[Scummvm-git-logs] scummvm master -> 969f7c99a0d06f7fefed99b4a1d2beaaf6e214d8
sev-
sev at scummvm.org
Thu Jun 28 23:54:41 CEST 2018
This automated email contains information about 294 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
280b249657 PINK: Initial commit
b3c656c6ed PINK: Implemented Sound Class
d058e5dfe6 PINK: moved game descriptions to detection_tables.h
5d1c4af5f6 PINK: Implemented MFC archive, some pink objects and their initialization
4ff13d64ba PINK: Added InventoryItem class
f8055bc206 PINK: split declaration and definition and some fixes
0f8768c5ad PINK: Added all classes in classMap
198710adac PINK: Implemented Page loading.
5cf3d0e309 PINK: Added LeadActor pointer field to WalkMgr
bccb294e6a PINK: Added missing include
1d97b960c5 PINK: Added missing field to WalkLocation class
6885bc2636 PINK: Added Sequencer, Sequence and SequenceItem
d6f0613adf PINK: Added SequenceItemLeader and SequenceItemDefaultAction
45458542da PINK: Added Handler and HandlerStartPage
f62132c4f3 PINK: Added SideEffect, SideEffectExit, SideEffectVariable, SideEffectModuleVariable and
113540b930 PINK: Implemented debug output of Objects
c87a392e16 PINK: More debug output of Objects attributes
fed63e22ec PINK: Added findSequence method to Sequencer
62f84eae96 PINK: Implemented SideEffectExit
3e2106a1c0 PINK: Added more Handler methods
b4d44d8ffc PINK: Added SequenceActorState and SequenceContext
d95e32782a PINK: Continue to develop Sequencer::authorSequence method
acbe2e8832 PINK: Added findActor method
d303144364 PINK: Added findAction method
7c4bcc033d PINK: implemented SideEffectModuleVariable fully
4d8bd5958f PINK: added setIdleAction to actor
f7c6830da9 PINK: added states to LeadActor
a49b399fbd PINK: implemented ActionHide completely
2e3e07b858 PINK: added some methods to Actor
ac0ed1dbdd PINK: implemented init of LeadActor and checking for state in LeadActor method
43c72bc2b7 PINK: added basic script implementation
824b3fa38e PINK: some fixes
467d3f1ab8 PINK: did a big file movement for better readability. Almost implemented
be415cd46f PINK: small fixes
eb6ce676e4 PINK: game page init fixes
8874ccb9de PINK: added debug information to actions
a22ebbb54e PINK: Handlers are implemented, beside handlerMgr, HandlerTimerSequences;
7facc7543f PINK: added random to methods which need it.
7f8f4dea2a PINK: added SeqTimer class
e856e0bd67 PINK: added SupportingActor and HandlerMgr
46d576d9ce PINK: added ActionLoop
05992bf95f PINK: Fixed wrong constant values
74437eee91 PINK: Again small fix for ActionLoop
636e226d73 PINK: added ActionTalk class
8671e8bee3 PINK: added ActionPlayWithSfx and ActionSfx
f29b0a8f35 PINK: added ActionText
72dd7fae8b PINK: fixed missing arguments
2b1bc0900a PINK: added CursorActor
f8de0028f2 PINK: added all missing objects to factory method. Unimplemented classes are commented out
7f5e2e69e8 PINK: added ParlSqPink and PubPink
26f2ff6640 PINK: added InventoryActor and SequenceAudio
bba35c5f2c PINK: Started implementation of Director class . For now engine can play logo scene, but sprites are at wrong positions
c6df869fec PINK: Basic implementation of CEL decoder. Fixed sprite positioning
0e39a87862 PINK: Implemented changing page and module, but without unloading old page. For now it can play logo of Wanderlust Inter
17c2bcfb94 PINK: fixed ActionSfx deserialization
c37bd09354 PINK: implemented drawing of transparent drawing, but it seems that original handles this a bit different.(intro of Peri
dbc709a140 PINK: fixes to get first game scene of Hokus Pokus loaded and hack for Peril intro sprite, which has wrong transparent c
7168242832 PINK: small fixes and implemented skipping of sequence by buttons
43a5e46ce2 PINK: added placeholders for remaining buttons
675f83256a PINK: added button to toggle Drawing of Bounding Rectangles
ea5cb3a60e PINK: implemented sequence restarting
48d34128b2 PINK: implemented skipping to last subsequence
896511c34a PINK: hacky implementation of SequenceAudio
e55839ff20 PINK: added restart method to SequenceAudio
37dbe057a8 PINK: fixed sideEffect and choosing of handler
a75aeb62ee PINK: fixes for Peril
f9c94a40a4 PINK: Implemented SequenceAudio as in original.
65eccb7ba7 PINK: added basic ActionLoop implementation
1a2bd666b0 PINK: added ActionPlayWithSfx implementation
5db9a45458 PINK: added ActionTalk implementation
475f6a62bd PINK: fixed some segfaults
e48ac17f68 PINK: small fixes
49d5ea28c0 PINK: added basic cursor implementation, fixed sequenceAudio restarting and skipping, fixed various mem leaks, hopefully
f6d620f683 PINK: fixed finding actor on screen
4b7c75607a PINK: added onMouseOver method to LeadActor
cad72b1532 PINK: basic walk, left click and seqTimer implementation
c29b1d1112 PINK: started inventory implementation
78c4ed85ab PINK: implemented page state saving
dac8d2a72b PINK: bugfixes and added basic inventory implementation
8c5bfed756 PINK: created constants for magic numbers, improved code in file
2f43cbafa0 PINK: moved more values to constants section
ec96a3b1e7 PINK: added check for item owner
888f5b668f PINK: added more constants
9f8356e52e PINK: fixed Inventory onClick method and other bugfixes
c9887c6151 PINK: added PDAButtonActor and AudioInfoPDAButton
ba29d37ccd PINK: fixed stopping sfx according to disasm
6f128e9146 PINK: added missing parameter in ActionPlayWithSfx::toConsole method;
52df3e15f8 PINK: removed unnecessary method call
ed3fce3267 PINK: fixed compilation error
604c74ab07 PINK: added missing cursor
181b89035a PINK: added implementation of item using
d83022b607 PINK: added implementation of mini-games (PubPink and ParlSqPink)
362db13d17 PINK: fixed SideEffectLocation
954ee72b87 PINK: fixed finding nullptr action
9364010e5e PINK: fixed setting action method
866b552eed PINK: changed static_cast to dynamic_cast
0d82a3062c PINK: added movement for picked item from inventory
84529c9177 PINK: fixed entering to Mucky Duck Pub
9cfa4970a2 PINK: fixed choosing item after getting it from click using other item
08d0652297 PINK: implemented stopFrame
c9e7c001ad PINK: fixed unstoppable talk animation
4ce6b3dbd2 PINK: fixed compilation errors
e11bc29abc PINK: increased buffer size (fixes crash in India Location)
a7ad5fe86a PINK: fixes crash on loading final scene of Passport to Peril(not tested)
7528c33224 PINK: updated description of engine. Passport to Peril is now fully playable*
0103b904a8 PINK: added missing include
23157a6450 PINK: fix for Pokus game
cdcb8f5ec6 PINK: changed size method to empty to improve readability
ab4980aa59 PINK: added basic implementation of HandlerTimerSequences just to make Hokus Pokus playable after Black Hole
d11115a6aa PINK: fixed finding of nullptr Actor
c1af0371ee PINK: fixed crash in Hokus Pokus
f03d5811ec PINK: updated status of engine
9566439683 PINK: fixed sprites which start playing with delay
f3ac46e887 PINK: renamed method parameters to appropriate names in Condition classes
d54c2a68cb PINK: fixed forward declaration
3411750a1c PINK: removed single-line function from SeqTimer
38ff5b1e80 PINK: remove bug from description
39ed15d2f7 PINK: fix includes
8733e54cd4 PINK: remove the use of auto variables
656ca285ac PINK: change size_t to uint
a45e58319d PINK: fix signed vs unsigned comparison
c32c642eba PINK: change _endFrame type from uint32 to int32
b89de53fb1 PINK: fix arguments in InventoryItem method
d8e42e7395 PINK: change hex to dec numbers
37574a3bcf PINK: remove >> << operators
c06452594f PINK: fix no newline warning
ea5c093410 PINK: remove lambda functions
931d6adbcb PINK: return deleted variable declaration by mistake
82974a9ce3 PINK: fix indentation
22e25ed890 PINK: fix module.mk
f6dd0f2f49 PINK: remove commas at the end of enumerator lists
d3d7a92800 PINK: fix compilation error
2bb2834782 PINK: fix compiler warning about UB
d7f09d4c3c PINK: remove extended initializer lists
e98c14c3d7 PINK: fix formatting
174b317fac PINK: fix formatting
65e899e723 PINK: fix finding of resource description
b82c0eee57 PINK: remove redundant Archive destructor
a8baeda59e PINK: change linear search to binary
de6932f771 PINK: fix letter case
1202988403 PINK: added streams getters to archive
ed3f9dcaa8 PINK: added methods to read/write Byte in archive
147904f53a PINK: add StringMap serialization
0b4c0b2bee PINK: add saving and loading state of sequencer
04a0c4ead6 PINK: add saving/loading state of WalkMgr
9b5dac452d PINK: add state saving/loading of Inventory
578b93af20 PINK: add state saving/loading of LeadActor
d6b1b9396e PINK: add state saving/loading of Module and GamePage
4f13df4828 PINK: add saving/loading of game.
1df85834a8 PINK: add improved pause support
fa96cc41f8 PINK: add RTL feature
6ba76faa33 PINK: fix disappearing cursor after exiting from GMM
90864279f4 PINK: fixes to save system
e7a7d6960d PINK: add savestate metadata support
11b5865b48 PINK: fix loading inventory save
80622943e4 PINK: prepare page interface to add PDAPage
001a08c91c PINK: fix deserializing of ActionText
11d2c1aa52 PINK: add missing cursor
9f23b4238c PINK: add Pokus World Book implementation
127e2fdf55 PINK: add PDAButtonActor(Pokus) implementation
a531381f2b PINK: change pause/unpause to pause method with parameter
b682ecb0ea PINK: refactor Actors to remove casts and improve readability
442f725a5d PINK: add loadTxt to ResourceMgr
da0adc92a2 PINK: reformat Action's code
4874ed50d2 PINK: implement exit from PDA
83799edcba PINK: reformat file's code
44efa90377 PINK: revised page initialization
f7693d3971 PINK: add proper implementation of Actor init function
4dd40b0f7b PINK: add saving/loading for PDA
bfd1b62063 PINK: change drawing method
fb8d8c1f57 PINK: remove redundant adding sprite to scene, which doesn't need to be drawn
a76d86a342 PINK: add check to startFrame because it can be greater than sprite's frames number
4fd0ec3ff7 PINK: fix ending of ActionCEL
cf04fb20c7 PINK: rework sound system
30b5c30ab2 PINK: fix accessing non-existent pixels
f11d331129 PINK: implement sound balance
0659ca4846 PINK: fix mem leaks
10f6e0a6b3 PINK: fix loading empty page from save
b9a5f84515 PINK: fix game page destruction after saving
5babed5790 PINK: fix playing looped sounds
078557a1ad PINK: fix condition of miniGame
ccd0ec7ffb PINK: inline one line archive functions; remove stream getters
58e7d560ee PINK: inline small functions
3ca2c13893 PINK: remove observing of looped sounds
2fb268b155 PINK: reworked sprite class(ActionCEL) and his inheritors.
471840514f PINK: fix determination of Actor by point
a37a7895db PINK: fix item moving
e0fa8fe171 PINK: fix ActionLoop Random
5282560ba1 PINK: fix drawing of some sprites after setting frame
02524d81c8 PINK: remove sprite unnecessary updating by another hack
a38a02d71c PINK: fix CEL rewinding
9db2368028 PINK: fix toConsole method
def6698164 PINK: add init method to InventoryActor
7b651e41c6 PINK: move the same code to functions(getInventoryMgr and getActorByPoint)
84af69cdf6 PINK: move same code to startInventory function
2c4336cd8c PINK: move the same code to function setReadyAfterWalk
cf8971ae45 PINK: implemented skipping of walk
b6658eb9a8 PINK: add soundSettings syncing
2c6ab1c775 PINK: fix inventory opening
ed25075146 PINK: rewrite onLeftButtonClick
60d423cabb PINK: implement AudioInfoManager
14cc810cef PINK: update engine description
d2218ad8cd PINK: Engine class code cleanup
1af15bf46b PINK: rework changing page routine
64bb3baab8 PINK: fix pausing when click on panther with empty inventory
4701cbd7d5 PINK: fix rewinding of CEL files which have 1 frame.
4af995079a PINK: fix playing looped ActionPlayWithSfx
e4402a90eb PINK: rework LeadActor states
bc4d32df8b PINK: file code cleanup
861ef3be97 PINK: rework CursorMgr
9b8d72bfb5 PINK: fix naming
4aa908860b PINK: add Hokus Pokus scripting system
07e1621ebc PINK: add missing objs to module.mk. Pointed by Henke37.
425e034bee PINK: add some debug output to simplify communication with testers
4879f7600c PINK: fix ActionTalk sound balance. Thanks Henke37 for bugreport
c4461cb4c3 PINK: fix playing of sprites which have incorrect stopFrame
b32af31601 PINK: fix updating cursor when mouse isn't moving
5f61d96bae PINK: rework InventoryMgr updating
99301a773f PINK: rework item changing in inventory
b1d516276a PINK: add missing cursor
0835b0fee1 PINK: fix SeqTimer updating when actor isn't found
cfc5538f95 PINK: fix skipping sequence
e2ac931ccb PINK: rework scripting system
fc57a96818 PINK: removed FPS counter
48a001648e PINK: remove hidden overloaded virtual function
103052fe15 PINK: fix compiler warning about mismatched declarations
6278ab72b4 PINK: fix compiler warning about string literal
6a2dc6fa0f PINK: remove unused variable
3134b2d230 PINK: fix wrong deleting of conflicting contexts
3143cc3f29 PINK: add saving/loading of parallel contexts
25a9e093c2 PINK: fix include statement
28a1ff7555 PINK: fix shadowing declarations
99416cb331 PINK: fix mismatched declarations
b670fba4c9 PINK: remove extra indentation
c139197930 PINK: Fix warning
5142ed203c PINK: JANITORIAL: Indentation fixes
c3e1157d18 PINK: JANITORIAL: More formatting fixes
a224e41edc PINK: JANITORIAL: More whitespace fixes
11df62d6fa PINK: JANITORIAL: Minor whitespace fixes
aa8849f123 PINK: Shut unused variables warnings
9c176c5702 PINK: Format 'else' statement oneliners
85e0c7ccd3 PINK: JANITORIAL: Indentation fixes
bb8a64d22d PINK: JANITORIAL: Fix code formatting
e9d1fa0c61 PINK: Allow running from original media
7e344abbd9 PINK: Added detection for English versions
6b6e38fa1d PINK: JANITORIAL: Fix indentation
0f2654fb0c PINK: Added detection for Russian versions
914ee715eb PINK: fix warning
96dbec0184 PINK: Added detection for Hebrew version
7803349271 PINK: Added French versions detection
3c07f9bf31 PINK: added Swedish vesions detection
4d847d83ed COMMON: Added Finnish language constants
8b43fe75bc PINK: Added Finnish and Spanish versions detection
9e08dc6537 PINK: Added Polish Pokus detection
9792e8651f PINK: Added detection for Portuguese versions of the games
8477a61d62 PINK: make comparison to character constants endianness independent
3e2c9b6bc2 PINK: fix updating cursor in some situations
a9c3826b0f PINK: added updating screen after setting cursor
ffcaf74b08 PINK: implement OnMouseOverWithItem for LeadActor
8516684b4a PINK: fixed MD5 of Swedish versions
60d2c3e2f2 PINK: fixed playing SequenceAudio with long songs
d0f0f41857 PINK: fixed clicking on empty part of screen
a8cbdba16f PINK: added commands to Console
9e920d9349 PINK: add commands to list and set game variables
ba161a9e25 PINK: added more debug commands
278e279e80 PINK: added commands to manipulate inventory
b379400e3b PINK: JANITORIAL: Fix formatting
db5f5e7b0d PINK: Added Polish Peril detection
42a649fd80 PINK: fix saving/loading
81f60be7c8 PINK: fixed playing last audio subsequence
c75e048d2c PINK: changed way of getting sample
e979dda822 PINK: removed readCount function
50bed2d544 PINK: updated engine description
ab44490673 PINK: remove using Timestamp. It doesn't work as intended.
633649398f PINK: added position recalculation of walking sprites
63fc5ad79b PINK: fix setting cursor with name which wasn't in disasm
be3e0148df PINK: removed unused include directives
7a6c8f70e6 PINK: removed unused functions
c5062e0f74 PINK: fixed loading WorldBook when clicking on inv window
2d8b2be6c5 PINK: rework setItemOwner method
0f596eb69a PINK: updated engine description
8cbdc4b63f PINK: renamed method of SequenceContext
f7679c6c9b PINK: Do not drop language on target generation during autodetection
8ad0f02b41 PINK: Properly generate save names
41d3d1ee75 PINK: Fix compilation
8293b97e76 PINK: Fix savegame detection
98e7bdee4b PINK: move save/load engine functions to separate file
8a606ed8a8 PINK: added undef of macros
feb3fde1cf PINK: JANITORIAL: formatting fixes
55f011ec89 PINK: added a bit more explanatory commentary
40488c8b22 PINK: JANITORIAL: more formatting fixes
e25a9cabb4 PINK: rework getting length between locations
9c80037c8a PINK: rework writing save header
969f7c99a0 PINK: added loading/saving of AudioInfoMgr
Commit: 280b24965708d7db3066bad06a4115d52cfacf31
https://github.com/scummvm/scummvm/commit/280b24965708d7db3066bad06a4115d52cfacf31
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Initial commit
Implemented skeleton of engine, detection, broFile and started orbFile
implementation.
Changed paths:
A engines/pink/configure.engine
A engines/pink/console.h
A engines/pink/detection.cpp
A engines/pink/file.cpp
A engines/pink/file.h
A engines/pink/module.mk
A engines/pink/pink.cpp
A engines/pink/pink.h
diff --git a/engines/pink/configure.engine b/engines/pink/configure.engine
new file mode 100644
index 0000000..80a2df6
--- /dev/null
+++ b/engines/pink/configure.engine
@@ -0,0 +1,3 @@
+# This file is included from the main "configure" script
+# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
+add_engine pink "Pink Panther" no "" "" ""
diff --git a/engines/pink/console.h b/engines/pink/console.h
new file mode 100644
index 0000000..03f4882
--- /dev/null
+++ b/engines/pink/console.h
@@ -0,0 +1,41 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*
+*/
+
+#ifndef PINK_CONSOLE_H
+#define PINK_CONSOLE_H
+
+#include "gui/debugger.h"
+
+namespace Pink {
+
+class PinkEngine;
+
+class Console : public GUI::Debugger {
+public:
+ Console(PinkEngine *vm) {}
+
+ virtual ~Console(void) {}
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/detection.cpp b/engines/pink/detection.cpp
new file mode 100644
index 0000000..16b289b
--- /dev/null
+++ b/engines/pink/detection.cpp
@@ -0,0 +1,96 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include <gui/EventRecorder.h>
+#include "pink.h"
+
+static const PlainGameDescriptor pinkGames[] = {
+ {"peril", "The Pink Panther: Passport to Peril"},
+ {"pokus", "The Pink Panther: Hokus Pokus Pink"},
+ {0, 0}
+};
+
+namespace Pink {
+
+static const ADGameDescription gameDescriptions[] = {
+ {
+ "peril",
+ 0,{
+ {"PPTP.ORB", NULL, NULL, -1},
+ {"PPTP.BRO", NULL, NULL, -1},
+ AD_LISTEND},
+ Common::RU_RUS,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NONE)
+ },
+
+ {
+ "peril",
+ 0,
+ AD_ENTRY1s("hpp.ORB", NULL, -1),
+ Common::RU_RUS,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NONE)
+ },
+ AD_TABLE_END_MARKER
+};
+
+} // End of namespace Pink
+
+
+class PinkMetaEngine : public AdvancedMetaEngine {
+public:
+ PinkMetaEngine() : AdvancedMetaEngine(Pink::gameDescriptions, sizeof(ADGameDescription), pinkGames) {
+ _gameIds = pinkGames;
+ }
+
+ virtual const char *getName() const {
+ return "Pink Panther Engine";
+ }
+
+ virtual const char *getOriginalCopyright() const {
+ return "Pink Panther Engine (C) Wanderlust Interactive";
+ }
+
+ //virtual bool hasFeature(MetaEngineFeature f) const;
+ //virtual int getMaximumSaveSlot() const { return 0; }
+ //virtual SaveStateList listSaves(const char *target) const;
+ //virtual void removeSaveState(const char *target, int slot) const;
+ //virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const;
+ virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
+};
+
+bool PinkMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
+ if (desc) {
+ *engine = new Pink::PinkEngine(syst, desc);
+ }
+
+ return desc != 0;
+}
+
+#if PLUGIN_ENABLED_DYNAMIC(PINK)
+REGISTER_PLUGIN_DYNAMIC(PINK, PLUGIN_TYPE_ENGINE, PinkMetaEngine);
+#else
+REGISTER_PLUGIN_STATIC(PINK, PLUGIN_TYPE_ENGINE, PinkMetaEngine);
+#endif
diff --git a/engines/pink/file.cpp b/engines/pink/file.cpp
new file mode 100644
index 0000000..5bcd8cc
--- /dev/null
+++ b/engines/pink/file.cpp
@@ -0,0 +1,120 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include <common/str.h>
+#include "pink.h"
+
+namespace Pink {
+
+OrbFile::OrbFile()
+ : File(), _timestamp(0),
+ _tableOffset(0),
+ _tableSize(0),
+ _table(nullptr)
+{}
+
+OrbFile::~OrbFile() {
+ delete[] _table;
+}
+
+bool OrbFile::open(Common::String &name) {
+ if (!File::open(name))
+ return false;
+
+ if (readUint32BE() != 'ORB\0'){
+ close();
+ return false;
+ }
+
+ uint16 minor = readUint16LE();
+ uint16 major = readUint16LE();
+ //output
+ if (minor || major != 2){
+ return false;
+ }
+
+ _timestamp = readUint32LE();
+ if (!_timestamp){
+ return false;
+ }
+ //convert to date
+ //output into debug
+
+ _tableOffset = readUint32LE();
+ _tableSize = readUint32LE();
+ _table = new ObjectDescription[_tableSize];
+
+ for (size_t i = 0; i < _tableSize; ++i) {
+ _table[i].deserialize(*this);
+ }
+
+ return true;
+}
+
+void OrbFile::LoadGame(PinkEngine *game) {
+
+}
+
+void OrbFile::LoadObject(void *obj, Common::String &name) {
+
+}
+
+uint32 OrbFile::getTimestamp() {
+ return _timestamp;
+}
+
+bool BroFile::open(Common::String &name, uint32 orbTimestamp) {
+ if (!File::open(name) || readUint32BE() != 'BRO\0')
+ return false;
+
+ uint16 minor = readUint16LE();
+ uint16 major = readUint16LE();
+ // do output
+
+ if (minor || major != 1){
+ return false;
+ }
+
+ uint32 _timestamp = readUint32LE();
+
+ return _timestamp == orbTimestamp;
+}
+
+void ObjectDescription::deserialize(Common::File &file) {
+ file.read(name, sizeof(name));
+ file.read(&objectsOffset, sizeof(objectsOffset));
+ file.read(&objectsCount, sizeof(objectsCount));
+ file.read(&resourcesOffset, sizeof(resourcesOffset));
+ file.read(&resourcesCount, sizeof(resourcesCount));
+}
+
+void ResourseDescription::deserialize(Common::File &file) {
+ file.read(name, sizeof(name));
+ file.read(&offset, sizeof(offset));
+ file.read(&size, sizeof(offset));
+
+ uint16 temp;
+ file.read(&temp, sizeof(temp));
+ InBro = temp ? true : false;
+}
+
+} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/file.h b/engines/pink/file.h
new file mode 100644
index 0000000..64e3782
--- /dev/null
+++ b/engines/pink/file.h
@@ -0,0 +1,81 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_FILE_H
+#define PINK_FILE_H
+
+#include <common/file.h>
+
+namespace Pink {
+
+struct ObjectDescription {
+ void deserialize(Common::File &file);
+
+ char name[16];
+ uint32 objectsOffset;
+ uint32 objectsCount;
+ uint32 resourcesOffset;
+ uint32 resourcesCount;
+};
+
+struct ResourseDescription {
+ void deserialize(Common::File &file);
+
+ char name[16];
+ uint32 offset;
+ uint32 size;
+ bool InBro; // in original it is short.
+ // Don't know what's better to use.(Perhaps no diffrence because of padding)
+};
+
+class PinkEngine;
+
+class OrbFile : public Common::File {
+public:
+ OrbFile();
+ virtual ~OrbFile();
+
+ virtual bool open(Common::String &name);
+
+ void LoadGame(PinkEngine *game);
+ void LoadObject(void *obj, Common::String &name);
+
+ uint32 getTimestamp();
+
+private:
+ uint32 _timestamp;
+ uint32 _tableOffset;
+ uint32 _tableSize;
+ ObjectDescription *_table;
+};
+
+class BroFile : public Common::File {
+public:
+ BroFile() = default;
+ virtual ~BroFile() = default;
+
+ virtual bool open(Common::String &name, uint32 orbId);
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/module.mk b/engines/pink/module.mk
new file mode 100644
index 0000000..754c957
--- /dev/null
+++ b/engines/pink/module.mk
@@ -0,0 +1,18 @@
+MODULE := engines/pink
+
+MODULE_OBJS = \
+ pink.o \
+ console.o \
+ detection.o \
+ director.o \
+ sound.o \
+ file.o \
+
+
+# This module can be built as a plugin
+ifeq ($(ENABLE_PLUMBERS), DYNAMIC_PLUGIN)
+PLUGIN := 1
+endif
+
+# Include common rules
+include $(srcdir)/rules.mk
\ No newline at end of file
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
new file mode 100644
index 0000000..f45afbb
--- /dev/null
+++ b/engines/pink/pink.cpp
@@ -0,0 +1,103 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "pink.h"
+#include "console.h"
+#include <audio/mixer.h>
+#include <engines/util.h>
+
+namespace Pink {
+
+Pink::PinkEngine::PinkEngine(OSystem *system, const ADGameDescription *desc)
+ : Engine(system), _rnd("pink"), _desc(*desc),
+ _bro(nullptr)
+{
+ /* TODO
+ * setup debug channels
+ *
+ */
+}
+
+Pink::PinkEngine::~PinkEngine() {
+ delete _console;
+ delete _bro;
+}
+
+Common::Error PinkEngine::init() {
+ initGraphics(640, 480);
+
+ _console = new Console(this);
+
+ if (_desc.filesDescriptions[1].fileName){
+ _bro = new BroFile();
+ }
+
+ Common::String orbName = _desc.filesDescriptions[0].fileName;
+ Common::String broName = _desc.filesDescriptions[1].fileName;
+
+ if (!_orb.open(orbName) || (_bro && !_bro->open(broName, _orb.getTimestamp()))){
+ return Common::kNoGameDataFoundError;
+ }
+
+ return Common::kNoError;
+}
+
+Common::Error Pink::PinkEngine::run() {
+ Common::Error error = init();
+ if (error.getCode() != Common::kNoError){
+ return error;
+ }
+
+ while(!shouldQuit()){
+ Common::Event event;
+ while(_eventMan->pollEvent(event)){
+ switch (event.type){
+ case Common::EVENT_QUIT:
+ case Common::EVENT_RTL:
+
+ return Common::kNoError;
+ case Common::EVENT_MOUSEMOVE:
+
+ break;
+ case Common::EVENT_LBUTTONDOWN:
+
+ break;
+
+ // don't know why it is used in orginal
+ case Common::EVENT_LBUTTONUP:
+ case Common::EVENT_RBUTTONDOWN:
+ case Common::EVENT_KEYDOWN:
+ break;
+ default:
+ break;
+ }
+ }
+ //update();
+ g_system->updateScreen();
+ g_system->delayMillis(10);
+ }
+
+
+ return Common::kNoError;
+}
+
+}
\ No newline at end of file
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
new file mode 100644
index 0000000..7f9d39e
--- /dev/null
+++ b/engines/pink/pink.h
@@ -0,0 +1,84 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_PINK_H
+#define PINK_PINK_H
+
+#include "common/random.h"
+#include "engines/engine.h"
+#include "gui/EventRecorder.h"
+#include "gui/debugger.h"
+#include "file.h"
+
+
+/*
+ * This is the namespace of the Pink engine.
+ *
+ * Status of this engine: In Development
+ *
+ * Internal name of original name: OxCart Runtime
+ *
+ * Games using this engine:
+ * - The Pink Panther: Passport to Peril
+ * - The Pink Panther: Hokus Pokus Pink
+ */
+
+namespace Pink {
+
+class Console;
+
+enum {
+ kPinkDebugGeneral = 1 << 0,
+ kPinkDebugLoading = 1 << 1,
+ kPinkDebugSound = 1 << 2
+};
+
+class PinkEngine : public Engine {
+
+public:
+ PinkEngine(OSystem *system, const ADGameDescription *desc);
+
+ ~PinkEngine();
+
+ virtual Common::Error run();
+
+private:
+ Common::Error init();
+
+ void handleEvent(Common::Event &event);
+ void update();
+
+ Console *_console;
+ Common::RandomSource _rnd;
+
+ Common::String _nextModule;
+ Common::String _nextPage;
+
+ OrbFile _orb;
+ BroFile *_bro;
+
+ const ADGameDescription _desc;
+};
+
+} // End of namespace Pink
+
+#endif
\ No newline at end of file
Commit: b3c656c6ed04b14e5e6ab2c938e9df6fe9dfe191
https://github.com/scummvm/scummvm/commit/b3c656c6ed04b14e5e6ab2c938e9df6fe9dfe191
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Implemented Sound Class
Changed paths:
A engines/pink/sound.cpp
A engines/pink/sound.h
diff --git a/engines/pink/sound.cpp b/engines/pink/sound.cpp
new file mode 100644
index 0000000..bdc41c8
--- /dev/null
+++ b/engines/pink/sound.cpp
@@ -0,0 +1,100 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include <audio/audiostream.h>
+#include <audio/decoders/wave.h>
+#include <audio/decoders/adpcm.h>
+#include "sound.h"
+
+namespace Pink {
+
+Sound::Sound(Audio::Mixer *mixer, AudioFormat format, Common::SeekableReadStream *stream)
+ : _mixer(mixer)
+{
+ load(format, stream);
+}
+
+Sound::~Sound() {
+ //look for mem leak
+ stop();
+}
+
+bool Sound::isPlaying() {
+ return _mixer->isSoundHandleActive(_handle);
+
+}
+
+void Sound::pause() {
+ _mixer->pauseHandle(_handle, true);
+}
+
+void Sound::resume() {
+ _mixer->pauseHandle(_handle, false);
+}
+
+void Sound::stop() {
+ _mixer->stopHandle(_handle);
+}
+
+void Sound::play(Audio::Mixer::SoundType type, int volume, bool isLoop) {
+ _mixer->stopHandle(_handle);
+
+ if (isLoop) {
+ //bad impl?
+ Audio::SeekableAudioStream *seekableStream = dynamic_cast<Audio::SeekableAudioStream*>(_stream);
+ _stream = Audio::makeLoopingAudioStream(seekableStream, 0, 0, 0);
+ }
+
+ _mixer->playStream(type, &_handle ,_stream);
+}
+
+bool Sound::load(AudioFormat format, Common::SeekableReadStream *stream) {
+ //may be mem leak
+
+ // checked vox files in hex editor and they have WAVEfmt .
+ // It seems strange for me
+ // linux file says wav and vox are
+ // RIFF (little-endian) data, WAVE audio, Microsoft PCM, 8 bit, mono 22050 Hz
+
+ switch (format){
+ case AudioFormat::kWAV:
+ _stream = Audio::makeWAVStream(stream, DisposeAfterUse::NO);
+ break;
+ case AudioFormat::kVOX:
+ //TODO
+ // check for last arg; nBlockAlign(1, 4 or other)
+ _stream = Audio::makeADPCMStream(stream, DisposeAfterUse::NO, 0, Audio::kADPCMOki, 22050, 1, 0);
+ break;
+ }
+
+ return isLoaded();
+}
+
+bool Sound::isLoaded() {
+ return _stream != nullptr;
+}
+
+void Sound::setBalance(int8 balance) {
+ _mixer->setChannelBalance(_handle, balance);
+}
+
+} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/sound.h b/engines/pink/sound.h
new file mode 100644
index 0000000..7b60745
--- /dev/null
+++ b/engines/pink/sound.h
@@ -0,0 +1,64 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_SOUND_H
+#define PINK_SOUND_H
+
+#include <common/stream.h>
+#include <audio/mixer.h>
+
+namespace Pink {
+
+enum class AudioFormat{kWAV, kVOX};
+
+/*TODO
+ from disasm foreground 100 %, background 80 %
+ dont know how to properly do it
+ may be use ConfMan
+*/
+
+class Sound {
+public:
+ Sound(Audio::Mixer *mixer, AudioFormat format, Common::SeekableReadStream *stream);
+ ~Sound();
+
+ bool load(AudioFormat format, Common::SeekableReadStream *stream);
+ void play(Audio::Mixer::SoundType type, int volume, bool isLoop);
+
+ bool isLoaded();
+ bool isPlaying();
+
+ void pause();
+ void resume();
+ void stop();
+
+ void setBalance(int8 balance);
+
+private:
+ Audio::Mixer *_mixer;
+ Audio::AudioStream *_stream;
+ Audio::SoundHandle _handle;
+};
+
+} // End of namespace Pink
+
+#endif
Commit: d058e5dfe6b146373ce89c5710b6e723de687da5
https://github.com/scummvm/scummvm/commit/d058e5dfe6b146373ce89c5710b6e723de687da5
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: moved game descriptions to detection_tables.h
Changed paths:
A engines/pink/detection_tables.h
engines/pink/detection.cpp
diff --git a/engines/pink/detection.cpp b/engines/pink/detection.cpp
index 16b289b..d3a7a08 100644
--- a/engines/pink/detection.cpp
+++ b/engines/pink/detection.cpp
@@ -23,41 +23,14 @@
#include <gui/EventRecorder.h>
#include "pink.h"
+
static const PlainGameDescriptor pinkGames[] = {
{"peril", "The Pink Panther: Passport to Peril"},
{"pokus", "The Pink Panther: Hokus Pokus Pink"},
{0, 0}
};
-namespace Pink {
-
-static const ADGameDescription gameDescriptions[] = {
- {
- "peril",
- 0,{
- {"PPTP.ORB", NULL, NULL, -1},
- {"PPTP.BRO", NULL, NULL, -1},
- AD_LISTEND},
- Common::RU_RUS,
- Common::kPlatformWindows,
- ADGF_UNSTABLE,
- GUIO1(GUIO_NONE)
- },
-
- {
- "peril",
- 0,
- AD_ENTRY1s("hpp.ORB", NULL, -1),
- Common::RU_RUS,
- Common::kPlatformWindows,
- ADGF_UNSTABLE,
- GUIO1(GUIO_NONE)
- },
- AD_TABLE_END_MARKER
-};
-
-} // End of namespace Pink
-
+#include "detection_tables.h"
class PinkMetaEngine : public AdvancedMetaEngine {
public:
diff --git a/engines/pink/detection_tables.h b/engines/pink/detection_tables.h
new file mode 100644
index 0000000..b14803b
--- /dev/null
+++ b/engines/pink/detection_tables.h
@@ -0,0 +1,56 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_DETECTION_TABLES_H
+#define PINK_DETECTION_TABLES_H
+
+#include <gui/EventRecorder.h>
+
+namespace Pink {
+
+static const ADGameDescription gameDescriptions[] = {
+ {
+ "peril",
+ 0,{
+ {"PPTP.ORB", NULL, NULL, -1},
+ {"PPTP.BRO", NULL, NULL, -1},
+ AD_LISTEND},
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NONE)
+ },
+ {
+ "pokus",
+ 0,
+ AD_ENTRY1s("hpp.ORB", NULL, -1),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NONE)
+ },
+ AD_TABLE_END_MARKER
+};
+
+} // End of namespace Pink
+
+#endif
Commit: 5d1c4af5f6b1f197eb4c3af7dbc05b591047406d
https://github.com/scummvm/scummvm/commit/5d1c4af5f6b1f197eb4c3af7dbc05b591047406d
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Implemented MFC archive, some pink objects and their initialization
Thanks fullpipe engine developer for MFC archive
Changed paths:
A engines/pink/archive.cpp
A engines/pink/archive.h
A engines/pink/director.cpp
A engines/pink/director.h
A engines/pink/objects/inventory.h
A engines/pink/objects/module.cpp
A engines/pink/objects/module.h
A engines/pink/objects/named_object.h
A engines/pink/objects/object.h
A engines/pink/objects/page.h
A engines/pink/resource_mgr.cpp
A engines/pink/resource_mgr.h
A engines/pink/utils.h
engines/pink/file.cpp
engines/pink/file.h
engines/pink/module.mk
engines/pink/pink.cpp
engines/pink/pink.h
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp
new file mode 100644
index 0000000..ab6ab78
--- /dev/null
+++ b/engines/pink/archive.cpp
@@ -0,0 +1,213 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include <common/debug.h>
+#include <common/file.h>
+#include "objects/module.h"
+#include "objects/page.h"
+
+namespace Pink {
+
+enum {
+ kMaxClassLength = 32,
+ kMaxStringLength = 64, // adjust
+ kNullObject = 0
+};
+
+
+enum {
+ kActionHide,
+ kActionLoop,
+ kActionPlay,
+ kActionPlayWithSfx,
+ kActionSfx,
+ kActionSound,
+ kActionStill,
+ kActionTalk,
+ kActionText,
+ kActor,
+ kAudioInfoPDAButton,
+ kConditionGameVariable,
+ kConditionInventoryItemOwner,
+ kConditionModuleVariable,
+ kConditionNotInventoryItemOwner,
+ kConditionNotModuleVariable,
+ kConditionNotPageVariable,
+ kConditionPageVariable,
+ kCursorActor,
+ kGamePage,
+ kHandlerLeftClick,
+ kHandlerStartPage,
+ kHandlerTimer,
+ kHandlerUseClick,
+ kInventoryActor,
+ kInventoryItem,
+ kLeadActor,
+ kModuleProxy,
+ kPDAButtonActor,
+ kParlSqPink,
+ kPubPink,
+ kSeqTimer,
+ kSequence,
+ kSequenceAudio,
+ kSequenceItem,
+ kSequenceItemDefaultAction,
+ kSequenceItemLeader,
+ kSequenceItemLeaderAudio,
+ kSideEffectExit,
+ kSideEffectGameVariable,
+ kSideEffectInventoryItemOwner,
+ kSideEffectLocation,
+ kSideEffectModuleVariable,
+ kSideEffectPageVariable,
+ kSideEffectRandomPageVariable,
+ kSupportingActor,
+ kWalkAction,
+ kWalkLocation
+};
+
+static const struct RuntimeClass {
+ const char *name;
+ int id;
+} classMap[] = {
+ {"GamePage", kGamePage},
+ {"ModuleProxy", kModuleProxy}
+};
+
+static Object* createObject(int objectId){
+ switch (objectId){
+ case kGamePage:
+ return new GamePage();
+ case kModuleProxy:
+ return new ModuleProxy();
+ default:
+ return nullptr;
+ }
+}
+
+
+Archive::Archive(Common::File &file)
+ : _file(file)
+{
+ debug("Archive created");
+ _objectMap.push_back(0);
+ _objectIdMap.push_back(kNullObject);
+}
+
+Archive::~Archive()
+{
+ debug("Archive destroyed");
+}
+
+void Archive::mapObject(Object *obj) {
+ _objectMap.push_back(obj); // Basically a hack, but behavior is all correct
+ _objectIdMap.push_back(0);
+}
+
+int Archive::readCount() {
+ int count = _file.readUint16LE();
+
+ if (count == 0xffff)
+ count = _file.readUint32LE();
+
+ return count;
+}
+
+Object *Archive::readObject() {
+ bool isCopyReturned;
+ Object *res = parseObject(isCopyReturned);
+
+ if (res && !isCopyReturned)
+ res->deserialize(*this);
+
+ return res;
+}
+
+Object *Archive::parseObject(bool &isCopyReturned) {
+ char className[kMaxClassLength];
+ int objectId = 0;
+ Object *res = 0;
+
+ uint obTag = _file.readUint16LE();
+
+ if (obTag == 0x0000) {
+ return nullptr;
+ } else if (obTag == 0xffff) {
+ int schema = _file.readUint16LE();
+
+ int size = _file.readUint16LE();
+ _file.read(className, size);
+ className[size] = '\0';
+
+ objectId = findObjectId(className + 1);
+
+ res = createObject(objectId);
+ _objectMap.push_back(res);
+ _objectIdMap.push_back(objectId);
+
+ //_objectMap.push_back(res); // Basically a hack, but behavior is all correct
+ //_objectIdMap.push_back(objectId);
+
+ isCopyReturned = false;
+ } else if ((obTag & 0x8000) == 0) {
+
+ res = _objectMap[obTag];
+
+ isCopyReturned = true;
+ } else {
+
+ obTag &= ~0x8000;
+
+ objectId = _objectIdMap[obTag];
+
+ res = createObject(objectId);
+ _objectMap.push_back(res);
+ _objectIdMap.push_back(objectId);
+
+ isCopyReturned = false;
+ }
+
+ return res;
+}
+
+uint Archive::findObjectId(const char *name) {
+ RuntimeClass * found = static_cast<RuntimeClass*>
+ (bsearch(name, classMap, sizeof(classMap) / sizeof(RuntimeClass) , sizeof(RuntimeClass), [] (const void *a, const void *b) {
+ return strcmp((const char *) a, *(const char **) b);
+ }));
+
+ if (!found)
+ error("Class %s is not implemented", name);
+
+ return found->id;
+}
+
+Common::String Archive::readString() {
+ char buffer[kMaxStringLength]; // test and lower then
+ byte len = _file.readByte();
+ _file.read(buffer, len);
+ return Common::String(buffer, len);
+}
+
+} // End of namespace Pink
+
+
diff --git a/engines/pink/archive.h b/engines/pink/archive.h
new file mode 100644
index 0000000..6971b0f
--- /dev/null
+++ b/engines/pink/archive.h
@@ -0,0 +1,80 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_ARCHIVE_H
+#define PINK_ARCHIVE_H
+
+#include <common/array.h>
+#include <engines/pink/objects/object.h>
+
+namespace Common {
+
+class File;
+
+}
+
+namespace Pink {
+
+class Archive {
+public:
+ Archive(Common::File &file);
+ ~Archive();
+
+ void mapObject(Object *obj);
+ int readCount();
+ Object *readObject();
+ Common::String readString();
+
+private:
+ uint findObjectId(const char *name);
+
+ Object *parseObject(bool &isCopyReturned);
+
+ Common::Array<Object *> _objectMap;
+ Common::Array<uint> _objectIdMap;
+ Common::File &_file;
+};
+
+template <typename T>
+inline Archive &operator>>(Archive &archive, Common::Array<T> &arr){
+ uint size = archive.readCount();
+ arr.resize(size);
+ for (uint i = 0; i < size; ++i) {
+ arr[i] = reinterpret_cast<T> (archive.readObject()); // hack; doesn't know better approach
+ }
+ return archive;
+}
+
+template <typename T>
+inline Archive &operator>>(Archive &archive, Object &obj){
+ obj.load(archive);
+ return archive;
+}
+
+inline Archive &operator>>(Archive &archive, Common::String &string){
+ string = archive.readString();
+ return archive;
+}
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/director.cpp b/engines/pink/director.cpp
new file mode 100644
index 0000000..e34e0bc
--- /dev/null
+++ b/engines/pink/director.cpp
@@ -0,0 +1,26 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+namespace Pink {
+
+
+}
\ No newline at end of file
diff --git a/engines/pink/director.h b/engines/pink/director.h
new file mode 100644
index 0000000..8821649
--- /dev/null
+++ b/engines/pink/director.h
@@ -0,0 +1,41 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_DIRECTOR_H
+#define PINK_DIRECTOR_H
+
+namespace Pink {
+
+class Director {
+public:
+ //void addSoundObject();
+ //void removeSound();
+ //void updateSoundAction
+ //CActor *getActorByCoords();
+private:
+
+};
+
+} // End of namespace Pink
+
+
+#endif
diff --git a/engines/pink/file.cpp b/engines/pink/file.cpp
index 5bcd8cc..38df98d 100644
--- a/engines/pink/file.cpp
+++ b/engines/pink/file.cpp
@@ -21,6 +21,7 @@
*/
#include <common/str.h>
+#include "objects/page.h"
#include "pink.h"
namespace Pink {
@@ -30,13 +31,18 @@ OrbFile::OrbFile()
_tableOffset(0),
_tableSize(0),
_table(nullptr)
-{}
+{
+ debug("Object Description size: %u", sizeof(ObjectDescription));
+ debug("Resource Description size: %u", sizeof(ResourceDescription));
+ debug("OrbFile size: %lu", sizeof(OrbFile));
+ debug("BroFile size: %lu", sizeof(BroFile));
+}
OrbFile::~OrbFile() {
delete[] _table;
}
-bool OrbFile::open(Common::String &name) {
+bool OrbFile::open(const Common::String &name) {
if (!File::open(name))
return false;
@@ -47,7 +53,9 @@ bool OrbFile::open(Common::String &name) {
uint16 minor = readUint16LE();
uint16 major = readUint16LE();
- //output
+
+ debug("Orb v%hu.%hu loaded", major, minor);
+
if (minor || major != 2){
return false;
}
@@ -56,39 +64,83 @@ bool OrbFile::open(Common::String &name) {
if (!_timestamp){
return false;
}
- //convert to date
- //output into debug
_tableOffset = readUint32LE();
_tableSize = readUint32LE();
_table = new ObjectDescription[_tableSize];
+ debug("Orb has %u object descriptions", _tableSize);
+
+ seek(_tableOffset);
+
for (size_t i = 0; i < _tableSize; ++i) {
- _table[i].deserialize(*this);
+ _table[i].load(*this);
+ debug("Object description %s loaded", _table[i].name);
}
return true;
}
-void OrbFile::LoadGame(PinkEngine *game) {
+void OrbFile::loadGame(PinkEngine *game) {
+ seekToObject("PinkGame");
+ Archive archive(*this);
+ archive.mapObject((Object *) game); // hack
+
+ game->load(archive);
}
-void OrbFile::LoadObject(void *obj, Common::String &name) {
+void OrbFile::loadObject(Object *obj, const Common::String &name) {
+ seekToObject(name.c_str());
+ Archive archive(*this);
+ obj->load(archive);
+}
+void OrbFile::loadObject(Object *obj, ObjectDescription *objDesc) {
+ seek(objDesc->objectsOffset);
+ Archive archive(*this);
+ obj->load(archive);
}
+
uint32 OrbFile::getTimestamp() {
return _timestamp;
}
+void OrbFile::seekToObject(const char *name) {
+ ObjectDescription *desc = getObjDesc(name);
+ seek(desc->objectsOffset);
+}
+
+
+ObjectDescription *OrbFile::getObjDesc(const char *name){
+ ObjectDescription *desc = static_cast<ObjectDescription*>(bsearch(name, _table, _tableSize, sizeof(ObjectDescription),
+ [] (const void *a, const void *b) {
+ return scumm_stricmp((char *) a, (char *) b); }));
+ assert(desc != nullptr);
+ return desc;
+}
+
+ResourceDescription *OrbFile::getResDescTable(ObjectDescription *objDesc){
+ const uint32 size = objDesc->objectsCount;
+ ResourceDescription *table = new ResourceDescription[size];
+
+ for (uint i = 0; i < size; ++i) {
+ table[i].load(*this);
+ }
+
+ return table;
+}
+
+
bool BroFile::open(Common::String &name, uint32 orbTimestamp) {
if (!File::open(name) || readUint32BE() != 'BRO\0')
return false;
uint16 minor = readUint16LE();
uint16 major = readUint16LE();
- // do output
+
+ debug("Bro v%hu.%hu loaded", major, minor);
if (minor || major != 1){
return false;
@@ -99,7 +151,7 @@ bool BroFile::open(Common::String &name, uint32 orbTimestamp) {
return _timestamp == orbTimestamp;
}
-void ObjectDescription::deserialize(Common::File &file) {
+void ObjectDescription::load(Common::File &file) {
file.read(name, sizeof(name));
file.read(&objectsOffset, sizeof(objectsOffset));
file.read(&objectsCount, sizeof(objectsCount));
@@ -107,7 +159,7 @@ void ObjectDescription::deserialize(Common::File &file) {
file.read(&resourcesCount, sizeof(resourcesCount));
}
-void ResourseDescription::deserialize(Common::File &file) {
+void ResourceDescription::load(Common::File &file) {
file.read(name, sizeof(name));
file.read(&offset, sizeof(offset));
file.read(&size, sizeof(offset));
diff --git a/engines/pink/file.h b/engines/pink/file.h
index 64e3782..2b1d7cb 100644
--- a/engines/pink/file.h
+++ b/engines/pink/file.h
@@ -24,11 +24,12 @@
#define PINK_FILE_H
#include <common/file.h>
+#include "sound.h"
namespace Pink {
struct ObjectDescription {
- void deserialize(Common::File &file);
+ void load(Common::File &file);
char name[16];
uint32 objectsOffset;
@@ -37,8 +38,8 @@ struct ObjectDescription {
uint32 resourcesCount;
};
-struct ResourseDescription {
- void deserialize(Common::File &file);
+struct ResourceDescription {
+ void load(Common::File &file);
char name[16];
uint32 offset;
@@ -48,20 +49,27 @@ struct ResourseDescription {
};
class PinkEngine;
+class Object;
class OrbFile : public Common::File {
public:
OrbFile();
virtual ~OrbFile();
- virtual bool open(Common::String &name);
+ virtual bool open(const Common::String &name);
- void LoadGame(PinkEngine *game);
- void LoadObject(void *obj, Common::String &name);
+ void loadGame(PinkEngine *game);
+ void loadObject(Object *obj, const Common::String &name);
+ void loadObject(Object *obj, ObjectDescription *objDesc);
+
+ ObjectDescription *getObjDesc(const char *name);
+ ResourceDescription *getResDescTable(ObjectDescription *objDesc);
uint32 getTimestamp();
private:
+ void seekToObject(const char * name);
+
uint32 _timestamp;
uint32 _tableOffset;
uint32 _tableSize;
@@ -73,7 +81,7 @@ public:
BroFile() = default;
virtual ~BroFile() = default;
- virtual bool open(Common::String &name, uint32 orbId);
+ virtual bool open(Common::String &name, uint32 orbTimestamp);
};
} // End of namespace Pink
diff --git a/engines/pink/module.mk b/engines/pink/module.mk
index 754c957..a29b18a 100644
--- a/engines/pink/module.mk
+++ b/engines/pink/module.mk
@@ -7,6 +7,9 @@ MODULE_OBJS = \
director.o \
sound.o \
file.o \
+ archive.o \
+ objects/object.o \
+ objects/module.o \
# This module can be built as a plugin
diff --git a/engines/pink/objects/inventory.h b/engines/pink/objects/inventory.h
new file mode 100644
index 0000000..8827b4a
--- /dev/null
+++ b/engines/pink/objects/inventory.h
@@ -0,0 +1,40 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_INVENTORY_H
+#define PINK_INVENTORY_H
+
+#include "object.h"
+
+namespace Pink {
+
+ class InventoryMgr : public Object{
+ public:
+
+ private:
+ // array of inv items
+ // other fields. haven't RE them yet
+ };
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/objects/module.cpp b/engines/pink/objects/module.cpp
new file mode 100644
index 0000000..3d33c16
--- /dev/null
+++ b/engines/pink/objects/module.cpp
@@ -0,0 +1,90 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "module.h"
+#include "page.h"
+
+namespace Pink {
+
+
+void Module::deserialize(Archive &archive){
+ archive.mapObject(this);
+ NamedObject::deserialize(archive);
+ archive.readString(); // skip directory
+
+ //_invMgr.load(archive);
+ // intro has 0 items so we will skip
+ archive.readCount();
+
+ archive >> _pages;
+}
+
+void Module::initPage(bool isLoadingSave, const Common::String *pageName) {
+ // debugging original
+ // 0 0 - new game
+ // 0 1 - module changed
+ // 1 0 - from save
+
+ // 1 1 - haven't seen those values
+
+ //this func will be rewrited after testing
+
+ if (_page) {
+ debug("loading from save");
+ }
+ if (pageName){
+ debug("module changed");
+ }
+ assert(_pages.size() != 0);
+
+ if (pageName) {
+ uint i;
+ for (i = 0; i < _pages.size(); ++i) {
+ if(*pageName == _pages[i]->getName()) {
+ _page = _pages[i];
+ }
+ }
+ assert(i < _pages.size());
+ }
+
+ if (_page) {
+ _page->init(isLoadingSave); // module changed or from save
+ return;
+ }
+
+ if (_page != _pages[0]) {
+ if (_page) {
+ assert(0); // in original code there is call to page func but I've never seen it
+ return;
+ }
+ _page = _pages[0];
+ _page->init(isLoadingSave); // new game
+ return;
+ }
+
+ assert(0);
+}
+
+} // End of namespace Pink
+
+
+
diff --git a/engines/pink/objects/module.h b/engines/pink/objects/module.h
new file mode 100644
index 0000000..c6dbdbe
--- /dev/null
+++ b/engines/pink/objects/module.h
@@ -0,0 +1,74 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_MODULE_H
+#define PINK_MODULE_H
+
+#include "../archive.h"
+#include <common/str.h>
+#include "object.h"
+#include "named_object.h"
+#include <common/debug.h>
+#include <engines/pink/utils.h>
+#include <common/hash-str.h>
+#include "inventory.h"
+
+namespace Pink {
+
+class ModuleProxy : public NamedObject {
+public:
+ ModuleProxy(){};
+ ModuleProxy(const Common::String &name)
+ : NamedObject(name)
+ {}
+
+
+};
+
+class PinkEngine;
+
+class Module : public NamedObject {
+public:
+ Module(PinkEngine *game, const Common::String &name)
+ : NamedObject(name), _game(game), _page(nullptr)
+ {}
+
+ void deserialize(Archive &archive);
+ void initPage(bool isLoadingSave, const Common::String *pageName);
+
+ void OnLeftButtonDown();
+ void OnMouseMove();
+ void OnKeyboardButtonClick();
+
+private:
+ PinkEngine *_game;
+ //Common::String _directory; doesn't need this because it was used when game had data in directories
+ GamePage *_page;
+ PagesArray _pages;
+ InventoryMgr _invMgr;
+ Common::StringMap _map; // used for saves and maybe for smth else
+};
+
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/objects/named_object.h b/engines/pink/objects/named_object.h
new file mode 100644
index 0000000..a0136f7
--- /dev/null
+++ b/engines/pink/objects/named_object.h
@@ -0,0 +1,58 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_NAMED_OBJECT_H
+#define PINK_NAMED_OBJECT_H
+
+#include "../archive.h"
+#include <common/str.h>
+#include "object.h"
+#include <common/debug.h>
+
+namespace Pink {
+
+class NamedObject : public Object {
+public:
+ NamedObject(){};
+ NamedObject(const Common::String &name)
+ : _name(name)
+ {}
+
+ void deserialize(Archive &archive){
+ _name = archive.readString();
+ debug("NamedObject %s loaded", _name.c_str());
+ }
+ void store(Archive &archive){
+
+ }
+
+ const Common::String &getName() const {
+ return _name;
+ }
+
+private:
+ Common::String _name;
+};
+
+} // End of namespace Pink
+
+#endif
\ No newline at end of file
diff --git a/engines/pink/objects/object.h b/engines/pink/objects/object.h
new file mode 100644
index 0000000..f6e1ee7
--- /dev/null
+++ b/engines/pink/objects/object.h
@@ -0,0 +1,41 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_OBJECT_H
+#define PINK_OBJECT_H
+
+namespace Pink {
+
+class Archive;
+
+class Object {
+public:
+ virtual ~Object() {};
+ virtual void load(Archive &){};
+ virtual void store(Archive &){};
+ virtual void deserialize(Archive &){};
+ virtual void init() {}
+};
+
+} // End of namespace Pink
+
+#endif
\ No newline at end of file
diff --git a/engines/pink/objects/page.h b/engines/pink/objects/page.h
new file mode 100644
index 0000000..1055a71
--- /dev/null
+++ b/engines/pink/objects/page.h
@@ -0,0 +1,87 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_PAGE_H
+#define PINK_PAGE_H
+
+#include "object.h"
+#include "module.h"
+
+namespace Pink {
+
+class Archive;
+
+class Page : public NamedObject {
+public:
+
+
+
+private:
+ /*
+ *
+ * CLeadActor *_leadActor;
+ int unk_1;
+ CObArray actors;
+ CString _str;
+ PageResources *_ResourseMgr;
+ */
+};
+
+class GamePage : public Page {
+public:
+ void deserialize(Archive &archive){
+ Page::deserialize(archive);
+ _module = static_cast<Module*>(archive.readObject());
+ assert(dynamic_cast<Module*>(_module) != 0);
+ }
+
+ void load(Archive &archive){
+
+ }
+
+
+ void init(bool isLoadingSave){
+ if (isLoadingSave){
+ assert(perhapsIsLoaded == 0);
+ // loadSerialize
+ }
+ }
+private:
+ int perhapsIsLoaded;
+ Module *_module;
+ /*
+ int perhaps_notLoaded;
+ int cunk_1;
+ int memfile;
+ CModule *_module;
+ CCursorMgr *cursor_mgr;
+ CWalkMgr *walkMgr;
+ CSequencer *sequencer;
+ CMapStringToString map;
+ CObArray handlers;
+ int unk;
+ */
+};
+
+} // End of namespace Pink
+
+#endif
\ No newline at end of file
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index f45afbb..aaaa2b1 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -22,42 +22,60 @@
#include "pink.h"
#include "console.h"
-#include <audio/mixer.h>
#include <engines/util.h>
+#include <common/debug-channels.h>
+#include "objects/module.h"
namespace Pink {
Pink::PinkEngine::PinkEngine(OSystem *system, const ADGameDescription *desc)
- : Engine(system), _rnd("pink"), _desc(*desc),
- _bro(nullptr)
+ : Engine(system), _console(nullptr), _rnd("pink"),
+ _desc(*desc), _bro(nullptr), _module(nullptr)
{
- /* TODO
- * setup debug channels
- *
- */
+ debug("PinkEngine constructed");
+
+ DebugMan.addDebugChannel(kPinkDebugGeneral, "general", "General issues");
+ DebugMan.addDebugChannel(kPinkDebugLoadingObjects, "loading_objects", "Serializing objects from Orb");
+ DebugMan.addDebugChannel(kPinkDebugLoadingResources, "loading_resources", "Loading resources data");
+ DebugMan.addDebugChannel(kPinkDebugGraphics, "graphics", "Graphics handling");
+ DebugMan.addDebugChannel(kPinkDebugSound, "sound", "Sound processing");
}
Pink::PinkEngine::~PinkEngine() {
delete _console;
delete _bro;
+ for (uint i = 0; i < _modules.size(); ++i) {
+ delete _modules[i];
+ }
+
+ DebugMan.clearAllDebugChannels();
}
Common::Error PinkEngine::init() {
+ debug("PinkEngine init");
+
initGraphics(640, 480);
_console = new Console(this);
- if (_desc.filesDescriptions[1].fileName){
+ Common::String orbName{_desc.filesDescriptions[0].fileName};
+ Common::String broName{_desc.filesDescriptions[1].fileName};
+
+ if (!broName.empty()){
_bro = new BroFile();
}
-
- Common::String orbName = _desc.filesDescriptions[0].fileName;
- Common::String broName = _desc.filesDescriptions[1].fileName;
+ else debug("This game doesn't need to use bro");
if (!_orb.open(orbName) || (_bro && !_bro->open(broName, _orb.getTimestamp()))){
return Common::kNoGameDataFoundError;
}
+ // TODO load cursor
+
+ _orb.loadGame(this);
+ _nextModule = _modules[0]->getName();
+ initModule();
+
return Common::kNoError;
}
@@ -73,7 +91,7 @@ Common::Error Pink::PinkEngine::run() {
switch (event.type){
case Common::EVENT_QUIT:
case Common::EVENT_RTL:
-
+ debug("Quit Event");
return Common::kNoError;
case Common::EVENT_MOUSEMOVE:
@@ -96,8 +114,67 @@ Common::Error Pink::PinkEngine::run() {
g_system->delayMillis(10);
}
-
return Common::kNoError;
}
+void PinkEngine::load(Archive &archive) {
+ debug(archive.readString().c_str());
+ debug(archive.readString().c_str());
+ archive >> _modules;
+}
+
+void PinkEngine::initModule() {
+ if (_module) {
+ assert(_module->getName() != _nextModule);
+
+ //call module function (smth with unloading)
+
+ //check additional field of game(unk_1)
+ uint i;
+ for (i = 0; i < _modules.size(); ++i) {
+ if (_module == _modules[i]){
+ break;
+ }
+ }
+ assert(i != _modules.size());
+
+ _modules[i] = new ModuleProxy(_module->getName());
+
+ delete _module;
+ _module = nullptr;
+ }
+
+ assert(_modules.size() != 0);
+
+ uint i;
+ for (i = 0; i < _modules.size(); ++i) {
+ assert(dynamic_cast<Module*>(_modules[i]) == 0);
+ if (_modules[i]->getName() == _nextModule) {
+ changeProxyToModule(i);
+ break;
+ }
+ }
+ assert(i < _modules.size());
+
+ _module = static_cast<Module*>(_modules[i]);
+ _module->initPage(LoadingNotSave, 0); //TODO change to constants
+
+}
+
+void PinkEngine::setNextExecutors(const Common::String &nextModule, const Common::String &nextPage) {
+ _nextModule = nextModule;
+ _nextPage = nextPage;
+}
+
+void PinkEngine::changeProxyToModule(int index) {
+ assert(dynamic_cast<Module*>(_modules[index]) == 0);
+
+ Module *module = new Module(this, _modules[index]->getName());
+
+ _orb.loadObject(module, module->getName());
+
+ delete _modules[index];
+ _modules[index] = module;
+}
+
}
\ No newline at end of file
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index 7f9d39e..4aa6918 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -23,11 +23,13 @@
#ifndef PINK_PINK_H
#define PINK_PINK_H
+#include <engines/pink/objects/named_object.h>
#include "common/random.h"
#include "engines/engine.h"
#include "gui/EventRecorder.h"
#include "gui/debugger.h"
#include "file.h"
+#include "utils.h"
/*
@@ -35,7 +37,7 @@
*
* Status of this engine: In Development
*
- * Internal name of original name: OxCart Runtime
+ * Internal name of original engine: OxCart Runtime
*
* Games using this engine:
* - The Pink Panther: Passport to Peril
@@ -45,27 +47,40 @@
namespace Pink {
class Console;
+class Archive;
+class Module;
enum {
kPinkDebugGeneral = 1 << 0,
- kPinkDebugLoading = 1 << 1,
- kPinkDebugSound = 1 << 2
+ kPinkDebugLoadingResources = 1 << 1,
+ kPinkDebugLoadingObjects = 1 << 2,
+ kPinkDebugGraphics = 1 << 3,
+ kPinkDebugSound = 1 << 4
};
-class PinkEngine : public Engine {
+enum {
+ LoadingSave = 1,
+ LoadingNotSave = 0
+};
+
+class PinkEngine : public Engine {
public:
PinkEngine(OSystem *system, const ADGameDescription *desc);
-
~PinkEngine();
virtual Common::Error run();
+ void load(Archive &archive);
+
+ void initModule();
+ void setNextExecutors(const Common::String &nextModule, const Common::String &nextPage);
+
+ OrbFile *getOrb() { return &_orb; }
+ BroFile *getBro() { return _bro; }
private:
Common::Error init();
-
- void handleEvent(Common::Event &event);
- void update();
+ void changeProxyToModule(int index);
Console *_console;
Common::RandomSource _rnd;
@@ -76,6 +91,9 @@ private:
OrbFile _orb;
BroFile *_bro;
+ Module *_module;
+ ModulesArray _modules;
+
const ADGameDescription _desc;
};
diff --git a/engines/pink/resource_mgr.cpp b/engines/pink/resource_mgr.cpp
new file mode 100644
index 0000000..6676b0f
--- /dev/null
+++ b/engines/pink/resource_mgr.cpp
@@ -0,0 +1,49 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "resource_mgr.h"
+#include "file.h"
+#include "pink.h"
+#include "objects/page.h"
+
+namespace Pink {
+
+ResourceMgr::ResourceMgr()
+ : _orb(nullptr), _bro(nullptr),
+ _resDescTable(nullptr), _resCount(0)
+{}
+
+ResourceMgr::~ResourceMgr() {
+ delete[] _resDescTable;
+}
+
+void ResourceMgr::init(PinkEngine *game, GamePage *page) {
+ _orb = game->getOrb();
+ _bro = game->getBro();
+
+ ObjectDescription *objDesc = _orb->getObjDesc(page->getName().c_str());
+ _resCount = objDesc->resourcesCount;
+ _orb->loadObject(page, objDesc);
+ _resDescTable = _orb->getResDescTable(objDesc);
+}
+
+} // End of namespace Pink
diff --git a/engines/pink/resource_mgr.h b/engines/pink/resource_mgr.h
new file mode 100644
index 0000000..7672e84
--- /dev/null
+++ b/engines/pink/resource_mgr.h
@@ -0,0 +1,57 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include <common/scummsys.h>
+
+#ifndef PINK_RESOURCE_MGR_H
+#define PINK_RESOURCE_MGR_H
+
+namespace Pink {
+
+class GamePage;
+class PinkEngine;
+class OrbFile;
+class BroFile;
+
+struct ResourceDescription;
+
+class ResourceMgr {
+public:
+ ResourceMgr();
+ ~ResourceMgr();
+
+ void init(PinkEngine *game, GamePage *page);
+ //compiler must do RVO
+ //Common::String loadText(Common::String &name);
+ //Sound loadSound(Common::String &name);
+ // loadCEL();
+
+private:
+ OrbFile *_orb;
+ BroFile *_bro;
+ ResourceDescription *_resDescTable;
+ uint32 _resCount;
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/utils.h b/engines/pink/utils.h
new file mode 100644
index 0000000..82fb39d
--- /dev/null
+++ b/engines/pink/utils.h
@@ -0,0 +1,38 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_UTILS_H
+#define PINK_UTILS_H
+
+#include <common/array.h>
+
+namespace Pink {
+ class Object;
+ class NamedObject;
+ class GamePage;
+
+ using ObArray = Common::Array<Object*>;
+ using ModulesArray = Common::Array<NamedObject*>;
+ using PagesArray = Common::Array<GamePage*>;
+}
+
+#endif
Commit: 4ff13d64ba3812a0847ef9f0634581ba0715e075
https://github.com/scummvm/scummvm/commit/4ff13d64ba3812a0847ef9f0634581ba0715e075
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Added InventoryItem class
Changed paths:
A engines/pink/objects/inventory.cpp
engines/pink/objects/inventory.h
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
new file mode 100644
index 0000000..7a606e9
--- /dev/null
+++ b/engines/pink/objects/inventory.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+
+#include "inventory.h"
+
+namespace Pink {
+
+void Pink::InventoryItem::deserialize(Archive &archive) {
+ NamedObject::deserialize(archive);
+ _initialOwner = archive.readString();
+ _currentOwner = _initialOwner;
+}
+
+InventoryMgr::~InventoryMgr() {
+ for (int i = 0; i < _invItems.size(); ++i) {
+ delete _invItems[i];
+ }
+}
+
+void InventoryMgr::deserialize(Archive &archive) {
+ archive >> _invItems;
+}
+
+} // End of namespace Pink
+
+
diff --git a/engines/pink/objects/inventory.h b/engines/pink/objects/inventory.h
index 8827b4a..f693811 100644
--- a/engines/pink/objects/inventory.h
+++ b/engines/pink/objects/inventory.h
@@ -23,17 +23,31 @@
#ifndef PINK_INVENTORY_H
#define PINK_INVENTORY_H
-#include "object.h"
+#include "named_object.h"
namespace Pink {
- class InventoryMgr : public Object{
- public:
- private:
- // array of inv items
- // other fields. haven't RE them yet
- };
+class InventoryItem : public NamedObject {
+public:
+ virtual void deserialize(Archive &archive);
+
+private:
+ Common::String _initialOwner;
+ Common::String _currentOwner;
+};
+
+class InventoryMgr : public Object {
+public:
+ virtual ~InventoryMgr();
+
+ virtual void deserialize(Archive &archive);
+
+
+private:
+ Common::Array<InventoryItem*> _invItems;
+ // other fields. haven't RE them yet
+};
} // End of namespace Pink
Commit: f8055bc2067d369e13b056d723512f198c10f973
https://github.com/scummvm/scummvm/commit/f8055bc2067d369e13b056d723512f198c10f973
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: split declaration and definition and some fixes
Changed paths:
A engines/pink/objects/actor.cpp
A engines/pink/objects/actor.h
A engines/pink/objects/page.cpp
engines/pink/archive.cpp
engines/pink/objects/inventory.h
engines/pink/objects/module.cpp
engines/pink/objects/module.h
engines/pink/objects/page.h
engines/pink/pink.cpp
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp
index ab6ab78..e4605af 100644
--- a/engines/pink/archive.cpp
+++ b/engines/pink/archive.cpp
@@ -33,7 +33,6 @@ enum {
kNullObject = 0
};
-
enum {
kActionHide,
kActionLoop,
@@ -90,21 +89,23 @@ static const struct RuntimeClass {
int id;
} classMap[] = {
{"GamePage", kGamePage},
+ {"InventoryItem", kInventoryItem},
{"ModuleProxy", kModuleProxy}
};
static Object* createObject(int objectId){
switch (objectId){
case kGamePage:
- return new GamePage();
+ return new GamePage;
+ case kInventoryItem:
+ return new InventoryItem;
case kModuleProxy:
- return new ModuleProxy();
+ return new ModuleProxy;
default:
return nullptr;
}
}
-
Archive::Archive(Common::File &file)
: _file(file)
{
diff --git a/engines/pink/objects/actor.cpp b/engines/pink/objects/actor.cpp
new file mode 100644
index 0000000..c90afb7
--- /dev/null
+++ b/engines/pink/objects/actor.cpp
@@ -0,0 +1,27 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+namespace Pink {
+
+
+
+} // End of namespace Pink
diff --git a/engines/pink/objects/actor.h b/engines/pink/objects/actor.h
new file mode 100644
index 0000000..a9c0ff8
--- /dev/null
+++ b/engines/pink/objects/actor.h
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_ACTOR_H
+#define PINK_ACTOR_H
+
+namespace Pink {
+
+class GamePage;
+
+class Actor {
+public:
+
+private:
+ GamePage *page;
+ //int possibly_isActionNotExist;
+ //CAction *action;
+ //CObArray actions;
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/objects/inventory.h b/engines/pink/objects/inventory.h
index f693811..6dacd87 100644
--- a/engines/pink/objects/inventory.h
+++ b/engines/pink/objects/inventory.h
@@ -43,7 +43,6 @@ public:
virtual void deserialize(Archive &archive);
-
private:
Common::Array<InventoryItem*> _invItems;
// other fields. haven't RE them yet
diff --git a/engines/pink/objects/module.cpp b/engines/pink/objects/module.cpp
index 3d33c16..505b8fb 100644
--- a/engines/pink/objects/module.cpp
+++ b/engines/pink/objects/module.cpp
@@ -25,20 +25,27 @@
namespace Pink {
+ModuleProxy::ModuleProxy(const Common::String &name)
+ : NamedObject(name)
+{}
-void Module::deserialize(Archive &archive){
+ModuleProxy::ModuleProxy() {}
+
+Module::Module(PinkEngine *game, const Common::String &name)
+ : NamedObject(name), _game(game), _page(nullptr)
+{}
+
+void Module::load(Archive &archive){
archive.mapObject(this);
NamedObject::deserialize(archive);
- archive.readString(); // skip directory
- //_invMgr.load(archive);
- // intro has 0 items so we will skip
- archive.readCount();
+ archive.readString(); // skip directory
+ _invMgr.deserialize(archive);
archive >> _pages;
}
-void Module::initPage(bool isLoadingSave, const Common::String *pageName) {
+void Module::init(bool isLoadingSave, const Common::String *pageName) {
// debugging original
// 0 0 - new game
// 0 1 - module changed
diff --git a/engines/pink/objects/module.h b/engines/pink/objects/module.h
index c6dbdbe..ea2ecee 100644
--- a/engines/pink/objects/module.h
+++ b/engines/pink/objects/module.h
@@ -36,24 +36,18 @@ namespace Pink {
class ModuleProxy : public NamedObject {
public:
- ModuleProxy(){};
- ModuleProxy(const Common::String &name)
- : NamedObject(name)
- {}
-
-
+ ModuleProxy();
+ ModuleProxy(const Common::String &name);
};
class PinkEngine;
class Module : public NamedObject {
public:
- Module(PinkEngine *game, const Common::String &name)
- : NamedObject(name), _game(game), _page(nullptr)
- {}
+ Module(PinkEngine *game, const Common::String &name);
- void deserialize(Archive &archive);
- void initPage(bool isLoadingSave, const Common::String *pageName);
+ void load(Archive &archive);
+ void init(bool isLoadingSave, const Common::String *pageName);
void OnLeftButtonDown();
void OnMouseMove();
@@ -61,7 +55,6 @@ public:
private:
PinkEngine *_game;
- //Common::String _directory; doesn't need this because it was used when game had data in directories
GamePage *_page;
PagesArray _pages;
InventoryMgr _invMgr;
diff --git a/engines/pink/objects/page.cpp b/engines/pink/objects/page.cpp
new file mode 100644
index 0000000..31bb48b
--- /dev/null
+++ b/engines/pink/objects/page.cpp
@@ -0,0 +1,58 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "page.h"
+
+namespace Pink {
+
+void Page::load(Archive &archive) {
+ archive.mapObject(this);
+ NamedObject::deserialize(archive);
+ archive.readString(); //skip directory
+ // deserialize actors
+}
+
+void GamePage::deserialize(Archive &archive) {
+ Page::deserialize(archive);
+ _module = static_cast<Module*>(archive.readObject());
+ assert(dynamic_cast<Module*>(_module) != 0);
+}
+
+void GamePage::load(Archive &archive) {
+ //archive.mapObject(_cursorMgr);
+ //archive.mapObject(_walkMgr);
+ //archive.mapObject(_sequencer);
+ //_leadActor = archive.readObject()
+ //serialize ccursormgr NullSub
+ //serialize walkmgr
+ //serialize sequencer
+ //serialize handlers
+}
+
+void GamePage::init(bool isLoadingSave) {
+ if (isLoadingSave){
+ assert(perhapsIsLoaded == 0);
+ // loadSerialize
+ }
+}
+
+} // End of namespace Pink
diff --git a/engines/pink/objects/page.h b/engines/pink/objects/page.h
index 1055a71..f2ef83c 100644
--- a/engines/pink/objects/page.h
+++ b/engines/pink/objects/page.h
@@ -33,7 +33,7 @@ class Archive;
class Page : public NamedObject {
public:
-
+ void load(Archive &archive);
private:
/*
@@ -48,23 +48,12 @@ private:
class GamePage : public Page {
public:
- void deserialize(Archive &archive){
- Page::deserialize(archive);
- _module = static_cast<Module*>(archive.readObject());
- assert(dynamic_cast<Module*>(_module) != 0);
- }
-
- void load(Archive &archive){
+ void deserialize(Archive &archive);
- }
+ void load(Archive &archive);
- void init(bool isLoadingSave){
- if (isLoadingSave){
- assert(perhapsIsLoaded == 0);
- // loadSerialize
- }
- }
+ void init(bool isLoadingSave);
private:
int perhapsIsLoaded;
Module *_module;
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index aaaa2b1..4df3dfe 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -157,7 +157,7 @@ void PinkEngine::initModule() {
assert(i < _modules.size());
_module = static_cast<Module*>(_modules[i]);
- _module->initPage(LoadingNotSave, 0); //TODO change to constants
+ _module->init(LoadingNotSave, 0);
}
Commit: 0f8768c5ade1a211ee0afbc61c3f33ce236588dc
https://github.com/scummvm/scummvm/commit/0f8768c5ade1a211ee0afbc61c3f33ce236588dc
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Added all classes in classMap
Changed paths:
engines/pink/archive.cpp
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp
index e4605af..4627800 100644
--- a/engines/pink/archive.cpp
+++ b/engines/pink/archive.cpp
@@ -88,9 +88,54 @@ static const struct RuntimeClass {
const char *name;
int id;
} classMap[] = {
+ {"ActionHide", kActionHide},
+ {"ActionLoop", kActionLoop},
+ {"ActionPlay", kActionPlay},
+ {"ActionPlayWithSfx", kActionPlayWithSfx},
+ {"ActionSfx", kActionSfx},
+ {"ActionSound", kActionSound},
+ {"ActionStill", kActionStill},
+ {"ActionTalk", kActionTalk},
+ {"ActionText", kActionText},
+ {"Actor", kActor},
+ {"AudioInfoPDAButton", kAudioInfoPDAButton},
+ {"ConditionGameVariable", kConditionGameVariable},
+ {"ConditionInventoryItemOwner", kConditionInventoryItemOwner},
+ {"ConditionModuleVariable", kConditionModuleVariable},
+ {"ConditionNotInventoryItemOwner", kConditionNotInventoryItemOwner},
+ {"ConditionNotModuleVariable", kConditionNotModuleVariable},
+ {"ConditionNotPageVariable", kConditionNotPageVariable},
+ {"ConditionPageVariable", kConditionPageVariable},
+ {"CursorActor", kCursorActor},
{"GamePage", kGamePage},
+ {"HandlerLeftClick", kHandlerLeftClick},
+ {"HandlerStartPage", kHandlerStartPage},
+ {"HandlerTimer", kHandlerTimer},
+ {"HandlerUseClick", kHandlerUseClick},
+ {"InventoryActor", kInventoryActor},
{"InventoryItem", kInventoryItem},
- {"ModuleProxy", kModuleProxy}
+ {"LeadActor", kLeadActor},
+ {"ModuleProxy", kModuleProxy},
+ {"PDAButtonActor", kPDAButtonActor},
+ {"ParlSqPink", kParlSqPink},
+ {"PubPink", kPubPink},
+ {"SeqTimer", kSeqTimer},
+ {"Sequence", kSequence},
+ {"SequenceAudio", kSequenceAudio},
+ {"SequenceItem", kSequenceItem},
+ {"SequenceItemDefaultAction", kSequenceItemDefaultAction},
+ {"SequenceItemLeader", kSequenceItemLeader},
+ {"SequenceItemLeaderAudio", kSequenceItemLeaderAudio},
+ {"SideEffectExit", kSideEffectExit},
+ {"SideEffectGameVariable", kSideEffectGameVariable},
+ {"SideEffectInventoryItemOwner", kSideEffectInventoryItemOwner},
+ {"SideEffectLocation", kSideEffectLocation},
+ {"SideEffectModuleVariable", kSideEffectModuleVariable},
+ {"SideEffectPageVariable", kSideEffectPageVariable},
+ {"SideEffectRandomPageVariable", kSideEffectRandomPageVariable},
+ {"SupportingActor", kSupportingActor},
+ {"WalkAction", kWalkAction},
+ {"WalkLocation", kWalkLocation}
};
static Object* createObject(int objectId){
Commit: 198710adac6c827a9db4b0640952d8ea88713ca2
https://github.com/scummvm/scummvm/commit/198710adac6c827a9db4b0640952d8ea88713ca2
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Implemented Page loading.
Changed paths:
A engines/pink/actions/action.cpp
A engines/pink/actions/action.h
A engines/pink/actions/action_cel.cpp
A engines/pink/actions/action_cel.h
A engines/pink/actions/action_hide.cpp
A engines/pink/actions/action_hide.h
A engines/pink/actions/action_play.cpp
A engines/pink/actions/action_play.h
A engines/pink/actions/action_sound.cpp
A engines/pink/actions/action_sound.h
A engines/pink/actions/action_still.cpp
A engines/pink/actions/action_still.h
A engines/pink/actors/actor.cpp
A engines/pink/actors/actor.h
A engines/pink/actors/lead_actor.cpp
A engines/pink/actors/lead_actor.h
A engines/pink/cursor_mgr.cpp
A engines/pink/cursor_mgr.h
A engines/pink/inventory.cpp
A engines/pink/inventory.h
A engines/pink/module.cpp
A engines/pink/module.h
A engines/pink/object.cpp
A engines/pink/object.h
A engines/pink/page.cpp
A engines/pink/page.h
A engines/pink/walk/walk_location.cpp
A engines/pink/walk/walk_location.h
A engines/pink/walk/walk_mgr.cpp
A engines/pink/walk/walk_mgr.h
R engines/pink/objects/actor.cpp
R engines/pink/objects/actor.h
R engines/pink/objects/inventory.cpp
R engines/pink/objects/inventory.h
R engines/pink/objects/module.cpp
R engines/pink/objects/module.h
R engines/pink/objects/object.h
R engines/pink/objects/page.cpp
R engines/pink/objects/page.h
engines/pink/archive.cpp
engines/pink/archive.h
engines/pink/file.cpp
engines/pink/module.mk
engines/pink/pink.cpp
engines/pink/pink.h
engines/pink/resource_mgr.cpp
diff --git a/engines/pink/actions/action.cpp b/engines/pink/actions/action.cpp
new file mode 100644
index 0000000..dfeed6f2
--- /dev/null
+++ b/engines/pink/actions/action.cpp
@@ -0,0 +1,34 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "action.h"
+#include "../actors/actor.h"
+#include "../archive.h"
+
+namespace Pink {
+
+void Action::deserialize(Archive &archive) {
+ NamedObject::deserialize(archive);
+ _actor = static_cast<Actor*>(archive.readObject());
+}
+
+} // End of namespace Pink
diff --git a/engines/pink/actions/action.h b/engines/pink/actions/action.h
new file mode 100644
index 0000000..3d71303
--- /dev/null
+++ b/engines/pink/actions/action.h
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_ACTION_H
+#define PINK_ACTION_H
+
+#include "../object.h"
+
+namespace Pink {
+
+class Actor;
+
+class Action : public NamedObject {
+public:
+ virtual void deserialize(Archive &archive);
+
+private:
+ Actor *_actor;
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/actions/action_cel.cpp b/engines/pink/actions/action_cel.cpp
new file mode 100644
index 0000000..a84ea41
--- /dev/null
+++ b/engines/pink/actions/action_cel.cpp
@@ -0,0 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "action_cel.h"
+#include "../archive.h"
+
+namespace Pink {
+
+void ActionCEL::deserialize(Archive &archive) {
+ Action::deserialize(archive);
+ archive >> _fileName >> _z;
+}
+
+} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/actions/action_cel.h b/engines/pink/actions/action_cel.h
new file mode 100644
index 0000000..346b9d2
--- /dev/null
+++ b/engines/pink/actions/action_cel.h
@@ -0,0 +1,41 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_ACTION_CEL_H
+#define PINK_ACTION_CEL_H
+
+#include "action.h"
+
+namespace Pink {
+
+class ActionCEL : public Action {
+public:
+ virtual void deserialize(Archive &archive);
+
+private:
+ Common::String _fileName;
+ uint32 _z; // Z coordinate for sprite
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/actions/action_hide.cpp b/engines/pink/actions/action_hide.cpp
new file mode 100644
index 0000000..8c3eb17
--- /dev/null
+++ b/engines/pink/actions/action_hide.cpp
@@ -0,0 +1,26 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+namespace Pink {
+
+
+} //End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/actions/action_hide.h b/engines/pink/actions/action_hide.h
new file mode 100644
index 0000000..2c2af5c
--- /dev/null
+++ b/engines/pink/actions/action_hide.h
@@ -0,0 +1,36 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_ACTION_HIDE_H
+#define PINK_ACTION_HIDE_H
+
+#include "action.h"
+
+namespace Pink {
+
+class ActionHide : public Action {
+
+};
+
+} //End of namespace Pink
+
+#endif
diff --git a/engines/pink/actions/action_play.cpp b/engines/pink/actions/action_play.cpp
new file mode 100644
index 0000000..d31775d
--- /dev/null
+++ b/engines/pink/actions/action_play.cpp
@@ -0,0 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "action_play.h"
+#include "../archive.h"
+
+namespace Pink {
+
+void ActionPlay::deserialize(Archive &archive) {
+ ActionStill::deserialize(archive);
+ archive >> _stopFrame;
+}
+
+} // End of namespace Pink
diff --git a/engines/pink/actions/action_play.h b/engines/pink/actions/action_play.h
new file mode 100644
index 0000000..00360d9
--- /dev/null
+++ b/engines/pink/actions/action_play.h
@@ -0,0 +1,40 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_ACTION_PLAY_H
+#define PINK_ACTION_PLAY_H
+
+#include "action.h"
+#include "action_still.h"
+
+namespace Pink {
+
+class ActionPlay : public ActionStill {
+ virtual void deserialize(Archive &archive);
+
+private:
+ uint32 _stopFrame;
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/actions/action_sound.cpp b/engines/pink/actions/action_sound.cpp
new file mode 100644
index 0000000..b5e5c5e
--- /dev/null
+++ b/engines/pink/actions/action_sound.cpp
@@ -0,0 +1,36 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "action_sound.h"
+#include "../archive.h"
+
+namespace Pink {
+
+void ActionSound::deserialize(Archive &archive) {
+ Action::deserialize(archive);
+ archive >> _fileName;
+ _volume = archive.readDWORD();
+ _isLoop = (bool) archive.readDWORD();
+ _isBackground = (bool) archive.readDWORD();
+}
+
+} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/actions/action_sound.h b/engines/pink/actions/action_sound.h
new file mode 100644
index 0000000..15b27d7
--- /dev/null
+++ b/engines/pink/actions/action_sound.h
@@ -0,0 +1,47 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_ACTION_SOUND_H
+#define PINK_ACTION_SOUND_H
+
+#include "action.h"
+
+namespace Pink {
+
+class Sound;
+
+class ActionSound : public Action {
+public:
+ virtual void deserialize(Archive &archive);
+
+private:
+ Sound *_sound;
+ Common::String _fileName;
+ uint32 _volume;
+ bool _isLoop;
+ bool _isBackground;
+ bool _isStopped;
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/actions/action_still.cpp b/engines/pink/actions/action_still.cpp
new file mode 100644
index 0000000..f015a8b
--- /dev/null
+++ b/engines/pink/actions/action_still.cpp
@@ -0,0 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "action_still.h"
+#include "../archive.h"
+
+namespace Pink {
+
+void ActionStill::deserialize(Archive &archive) {
+ ActionCEL::deserialize(archive);
+ archive >> _startFrame;
+}
+
+} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/actions/action_still.h b/engines/pink/actions/action_still.h
new file mode 100644
index 0000000..9d6c7be
--- /dev/null
+++ b/engines/pink/actions/action_still.h
@@ -0,0 +1,40 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_ACTION_STILL_H
+#define PINK_ACTION_STILL_H
+
+#include "action_cel.h"
+
+namespace Pink {
+
+class ActionStill : public ActionCEL {
+public:
+ virtual void deserialize(Archive &archive);
+
+private:
+ uint32 _startFrame;
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/actors/actor.cpp b/engines/pink/actors/actor.cpp
new file mode 100644
index 0000000..30f7e7b
--- /dev/null
+++ b/engines/pink/actors/actor.cpp
@@ -0,0 +1,34 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "actor.h"
+#include "../page.h"
+
+namespace Pink {
+
+void Actor::deserialize(Archive &archive) {
+ NamedObject::deserialize(archive);
+ _page = static_cast<GamePage*>(archive.readObject());
+ archive >> _actions;
+}
+
+} // End of namespace Pink
diff --git a/engines/pink/actors/actor.h b/engines/pink/actors/actor.h
new file mode 100644
index 0000000..8daccc8
--- /dev/null
+++ b/engines/pink/actors/actor.h
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_ACTOR_H
+#define PINK_ACTOR_H
+
+#include <common/array.h>
+#include "../object.h"
+
+namespace Pink {
+
+class GamePage;
+class Action;
+
+class Actor : public NamedObject {
+public:
+ Actor() {};
+ virtual void deserialize(Archive &archive);
+
+private:
+ GamePage *_page;
+ //int possibly_isActionNotExist;
+ Action *_action;
+ Common::Array<Action*> _actions;
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/actors/lead_actor.cpp b/engines/pink/actors/lead_actor.cpp
new file mode 100644
index 0000000..308e641
--- /dev/null
+++ b/engines/pink/actors/lead_actor.cpp
@@ -0,0 +1,38 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "lead_actor.h"
+#include "../walk/walk_mgr.h"
+#include "../cursor_mgr.h"
+#include "../sequencer.h"
+#include "../archive.h"
+
+namespace Pink {
+
+void LeadActor::deserialize(Archive &archive) {
+ Actor::deserialize(archive);
+ _cursorMgr = static_cast<CursorMgr*>(archive.readObject());
+ _walkMgr = static_cast<WalkMgr*>(archive.readObject());
+ _sequencer = static_cast<Sequencer*>(archive.readObject());
+}
+
+} // End of namespace Pink
diff --git a/engines/pink/actors/lead_actor.h b/engines/pink/actors/lead_actor.h
new file mode 100644
index 0000000..a859de8
--- /dev/null
+++ b/engines/pink/actors/lead_actor.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_LEAD_ACTOR_H
+#define PINK_LEAD_ACTOR_H
+
+#include "actor.h"
+
+namespace Pink {
+
+class CursorMgr;
+class WalkMgr;
+class Sequencer;
+
+class LeadActor : public Actor {
+public:
+ virtual void deserialize(Archive &archive);
+
+private:
+ CursorMgr *_cursorMgr;
+ WalkMgr *_walkMgr;
+ Sequencer *_sequencer;
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp
index 4627800..265c9c6 100644
--- a/engines/pink/archive.cpp
+++ b/engines/pink/archive.cpp
@@ -22,8 +22,14 @@
#include <common/debug.h>
#include <common/file.h>
-#include "objects/module.h"
-#include "objects/page.h"
+#include <engines/pink/actors/actor.h>
+#include <engines/pink/walk/walk_location.h>
+#include <engines/pink/actions/action_hide.h>
+#include <engines/pink/actions/action_play.h>
+#include <engines/pink/actions/action_sound.h>
+#include "module.h"
+#include "page.h"
+#include "actors/lead_actor.h"
namespace Pink {
@@ -140,12 +146,26 @@ static const struct RuntimeClass {
static Object* createObject(int objectId){
switch (objectId){
+ case kActionHide:
+ return new ActionHide;
+ case kActionPlay:
+ return new ActionPlay;
+ case kActionSound:
+ return new ActionSound;
+ case kActionStill:
+ return new ActionStill;
+ case kActor:
+ return new Actor;
case kGamePage:
return new GamePage;
case kInventoryItem:
return new InventoryItem;
+ case kLeadActor:
+ return new LeadActor;
case kModuleProxy:
return new ModuleProxy;
+ case kWalkLocation:
+ return new WalkLocation;
default:
return nullptr;
}
@@ -165,7 +185,7 @@ Archive::~Archive()
}
void Archive::mapObject(Object *obj) {
- _objectMap.push_back(obj); // Basically a hack, but behavior is all correct
+ _objectMap.push_back(obj);
_objectIdMap.push_back(0);
}
@@ -207,11 +227,13 @@ Object *Archive::parseObject(bool &isCopyReturned) {
objectId = findObjectId(className + 1);
res = createObject(objectId);
+ if (!res) error("Class %s is not implemented", className);
+
_objectMap.push_back(res);
_objectIdMap.push_back(objectId);
- //_objectMap.push_back(res); // Basically a hack, but behavior is all correct
- //_objectIdMap.push_back(objectId);
+ _objectMap.push_back(res); // Basically a hack, but behavior is all correct
+ _objectIdMap.push_back(objectId);
isCopyReturned = false;
} else if ((obTag & 0x8000) == 0) {
@@ -254,6 +276,10 @@ Common::String Archive::readString() {
return Common::String(buffer, len);
}
+uint32 Archive::readDWORD() {
+ return _file.readUint32LE();
+}
+
} // End of namespace Pink
diff --git a/engines/pink/archive.h b/engines/pink/archive.h
index 6971b0f..9ca1c29 100644
--- a/engines/pink/archive.h
+++ b/engines/pink/archive.h
@@ -24,7 +24,7 @@
#define PINK_ARCHIVE_H
#include <common/array.h>
-#include <engines/pink/objects/object.h>
+#include <engines/pink/object.h>
namespace Common {
@@ -40,10 +40,13 @@ public:
~Archive();
void mapObject(Object *obj);
+
int readCount();
+ uint32 readDWORD();
Object *readObject();
Common::String readString();
+
private:
uint findObjectId(const char *name);
@@ -75,6 +78,12 @@ inline Archive &operator>>(Archive &archive, Common::String &string){
return archive;
}
+inline Archive &operator>>(Archive &archive, uint32 &num){
+ num = archive.readDWORD();
+ return archive;
+}
+
+
} // End of namespace Pink
#endif
diff --git a/engines/pink/cursor_mgr.cpp b/engines/pink/cursor_mgr.cpp
new file mode 100644
index 0000000..90cbd90
--- /dev/null
+++ b/engines/pink/cursor_mgr.cpp
@@ -0,0 +1,29 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "cursor_mgr.h"
+
+namespace Pink {
+
+CursorMgr::CursorMgr(GamePage *page) : page(page) {}
+
+} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/cursor_mgr.h b/engines/pink/cursor_mgr.h
new file mode 100644
index 0000000..cfc16ac
--- /dev/null
+++ b/engines/pink/cursor_mgr.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_CURSOR_MGR_H
+#define PINK_CURSOR_MGR_H
+
+#include "engines/pink/object.h"
+
+namespace Pink {
+
+class Actor;
+class GamePage;
+
+class CursorMgr : public Object {
+public:
+ CursorMgr(GamePage *page);
+
+private:
+ Actor *actor;
+ GamePage *page;
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/file.cpp b/engines/pink/file.cpp
index 38df98d..354c7b5 100644
--- a/engines/pink/file.cpp
+++ b/engines/pink/file.cpp
@@ -21,7 +21,7 @@
*/
#include <common/str.h>
-#include "objects/page.h"
+#include "page.h"
#include "pink.h"
namespace Pink {
diff --git a/engines/pink/inventory.cpp b/engines/pink/inventory.cpp
new file mode 100644
index 0000000..ed2569e
--- /dev/null
+++ b/engines/pink/inventory.cpp
@@ -0,0 +1,47 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+
+#include "inventory.h"
+#include "archive.h"
+
+namespace Pink {
+
+void Pink::InventoryItem::deserialize(Archive &archive) {
+ NamedObject::deserialize(archive);
+ _initialOwner = archive.readString();
+ _currentOwner = _initialOwner;
+}
+
+InventoryMgr::~InventoryMgr() {
+ for (uint i = 0; i < _invItems.size(); ++i) {
+ delete _invItems[i];
+ }
+}
+
+void InventoryMgr::deserialize(Archive &archive) {
+ archive >> _invItems;
+}
+
+} // End of namespace Pink
+
+
diff --git a/engines/pink/inventory.h b/engines/pink/inventory.h
new file mode 100644
index 0000000..197c226
--- /dev/null
+++ b/engines/pink/inventory.h
@@ -0,0 +1,55 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_INVENTORY_H
+#define PINK_INVENTORY_H
+
+
+#include <common/array.h>
+#include "engines/pink/object.h"
+
+namespace Pink {
+
+
+class InventoryItem : public NamedObject {
+public:
+ virtual void deserialize(Archive &archive);
+
+private:
+ Common::String _initialOwner;
+ Common::String _currentOwner;
+};
+
+class InventoryMgr : public Object {
+public:
+ virtual ~InventoryMgr();
+
+ virtual void deserialize(Archive &archive);
+
+private:
+ Common::Array<InventoryItem*> _invItems;
+ // other fields. haven't RE them yet
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/module.cpp b/engines/pink/module.cpp
new file mode 100644
index 0000000..4b5d136
--- /dev/null
+++ b/engines/pink/module.cpp
@@ -0,0 +1,101 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "module.h"
+#include "page.h"
+
+namespace Pink {
+
+ModuleProxy::ModuleProxy(const Common::String &name)
+ : NamedObject(name)
+{}
+
+ModuleProxy::ModuleProxy() {}
+
+Module::Module(PinkEngine *game, const Common::String &name)
+ : NamedObject(name), _game(game), _page(nullptr)
+{}
+
+void Module::load(Archive &archive){
+ archive.mapObject(this);
+ NamedObject::deserialize(archive);
+
+ archive.readString(); // skip directory
+
+ _invMgr.deserialize(archive);
+ archive >> _pages;
+}
+
+void Module::init(bool isLoadingSave, const Common::String *pageName) {
+ // debugging original
+ // 0 0 - new game
+ // 0 1 - module changed
+ // 1 0 - from save
+
+ // 1 1 - haven't seen those values
+
+ //this func will be rewrited after testing
+
+ if (_page) {
+ debug("loading from save");
+ }
+ if (pageName){
+ debug("module changed");
+ }
+ assert(_pages.size() != 0);
+
+ if (pageName) {
+ uint i;
+ for (i = 0; i < _pages.size(); ++i) {
+ if(*pageName == _pages[i]->getName()) {
+ _page = _pages[i];
+ }
+ }
+ assert(i < _pages.size());
+ }
+
+ if (_page) {
+ _page->init(isLoadingSave); // module changed or from save
+ return;
+ }
+
+ if (_page != _pages[0]) {
+ if (_page) {
+ assert(0); // in original code there is call to page func but I've never seen it
+ return;
+ }
+ _page = _pages[0];
+ _page->init(isLoadingSave); // new game
+ return;
+ }
+
+ assert(0);
+}
+
+PinkEngine *Module::getGame() const {
+ return _game;
+}
+
+} // End of namespace Pink
+
+
+
diff --git a/engines/pink/module.h b/engines/pink/module.h
new file mode 100644
index 0000000..1ec10bf
--- /dev/null
+++ b/engines/pink/module.h
@@ -0,0 +1,70 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_MODULE_H
+#define PINK_MODULE_H
+
+#include "archive.h"
+#include <common/str.h>
+#include "engines/pink/object.h"
+#include <common/debug.h>
+#include <engines/pink/utils.h>
+#include <common/hash-str.h>
+#include "inventory.h"
+
+namespace Pink {
+
+class ModuleProxy : public NamedObject {
+public:
+ ModuleProxy();
+ ModuleProxy(const Common::String &name);
+};
+
+class PinkEngine;
+
+class Module : public NamedObject {
+public:
+ Module(PinkEngine *game, const Common::String &name);
+
+ void load(Archive &archive);
+ void init(bool isLoadingSave, const Common::String *pageName);
+
+ void OnLeftButtonDown();
+ void OnMouseMove();
+ void OnKeyboardButtonClick();
+
+private:
+ PinkEngine *_game;
+public:
+ PinkEngine *getGame() const;
+
+private:
+ GamePage *_page;
+ PagesArray _pages;
+ InventoryMgr _invMgr;
+ Common::StringMap _map; // used for saves and maybe for smth else
+};
+
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/module.mk b/engines/pink/module.mk
index a29b18a..b78f3f1 100644
--- a/engines/pink/module.mk
+++ b/engines/pink/module.mk
@@ -8,8 +8,14 @@ MODULE_OBJS = \
sound.o \
file.o \
archive.o \
- objects/object.o \
- objects/module.o \
+ object.o \
+ module.o \
+ page.o \
+ inventory.o \
+ resource_mgr.o \
+ actions/action.o \
+ actors/actor.o \
+ actors/lead_actor.o \
# This module can be built as a plugin
diff --git a/engines/pink/object.cpp b/engines/pink/object.cpp
new file mode 100644
index 0000000..5e99bd7
--- /dev/null
+++ b/engines/pink/object.cpp
@@ -0,0 +1,45 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "object.h"
+#include "archive.h"
+
+namespace Pink {
+
+Pink::NamedObject::NamedObject(const Common::String &name)
+ : _name(name)
+{}
+
+void Pink::NamedObject::deserialize(Archive &archive) {
+ _name = archive.readString();
+}
+
+const Common::String &Pink::NamedObject::getName() const {
+ return _name;
+}
+
+void NamedObject::store(Archive &archive) {
+
+}
+
+} // End of namespace Pink
+
diff --git a/engines/pink/object.h b/engines/pink/object.h
new file mode 100644
index 0000000..f8abf4e
--- /dev/null
+++ b/engines/pink/object.h
@@ -0,0 +1,57 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_OBJECT_H
+#define PINK_OBJECT_H
+
+#include <common/str.h>
+
+namespace Pink {
+
+class Archive;
+
+class Object {
+public:
+ virtual ~Object() {};
+ virtual void load(Archive &){};
+ virtual void store(Archive &){};
+ virtual void deserialize(Archive &){};
+ virtual void init() {}
+};
+
+class NamedObject : public Object {
+public:
+ NamedObject(){};
+ NamedObject(const Common::String &name);
+
+ void deserialize(Archive &archive);
+ void store(Archive &archive);
+
+ const Common::String &getName() const;
+
+private:
+ Common::String _name;
+};
+
+} // End of namespace Pink
+
+#endif
\ No newline at end of file
diff --git a/engines/pink/objects/actor.cpp b/engines/pink/objects/actor.cpp
deleted file mode 100644
index c90afb7..0000000
--- a/engines/pink/objects/actor.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-namespace Pink {
-
-
-
-} // End of namespace Pink
diff --git a/engines/pink/objects/actor.h b/engines/pink/objects/actor.h
deleted file mode 100644
index a9c0ff8..0000000
--- a/engines/pink/objects/actor.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PINK_ACTOR_H
-#define PINK_ACTOR_H
-
-namespace Pink {
-
-class GamePage;
-
-class Actor {
-public:
-
-private:
- GamePage *page;
- //int possibly_isActionNotExist;
- //CAction *action;
- //CObArray actions;
-};
-
-} // End of namespace Pink
-
-#endif
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
deleted file mode 100644
index 7a606e9..0000000
--- a/engines/pink/objects/inventory.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-
-#include "inventory.h"
-
-namespace Pink {
-
-void Pink::InventoryItem::deserialize(Archive &archive) {
- NamedObject::deserialize(archive);
- _initialOwner = archive.readString();
- _currentOwner = _initialOwner;
-}
-
-InventoryMgr::~InventoryMgr() {
- for (int i = 0; i < _invItems.size(); ++i) {
- delete _invItems[i];
- }
-}
-
-void InventoryMgr::deserialize(Archive &archive) {
- archive >> _invItems;
-}
-
-} // End of namespace Pink
-
-
diff --git a/engines/pink/objects/inventory.h b/engines/pink/objects/inventory.h
deleted file mode 100644
index 6dacd87..0000000
--- a/engines/pink/objects/inventory.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PINK_INVENTORY_H
-#define PINK_INVENTORY_H
-
-#include "named_object.h"
-
-namespace Pink {
-
-
-class InventoryItem : public NamedObject {
-public:
- virtual void deserialize(Archive &archive);
-
-private:
- Common::String _initialOwner;
- Common::String _currentOwner;
-};
-
-class InventoryMgr : public Object {
-public:
- virtual ~InventoryMgr();
-
- virtual void deserialize(Archive &archive);
-
-private:
- Common::Array<InventoryItem*> _invItems;
- // other fields. haven't RE them yet
-};
-
-} // End of namespace Pink
-
-#endif
diff --git a/engines/pink/objects/module.cpp b/engines/pink/objects/module.cpp
deleted file mode 100644
index 505b8fb..0000000
--- a/engines/pink/objects/module.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "module.h"
-#include "page.h"
-
-namespace Pink {
-
-ModuleProxy::ModuleProxy(const Common::String &name)
- : NamedObject(name)
-{}
-
-ModuleProxy::ModuleProxy() {}
-
-Module::Module(PinkEngine *game, const Common::String &name)
- : NamedObject(name), _game(game), _page(nullptr)
-{}
-
-void Module::load(Archive &archive){
- archive.mapObject(this);
- NamedObject::deserialize(archive);
-
- archive.readString(); // skip directory
-
- _invMgr.deserialize(archive);
- archive >> _pages;
-}
-
-void Module::init(bool isLoadingSave, const Common::String *pageName) {
- // debugging original
- // 0 0 - new game
- // 0 1 - module changed
- // 1 0 - from save
-
- // 1 1 - haven't seen those values
-
- //this func will be rewrited after testing
-
- if (_page) {
- debug("loading from save");
- }
- if (pageName){
- debug("module changed");
- }
- assert(_pages.size() != 0);
-
- if (pageName) {
- uint i;
- for (i = 0; i < _pages.size(); ++i) {
- if(*pageName == _pages[i]->getName()) {
- _page = _pages[i];
- }
- }
- assert(i < _pages.size());
- }
-
- if (_page) {
- _page->init(isLoadingSave); // module changed or from save
- return;
- }
-
- if (_page != _pages[0]) {
- if (_page) {
- assert(0); // in original code there is call to page func but I've never seen it
- return;
- }
- _page = _pages[0];
- _page->init(isLoadingSave); // new game
- return;
- }
-
- assert(0);
-}
-
-} // End of namespace Pink
-
-
-
diff --git a/engines/pink/objects/module.h b/engines/pink/objects/module.h
deleted file mode 100644
index ea2ecee..0000000
--- a/engines/pink/objects/module.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PINK_MODULE_H
-#define PINK_MODULE_H
-
-#include "../archive.h"
-#include <common/str.h>
-#include "object.h"
-#include "named_object.h"
-#include <common/debug.h>
-#include <engines/pink/utils.h>
-#include <common/hash-str.h>
-#include "inventory.h"
-
-namespace Pink {
-
-class ModuleProxy : public NamedObject {
-public:
- ModuleProxy();
- ModuleProxy(const Common::String &name);
-};
-
-class PinkEngine;
-
-class Module : public NamedObject {
-public:
- Module(PinkEngine *game, const Common::String &name);
-
- void load(Archive &archive);
- void init(bool isLoadingSave, const Common::String *pageName);
-
- void OnLeftButtonDown();
- void OnMouseMove();
- void OnKeyboardButtonClick();
-
-private:
- PinkEngine *_game;
- GamePage *_page;
- PagesArray _pages;
- InventoryMgr _invMgr;
- Common::StringMap _map; // used for saves and maybe for smth else
-};
-
-
-} // End of namespace Pink
-
-#endif
diff --git a/engines/pink/objects/object.h b/engines/pink/objects/object.h
deleted file mode 100644
index f6e1ee7..0000000
--- a/engines/pink/objects/object.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PINK_OBJECT_H
-#define PINK_OBJECT_H
-
-namespace Pink {
-
-class Archive;
-
-class Object {
-public:
- virtual ~Object() {};
- virtual void load(Archive &){};
- virtual void store(Archive &){};
- virtual void deserialize(Archive &){};
- virtual void init() {}
-};
-
-} // End of namespace Pink
-
-#endif
\ No newline at end of file
diff --git a/engines/pink/objects/page.cpp b/engines/pink/objects/page.cpp
deleted file mode 100644
index 31bb48b..0000000
--- a/engines/pink/objects/page.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "page.h"
-
-namespace Pink {
-
-void Page::load(Archive &archive) {
- archive.mapObject(this);
- NamedObject::deserialize(archive);
- archive.readString(); //skip directory
- // deserialize actors
-}
-
-void GamePage::deserialize(Archive &archive) {
- Page::deserialize(archive);
- _module = static_cast<Module*>(archive.readObject());
- assert(dynamic_cast<Module*>(_module) != 0);
-}
-
-void GamePage::load(Archive &archive) {
- //archive.mapObject(_cursorMgr);
- //archive.mapObject(_walkMgr);
- //archive.mapObject(_sequencer);
- //_leadActor = archive.readObject()
- //serialize ccursormgr NullSub
- //serialize walkmgr
- //serialize sequencer
- //serialize handlers
-}
-
-void GamePage::init(bool isLoadingSave) {
- if (isLoadingSave){
- assert(perhapsIsLoaded == 0);
- // loadSerialize
- }
-}
-
-} // End of namespace Pink
diff --git a/engines/pink/objects/page.h b/engines/pink/objects/page.h
deleted file mode 100644
index f2ef83c..0000000
--- a/engines/pink/objects/page.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PINK_PAGE_H
-#define PINK_PAGE_H
-
-#include "object.h"
-#include "module.h"
-
-namespace Pink {
-
-class Archive;
-
-class Page : public NamedObject {
-public:
-
- void load(Archive &archive);
-
-private:
- /*
- *
- * CLeadActor *_leadActor;
- int unk_1;
- CObArray actors;
- CString _str;
- PageResources *_ResourseMgr;
- */
-};
-
-class GamePage : public Page {
-public:
- void deserialize(Archive &archive);
-
- void load(Archive &archive);
-
-
- void init(bool isLoadingSave);
-private:
- int perhapsIsLoaded;
- Module *_module;
- /*
- int perhaps_notLoaded;
- int cunk_1;
- int memfile;
- CModule *_module;
- CCursorMgr *cursor_mgr;
- CWalkMgr *walkMgr;
- CSequencer *sequencer;
- CMapStringToString map;
- CObArray handlers;
- int unk;
- */
-};
-
-} // End of namespace Pink
-
-#endif
\ No newline at end of file
diff --git a/engines/pink/page.cpp b/engines/pink/page.cpp
new file mode 100644
index 0000000..3b769a4
--- /dev/null
+++ b/engines/pink/page.cpp
@@ -0,0 +1,78 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include <engines/pink/walk/walk_mgr.h>
+#include "page.h"
+#include "cursor_mgr.h"
+#include "actors/lead_actor.h"
+#include "sequencer.h"
+
+namespace Pink {
+
+void Page::load(Archive &archive) {
+ archive.mapObject(this);
+ NamedObject::deserialize(archive);
+ archive.readString(); //skip directory
+ archive >> _actors;
+}
+
+void GamePage::deserialize(Archive &archive) {
+ Page::deserialize(archive);
+ _module = static_cast<Module*>(archive.readObject());
+ assert(dynamic_cast<Module*>(_module) != 0);
+}
+
+void GamePage::load(Archive &archive) {
+ archive.mapObject(_cursorMgr);
+ archive.mapObject(_walkMgr);
+ archive.mapObject(_sequencer);
+
+ Page::load(archive);
+
+ _leadActor = static_cast<LeadActor*>(archive.readObject());
+
+ _walkMgr->deserialize(archive);
+
+ _sequencer->deserialize(archive);
+ //serialize handlers
+}
+
+void GamePage::init(bool isLoadingSave) {
+ if (!isLoadingSave){
+ //assert(perhapsIsLoaded == 0);
+ loadFields();
+ }
+}
+
+void GamePage::loadFields() {
+ perhapsIsLoaded = true;
+ _cursorMgr = new CursorMgr(this);
+ _walkMgr = new WalkMgr;
+ _sequencer = new Sequencer(this);
+
+ _resMgr.init(_module->getGame(), this);
+
+ // memfile manipulations
+
+}
+
+} // End of namespace Pink
diff --git a/engines/pink/page.h b/engines/pink/page.h
new file mode 100644
index 0000000..5ea05bc
--- /dev/null
+++ b/engines/pink/page.h
@@ -0,0 +1,85 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_PAGE_H
+#define PINK_PAGE_H
+
+#include "engines/pink/object.h"
+#include "engines/pink/module.h"
+#include "resource_mgr.h"
+
+namespace Pink {
+
+class Archive;
+class Actor;
+class LeadActor;
+
+
+class Page : public NamedObject {
+public:
+
+ void load(Archive &archive);
+
+protected:
+ ResourceMgr _resMgr;
+ LeadActor *_leadActor;
+ Common::Array<Actor*> _actors;
+
+ /*
+ int unk_1;
+ CString _str;
+ */
+};
+
+
+class CursorMgr;
+class WalkMgr;
+class Sequencer;
+
+class GamePage : public Page {
+public:
+ virtual void deserialize(Archive &archive);
+ virtual void load(Archive &archive);
+ void loadFields();;
+
+ void init(bool isLoadingSave);
+
+
+private:
+ int perhapsIsLoaded;
+ Module *_module;
+ CursorMgr *_cursorMgr;
+ WalkMgr *_walkMgr;
+ Sequencer *_sequencer;
+ /*
+ int perhaps_notLoaded;
+ int cunk_1;
+ int memfile;
+ CMapStringToString map;
+ CObArray handlers;
+ int unk;
+ */
+};
+
+} // End of namespace Pink
+
+#endif
\ No newline at end of file
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index 4df3dfe..9f28681 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -24,7 +24,7 @@
#include "console.h"
#include <engines/util.h>
#include <common/debug-channels.h>
-#include "objects/module.h"
+#include "module.h"
namespace Pink {
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index 4aa6918..834f787 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -23,7 +23,6 @@
#ifndef PINK_PINK_H
#define PINK_PINK_H
-#include <engines/pink/objects/named_object.h>
#include "common/random.h"
#include "engines/engine.h"
#include "gui/EventRecorder.h"
diff --git a/engines/pink/resource_mgr.cpp b/engines/pink/resource_mgr.cpp
index 6676b0f..dc53cf3 100644
--- a/engines/pink/resource_mgr.cpp
+++ b/engines/pink/resource_mgr.cpp
@@ -23,7 +23,7 @@
#include "resource_mgr.h"
#include "file.h"
#include "pink.h"
-#include "objects/page.h"
+#include "page.h"
namespace Pink {
diff --git a/engines/pink/walk/walk_location.cpp b/engines/pink/walk/walk_location.cpp
new file mode 100644
index 0000000..239c69f
--- /dev/null
+++ b/engines/pink/walk/walk_location.cpp
@@ -0,0 +1,31 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "walk_location.h"
+#include "../archive.h"
+
+void Pink::WalkLocation::deserialize(Pink::Archive &archive) {
+ NamedObject::deserialize(archive);
+ // serialize string array
+ //intro has zero, so skip
+ assert(archive.readCount() == 0);
+}
diff --git a/engines/pink/walk/walk_location.h b/engines/pink/walk/walk_location.h
new file mode 100644
index 0000000..0ad5adf
--- /dev/null
+++ b/engines/pink/walk/walk_location.h
@@ -0,0 +1,41 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+#ifndef PINK_WALK_LOCATION_H
+#define PINK_WALK_LOCATION_H
+
+#include <engines/pink/object.h>
+#include <common/array.h>
+
+namespace Pink {
+
+class WalkLocation : public NamedObject {
+public:
+ virtual void deserialize(Archive &archive);
+
+private:
+
+
+};
+
+} // End of namespace Pink
+
+#endif
\ No newline at end of file
diff --git a/engines/pink/walk/walk_mgr.cpp b/engines/pink/walk/walk_mgr.cpp
new file mode 100644
index 0000000..f2b947b
--- /dev/null
+++ b/engines/pink/walk/walk_mgr.cpp
@@ -0,0 +1,12 @@
+//
+// Created by andrei on 3/17/18.
+//
+
+#include "walk_mgr.h"
+#include "../archive.h"
+
+
+void Pink::WalkMgr::deserialize(Pink::Archive &archive) {
+ // setLeadActorRef;
+ archive >> _locations;
+}
diff --git a/engines/pink/walk/walk_mgr.h b/engines/pink/walk/walk_mgr.h
new file mode 100644
index 0000000..27321cf
--- /dev/null
+++ b/engines/pink/walk/walk_mgr.h
@@ -0,0 +1,43 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_WALK_MGR_H
+#define PINK_WALK_MGR_H
+
+#include <common/array.h>
+#include "engines/pink/object.h"
+
+namespace Pink {
+
+class WalkLocation;
+
+class WalkMgr : public Object {
+public:
+ virtual void deserialize(Archive &archive);
+
+private:
+ Common::Array<WalkLocation*> _locations;
+};
+
+} // End of namespace Pink
+
+#endif
Commit: 5cf3d0e309d03abec502f986f65dc6144f972c54
https://github.com/scummvm/scummvm/commit/5cf3d0e309d03abec502f986f65dc6144f972c54
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Added LeadActor pointer field to WalkMgr
Changed paths:
R engines/pink/objects/named_object.h
engines/pink/walk/walk_mgr.cpp
engines/pink/walk/walk_mgr.h
diff --git a/engines/pink/objects/named_object.h b/engines/pink/objects/named_object.h
deleted file mode 100644
index a0136f7..0000000
--- a/engines/pink/objects/named_object.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PINK_NAMED_OBJECT_H
-#define PINK_NAMED_OBJECT_H
-
-#include "../archive.h"
-#include <common/str.h>
-#include "object.h"
-#include <common/debug.h>
-
-namespace Pink {
-
-class NamedObject : public Object {
-public:
- NamedObject(){};
- NamedObject(const Common::String &name)
- : _name(name)
- {}
-
- void deserialize(Archive &archive){
- _name = archive.readString();
- debug("NamedObject %s loaded", _name.c_str());
- }
- void store(Archive &archive){
-
- }
-
- const Common::String &getName() const {
- return _name;
- }
-
-private:
- Common::String _name;
-};
-
-} // End of namespace Pink
-
-#endif
\ No newline at end of file
diff --git a/engines/pink/walk/walk_mgr.cpp b/engines/pink/walk/walk_mgr.cpp
index f2b947b..cf97d61 100644
--- a/engines/pink/walk/walk_mgr.cpp
+++ b/engines/pink/walk/walk_mgr.cpp
@@ -7,6 +7,6 @@
void Pink::WalkMgr::deserialize(Pink::Archive &archive) {
- // setLeadActorRef;
+ _leadActor = static_cast<LeadActor*>(archive.readObject());
archive >> _locations;
}
diff --git a/engines/pink/walk/walk_mgr.h b/engines/pink/walk/walk_mgr.h
index 27321cf..857268d 100644
--- a/engines/pink/walk/walk_mgr.h
+++ b/engines/pink/walk/walk_mgr.h
@@ -29,12 +29,14 @@
namespace Pink {
class WalkLocation;
+class LeadActor;
class WalkMgr : public Object {
public:
virtual void deserialize(Archive &archive);
private:
+ LeadActor *_leadActor;
Common::Array<WalkLocation*> _locations;
};
Commit: bccb294e6aac585dcb2d0348f277e65d929154eb
https://github.com/scummvm/scummvm/commit/bccb294e6aac585dcb2d0348f277e65d929154eb
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Added missing include
Changed paths:
engines/pink/walk/walk_mgr.cpp
diff --git a/engines/pink/walk/walk_mgr.cpp b/engines/pink/walk/walk_mgr.cpp
index cf97d61..ce7690a 100644
--- a/engines/pink/walk/walk_mgr.cpp
+++ b/engines/pink/walk/walk_mgr.cpp
@@ -3,6 +3,7 @@
//
#include "walk_mgr.h"
+#include "../actors/lead_actor.h"
#include "../archive.h"
Commit: 1d97b960c5339037bb26d03b7b3e1a2df20b0ecb
https://github.com/scummvm/scummvm/commit/1d97b960c5339037bb26d03b7b3e1a2df20b0ecb
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Added missing field to WalkLocation class
Changed paths:
engines/pink/archive.h
engines/pink/utils.h
engines/pink/walk/walk_location.cpp
engines/pink/walk/walk_location.h
diff --git a/engines/pink/archive.h b/engines/pink/archive.h
index 9ca1c29..57ee78d 100644
--- a/engines/pink/archive.h
+++ b/engines/pink/archive.h
@@ -23,7 +23,7 @@
#ifndef PINK_ARCHIVE_H
#define PINK_ARCHIVE_H
-#include <common/array.h>
+#include "utils.h"
#include <engines/pink/object.h>
namespace Common {
@@ -83,6 +83,14 @@ inline Archive &operator>>(Archive &archive, uint32 &num){
return archive;
}
+inline Archive &operator>>(Archive &archive, StringArray &array){
+ uint32 size = archive.readCount();
+ array.resize(size);
+ for (uint i = 0; i < size; ++i) {
+ array[i] = archive.readString();
+ }
+ return archive;
+}
} // End of namespace Pink
diff --git a/engines/pink/utils.h b/engines/pink/utils.h
index 82fb39d..feb164c 100644
--- a/engines/pink/utils.h
+++ b/engines/pink/utils.h
@@ -33,6 +33,7 @@ namespace Pink {
using ObArray = Common::Array<Object*>;
using ModulesArray = Common::Array<NamedObject*>;
using PagesArray = Common::Array<GamePage*>;
+ using StringArray = Common::Array<Common::String>;
}
#endif
diff --git a/engines/pink/walk/walk_location.cpp b/engines/pink/walk/walk_location.cpp
index 239c69f..7bf19ea 100644
--- a/engines/pink/walk/walk_location.cpp
+++ b/engines/pink/walk/walk_location.cpp
@@ -25,7 +25,5 @@
void Pink::WalkLocation::deserialize(Pink::Archive &archive) {
NamedObject::deserialize(archive);
- // serialize string array
- //intro has zero, so skip
- assert(archive.readCount() == 0);
+ archive >> _neighbors;
}
diff --git a/engines/pink/walk/walk_location.h b/engines/pink/walk/walk_location.h
index 0ad5adf..da96a14 100644
--- a/engines/pink/walk/walk_location.h
+++ b/engines/pink/walk/walk_location.h
@@ -24,6 +24,7 @@
#include <engines/pink/object.h>
#include <common/array.h>
+#include <engines/pink/utils.h>
namespace Pink {
@@ -32,8 +33,7 @@ public:
virtual void deserialize(Archive &archive);
private:
-
-
+ StringArray _neighbors;
};
} // End of namespace Pink
Commit: 6885bc2636c92ed6d43c7e4b10df3665b22b0932
https://github.com/scummvm/scummvm/commit/6885bc2636c92ed6d43c7e4b10df3665b22b0932
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Added Sequencer, Sequence and SequenceItem
Changed paths:
A engines/pink/items/sequence_item.cpp
A engines/pink/items/sequence_item.h
A engines/pink/sequences/sequence.cpp
A engines/pink/sequences/sequence.h
A engines/pink/sequences/sequencer.cpp
A engines/pink/sequences/sequencer.h
engines/pink/actors/lead_actor.cpp
engines/pink/archive.cpp
engines/pink/page.cpp
diff --git a/engines/pink/actors/lead_actor.cpp b/engines/pink/actors/lead_actor.cpp
index 308e641..80a9281 100644
--- a/engines/pink/actors/lead_actor.cpp
+++ b/engines/pink/actors/lead_actor.cpp
@@ -23,7 +23,7 @@
#include "lead_actor.h"
#include "../walk/walk_mgr.h"
#include "../cursor_mgr.h"
-#include "../sequencer.h"
+#include "engines/pink/sequences/sequencer.h"
#include "../archive.h"
namespace Pink {
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp
index 265c9c6..621135a 100644
--- a/engines/pink/archive.cpp
+++ b/engines/pink/archive.cpp
@@ -27,6 +27,8 @@
#include <engines/pink/actions/action_hide.h>
#include <engines/pink/actions/action_play.h>
#include <engines/pink/actions/action_sound.h>
+#include <engines/pink/sequences/sequence.h>
+#include "items/sequence_item.h"
#include "module.h"
#include "page.h"
#include "actors/lead_actor.h"
@@ -164,6 +166,10 @@ static Object* createObject(int objectId){
return new LeadActor;
case kModuleProxy:
return new ModuleProxy;
+ case kSequence:
+ return new Sequence;
+ case kSequenceItem:
+ return new SequenceItem;
case kWalkLocation:
return new WalkLocation;
default:
diff --git a/engines/pink/items/sequence_item.cpp b/engines/pink/items/sequence_item.cpp
new file mode 100644
index 0000000..0672fd9
--- /dev/null
+++ b/engines/pink/items/sequence_item.cpp
@@ -0,0 +1,32 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "sequence_item.h"
+#include "../archive.h"
+
+namespace Pink {
+
+void SequenceItem::deserialize(Archive &archive) {
+ archive >> _actor >> _action;
+}
+
+} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/items/sequence_item.h b/engines/pink/items/sequence_item.h
new file mode 100644
index 0000000..b81d193
--- /dev/null
+++ b/engines/pink/items/sequence_item.h
@@ -0,0 +1,41 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_SEQUENCE_ITEM_H
+#define PINK_SEQUENCE_ITEM_H
+
+#include <engines/pink/object.h>
+
+namespace Pink {
+
+class SequenceItem : public Object {
+public:
+ virtual void deserialize(Archive &archive);
+
+private:
+ Common::String _actor;
+ Common::String _action;
+};
+
+}
+
+#endif
diff --git a/engines/pink/page.cpp b/engines/pink/page.cpp
index 3b769a4..0bbedac 100644
--- a/engines/pink/page.cpp
+++ b/engines/pink/page.cpp
@@ -24,7 +24,7 @@
#include "page.h"
#include "cursor_mgr.h"
#include "actors/lead_actor.h"
-#include "sequencer.h"
+#include "engines/pink/sequences/sequencer.h"
namespace Pink {
diff --git a/engines/pink/sequences/sequence.cpp b/engines/pink/sequences/sequence.cpp
new file mode 100644
index 0000000..fbee15e
--- /dev/null
+++ b/engines/pink/sequences/sequence.cpp
@@ -0,0 +1,34 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "sequence.h"
+#include "../archive.h"
+
+namespace Pink {
+
+void Sequence::deserialize(Archive &archive) {
+ NamedObject::deserialize(archive);
+ _sequencer = static_cast<Sequencer*>(archive.readObject());
+ archive >> _items;
+}
+
+} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/sequences/sequence.h b/engines/pink/sequences/sequence.h
new file mode 100644
index 0000000..6171459
--- /dev/null
+++ b/engines/pink/sequences/sequence.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_SEQUENCE_H
+#define PINK_SEQUENCE_H
+
+#include <engines/pink/object.h>
+#include <common/array.h>
+
+namespace Pink {
+
+class Sequencer;
+class SequenceItem;
+
+class Sequence : public NamedObject {
+public:
+ virtual void deserialize(Archive &archive);
+
+private:
+ Sequencer *_sequencer;
+ Common::Array<SequenceItem*> _items;
+ //context
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/sequences/sequencer.cpp b/engines/pink/sequences/sequencer.cpp
new file mode 100644
index 0000000..b4914bc
--- /dev/null
+++ b/engines/pink/sequences/sequencer.cpp
@@ -0,0 +1,40 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+
+#include "sequencer.h"
+#include "engines/pink/archive.h"
+
+namespace Pink {
+
+Sequencer::Sequencer(GamePage *page)
+ : _page(page)
+{}
+
+void Sequencer::deserialize(Archive &archive) {
+ archive >> _sequences;
+ archive.readCount();// intro have 0 timers;
+ //serialize timers;
+
+}
+
+} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/sequences/sequencer.h b/engines/pink/sequences/sequencer.h
new file mode 100644
index 0000000..2ac8e03
--- /dev/null
+++ b/engines/pink/sequences/sequencer.h
@@ -0,0 +1,51 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+
+#ifndef PINK_SEQUENCER_H
+#define PINK_SEQUENCER_H
+
+#include <common/array.h>
+#include "engines/pink/object.h"
+
+namespace Pink {
+
+class Sequence;
+class GamePage;
+
+class Sequencer : public Object {
+public:
+ Sequencer(GamePage *page);
+
+ virtual void deserialize(Archive &archive);
+
+private:
+ //context
+ // unknown objects array
+ Common::Array<Sequence*> _sequences;
+ //timers
+ GamePage *_page;
+};
+
+} // End of namespace Pink
+
+#endif
\ No newline at end of file
Commit: d6f0613adfa229133734a9373a0065e19454083a
https://github.com/scummvm/scummvm/commit/d6f0613adfa229133734a9373a0065e19454083a
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Added SequenceItemLeader and SequenceItemDefaultAction
Changed paths:
A engines/pink/items/sequence_item_default_action.cpp
A engines/pink/items/sequence_item_default_action.h
A engines/pink/items/sequence_item_leader.cpp
A engines/pink/items/sequence_item_leader.h
engines/pink/archive.cpp
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp
index 621135a..363feda 100644
--- a/engines/pink/archive.cpp
+++ b/engines/pink/archive.cpp
@@ -28,7 +28,8 @@
#include <engines/pink/actions/action_play.h>
#include <engines/pink/actions/action_sound.h>
#include <engines/pink/sequences/sequence.h>
-#include "items/sequence_item.h"
+#include <engines/pink/items/sequence_item_default_action.h>
+#include <engines/pink/items/sequence_item_leader.h>
#include "module.h"
#include "page.h"
#include "actors/lead_actor.h"
@@ -170,6 +171,10 @@ static Object* createObject(int objectId){
return new Sequence;
case kSequenceItem:
return new SequenceItem;
+ case kSequenceItemDefaultAction:
+ return new SequenceItemDefaultAction;
+ case kSequenceItemLeader:
+ return new SequenceItemLeader;
case kWalkLocation:
return new WalkLocation;
default:
diff --git a/engines/pink/items/sequence_item_default_action.cpp b/engines/pink/items/sequence_item_default_action.cpp
new file mode 100644
index 0000000..58d8830
--- /dev/null
+++ b/engines/pink/items/sequence_item_default_action.cpp
@@ -0,0 +1,25 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+namespace Pink {
+
+} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/items/sequence_item_default_action.h b/engines/pink/items/sequence_item_default_action.h
new file mode 100644
index 0000000..3538464
--- /dev/null
+++ b/engines/pink/items/sequence_item_default_action.h
@@ -0,0 +1,36 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_SEQUENCE_ITEM_DEFAULT_ACTION_H
+#define PINK_SEQUENCE_ITEM_DEFAULT_ACTION_H
+
+#include "sequence_item.h"
+
+namespace Pink {
+
+class SequenceItemDefaultAction : public SequenceItem {
+
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/items/sequence_item_leader.cpp b/engines/pink/items/sequence_item_leader.cpp
new file mode 100644
index 0000000..8c3eb17
--- /dev/null
+++ b/engines/pink/items/sequence_item_leader.cpp
@@ -0,0 +1,26 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+namespace Pink {
+
+
+} //End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/items/sequence_item_leader.h b/engines/pink/items/sequence_item_leader.h
new file mode 100644
index 0000000..9edfc05
--- /dev/null
+++ b/engines/pink/items/sequence_item_leader.h
@@ -0,0 +1,38 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_SEQUENCE_ITEM_LEADER_H
+#define PINK_SEQUENCE_ITEM_LEADER_H
+
+#include "sequence_item.h"
+
+namespace Pink {
+
+class SequenceItemLeader : public SequenceItem {
+public:
+
+private:
+};
+
+}
+
+#endif
Commit: 45458542da30b544f9ac3ba2adc9aeffac3ab93e
https://github.com/scummvm/scummvm/commit/45458542da30b544f9ac3ba2adc9aeffac3ab93e
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Added Handler and HandlerStartPage
Changed paths:
A engines/pink/handlers/handler.cpp
A engines/pink/handlers/handler.h
A engines/pink/handlers/handler_start_page.cpp
A engines/pink/handlers/handler_start_page.h
engines/pink/sequences/sequence.cpp
diff --git a/engines/pink/handlers/handler.cpp b/engines/pink/handlers/handler.cpp
new file mode 100644
index 0000000..e2d3539
--- /dev/null
+++ b/engines/pink/handlers/handler.cpp
@@ -0,0 +1,31 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "handler.h"
+
+namespace Pink {
+
+void Handler::deserialize(Archive &archive) {
+
+}
+
+} // End of namespace Pink
diff --git a/engines/pink/handlers/handler.h b/engines/pink/handlers/handler.h
new file mode 100644
index 0000000..803c4f4
--- /dev/null
+++ b/engines/pink/handlers/handler.h
@@ -0,0 +1,39 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_HANDLER_H
+#define PINK_HANDLER_H
+
+#include <engines/pink/object.h>
+
+namespace Pink {
+
+class Handler : public Object {
+public:
+ virtual void deserialize(Archive &archive);
+ //_conditions
+ //_sideEffects
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/handlers/handler_start_page.cpp b/engines/pink/handlers/handler_start_page.cpp
new file mode 100644
index 0000000..58d8830
--- /dev/null
+++ b/engines/pink/handlers/handler_start_page.cpp
@@ -0,0 +1,25 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+namespace Pink {
+
+} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/handlers/handler_start_page.h b/engines/pink/handlers/handler_start_page.h
new file mode 100644
index 0000000..9e76d36
--- /dev/null
+++ b/engines/pink/handlers/handler_start_page.h
@@ -0,0 +1,36 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_HANDLER_START_PAGE_H
+#define PINK_HANDLER_START_PAGE_H
+
+#include "handler.h"
+
+namespace Pink {
+
+class HandlerStartPage : public Handler {
+
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/sequences/sequence.cpp b/engines/pink/sequences/sequence.cpp
index fbee15e..d3a6872 100644
--- a/engines/pink/sequences/sequence.cpp
+++ b/engines/pink/sequences/sequence.cpp
@@ -21,6 +21,7 @@
*/
#include "sequence.h"
+#include "sequencer.h"
#include "../archive.h"
namespace Pink {
Commit: f62132c4f3738ce24fa3cf0e449417baeb2e86fe
https://github.com/scummvm/scummvm/commit/f62132c4f3738ce24fa3cf0e449417baeb2e86fe
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Added SideEffect, SideEffectExit, SideEffectVariable, SideEffectModuleVariable and
HandlerSequences
Currently engine is able to load first GamePage;
Changed paths:
A engines/pink/handlers/handler_sequences.cpp
A engines/pink/handlers/handler_sequences.h
A engines/pink/side_effects/side_effect.cpp
A engines/pink/side_effects/side_effect.h
A engines/pink/side_effects/side_effect_exit.cpp
A engines/pink/side_effects/side_effect_exit.h
A engines/pink/side_effects/side_effect_module_variable.cpp
A engines/pink/side_effects/side_effect_module_variable.h
A engines/pink/side_effects/side_effect_variable.cpp
A engines/pink/side_effects/side_effect_variable.h
engines/pink/archive.cpp
engines/pink/handlers/handler.cpp
engines/pink/handlers/handler.h
engines/pink/handlers/handler_start_page.h
engines/pink/page.cpp
engines/pink/page.h
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp
index 363feda..b03cf91 100644
--- a/engines/pink/archive.cpp
+++ b/engines/pink/archive.cpp
@@ -30,6 +30,9 @@
#include <engines/pink/sequences/sequence.h>
#include <engines/pink/items/sequence_item_default_action.h>
#include <engines/pink/items/sequence_item_leader.h>
+#include <engines/pink/handlers/handler_start_page.h>
+#include <engines/pink/side_effects/side_effect_exit.h>
+#include <engines/pink/side_effects/side_effect_module_variable.h>
#include "module.h"
#include "page.h"
#include "actors/lead_actor.h"
@@ -161,6 +164,8 @@ static Object* createObject(int objectId){
return new Actor;
case kGamePage:
return new GamePage;
+ case kHandlerStartPage:
+ return new HandlerStartPage;
case kInventoryItem:
return new InventoryItem;
case kLeadActor:
@@ -175,6 +180,10 @@ static Object* createObject(int objectId){
return new SequenceItemDefaultAction;
case kSequenceItemLeader:
return new SequenceItemLeader;
+ case kSideEffectExit:
+ return new SideEffectExit;
+ case kSideEffectModuleVariable:
+ return new SideEffectModuleVariable;
case kWalkLocation:
return new WalkLocation;
default:
diff --git a/engines/pink/handlers/handler.cpp b/engines/pink/handlers/handler.cpp
index e2d3539..300071b 100644
--- a/engines/pink/handlers/handler.cpp
+++ b/engines/pink/handlers/handler.cpp
@@ -21,11 +21,13 @@
*/
#include "handler.h"
+#include "../archive.h"
namespace Pink {
void Handler::deserialize(Archive &archive) {
-
+ assert(archive.readCount() == 0); // intro has zero conditions, so skip;
+ archive >> _sideEffects;
}
} // End of namespace Pink
diff --git a/engines/pink/handlers/handler.h b/engines/pink/handlers/handler.h
index 803c4f4..1acd9ad 100644
--- a/engines/pink/handlers/handler.h
+++ b/engines/pink/handlers/handler.h
@@ -24,14 +24,19 @@
#define PINK_HANDLER_H
#include <engines/pink/object.h>
+#include <common/array.h>
namespace Pink {
+class SideEffect;
+
class Handler : public Object {
public:
virtual void deserialize(Archive &archive);
+
+private:
//_conditions
- //_sideEffects
+ Common::Array<SideEffect*> _sideEffects;
};
} // End of namespace Pink
diff --git a/engines/pink/handlers/handler_sequences.cpp b/engines/pink/handlers/handler_sequences.cpp
new file mode 100644
index 0000000..9386338
--- /dev/null
+++ b/engines/pink/handlers/handler_sequences.cpp
@@ -0,0 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "handler_sequences.h"
+#include "../archive.h"
+
+namespace Pink {
+
+void HandlerSequences::deserialize(Archive &archive) {
+ Handler::deserialize(archive);
+ archive >> _sequences;
+}
+
+} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/handlers/handler_sequences.h b/engines/pink/handlers/handler_sequences.h
new file mode 100644
index 0000000..46023ea
--- /dev/null
+++ b/engines/pink/handlers/handler_sequences.h
@@ -0,0 +1,40 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+#ifndef PINK_HANDLER_SEQUENCES_H
+#define PINK_HANDLER_SEQUENCES_H
+
+#include <engines/pink/utils.h>
+#include "handler.h"
+
+namespace Pink {
+
+class HandlerSequences : public Handler {
+public:
+ virtual void deserialize(Archive &archive);
+
+private:
+ StringArray _sequences;
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/handlers/handler_start_page.h b/engines/pink/handlers/handler_start_page.h
index 9e76d36..202b320 100644
--- a/engines/pink/handlers/handler_start_page.h
+++ b/engines/pink/handlers/handler_start_page.h
@@ -24,10 +24,11 @@
#define PINK_HANDLER_START_PAGE_H
#include "handler.h"
+#include "handler_sequences.h"
namespace Pink {
-class HandlerStartPage : public Handler {
+class HandlerStartPage : public HandlerSequences {
};
diff --git a/engines/pink/page.cpp b/engines/pink/page.cpp
index 0bbedac..411da0b 100644
--- a/engines/pink/page.cpp
+++ b/engines/pink/page.cpp
@@ -53,7 +53,7 @@ void GamePage::load(Archive &archive) {
_walkMgr->deserialize(archive);
_sequencer->deserialize(archive);
- //serialize handlers
+ archive >> _handlers;
}
void GamePage::init(bool isLoadingSave) {
diff --git a/engines/pink/page.h b/engines/pink/page.h
index 5ea05bc..10dcd4e 100644
--- a/engines/pink/page.h
+++ b/engines/pink/page.h
@@ -54,6 +54,7 @@ protected:
class CursorMgr;
class WalkMgr;
class Sequencer;
+class Handler;
class GamePage : public Page {
public:
@@ -70,12 +71,13 @@ private:
CursorMgr *_cursorMgr;
WalkMgr *_walkMgr;
Sequencer *_sequencer;
+ Common::Array<Handler*> _handlers;
+
/*
int perhaps_notLoaded;
int cunk_1;
int memfile;
CMapStringToString map;
- CObArray handlers;
int unk;
*/
};
diff --git a/engines/pink/side_effects/side_effect.cpp b/engines/pink/side_effects/side_effect.cpp
new file mode 100644
index 0000000..58d8830
--- /dev/null
+++ b/engines/pink/side_effects/side_effect.cpp
@@ -0,0 +1,25 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+namespace Pink {
+
+} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/side_effects/side_effect.h b/engines/pink/side_effects/side_effect.h
new file mode 100644
index 0000000..628fe1e
--- /dev/null
+++ b/engines/pink/side_effects/side_effect.h
@@ -0,0 +1,38 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_SIDE_EFFECT_H
+#define PINK_SIDE_EFFECT_H
+
+#include <engines/pink/object.h>
+
+namespace Pink {
+
+class SideEffect : public Object {
+public:
+
+
+};
+
+}
+
+#endif
diff --git a/engines/pink/side_effects/side_effect_exit.cpp b/engines/pink/side_effects/side_effect_exit.cpp
new file mode 100644
index 0000000..5232012
--- /dev/null
+++ b/engines/pink/side_effects/side_effect_exit.cpp
@@ -0,0 +1,32 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "side_effect_exit.h"
+#include "../archive.h"
+
+namespace Pink {
+
+void SideEffectExit::deserialize(Archive &archive) {
+ archive >> _nextModule >> _nextPage;
+}
+
+} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/side_effects/side_effect_exit.h b/engines/pink/side_effects/side_effect_exit.h
new file mode 100644
index 0000000..fdcd7cd
--- /dev/null
+++ b/engines/pink/side_effects/side_effect_exit.h
@@ -0,0 +1,41 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_SIDE_EFFECT_EXIT_H
+#define PINK_SIDE_EFFECT_EXIT_H
+
+#include "side_effect.h"
+
+namespace Pink {
+
+class SideEffectExit : public SideEffect {
+public:
+ virtual void deserialize(Archive &archive);
+
+private:
+ Common::String _nextModule;
+ Common::String _nextPage;
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/side_effects/side_effect_module_variable.cpp b/engines/pink/side_effects/side_effect_module_variable.cpp
new file mode 100644
index 0000000..4972ad0
--- /dev/null
+++ b/engines/pink/side_effects/side_effect_module_variable.cpp
@@ -0,0 +1,22 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
diff --git a/engines/pink/side_effects/side_effect_module_variable.h b/engines/pink/side_effects/side_effect_module_variable.h
new file mode 100644
index 0000000..dc46ded
--- /dev/null
+++ b/engines/pink/side_effects/side_effect_module_variable.h
@@ -0,0 +1,35 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+#ifndef PINK_SIDE_EFFECT_MODULE_VARIABLE_H
+#define PINK_SIDE_EFFECT_MODULE_VARIABLE_H
+
+#include "side_effect_variable.h"
+
+namespace Pink {
+
+class SideEffectModuleVariable : public SideEffectVariable {
+
+};
+
+}
+
+#endif
\ No newline at end of file
diff --git a/engines/pink/side_effects/side_effect_variable.cpp b/engines/pink/side_effects/side_effect_variable.cpp
new file mode 100644
index 0000000..17481aa
--- /dev/null
+++ b/engines/pink/side_effects/side_effect_variable.cpp
@@ -0,0 +1,32 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "side_effect_variable.h"
+#include "../archive.h"
+
+namespace Pink {
+
+void SideEffectVariable::deserialize(Pink::Archive &archive) {
+ archive >> _name >> _value;
+}
+
+}
diff --git a/engines/pink/side_effects/side_effect_variable.h b/engines/pink/side_effects/side_effect_variable.h
new file mode 100644
index 0000000..15d6380
--- /dev/null
+++ b/engines/pink/side_effects/side_effect_variable.h
@@ -0,0 +1,41 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_SIDE_EFFECT_VARIABLE_H
+#define PINK_SIDE_EFFECT_VARIABLE_H
+
+#include "side_effect.h"
+
+namespace Pink {
+
+class SideEffectVariable : public SideEffect {
+public:
+ virtual void deserialize(Archive &archive);
+
+private:
+ Common::String _name;
+ Common::String _value;
+};
+
+} // End of namespace Pink
+
+#endif
Commit: 113540b930589242859ec8367ccf2a7af4a2fa21
https://github.com/scummvm/scummvm/commit/113540b930589242859ec8367ccf2a7af4a2fa21
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Implemented debug output of Objects
Changed paths:
engines/pink/actions/action.h
engines/pink/actions/action_cel.h
engines/pink/actions/action_play.cpp
engines/pink/actions/action_sound.cpp
engines/pink/actions/action_still.h
engines/pink/actors/actor.cpp
engines/pink/handlers/handler.h
engines/pink/handlers/handler_sequences.h
engines/pink/handlers/handler_start_page.cpp
engines/pink/handlers/handler_start_page.h
engines/pink/object.cpp
engines/pink/object.h
engines/pink/page.cpp
engines/pink/side_effects/side_effect_exit.cpp
engines/pink/side_effects/side_effect_module_variable.cpp
engines/pink/side_effects/side_effect_module_variable.h
engines/pink/side_effects/side_effect_variable.h
diff --git a/engines/pink/actions/action.h b/engines/pink/actions/action.h
index 3d71303..5608b99 100644
--- a/engines/pink/actions/action.h
+++ b/engines/pink/actions/action.h
@@ -33,7 +33,7 @@ class Action : public NamedObject {
public:
virtual void deserialize(Archive &archive);
-private:
+protected:
Actor *_actor;
};
diff --git a/engines/pink/actions/action_cel.h b/engines/pink/actions/action_cel.h
index 346b9d2..ca481f7 100644
--- a/engines/pink/actions/action_cel.h
+++ b/engines/pink/actions/action_cel.h
@@ -31,7 +31,7 @@ class ActionCEL : public Action {
public:
virtual void deserialize(Archive &archive);
-private:
+protected:
Common::String _fileName;
uint32 _z; // Z coordinate for sprite
};
diff --git a/engines/pink/actions/action_play.cpp b/engines/pink/actions/action_play.cpp
index d31775d..9dc2ef4 100644
--- a/engines/pink/actions/action_play.cpp
+++ b/engines/pink/actions/action_play.cpp
@@ -20,6 +20,7 @@
*
*/
+#include <common/debug.h>
#include "action_play.h"
#include "../archive.h"
@@ -28,6 +29,8 @@ namespace Pink {
void ActionPlay::deserialize(Archive &archive) {
ActionStill::deserialize(archive);
archive >> _stopFrame;
+ debug("\tActionPlay: _name = %s, _fileName = %s, z = %u, _startFrame = %u,"
+ " _endFrame = %u", _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame);
}
} // End of namespace Pink
diff --git a/engines/pink/actions/action_sound.cpp b/engines/pink/actions/action_sound.cpp
index b5e5c5e..ee85689 100644
--- a/engines/pink/actions/action_sound.cpp
+++ b/engines/pink/actions/action_sound.cpp
@@ -20,6 +20,7 @@
*
*/
+#include <common/debug.h>
#include "action_sound.h"
#include "../archive.h"
@@ -31,6 +32,8 @@ void ActionSound::deserialize(Archive &archive) {
_volume = archive.readDWORD();
_isLoop = (bool) archive.readDWORD();
_isBackground = (bool) archive.readDWORD();
+ debug("\tActionSound: _name = %s, _fileName = %s, _volume = %u, _isLoop = %u,"
+ " _isBackground = %u", _name.c_str(), _fileName.c_str(), _volume, _isLoop, _isBackground);
}
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/actions/action_still.h b/engines/pink/actions/action_still.h
index 9d6c7be..1400766 100644
--- a/engines/pink/actions/action_still.h
+++ b/engines/pink/actions/action_still.h
@@ -31,7 +31,7 @@ class ActionStill : public ActionCEL {
public:
virtual void deserialize(Archive &archive);
-private:
+protected:
uint32 _startFrame;
};
diff --git a/engines/pink/actors/actor.cpp b/engines/pink/actors/actor.cpp
index 30f7e7b..c7a5a9a 100644
--- a/engines/pink/actors/actor.cpp
+++ b/engines/pink/actors/actor.cpp
@@ -22,12 +22,16 @@
#include "actor.h"
#include "../page.h"
+#include "lead_actor.h"
namespace Pink {
void Actor::deserialize(Archive &archive) {
NamedObject::deserialize(archive);
_page = static_cast<GamePage*>(archive.readObject());
+ if (dynamic_cast<LeadActor*>(this))
+ debug("LeadActor: _name = %s", _name.c_str());
+ else debug("Actor: _name = %s", _name.c_str());
archive >> _actions;
}
diff --git a/engines/pink/handlers/handler.h b/engines/pink/handlers/handler.h
index 1acd9ad..6bcac49 100644
--- a/engines/pink/handlers/handler.h
+++ b/engines/pink/handlers/handler.h
@@ -34,7 +34,7 @@ class Handler : public Object {
public:
virtual void deserialize(Archive &archive);
-private:
+protected:
//_conditions
Common::Array<SideEffect*> _sideEffects;
};
diff --git a/engines/pink/handlers/handler_sequences.h b/engines/pink/handlers/handler_sequences.h
index 46023ea..7641b17 100644
--- a/engines/pink/handlers/handler_sequences.h
+++ b/engines/pink/handlers/handler_sequences.h
@@ -31,7 +31,7 @@ class HandlerSequences : public Handler {
public:
virtual void deserialize(Archive &archive);
-private:
+protected:
StringArray _sequences;
};
diff --git a/engines/pink/handlers/handler_start_page.cpp b/engines/pink/handlers/handler_start_page.cpp
index 58d8830..8fef49e 100644
--- a/engines/pink/handlers/handler_start_page.cpp
+++ b/engines/pink/handlers/handler_start_page.cpp
@@ -20,6 +20,19 @@
*
*/
+#include "handler_start_page.h"
+#include <common/debug.h>
+#include "../archive.h"
+
namespace Pink {
+void HandlerStartPage::deserialize(Archive &archive) {
+ debug("HandlerStartPage: ");
+ HandlerSequences::deserialize(archive);
+
+ for (uint i = 0; i < _sequences.size(); ++i) {
+ debug("\t%s", _sequences[i].c_str());
+ }
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/handlers/handler_start_page.h b/engines/pink/handlers/handler_start_page.h
index 202b320..a273e1e 100644
--- a/engines/pink/handlers/handler_start_page.h
+++ b/engines/pink/handlers/handler_start_page.h
@@ -29,7 +29,8 @@
namespace Pink {
class HandlerStartPage : public HandlerSequences {
-
+public:
+ virtual void deserialize(Archive &archive);
};
} // End of namespace Pink
diff --git a/engines/pink/object.cpp b/engines/pink/object.cpp
index 5e99bd7..3d0a2ae 100644
--- a/engines/pink/object.cpp
+++ b/engines/pink/object.cpp
@@ -20,6 +20,7 @@
*
*/
+#include <common/debug.h>
#include "object.h"
#include "archive.h"
diff --git a/engines/pink/object.h b/engines/pink/object.h
index f8abf4e..bd058cf 100644
--- a/engines/pink/object.h
+++ b/engines/pink/object.h
@@ -48,7 +48,7 @@ public:
const Common::String &getName() const;
-private:
+protected:
Common::String _name;
};
diff --git a/engines/pink/page.cpp b/engines/pink/page.cpp
index 411da0b..e802250 100644
--- a/engines/pink/page.cpp
+++ b/engines/pink/page.cpp
@@ -71,7 +71,7 @@ void GamePage::loadFields() {
_resMgr.init(_module->getGame(), this);
- // memfile manipulations
+ // memfile manipulations if from save or page changing
}
diff --git a/engines/pink/side_effects/side_effect_exit.cpp b/engines/pink/side_effects/side_effect_exit.cpp
index 5232012..0a14e1c 100644
--- a/engines/pink/side_effects/side_effect_exit.cpp
+++ b/engines/pink/side_effects/side_effect_exit.cpp
@@ -20,6 +20,7 @@
*
*/
+#include <common/debug.h>
#include "side_effect_exit.h"
#include "../archive.h"
@@ -27,6 +28,8 @@ namespace Pink {
void SideEffectExit::deserialize(Archive &archive) {
archive >> _nextModule >> _nextPage;
+ debug("\tSideEffectExit: _nextModule = %s, _nextPage = %s",
+ _nextModule.c_str(), _nextPage.c_str());
}
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/side_effects/side_effect_module_variable.cpp b/engines/pink/side_effects/side_effect_module_variable.cpp
index 4972ad0..5f3c857 100644
--- a/engines/pink/side_effects/side_effect_module_variable.cpp
+++ b/engines/pink/side_effects/side_effect_module_variable.cpp
@@ -1,3 +1,7 @@
+#include <engines/pink/archive.h>
+#include <common/debug.h>
+#include "side_effect_variable.h"
+
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
@@ -20,3 +24,14 @@
*
*/
+#include "side_effect_module_variable.h"
+
+namespace Pink {
+
+void SideEffectModuleVariable::deserialize(Archive &archive) {
+ SideEffectVariable::deserialize(archive);
+ debug("\tSideEffectModuleVariable: _name = %s _value = %s",
+ _name.c_str(), _value.c_str());
+}
+
+}
\ No newline at end of file
diff --git a/engines/pink/side_effects/side_effect_module_variable.h b/engines/pink/side_effects/side_effect_module_variable.h
index dc46ded..68156f1 100644
--- a/engines/pink/side_effects/side_effect_module_variable.h
+++ b/engines/pink/side_effects/side_effect_module_variable.h
@@ -27,9 +27,10 @@
namespace Pink {
class SideEffectModuleVariable : public SideEffectVariable {
-
+public:
+ virtual void deserialize(Archive &archive);
};
-}
+} // End of namespace Pink
#endif
\ No newline at end of file
diff --git a/engines/pink/side_effects/side_effect_variable.h b/engines/pink/side_effects/side_effect_variable.h
index 15d6380..c5b45f1 100644
--- a/engines/pink/side_effects/side_effect_variable.h
+++ b/engines/pink/side_effects/side_effect_variable.h
@@ -31,7 +31,7 @@ class SideEffectVariable : public SideEffect {
public:
virtual void deserialize(Archive &archive);
-private:
+protected:
Common::String _name;
Common::String _value;
};
Commit: c87a392e1678940a06a3c69e91a414572e70a07b
https://github.com/scummvm/scummvm/commit/c87a392e1678940a06a3c69e91a414572e70a07b
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: More debug output of Objects attributes
Changed paths:
engines/pink/actions/action_hide.cpp
engines/pink/actions/action_hide.h
engines/pink/actions/action_still.cpp
engines/pink/items/sequence_item.cpp
engines/pink/items/sequence_item.h
engines/pink/items/sequence_item_default_action.cpp
engines/pink/items/sequence_item_default_action.h
engines/pink/items/sequence_item_leader.cpp
engines/pink/items/sequence_item_leader.h
engines/pink/page.cpp
engines/pink/pink.cpp
engines/pink/sequences/sequence.cpp
engines/pink/sequences/sequencer.cpp
diff --git a/engines/pink/actions/action_hide.cpp b/engines/pink/actions/action_hide.cpp
index 8c3eb17..9c99bc7 100644
--- a/engines/pink/actions/action_hide.cpp
+++ b/engines/pink/actions/action_hide.cpp
@@ -20,7 +20,16 @@
*
*/
+#include "action_hide.h"
+#include <engines/pink/archive.h>
+#include <common/debug.h>
+
+
namespace Pink {
+void Pink::ActionHide::deserialize(Archive &archive) {
+ Action::deserialize(archive);
+ debug("\tActionHide: _name = %s", _name.c_str());
+}
} //End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/actions/action_hide.h b/engines/pink/actions/action_hide.h
index 2c2af5c..4662d5f 100644
--- a/engines/pink/actions/action_hide.h
+++ b/engines/pink/actions/action_hide.h
@@ -28,7 +28,10 @@
namespace Pink {
class ActionHide : public Action {
+public:
+ virtual void deserialize(Archive &archive);
+public:
};
} //End of namespace Pink
diff --git a/engines/pink/actions/action_still.cpp b/engines/pink/actions/action_still.cpp
index f015a8b..b33476a 100644
--- a/engines/pink/actions/action_still.cpp
+++ b/engines/pink/actions/action_still.cpp
@@ -20,14 +20,20 @@
*
*/
+#include <common/debug.h>
#include "action_still.h"
#include "../archive.h"
+#include "action_play.h"
namespace Pink {
void ActionStill::deserialize(Archive &archive) {
ActionCEL::deserialize(archive);
archive >> _startFrame;
+ if (!dynamic_cast<ActionPlay*>(this)){
+ debug("\tActionStill: _name = %s, _fileName = %s, _startFrame = %u",
+ _name.c_str(), _fileName.c_str(), _startFrame);
+ }
}
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/items/sequence_item.cpp b/engines/pink/items/sequence_item.cpp
index 0672fd9..c021361 100644
--- a/engines/pink/items/sequence_item.cpp
+++ b/engines/pink/items/sequence_item.cpp
@@ -20,6 +20,7 @@
*
*/
+#include <common/debug.h>
#include "sequence_item.h"
#include "../archive.h"
diff --git a/engines/pink/items/sequence_item.h b/engines/pink/items/sequence_item.h
index b81d193..76c81b5 100644
--- a/engines/pink/items/sequence_item.h
+++ b/engines/pink/items/sequence_item.h
@@ -31,7 +31,7 @@ class SequenceItem : public Object {
public:
virtual void deserialize(Archive &archive);
-private:
+protected:
Common::String _actor;
Common::String _action;
};
diff --git a/engines/pink/items/sequence_item_default_action.cpp b/engines/pink/items/sequence_item_default_action.cpp
index 58d8830..279877a 100644
--- a/engines/pink/items/sequence_item_default_action.cpp
+++ b/engines/pink/items/sequence_item_default_action.cpp
@@ -20,6 +20,16 @@
*
*/
+#include <engines/pink/archive.h>
+#include <common/debug.h>
+#include "sequence_item_default_action.h"
+
namespace Pink {
+void Pink::SequenceItemDefaultAction::deserialize(Archive &archive) {
+ SequenceItem::deserialize(archive);
+ debug("\t\tSequenceItemDefaultAction: _actor = %s, _action = %s",
+ _actor.c_str(), _action.c_str());
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/items/sequence_item_default_action.h b/engines/pink/items/sequence_item_default_action.h
index 3538464..9909673 100644
--- a/engines/pink/items/sequence_item_default_action.h
+++ b/engines/pink/items/sequence_item_default_action.h
@@ -28,7 +28,8 @@
namespace Pink {
class SequenceItemDefaultAction : public SequenceItem {
-
+public:
+ virtual void deserialize(Archive &archive);
};
} // End of namespace Pink
diff --git a/engines/pink/items/sequence_item_leader.cpp b/engines/pink/items/sequence_item_leader.cpp
index 8c3eb17..412352a 100644
--- a/engines/pink/items/sequence_item_leader.cpp
+++ b/engines/pink/items/sequence_item_leader.cpp
@@ -20,7 +20,17 @@
*
*/
+#include <engines/pink/archive.h>
+#include <common/debug.h>
+#include "sequence_item_leader.h"
+
namespace Pink {
+void Pink::SequenceItemLeader::deserialize(Archive &archive) {
+ SequenceItem::deserialize(archive);
+ debug("\t\tSequenceItemLeader: _actor = %s, _action = %s",
+ _actor.c_str(), _action.c_str());
+}
+
} //End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/items/sequence_item_leader.h b/engines/pink/items/sequence_item_leader.h
index 9edfc05..b5506ad 100644
--- a/engines/pink/items/sequence_item_leader.h
+++ b/engines/pink/items/sequence_item_leader.h
@@ -29,6 +29,7 @@ namespace Pink {
class SequenceItemLeader : public SequenceItem {
public:
+ virtual void deserialize(Archive &archive);
private:
};
diff --git a/engines/pink/page.cpp b/engines/pink/page.cpp
index e802250..a1d025f 100644
--- a/engines/pink/page.cpp
+++ b/engines/pink/page.cpp
@@ -61,6 +61,13 @@ void GamePage::init(bool isLoadingSave) {
//assert(perhapsIsLoaded == 0);
loadFields();
}
+
+ //init actor which inits actions
+
+ if (!isLoadingSave) {
+
+ }
+
}
void GamePage::loadFields() {
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index 9f28681..950ef23 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -110,6 +110,7 @@ Common::Error Pink::PinkEngine::run() {
}
}
//update();
+
g_system->updateScreen();
g_system->delayMillis(10);
}
diff --git a/engines/pink/sequences/sequence.cpp b/engines/pink/sequences/sequence.cpp
index d3a6872..54a293d 100644
--- a/engines/pink/sequences/sequence.cpp
+++ b/engines/pink/sequences/sequence.cpp
@@ -20,6 +20,7 @@
*
*/
+#include <common/debug.h>
#include "sequence.h"
#include "sequencer.h"
#include "../archive.h"
@@ -28,6 +29,7 @@ namespace Pink {
void Sequence::deserialize(Archive &archive) {
NamedObject::deserialize(archive);
+ debug("\tSequence %s", _name.c_str());
_sequencer = static_cast<Sequencer*>(archive.readObject());
archive >> _items;
}
diff --git a/engines/pink/sequences/sequencer.cpp b/engines/pink/sequences/sequencer.cpp
index b4914bc..f5c9b26 100644
--- a/engines/pink/sequences/sequencer.cpp
+++ b/engines/pink/sequences/sequencer.cpp
@@ -21,6 +21,7 @@
*/
+#include <common/debug.h>
#include "sequencer.h"
#include "engines/pink/archive.h"
@@ -31,6 +32,7 @@ Sequencer::Sequencer(GamePage *page)
{}
void Sequencer::deserialize(Archive &archive) {
+ debug("Sequencer:");
archive >> _sequences;
archive.readCount();// intro have 0 timers;
//serialize timers;
Commit: fed63e22ec0e21d9f2d05e9b38c7dcec637dccdf
https://github.com/scummvm/scummvm/commit/fed63e22ec0e21d9f2d05e9b38c7dcec637dccdf
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Added findSequence method to Sequencer
Changed paths:
engines/pink/sequences/sequencer.cpp
engines/pink/sequences/sequencer.h
diff --git a/engines/pink/sequences/sequencer.cpp b/engines/pink/sequences/sequencer.cpp
index f5c9b26..5de9c8c 100644
--- a/engines/pink/sequences/sequencer.cpp
+++ b/engines/pink/sequences/sequencer.cpp
@@ -23,6 +23,7 @@
#include <common/debug.h>
#include "sequencer.h"
+#include "sequence.h"
#include "engines/pink/archive.h"
namespace Pink {
@@ -39,4 +40,11 @@ void Sequencer::deserialize(Archive &archive) {
}
+Sequence *Sequencer::findSequence(const Common::String &name) {
+ return *Common::find_if(_sequences.begin(), _sequences.end(), [&name]
+ (Sequence* sequence) {
+ return name == sequence->getName();
+ });
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/sequences/sequencer.h b/engines/pink/sequences/sequencer.h
index 2ac8e03..d125405 100644
--- a/engines/pink/sequences/sequencer.h
+++ b/engines/pink/sequences/sequencer.h
@@ -37,6 +37,7 @@ public:
Sequencer(GamePage *page);
virtual void deserialize(Archive &archive);
+ Sequence* findSequence(const Common::String &name);
private:
//context
Commit: 62f84eae96625e778aae63e75b399a50b16363e8
https://github.com/scummvm/scummvm/commit/62f84eae96625e778aae63e75b399a50b16363e8
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Implemented SideEffectExit
Changed paths:
engines/pink/actors/actor.h
engines/pink/actors/lead_actor.cpp
engines/pink/actors/lead_actor.h
engines/pink/page.cpp
engines/pink/page.h
engines/pink/side_effects/side_effect.h
engines/pink/side_effects/side_effect_exit.cpp
engines/pink/side_effects/side_effect_exit.h
diff --git a/engines/pink/actors/actor.h b/engines/pink/actors/actor.h
index 8daccc8..f13cfe2 100644
--- a/engines/pink/actors/actor.h
+++ b/engines/pink/actors/actor.h
@@ -36,7 +36,7 @@ public:
Actor() {};
virtual void deserialize(Archive &archive);
-private:
+protected:
GamePage *_page;
//int possibly_isActionNotExist;
Action *_action;
diff --git a/engines/pink/actors/lead_actor.cpp b/engines/pink/actors/lead_actor.cpp
index 80a9281..23c94ed 100644
--- a/engines/pink/actors/lead_actor.cpp
+++ b/engines/pink/actors/lead_actor.cpp
@@ -25,6 +25,8 @@
#include "../cursor_mgr.h"
#include "engines/pink/sequences/sequencer.h"
#include "../archive.h"
+#include "../page.h"
+#include "../pink.h"
namespace Pink {
@@ -35,4 +37,9 @@ void LeadActor::deserialize(Archive &archive) {
_sequencer = static_cast<Sequencer*>(archive.readObject());
}
+void LeadActor::setNextExecutors(Common::String &nextModule, Common::String &nextPage) {
+ //TODO check for lead actor state
+ _page->getGame()->setNextExecutors(nextModule, nextPage);
+}
+
} // End of namespace Pink
diff --git a/engines/pink/actors/lead_actor.h b/engines/pink/actors/lead_actor.h
index a859de8..762896c 100644
--- a/engines/pink/actors/lead_actor.h
+++ b/engines/pink/actors/lead_actor.h
@@ -34,7 +34,7 @@ class Sequencer;
class LeadActor : public Actor {
public:
virtual void deserialize(Archive &archive);
-
+ void setNextExecutors(Common::String &nextModule, Common::String &nextPage);
private:
CursorMgr *_cursorMgr;
WalkMgr *_walkMgr;
diff --git a/engines/pink/page.cpp b/engines/pink/page.cpp
index a1d025f..cfc78c8 100644
--- a/engines/pink/page.cpp
+++ b/engines/pink/page.cpp
@@ -35,6 +35,7 @@ void Page::load(Archive &archive) {
archive >> _actors;
}
+
void GamePage::deserialize(Archive &archive) {
Page::deserialize(archive);
_module = static_cast<Module*>(archive.readObject());
@@ -82,4 +83,9 @@ void GamePage::loadFields() {
}
+PinkEngine *GamePage::getGame() {
+ return _module->getGame();
+}
+
+
} // End of namespace Pink
diff --git a/engines/pink/page.h b/engines/pink/page.h
index 10dcd4e..a408ba8 100644
--- a/engines/pink/page.h
+++ b/engines/pink/page.h
@@ -38,7 +38,6 @@ class Page : public NamedObject {
public:
void load(Archive &archive);
-
protected:
ResourceMgr _resMgr;
LeadActor *_leadActor;
@@ -64,6 +63,7 @@ public:
void init(bool isLoadingSave);
+ PinkEngine *getGame();
private:
int perhapsIsLoaded;
diff --git a/engines/pink/side_effects/side_effect.h b/engines/pink/side_effects/side_effect.h
index 628fe1e..f3d4eec 100644
--- a/engines/pink/side_effects/side_effect.h
+++ b/engines/pink/side_effects/side_effect.h
@@ -27,9 +27,12 @@
namespace Pink {
+class LeadActor;
+
class SideEffect : public Object {
public:
-
+ virtual ~SideEffect() {};
+ virtual void init(LeadActor &_actor) {};
};
diff --git a/engines/pink/side_effects/side_effect_exit.cpp b/engines/pink/side_effects/side_effect_exit.cpp
index 0a14e1c..31efc35 100644
--- a/engines/pink/side_effects/side_effect_exit.cpp
+++ b/engines/pink/side_effects/side_effect_exit.cpp
@@ -23,6 +23,7 @@
#include <common/debug.h>
#include "side_effect_exit.h"
#include "../archive.h"
+#include "../actors/lead_actor.h"
namespace Pink {
@@ -32,4 +33,8 @@ void SideEffectExit::deserialize(Archive &archive) {
_nextModule.c_str(), _nextPage.c_str());
}
+void SideEffectExit::init(LeadActor &_actor) {
+ _actor.setNextExecutors(_nextPage, _nextModule);
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/side_effects/side_effect_exit.h b/engines/pink/side_effects/side_effect_exit.h
index fdcd7cd..5d2076d 100644
--- a/engines/pink/side_effects/side_effect_exit.h
+++ b/engines/pink/side_effects/side_effect_exit.h
@@ -31,6 +31,8 @@ class SideEffectExit : public SideEffect {
public:
virtual void deserialize(Archive &archive);
+ virtual void init(LeadActor &_actor);
+
private:
Common::String _nextModule;
Common::String _nextPage;
Commit: 3e2106a1c087b2c27f961ce918ad6459670b99fa
https://github.com/scummvm/scummvm/commit/3e2106a1c087b2c27f961ce918ad6459670b99fa
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Added more Handler methods
Changed paths:
engines/pink/actors/actor.cpp
engines/pink/actors/actor.h
engines/pink/handlers/handler.cpp
engines/pink/handlers/handler.h
engines/pink/handlers/handler_sequences.cpp
engines/pink/handlers/handler_sequences.h
engines/pink/page.cpp
engines/pink/page.h
engines/pink/sequences/sequencer.h
engines/pink/side_effects/side_effect.h
engines/pink/side_effects/side_effect_exit.cpp
engines/pink/side_effects/side_effect_exit.h
engines/pink/side_effects/side_effect_module_variable.h
diff --git a/engines/pink/actors/actor.cpp b/engines/pink/actors/actor.cpp
index c7a5a9a..340b1c9 100644
--- a/engines/pink/actors/actor.cpp
+++ b/engines/pink/actors/actor.cpp
@@ -35,4 +35,8 @@ void Actor::deserialize(Archive &archive) {
archive >> _actions;
}
+Sequencer *Actor::getSequencer() {
+ return _page->getSequencer();
+}
+
} // End of namespace Pink
diff --git a/engines/pink/actors/actor.h b/engines/pink/actors/actor.h
index f13cfe2..eb19c41 100644
--- a/engines/pink/actors/actor.h
+++ b/engines/pink/actors/actor.h
@@ -30,11 +30,13 @@ namespace Pink {
class GamePage;
class Action;
+class Sequencer;
class Actor : public NamedObject {
public:
Actor() {};
virtual void deserialize(Archive &archive);
+ Sequencer *getSequencer();
protected:
GamePage *_page;
diff --git a/engines/pink/handlers/handler.cpp b/engines/pink/handlers/handler.cpp
index 300071b..d42d015 100644
--- a/engines/pink/handlers/handler.cpp
+++ b/engines/pink/handlers/handler.cpp
@@ -22,6 +22,7 @@
#include "handler.h"
#include "../archive.h"
+#include "../side_effects/side_effect.h"
namespace Pink {
@@ -30,4 +31,14 @@ void Handler::deserialize(Archive &archive) {
archive >> _sideEffects;
}
+bool Handler::initConditions(LeadActor *actor) {
+ return true;
+}
+
+void Handler::initSideEffects(LeadActor *actor) {
+ for (int i = 0; i < _sideEffects.size(); ++i) {
+ _sideEffects[i]->init(actor);
+ }
+}
+
} // End of namespace Pink
diff --git a/engines/pink/handlers/handler.h b/engines/pink/handlers/handler.h
index 6bcac49..beca2ff 100644
--- a/engines/pink/handlers/handler.h
+++ b/engines/pink/handlers/handler.h
@@ -29,10 +29,13 @@
namespace Pink {
class SideEffect;
+class LeadActor;
class Handler : public Object {
public:
virtual void deserialize(Archive &archive);
+ bool initConditions(LeadActor *actor);
+ void initSideEffects(LeadActor *actor);
protected:
//_conditions
diff --git a/engines/pink/handlers/handler_sequences.cpp b/engines/pink/handlers/handler_sequences.cpp
index 9386338..52c9254 100644
--- a/engines/pink/handlers/handler_sequences.cpp
+++ b/engines/pink/handlers/handler_sequences.cpp
@@ -21,7 +21,9 @@
*/
#include "handler_sequences.h"
+#include <engines/pink/sequences/sequencer.h>
#include "../archive.h"
+#include "../actors/lead_actor.h"
namespace Pink {
@@ -30,4 +32,11 @@ void HandlerSequences::deserialize(Archive &archive) {
archive >> _sequences;
}
+void HandlerSequences::initSequence(LeadActor *actor) {
+ initSideEffects(actor);
+ Sequencer *sequencer = actor->getSequencer();
+ Sequence *sequence = sequencer->findSequence(_sequences[0]); //actually we must pick random sequence
+ //sequencer->authorSequence(sequence, 0);
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/handlers/handler_sequences.h b/engines/pink/handlers/handler_sequences.h
index 7641b17..b55d81c 100644
--- a/engines/pink/handlers/handler_sequences.h
+++ b/engines/pink/handlers/handler_sequences.h
@@ -30,6 +30,7 @@ namespace Pink {
class HandlerSequences : public Handler {
public:
virtual void deserialize(Archive &archive);
+ void initSequence(LeadActor *actor);
protected:
StringArray _sequences;
diff --git a/engines/pink/page.cpp b/engines/pink/page.cpp
index cfc78c8..77e3bb3 100644
--- a/engines/pink/page.cpp
+++ b/engines/pink/page.cpp
@@ -21,6 +21,8 @@
*/
#include <engines/pink/walk/walk_mgr.h>
+#include <engines/pink/handlers/handler.h>
+#include <engines/pink/handlers/handler_sequences.h>
#include "page.h"
#include "cursor_mgr.h"
#include "actors/lead_actor.h"
@@ -60,18 +62,26 @@ void GamePage::load(Archive &archive) {
void GamePage::init(bool isLoadingSave) {
if (!isLoadingSave){
//assert(perhapsIsLoaded == 0);
- loadFields();
+ loadManagers();
}
//init actor which inits actions
if (!isLoadingSave) {
+ for (int i = 0; i < _handlers.size(); ++i) {
+ if (_handlers[i]->initConditions(_leadActor)){
+ HandlerSequences *handlerSequences = dynamic_cast<HandlerSequences*>(_handlers[i]);
+ assert(handlerSequences);
+ handlerSequences->initSequence(_leadActor);
+ break;
+ }
+ }
}
}
-void GamePage::loadFields() {
+void GamePage::loadManagers() {
perhapsIsLoaded = true;
_cursorMgr = new CursorMgr(this);
_walkMgr = new WalkMgr;
@@ -87,5 +97,8 @@ PinkEngine *GamePage::getGame() {
return _module->getGame();
}
+Sequencer *GamePage::getSequencer() {
+ return _sequencer;
+}
} // End of namespace Pink
diff --git a/engines/pink/page.h b/engines/pink/page.h
index a408ba8..008b0a0 100644
--- a/engines/pink/page.h
+++ b/engines/pink/page.h
@@ -59,11 +59,12 @@ class GamePage : public Page {
public:
virtual void deserialize(Archive &archive);
virtual void load(Archive &archive);
- void loadFields();;
+ void loadManagers();
void init(bool isLoadingSave);
PinkEngine *getGame();
+ Sequencer *getSequencer();
private:
int perhapsIsLoaded;
diff --git a/engines/pink/sequences/sequencer.h b/engines/pink/sequences/sequencer.h
index d125405..93a156f 100644
--- a/engines/pink/sequences/sequencer.h
+++ b/engines/pink/sequences/sequencer.h
@@ -38,6 +38,7 @@ public:
virtual void deserialize(Archive &archive);
Sequence* findSequence(const Common::String &name);
+ void authorSequence(Sequence *sequence, bool isFromSave);
private:
//context
diff --git a/engines/pink/side_effects/side_effect.h b/engines/pink/side_effects/side_effect.h
index f3d4eec..e26a285 100644
--- a/engines/pink/side_effects/side_effect.h
+++ b/engines/pink/side_effects/side_effect.h
@@ -32,7 +32,7 @@ class LeadActor;
class SideEffect : public Object {
public:
virtual ~SideEffect() {};
- virtual void init(LeadActor &_actor) {};
+ virtual void init(LeadActor *_actor) {};
};
diff --git a/engines/pink/side_effects/side_effect_exit.cpp b/engines/pink/side_effects/side_effect_exit.cpp
index 31efc35..0871c2f 100644
--- a/engines/pink/side_effects/side_effect_exit.cpp
+++ b/engines/pink/side_effects/side_effect_exit.cpp
@@ -33,8 +33,8 @@ void SideEffectExit::deserialize(Archive &archive) {
_nextModule.c_str(), _nextPage.c_str());
}
-void SideEffectExit::init(LeadActor &_actor) {
- _actor.setNextExecutors(_nextPage, _nextModule);
+void SideEffectExit::init(LeadActor *_actor) {
+ _actor->setNextExecutors(_nextPage, _nextModule);
}
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/side_effects/side_effect_exit.h b/engines/pink/side_effects/side_effect_exit.h
index 5d2076d..a324b82 100644
--- a/engines/pink/side_effects/side_effect_exit.h
+++ b/engines/pink/side_effects/side_effect_exit.h
@@ -31,7 +31,7 @@ class SideEffectExit : public SideEffect {
public:
virtual void deserialize(Archive &archive);
- virtual void init(LeadActor &_actor);
+ virtual void init(LeadActor *_actor);
private:
Common::String _nextModule;
diff --git a/engines/pink/side_effects/side_effect_module_variable.h b/engines/pink/side_effects/side_effect_module_variable.h
index 68156f1..4eddeba 100644
--- a/engines/pink/side_effects/side_effect_module_variable.h
+++ b/engines/pink/side_effects/side_effect_module_variable.h
@@ -29,6 +29,7 @@ namespace Pink {
class SideEffectModuleVariable : public SideEffectVariable {
public:
virtual void deserialize(Archive &archive);
+
};
} // End of namespace Pink
Commit: b4d44d8ffc5c5d7e97d717c1d3f00d246ce3b9a8
https://github.com/scummvm/scummvm/commit/b4d44d8ffc5c5d7e97d717c1d3f00d246ce3b9a8
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Added SequenceActorState and SequenceContext
Changed paths:
engines/pink/handlers/handler_sequences.cpp
engines/pink/items/sequence_item.cpp
engines/pink/items/sequence_item.h
engines/pink/page.cpp
engines/pink/sequences/sequence.cpp
engines/pink/sequences/sequence.h
engines/pink/sequences/sequencer.cpp
engines/pink/sequences/sequencer.h
diff --git a/engines/pink/handlers/handler_sequences.cpp b/engines/pink/handlers/handler_sequences.cpp
index 52c9254..c785883 100644
--- a/engines/pink/handlers/handler_sequences.cpp
+++ b/engines/pink/handlers/handler_sequences.cpp
@@ -34,9 +34,10 @@ void HandlerSequences::deserialize(Archive &archive) {
void HandlerSequences::initSequence(LeadActor *actor) {
initSideEffects(actor);
+
Sequencer *sequencer = actor->getSequencer();
Sequence *sequence = sequencer->findSequence(_sequences[0]); //actually we must pick random sequence
- //sequencer->authorSequence(sequence, 0);
+ sequencer->authorSequence(sequence, 0);
}
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/items/sequence_item.cpp b/engines/pink/items/sequence_item.cpp
index c021361..050e1d0 100644
--- a/engines/pink/items/sequence_item.cpp
+++ b/engines/pink/items/sequence_item.cpp
@@ -30,4 +30,12 @@ void SequenceItem::deserialize(Archive &archive) {
archive >> _actor >> _action;
}
+const Common::String &SequenceItem::getActor() const {
+ return _actor;
+}
+
+const Common::String &SequenceItem::getAction() const {
+ return _action;
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/items/sequence_item.h b/engines/pink/items/sequence_item.h
index 76c81b5..5cf622e 100644
--- a/engines/pink/items/sequence_item.h
+++ b/engines/pink/items/sequence_item.h
@@ -31,6 +31,9 @@ class SequenceItem : public Object {
public:
virtual void deserialize(Archive &archive);
+ const Common::String &getActor() const;
+ const Common::String &getAction() const;
+
protected:
Common::String _actor;
Common::String _action;
diff --git a/engines/pink/page.cpp b/engines/pink/page.cpp
index 77e3bb3..f0bdf32 100644
--- a/engines/pink/page.cpp
+++ b/engines/pink/page.cpp
@@ -68,7 +68,7 @@ void GamePage::init(bool isLoadingSave) {
//init actor which inits actions
if (!isLoadingSave) {
- for (int i = 0; i < _handlers.size(); ++i) {
+ for (uint i = 0; i < _handlers.size(); ++i) {
if (_handlers[i]->initConditions(_leadActor)){
HandlerSequences *handlerSequences = dynamic_cast<HandlerSequences*>(_handlers[i]);
assert(handlerSequences);
diff --git a/engines/pink/sequences/sequence.cpp b/engines/pink/sequences/sequence.cpp
index 54a293d..73f1194 100644
--- a/engines/pink/sequences/sequence.cpp
+++ b/engines/pink/sequences/sequence.cpp
@@ -24,6 +24,7 @@
#include "sequence.h"
#include "sequencer.h"
#include "../archive.h"
+#include "../items/sequence_item.h"
namespace Pink {
@@ -34,4 +35,35 @@ void Sequence::deserialize(Archive &archive) {
archive >> _items;
}
+Common::Array<SequenceItem*> &Sequence::getItems() {
+ return _items;
+}
+
+SequenceContext::SequenceContext(Sequence *sequence, Sequencer *sequencer)
+ : _sequence(sequence), _sequencer(sequencer)
+{
+ Common::Array<SequenceItem*> &items = sequence->getItems();
+ for (uint i = 0; i < items.size(); ++i) {
+ for (uint j = 0; j < _states.size(); ++j) {
+ if (items[i]->getActor() != _states[j].getActor()){
+ break;
+ }
+ else assert(0); // can it be ?
+ }
+ _states.push_back({items[i]->getActor()});
+ }
+}
+
+SequenceContext::~SequenceContext() {
+
+}
+
+SequenceActorState::SequenceActorState(const Common::String &name)
+ :_actor(name)
+{}
+
+const Common::String &SequenceActorState::getActor() const {
+ return _actor;
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/sequences/sequence.h b/engines/pink/sequences/sequence.h
index 6171459..0360f28 100644
--- a/engines/pink/sequences/sequence.h
+++ b/engines/pink/sequences/sequence.h
@@ -30,10 +30,12 @@ namespace Pink {
class Sequencer;
class SequenceItem;
+class SequenceContext;
class Sequence : public NamedObject {
public:
virtual void deserialize(Archive &archive);
+ Common::Array<SequenceItem*> &getItems();
private:
Sequencer *_sequencer;
@@ -41,6 +43,28 @@ private:
//context
};
+class SequenceActorState {
+public:
+ SequenceActorState(const Common::String &name);
+
+ const Common::String &getActor() const;
+
+private:
+ Common::String _actor;
+ Common::String _unk; // ?state
+};
+
+
+class SequenceContext {
+public:
+ SequenceContext(Sequence *sequence, Sequencer* sequencer);
+ ~SequenceContext();
+private:
+ Sequence *_sequence;
+ Sequencer *_sequencer;
+ Common::Array<SequenceActorState> _states;
+};
+
} // End of namespace Pink
#endif
diff --git a/engines/pink/sequences/sequencer.cpp b/engines/pink/sequences/sequencer.cpp
index 5de9c8c..4f7099f 100644
--- a/engines/pink/sequences/sequencer.cpp
+++ b/engines/pink/sequences/sequencer.cpp
@@ -29,7 +29,7 @@
namespace Pink {
Sequencer::Sequencer(GamePage *page)
- : _page(page)
+ : _context(nullptr), _page(page)
{}
void Sequencer::deserialize(Archive &archive) {
@@ -47,4 +47,14 @@ Sequence *Sequencer::findSequence(const Common::String &name) {
});
}
+void Sequencer::authorSequence(Sequence *sequence, bool unk) {
+ if (_context){
+
+ }
+
+ if (sequence){
+ _context = new SequenceContext(sequence, this);
+ }
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/sequences/sequencer.h b/engines/pink/sequences/sequencer.h
index 93a156f..255f2c6 100644
--- a/engines/pink/sequences/sequencer.h
+++ b/engines/pink/sequences/sequencer.h
@@ -30,6 +30,7 @@
namespace Pink {
class Sequence;
+class SequenceContext;
class GamePage;
class Sequencer : public Object {
@@ -38,10 +39,10 @@ public:
virtual void deserialize(Archive &archive);
Sequence* findSequence(const Common::String &name);
- void authorSequence(Sequence *sequence, bool isFromSave);
+ void authorSequence(Sequence *sequence, bool unk);
private:
- //context
+ SequenceContext *_context;
// unknown objects array
Common::Array<Sequence*> _sequences;
//timers
Commit: d95e32782abe260aa74162b8c868a583e857be15
https://github.com/scummvm/scummvm/commit/d95e32782abe260aa74162b8c868a583e857be15
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Continue to develop Sequencer::authorSequence method
Changed paths:
engines/pink/items/sequence_item.cpp
engines/pink/sequences/sequence.cpp
engines/pink/sequences/sequencer.cpp
engines/pink/sequences/sequencer.h
diff --git a/engines/pink/items/sequence_item.cpp b/engines/pink/items/sequence_item.cpp
index 050e1d0..2a8a93f 100644
--- a/engines/pink/items/sequence_item.cpp
+++ b/engines/pink/items/sequence_item.cpp
@@ -23,11 +23,15 @@
#include <common/debug.h>
#include "sequence_item.h"
#include "../archive.h"
+#include "sequence_item_leader.h"
+#include "sequence_item_default_action.h"
namespace Pink {
void SequenceItem::deserialize(Archive &archive) {
archive >> _actor >> _action;
+ if (!dynamic_cast<SequenceItemLeader*>(this) && !dynamic_cast<SequenceItemDefaultAction*>(this))
+ debug("\t\tSequenceItem: _actor = %s, _action = %s", _actor.c_str(), _action.c_str());
}
const Common::String &SequenceItem::getActor() const {
diff --git a/engines/pink/sequences/sequence.cpp b/engines/pink/sequences/sequence.cpp
index 73f1194..0d8adc1 100644
--- a/engines/pink/sequences/sequence.cpp
+++ b/engines/pink/sequences/sequence.cpp
@@ -44,13 +44,17 @@ SequenceContext::SequenceContext(Sequence *sequence, Sequencer *sequencer)
{
Common::Array<SequenceItem*> &items = sequence->getItems();
for (uint i = 0; i < items.size(); ++i) {
+ bool found = 0;
for (uint j = 0; j < _states.size(); ++j) {
- if (items[i]->getActor() != _states[j].getActor()){
+ if (items[i]->getActor() == _states[j].getActor()){
+ found = 1;
break;
}
- else assert(0); // can it be ?
}
- _states.push_back({items[i]->getActor()});
+ if (!found) {
+ debug(items[i]->getActor().c_str());
+ _states.push_back({items[i]->getActor()});
+ }
}
}
diff --git a/engines/pink/sequences/sequencer.cpp b/engines/pink/sequences/sequencer.cpp
index 4f7099f..68b72c1 100644
--- a/engines/pink/sequences/sequencer.cpp
+++ b/engines/pink/sequences/sequencer.cpp
@@ -54,7 +54,11 @@ void Sequencer::authorSequence(Sequence *sequence, bool unk) {
if (sequence){
_context = new SequenceContext(sequence, this);
+ //unload array of unknown objects
+ _currentSequenceName = sequence->getName();
+
}
+ else _currentSequenceName.clear();
}
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/sequences/sequencer.h b/engines/pink/sequences/sequencer.h
index 255f2c6..e2d16cd 100644
--- a/engines/pink/sequences/sequencer.h
+++ b/engines/pink/sequences/sequencer.h
@@ -45,6 +45,7 @@ private:
SequenceContext *_context;
// unknown objects array
Common::Array<Sequence*> _sequences;
+ Common::String _currentSequenceName;
//timers
GamePage *_page;
};
Commit: acbe2e8832dc06fe80dbe9ac6a57a5ec9615a58c
https://github.com/scummvm/scummvm/commit/acbe2e8832dc06fe80dbe9ac6a57a5ec9615a58c
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Added findActor method
Changed paths:
engines/pink/page.cpp
engines/pink/page.h
diff --git a/engines/pink/page.cpp b/engines/pink/page.cpp
index f0bdf32..c59e299 100644
--- a/engines/pink/page.cpp
+++ b/engines/pink/page.cpp
@@ -37,6 +37,13 @@ void Page::load(Archive &archive) {
archive >> _actors;
}
+Actor *Page::findActor(Common::String &name) {
+ return *Common::find_if(_actors.begin(), _actors.end(), [&name]
+ (Actor *actor) {
+ return name == actor->getName();
+ });;
+}
+
void GamePage::deserialize(Archive &archive) {
Page::deserialize(archive);
diff --git a/engines/pink/page.h b/engines/pink/page.h
index 008b0a0..3b06e5e 100644
--- a/engines/pink/page.h
+++ b/engines/pink/page.h
@@ -38,6 +38,8 @@ class Page : public NamedObject {
public:
void load(Archive &archive);
+ Actor *findActor(Common::String &name);
+
protected:
ResourceMgr _resMgr;
LeadActor *_leadActor;
Commit: d3031443647ae4830ec971866fb068be0990066f
https://github.com/scummvm/scummvm/commit/d3031443647ae4830ec971866fb068be0990066f
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Added findAction method
Changed paths:
engines/pink/actors/actor.cpp
engines/pink/actors/actor.h
diff --git a/engines/pink/actors/actor.cpp b/engines/pink/actors/actor.cpp
index 340b1c9..595d8e1 100644
--- a/engines/pink/actors/actor.cpp
+++ b/engines/pink/actors/actor.cpp
@@ -23,6 +23,7 @@
#include "actor.h"
#include "../page.h"
#include "lead_actor.h"
+#include "../actions/action.h"
namespace Pink {
@@ -39,4 +40,11 @@ Sequencer *Actor::getSequencer() {
return _page->getSequencer();
}
+Action *Actor::findAction(Common::String &name) {
+ return *Common::find_if(_actions.begin(), _actions.end(), [&name]
+ (Action* action) {
+ return name == action->getName();
+ });;
+}
+
} // End of namespace Pink
diff --git a/engines/pink/actors/actor.h b/engines/pink/actors/actor.h
index eb19c41..033fafa 100644
--- a/engines/pink/actors/actor.h
+++ b/engines/pink/actors/actor.h
@@ -36,6 +36,9 @@ class Actor : public NamedObject {
public:
Actor() {};
virtual void deserialize(Archive &archive);
+
+ Action *findAction(Common::String &name);
+
Sequencer *getSequencer();
protected:
Commit: 7c4bcc033d318b3396df9f1545afcc4da3bd4bc1
https://github.com/scummvm/scummvm/commit/7c4bcc033d318b3396df9f1545afcc4da3bd4bc1
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: implemented SideEffectModuleVariable fully
Changed paths:
engines/pink/actors/actor.cpp
engines/pink/actors/actor.h
engines/pink/actors/lead_actor.h
engines/pink/module.cpp
engines/pink/module.h
engines/pink/page.cpp
engines/pink/page.h
engines/pink/side_effects/side_effect.h
engines/pink/side_effects/side_effect_module_variable.cpp
engines/pink/side_effects/side_effect_module_variable.h
diff --git a/engines/pink/actors/actor.cpp b/engines/pink/actors/actor.cpp
index 595d8e1..c4c9b78 100644
--- a/engines/pink/actors/actor.cpp
+++ b/engines/pink/actors/actor.cpp
@@ -47,4 +47,8 @@ Action *Actor::findAction(Common::String &name) {
});;
}
+GamePage *Actor::getPage() const {
+ return _page;
+}
+
} // End of namespace Pink
diff --git a/engines/pink/actors/actor.h b/engines/pink/actors/actor.h
index 033fafa..1db59cf 100644
--- a/engines/pink/actors/actor.h
+++ b/engines/pink/actors/actor.h
@@ -40,6 +40,7 @@ public:
Action *findAction(Common::String &name);
Sequencer *getSequencer();
+ GamePage *getPage() const;
protected:
GamePage *_page;
diff --git a/engines/pink/actors/lead_actor.h b/engines/pink/actors/lead_actor.h
index 762896c..6152fae 100644
--- a/engines/pink/actors/lead_actor.h
+++ b/engines/pink/actors/lead_actor.h
@@ -34,7 +34,8 @@ class Sequencer;
class LeadActor : public Actor {
public:
virtual void deserialize(Archive &archive);
- void setNextExecutors(Common::String &nextModule, Common::String &nextPage);
+ void setNextExecutors (Common::String &nextModule, Common::String &nextPage);
+
private:
CursorMgr *_cursorMgr;
WalkMgr *_walkMgr;
diff --git a/engines/pink/module.cpp b/engines/pink/module.cpp
index 4b5d136..28ca354 100644
--- a/engines/pink/module.cpp
+++ b/engines/pink/module.cpp
@@ -95,6 +95,10 @@ PinkEngine *Module::getGame() const {
return _game;
}
+Common::StringMap &Module::getMap() {
+ return _map;
+}
+
} // End of namespace Pink
diff --git a/engines/pink/module.h b/engines/pink/module.h
index 1ec10bf..abaf679 100644
--- a/engines/pink/module.h
+++ b/engines/pink/module.h
@@ -52,12 +52,13 @@ public:
void OnMouseMove();
void OnKeyboardButtonClick();
-private:
- PinkEngine *_game;
-public:
+ Common::StringMap &getMap();
+
PinkEngine *getGame() const;
+
private:
+ PinkEngine *_game;
GamePage *_page;
PagesArray _pages;
InventoryMgr _invMgr;
diff --git a/engines/pink/page.cpp b/engines/pink/page.cpp
index c59e299..123e27b 100644
--- a/engines/pink/page.cpp
+++ b/engines/pink/page.cpp
@@ -108,4 +108,8 @@ Sequencer *GamePage::getSequencer() {
return _sequencer;
}
+Module *GamePage::getModule() const {
+ return _module;
+}
+
} // End of namespace Pink
diff --git a/engines/pink/page.h b/engines/pink/page.h
index 3b06e5e..878613a 100644
--- a/engines/pink/page.h
+++ b/engines/pink/page.h
@@ -67,10 +67,13 @@ public:
PinkEngine *getGame();
Sequencer *getSequencer();
+ Module *getModule() const;
private:
int perhapsIsLoaded;
Module *_module;
+
+private:
CursorMgr *_cursorMgr;
WalkMgr *_walkMgr;
Sequencer *_sequencer;
diff --git a/engines/pink/side_effects/side_effect.h b/engines/pink/side_effects/side_effect.h
index e26a285..45099f3 100644
--- a/engines/pink/side_effects/side_effect.h
+++ b/engines/pink/side_effects/side_effect.h
@@ -32,7 +32,7 @@ class LeadActor;
class SideEffect : public Object {
public:
virtual ~SideEffect() {};
- virtual void init(LeadActor *_actor) {};
+ virtual void init(LeadActor *actor) {};
};
diff --git a/engines/pink/side_effects/side_effect_module_variable.cpp b/engines/pink/side_effects/side_effect_module_variable.cpp
index 5f3c857..4e1e173 100644
--- a/engines/pink/side_effects/side_effect_module_variable.cpp
+++ b/engines/pink/side_effects/side_effect_module_variable.cpp
@@ -25,6 +25,8 @@
*/
#include "side_effect_module_variable.h"
+#include "../actors/lead_actor.h"
+#include "../page.h"
namespace Pink {
@@ -34,4 +36,9 @@ void SideEffectModuleVariable::deserialize(Archive &archive) {
_name.c_str(), _value.c_str());
}
+void SideEffectModuleVariable::init(LeadActor *actor) {
+ Common::StringMap &moduleMap = actor->getPage()->getModule()->getMap();
+ moduleMap[_name] = _value;
+}
+
}
\ No newline at end of file
diff --git a/engines/pink/side_effects/side_effect_module_variable.h b/engines/pink/side_effects/side_effect_module_variable.h
index 4eddeba..df45bf8 100644
--- a/engines/pink/side_effects/side_effect_module_variable.h
+++ b/engines/pink/side_effects/side_effect_module_variable.h
@@ -30,6 +30,7 @@ class SideEffectModuleVariable : public SideEffectVariable {
public:
virtual void deserialize(Archive &archive);
+ virtual void init(LeadActor *actor);
};
} // End of namespace Pink
Commit: 4d8bd5958f186a2b7ff3881b5cfbb4c77e0cf103
https://github.com/scummvm/scummvm/commit/4d8bd5958f186a2b7ff3881b5cfbb4c77e0cf103
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added setIdleAction to actor
Changed paths:
engines/pink/actors/actor.cpp
engines/pink/actors/actor.h
diff --git a/engines/pink/actors/actor.cpp b/engines/pink/actors/actor.cpp
index c4c9b78..d9363b6 100644
--- a/engines/pink/actors/actor.cpp
+++ b/engines/pink/actors/actor.cpp
@@ -51,4 +51,23 @@ GamePage *Actor::getPage() const {
return _page;
}
+void Actor::setIdleAction(bool unk) {
+ assert(_action == nullptr);
+
+ uint i;
+ for (i = 0; i < _actions.size(); ++i) {
+ if (_action[i].getName() == "Idle") {
+ _action = _actions[i];
+ break;
+ }
+ }
+ if (!_action) {
+ _isActionEnd = 1;
+ }
+ else {
+ _isActionEnd = 0;
+ //call action virt method
+ }
+}
+
} // End of namespace Pink
diff --git a/engines/pink/actors/actor.h b/engines/pink/actors/actor.h
index 1db59cf..fd9c25b 100644
--- a/engines/pink/actors/actor.h
+++ b/engines/pink/actors/actor.h
@@ -34,7 +34,10 @@ class Sequencer;
class Actor : public NamedObject {
public:
- Actor() {};
+ Actor()
+ : _page(nullptr), _action(nullptr),
+ _isActionEnd(1)
+ {};
virtual void deserialize(Archive &archive);
Action *findAction(Common::String &name);
@@ -42,11 +45,13 @@ public:
Sequencer *getSequencer();
GamePage *getPage() const;
+ void setIdleAction(bool unk);
+
protected:
GamePage *_page;
- //int possibly_isActionNotExist;
Action *_action;
Common::Array<Action*> _actions;
+ bool _isActionEnd;
};
} // End of namespace Pink
Commit: f7c6830da9d135e0428e60d7db9405a761ff8749
https://github.com/scummvm/scummvm/commit/f7c6830da9d135e0428e60d7db9405a761ff8749
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added states to LeadActor
Changed paths:
engines/pink/actors/lead_actor.h
diff --git a/engines/pink/actors/lead_actor.h b/engines/pink/actors/lead_actor.h
index 6152fae..46fda52 100644
--- a/engines/pink/actors/lead_actor.h
+++ b/engines/pink/actors/lead_actor.h
@@ -33,6 +33,17 @@ class Sequencer;
class LeadActor : public Actor {
public:
+ enum State {
+ Ready = 0,
+ Moving,
+ inDialog1, //???
+ Inventory,
+ PDA,
+ inDialog2,//???
+ PlayingVideo, // ???
+ unk_Loading // ????
+ };
+
virtual void deserialize(Archive &archive);
void setNextExecutors (Common::String &nextModule, Common::String &nextPage);
Commit: a49b399fbdbea1864dad20a793931bbb45f04e1c
https://github.com/scummvm/scummvm/commit/a49b399fbdbea1864dad20a793931bbb45f04e1c
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: implemented ActionHide completely
Changed paths:
engines/pink/actions/action.h
engines/pink/actions/action_hide.cpp
engines/pink/actions/action_hide.h
engines/pink/actors/actor.cpp
engines/pink/actors/actor.h
diff --git a/engines/pink/actions/action.h b/engines/pink/actions/action.h
index 5608b99..1037181 100644
--- a/engines/pink/actions/action.h
+++ b/engines/pink/actions/action.h
@@ -32,6 +32,8 @@ class Actor;
class Action : public NamedObject {
public:
virtual void deserialize(Archive &archive);
+ virtual void play(bool unk_startNow) {}; //?? not sure about parameter
+ virtual void end() {};
protected:
Actor *_actor;
diff --git a/engines/pink/actions/action_hide.cpp b/engines/pink/actions/action_hide.cpp
index 9c99bc7..a63cc49 100644
--- a/engines/pink/actions/action_hide.cpp
+++ b/engines/pink/actions/action_hide.cpp
@@ -21,6 +21,7 @@
*/
#include "action_hide.h"
+#include "../actors/actor.h"
#include <engines/pink/archive.h>
#include <common/debug.h>
@@ -32,4 +33,13 @@ void Pink::ActionHide::deserialize(Archive &archive) {
debug("\tActionHide: _name = %s", _name.c_str());
}
+void ActionHide::play(bool unk_startNow) {
+ debug("ActionHide %s is now in playing state", _name.c_str());
+ _actor->endAction();
+}
+
+void ActionHide::end() {
+ debug("ActionHide %s is ended", _name.c_str());
+}
+
} //End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/actions/action_hide.h b/engines/pink/actions/action_hide.h
index 4662d5f..e9b3294 100644
--- a/engines/pink/actions/action_hide.h
+++ b/engines/pink/actions/action_hide.h
@@ -31,7 +31,8 @@ class ActionHide : public Action {
public:
virtual void deserialize(Archive &archive);
-public:
+ virtual void play(bool unk_startNow);
+ virtual void end();
};
} //End of namespace Pink
diff --git a/engines/pink/actors/actor.cpp b/engines/pink/actors/actor.cpp
index d9363b6..f92c1cb 100644
--- a/engines/pink/actors/actor.cpp
+++ b/engines/pink/actors/actor.cpp
@@ -70,4 +70,8 @@ void Actor::setIdleAction(bool unk) {
}
}
+void Actor::endAction() {
+ _isActionEnd = 1;
+}
+
} // End of namespace Pink
diff --git a/engines/pink/actors/actor.h b/engines/pink/actors/actor.h
index fd9c25b..4e494bd 100644
--- a/engines/pink/actors/actor.h
+++ b/engines/pink/actors/actor.h
@@ -46,6 +46,8 @@ public:
GamePage *getPage() const;
void setIdleAction(bool unk);
+ void endAction();
+
protected:
GamePage *_page;
Commit: 2e3e07b8582a6d4bc54e263b334d3d26e8caa994
https://github.com/scummvm/scummvm/commit/2e3e07b8582a6d4bc54e263b334d3d26e8caa994
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added some methods to Actor
Changed paths:
engines/pink/actors/actor.cpp
engines/pink/actors/actor.h
diff --git a/engines/pink/actors/actor.cpp b/engines/pink/actors/actor.cpp
index f92c1cb..fefe1f9 100644
--- a/engines/pink/actors/actor.cpp
+++ b/engines/pink/actors/actor.cpp
@@ -40,7 +40,7 @@ Sequencer *Actor::getSequencer() {
return _page->getSequencer();
}
-Action *Actor::findAction(Common::String &name) {
+Action *Actor::findAction(const Common::String &name) {
return *Common::find_if(_actions.begin(), _actions.end(), [&name]
(Action* action) {
return name == action->getName();
@@ -51,27 +51,39 @@ GamePage *Actor::getPage() const {
return _page;
}
-void Actor::setIdleAction(bool unk) {
- assert(_action == nullptr);
-
- uint i;
- for (i = 0; i < _actions.size(); ++i) {
- if (_action[i].getName() == "Idle") {
- _action = _actions[i];
- break;
- }
+void Actor::init(bool unk) {
+ if (!_action) {
+ _action = findAction({"Idle"});
}
+
if (!_action) {
_isActionEnd = 1;
}
else {
_isActionEnd = 0;
- //call action virt method
+ _action->play(unk);
}
}
+void Actor::hide() {
+ setAction({"Hide"});
+}
+
void Actor::endAction() {
_isActionEnd = 1;
}
+void Actor::setAction(const Common::String &name) {
+ Action *newAction = findAction(name);
+ if (_action) {
+ _isActionEnd = 1;
+ _action->end();
+ }
+ if (newAction) {
+ _isActionEnd = 0;
+ _action = newAction;
+ _action->play(0);
+ }
+}
+
} // End of namespace Pink
diff --git a/engines/pink/actors/actor.h b/engines/pink/actors/actor.h
index 4e494bd..54661bd 100644
--- a/engines/pink/actors/actor.h
+++ b/engines/pink/actors/actor.h
@@ -40,14 +40,15 @@ public:
{};
virtual void deserialize(Archive &archive);
- Action *findAction(Common::String &name);
-
Sequencer *getSequencer();
GamePage *getPage() const;
- void setIdleAction(bool unk);
+ void init(bool unk);
+ void hide();
void endAction();
+ Action *findAction(const Common::String &name);
+ void setAction(const Common::String &name);
protected:
GamePage *_page;
Commit: ac0ed1dbdd420e2a2c7b5118d29bdb47715b5a14
https://github.com/scummvm/scummvm/commit/ac0ed1dbdd420e2a2c7b5118d29bdb47715b5a14
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: implemented init of LeadActor and checking for state in LeadActor method
Changed paths:
engines/pink/actors/actor.h
engines/pink/actors/lead_actor.cpp
engines/pink/actors/lead_actor.h
diff --git a/engines/pink/actors/actor.h b/engines/pink/actors/actor.h
index 54661bd..83f0d8e 100644
--- a/engines/pink/actors/actor.h
+++ b/engines/pink/actors/actor.h
@@ -43,7 +43,7 @@ public:
Sequencer *getSequencer();
GamePage *getPage() const;
- void init(bool unk);
+ virtual void init(bool unk);
void hide();
void endAction();
diff --git a/engines/pink/actors/lead_actor.cpp b/engines/pink/actors/lead_actor.cpp
index 23c94ed..12187d6 100644
--- a/engines/pink/actors/lead_actor.cpp
+++ b/engines/pink/actors/lead_actor.cpp
@@ -38,8 +38,18 @@ void LeadActor::deserialize(Archive &archive) {
}
void LeadActor::setNextExecutors(Common::String &nextModule, Common::String &nextPage) {
- //TODO check for lead actor state
- _page->getGame()->setNextExecutors(nextModule, nextPage);
+ if (_state == Ready || _state == Moving || _state == inDialog1 || _state == Inventory || _state == PDA) {
+ _state = PlayingVideo;
+ _page->getGame()->setNextExecutors(nextModule, nextPage);
+ }
+}
+
+void LeadActor::init(bool unk) {
+ if (_state == unk_Loading){
+ _state = Ready;
+ }
+ //TODO set actor ref to inv mgr
+ Actor::init(unk);
}
} // End of namespace Pink
diff --git a/engines/pink/actors/lead_actor.h b/engines/pink/actors/lead_actor.h
index 46fda52..3954df1 100644
--- a/engines/pink/actors/lead_actor.h
+++ b/engines/pink/actors/lead_actor.h
@@ -47,7 +47,10 @@ public:
virtual void deserialize(Archive &archive);
void setNextExecutors (Common::String &nextModule, Common::String &nextPage);
+ virtual void init(bool unk);
+
private:
+ State _state;
CursorMgr *_cursorMgr;
WalkMgr *_walkMgr;
Sequencer *_sequencer;
Commit: 43c72bc2b7623452063cc87c5bc14b0f0676b331
https://github.com/scummvm/scummvm/commit/43c72bc2b7623452063cc87c5bc14b0f0676b331
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added basic script implementation
Changed paths:
engines/pink/actors/actor.cpp
engines/pink/actors/actor.h
engines/pink/items/sequence_item.cpp
engines/pink/items/sequence_item.h
engines/pink/items/sequence_item_default_action.cpp
engines/pink/items/sequence_item_leader.cpp
engines/pink/sequences/sequence.cpp
engines/pink/sequences/sequence.h
engines/pink/sequences/sequencer.h
diff --git a/engines/pink/actors/actor.cpp b/engines/pink/actors/actor.cpp
index fefe1f9..c10df16 100644
--- a/engines/pink/actors/actor.cpp
+++ b/engines/pink/actors/actor.cpp
@@ -75,6 +75,10 @@ void Actor::endAction() {
void Actor::setAction(const Common::String &name) {
Action *newAction = findAction(name);
+ setAction(newAction);
+}
+
+void Actor::setAction(Action *newAction) {
if (_action) {
_isActionEnd = 1;
_action->end();
@@ -86,4 +90,13 @@ void Actor::setAction(const Common::String &name) {
}
}
+void Actor::setAction(Action *newAction, bool unk) {
+ if (unk){
+ assert(0); // want to see this
+ _isActionEnd = 1;
+ _action = newAction;
+ }
+ else setAction(newAction);
+}
+
} // End of namespace Pink
diff --git a/engines/pink/actors/actor.h b/engines/pink/actors/actor.h
index 83f0d8e..040a482 100644
--- a/engines/pink/actors/actor.h
+++ b/engines/pink/actors/actor.h
@@ -49,6 +49,8 @@ public:
Action *findAction(const Common::String &name);
void setAction(const Common::String &name);
+ void setAction(Action *newAction);
+ void setAction(Action *newAction, bool unk);
protected:
GamePage *_page;
diff --git a/engines/pink/items/sequence_item.cpp b/engines/pink/items/sequence_item.cpp
index 2a8a93f..ade4e40 100644
--- a/engines/pink/items/sequence_item.cpp
+++ b/engines/pink/items/sequence_item.cpp
@@ -21,25 +21,52 @@
*/
#include <common/debug.h>
+#include <engines/pink/sequences/sequence.h>
+#include <engines/pink/sequences/sequencer.h>
+#include <engines/pink/actions/action.h>
#include "sequence_item.h"
#include "../archive.h"
#include "sequence_item_leader.h"
#include "sequence_item_default_action.h"
+#include "../page.h"
+#include "../actors/actor.h"
namespace Pink {
void SequenceItem::deserialize(Archive &archive) {
- archive >> _actor >> _action;
+ archive >> _actorName >> _actionName;
if (!dynamic_cast<SequenceItemLeader*>(this) && !dynamic_cast<SequenceItemDefaultAction*>(this))
- debug("\t\tSequenceItem: _actor = %s, _action = %s", _actor.c_str(), _action.c_str());
+ debug("\t\tSequenceItem: _actor = %s, _action = %s", _actorName.c_str(), _actionName.c_str());
}
const Common::String &SequenceItem::getActor() const {
- return _actor;
+ return _actorName;
}
const Common::String &SequenceItem::getAction() const {
- return _action;
+ return _actionName;
+}
+
+bool SequenceItem::execute(int unk, Sequence *sequence, bool unk2) {
+ Actor *actor;
+ Action *action;
+ if (!(actor = sequence->_sequencer->_page->findActor(_actorName)) ||
+ !(action = actor->findAction(_actionName))) {
+ return false;
+ }
+
+ actor->setAction(action, unk2);
+ Common::Array<SequenceActorState> &states = sequence->_context->_states;
+ for (int i = 0; i < sequence->_context->_states.size(); ++i) {
+ if (states[i]._actorName == _actorName){
+ states[i]._unk = unk;
+ sequence->_context->_actor = dynamic_cast<SequenceItemLeader*>(this) ?
+ actor : sequence->_context->_actor;
+ // TODO change to virt call
+ }
+ }
+
+ return true;
}
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/items/sequence_item.h b/engines/pink/items/sequence_item.h
index 5cf622e..2b6d2b9 100644
--- a/engines/pink/items/sequence_item.h
+++ b/engines/pink/items/sequence_item.h
@@ -27,6 +27,8 @@
namespace Pink {
+class Sequence;
+
class SequenceItem : public Object {
public:
virtual void deserialize(Archive &archive);
@@ -34,9 +36,11 @@ public:
const Common::String &getActor() const;
const Common::String &getAction() const;
+ virtual bool execute(int unk, Sequence *sequence, bool unk2);
+
protected:
- Common::String _actor;
- Common::String _action;
+ Common::String _actorName;
+ Common::String _actionName;
};
}
diff --git a/engines/pink/items/sequence_item_default_action.cpp b/engines/pink/items/sequence_item_default_action.cpp
index 279877a..3428639 100644
--- a/engines/pink/items/sequence_item_default_action.cpp
+++ b/engines/pink/items/sequence_item_default_action.cpp
@@ -29,7 +29,7 @@ namespace Pink {
void Pink::SequenceItemDefaultAction::deserialize(Archive &archive) {
SequenceItem::deserialize(archive);
debug("\t\tSequenceItemDefaultAction: _actor = %s, _action = %s",
- _actor.c_str(), _action.c_str());
+ _actorName.c_str(), _actionName.c_str());
}
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/items/sequence_item_leader.cpp b/engines/pink/items/sequence_item_leader.cpp
index 412352a..5e19fb4 100644
--- a/engines/pink/items/sequence_item_leader.cpp
+++ b/engines/pink/items/sequence_item_leader.cpp
@@ -30,7 +30,7 @@ namespace Pink {
void Pink::SequenceItemLeader::deserialize(Archive &archive) {
SequenceItem::deserialize(archive);
debug("\t\tSequenceItemLeader: _actor = %s, _action = %s",
- _actor.c_str(), _action.c_str());
+ _actorName.c_str(), _actionName.c_str());
}
} //End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/sequences/sequence.cpp b/engines/pink/sequences/sequence.cpp
index 0d8adc1..034078f 100644
--- a/engines/pink/sequences/sequence.cpp
+++ b/engines/pink/sequences/sequence.cpp
@@ -21,10 +21,12 @@
*/
#include <common/debug.h>
+#include <engines/pink/items/sequence_item_leader.h>
#include "sequence.h"
#include "sequencer.h"
#include "../archive.h"
-#include "../items/sequence_item.h"
+#include "../page.h"
+#include "../actors/actor.h"
namespace Pink {
@@ -39,10 +41,61 @@ Common::Array<SequenceItem*> &Sequence::getItems() {
return _items;
}
+void Sequence::setContext(SequenceContext *context) {
+ _context = context;
+}
+
+void Sequence::init(int unk) {
+ assert(_items.size());
+ assert(dynamic_cast<SequenceItemLeader*>(_items[0])); // first item must always be a leader
+ start(unk);
+}
+
+class Action;
+
+void Sequence::start(int unk) {
+ if (_context->_nextItemIndex > _items.size()){
+ debug("Sequence %s ended", _name);
+ //TODO destroy context
+ return;
+ }
+
+ if (!_items[_context->_nextItemIndex]->execute(_context->_unk, this, unk)){
+ //destroy context;
+ }
+
+ uint i;
+ for (i = _context->_nextItemIndex + 1; i <_items.size(); ++i){
+ if (dynamic_cast<SequenceItemLeader*>(_items[i]))
+ break;
+ _items[i]->execute(_context->_unk, this, unk);
+ }
+ _context->_nextItemIndex = i;
+
+
+ Common::Array<SequenceActorState> &states = _context->_states;
+ for (uint j = 0; j < states.size(); ++j) {
+ if (states[j]._unk != _context->_unk &&
+ !states[j]._actionName.empty()) {
+ Actor *actor;
+ Action *action;
+ actor = _sequencer->_page->findActor(states[j]._actorName);
+ assert(actor);
+ action = actor->findAction(states[j]._actionName);
+ assert(action);
+ actor->setAction(action, unk);
+ }
+ }
+ _context->_unk++;
+}
+
SequenceContext::SequenceContext(Sequence *sequence, Sequencer *sequencer)
- : _sequence(sequence), _sequencer(sequencer)
+ : _sequence(sequence), _sequencer(sequencer),
+ _nextItemIndex(0), _unk(1), _actor(nullptr)
{
+ sequence->setContext(this);
Common::Array<SequenceItem*> &items = sequence->getItems();
+ debug("SequenceContext for %s", _sequence->getName().c_str());
for (uint i = 0; i < items.size(); ++i) {
bool found = 0;
for (uint j = 0; j < _states.size(); ++j) {
@@ -63,11 +116,11 @@ SequenceContext::~SequenceContext() {
}
SequenceActorState::SequenceActorState(const Common::String &name)
- :_actor(name)
+ :_actorName(name), _unk(0)
{}
const Common::String &SequenceActorState::getActor() const {
- return _actor;
+ return _actorName;
}
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/sequences/sequence.h b/engines/pink/sequences/sequence.h
index 0360f28..02f3904 100644
--- a/engines/pink/sequences/sequence.h
+++ b/engines/pink/sequences/sequence.h
@@ -35,12 +35,19 @@ class SequenceContext;
class Sequence : public NamedObject {
public:
virtual void deserialize(Archive &archive);
+
Common::Array<SequenceItem*> &getItems();
-private:
+ void setContext(SequenceContext *context);
+ void init(int unk);
+ void start(int unk);
+
+public:
+ SequenceContext *_context;
Sequencer *_sequencer;
Common::Array<SequenceItem*> _items;
- //context
+ int _unk;
+
};
class SequenceActorState {
@@ -49,20 +56,26 @@ public:
const Common::String &getActor() const;
-private:
- Common::String _actor;
- Common::String _unk; // ?state
+public:
+ Common::String _actorName;
+ Common::String _actionName; // ?state
+ int _unk;
};
+class Actor;
class SequenceContext {
public:
SequenceContext(Sequence *sequence, Sequencer* sequencer);
~SequenceContext();
-private:
+
+public:
Sequence *_sequence;
Sequencer *_sequencer;
+ int _nextItemIndex;
+ Actor *_actor;
Common::Array<SequenceActorState> _states;
+ int _unk;
};
} // End of namespace Pink
diff --git a/engines/pink/sequences/sequencer.h b/engines/pink/sequences/sequencer.h
index e2d16cd..0243a4e 100644
--- a/engines/pink/sequences/sequencer.h
+++ b/engines/pink/sequences/sequencer.h
@@ -41,13 +41,14 @@ public:
Sequence* findSequence(const Common::String &name);
void authorSequence(Sequence *sequence, bool unk);
-private:
+public:
SequenceContext *_context;
// unknown objects array
Common::Array<Sequence*> _sequences;
Common::String _currentSequenceName;
//timers
GamePage *_page;
+ int unk;
};
} // End of namespace Pink
Commit: 824b3fa38e965e425d09239f2ac81c4853eb43e8
https://github.com/scummvm/scummvm/commit/824b3fa38e965e425d09239f2ac81c4853eb43e8
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: some fixes
Changed paths:
engines/pink/file.cpp
engines/pink/page.cpp
engines/pink/page.h
engines/pink/resource_mgr.cpp
engines/pink/resource_mgr.h
diff --git a/engines/pink/file.cpp b/engines/pink/file.cpp
index 354c7b5..04e87c2 100644
--- a/engines/pink/file.cpp
+++ b/engines/pink/file.cpp
@@ -122,7 +122,8 @@ ObjectDescription *OrbFile::getObjDesc(const char *name){
}
ResourceDescription *OrbFile::getResDescTable(ObjectDescription *objDesc){
- const uint32 size = objDesc->objectsCount;
+ const uint32 size = objDesc->resourcesCount;
+ seek(objDesc->resourcesOffset);
ResourceDescription *table = new ResourceDescription[size];
for (uint i = 0; i < size; ++i) {
diff --git a/engines/pink/page.cpp b/engines/pink/page.cpp
index 123e27b..3d644db 100644
--- a/engines/pink/page.cpp
+++ b/engines/pink/page.cpp
@@ -72,7 +72,9 @@ void GamePage::init(bool isLoadingSave) {
loadManagers();
}
- //init actor which inits actions
+ for (int i = 0; i < _actors.size(); ++i) {
+ _actors[i]->init(0);
+ }
if (!isLoadingSave) {
for (uint i = 0; i < _handlers.size(); ++i) {
@@ -112,4 +114,5 @@ Module *GamePage::getModule() const {
return _module;
}
+
} // End of namespace Pink
diff --git a/engines/pink/page.h b/engines/pink/page.h
index 878613a..a2458c1 100644
--- a/engines/pink/page.h
+++ b/engines/pink/page.h
@@ -69,11 +69,10 @@ public:
Sequencer *getSequencer();
Module *getModule() const;
+
private:
int perhapsIsLoaded;
Module *_module;
-
-private:
CursorMgr *_cursorMgr;
WalkMgr *_walkMgr;
Sequencer *_sequencer;
diff --git a/engines/pink/resource_mgr.cpp b/engines/pink/resource_mgr.cpp
index dc53cf3..378dded 100644
--- a/engines/pink/resource_mgr.cpp
+++ b/engines/pink/resource_mgr.cpp
@@ -20,6 +20,7 @@
*
*/
+#include <video/flic_decoder.h>
#include "resource_mgr.h"
#include "file.h"
#include "pink.h"
@@ -28,7 +29,7 @@
namespace Pink {
ResourceMgr::ResourceMgr()
- : _orb(nullptr), _bro(nullptr),
+ : _game(nullptr), _orb(nullptr), _bro(nullptr),
_resDescTable(nullptr), _resCount(0)
{}
@@ -39,6 +40,7 @@ ResourceMgr::~ResourceMgr() {
void ResourceMgr::init(PinkEngine *game, GamePage *page) {
_orb = game->getOrb();
_bro = game->getBro();
+ _game = game;
ObjectDescription *objDesc = _orb->getObjDesc(page->getName().c_str());
_resCount = objDesc->resourcesCount;
diff --git a/engines/pink/resource_mgr.h b/engines/pink/resource_mgr.h
index 7672e84..47c381a 100644
--- a/engines/pink/resource_mgr.h
+++ b/engines/pink/resource_mgr.h
@@ -25,12 +25,17 @@
#ifndef PINK_RESOURCE_MGR_H
#define PINK_RESOURCE_MGR_H
+namespace Common {
+ class String;
+}
+
namespace Pink {
class GamePage;
class PinkEngine;
class OrbFile;
class BroFile;
+class Sound;
struct ResourceDescription;
@@ -40,12 +45,14 @@ public:
~ResourceMgr();
void init(PinkEngine *game, GamePage *page);
+ //move methods to page
//compiler must do RVO
//Common::String loadText(Common::String &name);
- //Sound loadSound(Common::String &name);
+ Sound loadSound(Common::String &name);
// loadCEL();
private:
+ PinkEngine *_game;
OrbFile *_orb;
BroFile *_bro;
ResourceDescription *_resDescTable;
Commit: 467d3f1ab890bfca77629dd239b670ee4797bfe8
https://github.com/scummvm/scummvm/commit/467d3f1ab890bfca77629dd239b670ee4797bfe8
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: did a big file movement for better readability. Almost implemented
conditions and sideEffects. Added more classes. Now engine can play intro's sound.
Changed paths:
A engines/pink/objects/actions/action.cpp
A engines/pink/objects/actions/action.h
A engines/pink/objects/actions/action_cel.cpp
A engines/pink/objects/actions/action_cel.h
A engines/pink/objects/actions/action_hide.cpp
A engines/pink/objects/actions/action_hide.h
A engines/pink/objects/actions/action_play.cpp
A engines/pink/objects/actions/action_play.h
A engines/pink/objects/actions/action_sound.cpp
A engines/pink/objects/actions/action_sound.h
A engines/pink/objects/actions/action_still.cpp
A engines/pink/objects/actions/action_still.h
A engines/pink/objects/actions/walk_action.cpp
A engines/pink/objects/actions/walk_action.h
A engines/pink/objects/actors/actor.cpp
A engines/pink/objects/actors/actor.h
A engines/pink/objects/actors/lead_actor.cpp
A engines/pink/objects/actors/lead_actor.h
A engines/pink/objects/condition.cpp
A engines/pink/objects/condition.h
A engines/pink/objects/handlers/handler.cpp
A engines/pink/objects/handlers/handler.h
A engines/pink/objects/handlers/handler_mgr.cpp
A engines/pink/objects/handlers/handler_mgr.h
A engines/pink/objects/handlers/handler_timer.cpp
A engines/pink/objects/handlers/handler_timer.h
A engines/pink/objects/inventory.cpp
A engines/pink/objects/inventory.h
A engines/pink/objects/module.cpp
A engines/pink/objects/module.h
A engines/pink/objects/object.cpp
A engines/pink/objects/object.h
A engines/pink/objects/pages/game_page.cpp
A engines/pink/objects/pages/game_page.h
A engines/pink/objects/pages/page.cpp
A engines/pink/objects/pages/page.h
A engines/pink/objects/sequences/sequence.cpp
A engines/pink/objects/sequences/sequence.h
A engines/pink/objects/sequences/sequence_item.cpp
A engines/pink/objects/sequences/sequence_item.h
A engines/pink/objects/sequences/sequencer.cpp
A engines/pink/objects/sequences/sequencer.h
A engines/pink/objects/side_effect.cpp
A engines/pink/objects/side_effect.h
A engines/pink/objects/walk/walk_location.cpp
A engines/pink/objects/walk/walk_location.h
A engines/pink/objects/walk/walk_mgr.cpp
A engines/pink/objects/walk/walk_mgr.h
R engines/pink/actions/action.cpp
R engines/pink/actions/action.h
R engines/pink/actions/action_cel.cpp
R engines/pink/actions/action_cel.h
R engines/pink/actions/action_hide.cpp
R engines/pink/actions/action_hide.h
R engines/pink/actions/action_play.cpp
R engines/pink/actions/action_play.h
R engines/pink/actions/action_sound.cpp
R engines/pink/actions/action_sound.h
R engines/pink/actions/action_still.cpp
R engines/pink/actions/action_still.h
R engines/pink/actors/actor.cpp
R engines/pink/actors/actor.h
R engines/pink/actors/lead_actor.cpp
R engines/pink/actors/lead_actor.h
R engines/pink/handlers/handler.cpp
R engines/pink/handlers/handler.h
R engines/pink/handlers/handler_sequences.cpp
R engines/pink/handlers/handler_sequences.h
R engines/pink/handlers/handler_start_page.cpp
R engines/pink/handlers/handler_start_page.h
R engines/pink/inventory.cpp
R engines/pink/inventory.h
R engines/pink/items/sequence_item.cpp
R engines/pink/items/sequence_item.h
R engines/pink/items/sequence_item_default_action.cpp
R engines/pink/items/sequence_item_default_action.h
R engines/pink/items/sequence_item_leader.cpp
R engines/pink/items/sequence_item_leader.h
R engines/pink/module.cpp
R engines/pink/module.h
R engines/pink/object.cpp
R engines/pink/object.h
R engines/pink/page.cpp
R engines/pink/page.h
R engines/pink/sequences/sequence.cpp
R engines/pink/sequences/sequence.h
R engines/pink/sequences/sequencer.cpp
R engines/pink/sequences/sequencer.h
R engines/pink/side_effects/side_effect.cpp
R engines/pink/side_effects/side_effect.h
R engines/pink/side_effects/side_effect_exit.cpp
R engines/pink/side_effects/side_effect_exit.h
R engines/pink/side_effects/side_effect_module_variable.cpp
R engines/pink/side_effects/side_effect_module_variable.h
R engines/pink/side_effects/side_effect_variable.cpp
R engines/pink/side_effects/side_effect_variable.h
R engines/pink/utils.h
R engines/pink/walk/walk_location.cpp
R engines/pink/walk/walk_location.h
R engines/pink/walk/walk_mgr.cpp
R engines/pink/walk/walk_mgr.h
engines/pink/archive.cpp
engines/pink/archive.h
engines/pink/cursor_mgr.cpp
engines/pink/cursor_mgr.h
engines/pink/file.cpp
engines/pink/file.h
engines/pink/module.mk
engines/pink/pink.cpp
engines/pink/pink.h
engines/pink/resource_mgr.cpp
engines/pink/resource_mgr.h
engines/pink/sound.cpp
engines/pink/sound.h
diff --git a/engines/pink/actions/action.cpp b/engines/pink/actions/action.cpp
deleted file mode 100644
index dfeed6f2..0000000
--- a/engines/pink/actions/action.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "action.h"
-#include "../actors/actor.h"
-#include "../archive.h"
-
-namespace Pink {
-
-void Action::deserialize(Archive &archive) {
- NamedObject::deserialize(archive);
- _actor = static_cast<Actor*>(archive.readObject());
-}
-
-} // End of namespace Pink
diff --git a/engines/pink/actions/action.h b/engines/pink/actions/action.h
deleted file mode 100644
index 1037181..0000000
--- a/engines/pink/actions/action.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PINK_ACTION_H
-#define PINK_ACTION_H
-
-#include "../object.h"
-
-namespace Pink {
-
-class Actor;
-
-class Action : public NamedObject {
-public:
- virtual void deserialize(Archive &archive);
- virtual void play(bool unk_startNow) {}; //?? not sure about parameter
- virtual void end() {};
-
-protected:
- Actor *_actor;
-};
-
-} // End of namespace Pink
-
-#endif
diff --git a/engines/pink/actions/action_cel.cpp b/engines/pink/actions/action_cel.cpp
deleted file mode 100644
index a84ea41..0000000
--- a/engines/pink/actions/action_cel.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "action_cel.h"
-#include "../archive.h"
-
-namespace Pink {
-
-void ActionCEL::deserialize(Archive &archive) {
- Action::deserialize(archive);
- archive >> _fileName >> _z;
-}
-
-} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/actions/action_cel.h b/engines/pink/actions/action_cel.h
deleted file mode 100644
index ca481f7..0000000
--- a/engines/pink/actions/action_cel.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PINK_ACTION_CEL_H
-#define PINK_ACTION_CEL_H
-
-#include "action.h"
-
-namespace Pink {
-
-class ActionCEL : public Action {
-public:
- virtual void deserialize(Archive &archive);
-
-protected:
- Common::String _fileName;
- uint32 _z; // Z coordinate for sprite
-};
-
-} // End of namespace Pink
-
-#endif
diff --git a/engines/pink/actions/action_hide.cpp b/engines/pink/actions/action_hide.cpp
deleted file mode 100644
index a63cc49..0000000
--- a/engines/pink/actions/action_hide.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "action_hide.h"
-#include "../actors/actor.h"
-#include <engines/pink/archive.h>
-#include <common/debug.h>
-
-
-namespace Pink {
-
-void Pink::ActionHide::deserialize(Archive &archive) {
- Action::deserialize(archive);
- debug("\tActionHide: _name = %s", _name.c_str());
-}
-
-void ActionHide::play(bool unk_startNow) {
- debug("ActionHide %s is now in playing state", _name.c_str());
- _actor->endAction();
-}
-
-void ActionHide::end() {
- debug("ActionHide %s is ended", _name.c_str());
-}
-
-} //End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/actions/action_hide.h b/engines/pink/actions/action_hide.h
deleted file mode 100644
index e9b3294..0000000
--- a/engines/pink/actions/action_hide.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PINK_ACTION_HIDE_H
-#define PINK_ACTION_HIDE_H
-
-#include "action.h"
-
-namespace Pink {
-
-class ActionHide : public Action {
-public:
- virtual void deserialize(Archive &archive);
-
- virtual void play(bool unk_startNow);
- virtual void end();
-};
-
-} //End of namespace Pink
-
-#endif
diff --git a/engines/pink/actions/action_play.cpp b/engines/pink/actions/action_play.cpp
deleted file mode 100644
index 9dc2ef4..0000000
--- a/engines/pink/actions/action_play.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include <common/debug.h>
-#include "action_play.h"
-#include "../archive.h"
-
-namespace Pink {
-
-void ActionPlay::deserialize(Archive &archive) {
- ActionStill::deserialize(archive);
- archive >> _stopFrame;
- debug("\tActionPlay: _name = %s, _fileName = %s, z = %u, _startFrame = %u,"
- " _endFrame = %u", _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame);
-}
-
-} // End of namespace Pink
diff --git a/engines/pink/actions/action_play.h b/engines/pink/actions/action_play.h
deleted file mode 100644
index 00360d9..0000000
--- a/engines/pink/actions/action_play.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PINK_ACTION_PLAY_H
-#define PINK_ACTION_PLAY_H
-
-#include "action.h"
-#include "action_still.h"
-
-namespace Pink {
-
-class ActionPlay : public ActionStill {
- virtual void deserialize(Archive &archive);
-
-private:
- uint32 _stopFrame;
-};
-
-} // End of namespace Pink
-
-#endif
diff --git a/engines/pink/actions/action_sound.cpp b/engines/pink/actions/action_sound.cpp
deleted file mode 100644
index ee85689..0000000
--- a/engines/pink/actions/action_sound.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include <common/debug.h>
-#include "action_sound.h"
-#include "../archive.h"
-
-namespace Pink {
-
-void ActionSound::deserialize(Archive &archive) {
- Action::deserialize(archive);
- archive >> _fileName;
- _volume = archive.readDWORD();
- _isLoop = (bool) archive.readDWORD();
- _isBackground = (bool) archive.readDWORD();
- debug("\tActionSound: _name = %s, _fileName = %s, _volume = %u, _isLoop = %u,"
- " _isBackground = %u", _name.c_str(), _fileName.c_str(), _volume, _isLoop, _isBackground);
-}
-
-} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/actions/action_sound.h b/engines/pink/actions/action_sound.h
deleted file mode 100644
index 15b27d7..0000000
--- a/engines/pink/actions/action_sound.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PINK_ACTION_SOUND_H
-#define PINK_ACTION_SOUND_H
-
-#include "action.h"
-
-namespace Pink {
-
-class Sound;
-
-class ActionSound : public Action {
-public:
- virtual void deserialize(Archive &archive);
-
-private:
- Sound *_sound;
- Common::String _fileName;
- uint32 _volume;
- bool _isLoop;
- bool _isBackground;
- bool _isStopped;
-};
-
-} // End of namespace Pink
-
-#endif
diff --git a/engines/pink/actions/action_still.cpp b/engines/pink/actions/action_still.cpp
deleted file mode 100644
index b33476a..0000000
--- a/engines/pink/actions/action_still.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include <common/debug.h>
-#include "action_still.h"
-#include "../archive.h"
-#include "action_play.h"
-
-namespace Pink {
-
-void ActionStill::deserialize(Archive &archive) {
- ActionCEL::deserialize(archive);
- archive >> _startFrame;
- if (!dynamic_cast<ActionPlay*>(this)){
- debug("\tActionStill: _name = %s, _fileName = %s, _startFrame = %u",
- _name.c_str(), _fileName.c_str(), _startFrame);
- }
-}
-
-} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/actions/action_still.h b/engines/pink/actions/action_still.h
deleted file mode 100644
index 1400766..0000000
--- a/engines/pink/actions/action_still.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PINK_ACTION_STILL_H
-#define PINK_ACTION_STILL_H
-
-#include "action_cel.h"
-
-namespace Pink {
-
-class ActionStill : public ActionCEL {
-public:
- virtual void deserialize(Archive &archive);
-
-protected:
- uint32 _startFrame;
-};
-
-} // End of namespace Pink
-
-#endif
diff --git a/engines/pink/actors/actor.cpp b/engines/pink/actors/actor.cpp
deleted file mode 100644
index c10df16..0000000
--- a/engines/pink/actors/actor.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "actor.h"
-#include "../page.h"
-#include "lead_actor.h"
-#include "../actions/action.h"
-
-namespace Pink {
-
-void Actor::deserialize(Archive &archive) {
- NamedObject::deserialize(archive);
- _page = static_cast<GamePage*>(archive.readObject());
- if (dynamic_cast<LeadActor*>(this))
- debug("LeadActor: _name = %s", _name.c_str());
- else debug("Actor: _name = %s", _name.c_str());
- archive >> _actions;
-}
-
-Sequencer *Actor::getSequencer() {
- return _page->getSequencer();
-}
-
-Action *Actor::findAction(const Common::String &name) {
- return *Common::find_if(_actions.begin(), _actions.end(), [&name]
- (Action* action) {
- return name == action->getName();
- });;
-}
-
-GamePage *Actor::getPage() const {
- return _page;
-}
-
-void Actor::init(bool unk) {
- if (!_action) {
- _action = findAction({"Idle"});
- }
-
- if (!_action) {
- _isActionEnd = 1;
- }
- else {
- _isActionEnd = 0;
- _action->play(unk);
- }
-}
-
-void Actor::hide() {
- setAction({"Hide"});
-}
-
-void Actor::endAction() {
- _isActionEnd = 1;
-}
-
-void Actor::setAction(const Common::String &name) {
- Action *newAction = findAction(name);
- setAction(newAction);
-}
-
-void Actor::setAction(Action *newAction) {
- if (_action) {
- _isActionEnd = 1;
- _action->end();
- }
- if (newAction) {
- _isActionEnd = 0;
- _action = newAction;
- _action->play(0);
- }
-}
-
-void Actor::setAction(Action *newAction, bool unk) {
- if (unk){
- assert(0); // want to see this
- _isActionEnd = 1;
- _action = newAction;
- }
- else setAction(newAction);
-}
-
-} // End of namespace Pink
diff --git a/engines/pink/actors/actor.h b/engines/pink/actors/actor.h
deleted file mode 100644
index 040a482..0000000
--- a/engines/pink/actors/actor.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PINK_ACTOR_H
-#define PINK_ACTOR_H
-
-#include <common/array.h>
-#include "../object.h"
-
-namespace Pink {
-
-class GamePage;
-class Action;
-class Sequencer;
-
-class Actor : public NamedObject {
-public:
- Actor()
- : _page(nullptr), _action(nullptr),
- _isActionEnd(1)
- {};
- virtual void deserialize(Archive &archive);
-
- Sequencer *getSequencer();
- GamePage *getPage() const;
-
- virtual void init(bool unk);
- void hide();
- void endAction();
-
- Action *findAction(const Common::String &name);
- void setAction(const Common::String &name);
- void setAction(Action *newAction);
- void setAction(Action *newAction, bool unk);
-
-protected:
- GamePage *_page;
- Action *_action;
- Common::Array<Action*> _actions;
- bool _isActionEnd;
-};
-
-} // End of namespace Pink
-
-#endif
diff --git a/engines/pink/actors/lead_actor.cpp b/engines/pink/actors/lead_actor.cpp
deleted file mode 100644
index 12187d6..0000000
--- a/engines/pink/actors/lead_actor.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "lead_actor.h"
-#include "../walk/walk_mgr.h"
-#include "../cursor_mgr.h"
-#include "engines/pink/sequences/sequencer.h"
-#include "../archive.h"
-#include "../page.h"
-#include "../pink.h"
-
-namespace Pink {
-
-void LeadActor::deserialize(Archive &archive) {
- Actor::deserialize(archive);
- _cursorMgr = static_cast<CursorMgr*>(archive.readObject());
- _walkMgr = static_cast<WalkMgr*>(archive.readObject());
- _sequencer = static_cast<Sequencer*>(archive.readObject());
-}
-
-void LeadActor::setNextExecutors(Common::String &nextModule, Common::String &nextPage) {
- if (_state == Ready || _state == Moving || _state == inDialog1 || _state == Inventory || _state == PDA) {
- _state = PlayingVideo;
- _page->getGame()->setNextExecutors(nextModule, nextPage);
- }
-}
-
-void LeadActor::init(bool unk) {
- if (_state == unk_Loading){
- _state = Ready;
- }
- //TODO set actor ref to inv mgr
- Actor::init(unk);
-}
-
-} // End of namespace Pink
diff --git a/engines/pink/actors/lead_actor.h b/engines/pink/actors/lead_actor.h
deleted file mode 100644
index 3954df1..0000000
--- a/engines/pink/actors/lead_actor.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PINK_LEAD_ACTOR_H
-#define PINK_LEAD_ACTOR_H
-
-#include "actor.h"
-
-namespace Pink {
-
-class CursorMgr;
-class WalkMgr;
-class Sequencer;
-
-class LeadActor : public Actor {
-public:
- enum State {
- Ready = 0,
- Moving,
- inDialog1, //???
- Inventory,
- PDA,
- inDialog2,//???
- PlayingVideo, // ???
- unk_Loading // ????
- };
-
- virtual void deserialize(Archive &archive);
- void setNextExecutors (Common::String &nextModule, Common::String &nextPage);
-
- virtual void init(bool unk);
-
-private:
- State _state;
- CursorMgr *_cursorMgr;
- WalkMgr *_walkMgr;
- Sequencer *_sequencer;
-};
-
-} // End of namespace Pink
-
-#endif
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp
index b03cf91..9e06420 100644
--- a/engines/pink/archive.cpp
+++ b/engines/pink/archive.cpp
@@ -22,20 +22,19 @@
#include <common/debug.h>
#include <common/file.h>
-#include <engines/pink/actors/actor.h>
-#include <engines/pink/walk/walk_location.h>
-#include <engines/pink/actions/action_hide.h>
-#include <engines/pink/actions/action_play.h>
-#include <engines/pink/actions/action_sound.h>
-#include <engines/pink/sequences/sequence.h>
-#include <engines/pink/items/sequence_item_default_action.h>
-#include <engines/pink/items/sequence_item_leader.h>
-#include <engines/pink/handlers/handler_start_page.h>
-#include <engines/pink/side_effects/side_effect_exit.h>
-#include <engines/pink/side_effects/side_effect_module_variable.h>
-#include "module.h"
-#include "page.h"
-#include "actors/lead_actor.h"
+#include <engines/pink/objects/object.h>
+#include <engines/pink/objects/module.h>
+#include <engines/pink/objects/pages/game_page.h>
+#include <engines/pink/objects/actors/lead_actor.h>
+#include <engines/pink/objects/condition.h>
+#include <engines/pink/objects/side_effect.h>
+#include <engines/pink/objects/sequences/sequence_item.h>
+#include <engines/pink/objects/sequences/sequence.h>
+#include <engines/pink/objects/handlers/handler.h>
+#include <engines/pink/objects/actions/action_play.h>
+#include <engines/pink/objects/actions/action_sound.h>
+#include <engines/pink/objects/actions/action_hide.h>
+#include <engines/pink/objects/walk/walk_location.h>
namespace Pink {
@@ -194,15 +193,12 @@ static Object* createObject(int objectId){
Archive::Archive(Common::File &file)
: _file(file)
{
- debug("Archive created");
_objectMap.push_back(0);
_objectIdMap.push_back(kNullObject);
}
Archive::~Archive()
-{
- debug("Archive destroyed");
-}
+{}
void Archive::mapObject(Object *obj) {
_objectMap.push_back(obj);
@@ -222,8 +218,9 @@ Object *Archive::readObject() {
bool isCopyReturned;
Object *res = parseObject(isCopyReturned);
- if (res && !isCopyReturned)
+ if (res && !isCopyReturned) {
res->deserialize(*this);
+ }
return res;
}
@@ -284,7 +281,7 @@ uint Archive::findObjectId(const char *name) {
}));
if (!found)
- error("Class %s is not implemented", name);
+ error("Class %s is not in class Map", name);
return found->id;
}
diff --git a/engines/pink/archive.h b/engines/pink/archive.h
index 57ee78d..906169b 100644
--- a/engines/pink/archive.h
+++ b/engines/pink/archive.h
@@ -23,8 +23,8 @@
#ifndef PINK_ARCHIVE_H
#define PINK_ARCHIVE_H
-#include "utils.h"
-#include <engines/pink/object.h>
+#include <engines/pink/objects/object.h>
+#include <common/str-array.h>
namespace Common {
@@ -46,7 +46,6 @@ public:
Object *readObject();
Common::String readString();
-
private:
uint findObjectId(const char *name);
@@ -62,7 +61,7 @@ inline Archive &operator>>(Archive &archive, Common::Array<T> &arr){
uint size = archive.readCount();
arr.resize(size);
for (uint i = 0; i < size; ++i) {
- arr[i] = reinterpret_cast<T> (archive.readObject()); // hack; doesn't know better approach
+ arr[i] = reinterpret_cast<T> (archive.readObject());
}
return archive;
}
@@ -83,7 +82,7 @@ inline Archive &operator>>(Archive &archive, uint32 &num){
return archive;
}
-inline Archive &operator>>(Archive &archive, StringArray &array){
+inline Archive &operator>>(Archive &archive, Common::StringArray &array){
uint32 size = archive.readCount();
array.resize(size);
for (uint i = 0; i < size; ++i) {
diff --git a/engines/pink/cursor_mgr.cpp b/engines/pink/cursor_mgr.cpp
index 90cbd90..b5f9d4c 100644
--- a/engines/pink/cursor_mgr.cpp
+++ b/engines/pink/cursor_mgr.cpp
@@ -24,6 +24,6 @@
namespace Pink {
-CursorMgr::CursorMgr(GamePage *page) : page(page) {}
+CursorMgr::CursorMgr(GamePage *page) : _page(page) {}
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/cursor_mgr.h b/engines/pink/cursor_mgr.h
index cfc16ac..fac7c2e 100644
--- a/engines/pink/cursor_mgr.h
+++ b/engines/pink/cursor_mgr.h
@@ -23,7 +23,7 @@
#ifndef PINK_CURSOR_MGR_H
#define PINK_CURSOR_MGR_H
-#include "engines/pink/object.h"
+#include "engines/pink/objects/object.h"
namespace Pink {
@@ -35,8 +35,8 @@ public:
CursorMgr(GamePage *page);
private:
- Actor *actor;
- GamePage *page;
+ Actor *_actor;
+ GamePage *_page;
};
} // End of namespace Pink
diff --git a/engines/pink/file.cpp b/engines/pink/file.cpp
index 04e87c2..996a13d 100644
--- a/engines/pink/file.cpp
+++ b/engines/pink/file.cpp
@@ -21,7 +21,7 @@
*/
#include <common/str.h>
-#include "page.h"
+#include "engines/pink/objects/pages/game_page.h"
#include "pink.h"
namespace Pink {
@@ -167,7 +167,7 @@ void ResourceDescription::load(Common::File &file) {
uint16 temp;
file.read(&temp, sizeof(temp));
- InBro = temp ? true : false;
+ inBro = temp ? true : false;
}
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/file.h b/engines/pink/file.h
index 2b1d7cb..36a6af2 100644
--- a/engines/pink/file.h
+++ b/engines/pink/file.h
@@ -24,7 +24,6 @@
#define PINK_FILE_H
#include <common/file.h>
-#include "sound.h"
namespace Pink {
@@ -44,7 +43,7 @@ struct ResourceDescription {
char name[16];
uint32 offset;
uint32 size;
- bool InBro; // in original it is short.
+ bool inBro; // in original it is short.
// Don't know what's better to use.(Perhaps no diffrence because of padding)
};
diff --git a/engines/pink/handlers/handler.cpp b/engines/pink/handlers/handler.cpp
deleted file mode 100644
index d42d015..0000000
--- a/engines/pink/handlers/handler.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "handler.h"
-#include "../archive.h"
-#include "../side_effects/side_effect.h"
-
-namespace Pink {
-
-void Handler::deserialize(Archive &archive) {
- assert(archive.readCount() == 0); // intro has zero conditions, so skip;
- archive >> _sideEffects;
-}
-
-bool Handler::initConditions(LeadActor *actor) {
- return true;
-}
-
-void Handler::initSideEffects(LeadActor *actor) {
- for (int i = 0; i < _sideEffects.size(); ++i) {
- _sideEffects[i]->init(actor);
- }
-}
-
-} // End of namespace Pink
diff --git a/engines/pink/handlers/handler.h b/engines/pink/handlers/handler.h
deleted file mode 100644
index beca2ff..0000000
--- a/engines/pink/handlers/handler.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PINK_HANDLER_H
-#define PINK_HANDLER_H
-
-#include <engines/pink/object.h>
-#include <common/array.h>
-
-namespace Pink {
-
-class SideEffect;
-class LeadActor;
-
-class Handler : public Object {
-public:
- virtual void deserialize(Archive &archive);
- bool initConditions(LeadActor *actor);
- void initSideEffects(LeadActor *actor);
-
-protected:
- //_conditions
- Common::Array<SideEffect*> _sideEffects;
-};
-
-} // End of namespace Pink
-
-#endif
diff --git a/engines/pink/handlers/handler_sequences.cpp b/engines/pink/handlers/handler_sequences.cpp
deleted file mode 100644
index c785883..0000000
--- a/engines/pink/handlers/handler_sequences.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "handler_sequences.h"
-#include <engines/pink/sequences/sequencer.h>
-#include "../archive.h"
-#include "../actors/lead_actor.h"
-
-namespace Pink {
-
-void HandlerSequences::deserialize(Archive &archive) {
- Handler::deserialize(archive);
- archive >> _sequences;
-}
-
-void HandlerSequences::initSequence(LeadActor *actor) {
- initSideEffects(actor);
-
- Sequencer *sequencer = actor->getSequencer();
- Sequence *sequence = sequencer->findSequence(_sequences[0]); //actually we must pick random sequence
- sequencer->authorSequence(sequence, 0);
-}
-
-} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/handlers/handler_sequences.h b/engines/pink/handlers/handler_sequences.h
deleted file mode 100644
index b55d81c..0000000
--- a/engines/pink/handlers/handler_sequences.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-#ifndef PINK_HANDLER_SEQUENCES_H
-#define PINK_HANDLER_SEQUENCES_H
-
-#include <engines/pink/utils.h>
-#include "handler.h"
-
-namespace Pink {
-
-class HandlerSequences : public Handler {
-public:
- virtual void deserialize(Archive &archive);
- void initSequence(LeadActor *actor);
-
-protected:
- StringArray _sequences;
-};
-
-} // End of namespace Pink
-
-#endif
diff --git a/engines/pink/handlers/handler_start_page.cpp b/engines/pink/handlers/handler_start_page.cpp
deleted file mode 100644
index 8fef49e..0000000
--- a/engines/pink/handlers/handler_start_page.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "handler_start_page.h"
-#include <common/debug.h>
-#include "../archive.h"
-
-namespace Pink {
-
-void HandlerStartPage::deserialize(Archive &archive) {
- debug("HandlerStartPage: ");
- HandlerSequences::deserialize(archive);
-
- for (uint i = 0; i < _sequences.size(); ++i) {
- debug("\t%s", _sequences[i].c_str());
- }
-}
-
-} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/handlers/handler_start_page.h b/engines/pink/handlers/handler_start_page.h
deleted file mode 100644
index a273e1e..0000000
--- a/engines/pink/handlers/handler_start_page.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PINK_HANDLER_START_PAGE_H
-#define PINK_HANDLER_START_PAGE_H
-
-#include "handler.h"
-#include "handler_sequences.h"
-
-namespace Pink {
-
-class HandlerStartPage : public HandlerSequences {
-public:
- virtual void deserialize(Archive &archive);
-};
-
-} // End of namespace Pink
-
-#endif
diff --git a/engines/pink/inventory.cpp b/engines/pink/inventory.cpp
deleted file mode 100644
index ed2569e..0000000
--- a/engines/pink/inventory.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-
-#include "inventory.h"
-#include "archive.h"
-
-namespace Pink {
-
-void Pink::InventoryItem::deserialize(Archive &archive) {
- NamedObject::deserialize(archive);
- _initialOwner = archive.readString();
- _currentOwner = _initialOwner;
-}
-
-InventoryMgr::~InventoryMgr() {
- for (uint i = 0; i < _invItems.size(); ++i) {
- delete _invItems[i];
- }
-}
-
-void InventoryMgr::deserialize(Archive &archive) {
- archive >> _invItems;
-}
-
-} // End of namespace Pink
-
-
diff --git a/engines/pink/inventory.h b/engines/pink/inventory.h
deleted file mode 100644
index 197c226..0000000
--- a/engines/pink/inventory.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PINK_INVENTORY_H
-#define PINK_INVENTORY_H
-
-
-#include <common/array.h>
-#include "engines/pink/object.h"
-
-namespace Pink {
-
-
-class InventoryItem : public NamedObject {
-public:
- virtual void deserialize(Archive &archive);
-
-private:
- Common::String _initialOwner;
- Common::String _currentOwner;
-};
-
-class InventoryMgr : public Object {
-public:
- virtual ~InventoryMgr();
-
- virtual void deserialize(Archive &archive);
-
-private:
- Common::Array<InventoryItem*> _invItems;
- // other fields. haven't RE them yet
-};
-
-} // End of namespace Pink
-
-#endif
diff --git a/engines/pink/items/sequence_item.cpp b/engines/pink/items/sequence_item.cpp
deleted file mode 100644
index ade4e40..0000000
--- a/engines/pink/items/sequence_item.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include <common/debug.h>
-#include <engines/pink/sequences/sequence.h>
-#include <engines/pink/sequences/sequencer.h>
-#include <engines/pink/actions/action.h>
-#include "sequence_item.h"
-#include "../archive.h"
-#include "sequence_item_leader.h"
-#include "sequence_item_default_action.h"
-#include "../page.h"
-#include "../actors/actor.h"
-
-namespace Pink {
-
-void SequenceItem::deserialize(Archive &archive) {
- archive >> _actorName >> _actionName;
- if (!dynamic_cast<SequenceItemLeader*>(this) && !dynamic_cast<SequenceItemDefaultAction*>(this))
- debug("\t\tSequenceItem: _actor = %s, _action = %s", _actorName.c_str(), _actionName.c_str());
-}
-
-const Common::String &SequenceItem::getActor() const {
- return _actorName;
-}
-
-const Common::String &SequenceItem::getAction() const {
- return _actionName;
-}
-
-bool SequenceItem::execute(int unk, Sequence *sequence, bool unk2) {
- Actor *actor;
- Action *action;
- if (!(actor = sequence->_sequencer->_page->findActor(_actorName)) ||
- !(action = actor->findAction(_actionName))) {
- return false;
- }
-
- actor->setAction(action, unk2);
- Common::Array<SequenceActorState> &states = sequence->_context->_states;
- for (int i = 0; i < sequence->_context->_states.size(); ++i) {
- if (states[i]._actorName == _actorName){
- states[i]._unk = unk;
- sequence->_context->_actor = dynamic_cast<SequenceItemLeader*>(this) ?
- actor : sequence->_context->_actor;
- // TODO change to virt call
- }
- }
-
- return true;
-}
-
-} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/items/sequence_item.h b/engines/pink/items/sequence_item.h
deleted file mode 100644
index 2b6d2b9..0000000
--- a/engines/pink/items/sequence_item.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PINK_SEQUENCE_ITEM_H
-#define PINK_SEQUENCE_ITEM_H
-
-#include <engines/pink/object.h>
-
-namespace Pink {
-
-class Sequence;
-
-class SequenceItem : public Object {
-public:
- virtual void deserialize(Archive &archive);
-
- const Common::String &getActor() const;
- const Common::String &getAction() const;
-
- virtual bool execute(int unk, Sequence *sequence, bool unk2);
-
-protected:
- Common::String _actorName;
- Common::String _actionName;
-};
-
-}
-
-#endif
diff --git a/engines/pink/items/sequence_item_default_action.cpp b/engines/pink/items/sequence_item_default_action.cpp
deleted file mode 100644
index 3428639..0000000
--- a/engines/pink/items/sequence_item_default_action.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include <engines/pink/archive.h>
-#include <common/debug.h>
-#include "sequence_item_default_action.h"
-
-namespace Pink {
-
-void Pink::SequenceItemDefaultAction::deserialize(Archive &archive) {
- SequenceItem::deserialize(archive);
- debug("\t\tSequenceItemDefaultAction: _actor = %s, _action = %s",
- _actorName.c_str(), _actionName.c_str());
-}
-
-} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/items/sequence_item_default_action.h b/engines/pink/items/sequence_item_default_action.h
deleted file mode 100644
index 9909673..0000000
--- a/engines/pink/items/sequence_item_default_action.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PINK_SEQUENCE_ITEM_DEFAULT_ACTION_H
-#define PINK_SEQUENCE_ITEM_DEFAULT_ACTION_H
-
-#include "sequence_item.h"
-
-namespace Pink {
-
-class SequenceItemDefaultAction : public SequenceItem {
-public:
- virtual void deserialize(Archive &archive);
-};
-
-} // End of namespace Pink
-
-#endif
diff --git a/engines/pink/items/sequence_item_leader.cpp b/engines/pink/items/sequence_item_leader.cpp
deleted file mode 100644
index 5e19fb4..0000000
--- a/engines/pink/items/sequence_item_leader.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include <engines/pink/archive.h>
-#include <common/debug.h>
-#include "sequence_item_leader.h"
-
-namespace Pink {
-
-
-void Pink::SequenceItemLeader::deserialize(Archive &archive) {
- SequenceItem::deserialize(archive);
- debug("\t\tSequenceItemLeader: _actor = %s, _action = %s",
- _actorName.c_str(), _actionName.c_str());
-}
-
-} //End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/items/sequence_item_leader.h b/engines/pink/items/sequence_item_leader.h
deleted file mode 100644
index b5506ad..0000000
--- a/engines/pink/items/sequence_item_leader.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PINK_SEQUENCE_ITEM_LEADER_H
-#define PINK_SEQUENCE_ITEM_LEADER_H
-
-#include "sequence_item.h"
-
-namespace Pink {
-
-class SequenceItemLeader : public SequenceItem {
-public:
- virtual void deserialize(Archive &archive);
-
-private:
-};
-
-}
-
-#endif
diff --git a/engines/pink/module.cpp b/engines/pink/module.cpp
deleted file mode 100644
index 28ca354..0000000
--- a/engines/pink/module.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "module.h"
-#include "page.h"
-
-namespace Pink {
-
-ModuleProxy::ModuleProxy(const Common::String &name)
- : NamedObject(name)
-{}
-
-ModuleProxy::ModuleProxy() {}
-
-Module::Module(PinkEngine *game, const Common::String &name)
- : NamedObject(name), _game(game), _page(nullptr)
-{}
-
-void Module::load(Archive &archive){
- archive.mapObject(this);
- NamedObject::deserialize(archive);
-
- archive.readString(); // skip directory
-
- _invMgr.deserialize(archive);
- archive >> _pages;
-}
-
-void Module::init(bool isLoadingSave, const Common::String *pageName) {
- // debugging original
- // 0 0 - new game
- // 0 1 - module changed
- // 1 0 - from save
-
- // 1 1 - haven't seen those values
-
- //this func will be rewrited after testing
-
- if (_page) {
- debug("loading from save");
- }
- if (pageName){
- debug("module changed");
- }
- assert(_pages.size() != 0);
-
- if (pageName) {
- uint i;
- for (i = 0; i < _pages.size(); ++i) {
- if(*pageName == _pages[i]->getName()) {
- _page = _pages[i];
- }
- }
- assert(i < _pages.size());
- }
-
- if (_page) {
- _page->init(isLoadingSave); // module changed or from save
- return;
- }
-
- if (_page != _pages[0]) {
- if (_page) {
- assert(0); // in original code there is call to page func but I've never seen it
- return;
- }
- _page = _pages[0];
- _page->init(isLoadingSave); // new game
- return;
- }
-
- assert(0);
-}
-
-PinkEngine *Module::getGame() const {
- return _game;
-}
-
-Common::StringMap &Module::getMap() {
- return _map;
-}
-
-} // End of namespace Pink
-
-
-
diff --git a/engines/pink/module.h b/engines/pink/module.h
deleted file mode 100644
index abaf679..0000000
--- a/engines/pink/module.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PINK_MODULE_H
-#define PINK_MODULE_H
-
-#include "archive.h"
-#include <common/str.h>
-#include "engines/pink/object.h"
-#include <common/debug.h>
-#include <engines/pink/utils.h>
-#include <common/hash-str.h>
-#include "inventory.h"
-
-namespace Pink {
-
-class ModuleProxy : public NamedObject {
-public:
- ModuleProxy();
- ModuleProxy(const Common::String &name);
-};
-
-class PinkEngine;
-
-class Module : public NamedObject {
-public:
- Module(PinkEngine *game, const Common::String &name);
-
- void load(Archive &archive);
- void init(bool isLoadingSave, const Common::String *pageName);
-
- void OnLeftButtonDown();
- void OnMouseMove();
- void OnKeyboardButtonClick();
-
- Common::StringMap &getMap();
-
- PinkEngine *getGame() const;
-
-
-private:
- PinkEngine *_game;
- GamePage *_page;
- PagesArray _pages;
- InventoryMgr _invMgr;
- Common::StringMap _map; // used for saves and maybe for smth else
-};
-
-
-} // End of namespace Pink
-
-#endif
diff --git a/engines/pink/module.mk b/engines/pink/module.mk
index b78f3f1..a78312a 100644
--- a/engines/pink/module.mk
+++ b/engines/pink/module.mk
@@ -8,14 +8,30 @@ MODULE_OBJS = \
sound.o \
file.o \
archive.o \
- object.o \
- module.o \
- page.o \
- inventory.o \
+ cursor_mgr.o \
+ objects/object.o \
+ objects/module.o \
+ objects/pages/page.o \
+ objects/pages/game_page.o \
+ objects/inventory.o \
+ objects/side_effect.o \
+ objects/condition.o \
resource_mgr.o \
- actions/action.o \
- actors/actor.o \
- actors/lead_actor.o \
+ objects/actions/action.o \
+ objects/actions/action_cel.o \
+ objects/actions/action_hide.o \
+ objects/actions/action_play.o \
+ objects/actions/action_sound.o \
+ objects/actions/action_still.o \
+ objects/actors/actor.o \
+ objects/actors/lead_actor.o \
+ objects/walk/walk_mgr.o \
+ objects/walk/walk_location.o \
+ objects/sequences/sequence.o \
+ objects/sequences/sequence_item.o \
+ objects/sequences/sequencer.o \
+ objects/handlers/handler.o \
+ objects/handlers/handler_timer.o \
# This module can be built as a plugin
diff --git a/engines/pink/object.cpp b/engines/pink/object.cpp
deleted file mode 100644
index 3d0a2ae..0000000
--- a/engines/pink/object.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include <common/debug.h>
-#include "object.h"
-#include "archive.h"
-
-namespace Pink {
-
-Pink::NamedObject::NamedObject(const Common::String &name)
- : _name(name)
-{}
-
-void Pink::NamedObject::deserialize(Archive &archive) {
- _name = archive.readString();
-}
-
-const Common::String &Pink::NamedObject::getName() const {
- return _name;
-}
-
-void NamedObject::store(Archive &archive) {
-
-}
-
-} // End of namespace Pink
-
diff --git a/engines/pink/object.h b/engines/pink/object.h
deleted file mode 100644
index bd058cf..0000000
--- a/engines/pink/object.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PINK_OBJECT_H
-#define PINK_OBJECT_H
-
-#include <common/str.h>
-
-namespace Pink {
-
-class Archive;
-
-class Object {
-public:
- virtual ~Object() {};
- virtual void load(Archive &){};
- virtual void store(Archive &){};
- virtual void deserialize(Archive &){};
- virtual void init() {}
-};
-
-class NamedObject : public Object {
-public:
- NamedObject(){};
- NamedObject(const Common::String &name);
-
- void deserialize(Archive &archive);
- void store(Archive &archive);
-
- const Common::String &getName() const;
-
-protected:
- Common::String _name;
-};
-
-} // End of namespace Pink
-
-#endif
\ No newline at end of file
diff --git a/engines/pink/objects/actions/action.cpp b/engines/pink/objects/actions/action.cpp
new file mode 100644
index 0000000..0853e37
--- /dev/null
+++ b/engines/pink/objects/actions/action.cpp
@@ -0,0 +1,34 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "action.h"
+#include "engines/pink/objects/actors/actor.h"
+#include "engines/pink/archive.h"
+
+namespace Pink {
+
+void Action::deserialize(Archive &archive) {
+ NamedObject::deserialize(archive);
+ _actor = static_cast<Actor*>(archive.readObject());
+}
+
+} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action.h b/engines/pink/objects/actions/action.h
new file mode 100644
index 0000000..5b164a3
--- /dev/null
+++ b/engines/pink/objects/actions/action.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_ACTION_H
+#define PINK_ACTION_H
+
+#include "engines/pink/objects/object.h"
+
+namespace Pink {
+
+class Actor;
+
+class Action : public NamedObject {
+public:
+ virtual void deserialize(Archive &archive);
+ virtual void start(bool unk) {};
+ virtual void end() {};
+ virtual void update() {};
+ virtual void toConsole() {};
+
+protected:
+ Actor *_actor;
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp
new file mode 100644
index 0000000..f1c3504
--- /dev/null
+++ b/engines/pink/objects/actions/action_cel.cpp
@@ -0,0 +1,34 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include <common/debug.h>
+#include "action_cel.h"
+#include "engines/pink/archive.h"
+
+namespace Pink {
+
+void ActionCEL::deserialize(Archive &archive) {
+ Action::deserialize(archive);
+ archive >> _fileName >> _z;
+}
+
+} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/actions/action_cel.h b/engines/pink/objects/actions/action_cel.h
new file mode 100644
index 0000000..8c6a61a
--- /dev/null
+++ b/engines/pink/objects/actions/action_cel.h
@@ -0,0 +1,41 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_ACTION_CEL_H
+#define PINK_ACTION_CEL_H
+
+#include "action.h"
+
+namespace Pink {
+
+class ActionCEL : public Action {
+public:
+ virtual void deserialize(Archive &archive);
+
+protected:
+ Common::String _fileName;
+ uint32 _z;
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/objects/actions/action_hide.cpp b/engines/pink/objects/actions/action_hide.cpp
new file mode 100644
index 0000000..7df4366
--- /dev/null
+++ b/engines/pink/objects/actions/action_hide.cpp
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "action_hide.h"
+#include "engines/pink/objects/actors/actor.h"
+#include <engines/pink/archive.h>
+#include <common/debug.h>
+
+
+namespace Pink {
+
+void Pink::ActionHide::deserialize(Archive &archive) {
+ Action::deserialize(archive);
+}
+
+void ActionHide::play(bool unk_startNow) {
+ debug("ActionHide %s is now in playing state", _name.c_str());
+ _actor->endAction();
+}
+
+void ActionHide::end() {
+ debug("ActionHide %s is ended", _name.c_str());
+}
+
+void ActionHide::toConsole() {
+ debug("\tActionHide: _name = %s", _name.c_str());
+}
+
+} //End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/actions/action_hide.h b/engines/pink/objects/actions/action_hide.h
new file mode 100644
index 0000000..fa6e717
--- /dev/null
+++ b/engines/pink/objects/actions/action_hide.h
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_ACTION_HIDE_H
+#define PINK_ACTION_HIDE_H
+
+#include "action.h"
+
+namespace Pink {
+
+class ActionHide : public Action {
+public:
+ virtual void deserialize(Archive &archive);
+
+ virtual void toConsole();
+
+ virtual void play(bool unk_startNow);
+ virtual void end();
+};
+
+} //End of namespace Pink
+
+#endif
diff --git a/engines/pink/objects/actions/action_play.cpp b/engines/pink/objects/actions/action_play.cpp
new file mode 100644
index 0000000..5e6b692
--- /dev/null
+++ b/engines/pink/objects/actions/action_play.cpp
@@ -0,0 +1,39 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include <common/debug.h>
+#include "action_play.h"
+#include "engines/pink/archive.h"
+
+namespace Pink {
+
+void ActionPlay::deserialize(Archive &archive) {
+ ActionStill::deserialize(archive);
+ archive >> _stopFrame;
+}
+
+void ActionPlay::toConsole() {
+ debug("\tActionPlay: _name = %s, _fileName = %s, z = %u, _startFrame = %u,"
+ " _endFrame = %u", _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame);
+}
+
+} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_play.h b/engines/pink/objects/actions/action_play.h
new file mode 100644
index 0000000..d53b44a
--- /dev/null
+++ b/engines/pink/objects/actions/action_play.h
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_ACTION_PLAY_H
+#define PINK_ACTION_PLAY_H
+
+#include "action.h"
+#include "action_still.h"
+
+namespace Pink {
+
+class ActionPlay : public ActionStill {
+public:
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
+
+private:
+ uint32 _stopFrame;
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/objects/actions/action_sound.cpp b/engines/pink/objects/actions/action_sound.cpp
new file mode 100644
index 0000000..f389f97
--- /dev/null
+++ b/engines/pink/objects/actions/action_sound.cpp
@@ -0,0 +1,72 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include <common/debug.h>
+#include "action_sound.h"
+#include "engines/pink/archive.h"
+#include <engines/pink/objects/actors/actor.h>
+#include <engines/pink/objects/pages/game_page.h>
+#include <engines/pink/sound.h>
+
+
+namespace Pink {
+
+ActionSound::ActionSound()
+ : _sound(nullptr), _isStopped(1)
+{}
+
+void ActionSound::deserialize(Archive &archive) {
+ Action::deserialize(archive);
+ archive >> _fileName;
+ _volume = archive.readDWORD();
+ _isLoop = (bool) archive.readDWORD();
+ _isBackground = (bool) archive.readDWORD();
+}
+
+void ActionSound::toConsole() {
+ debug("\tActionSound: _name = %s, _fileName = %s, _volume = %u, _isLoop = %u,"
+ " _isBackground = %u", _name.c_str(), _fileName.c_str(), _volume, _isLoop, _isBackground);
+}
+
+void ActionSound::start(bool unk) {
+ assert(!_sound);
+ _sound = _actor->getPage()->loadSound(_fileName);
+
+ Audio::Mixer::SoundType soundType = _isBackground ? Audio::Mixer::SoundType::kMusicSoundType
+ : Audio::Mixer::SoundType::kSpeechSoundType;
+ _sound->play(soundType, _volume, _isLoop);
+ if (_isLoop)
+ _actor->endAction();
+}
+
+void ActionSound::end() {
+ _sound->stop();
+ delete _sound;
+ _sound = nullptr;
+}
+
+void ActionSound::update() {
+ if (!_sound->isPlaying())
+ _actor->endAction();
+}
+
+} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/actions/action_sound.h b/engines/pink/objects/actions/action_sound.h
new file mode 100644
index 0000000..e4bb2f1
--- /dev/null
+++ b/engines/pink/objects/actions/action_sound.h
@@ -0,0 +1,54 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_ACTION_SOUND_H
+#define PINK_ACTION_SOUND_H
+
+#include "action.h"
+
+namespace Pink {
+
+class Sound;
+
+class ActionSound : public Action {
+public:
+ ActionSound();
+ virtual void deserialize(Archive &archive);
+
+ virtual void toConsole();
+
+ virtual void start(bool unk_startNow);
+ virtual void end();
+ virtual void update();
+
+private:
+ Sound *_sound;
+ Common::String _fileName;
+ uint32 _volume;
+ bool _isLoop;
+ bool _isBackground;
+ bool _isStopped;
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/objects/actions/action_still.cpp b/engines/pink/objects/actions/action_still.cpp
new file mode 100644
index 0000000..3c6bf17
--- /dev/null
+++ b/engines/pink/objects/actions/action_still.cpp
@@ -0,0 +1,39 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include <common/debug.h>
+#include "action_still.h"
+#include "engines/pink/archive.h"
+
+namespace Pink {
+
+void ActionStill::deserialize(Archive &archive) {
+ ActionCEL::deserialize(archive);
+ archive >> _startFrame;
+}
+
+void ActionStill::toConsole() {
+ debug("\tActionStill: _name = %s, _fileName = %s, _startFrame = %u",
+ _name.c_str(), _fileName.c_str(), _startFrame);
+}
+
+} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/actions/action_still.h b/engines/pink/objects/actions/action_still.h
new file mode 100644
index 0000000..075371a
--- /dev/null
+++ b/engines/pink/objects/actions/action_still.h
@@ -0,0 +1,41 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_ACTION_STILL_H
+#define PINK_ACTION_STILL_H
+
+#include "action_cel.h"
+
+namespace Pink {
+
+class ActionStill : public ActionCEL {
+public:
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
+
+protected:
+ uint32 _startFrame;
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/objects/actions/walk_action.cpp b/engines/pink/objects/actions/walk_action.cpp
new file mode 100644
index 0000000..39be8f4
--- /dev/null
+++ b/engines/pink/objects/actions/walk_action.cpp
@@ -0,0 +1,40 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "walk_action.h"
+#include <engines/pink/archive.h>
+#include <common/debug.h>
+
+namespace Pink {
+
+void WalkAction::deserialize(Archive &archive) {
+ ActionCEL::deserialize(archive);
+ uint32 calcFramePositions = archive.readDWORD();
+ _toCalcFramePositions = calcFramePositions ? true : false;
+}
+
+void WalkAction::toConsole() {
+ debug("\tWalkAction: _name = %s, _fileName = %s, _calcFramePositions = %u",
+ _name.c_str(), _fileName.c_str(), _toCalcFramePositions);
+}
+
+} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/actions/walk_action.h b/engines/pink/objects/actions/walk_action.h
new file mode 100644
index 0000000..923811f
--- /dev/null
+++ b/engines/pink/objects/actions/walk_action.h
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_WALK_ACTION_H
+#define PINK_WALK_ACTION_H
+
+#include "action_cel.h"
+
+namespace Pink {
+
+class WalkAction : public ActionCEL {
+public:
+ virtual void deserialize(Archive &archive);
+
+ virtual void toConsole();
+
+private:
+ bool _toCalcFramePositions;
+};
+
+}
+
+#endif
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
new file mode 100644
index 0000000..c02cb67
--- /dev/null
+++ b/engines/pink/objects/actors/actor.cpp
@@ -0,0 +1,110 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "actor.h"
+#include "engines/pink/objects/pages/game_page.h"
+#include "lead_actor.h"
+#include "engines/pink/objects/actions/action.h"
+
+namespace Pink {
+
+void Actor::deserialize(Archive &archive) {
+ NamedObject::deserialize(archive);
+ _page = static_cast<GamePage*>(archive.readObject());
+ archive >> _actions;
+}
+
+void Actor::toConsole() {
+ debug("Actor: _name = %s", _name.c_str());
+ for (int i = 0; i < _actions.size(); ++i) {
+ _actions[i]->toConsole();
+ }
+}
+
+Sequencer *Actor::getSequencer() const {
+ return _page->getSequencer();
+}
+
+Action *Actor::findAction(const Common::String &name) {
+ return *Common::find_if(_actions.begin(), _actions.end(), [&name]
+ (Action* action) {
+ return name == action->getName();
+ });;
+}
+
+GamePage *Actor::getPage() const {
+ return _page;
+}
+
+void Actor::init(bool unk) {
+ if (!_action) {
+ _action = findAction({"Idle"});
+ }
+
+ if (!_action) {
+ _isActionEnd = 1;
+ }
+ else {
+ _isActionEnd = 0;
+ _action->start(unk);
+ }
+}
+
+void Actor::hide() {
+ setAction({"Hide"});
+}
+
+void Actor::endAction() {
+ _isActionEnd = 1;
+}
+
+void Actor::setAction(const Common::String &name) {
+ Action *newAction = findAction(name);
+ setAction(newAction);
+}
+
+void Actor::setAction(Action *newAction) {
+ if (_action) {
+ _isActionEnd = 1;
+ _action->end();
+ }
+ if (newAction) {
+ _isActionEnd = 0;
+ _action = newAction;
+ _action->start(0);
+ }
+}
+
+void Actor::setAction(Action *newAction, bool unk) {
+ if (unk){
+ assert(0); // want to see this
+ _isActionEnd = 1;
+ _action = newAction;
+ }
+ else setAction(newAction);
+}
+
+Action *Actor::getAction() const {
+ return _action;
+}
+
+} // End of namespace Pink
diff --git a/engines/pink/objects/actors/actor.h b/engines/pink/objects/actors/actor.h
new file mode 100644
index 0000000..a31f553
--- /dev/null
+++ b/engines/pink/objects/actors/actor.h
@@ -0,0 +1,68 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_ACTOR_H
+#define PINK_ACTOR_H
+
+#include <common/array.h>
+#include "engines/pink/objects/object.h"
+
+namespace Pink {
+
+class GamePage;
+class Action;
+class Sequencer;
+
+class Actor : public NamedObject {
+public:
+ Actor()
+ : _page(nullptr), _action(nullptr),
+ _isActionEnd(1)
+ {};
+ virtual void deserialize(Archive &archive);
+
+ virtual void toConsole();
+
+ Sequencer *getSequencer() const;
+ GamePage *getPage() const;
+ Action *getAction() const;
+
+
+ virtual void init(bool unk);
+ void hide();
+ void endAction();
+
+ Action *findAction(const Common::String &name);
+ void setAction(const Common::String &name);
+ void setAction(Action *newAction);
+ void setAction(Action *newAction, bool unk);
+
+protected:
+ GamePage *_page;
+ Action *_action;
+ Common::Array<Action*> _actions;
+ bool _isActionEnd;
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
new file mode 100644
index 0000000..2c88612
--- /dev/null
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -0,0 +1,63 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "lead_actor.h"
+#include <engines/pink/objects/actions/action.h>
+#include "engines/pink/objects/walk/walk_mgr.h"
+#include "engines/pink/cursor_mgr.h"
+#include "engines/pink/objects/sequences/sequencer.h"
+#include "engines/pink/archive.h"
+#include "engines/pink/objects/pages/game_page.h"
+#include "engines/pink/pink.h"
+
+namespace Pink {
+
+void LeadActor::deserialize(Archive &archive) {
+ Actor::deserialize(archive);
+ _cursorMgr = static_cast<CursorMgr*>(archive.readObject());
+ _walkMgr = static_cast<WalkMgr*>(archive.readObject());
+ _sequencer = static_cast<Sequencer*>(archive.readObject());
+}
+
+void LeadActor::setNextExecutors(Common::String &nextModule, Common::String &nextPage) {
+ if (_state == Ready || _state == Moving || _state == inDialog1 || _state == Inventory || _state == PDA) {
+ _state = PlayingVideo;
+ _page->getGame()->setNextExecutors(nextModule, nextPage);
+ }
+}
+
+void LeadActor::init(bool unk) {
+ if (_state == unk_Loading){
+ _state = Ready;
+ }
+ _page->getModule()->getInventoryMgr()->setLeadActor(this);
+ Actor::init(unk);
+}
+
+void LeadActor::toConsole() {
+ debug("LeadActor: _name = %s", _name.c_str());
+ for (int i = 0; i < _actions.size(); ++i) {
+ _actions[i]->toConsole();
+ }
+}
+
+} // End of namespace Pink
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
new file mode 100644
index 0000000..762facb
--- /dev/null
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -0,0 +1,63 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_LEAD_ACTOR_H
+#define PINK_LEAD_ACTOR_H
+
+#include "actor.h"
+
+namespace Pink {
+
+class CursorMgr;
+class WalkMgr;
+class Sequencer;
+
+class LeadActor : public Actor {
+public:
+ enum State {
+ Ready = 0,
+ Moving,
+ inDialog1, //???
+ Inventory,
+ PDA,
+ inDialog2,//???
+ PlayingVideo, // ???
+ unk_Loading // ????
+ };
+
+ virtual void deserialize(Archive &archive);
+
+ virtual void toConsole();
+
+ void setNextExecutors (Common::String &nextModule, Common::String &nextPage);
+ virtual void init(bool unk);
+
+private:
+ State _state;
+ CursorMgr *_cursorMgr;
+ WalkMgr *_walkMgr;
+ Sequencer *_sequencer;
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/objects/condition.cpp b/engines/pink/objects/condition.cpp
new file mode 100644
index 0000000..71a68d4
--- /dev/null
+++ b/engines/pink/objects/condition.cpp
@@ -0,0 +1,98 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include <engines/pink/archive.h>
+#include <engines/pink/objects/actors/lead_actor.h>
+#include <engines/pink/objects/pages/game_page.h>
+#include <engines/pink/pink.h>
+#include "condition.h"
+
+namespace Pink {
+
+void Pink::ConditionVariable::deserialize(Archive &archive) {
+ archive >> _name >> _value;
+}
+
+bool Pink::ConditionGameVariable::evaluate(LeadActor *leadActor) {
+ return leadActor->getPage()->getModule()->getGame()->checkValueOfVariable(_name, _value);
+}
+
+void ConditionGameVariable::toConsole() {
+ debug("\t\tConditionGameVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
+}
+
+bool Pink::ConditionModuleVariable::evaluate(LeadActor *leadActor) {
+ return leadActor->getPage()->getModule()->checkValueOfVariable(_name, _value);
+}
+
+void ConditionModuleVariable::toConsole() {
+ debug("\t\tConditionModuleVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
+}
+
+bool Pink::ConditionNotModuleVariable::evaluate(LeadActor *leadActor) {
+ return !ConditionModuleVariable::evaluate(leadActor);
+}
+
+void ConditionNotModuleVariable::toConsole() {
+ debug("\t\tConditionNotModuleVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
+}
+
+bool ConditionPageVariable::evaluate(LeadActor *leadActor) {
+ return leadActor->getPage()->checkValueOfVariable(_name, _value);
+}
+
+void ConditionPageVariable::toConsole() {
+ debug("\t\tConditionPageVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
+}
+
+bool ConditionNotPageVariable::evaluate(LeadActor *leadActor) {
+ return !ConditionPageVariable::evaluate(leadActor);
+}
+
+void ConditionNotPageVariable::toConsole() {
+ debug("\t\tConditionNotPageVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
+}
+
+void ConditionInventoryItemOwner::deserialize(Archive &archive) {
+ archive >> _item >> _owner;
+}
+
+bool ConditionInventoryItemOwner::evaluate(LeadActor *leadActor) {
+ InventoryMgr *mgr = leadActor->getPage()->getModule()->getInventoryMgr();
+ InventoryItem *item = mgr->findInventoryItem(_item);
+ return item->getCurrentOwner() == _owner;
+}
+
+void ConditionInventoryItemOwner::toConsole() {
+ debug("\t\tConditionInventoryItemOwner: _item=%s, _owner=%s", _item.c_str(), _owner.c_str());
+}
+
+bool ConditionNotInventoryItemOwner::evaluate(LeadActor *leadActor) {
+ return !ConditionInventoryItemOwner::evaluate(leadActor);
+}
+
+void ConditionNotInventoryItemOwner::toConsole() {
+ debug("\t\tConditionNotInventoryItemOwner: _item=%s, _owner=%s", _item.c_str(), _owner.c_str());
+}
+
+} // End of namespace Pink
+
diff --git a/engines/pink/objects/condition.h b/engines/pink/objects/condition.h
new file mode 100644
index 0000000..6df1920
--- /dev/null
+++ b/engines/pink/objects/condition.h
@@ -0,0 +1,106 @@
+ /* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_CONDITION_H
+#define PINK_CONDITION_H
+
+#include <engines/pink/objects/object.h>
+
+namespace Pink {
+
+class LeadActor;
+
+class Condition : public Object {
+public:
+ virtual void deserialize(Archive &archive) = 0;
+ virtual bool evaluate(LeadActor *leadActor) = 0;
+};
+
+class ConditionVariable : public Condition {
+public:
+
+ virtual void deserialize(Archive &archive);
+ virtual bool evaluate(LeadActor *leadActor) = 0;
+
+protected:
+ Common::String _name;
+ Common::String _value;
+};
+
+class ConditionGameVariable : public ConditionVariable {
+public:
+ virtual void toConsole();
+ virtual bool evaluate(LeadActor *leadActor);
+};
+
+/*
+ * It is not used in games and has evaluate method with infinity recursion
+class ConditionNotGameVariable : public ConditionGameVariable {
+ virtual bool evaluate(LeadActor *leadActor);
+};
+ */
+
+class ConditionModuleVariable : public ConditionVariable {
+public:
+ virtual void toConsole();
+ virtual bool evaluate(LeadActor *leadActor);
+};
+
+class ConditionNotModuleVariable : public ConditionModuleVariable {
+public:
+ virtual void toConsole();
+ virtual bool evaluate(LeadActor *leadActor);
+};
+
+class ConditionPageVariable : public ConditionVariable {
+public:
+ virtual void toConsole();
+ virtual bool evaluate(LeadActor *leadActor);
+};
+
+class ConditionNotPageVariable : public ConditionPageVariable {
+public:
+ virtual void toConsole();
+ virtual bool evaluate(LeadActor *leadActor);
+};
+
+class ConditionInventoryItemOwner : public Condition {
+public:
+ virtual void toConsole();
+ virtual void deserialize(Archive &archive);
+ virtual bool evaluate(LeadActor *leadActor);
+
+protected:
+ Common::String _item;
+ Common::String _owner;
+};
+
+class ConditionNotInventoryItemOwner : public ConditionInventoryItemOwner {
+public:
+ virtual void toConsole();
+ virtual bool evaluate(LeadActor *leadActor);
+};
+
+} // End of namespace Pink
+
+
+#endif
diff --git a/engines/pink/objects/handlers/handler.cpp b/engines/pink/objects/handlers/handler.cpp
new file mode 100644
index 0000000..6a53832
--- /dev/null
+++ b/engines/pink/objects/handlers/handler.cpp
@@ -0,0 +1,89 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "handler.h"
+#include "engines/pink/archive.h"
+#include "engines/pink/objects/side_effect.h"
+#include <engines/pink/objects/condition.h>
+#include <engines/pink/objects/sequences/sequencer.h>
+#include <engines/pink/objects/sequences/sequence.h>
+#include <engines/pink/objects/actors/lead_actor.h>
+#include <common/debug.h>
+
+namespace Pink {
+
+void Handler::deserialize(Archive &archive) {
+ archive >> _conditions;
+ archive >> _sideEffects;
+}
+
+bool Handler::isSuitable(LeadActor *actor) {
+ for (int i = 0; i < _conditions.size(); ++i) {
+ if (_conditions[i]->evaluate(actor)){
+ return false;
+ }
+ }
+ return true;
+}
+
+void Handler::prepareForNextHandler(LeadActor *actor) {
+ for (int i = 0; i < _sideEffects.size(); ++i) {
+ _sideEffects[i]->execute(actor);
+ }
+}
+
+void HandlerSequences::deserialize(Archive &archive) {
+ Handler::deserialize(archive);
+ archive >> _sequences;
+}
+
+void HandlerSequences::init(LeadActor *actor) {
+ prepareForNextHandler(actor);
+ Sequencer *sequencer = actor->getSequencer();
+ Sequence *sequence = sequencer->findSequence(_sequences[0]); //actually we must pick random sequence
+ sequencer->authorSequence(sequence, 0);
+}
+
+void HandlerStartPage::handle(Sequence *sequence) {
+ sequence->_unk = 1;
+}
+
+void HandlerStartPage::toConsole() {
+ debug("HandlerStartPage:");
+
+ debug("\tSideEffects:");
+ for (int i = 0; i < _sideEffects.size(); ++i) {
+ _sideEffects[i]->toConsole();
+ }
+
+ debug("\tConditions:");
+ for (int i = 0; i < _conditions.size(); ++i) {
+ _conditions[i]->toConsole();
+ }
+
+ debug("\tSequences:");
+ for (int i = 0; i < _sequences.size(); ++i) {
+ debug("\t\t%s", _sequences[i].c_str());
+ }
+}
+
+} // End of namespace Pink
diff --git a/engines/pink/objects/handlers/handler.h b/engines/pink/objects/handlers/handler.h
new file mode 100644
index 0000000..4f8cc28
--- /dev/null
+++ b/engines/pink/objects/handlers/handler.h
@@ -0,0 +1,72 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_HANDLER_H
+#define PINK_HANDLER_H
+
+#include <common/array.h>
+#include <common/str-array.h>
+#include <engines/pink/objects/object.h>
+
+
+namespace Pink {
+
+class Condition;
+class SideEffect;
+class LeadActor;
+
+class Handler : public Object {
+public:
+ virtual void deserialize(Archive &archive);
+ bool isSuitable(LeadActor *actor);
+
+protected:
+ void prepareForNextHandler(LeadActor *actor);
+
+ Common::Array<Condition*> _conditions;
+ Common::Array<SideEffect*> _sideEffects;
+};
+
+class Sequence;
+
+class HandlerSequences : public Handler {
+public:
+ virtual void deserialize(Archive &archive);
+ void init(LeadActor *actor);
+ virtual void handle(Sequence *sequence) = 0;
+
+protected:
+ Common::StringArray _sequences;
+};
+
+class HandlerStartPage : public HandlerSequences {
+public:
+ ~HandlerStartPage() {};
+
+ virtual void toConsole();
+
+ virtual void handle(Sequence *sequence);
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/objects/handlers/handler_mgr.cpp b/engines/pink/objects/handlers/handler_mgr.cpp
new file mode 100644
index 0000000..9c8d43c
--- /dev/null
+++ b/engines/pink/objects/handlers/handler_mgr.cpp
@@ -0,0 +1,5 @@
+//
+// Created by andrei on 3/21/18.
+//
+
+#include "handler_mgr.h"
diff --git a/engines/pink/objects/handlers/handler_mgr.h b/engines/pink/objects/handlers/handler_mgr.h
new file mode 100644
index 0000000..978f8d9
--- /dev/null
+++ b/engines/pink/objects/handlers/handler_mgr.h
@@ -0,0 +1,14 @@
+//
+// Created by andrei on 3/21/18.
+//
+
+#ifndef SCUMMVM_HANDLER_MGR_H
+#define SCUMMVM_HANDLER_MGR_H
+
+
+class HandlerMgr {
+
+};
+
+
+#endif //SCUMMVM_HANDLER_MGR_H
diff --git a/engines/pink/objects/handlers/handler_timer.cpp b/engines/pink/objects/handlers/handler_timer.cpp
new file mode 100644
index 0000000..2c6161b
--- /dev/null
+++ b/engines/pink/objects/handlers/handler_timer.cpp
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "handler_timer.h"
+
+namespace Pink {
+
+
+void HandlerTimerActions::deserialize(Archive &archive) {
+ Handler::deserialize(archive);
+}
+
+void HandlerTimerActions::handle(LeadActor *actor) {
+
+}
+
+void HandlerTimerSequences::deserialize(Archive &archive) {
+ Handler::deserialize(archive);
+}
+
+void HandlerTimerSequences::handle(LeadActor *actor) {
+
+}
+
+} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/handlers/handler_timer.h b/engines/pink/objects/handlers/handler_timer.h
new file mode 100644
index 0000000..21d9518
--- /dev/null
+++ b/engines/pink/objects/handlers/handler_timer.h
@@ -0,0 +1,57 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_HANDLER_TIMER_H
+#define PINK_HANDLER_TIMER_H
+
+#include <common/str-array.h>
+#include "handler.h"
+
+namespace Pink {
+
+class LeadActor;
+
+// This class has difference in games
+class HandlerTimer : public Handler {
+ virtual void handle(LeadActor *actor) = 0;
+};
+
+class HandlerTimerActions : public HandlerTimer {
+ virtual void deserialize(Archive &archive);
+ virtual void handle(LeadActor *actor);
+
+private:
+ Common::StringArray _actions;
+};
+
+class HandlerTimerSequences : public HandlerTimer {
+ virtual void deserialize(Archive &archive);
+ virtual void handle(LeadActor *actor);
+
+private:
+ Common::StringArray _sequences;
+};
+
+} // End of namespace Pink
+
+
+#endif
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
new file mode 100644
index 0000000..feed41a
--- /dev/null
+++ b/engines/pink/objects/inventory.cpp
@@ -0,0 +1,74 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+
+#include <common/debug.h>
+#include "inventory.h"
+#include "engines/pink/archive.h"
+
+namespace Pink {
+
+void Pink::InventoryItem::deserialize(Archive &archive) {
+ NamedObject::deserialize(archive);
+ _initialOwner = archive.readString();
+ _currentOwner = _initialOwner;
+}
+
+Common::String &InventoryItem::getCurrentOwner() {
+ return _currentOwner;
+}
+
+void InventoryItem::toConsole() {
+ debug("\tInventoryItem: _initialOwner=%s _currentOwner=%s", _initialOwner, _currentOwner);
+}
+
+InventoryMgr::~InventoryMgr() {
+ for (uint i = 0; i < _items.size(); ++i) {
+ delete _items[i];
+ }
+}
+
+void InventoryMgr::deserialize(Archive &archive) {
+ archive >> _items;
+}
+
+InventoryItem *InventoryMgr::findInventoryItem(Common::String &name) {
+ return *Common::find_if(_items.begin(), _items.end(), [&name]
+ (InventoryItem *item) {
+ return name == item->getName();
+ });;
+}
+
+void InventoryMgr::setLeadActor(LeadActor *lead) {
+ _lead = lead;
+}
+
+void InventoryMgr::toConsole() {
+ debug("InventoryMgr:");
+ for (int i = 0; i < _items.size(); ++i) {
+ _items[i]->toConsole();
+ }
+}
+
+} // End of namespace Pink
+
+
diff --git a/engines/pink/objects/inventory.h b/engines/pink/objects/inventory.h
new file mode 100644
index 0000000..ca1ef7f
--- /dev/null
+++ b/engines/pink/objects/inventory.h
@@ -0,0 +1,66 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_INVENTORY_H
+#define PINK_INVENTORY_H
+
+
+#include <common/array.h>
+#include "engines/pink/objects/object.h"
+
+namespace Pink {
+
+
+class InventoryItem : public NamedObject {
+public:
+ virtual void deserialize(Archive &archive);
+
+ virtual void toConsole();
+
+ Common::String &getCurrentOwner();
+
+private:
+ Common::String _initialOwner;
+ Common::String _currentOwner;
+};
+
+class LeadActor;
+
+class InventoryMgr : public Object {
+public:
+ virtual ~InventoryMgr();
+ virtual void deserialize(Archive &archive);
+
+ virtual void toConsole();
+
+ void setLeadActor(LeadActor *lead);
+ InventoryItem* findInventoryItem(Common::String &name);
+
+private:
+ LeadActor *_lead;
+ Common::Array<InventoryItem*> _items;
+ // other fields. haven't RE them yet
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/objects/module.cpp b/engines/pink/objects/module.cpp
new file mode 100644
index 0000000..97f78d4
--- /dev/null
+++ b/engines/pink/objects/module.cpp
@@ -0,0 +1,114 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "module.h"
+#include "engines/pink/objects/pages/game_page.h"
+
+namespace Pink {
+
+ModuleProxy::ModuleProxy(const Common::String &name)
+ : NamedObject(name)
+{}
+
+ModuleProxy::ModuleProxy() {}
+
+Module::Module(PinkEngine *game, const Common::String &name)
+ : NamedObject(name), _game(game), _page(nullptr)
+{}
+
+void Module::load(Archive &archive){
+ archive.mapObject(this);
+ NamedObject::deserialize(archive);
+
+ archive.readString(); // skip directory
+
+ _invMgr.deserialize(archive);
+ archive >> _pages;
+}
+
+void Module::init(bool isLoadingSave, const Common::String *pageName) {
+ // debugging original
+ // 0 0 - new game
+ // 0 1 - module changed
+ // 1 0 - from save
+
+ // 1 1 - haven't seen those values
+
+ //this func will be rewrited after testing
+
+ if (_page) {
+ debug("loading from save");
+ }
+ if (pageName){
+ debug("module changed");
+ }
+ assert(_pages.size() != 0);
+
+ if (pageName) {
+ uint i;
+ for (i = 0; i < _pages.size(); ++i) {
+ if(*pageName == _pages[i]->getName()) {
+ _page = _pages[i];
+ }
+ }
+ assert(i < _pages.size());
+ }
+
+ if (_page) {
+ _page->init(isLoadingSave); // module changed or from save
+ return;
+ }
+
+ if (_page != _pages[0]) {
+ if (_page) {
+ assert(0); // in original code there is call to page func but I've never seen it
+ return;
+ }
+ _page = _pages[0];
+ _page->init(isLoadingSave); // new game
+ return;
+ }
+
+ assert(0);
+}
+
+PinkEngine *Module::getGame() const {
+ return _game;
+}
+
+bool Module::checkValueOfVariable(Common::String &variable, Common::String &value) {
+ assert(_variables.contains(variable));
+ return _variables[variable] == value;
+}
+
+void Module::setVariable(Common::String &variable, Common::String &value) {
+ _variables[variable] = value;
+}
+
+InventoryMgr *Module::getInventoryMgr() {
+ return &_invMgr;
+}
+
+} // End of namespace Pink
+
+
+
diff --git a/engines/pink/objects/module.h b/engines/pink/objects/module.h
new file mode 100644
index 0000000..214ff2a
--- /dev/null
+++ b/engines/pink/objects/module.h
@@ -0,0 +1,72 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_MODULE_H
+#define PINK_MODULE_H
+
+#include "engines/pink/archive.h"
+#include "engines/pink/objects/object.h"
+#include <common/debug.h>
+#include <common/hash-str.h>
+#include "engines/pink/objects/inventory.h"
+
+namespace Pink {
+
+class ModuleProxy : public NamedObject {
+public:
+ ModuleProxy();
+ ModuleProxy(const Common::String &name);
+};
+
+class PinkEngine;
+class GamePage;
+
+class Module : public NamedObject {
+public:
+ Module(PinkEngine *game, const Common::String &name);
+
+ void load(Archive &archive);
+ void init(bool isLoadingSave, const Common::String *pageName);
+
+ void OnLeftButtonDown();
+ void OnMouseMove();
+ void OnKeyboardButtonClick();
+
+
+ PinkEngine *getGame() const;
+ InventoryMgr *getInventoryMgr();
+
+ bool checkValueOfVariable(Common::String &variable, Common::String &value);
+ void setVariable(Common::String &variable, Common::String &value);
+
+private:
+ PinkEngine *_game;
+ GamePage *_page;
+ Common::Array<GamePage*> _pages;
+ InventoryMgr _invMgr;
+ Common::StringMap _variables;
+};
+
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/objects/object.cpp b/engines/pink/objects/object.cpp
new file mode 100644
index 0000000..eac48bd
--- /dev/null
+++ b/engines/pink/objects/object.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include <common/debug.h>
+#include "object.h"
+#include "engines/pink/archive.h"
+
+namespace Pink {
+
+Pink::NamedObject::NamedObject(const Common::String &name)
+ : _name(name)
+{}
+
+void Pink::NamedObject::deserialize(Archive &archive) {
+ _name = archive.readString();
+}
+
+const Common::String &Pink::NamedObject::getName() const {
+ return _name;
+}
+
+void NamedObject::store(Archive &archive) {
+
+}
+
+} // End of namespace Pink
+
diff --git a/engines/pink/objects/object.h b/engines/pink/objects/object.h
new file mode 100644
index 0000000..1f67c3d
--- /dev/null
+++ b/engines/pink/objects/object.h
@@ -0,0 +1,58 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_OBJECT_H
+#define PINK_OBJECT_H
+
+#include <common/str.h>
+
+namespace Pink {
+
+class Archive;
+
+class Object {
+public:
+ virtual ~Object() {};
+ virtual void load(Archive &){};
+ virtual void store(Archive &){};
+ virtual void deserialize(Archive &){};
+ virtual void init() {}
+ virtual void toConsole() {};
+};
+
+class NamedObject : public Object {
+public:
+ NamedObject(){};
+ NamedObject(const Common::String &name);
+
+ void deserialize(Archive &archive);
+ void store(Archive &archive);
+
+ const Common::String &getName() const;
+
+protected:
+ Common::String _name;
+};
+
+} // End of namespace Pink
+
+#endif
\ No newline at end of file
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
new file mode 100644
index 0000000..58d8830
--- /dev/null
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -0,0 +1,25 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+namespace Pink {
+
+} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/pages/game_page.h b/engines/pink/objects/pages/game_page.h
new file mode 100644
index 0000000..f92a966
--- /dev/null
+++ b/engines/pink/objects/pages/game_page.h
@@ -0,0 +1,73 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_GAME_PAGE_H
+#define PINK_GAME_PAGE_H
+
+#include "page.h"
+
+namespace Pink {
+
+class CursorMgr;
+class WalkMgr;
+class Sequencer;
+class Handler;
+
+class GamePage : public Page {
+public:
+ virtual void deserialize(Archive &archive);
+
+ virtual void load(Archive &archive);
+
+ void loadManagers();
+
+ void init(bool isLoadingSave);
+
+ PinkEngine *getGame();
+ Sequencer *getSequencer();
+ WalkMgr *getWalkMgr();
+
+ Module *getModule() const;
+ bool checkValueOfVariable(Common::String &variable, Common::String &value);
+ void setVariable(Common::String &variable, Common::String &value);
+
+ virtual void toConsole();
+
+private:
+ int perhapsIsLoaded;
+ Module *_module;
+ CursorMgr *_cursorMgr;
+ WalkMgr *_walkMgr;
+ Sequencer *_sequencer;
+ Common::Array<Handler *> _handlers;
+ Common::StringMap _variables;
+
+ /*
+ int cunk_1;
+ int memfile;
+ int unk;
+ */
+};
+
+}
+
+#endif //SCUMMVM_GAME_PAGE_H
diff --git a/engines/pink/objects/pages/page.cpp b/engines/pink/objects/pages/page.cpp
new file mode 100644
index 0000000..6eb9ff2
--- /dev/null
+++ b/engines/pink/objects/pages/page.cpp
@@ -0,0 +1,151 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include <engines/pink/objects/walk/walk_mgr.h>
+#include <engines/pink/objects/handlers/handler.h>
+#include "game_page.h"
+#include "engines/pink/cursor_mgr.h"
+#include "engines/pink/objects/actors/lead_actor.h"
+#include "engines/pink/objects/sequences/sequencer.h"
+
+namespace Pink {
+
+void Page::load(Archive &archive) {
+ archive.mapObject(this);
+ NamedObject::deserialize(archive);
+ archive.readString(); //skip directory
+ archive >> _actors;
+}
+
+Actor *Page::findActor(Common::String &name) {
+ return *Common::find_if(_actors.begin(), _actors.end(), [&name]
+ (Actor *actor) {
+ return name == actor->getName();
+ });;
+}
+
+Sound *Page::loadSound(Common::String &fileName) {
+ return _resMgr.loadSound(fileName);
+}
+
+void Page::toConsole() {
+ for (int i = 0; i < _actors.size(); ++i) {
+ _actors[i]->toConsole();
+ }
+}
+
+
+void GamePage::deserialize(Archive &archive) {
+ Page::deserialize(archive);
+ _module = static_cast<Module*>(archive.readObject());
+ assert(dynamic_cast<Module*>(_module) != 0);
+}
+
+void GamePage::load(Archive &archive) {
+ archive.mapObject(_cursorMgr);
+ archive.mapObject(_walkMgr);
+ archive.mapObject(_sequencer);
+
+ Page::load(archive);
+
+ _leadActor = static_cast<LeadActor*>(archive.readObject());
+
+ _walkMgr->deserialize(archive);
+
+ _sequencer->deserialize(archive);
+ archive >> _handlers;
+}
+
+void GamePage::init(bool isLoadingSave) {
+
+ if (!isLoadingSave){
+ //assert(perhapsIsLoaded == 0);
+ loadManagers();
+ }
+
+ toConsole();
+
+ for (int i = 0; i < _actors.size(); ++i) {
+ _actors[i]->init(0);
+ }
+
+ if (!isLoadingSave) {
+ for (uint i = 0; i < _handlers.size(); ++i) {
+ if (_handlers[i]->isSuitable(_leadActor)){
+ HandlerSequences *handlerSequences = dynamic_cast<HandlerSequences*>(_handlers[i]);
+ assert(handlerSequences);
+ handlerSequences->init(_leadActor);
+ break;
+ }
+ }
+
+ }
+
+}
+
+void GamePage::loadManagers() {
+ perhapsIsLoaded = true;
+ _cursorMgr = new CursorMgr(this);
+ _walkMgr = new WalkMgr;
+ _sequencer = new Sequencer(this);
+
+ _resMgr.init(_module->getGame(), this);
+
+ // memfile manipulations if from save or page changing
+
+}
+
+PinkEngine *GamePage::getGame() {
+ return _module->getGame();
+}
+
+Sequencer *GamePage::getSequencer() {
+ return _sequencer;
+}
+
+Module *GamePage::getModule() const {
+ return _module;
+}
+
+bool GamePage::checkValueOfVariable(Common::String &variable, Common::String &value) {
+ assert(_variables.contains(variable));
+ return _variables[variable] == value;
+}
+
+void GamePage::setVariable(Common::String &variable, Common::String &value) {
+ _variables[variable] = value;
+}
+
+WalkMgr *GamePage::getWalkMgr() {
+ return _walkMgr;
+}
+
+void GamePage::toConsole() {
+ Page::toConsole();
+ _walkMgr->toConsole();
+ _sequencer->toConsole();
+ for (int i = 0; i < _handlers.size(); ++i) {
+ _handlers[i]->toConsole();
+ }
+}
+
+} // End of namespace Pink
diff --git a/engines/pink/objects/pages/page.h b/engines/pink/objects/pages/page.h
new file mode 100644
index 0000000..63d4551
--- /dev/null
+++ b/engines/pink/objects/pages/page.h
@@ -0,0 +1,58 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_PAGE_H
+#define PINK_PAGE_H
+
+#include "engines/pink/objects/object.h"
+#include "engines/pink/objects/module.h"
+#include "engines/pink/resource_mgr.h"
+
+namespace Pink {
+
+class Archive;
+class Actor;
+class LeadActor;
+
+class Page : public NamedObject {
+public:
+
+ void load(Archive &archive);
+ Actor *findActor(Common::String &name);
+ Sound* loadSound(Common::String &fileName);
+
+ virtual void toConsole();
+
+protected:
+ Common::Array<Actor*> _actors;
+ ResourceMgr _resMgr;
+ LeadActor *_leadActor;
+
+ /*
+ int unk_1;
+ CString _str;
+ */
+};
+
+} // End of namespace Pink
+
+#endif
\ No newline at end of file
diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp
new file mode 100644
index 0000000..0af8f1a
--- /dev/null
+++ b/engines/pink/objects/sequences/sequence.cpp
@@ -0,0 +1,144 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include <common/debug.h>
+#include "sequence_item.h"
+#include "sequence.h"
+#include "sequencer.h"
+#include "engines/pink/archive.h"
+#include "engines/pink/objects/pages/game_page.h"
+#include "engines/pink/objects/actors/actor.h"
+
+namespace Pink {
+
+Sequence::Sequence()
+ : _unk(0), _context(nullptr),
+ _sequencer(nullptr) {}
+
+Sequence::~Sequence() {
+ for (int i = 0; i < _items.size(); ++i) {
+ delete _items[i];
+ }
+}
+
+void Sequence::deserialize(Archive &archive) {
+ NamedObject::deserialize(archive);
+ _sequencer = static_cast<Sequencer*>(archive.readObject());
+ archive >> _items;
+}
+
+void Sequence::toConsole() {
+ debug("\t\tSequence %s", _name.c_str());
+ debug("\t\t\tItems:");
+ for (int i = 0; i < _items.size(); ++i) {
+ _items[i]->toConsole();
+ }
+}
+
+Common::Array<SequenceItem*> &Sequence::getItems() {
+ return _items;
+}
+
+void Sequence::setContext(SequenceContext *context) {
+ _context = context;
+}
+
+void Sequence::init(int unk) {
+ assert(_items.size());
+ assert(dynamic_cast<SequenceItemLeader*>(_items[0])); // first item must always be a leader
+ start(unk);
+}
+
+class Action;
+
+void Sequence::start(int unk) {
+ if (_context->_nextItemIndex > _items.size()){
+ debug("Sequence %s ended", _name);
+ //TODO destroy context
+ return;
+ }
+
+ if (!_items[_context->_nextItemIndex]->execute(_context->_unk, this, unk)){
+ //destroy context;
+ }
+
+ uint i;
+ for (i = _context->_nextItemIndex + 1; i <_items.size(); ++i){
+ if (_items[i]->isLeader())
+ break;
+ _items[i]->execute(_context->_unk, this, unk);
+ }
+ _context->_nextItemIndex = i;
+
+
+ Common::Array<SequenceActorState> &states = _context->_states;
+ for (uint j = 0; j < states.size(); ++j) {
+ if (states[j]._unk != _context->_unk &&
+ !states[j]._actionName.empty()) {
+ Actor *actor;
+ Action *action;
+ actor = _sequencer->_page->findActor(states[j]._actorName);
+ assert(actor);
+ action = actor->findAction(states[j]._actionName);
+ assert(action);
+ if (actor->getAction() != action)
+ actor->setAction(action, unk);
+ }
+ }
+ _context->_unk++;
+}
+
+SequenceContext::SequenceContext(Sequence *sequence, Sequencer *sequencer)
+ : _sequence(sequence), _sequencer(sequencer),
+ _nextItemIndex(0), _unk(1), _actor(nullptr)
+{
+ sequence->setContext(this);
+ Common::Array<SequenceItem*> &items = sequence->getItems();
+ debug("SequenceContext for %s", _sequence->getName().c_str());
+ for (uint i = 0; i < items.size(); ++i) {
+ bool found = 0;
+ for (uint j = 0; j < _states.size(); ++j) {
+ if (items[i]->getActor() == _states[j].getActor()){
+ found = 1;
+ break;
+ }
+ }
+ if (!found) {
+ debug(items[i]->getActor().c_str());
+ _states.push_back({items[i]->getActor()});
+ }
+ }
+}
+
+SequenceContext::~SequenceContext() {
+
+}
+
+SequenceActorState::SequenceActorState(const Common::String &name)
+ :_actorName(name), _unk(0)
+{}
+
+const Common::String &SequenceActorState::getActor() const {
+ return _actorName;
+}
+
+} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/sequences/sequence.h b/engines/pink/objects/sequences/sequence.h
new file mode 100644
index 0000000..f2f324b
--- /dev/null
+++ b/engines/pink/objects/sequences/sequence.h
@@ -0,0 +1,87 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_SEQUENCE_H
+#define PINK_SEQUENCE_H
+
+#include <engines/pink/objects/object.h>
+#include <common/array.h>
+
+namespace Pink {
+
+class Sequencer;
+class SequenceItem;
+class SequenceContext;
+
+class Sequence : public NamedObject {
+public:
+ Sequence();
+ virtual ~Sequence();
+ virtual void deserialize(Archive &archive);
+
+ virtual void toConsole();
+
+ Common::Array<SequenceItem*> &getItems();
+
+ void setContext(SequenceContext *context);
+ void init(int unk);
+ void start(int unk);
+
+public:
+ SequenceContext *_context;
+ Sequencer *_sequencer;
+ Common::Array<SequenceItem*> _items;
+ int _unk;
+
+};
+
+class SequenceActorState {
+public:
+ SequenceActorState(const Common::String &name);
+
+ const Common::String &getActor() const;
+
+public:
+ Common::String _actorName;
+ Common::String _actionName; // ?state
+ int _unk;
+};
+
+class Actor;
+
+class SequenceContext {
+public:
+ SequenceContext(Sequence *sequence, Sequencer* sequencer);
+ ~SequenceContext();
+
+public:
+ Sequence *_sequence;
+ Sequencer *_sequencer;
+ int _nextItemIndex;
+ Actor *_actor;
+ Common::Array<SequenceActorState> _states;
+ int _unk;
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/objects/sequences/sequence_item.cpp b/engines/pink/objects/sequences/sequence_item.cpp
new file mode 100644
index 0000000..732424a
--- /dev/null
+++ b/engines/pink/objects/sequences/sequence_item.cpp
@@ -0,0 +1,109 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "sequence_item.h"
+#include <common/debug.h>
+#include <engines/pink/objects/sequences/sequence.h>
+#include <engines/pink/objects/sequences/sequencer.h>
+#include <engines/pink/objects/actions/action.h>
+#include "engines/pink/archive.h"
+#include "engines/pink/objects/pages/game_page.h"
+#include "engines/pink/objects/actors/actor.h"
+
+namespace Pink {
+
+void SequenceItem::deserialize(Archive &archive) {
+ archive >> _actor >> _action;
+}
+
+void SequenceItem::toConsole() {
+ debug("\t\t\t\tSequenceItem: _actor=%s, _action=%s", _actor.c_str(), _action.c_str());
+}
+
+const Common::String &SequenceItem::getActor() const {
+ return _actor;
+}
+
+const Common::String &SequenceItem::getAction() const {
+ return _action;
+}
+
+bool SequenceItem::execute(int unk, Sequence *sequence, bool unk2) {
+ Actor *actor;
+ Action *action;
+ if (!(actor = sequence->_sequencer->_page->findActor(_actor)) ||
+ !(action = actor->findAction(_action))) {
+ assert(0);
+ return false;
+ }
+
+ actor->setAction(action, unk2);
+ Common::Array<SequenceActorState> &states = sequence->_context->_states;
+ for (int i = 0; i < sequence->_context->_states.size(); ++i) {
+ if (states[i]._actorName == _actor){
+ states[i]._unk = unk;
+ sequence->_context->_actor = isLeader() ? actor : sequence->_context->_actor;
+ break;
+ }
+ }
+
+ return true;
+}
+
+bool SequenceItem::isLeader() {
+ return false;
+}
+
+bool SequenceItemLeader::isLeader() {
+ return true;
+}
+
+void SequenceItemLeader::toConsole() {
+ debug("\t\t\t\tSequenceItemLeader: _actor=%s, _action=%s", _actor.c_str(), _action.c_str());
+}
+
+
+void SequenceItemLeaderAudio::deserialize(Archive &archive) {
+ SequenceItem::deserialize(archive);
+ archive.readDWORD();
+}
+
+void SequenceItemLeaderAudio::toConsole() {
+ debug("\t\t\t\tSequenceItemLeaderAudio: _actor=%s, _action=%s", _actor.c_str(), _action.c_str());
+}
+
+bool SequenceItemDefaultAction::execute(int unk, Sequence *sequence, bool unk2) {
+ Common::Array<SequenceActorState> &actorStates = sequence->_context->_states;
+ for (int i = 0; i < actorStates.size(); ++i) {
+ if (actorStates[i]._actorName == _actor){
+ actorStates[i]._actionName = _action;
+ break;
+ }
+ }
+ return true;
+}
+
+void SequenceItemDefaultAction::toConsole() {
+ debug("\t\t\t\tSequenceItemDefaultAction: _actor=%s, _action=%s", _actor.c_str(), _action.c_str());
+}
+
+} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/sequences/sequence_item.h b/engines/pink/objects/sequences/sequence_item.h
new file mode 100644
index 0000000..70fc68d
--- /dev/null
+++ b/engines/pink/objects/sequences/sequence_item.h
@@ -0,0 +1,85 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_SEQUENCE_ITEM_H
+#define PINK_SEQUENCE_ITEM_H
+
+#include <engines/pink/objects/object.h>
+
+namespace Pink {
+
+class Sequence;
+
+class SequenceItem : public Object {
+public:
+ virtual void deserialize(Archive &archive);
+
+ virtual void toConsole();
+
+ const Common::String &getActor() const;
+ const Common::String &getAction() const;
+
+ virtual bool execute(int unk, Sequence *sequence, bool unk2);
+ virtual bool isLeader();
+
+protected:
+ Common::String _actor;
+ Common::String _action;
+};
+
+class SequenceItemLeader : public SequenceItem {
+public:
+ virtual void toConsole();
+
+ virtual bool isLeader();
+};
+
+class SequenceItemLeaderAudio : public SequenceItemLeader {
+ virtual void deserialize(Archive &archive);
+
+public:
+ virtual void toConsole();
+
+private:
+ //uint32 _sample; // zero in data files and not used;
+};
+
+class SequenceItemDefaultAction : public SequenceItem {
+public:
+ virtual bool execute(int unk, Sequence *sequence, bool unk2);
+
+ virtual void toConsole();
+};
+
+/* not used in games but is implemented in engine
+class SequenceItemSideEffects : public SequenceItemDefaultAction {
+public:
+ virtual void deserialize(Archive &archive);
+ virtual bool execute(int unk, Sequence *sequence, bool unk2);
+private
+ Common::Array<SideEffect*> _sideEffects
+};
+ */
+
+}
+
+#endif
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
new file mode 100644
index 0000000..2bddcbd
--- /dev/null
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -0,0 +1,76 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+
+#include <common/debug.h>
+#include "sequencer.h"
+#include "sequence.h"
+#include "engines/pink/archive.h"
+
+namespace Pink {
+
+Sequencer::Sequencer(GamePage *page)
+ : _context(nullptr), _page(page)
+{}
+
+Sequencer::~Sequencer() {
+ for (int i = 0; i < _sequences.size(); ++i) {
+ delete _sequences[i];
+ }
+}
+
+void Sequencer::deserialize(Archive &archive) {
+ archive >> _sequences;
+ archive.readCount();// intro have 0 timers;
+ //serialize timers;
+
+}
+
+Sequence *Sequencer::findSequence(const Common::String &name) {
+ return *Common::find_if(_sequences.begin(), _sequences.end(), [&name]
+ (Sequence* sequence) {
+ return name == sequence->getName();
+ });
+}
+
+void Sequencer::authorSequence(Sequence *sequence, bool unk) {
+ if (_context){
+
+ }
+
+ if (sequence){
+ _context = new SequenceContext(sequence, this);
+ //unload array of unknown objects
+ _currentSequenceName = sequence->getName();
+ sequence->start(unk);
+ }
+ else _currentSequenceName.clear();
+}
+
+void Sequencer::toConsole() {
+ debug("Sequencer:");
+ for (int i = 0; i < _sequences.size(); ++i) {
+ _sequences[i]->toConsole();
+ }
+}
+
+} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/sequences/sequencer.h b/engines/pink/objects/sequences/sequencer.h
new file mode 100644
index 0000000..d292346
--- /dev/null
+++ b/engines/pink/objects/sequences/sequencer.h
@@ -0,0 +1,59 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+
+#ifndef PINK_SEQUENCER_H
+#define PINK_SEQUENCER_H
+
+#include <common/array.h>
+#include "engines/pink/objects/object.h"
+
+namespace Pink {
+
+class Sequence;
+class SequenceContext;
+class GamePage;
+
+class Sequencer : public Object {
+public:
+ Sequencer(GamePage *page);
+ ~Sequencer();
+
+ virtual void toConsole();
+
+ virtual void deserialize(Archive &archive);
+ Sequence* findSequence(const Common::String &name);
+ void authorSequence(Sequence *sequence, bool unk);
+
+public:
+ SequenceContext *_context;
+ // unknown objects array
+ Common::Array<Sequence*> _sequences;
+ Common::String _currentSequenceName;
+ //timers
+ GamePage *_page;
+ int unk;
+};
+
+} // End of namespace Pink
+
+#endif
\ No newline at end of file
diff --git a/engines/pink/objects/side_effect.cpp b/engines/pink/objects/side_effect.cpp
new file mode 100644
index 0000000..4b290fa
--- /dev/null
+++ b/engines/pink/objects/side_effect.cpp
@@ -0,0 +1,126 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include <common/hash-str.h>
+#include "side_effect.h"
+#include <engines/pink/archive.h>
+#include <engines/pink/objects/actors/lead_actor.h>
+#include <engines/pink/objects/pages/game_page.h>
+#include <engines/pink/pink.h>
+#include <engines/pink/objects/walk/walk_location.h>
+#include <engines/pink/objects/walk/walk_mgr.h>
+
+namespace Pink {
+
+void SideEffectExit::deserialize(Archive &archive) {
+ archive >> _nextModule >> _nextPage;
+}
+
+void SideEffectExit::execute(LeadActor *actor) {
+ actor->setNextExecutors(_nextModule, _nextPage);
+}
+
+void SideEffectExit::toConsole() {
+ debug("\t\tSideEffectExit: _nextModule=%s, _nextPage=%s", _nextModule.c_str(), _nextPage.c_str());
+}
+
+
+void SideEffectLocation::deserialize(Archive &archive) {
+ archive >> _location;
+}
+
+void SideEffectLocation::execute(LeadActor *actor) {
+ WalkMgr *mgr = actor->getPage()->getWalkMgr();
+ WalkLocation *location = mgr->findLocation(_location);
+ //TODO end this method
+}
+
+void SideEffectLocation::toConsole() {
+ debug("\t\tSideEffectLocation: _location=%s", _location.c_str());
+}
+
+
+void SideEffectInventoryItemOwner::deserialize(Archive &archive) {
+ archive >> _item >> _owner;
+}
+
+void SideEffectInventoryItemOwner::execute(LeadActor *actor) {
+ //TODO
+}
+
+void SideEffectInventoryItemOwner::toConsole() {
+ debug("\t\tSideEffectInventoryItemOwner: _item=%s, _owner=%s", _item.c_str(), _owner.c_str());
+}
+
+
+void SideEffectVariable::deserialize(Pink::Archive &archive) {
+ archive >> _name >> _value;
+}
+
+
+void SideEffectGameVariable::execute(LeadActor *actor) {
+ actor->getPage()->getGame()->setVariable(_name, _value);
+}
+
+void SideEffectGameVariable::toConsole() {
+ debug("\t\tSideEffectGameVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
+}
+
+
+void SideEffectModuleVariable::execute(LeadActor *actor) {
+ actor->getPage()->setVariable(_name, _value);
+}
+
+void SideEffectModuleVariable::toConsole() {
+ debug("\t\tSideEffectModuleVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
+}
+
+
+void SideEffectPageVariable::execute(LeadActor *actor) {
+ actor->getPage()->setVariable(_name, _value);
+}
+
+void SideEffectPageVariable::toConsole() {
+ debug("\t\tSideEffectPageVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
+}
+
+
+void SideEffectRandomPageVariable::deserialize(Archive &archive) {
+ archive >> _name >> _values;
+}
+
+void SideEffectRandomPageVariable::execute(LeadActor *actor) {
+ // TODO think how to get rand gen here
+ actor->getPage()->setVariable(_name, _values[0]); // temporary solution
+}
+
+void SideEffectRandomPageVariable::toConsole() {
+ Common::String values("{");
+ for (int i = 0; i < _values.size(); ++i) {
+ values += _values[i];
+ values += ',';
+ }
+ values += '}';
+ debug("\t\tSideEffectRandomPageVariable: _name=%s, _values=%s", _name.c_str(), values.c_str());
+}
+
+} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/side_effect.h b/engines/pink/objects/side_effect.h
new file mode 100644
index 0000000..810dd46
--- /dev/null
+++ b/engines/pink/objects/side_effect.h
@@ -0,0 +1,121 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_SIDE_EFFECT_H
+#define PINK_SIDE_EFFECT_H
+
+#include <engines/pink/objects/object.h>
+#include <common/str-array.h>
+
+namespace Pink {
+
+class LeadActor;
+
+class SideEffect : public Object {
+public:
+ virtual void deserialize(Archive &archive) = 0;
+ virtual void execute(LeadActor *actor) = 0;
+};
+
+class SideEffectExit : public SideEffect {
+public:
+ virtual void deserialize(Archive &archive);
+
+ virtual void toConsole();
+
+ virtual void execute(LeadActor *actor);
+
+private:
+ Common::String _nextModule;
+ Common::String _nextPage;
+};
+
+class SideEffectLocation : public SideEffect {
+ virtual void deserialize(Archive &archive);
+ virtual void execute(LeadActor *actor);
+
+public:
+ virtual void toConsole();
+
+private:
+ Common::String _location;
+};
+
+class SideEffectInventoryItemOwner : public SideEffect {
+ virtual void deserialize(Archive &archive);
+ virtual void execute(LeadActor *actor);
+
+public:
+ virtual void toConsole();
+
+private:
+ Common::String _item;
+ Common::String _owner;
+};
+
+class SideEffectVariable : public SideEffect {
+public:
+ virtual void deserialize(Archive &archive);
+ virtual void execute(LeadActor *actor) = 0;
+
+protected:
+ Common::String _name;
+ Common::String _value;
+};
+
+class SideEffectGameVariable : public SideEffectVariable {
+public:
+ virtual void toConsole();
+ virtual void execute(LeadActor *actor);
+};
+
+class SideEffectModuleVariable : public SideEffectVariable {
+public:
+ virtual void toConsole();
+ virtual void execute(LeadActor *actor);
+};
+
+class SideEffectPageVariable : public SideEffectVariable {
+public:
+ virtual void toConsole();
+
+ virtual void execute(LeadActor *actor);
+};
+
+class SideEffectRandomPageVariable : public SideEffect
+{
+ virtual void deserialize(Archive &archive);
+
+public:
+ virtual void toConsole();
+
+private:
+ virtual void execute(LeadActor *actor);
+
+private:
+ Common::String _name;
+ Common::StringArray _values;
+};
+
+}
+
+#endif
diff --git a/engines/pink/objects/walk/walk_location.cpp b/engines/pink/objects/walk/walk_location.cpp
new file mode 100644
index 0000000..e5f5ea7
--- /dev/null
+++ b/engines/pink/objects/walk/walk_location.cpp
@@ -0,0 +1,29 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "walk_location.h"
+#include "engines/pink/archive.h"
+
+void Pink::WalkLocation::deserialize(Pink::Archive &archive) {
+ NamedObject::deserialize(archive);
+ archive >> _neighbors;
+}
diff --git a/engines/pink/objects/walk/walk_location.h b/engines/pink/objects/walk/walk_location.h
new file mode 100644
index 0000000..82e6436
--- /dev/null
+++ b/engines/pink/objects/walk/walk_location.h
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+#ifndef PINK_WALK_LOCATION_H
+#define PINK_WALK_LOCATION_H
+
+#include <engines/pink/objects/object.h>
+#include <common/array.h>
+#include <common/str-array.h>
+
+
+namespace Pink {
+
+class WalkLocation : public NamedObject {
+public:
+ virtual void deserialize(Archive &archive);
+
+private:
+ Common::StringArray _neighbors;
+};
+
+} // End of namespace Pink
+
+#endif
\ No newline at end of file
diff --git a/engines/pink/objects/walk/walk_mgr.cpp b/engines/pink/objects/walk/walk_mgr.cpp
new file mode 100644
index 0000000..1b5ceef
--- /dev/null
+++ b/engines/pink/objects/walk/walk_mgr.cpp
@@ -0,0 +1,20 @@
+//
+// Created by andrei on 3/17/18.
+//
+
+#include "walk_mgr.h"
+#include "walk_location.h"
+#include "engines/pink/objects/actors/lead_actor.h"
+#include "engines/pink/archive.h"
+
+
+void Pink::WalkMgr::deserialize(Pink::Archive &archive) {
+ _leadActor = static_cast<LeadActor*>(archive.readObject());
+ archive >> _locations;
+}
+
+Pink::WalkLocation *Pink::WalkMgr::findLocation(Common::String &name) {
+ return *Common::find_if(_locations.begin(), _locations.end(), [&name] (WalkLocation *location) {
+ return location->getName() == name;
+ });
+}
diff --git a/engines/pink/objects/walk/walk_mgr.h b/engines/pink/objects/walk/walk_mgr.h
new file mode 100644
index 0000000..0ae7ef6
--- /dev/null
+++ b/engines/pink/objects/walk/walk_mgr.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_WALK_MGR_H
+#define PINK_WALK_MGR_H
+
+#include <common/array.h>
+#include "engines/pink/objects/object.h"
+
+namespace Pink {
+
+class WalkLocation;
+class LeadActor;
+
+class WalkMgr : public Object {
+public:
+ virtual void deserialize(Archive &archive);
+ WalkLocation *findLocation(Common::String &name);
+
+private:
+ LeadActor *_leadActor;
+ Common::Array<WalkLocation*> _locations;
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/page.cpp b/engines/pink/page.cpp
deleted file mode 100644
index 3d644db..0000000
--- a/engines/pink/page.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include <engines/pink/walk/walk_mgr.h>
-#include <engines/pink/handlers/handler.h>
-#include <engines/pink/handlers/handler_sequences.h>
-#include "page.h"
-#include "cursor_mgr.h"
-#include "actors/lead_actor.h"
-#include "engines/pink/sequences/sequencer.h"
-
-namespace Pink {
-
-void Page::load(Archive &archive) {
- archive.mapObject(this);
- NamedObject::deserialize(archive);
- archive.readString(); //skip directory
- archive >> _actors;
-}
-
-Actor *Page::findActor(Common::String &name) {
- return *Common::find_if(_actors.begin(), _actors.end(), [&name]
- (Actor *actor) {
- return name == actor->getName();
- });;
-}
-
-
-void GamePage::deserialize(Archive &archive) {
- Page::deserialize(archive);
- _module = static_cast<Module*>(archive.readObject());
- assert(dynamic_cast<Module*>(_module) != 0);
-}
-
-void GamePage::load(Archive &archive) {
- archive.mapObject(_cursorMgr);
- archive.mapObject(_walkMgr);
- archive.mapObject(_sequencer);
-
- Page::load(archive);
-
- _leadActor = static_cast<LeadActor*>(archive.readObject());
-
- _walkMgr->deserialize(archive);
-
- _sequencer->deserialize(archive);
- archive >> _handlers;
-}
-
-void GamePage::init(bool isLoadingSave) {
- if (!isLoadingSave){
- //assert(perhapsIsLoaded == 0);
- loadManagers();
- }
-
- for (int i = 0; i < _actors.size(); ++i) {
- _actors[i]->init(0);
- }
-
- if (!isLoadingSave) {
- for (uint i = 0; i < _handlers.size(); ++i) {
- if (_handlers[i]->initConditions(_leadActor)){
- HandlerSequences *handlerSequences = dynamic_cast<HandlerSequences*>(_handlers[i]);
- assert(handlerSequences);
- handlerSequences->initSequence(_leadActor);
- break;
- }
- }
-
- }
-
-}
-
-void GamePage::loadManagers() {
- perhapsIsLoaded = true;
- _cursorMgr = new CursorMgr(this);
- _walkMgr = new WalkMgr;
- _sequencer = new Sequencer(this);
-
- _resMgr.init(_module->getGame(), this);
-
- // memfile manipulations if from save or page changing
-
-}
-
-PinkEngine *GamePage::getGame() {
- return _module->getGame();
-}
-
-Sequencer *GamePage::getSequencer() {
- return _sequencer;
-}
-
-Module *GamePage::getModule() const {
- return _module;
-}
-
-
-} // End of namespace Pink
diff --git a/engines/pink/page.h b/engines/pink/page.h
deleted file mode 100644
index a2458c1..0000000
--- a/engines/pink/page.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PINK_PAGE_H
-#define PINK_PAGE_H
-
-#include "engines/pink/object.h"
-#include "engines/pink/module.h"
-#include "resource_mgr.h"
-
-namespace Pink {
-
-class Archive;
-class Actor;
-class LeadActor;
-
-
-class Page : public NamedObject {
-public:
-
- void load(Archive &archive);
- Actor *findActor(Common::String &name);
-
-protected:
- ResourceMgr _resMgr;
- LeadActor *_leadActor;
- Common::Array<Actor*> _actors;
-
- /*
- int unk_1;
- CString _str;
- */
-};
-
-
-class CursorMgr;
-class WalkMgr;
-class Sequencer;
-class Handler;
-
-class GamePage : public Page {
-public:
- virtual void deserialize(Archive &archive);
- virtual void load(Archive &archive);
- void loadManagers();
-
- void init(bool isLoadingSave);
-
- PinkEngine *getGame();
- Sequencer *getSequencer();
- Module *getModule() const;
-
-
-private:
- int perhapsIsLoaded;
- Module *_module;
- CursorMgr *_cursorMgr;
- WalkMgr *_walkMgr;
- Sequencer *_sequencer;
- Common::Array<Handler*> _handlers;
-
- /*
- int perhaps_notLoaded;
- int cunk_1;
- int memfile;
- CMapStringToString map;
- int unk;
- */
-};
-
-} // End of namespace Pink
-
-#endif
\ No newline at end of file
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index 950ef23..b5edbb1 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -24,7 +24,9 @@
#include "console.h"
#include <engines/util.h>
#include <common/debug-channels.h>
-#include "module.h"
+#include <video/flic_decoder.h>
+#include "engines/pink/objects/module.h"
+#include <graphics/surface.h>
namespace Pink {
@@ -85,6 +87,13 @@ Common::Error Pink::PinkEngine::run() {
return error;
}
+ Video::FlicDecoder flicDecoder;
+ Common::File anim;
+ anim.open("WANDRBOY.CEL");
+ flicDecoder.loadStream(&anim);
+ flicDecoder.start();
+ _system->updateScreen();
+ const Graphics::Surface *surface = flicDecoder.decodeNextFrame();
while(!shouldQuit()){
Common::Event event;
while(_eventMan->pollEvent(event)){
@@ -110,17 +119,20 @@ Common::Error Pink::PinkEngine::run() {
}
}
//update();
-
- g_system->updateScreen();
- g_system->delayMillis(10);
+ surface = flicDecoder.needsUpdate() ? flicDecoder.decodeNextFrame() : surface;
+ if (surface) {
+ _system->copyRectToScreen(surface->getPixels(), surface->pitch, 0, 0, surface->w, surface->h);
+ _system->updateScreen();
+ }
+ _system->delayMillis(10);
}
return Common::kNoError;
}
void PinkEngine::load(Archive &archive) {
- debug(archive.readString().c_str());
- debug(archive.readString().c_str());
+ archive.readString();
+ archive.readString();
archive >> _modules;
}
@@ -151,7 +163,7 @@ void PinkEngine::initModule() {
for (i = 0; i < _modules.size(); ++i) {
assert(dynamic_cast<Module*>(_modules[i]) == 0);
if (_modules[i]->getName() == _nextModule) {
- changeProxyToModule(i);
+ loadModule(i);
break;
}
}
@@ -167,7 +179,7 @@ void PinkEngine::setNextExecutors(const Common::String &nextModule, const Common
_nextPage = nextPage;
}
-void PinkEngine::changeProxyToModule(int index) {
+void PinkEngine::loadModule(int index) {
assert(dynamic_cast<Module*>(_modules[index]) == 0);
Module *module = new Module(this, _modules[index]->getName());
@@ -178,4 +190,13 @@ void PinkEngine::changeProxyToModule(int index) {
_modules[index] = module;
}
+bool PinkEngine::checkValueOfVariable(Common::String &variable, Common::String &value) {
+ assert(_variables.contains(variable));
+ return _variables[variable] == value;
+}
+
+void PinkEngine::setVariable(Common::String &variable, Common::String &value) {
+ _variables[variable] = value;
+}
+
}
\ No newline at end of file
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index 834f787..114b475 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -28,7 +28,6 @@
#include "gui/EventRecorder.h"
#include "gui/debugger.h"
#include "file.h"
-#include "utils.h"
/*
@@ -47,6 +46,7 @@ namespace Pink {
class Console;
class Archive;
+class NamedObject;
class Module;
enum {
@@ -62,7 +62,6 @@ enum {
LoadingNotSave = 0
};
-
class PinkEngine : public Engine {
public:
PinkEngine(OSystem *system, const ADGameDescription *desc);
@@ -77,9 +76,12 @@ public:
OrbFile *getOrb() { return &_orb; }
BroFile *getBro() { return _bro; }
+ bool checkValueOfVariable(Common::String &variable, Common::String &value);
+ void setVariable(Common::String &variable, Common::String &value);
+
private:
Common::Error init();
- void changeProxyToModule(int index);
+ void loadModule(int index);
Console *_console;
Common::RandomSource _rnd;
@@ -91,7 +93,9 @@ private:
BroFile *_bro;
Module *_module;
- ModulesArray _modules;
+ Common::Array<NamedObject*> _modules;
+
+ Common::StringMap _variables;
const ADGameDescription _desc;
};
diff --git a/engines/pink/resource_mgr.cpp b/engines/pink/resource_mgr.cpp
index 378dded..1584502 100644
--- a/engines/pink/resource_mgr.cpp
+++ b/engines/pink/resource_mgr.cpp
@@ -21,31 +21,56 @@
*/
#include <video/flic_decoder.h>
+#include <common/substream.h>
+#include <graphics/surface.h>
#include "resource_mgr.h"
#include "file.h"
#include "pink.h"
-#include "page.h"
+#include "sound.h"
+#include "engines/pink/objects/pages/game_page.h"
namespace Pink {
ResourceMgr::ResourceMgr()
- : _game(nullptr), _orb(nullptr), _bro(nullptr),
- _resDescTable(nullptr), _resCount(0)
-{}
+ : _game(nullptr), _resDescTable(nullptr),
+ _resCount(0) {}
ResourceMgr::~ResourceMgr() {
delete[] _resDescTable;
}
void ResourceMgr::init(PinkEngine *game, GamePage *page) {
- _orb = game->getOrb();
- _bro = game->getBro();
+ OrbFile *orb = game->getOrb();
_game = game;
- ObjectDescription *objDesc = _orb->getObjDesc(page->getName().c_str());
+ ObjectDescription *objDesc = orb->getObjDesc(page->getName().c_str());
_resCount = objDesc->resourcesCount;
- _orb->loadObject(page, objDesc);
- _resDescTable = _orb->getResDescTable(objDesc);
+ orb->loadObject(page, objDesc);
+ _resDescTable = orb->getResDescTable(objDesc);
+}
+
+Sound *ResourceMgr::loadSound(Common::String &name) {
+ return new Sound(_game->_mixer, getResourceStream(name));
+}
+
+Common::SeekableReadStream *ResourceMgr::getResourceStream(Common::String &name) {
+ Common::SeekableReadStream *stream;
+ uint i;
+ for (i = 0; i < _resCount; ++i) {
+ if (name.compareToIgnoreCase(_resDescTable[i].name) == 0){
+ break;
+ }
+ }
+ assert(i < _resDescTable[i].size);
+
+ if (_resDescTable[i].inBro)
+ stream = _game->getBro();
+ else stream = _game->getOrb();
+
+ stream->seek(_resDescTable[i].offset);
+
+ return new Common::SeekableSubReadStream(stream, _resDescTable[i].offset,
+ _resDescTable[i].offset + _resDescTable[i].size);
}
} // End of namespace Pink
diff --git a/engines/pink/resource_mgr.h b/engines/pink/resource_mgr.h
index 47c381a..8de06b2 100644
--- a/engines/pink/resource_mgr.h
+++ b/engines/pink/resource_mgr.h
@@ -21,6 +21,7 @@
*/
#include <common/scummsys.h>
+#include <common/stream.h>
#ifndef PINK_RESOURCE_MGR_H
#define PINK_RESOURCE_MGR_H
@@ -48,13 +49,13 @@ public:
//move methods to page
//compiler must do RVO
//Common::String loadText(Common::String &name);
- Sound loadSound(Common::String &name);
+ Sound *loadSound(Common::String &name);
// loadCEL();
private:
+ Common::SeekableReadStream *getResourceStream(Common::String &name);
+
PinkEngine *_game;
- OrbFile *_orb;
- BroFile *_bro;
ResourceDescription *_resDescTable;
uint32 _resCount;
};
diff --git a/engines/pink/sequences/sequence.cpp b/engines/pink/sequences/sequence.cpp
deleted file mode 100644
index 034078f..0000000
--- a/engines/pink/sequences/sequence.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include <common/debug.h>
-#include <engines/pink/items/sequence_item_leader.h>
-#include "sequence.h"
-#include "sequencer.h"
-#include "../archive.h"
-#include "../page.h"
-#include "../actors/actor.h"
-
-namespace Pink {
-
-void Sequence::deserialize(Archive &archive) {
- NamedObject::deserialize(archive);
- debug("\tSequence %s", _name.c_str());
- _sequencer = static_cast<Sequencer*>(archive.readObject());
- archive >> _items;
-}
-
-Common::Array<SequenceItem*> &Sequence::getItems() {
- return _items;
-}
-
-void Sequence::setContext(SequenceContext *context) {
- _context = context;
-}
-
-void Sequence::init(int unk) {
- assert(_items.size());
- assert(dynamic_cast<SequenceItemLeader*>(_items[0])); // first item must always be a leader
- start(unk);
-}
-
-class Action;
-
-void Sequence::start(int unk) {
- if (_context->_nextItemIndex > _items.size()){
- debug("Sequence %s ended", _name);
- //TODO destroy context
- return;
- }
-
- if (!_items[_context->_nextItemIndex]->execute(_context->_unk, this, unk)){
- //destroy context;
- }
-
- uint i;
- for (i = _context->_nextItemIndex + 1; i <_items.size(); ++i){
- if (dynamic_cast<SequenceItemLeader*>(_items[i]))
- break;
- _items[i]->execute(_context->_unk, this, unk);
- }
- _context->_nextItemIndex = i;
-
-
- Common::Array<SequenceActorState> &states = _context->_states;
- for (uint j = 0; j < states.size(); ++j) {
- if (states[j]._unk != _context->_unk &&
- !states[j]._actionName.empty()) {
- Actor *actor;
- Action *action;
- actor = _sequencer->_page->findActor(states[j]._actorName);
- assert(actor);
- action = actor->findAction(states[j]._actionName);
- assert(action);
- actor->setAction(action, unk);
- }
- }
- _context->_unk++;
-}
-
-SequenceContext::SequenceContext(Sequence *sequence, Sequencer *sequencer)
- : _sequence(sequence), _sequencer(sequencer),
- _nextItemIndex(0), _unk(1), _actor(nullptr)
-{
- sequence->setContext(this);
- Common::Array<SequenceItem*> &items = sequence->getItems();
- debug("SequenceContext for %s", _sequence->getName().c_str());
- for (uint i = 0; i < items.size(); ++i) {
- bool found = 0;
- for (uint j = 0; j < _states.size(); ++j) {
- if (items[i]->getActor() == _states[j].getActor()){
- found = 1;
- break;
- }
- }
- if (!found) {
- debug(items[i]->getActor().c_str());
- _states.push_back({items[i]->getActor()});
- }
- }
-}
-
-SequenceContext::~SequenceContext() {
-
-}
-
-SequenceActorState::SequenceActorState(const Common::String &name)
- :_actorName(name), _unk(0)
-{}
-
-const Common::String &SequenceActorState::getActor() const {
- return _actorName;
-}
-
-} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/sequences/sequence.h b/engines/pink/sequences/sequence.h
deleted file mode 100644
index 02f3904..0000000
--- a/engines/pink/sequences/sequence.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PINK_SEQUENCE_H
-#define PINK_SEQUENCE_H
-
-#include <engines/pink/object.h>
-#include <common/array.h>
-
-namespace Pink {
-
-class Sequencer;
-class SequenceItem;
-class SequenceContext;
-
-class Sequence : public NamedObject {
-public:
- virtual void deserialize(Archive &archive);
-
- Common::Array<SequenceItem*> &getItems();
-
- void setContext(SequenceContext *context);
- void init(int unk);
- void start(int unk);
-
-public:
- SequenceContext *_context;
- Sequencer *_sequencer;
- Common::Array<SequenceItem*> _items;
- int _unk;
-
-};
-
-class SequenceActorState {
-public:
- SequenceActorState(const Common::String &name);
-
- const Common::String &getActor() const;
-
-public:
- Common::String _actorName;
- Common::String _actionName; // ?state
- int _unk;
-};
-
-class Actor;
-
-class SequenceContext {
-public:
- SequenceContext(Sequence *sequence, Sequencer* sequencer);
- ~SequenceContext();
-
-public:
- Sequence *_sequence;
- Sequencer *_sequencer;
- int _nextItemIndex;
- Actor *_actor;
- Common::Array<SequenceActorState> _states;
- int _unk;
-};
-
-} // End of namespace Pink
-
-#endif
diff --git a/engines/pink/sequences/sequencer.cpp b/engines/pink/sequences/sequencer.cpp
deleted file mode 100644
index 68b72c1..0000000
--- a/engines/pink/sequences/sequencer.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-
-#include <common/debug.h>
-#include "sequencer.h"
-#include "sequence.h"
-#include "engines/pink/archive.h"
-
-namespace Pink {
-
-Sequencer::Sequencer(GamePage *page)
- : _context(nullptr), _page(page)
-{}
-
-void Sequencer::deserialize(Archive &archive) {
- debug("Sequencer:");
- archive >> _sequences;
- archive.readCount();// intro have 0 timers;
- //serialize timers;
-
-}
-
-Sequence *Sequencer::findSequence(const Common::String &name) {
- return *Common::find_if(_sequences.begin(), _sequences.end(), [&name]
- (Sequence* sequence) {
- return name == sequence->getName();
- });
-}
-
-void Sequencer::authorSequence(Sequence *sequence, bool unk) {
- if (_context){
-
- }
-
- if (sequence){
- _context = new SequenceContext(sequence, this);
- //unload array of unknown objects
- _currentSequenceName = sequence->getName();
-
- }
- else _currentSequenceName.clear();
-}
-
-} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/sequences/sequencer.h b/engines/pink/sequences/sequencer.h
deleted file mode 100644
index 0243a4e..0000000
--- a/engines/pink/sequences/sequencer.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-
-#ifndef PINK_SEQUENCER_H
-#define PINK_SEQUENCER_H
-
-#include <common/array.h>
-#include "engines/pink/object.h"
-
-namespace Pink {
-
-class Sequence;
-class SequenceContext;
-class GamePage;
-
-class Sequencer : public Object {
-public:
- Sequencer(GamePage *page);
-
- virtual void deserialize(Archive &archive);
- Sequence* findSequence(const Common::String &name);
- void authorSequence(Sequence *sequence, bool unk);
-
-public:
- SequenceContext *_context;
- // unknown objects array
- Common::Array<Sequence*> _sequences;
- Common::String _currentSequenceName;
- //timers
- GamePage *_page;
- int unk;
-};
-
-} // End of namespace Pink
-
-#endif
\ No newline at end of file
diff --git a/engines/pink/side_effects/side_effect.cpp b/engines/pink/side_effects/side_effect.cpp
deleted file mode 100644
index 58d8830..0000000
--- a/engines/pink/side_effects/side_effect.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-namespace Pink {
-
-} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/side_effects/side_effect.h b/engines/pink/side_effects/side_effect.h
deleted file mode 100644
index 45099f3..0000000
--- a/engines/pink/side_effects/side_effect.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PINK_SIDE_EFFECT_H
-#define PINK_SIDE_EFFECT_H
-
-#include <engines/pink/object.h>
-
-namespace Pink {
-
-class LeadActor;
-
-class SideEffect : public Object {
-public:
- virtual ~SideEffect() {};
- virtual void init(LeadActor *actor) {};
-
-};
-
-}
-
-#endif
diff --git a/engines/pink/side_effects/side_effect_exit.cpp b/engines/pink/side_effects/side_effect_exit.cpp
deleted file mode 100644
index 0871c2f..0000000
--- a/engines/pink/side_effects/side_effect_exit.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include <common/debug.h>
-#include "side_effect_exit.h"
-#include "../archive.h"
-#include "../actors/lead_actor.h"
-
-namespace Pink {
-
-void SideEffectExit::deserialize(Archive &archive) {
- archive >> _nextModule >> _nextPage;
- debug("\tSideEffectExit: _nextModule = %s, _nextPage = %s",
- _nextModule.c_str(), _nextPage.c_str());
-}
-
-void SideEffectExit::init(LeadActor *_actor) {
- _actor->setNextExecutors(_nextPage, _nextModule);
-}
-
-} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/side_effects/side_effect_exit.h b/engines/pink/side_effects/side_effect_exit.h
deleted file mode 100644
index a324b82..0000000
--- a/engines/pink/side_effects/side_effect_exit.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PINK_SIDE_EFFECT_EXIT_H
-#define PINK_SIDE_EFFECT_EXIT_H
-
-#include "side_effect.h"
-
-namespace Pink {
-
-class SideEffectExit : public SideEffect {
-public:
- virtual void deserialize(Archive &archive);
-
- virtual void init(LeadActor *_actor);
-
-private:
- Common::String _nextModule;
- Common::String _nextPage;
-};
-
-} // End of namespace Pink
-
-#endif
diff --git a/engines/pink/side_effects/side_effect_module_variable.cpp b/engines/pink/side_effects/side_effect_module_variable.cpp
deleted file mode 100644
index 4e1e173..0000000
--- a/engines/pink/side_effects/side_effect_module_variable.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-#include <engines/pink/archive.h>
-#include <common/debug.h>
-#include "side_effect_variable.h"
-
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "side_effect_module_variable.h"
-#include "../actors/lead_actor.h"
-#include "../page.h"
-
-namespace Pink {
-
-void SideEffectModuleVariable::deserialize(Archive &archive) {
- SideEffectVariable::deserialize(archive);
- debug("\tSideEffectModuleVariable: _name = %s _value = %s",
- _name.c_str(), _value.c_str());
-}
-
-void SideEffectModuleVariable::init(LeadActor *actor) {
- Common::StringMap &moduleMap = actor->getPage()->getModule()->getMap();
- moduleMap[_name] = _value;
-}
-
-}
\ No newline at end of file
diff --git a/engines/pink/side_effects/side_effect_module_variable.h b/engines/pink/side_effects/side_effect_module_variable.h
deleted file mode 100644
index df45bf8..0000000
--- a/engines/pink/side_effects/side_effect_module_variable.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-#ifndef PINK_SIDE_EFFECT_MODULE_VARIABLE_H
-#define PINK_SIDE_EFFECT_MODULE_VARIABLE_H
-
-#include "side_effect_variable.h"
-
-namespace Pink {
-
-class SideEffectModuleVariable : public SideEffectVariable {
-public:
- virtual void deserialize(Archive &archive);
-
- virtual void init(LeadActor *actor);
-};
-
-} // End of namespace Pink
-
-#endif
\ No newline at end of file
diff --git a/engines/pink/side_effects/side_effect_variable.cpp b/engines/pink/side_effects/side_effect_variable.cpp
deleted file mode 100644
index 17481aa..0000000
--- a/engines/pink/side_effects/side_effect_variable.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "side_effect_variable.h"
-#include "../archive.h"
-
-namespace Pink {
-
-void SideEffectVariable::deserialize(Pink::Archive &archive) {
- archive >> _name >> _value;
-}
-
-}
diff --git a/engines/pink/side_effects/side_effect_variable.h b/engines/pink/side_effects/side_effect_variable.h
deleted file mode 100644
index c5b45f1..0000000
--- a/engines/pink/side_effects/side_effect_variable.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PINK_SIDE_EFFECT_VARIABLE_H
-#define PINK_SIDE_EFFECT_VARIABLE_H
-
-#include "side_effect.h"
-
-namespace Pink {
-
-class SideEffectVariable : public SideEffect {
-public:
- virtual void deserialize(Archive &archive);
-
-protected:
- Common::String _name;
- Common::String _value;
-};
-
-} // End of namespace Pink
-
-#endif
diff --git a/engines/pink/sound.cpp b/engines/pink/sound.cpp
index bdc41c8..cf62f03 100644
--- a/engines/pink/sound.cpp
+++ b/engines/pink/sound.cpp
@@ -27,10 +27,10 @@
namespace Pink {
-Sound::Sound(Audio::Mixer *mixer, AudioFormat format, Common::SeekableReadStream *stream)
+Sound::Sound(Audio::Mixer *mixer, Common::SeekableReadStream *stream)
: _mixer(mixer)
{
- load(format, stream);
+ load(stream);
}
Sound::~Sound() {
@@ -67,24 +67,11 @@ void Sound::play(Audio::Mixer::SoundType type, int volume, bool isLoop) {
_mixer->playStream(type, &_handle ,_stream);
}
-bool Sound::load(AudioFormat format, Common::SeekableReadStream *stream) {
- //may be mem leak
-
- // checked vox files in hex editor and they have WAVEfmt .
- // It seems strange for me
- // linux file says wav and vox are
+bool Sound::load(Common::SeekableReadStream *stream) {
+ // Vox files in pink have wave format.
// RIFF (little-endian) data, WAVE audio, Microsoft PCM, 8 bit, mono 22050 Hz
- switch (format){
- case AudioFormat::kWAV:
- _stream = Audio::makeWAVStream(stream, DisposeAfterUse::NO);
- break;
- case AudioFormat::kVOX:
- //TODO
- // check for last arg; nBlockAlign(1, 4 or other)
- _stream = Audio::makeADPCMStream(stream, DisposeAfterUse::NO, 0, Audio::kADPCMOki, 22050, 1, 0);
- break;
- }
+ _stream = Audio::makeWAVStream(stream, DisposeAfterUse::NO);
return isLoaded();
}
diff --git a/engines/pink/sound.h b/engines/pink/sound.h
index 7b60745..fdd5e23 100644
--- a/engines/pink/sound.h
+++ b/engines/pink/sound.h
@@ -28,8 +28,6 @@
namespace Pink {
-enum class AudioFormat{kWAV, kVOX};
-
/*TODO
from disasm foreground 100 %, background 80 %
dont know how to properly do it
@@ -38,10 +36,10 @@ enum class AudioFormat{kWAV, kVOX};
class Sound {
public:
- Sound(Audio::Mixer *mixer, AudioFormat format, Common::SeekableReadStream *stream);
+ Sound(Audio::Mixer *mixer, Common::SeekableReadStream *stream);
~Sound();
- bool load(AudioFormat format, Common::SeekableReadStream *stream);
+ bool load(Common::SeekableReadStream *stream);
void play(Audio::Mixer::SoundType type, int volume, bool isLoop);
bool isLoaded();
diff --git a/engines/pink/utils.h b/engines/pink/utils.h
deleted file mode 100644
index feb164c..0000000
--- a/engines/pink/utils.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PINK_UTILS_H
-#define PINK_UTILS_H
-
-#include <common/array.h>
-
-namespace Pink {
- class Object;
- class NamedObject;
- class GamePage;
-
- using ObArray = Common::Array<Object*>;
- using ModulesArray = Common::Array<NamedObject*>;
- using PagesArray = Common::Array<GamePage*>;
- using StringArray = Common::Array<Common::String>;
-}
-
-#endif
diff --git a/engines/pink/walk/walk_location.cpp b/engines/pink/walk/walk_location.cpp
deleted file mode 100644
index 7bf19ea..0000000
--- a/engines/pink/walk/walk_location.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "walk_location.h"
-#include "../archive.h"
-
-void Pink::WalkLocation::deserialize(Pink::Archive &archive) {
- NamedObject::deserialize(archive);
- archive >> _neighbors;
-}
diff --git a/engines/pink/walk/walk_location.h b/engines/pink/walk/walk_location.h
deleted file mode 100644
index da96a14..0000000
--- a/engines/pink/walk/walk_location.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-#ifndef PINK_WALK_LOCATION_H
-#define PINK_WALK_LOCATION_H
-
-#include <engines/pink/object.h>
-#include <common/array.h>
-#include <engines/pink/utils.h>
-
-namespace Pink {
-
-class WalkLocation : public NamedObject {
-public:
- virtual void deserialize(Archive &archive);
-
-private:
- StringArray _neighbors;
-};
-
-} // End of namespace Pink
-
-#endif
\ No newline at end of file
diff --git a/engines/pink/walk/walk_mgr.cpp b/engines/pink/walk/walk_mgr.cpp
deleted file mode 100644
index ce7690a..0000000
--- a/engines/pink/walk/walk_mgr.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-//
-// Created by andrei on 3/17/18.
-//
-
-#include "walk_mgr.h"
-#include "../actors/lead_actor.h"
-#include "../archive.h"
-
-
-void Pink::WalkMgr::deserialize(Pink::Archive &archive) {
- _leadActor = static_cast<LeadActor*>(archive.readObject());
- archive >> _locations;
-}
diff --git a/engines/pink/walk/walk_mgr.h b/engines/pink/walk/walk_mgr.h
deleted file mode 100644
index 857268d..0000000
--- a/engines/pink/walk/walk_mgr.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PINK_WALK_MGR_H
-#define PINK_WALK_MGR_H
-
-#include <common/array.h>
-#include "engines/pink/object.h"
-
-namespace Pink {
-
-class WalkLocation;
-class LeadActor;
-
-class WalkMgr : public Object {
-public:
- virtual void deserialize(Archive &archive);
-
-private:
- LeadActor *_leadActor;
- Common::Array<WalkLocation*> _locations;
-};
-
-} // End of namespace Pink
-
-#endif
Commit: be415cd46f7f5c87e221270ec43f050565bdd3e8
https://github.com/scummvm/scummvm/commit/be415cd46f7f5c87e221270ec43f050565bdd3e8
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: small fixes
Changed paths:
engines/pink/objects/handlers/handler.cpp
engines/pink/objects/handlers/handler.h
engines/pink/objects/pages/game_page.cpp
engines/pink/objects/pages/game_page.h
engines/pink/objects/pages/page.cpp
engines/pink/objects/sequences/sequencer.cpp
diff --git a/engines/pink/objects/handlers/handler.cpp b/engines/pink/objects/handlers/handler.cpp
index 6a53832..8b988fb 100644
--- a/engines/pink/objects/handlers/handler.cpp
+++ b/engines/pink/objects/handlers/handler.cpp
@@ -45,7 +45,7 @@ bool Handler::isSuitable(LeadActor *actor) {
return true;
}
-void Handler::prepareForNextHandler(LeadActor *actor) {
+void Handler::executeSideEffects(LeadActor *actor) {
for (int i = 0; i < _sideEffects.size(); ++i) {
_sideEffects[i]->execute(actor);
}
@@ -57,10 +57,14 @@ void HandlerSequences::deserialize(Archive &archive) {
}
void HandlerSequences::init(LeadActor *actor) {
- prepareForNextHandler(actor);
+ executeSideEffects(actor);
Sequencer *sequencer = actor->getSequencer();
+
Sequence *sequence = sequencer->findSequence(_sequences[0]); //actually we must pick random sequence
+ assert(sequence);
+
sequencer->authorSequence(sequence, 0);
+ handle(sequence);
}
void HandlerStartPage::handle(Sequence *sequence) {
diff --git a/engines/pink/objects/handlers/handler.h b/engines/pink/objects/handlers/handler.h
index 4f8cc28..c42aaef 100644
--- a/engines/pink/objects/handlers/handler.h
+++ b/engines/pink/objects/handlers/handler.h
@@ -40,7 +40,7 @@ public:
bool isSuitable(LeadActor *actor);
protected:
- void prepareForNextHandler(LeadActor *actor);
+ void executeSideEffects(LeadActor *actor);
Common::Array<Condition*> _conditions;
Common::Array<SideEffect*> _sideEffects;
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index 58d8830..f4a7a08 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -20,6 +20,109 @@
*
*/
+#include <engines/pink/objects/handlers/handler.h>
+#include "game_page.h"
+#include <engines/pink/objects/walk/walk_mgr.h>
+#include "engines/pink/cursor_mgr.h"
+#include "engines/pink/objects/actors/lead_actor.h"
+#include "engines/pink/objects/sequences/sequencer.h"
+
+
namespace Pink {
+void GamePage::deserialize(Archive &archive) {
+ Page::deserialize(archive);
+ _module = static_cast<Module*>(archive.readObject());
+ assert(dynamic_cast<Module*>(_module) != 0);
+}
+
+void GamePage::load(Archive &archive) {
+ archive.mapObject(_cursorMgr);
+ archive.mapObject(_walkMgr);
+ archive.mapObject(_sequencer);
+
+ Page::load(archive);
+
+ _leadActor = static_cast<LeadActor*>(archive.readObject());
+
+ _walkMgr->deserialize(archive);
+
+ _sequencer->deserialize(archive);
+ archive >> _handlers;
+}
+
+void GamePage::init(bool isLoadingSave) {
+
+ if (!isLoadingSave){
+ //assert(perhapsIsLoaded == 0);
+ loadManagers();
+ }
+
+ toConsole();
+
+ for (int i = 0; i < _actors.size(); ++i) {
+ _actors[i]->init(0);
+ }
+
+ if (!isLoadingSave)
+ prepareHandler();
+
+
+}
+
+void GamePage::prepareHandler() {
+ for (uint i = 0; i < _handlers.size(); ++i) {
+ if (_handlers[i]->isSuitable(_leadActor)){
+ _handlers[i]->init(_leadActor);
+ break;
+ }
+ }
+}
+
+void GamePage::loadManagers() {
+ perhapsIsLoaded = true;
+ _cursorMgr = new CursorMgr(this);
+ _walkMgr = new WalkMgr;
+ _sequencer = new Sequencer(this);
+
+ _resMgr.init(_module->getGame(), this);
+
+ // memfile manipulations if from save or page changing
+
+}
+
+PinkEngine *GamePage::getGame() {
+ return _module->getGame();
+}
+
+Sequencer *GamePage::getSequencer() {
+ return _sequencer;
+}
+
+Module *GamePage::getModule() const {
+ return _module;
+}
+
+bool GamePage::checkValueOfVariable(Common::String &variable, Common::String &value) {
+ assert(_variables.contains(variable));
+ return _variables[variable] == value;
+}
+
+void GamePage::setVariable(Common::String &variable, Common::String &value) {
+ _variables[variable] = value;
+}
+
+WalkMgr *GamePage::getWalkMgr() {
+ return _walkMgr;
+}
+
+void GamePage::toConsole() {
+ Page::toConsole();
+ _walkMgr->toConsole();
+ _sequencer->toConsole();
+ for (int i = 0; i < _handlers.size(); ++i) {
+ _handlers[i]->toConsole();
+ }
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/pages/game_page.h b/engines/pink/objects/pages/game_page.h
index f92a966..0437160 100644
--- a/engines/pink/objects/pages/game_page.h
+++ b/engines/pink/objects/pages/game_page.h
@@ -53,12 +53,15 @@ public:
virtual void toConsole();
private:
+ void prepareHandler();
+
+
int perhapsIsLoaded;
Module *_module;
CursorMgr *_cursorMgr;
WalkMgr *_walkMgr;
Sequencer *_sequencer;
- Common::Array<Handler *> _handlers;
+ Common::Array<HandlerStartPage*> _handlers;
Common::StringMap _variables;
/*
diff --git a/engines/pink/objects/pages/page.cpp b/engines/pink/objects/pages/page.cpp
index 6eb9ff2..36910ec 100644
--- a/engines/pink/objects/pages/page.cpp
+++ b/engines/pink/objects/pages/page.cpp
@@ -20,12 +20,9 @@
*
*/
-#include <engines/pink/objects/walk/walk_mgr.h>
-#include <engines/pink/objects/handlers/handler.h>
-#include "game_page.h"
-#include "engines/pink/cursor_mgr.h"
+#include "page.h"
#include "engines/pink/objects/actors/lead_actor.h"
-#include "engines/pink/objects/sequences/sequencer.h"
+
namespace Pink {
@@ -53,99 +50,4 @@ void Page::toConsole() {
}
}
-
-void GamePage::deserialize(Archive &archive) {
- Page::deserialize(archive);
- _module = static_cast<Module*>(archive.readObject());
- assert(dynamic_cast<Module*>(_module) != 0);
-}
-
-void GamePage::load(Archive &archive) {
- archive.mapObject(_cursorMgr);
- archive.mapObject(_walkMgr);
- archive.mapObject(_sequencer);
-
- Page::load(archive);
-
- _leadActor = static_cast<LeadActor*>(archive.readObject());
-
- _walkMgr->deserialize(archive);
-
- _sequencer->deserialize(archive);
- archive >> _handlers;
-}
-
-void GamePage::init(bool isLoadingSave) {
-
- if (!isLoadingSave){
- //assert(perhapsIsLoaded == 0);
- loadManagers();
- }
-
- toConsole();
-
- for (int i = 0; i < _actors.size(); ++i) {
- _actors[i]->init(0);
- }
-
- if (!isLoadingSave) {
- for (uint i = 0; i < _handlers.size(); ++i) {
- if (_handlers[i]->isSuitable(_leadActor)){
- HandlerSequences *handlerSequences = dynamic_cast<HandlerSequences*>(_handlers[i]);
- assert(handlerSequences);
- handlerSequences->init(_leadActor);
- break;
- }
- }
-
- }
-
-}
-
-void GamePage::loadManagers() {
- perhapsIsLoaded = true;
- _cursorMgr = new CursorMgr(this);
- _walkMgr = new WalkMgr;
- _sequencer = new Sequencer(this);
-
- _resMgr.init(_module->getGame(), this);
-
- // memfile manipulations if from save or page changing
-
-}
-
-PinkEngine *GamePage::getGame() {
- return _module->getGame();
-}
-
-Sequencer *GamePage::getSequencer() {
- return _sequencer;
-}
-
-Module *GamePage::getModule() const {
- return _module;
-}
-
-bool GamePage::checkValueOfVariable(Common::String &variable, Common::String &value) {
- assert(_variables.contains(variable));
- return _variables[variable] == value;
-}
-
-void GamePage::setVariable(Common::String &variable, Common::String &value) {
- _variables[variable] = value;
-}
-
-WalkMgr *GamePage::getWalkMgr() {
- return _walkMgr;
-}
-
-void GamePage::toConsole() {
- Page::toConsole();
- _walkMgr->toConsole();
- _sequencer->toConsole();
- for (int i = 0; i < _handlers.size(); ++i) {
- _handlers[i]->toConsole();
- }
-}
-
} // End of namespace Pink
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index 2bddcbd..d97e8f5 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -42,7 +42,6 @@ void Sequencer::deserialize(Archive &archive) {
archive >> _sequences;
archive.readCount();// intro have 0 timers;
//serialize timers;
-
}
Sequence *Sequencer::findSequence(const Common::String &name) {
Commit: eb6ce676e4e604f510cbf3f4d651c18911f4468f
https://github.com/scummvm/scummvm/commit/eb6ce676e4e604f510cbf3f4d651c18911f4468f
Author: whiterandrek (whiteradnrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: game page init fixes
Changed paths:
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/actors/lead_actor.h
engines/pink/objects/pages/game_page.cpp
engines/pink/objects/pages/game_page.h
engines/pink/objects/pages/page.cpp
engines/pink/objects/pages/page.h
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 2c88612..8e7411e 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -39,15 +39,15 @@ void LeadActor::deserialize(Archive &archive) {
}
void LeadActor::setNextExecutors(Common::String &nextModule, Common::String &nextPage) {
- if (_state == Ready || _state == Moving || _state == inDialog1 || _state == Inventory || _state == PDA) {
- _state = PlayingVideo;
+ if (_state == kReady || _state == kMoving || _state == kInDialog1 || _state == kInventory || _state == kPDA) {
+ _state = kPlayingVideo;
_page->getGame()->setNextExecutors(nextModule, nextPage);
}
}
void LeadActor::init(bool unk) {
- if (_state == unk_Loading){
- _state = Ready;
+ if (_state == kUnk_Loading){
+ _state = kReady;
}
_page->getModule()->getInventoryMgr()->setLeadActor(this);
Actor::init(unk);
@@ -60,4 +60,8 @@ void LeadActor::toConsole() {
}
}
+LeadActor::State LeadActor::getState() const {
+ return _state;
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index 762facb..30c0a50 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -34,14 +34,14 @@ class Sequencer;
class LeadActor : public Actor {
public:
enum State {
- Ready = 0,
- Moving,
- inDialog1, //???
- Inventory,
- PDA,
- inDialog2,//???
- PlayingVideo, // ???
- unk_Loading // ????
+ kReady = 0,
+ kMoving,
+ kInDialog1, //???
+ kInventory,
+ kPDA,
+ kInDialog2,//???
+ kPlayingVideo, // ???
+ kUnk_Loading // ????
};
virtual void deserialize(Archive &archive);
@@ -51,6 +51,8 @@ public:
void setNextExecutors (Common::String &nextModule, Common::String &nextPage);
virtual void init(bool unk);
+ State getState() const;
+
private:
State _state;
CursorMgr *_cursorMgr;
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index f4a7a08..9ea9184 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -52,7 +52,6 @@ void GamePage::load(Archive &archive) {
}
void GamePage::init(bool isLoadingSave) {
-
if (!isLoadingSave){
//assert(perhapsIsLoaded == 0);
loadManagers();
@@ -60,17 +59,15 @@ void GamePage::init(bool isLoadingSave) {
toConsole();
- for (int i = 0; i < _actors.size(); ++i) {
- _actors[i]->init(0);
- }
+ Page::init();
if (!isLoadingSave)
- prepareHandler();
+ initHandler();
}
-void GamePage::prepareHandler() {
+void GamePage::initHandler() {
for (uint i = 0; i < _handlers.size(); ++i) {
if (_handlers[i]->isSuitable(_leadActor)){
_handlers[i]->init(_leadActor);
diff --git a/engines/pink/objects/pages/game_page.h b/engines/pink/objects/pages/game_page.h
index 0437160..6eb29a2 100644
--- a/engines/pink/objects/pages/game_page.h
+++ b/engines/pink/objects/pages/game_page.h
@@ -30,7 +30,7 @@ namespace Pink {
class CursorMgr;
class WalkMgr;
class Sequencer;
-class Handler;
+class HandlerStartPage;
class GamePage : public Page {
public:
@@ -53,7 +53,7 @@ public:
virtual void toConsole();
private:
- void prepareHandler();
+ void initHandler();
int perhapsIsLoaded;
diff --git a/engines/pink/objects/pages/page.cpp b/engines/pink/objects/pages/page.cpp
index 36910ec..e7ea030 100644
--- a/engines/pink/objects/pages/page.cpp
+++ b/engines/pink/objects/pages/page.cpp
@@ -50,4 +50,13 @@ void Page::toConsole() {
}
}
+void Page::init() {
+ LeadActor::State state = _leadActor->getState();
+ bool unk = (state == LeadActor::kInventory || state == LeadActor::kPDA);
+
+ for (int i = 0; i < _actors.size(); ++i) {
+ _actors[i]->init(unk);
+ }
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/pages/page.h b/engines/pink/objects/pages/page.h
index 63d4551..208364c 100644
--- a/engines/pink/objects/pages/page.h
+++ b/engines/pink/objects/pages/page.h
@@ -43,6 +43,7 @@ public:
virtual void toConsole();
protected:
+ void init();
Common::Array<Actor*> _actors;
ResourceMgr _resMgr;
LeadActor *_leadActor;
Commit: 8874ccb9de1936c7fc1ae83bccd3d85344617285
https://github.com/scummvm/scummvm/commit/8874ccb9de1936c7fc1ae83bccd3d85344617285
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added debug information to actions
Changed paths:
engines/pink/objects/actions/action_hide.cpp
engines/pink/objects/actions/action_hide.h
engines/pink/objects/actions/action_play.cpp
engines/pink/objects/actions/action_play.h
engines/pink/objects/actions/action_sound.cpp
engines/pink/objects/actions/action_still.cpp
engines/pink/objects/actions/action_still.h
diff --git a/engines/pink/objects/actions/action_hide.cpp b/engines/pink/objects/actions/action_hide.cpp
index 7df4366..b89d4c9 100644
--- a/engines/pink/objects/actions/action_hide.cpp
+++ b/engines/pink/objects/actions/action_hide.cpp
@@ -32,13 +32,13 @@ void Pink::ActionHide::deserialize(Archive &archive) {
Action::deserialize(archive);
}
-void ActionHide::play(bool unk_startNow) {
- debug("ActionHide %s is now in playing state", _name.c_str());
+void ActionHide::start(bool unk_startNow) {
+ debug("Actor %s has now ActionHide %s", _actor->getName().c_str(), _name.c_str());
_actor->endAction();
}
void ActionHide::end() {
- debug("ActionHide %s is ended", _name.c_str());
+ debug("ActionHide %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
}
void ActionHide::toConsole() {
diff --git a/engines/pink/objects/actions/action_hide.h b/engines/pink/objects/actions/action_hide.h
index fa6e717..2e52fdc 100644
--- a/engines/pink/objects/actions/action_hide.h
+++ b/engines/pink/objects/actions/action_hide.h
@@ -33,7 +33,7 @@ public:
virtual void toConsole();
- virtual void play(bool unk_startNow);
+ virtual void start(bool unk_startNow);
virtual void end();
};
diff --git a/engines/pink/objects/actions/action_play.cpp b/engines/pink/objects/actions/action_play.cpp
index 5e6b692..051f3c4 100644
--- a/engines/pink/objects/actions/action_play.cpp
+++ b/engines/pink/objects/actions/action_play.cpp
@@ -22,6 +22,7 @@
#include <common/debug.h>
#include "action_play.h"
+#include "../actors/actor.h"
#include "engines/pink/archive.h"
namespace Pink {
@@ -36,4 +37,12 @@ void ActionPlay::toConsole() {
" _endFrame = %u", _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame);
}
+void ActionPlay::start(bool unk) {
+ debug("Actor %s has now ActionPlay %s", _actor->getName().c_str(), _name.c_str());
+}
+
+void ActionPlay::end() {
+ debug("ActionPlay %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_play.h b/engines/pink/objects/actions/action_play.h
index d53b44a..8ae9149 100644
--- a/engines/pink/objects/actions/action_play.h
+++ b/engines/pink/objects/actions/action_play.h
@@ -33,6 +33,9 @@ public:
virtual void deserialize(Archive &archive);
virtual void toConsole();
+ virtual void start(bool unk);
+ virtual void end();
+
private:
uint32 _stopFrame;
};
diff --git a/engines/pink/objects/actions/action_sound.cpp b/engines/pink/objects/actions/action_sound.cpp
index f389f97..38f8687 100644
--- a/engines/pink/objects/actions/action_sound.cpp
+++ b/engines/pink/objects/actions/action_sound.cpp
@@ -56,9 +56,12 @@ void ActionSound::start(bool unk) {
_sound->play(soundType, _volume, _isLoop);
if (_isLoop)
_actor->endAction();
+
+ debug("Actor %s has now ActionSound %s", _actor->getName().c_str(), _name.c_str());
}
void ActionSound::end() {
+ debug("ActionSound %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
_sound->stop();
delete _sound;
_sound = nullptr;
diff --git a/engines/pink/objects/actions/action_still.cpp b/engines/pink/objects/actions/action_still.cpp
index 3c6bf17..ca5793b 100644
--- a/engines/pink/objects/actions/action_still.cpp
+++ b/engines/pink/objects/actions/action_still.cpp
@@ -23,6 +23,7 @@
#include <common/debug.h>
#include "action_still.h"
#include "engines/pink/archive.h"
+#include <engines/pink/objects/actors/actor.h>
namespace Pink {
@@ -36,4 +37,12 @@ void ActionStill::toConsole() {
_name.c_str(), _fileName.c_str(), _startFrame);
}
+void ActionStill::start(bool unk) {
+ debug("Actor %s has now ActionStill %s", _actor->getName().c_str(), _name.c_str());
+}
+
+void ActionStill::end() {
+ debug("ActionStill %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/actions/action_still.h b/engines/pink/objects/actions/action_still.h
index 075371a..d777061 100644
--- a/engines/pink/objects/actions/action_still.h
+++ b/engines/pink/objects/actions/action_still.h
@@ -32,6 +32,10 @@ public:
virtual void deserialize(Archive &archive);
virtual void toConsole();
+ virtual void start(bool unk);
+
+ virtual void end();
+
protected:
uint32 _startFrame;
};
Commit: a22ebbb54e0ff82851e9d54c04b0ff654f848ce3
https://github.com/scummvm/scummvm/commit/a22ebbb54e0ff82851e9d54c04b0ff654f848ce3
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Handlers are implemented, beside handlerMgr, HandlerTimerSequences;
HandlerTimer differs in Peril and Hokus Pokus
Changed paths:
engines/pink/objects/actors/actor.cpp
engines/pink/objects/actors/actor.h
engines/pink/objects/handlers/handler.cpp
engines/pink/objects/handlers/handler.h
engines/pink/objects/handlers/handler_timer.cpp
engines/pink/objects/handlers/handler_timer.h
engines/pink/objects/pages/game_page.cpp
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index c02cb67..14faae1 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -107,4 +107,8 @@ Action *Actor::getAction() const {
return _action;
}
+bool Actor::isPlaying() {
+ return _isActionEnd;
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/actor.h b/engines/pink/objects/actors/actor.h
index a31f553..7bd65b3 100644
--- a/engines/pink/objects/actors/actor.h
+++ b/engines/pink/objects/actors/actor.h
@@ -47,6 +47,7 @@ public:
Action *getAction() const;
+ bool isPlaying();
virtual void init(bool unk);
void hide();
void endAction();
diff --git a/engines/pink/objects/handlers/handler.cpp b/engines/pink/objects/handlers/handler.cpp
index 8b988fb..c5468e1 100644
--- a/engines/pink/objects/handlers/handler.cpp
+++ b/engines/pink/objects/handlers/handler.cpp
@@ -51,19 +51,23 @@ void Handler::executeSideEffects(LeadActor *actor) {
}
}
+void Handler::onMessage(LeadActor *actor) {
+ executeSideEffects(actor);
+}
+
void HandlerSequences::deserialize(Archive &archive) {
Handler::deserialize(archive);
archive >> _sequences;
}
-void HandlerSequences::init(LeadActor *actor) {
- executeSideEffects(actor);
+void HandlerSequences::onMessage(LeadActor *actor) {
+ Handler::onMessage(actor);
Sequencer *sequencer = actor->getSequencer();
Sequence *sequence = sequencer->findSequence(_sequences[0]); //actually we must pick random sequence
assert(sequence);
-
sequencer->authorSequence(sequence, 0);
+
handle(sequence);
}
@@ -90,4 +94,49 @@ void HandlerStartPage::toConsole() {
}
}
+void HandlerLeftClick::toConsole() {
+ debug("HandlerLeftClick:");
+
+ debug("\tSideEffects:");
+ for (int i = 0; i < _sideEffects.size(); ++i) {
+ _sideEffects[i]->toConsole();
+ }
+
+ debug("\tConditions:");
+ for (int i = 0; i < _conditions.size(); ++i) {
+ _conditions[i]->toConsole();
+ }
+
+ debug("\tSequences:");
+ for (int i = 0; i < _sequences.size(); ++i) {
+ debug("\t\t%s", _sequences[i].c_str());
+ }
+}
+
+void HandlerUseClick::deserialize(Archive &archive) {
+ HandlerSequences::deserialize(archive);
+}
+
+void HandlerUseClick::toConsole() {
+ debug("HandlerUseClick: _inventoryItem=%s, _recepient=%s", _inventoryItem.c_str(), _recepient.c_str());
+ debug("\tSideEffects:");
+ for (int i = 0; i < _sideEffects.size(); ++i) {
+ _sideEffects[i]->toConsole();
+ }
+
+ debug("\tConditions:");
+ for (int i = 0; i < _conditions.size(); ++i) {
+ _conditions[i]->toConsole();
+ }
+
+ debug("\tSequences:");
+ for (int i = 0; i < _sequences.size(); ++i) {
+ debug("\t\t%s", _sequences[i].c_str());
+ }
+}
+
+void HandlerUseClick::handle(Sequence *sequence) {
+
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/handlers/handler.h b/engines/pink/objects/handlers/handler.h
index c42aaef..b2e5fcf 100644
--- a/engines/pink/objects/handlers/handler.h
+++ b/engines/pink/objects/handlers/handler.h
@@ -37,6 +37,7 @@ class LeadActor;
class Handler : public Object {
public:
virtual void deserialize(Archive &archive);
+ virtual void onMessage(LeadActor *actor);
bool isSuitable(LeadActor *actor);
protected:
@@ -51,20 +52,40 @@ class Sequence;
class HandlerSequences : public Handler {
public:
virtual void deserialize(Archive &archive);
- void init(LeadActor *actor);
- virtual void handle(Sequence *sequence) = 0;
+ virtual void onMessage(LeadActor *actor);
protected:
+ virtual void handle(Sequence *sequence) = 0;
+
Common::StringArray _sequences;
};
class HandlerStartPage : public HandlerSequences {
public:
- ~HandlerStartPage() {};
+ virtual void toConsole();
+private:
+ virtual void handle(Sequence *sequence);
+};
+
+class HandlerLeftClick : public HandlerSequences {
+public:
virtual void toConsole();
+private:
+ virtual void handle(Sequence *sequence) {}
+};
+
+class HandlerUseClick : public HandlerSequences {
+public:
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
+
+private:
virtual void handle(Sequence *sequence);
+
+ Common::String _inventoryItem;
+ Common::String _recepient;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/handlers/handler_timer.cpp b/engines/pink/objects/handlers/handler_timer.cpp
index 2c6161b..b074772 100644
--- a/engines/pink/objects/handlers/handler_timer.cpp
+++ b/engines/pink/objects/handlers/handler_timer.cpp
@@ -20,25 +20,74 @@
*
*/
+
#include "handler_timer.h"
+#include <common/debug.h>
+#include <engines/pink/archive.h>
+#include <engines/pink/objects/condition.h>
+#include <engines/pink/objects/sequences/sequence.h>
+#include <engines/pink/objects/side_effect.h>
+#include <engines/pink/objects/actors/lead_actor.h>
namespace Pink {
void HandlerTimerActions::deserialize(Archive &archive) {
Handler::deserialize(archive);
+ archive >> _actions;
}
-void HandlerTimerActions::handle(LeadActor *actor) {
+void HandlerTimerActions::toConsole() {
+ debug("HandlerTimerActions:");
+
+ debug("\tSideEffects:");
+ for (int i = 0; i < _sideEffects.size(); ++i) {
+ _sideEffects[i]->toConsole();
+ }
+
+ debug("\tConditions:");
+ for (int i = 0; i < _conditions.size(); ++i) {
+ _conditions[i]->toConsole();
+ }
+ debug("\tActions:");
+ for (int i = 0; i < _actions.size(); ++i) {
+ debug("\t\t%s", _actions[i].c_str());
+ }
}
-void HandlerTimerSequences::deserialize(Archive &archive) {
- Handler::deserialize(archive);
+void HandlerTimerActions::onMessage(LeadActor *actor) {
+ Handler::onMessage(actor);
+ assert(_actions.size() > 0);
+ if (!actor->isPlaying()){
+ Action *action = actor->findAction(_actions[0]);// we must pick random
+ assert(action);
+ actor->setAction(action, 0);
+ }
}
+
void HandlerTimerSequences::handle(LeadActor *actor) {
+ debug("HandlerTimerSequences function is not implemented");
+}
+
+void HandlerTimerSequences::toConsole() {
+ debug("HandlerTimerSequences:");
+
+ debug("\tSideEffects:");
+ for (int i = 0; i < _sideEffects.size(); ++i) {
+ _sideEffects[i]->toConsole();
+ }
+
+ debug("\tConditions:");
+ for (int i = 0; i < _conditions.size(); ++i) {
+ _conditions[i]->toConsole();
+ }
+ debug("\tSequences:");
+ for (int i = 0; i < _sequences.size(); ++i) {
+ debug("\t\t%s", _sequences[i].c_str());
+ }
}
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/handlers/handler_timer.h b/engines/pink/objects/handlers/handler_timer.h
index 21d9518..b355645 100644
--- a/engines/pink/objects/handlers/handler_timer.h
+++ b/engines/pink/objects/handlers/handler_timer.h
@@ -30,25 +30,30 @@ namespace Pink {
class LeadActor;
-// This class has difference in games
+//TODO in Peril create HandlerTimerActions when it is request for HandlerTimer
+
+// This class has differences in games
class HandlerTimer : public Handler {
- virtual void handle(LeadActor *actor) = 0;
+
};
+//in Peril this is HandlerTimer
class HandlerTimerActions : public HandlerTimer {
+public:
+ virtual void toConsole();
virtual void deserialize(Archive &archive);
- virtual void handle(LeadActor *actor);
+ virtual void onMessage(LeadActor *actor);
private:
Common::StringArray _actions;
};
-class HandlerTimerSequences : public HandlerTimer {
- virtual void deserialize(Archive &archive);
- virtual void handle(LeadActor *actor);
-
+//appear in HokusPokus
+class HandlerTimerSequences : public HandlerSequences { //originally it was inherited from HandlerTimer
+public:
+ virtual void toConsole();
private:
- Common::StringArray _sequences;
+ virtual void handle(LeadActor *actor); // very big and hard function
};
} // End of namespace Pink
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index 9ea9184..e29a4f8 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -70,7 +70,7 @@ void GamePage::init(bool isLoadingSave) {
void GamePage::initHandler() {
for (uint i = 0; i < _handlers.size(); ++i) {
if (_handlers[i]->isSuitable(_leadActor)){
- _handlers[i]->init(_leadActor);
+ _handlers[i]->onMessage(_leadActor);
break;
}
}
Commit: 7facc7543f437f53b45f5c90e1181bb918d053e4
https://github.com/scummvm/scummvm/commit/7facc7543f437f53b45f5c90e1181bb918d053e4
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added random to methods which need it.
Changed paths:
engines/pink/objects/handlers/handler.cpp
engines/pink/objects/handlers/handler_timer.cpp
engines/pink/objects/handlers/handler_timer.h
engines/pink/objects/pages/game_page.cpp
engines/pink/objects/pages/game_page.h
engines/pink/objects/side_effect.cpp
engines/pink/pink.cpp
engines/pink/pink.h
engines/pink/resource_mgr.cpp
engines/pink/resource_mgr.h
diff --git a/engines/pink/objects/handlers/handler.cpp b/engines/pink/objects/handlers/handler.cpp
index c5468e1..de29615 100644
--- a/engines/pink/objects/handlers/handler.cpp
+++ b/engines/pink/objects/handlers/handler.cpp
@@ -27,6 +27,8 @@
#include <engines/pink/objects/sequences/sequencer.h>
#include <engines/pink/objects/sequences/sequence.h>
#include <engines/pink/objects/actors/lead_actor.h>
+#include <engines/pink/objects/pages/game_page.h>
+#include <engines/pink/pink.h>
#include <common/debug.h>
namespace Pink {
@@ -64,7 +66,13 @@ void HandlerSequences::onMessage(LeadActor *actor) {
Handler::onMessage(actor);
Sequencer *sequencer = actor->getSequencer();
- Sequence *sequence = sequencer->findSequence(_sequences[0]); //actually we must pick random sequence
+ assert(_sequences.size());
+
+ Common::RandomSource &rnd = actor->getPage()->getGame()->getRnd();
+ uint index = rnd.getRandomNumber(_sequences.size() - 1);
+
+ Sequence *sequence = sequencer->findSequence(_sequences[index]);
+
assert(sequence);
sequencer->authorSequence(sequence, 0);
diff --git a/engines/pink/objects/handlers/handler_timer.cpp b/engines/pink/objects/handlers/handler_timer.cpp
index b074772..4954f01 100644
--- a/engines/pink/objects/handlers/handler_timer.cpp
+++ b/engines/pink/objects/handlers/handler_timer.cpp
@@ -28,6 +28,9 @@
#include <engines/pink/objects/sequences/sequence.h>
#include <engines/pink/objects/side_effect.h>
#include <engines/pink/objects/actors/lead_actor.h>
+#include <engines/pink/objects/pages/game_page.h>
+#include <engines/pink/pink.h>
+
namespace Pink {
@@ -58,9 +61,11 @@ void HandlerTimerActions::toConsole() {
void HandlerTimerActions::onMessage(LeadActor *actor) {
Handler::onMessage(actor);
- assert(_actions.size() > 0);
+ assert(_actions.size());
if (!actor->isPlaying()){
- Action *action = actor->findAction(_actions[0]);// we must pick random
+ Common::RandomSource &rnd = actor->getPage()->getGame()->getRnd();
+ uint index = rnd.getRandomNumber(_actions.size() - 1);
+ Action *action = actor->findAction(_actions[index]);
assert(action);
actor->setAction(action, 0);
}
diff --git a/engines/pink/objects/handlers/handler_timer.h b/engines/pink/objects/handlers/handler_timer.h
index b355645..d40dd6f 100644
--- a/engines/pink/objects/handlers/handler_timer.h
+++ b/engines/pink/objects/handlers/handler_timer.h
@@ -30,7 +30,7 @@ namespace Pink {
class LeadActor;
-//TODO in Peril create HandlerTimerActions when it is request for HandlerTimer
+//TODO: in Peril create HandlerTimerActions when it is request for HandlerTimer
// This class has differences in games
class HandlerTimer : public Handler {
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index e29a4f8..16f918d 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -89,7 +89,7 @@ void GamePage::loadManagers() {
}
PinkEngine *GamePage::getGame() {
- return _module->getGame();
+ return _resMgr.getGame();
}
Sequencer *GamePage::getSequencer() {
diff --git a/engines/pink/objects/pages/game_page.h b/engines/pink/objects/pages/game_page.h
index 6eb29a2..74d1976 100644
--- a/engines/pink/objects/pages/game_page.h
+++ b/engines/pink/objects/pages/game_page.h
@@ -45,8 +45,8 @@ public:
PinkEngine *getGame();
Sequencer *getSequencer();
WalkMgr *getWalkMgr();
-
Module *getModule() const;
+
bool checkValueOfVariable(Common::String &variable, Common::String &value);
void setVariable(Common::String &variable, Common::String &value);
diff --git a/engines/pink/objects/side_effect.cpp b/engines/pink/objects/side_effect.cpp
index 4b290fa..8e6fb5e 100644
--- a/engines/pink/objects/side_effect.cpp
+++ b/engines/pink/objects/side_effect.cpp
@@ -29,6 +29,7 @@
#include <engines/pink/objects/walk/walk_location.h>
#include <engines/pink/objects/walk/walk_mgr.h>
+
namespace Pink {
void SideEffectExit::deserialize(Archive &archive) {
@@ -109,8 +110,12 @@ void SideEffectRandomPageVariable::deserialize(Archive &archive) {
}
void SideEffectRandomPageVariable::execute(LeadActor *actor) {
- // TODO think how to get rand gen here
- actor->getPage()->setVariable(_name, _values[0]); // temporary solution
+ assert(_values.size());
+
+ Common::RandomSource &rnd = actor->getPage()->getGame()->getRnd();
+ uint index = rnd.getRandomNumber(_values.size() - 1);
+
+ actor->getPage()->setVariable(_name, _values[index]);
}
void SideEffectRandomPageVariable::toConsole() {
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index b5edbb1..ec0ad26 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -199,4 +199,8 @@ void PinkEngine::setVariable(Common::String &variable, Common::String &value) {
_variables[variable] = value;
}
+Common::RandomSource &PinkEngine::getRnd() {
+ return _rnd;
+}
+
}
\ No newline at end of file
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index 114b475..e5dc3d5 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -75,6 +75,7 @@ public:
OrbFile *getOrb() { return &_orb; }
BroFile *getBro() { return _bro; }
+ Common::RandomSource &getRnd();
bool checkValueOfVariable(Common::String &variable, Common::String &value);
void setVariable(Common::String &variable, Common::String &value);
diff --git a/engines/pink/resource_mgr.cpp b/engines/pink/resource_mgr.cpp
index 1584502..208b206 100644
--- a/engines/pink/resource_mgr.cpp
+++ b/engines/pink/resource_mgr.cpp
@@ -73,4 +73,8 @@ Common::SeekableReadStream *ResourceMgr::getResourceStream(Common::String &name)
_resDescTable[i].offset + _resDescTable[i].size);
}
+PinkEngine *ResourceMgr::getGame() const {
+ return _game;
+}
+
} // End of namespace Pink
diff --git a/engines/pink/resource_mgr.h b/engines/pink/resource_mgr.h
index 8de06b2..1188c12 100644
--- a/engines/pink/resource_mgr.h
+++ b/engines/pink/resource_mgr.h
@@ -51,6 +51,7 @@ public:
//Common::String loadText(Common::String &name);
Sound *loadSound(Common::String &name);
// loadCEL();
+ PinkEngine *getGame() const;
private:
Common::SeekableReadStream *getResourceStream(Common::String &name);
Commit: 7f8f4dea2a141fca4ed1d0a7a826f6088d52acd3
https://github.com/scummvm/scummvm/commit/7f8f4dea2a141fca4ed1d0a7a826f6088d52acd3
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added SeqTimer class
Changed paths:
A engines/pink/objects/sequences/seq_timer.cpp
A engines/pink/objects/sequences/seq_timer.h
engines/pink/objects/sequences/sequence.cpp
engines/pink/objects/sequences/sequence.h
engines/pink/objects/sequences/sequence_item.h
engines/pink/objects/sequences/sequencer.cpp
engines/pink/objects/sequences/sequencer.h
diff --git a/engines/pink/objects/sequences/seq_timer.cpp b/engines/pink/objects/sequences/seq_timer.cpp
new file mode 100644
index 0000000..d2b761c
--- /dev/null
+++ b/engines/pink/objects/sequences/seq_timer.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "seq_timer.h"
+#include <engines/pink/archive.h>
+#include "./sequencer.h"
+#include <common/debug.h>
+
+namespace Pink {
+
+SeqTimer::SeqTimer()
+ : _unk(0) {
+
+}
+
+void SeqTimer::deserialize(Archive &archive) {
+ archive >> _actor;
+ _period = archive.readDWORD();
+ _range = archive.readDWORD();
+ _sequencer = static_cast<Sequencer*>(archive.readObject());
+}
+
+void SeqTimer::toConsole() {
+ debug("\tSeqTimer: _actor=%s _period=%u _range=%u", _actor.c_str(), _period, _range);
+}
+
+} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/sequences/seq_timer.h b/engines/pink/objects/sequences/seq_timer.h
new file mode 100644
index 0000000..4319b92
--- /dev/null
+++ b/engines/pink/objects/sequences/seq_timer.h
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_SEQ_TIMER_H
+#define PINK_SEQ_TIMER_H
+
+#include <engines/pink/objects/object.h>
+
+namespace Pink {
+
+class Sequencer;
+
+class SeqTimer : public Object {
+public:
+ SeqTimer();
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
+
+private:
+ Common::String _actor;
+ int _period;
+ int _range;
+ int _unk;
+ Sequencer *_sequencer;
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp
index 0af8f1a..bad9621 100644
--- a/engines/pink/objects/sequences/sequence.cpp
+++ b/engines/pink/objects/sequences/sequence.cpp
@@ -114,6 +114,7 @@ SequenceContext::SequenceContext(Sequence *sequence, Sequencer *sequencer)
sequence->setContext(this);
Common::Array<SequenceItem*> &items = sequence->getItems();
debug("SequenceContext for %s", _sequence->getName().c_str());
+
for (uint i = 0; i < items.size(); ++i) {
bool found = 0;
for (uint j = 0; j < _states.size(); ++j) {
diff --git a/engines/pink/objects/sequences/sequence.h b/engines/pink/objects/sequences/sequence.h
index f2f324b..bdf11b2 100644
--- a/engines/pink/objects/sequences/sequence.h
+++ b/engines/pink/objects/sequences/sequence.h
@@ -62,7 +62,7 @@ public:
public:
Common::String _actorName;
- Common::String _actionName; // ?state
+ Common::String _actionName;
int _unk;
};
diff --git a/engines/pink/objects/sequences/sequence_item.h b/engines/pink/objects/sequences/sequence_item.h
index 70fc68d..1507aa8 100644
--- a/engines/pink/objects/sequences/sequence_item.h
+++ b/engines/pink/objects/sequences/sequence_item.h
@@ -49,14 +49,13 @@ protected:
class SequenceItemLeader : public SequenceItem {
public:
virtual void toConsole();
-
virtual bool isLeader();
};
+// behaviour is identical to SequenceItemLeader
class SequenceItemLeaderAudio : public SequenceItemLeader {
- virtual void deserialize(Archive &archive);
-
public:
+ virtual void deserialize(Archive &archive);
virtual void toConsole();
private:
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index d97e8f5..1f667cf 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -39,9 +39,7 @@ Sequencer::~Sequencer() {
}
void Sequencer::deserialize(Archive &archive) {
- archive >> _sequences;
- archive.readCount();// intro have 0 timers;
- //serialize timers;
+ archive >> _sequences >> _timers;
}
Sequence *Sequencer::findSequence(const Common::String &name) {
diff --git a/engines/pink/objects/sequences/sequencer.h b/engines/pink/objects/sequences/sequencer.h
index d292346..36e9ba0 100644
--- a/engines/pink/objects/sequences/sequencer.h
+++ b/engines/pink/objects/sequences/sequencer.h
@@ -32,6 +32,7 @@ namespace Pink {
class Sequence;
class SequenceContext;
class GamePage;
+class SeqTimer;
class Sequencer : public Object {
public:
@@ -49,7 +50,7 @@ public:
// unknown objects array
Common::Array<Sequence*> _sequences;
Common::String _currentSequenceName;
- //timers
+ Common::Array<SeqTimer*> _timers;
GamePage *_page;
int unk;
};
Commit: e856e0bd67d84d5334a6c2f60e4a9b814eb068e4
https://github.com/scummvm/scummvm/commit/e856e0bd67d84d5334a6c2f60e4a9b814eb068e4
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added SupportingActor and HandlerMgr
Changed paths:
A engines/pink/objects/actors/supporting_actor.cpp
A engines/pink/objects/actors/supporting_actor.h
engines/pink/module.mk
engines/pink/objects/handlers/handler_mgr.cpp
engines/pink/objects/handlers/handler_mgr.h
engines/pink/objects/side_effect.h
diff --git a/engines/pink/module.mk b/engines/pink/module.mk
index a78312a..8621fe7 100644
--- a/engines/pink/module.mk
+++ b/engines/pink/module.mk
@@ -1,38 +1,40 @@
MODULE := engines/pink
MODULE_OBJS = \
- pink.o \
- console.o \
+ archive.o \
+ console.o \
+ cursor_mgr.o \
detection.o \
director.o \
- sound.o \
file.o \
- archive.o \
- cursor_mgr.o \
+ pink.o \
+ resource_mgr.o \
+ sound.o \
objects/object.o \
objects/module.o \
- objects/pages/page.o \
- objects/pages/game_page.o \
objects/inventory.o \
objects/side_effect.o \
objects/condition.o \
- resource_mgr.o \
objects/actions/action.o \
objects/actions/action_cel.o \
objects/actions/action_hide.o \
objects/actions/action_play.o \
objects/actions/action_sound.o \
objects/actions/action_still.o \
+ objects/actions/walk_action.o \
objects/actors/actor.o \
objects/actors/lead_actor.o \
- objects/walk/walk_mgr.o \
- objects/walk/walk_location.o \
+ objects/actors/supporting_actor.o \
+ objects/handlers/handler.o \
+ objects/handlers/handler_mgr.o \
+ objects/handlers/handler_timer.o \
+ objects/pages/page.o \
+ objects/pages/game_page.o \
objects/sequences/sequence.o \
objects/sequences/sequence_item.o \
objects/sequences/sequencer.o \
- objects/handlers/handler.o \
- objects/handlers/handler_timer.o \
-
+ objects/walk/walk_mgr.o \
+ objects/walk/walk_location.o \
# This module can be built as a plugin
ifeq ($(ENABLE_PLUMBERS), DYNAMIC_PLUGIN)
diff --git a/engines/pink/objects/actors/supporting_actor.cpp b/engines/pink/objects/actors/supporting_actor.cpp
new file mode 100644
index 0000000..8e023bd
--- /dev/null
+++ b/engines/pink/objects/actors/supporting_actor.cpp
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "supporting_actor.h"
+#include <engines/pink/archive.h>
+#include <engines/pink/objects/actions/action.h>
+#include <common/debug.h>
+
+namespace Pink {
+
+void SupportingActor::deserialize(Archive &archive) {
+ Actor::deserialize(archive);
+ archive >> _location >> _pdaLink >> _cursor;
+ _handlerMgr.deserialize(archive);
+}
+
+void SupportingActor::toConsole() {
+ debug("SupportingActor: _name = %s, _location=%s, _pdaLink=%s, _cursor=%s", _name.c_str());
+ for (int i = 0; i < _actions.size(); ++i) {
+ _actions[i]->toConsole();
+ }
+ _handlerMgr.toConsole();
+}
+
+} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/actors/supporting_actor.h b/engines/pink/objects/actors/supporting_actor.h
new file mode 100644
index 0000000..a9dd69a
--- /dev/null
+++ b/engines/pink/objects/actors/supporting_actor.h
@@ -0,0 +1,45 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_SUPPORTING_ACTOR_H
+#define PINK_SUPPORTING_ACTOR_H
+
+#include <engines/pink/objects/handlers/handler_mgr.h>
+#include "actor.h"
+
+namespace Pink {
+
+class SupportingActor : public Actor {
+public:
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
+
+private:
+ HandlerMgr _handlerMgr;
+ Common::String _location;
+ Common::String _pdaLink;
+ Common::String _cursor;
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/objects/handlers/handler_mgr.cpp b/engines/pink/objects/handlers/handler_mgr.cpp
index 9c8d43c..da695b4 100644
--- a/engines/pink/objects/handlers/handler_mgr.cpp
+++ b/engines/pink/objects/handlers/handler_mgr.cpp
@@ -3,3 +3,28 @@
//
#include "handler_mgr.h"
+#include "handler.h"
+#include "handler_timer.h"
+#include <pink/archive.h>
+#include <common/debug.h>
+
+namespace Pink {
+
+void HandlerMgr::deserialize(Pink::Archive &archive) {
+ archive >> _leftClickHandlers >> _useClickHandlers >> _timerHandlers;
+}
+
+void HandlerMgr::toConsole() {
+ debug("HandlerMgr:");
+ for (int i = 0; i < _leftClickHandlers.size(); ++i) {
+ _leftClickHandlers[i]->toConsole();
+ }
+ for (int i = 0; i < _leftClickHandlers.size(); ++i) {
+ _useClickHandlers[i]->toConsole();
+ }
+ for (int i = 0; i < _leftClickHandlers.size(); ++i) {
+ _timerHandlers[i]->toConsole();
+ }
+}
+
+}
diff --git a/engines/pink/objects/handlers/handler_mgr.h b/engines/pink/objects/handlers/handler_mgr.h
index 978f8d9..0de44cf 100644
--- a/engines/pink/objects/handlers/handler_mgr.h
+++ b/engines/pink/objects/handlers/handler_mgr.h
@@ -1,14 +1,49 @@
-//
-// Created by andrei on 3/21/18.
-//
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
-#ifndef SCUMMVM_HANDLER_MGR_H
-#define SCUMMVM_HANDLER_MGR_H
+#ifndef PINK_HANDLER_MGR_H
+#define PINK_HANDLER_MGR_H
+#include <engines/pink/objects/object.h>
+#include <common/array.h>
-class HandlerMgr {
+namespace Pink {
+class HandlerLeftClick;
+class HandlerUseClick;
+class HandlerTimer;
+
+class HandlerMgr : public Object {
+public:
+ virtual void deserialize(Archive &archive);
+
+ virtual void toConsole();
+
+private:
+ Common::Array<HandlerLeftClick*> _leftClickHandlers;
+ Common::Array<HandlerUseClick*> _useClickHandlers;
+ Common::Array<HandlerTimer*> _timerHandlers;
};
+}
-#endif //SCUMMVM_HANDLER_MGR_H
+#endif
diff --git a/engines/pink/objects/side_effect.h b/engines/pink/objects/side_effect.h
index 810dd46..5134226 100644
--- a/engines/pink/objects/side_effect.h
+++ b/engines/pink/objects/side_effect.h
@@ -39,9 +39,7 @@ public:
class SideEffectExit : public SideEffect {
public:
virtual void deserialize(Archive &archive);
-
virtual void toConsole();
-
virtual void execute(LeadActor *actor);
private:
@@ -50,10 +48,9 @@ private:
};
class SideEffectLocation : public SideEffect {
+public:
virtual void deserialize(Archive &archive);
virtual void execute(LeadActor *actor);
-
-public:
virtual void toConsole();
private:
@@ -61,10 +58,9 @@ private:
};
class SideEffectInventoryItemOwner : public SideEffect {
+public:
virtual void deserialize(Archive &archive);
virtual void execute(LeadActor *actor);
-
-public:
virtual void toConsole();
private:
@@ -97,21 +93,17 @@ public:
class SideEffectPageVariable : public SideEffectVariable {
public:
virtual void toConsole();
-
virtual void execute(LeadActor *actor);
};
class SideEffectRandomPageVariable : public SideEffect
{
- virtual void deserialize(Archive &archive);
-
public:
+ virtual void deserialize(Archive &archive);
virtual void toConsole();
private:
virtual void execute(LeadActor *actor);
-
-private:
Common::String _name;
Common::StringArray _values;
};
Commit: 46d576d9cef7d99089b236a5a603c418fb8b811b
https://github.com/scummvm/scummvm/commit/46d576d9cef7d99089b236a5a603c418fb8b811b
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added ActionLoop
Changed paths:
A engines/pink/objects/actions/action_loop.cpp
A engines/pink/objects/actions/action_loop.h
engines/pink/module.mk
engines/pink/objects/actions/action_play.h
diff --git a/engines/pink/module.mk b/engines/pink/module.mk
index 8621fe7..472164d 100644
--- a/engines/pink/module.mk
+++ b/engines/pink/module.mk
@@ -18,6 +18,7 @@ MODULE_OBJS = \
objects/actions/action.o \
objects/actions/action_cel.o \
objects/actions/action_hide.o \
+ objects/actions/action_loop.o \
objects/actions/action_play.o \
objects/actions/action_sound.o \
objects/actions/action_still.o \
diff --git a/engines/pink/objects/actions/action_loop.cpp b/engines/pink/objects/actions/action_loop.cpp
new file mode 100644
index 0000000..dd80b48
--- /dev/null
+++ b/engines/pink/objects/actions/action_loop.cpp
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+
+#include "action_loop.h"
+#include <common/debug.h>
+#include <pink/archive.h>
+
+namespace Pink {
+
+void ActionLoop::deserialize(Archive &archive) {
+ ActionPlay::deserialize(archive);
+ uint32 style;
+ archive >> _intro >> style;
+ assert(style <= 2);
+ _style = static_cast<Style>(style);
+}
+
+void ActionLoop::toConsole() {
+ debug("\tActionLoop: _name = %s, _fileName = %s, z = %u, _startFrame = %u,"
+ " _endFrame = %u, _intro = %u, style = %u",
+ _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame, _intro, _style);
+}
+
+} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/actions/action_loop.h b/engines/pink/objects/actions/action_loop.h
new file mode 100644
index 0000000..659a21d
--- /dev/null
+++ b/engines/pink/objects/actions/action_loop.h
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_ACTION_LOOP_H
+#define PINK_ACTION_LOOP_H
+
+#include "action_play.h"
+
+namespace Pink {
+
+class ActionLoop : public ActionPlay {
+public:
+ virtual void deserialize(Archive &archive);
+
+ virtual void toConsole();
+
+private:
+ enum Style {
+ kPingPong = 0,
+ kRandom = 1,
+ kForward = 2
+ };
+ uint _intro;
+ Style _style;
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/objects/actions/action_play.h b/engines/pink/objects/actions/action_play.h
index 8ae9149..f5c6357 100644
--- a/engines/pink/objects/actions/action_play.h
+++ b/engines/pink/objects/actions/action_play.h
@@ -36,7 +36,7 @@ public:
virtual void start(bool unk);
virtual void end();
-private:
+protected:
uint32 _stopFrame;
};
Commit: 05992bf95f8cd1c27bbdc9698b75e4d1d4a32549
https://github.com/scummvm/scummvm/commit/05992bf95f8cd1c27bbdc9698b75e4d1d4a32549
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Fixed wrong constant values
Changed paths:
engines/pink/objects/actions/action_loop.cpp
engines/pink/objects/actions/action_loop.h
diff --git a/engines/pink/objects/actions/action_loop.cpp b/engines/pink/objects/actions/action_loop.cpp
index dd80b48..6ea4110 100644
--- a/engines/pink/objects/actions/action_loop.cpp
+++ b/engines/pink/objects/actions/action_loop.cpp
@@ -31,8 +31,17 @@ void ActionLoop::deserialize(Archive &archive) {
ActionPlay::deserialize(archive);
uint32 style;
archive >> _intro >> style;
- assert(style <= 2);
- _style = static_cast<Style>(style);
+ switch (style) {
+ case kPingPong:
+ _style = kPingPong;
+ break;
+ case kRandom:
+ _style = kRandom;
+ break;
+ default:
+ _style = kForward;
+ }
+ //_style = static_cast<Style>(style);
}
void ActionLoop::toConsole() {
diff --git a/engines/pink/objects/actions/action_loop.h b/engines/pink/objects/actions/action_loop.h
index 659a21d..0612f51 100644
--- a/engines/pink/objects/actions/action_loop.h
+++ b/engines/pink/objects/actions/action_loop.h
@@ -35,9 +35,9 @@ public:
private:
enum Style {
- kPingPong = 0,
- kRandom = 1,
- kForward = 2
+ kPingPong = 2,
+ kRandom = 3,
+ kForward // unknown
};
uint _intro;
Style _style;
Commit: 74437eee9152b0816449120f475695381eca69da
https://github.com/scummvm/scummvm/commit/74437eee9152b0816449120f475695381eca69da
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Again small fix for ActionLoop
Changed paths:
engines/pink/archive.cpp
engines/pink/archive.h
engines/pink/objects/actions/action_loop.cpp
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp
index 9e06420..0316581 100644
--- a/engines/pink/archive.cpp
+++ b/engines/pink/archive.cpp
@@ -297,6 +297,10 @@ uint32 Archive::readDWORD() {
return _file.readUint32LE();
}
+uint16 Archive::readWORD() {
+ return _file.readUint16LE();
+}
+
} // End of namespace Pink
diff --git a/engines/pink/archive.h b/engines/pink/archive.h
index 906169b..5e6c091 100644
--- a/engines/pink/archive.h
+++ b/engines/pink/archive.h
@@ -43,6 +43,8 @@ public:
int readCount();
uint32 readDWORD();
+ uint16 readWORD();
+
Object *readObject();
Common::String readString();
@@ -82,6 +84,11 @@ inline Archive &operator>>(Archive &archive, uint32 &num){
return archive;
}
+inline Archive &operator>>(Archive &archive, uint16 &num){
+ num = archive.readWORD();
+ return archive;
+}
+
inline Archive &operator>>(Archive &archive, Common::StringArray &array){
uint32 size = archive.readCount();
array.resize(size);
diff --git a/engines/pink/objects/actions/action_loop.cpp b/engines/pink/objects/actions/action_loop.cpp
index 6ea4110..98d95ee 100644
--- a/engines/pink/objects/actions/action_loop.cpp
+++ b/engines/pink/objects/actions/action_loop.cpp
@@ -29,7 +29,7 @@ namespace Pink {
void ActionLoop::deserialize(Archive &archive) {
ActionPlay::deserialize(archive);
- uint32 style;
+ uint16 style;
archive >> _intro >> style;
switch (style) {
case kPingPong:
Commit: 636e226d738b736cc94cc309d2f3bd896ecc7462
https://github.com/scummvm/scummvm/commit/636e226d738b736cc94cc309d2f3bd896ecc7462
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added ActionTalk class
Changed paths:
A engines/pink/objects/actions/action_talk.cpp
A engines/pink/objects/actions/action_talk.h
engines/pink/module.mk
engines/pink/objects/actions/action_loop.cpp
engines/pink/objects/actions/action_loop.h
diff --git a/engines/pink/module.mk b/engines/pink/module.mk
index 472164d..3880787 100644
--- a/engines/pink/module.mk
+++ b/engines/pink/module.mk
@@ -22,6 +22,7 @@ MODULE_OBJS = \
objects/actions/action_play.o \
objects/actions/action_sound.o \
objects/actions/action_still.o \
+ objects/actions/action_talk.o \
objects/actions/walk_action.o \
objects/actors/actor.o \
objects/actors/lead_actor.o \
diff --git a/engines/pink/objects/actions/action_loop.cpp b/engines/pink/objects/actions/action_loop.cpp
index 98d95ee..25e4d66 100644
--- a/engines/pink/objects/actions/action_loop.cpp
+++ b/engines/pink/objects/actions/action_loop.cpp
@@ -46,7 +46,7 @@ void ActionLoop::deserialize(Archive &archive) {
void ActionLoop::toConsole() {
debug("\tActionLoop: _name = %s, _fileName = %s, z = %u, _startFrame = %u,"
- " _endFrame = %u, _intro = %u, style = %u",
+ " _endFrame = %u, _intro = %u, _style = %u",
_name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame, _intro, _style);
}
diff --git a/engines/pink/objects/actions/action_loop.h b/engines/pink/objects/actions/action_loop.h
index 0612f51..82b2c1e 100644
--- a/engines/pink/objects/actions/action_loop.h
+++ b/engines/pink/objects/actions/action_loop.h
@@ -30,10 +30,9 @@ namespace Pink {
class ActionLoop : public ActionPlay {
public:
virtual void deserialize(Archive &archive);
-
virtual void toConsole();
-private:
+protected:
enum Style {
kPingPong = 2,
kRandom = 3,
diff --git a/engines/pink/objects/actions/action_talk.cpp b/engines/pink/objects/actions/action_talk.cpp
new file mode 100644
index 0000000..da37204
--- /dev/null
+++ b/engines/pink/objects/actions/action_talk.cpp
@@ -0,0 +1,40 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "action_talk.h"
+#include <pink/archive.h>
+#include <common/debug.h>
+
+namespace Pink {
+
+void ActionTalk::deserialize(Archive &archive) {
+ ActionLoop::deserialize(archive);
+ archive >> _vox;
+}
+
+void ActionTalk::toConsole() {
+ debug("\tActionTalk: _name = %s, _fileName = %s, z = %u, _startFrame = %u,"
+ " _endFrame = %u, _intro = %u, _style = %u, _vox = %s",
+ _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame, _intro, _style, _vox.c_str());
+}
+
+} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/actions/action_talk.h b/engines/pink/objects/actions/action_talk.h
new file mode 100644
index 0000000..4c28a6f
--- /dev/null
+++ b/engines/pink/objects/actions/action_talk.h
@@ -0,0 +1,41 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_ACTION_TALK_H
+#define PINK_ACTION_TALK_H
+
+#include <engines/pink/objects/actions/action_loop.h>
+
+namespace Pink {
+
+class ActionTalk : public ActionLoop {
+public:
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
+
+private:
+ Common::String _vox;
+};
+
+} // End of namespace Pink
+
+#endif
Commit: 8671e8bee37440019d7b6e495c69bd26e43b9e5c
https://github.com/scummvm/scummvm/commit/8671e8bee37440019d7b6e495c69bd26e43b9e5c
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added ActionPlayWithSfx and ActionSfx
Changed paths:
A engines/pink/objects/actions/action_play_with_sfx.cpp
A engines/pink/objects/actions/action_play_with_sfx.h
engines/pink/module.mk
diff --git a/engines/pink/module.mk b/engines/pink/module.mk
index 3880787..a1996dd 100644
--- a/engines/pink/module.mk
+++ b/engines/pink/module.mk
@@ -20,6 +20,7 @@ MODULE_OBJS = \
objects/actions/action_hide.o \
objects/actions/action_loop.o \
objects/actions/action_play.o \
+ objects/actions/action_play_with_sfx.o \
objects/actions/action_sound.o \
objects/actions/action_still.o \
objects/actions/action_talk.o \
diff --git a/engines/pink/objects/actions/action_play_with_sfx.cpp b/engines/pink/objects/actions/action_play_with_sfx.cpp
new file mode 100644
index 0000000..9e4767d
--- /dev/null
+++ b/engines/pink/objects/actions/action_play_with_sfx.cpp
@@ -0,0 +1,50 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "action_play_with_sfx.h"
+#include <pink/archive.h>
+#include <common/debug.h>
+
+namespace Pink {
+
+void Pink::ActionPlayWithSfx::deserialize(Pink::Archive &archive) {
+ ActionPlay::deserialize(archive);
+ archive >> _isLoop >> _sfxArray;
+}
+
+void Pink::ActionPlayWithSfx::toConsole() {
+ debug("\tActionPlayWithSfx: _name = %s, _fileName = %s, z = %u, _startFrame = %u,"
+ " _endFrame = %u, _isLoop = %u", _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame);
+ for (int i = 0; i < _sfxArray.size(); ++i) {
+ _sfxArray[i]->toConsole();
+ }
+}
+
+void Pink::ActionSfx::deserialize(Pink::Archive &archive) {
+ archive >> _sfx >> _volume >> _frame;
+}
+
+void Pink::ActionSfx::toConsole() {
+ debug("\t\tActionSfx: _name = %s, _volume = %u, _frame = %u");
+}
+
+} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/actions/action_play_with_sfx.h b/engines/pink/objects/actions/action_play_with_sfx.h
new file mode 100644
index 0000000..0a9307b
--- /dev/null
+++ b/engines/pink/objects/actions/action_play_with_sfx.h
@@ -0,0 +1,55 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_ACTION_PLAY_WITH_SFX_H
+#define PINK_ACTION_PLAY_WITH_SFX_H
+
+#include <common/array.h>
+#include "action_play.h"
+
+namespace Pink {
+
+class ActionSfx;
+
+class ActionPlayWithSfx : ActionPlay {
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
+
+private:
+ uint32 _isLoop;
+ Common::Array<ActionSfx*> _sfxArray;
+};
+
+class ActionSfx : Object {
+public:
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
+
+private:
+ Common::String _sfx;
+ uint32 _volume;
+ uint32 _frame;
+};
+
+}
+
+#endif
Commit: f29b0a8f35cc46b4c52a9da248493bcad8ce81ce
https://github.com/scummvm/scummvm/commit/f29b0a8f35cc46b4c52a9da248493bcad8ce81ce
Author: whiterandrek (whiteradnrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added ActionText
Changed paths:
A engines/pink/objects/actions/action_text.cpp
A engines/pink/objects/actions/action_text.h
engines/pink/module.mk
diff --git a/engines/pink/module.mk b/engines/pink/module.mk
index a1996dd..ca8812d 100644
--- a/engines/pink/module.mk
+++ b/engines/pink/module.mk
@@ -24,6 +24,7 @@ MODULE_OBJS = \
objects/actions/action_sound.o \
objects/actions/action_still.o \
objects/actions/action_talk.o \
+ objects/actions/action_text.o \
objects/actions/walk_action.o \
objects/actors/actor.o \
objects/actors/lead_actor.o \
diff --git a/engines/pink/objects/actions/action_text.cpp b/engines/pink/objects/actions/action_text.cpp
new file mode 100644
index 0000000..ef21ef3
--- /dev/null
+++ b/engines/pink/objects/actions/action_text.cpp
@@ -0,0 +1,45 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "action_text.h"
+#include <pink/archive.h>
+#include <common/debug.h>
+
+namespace Pink {
+
+void ActionText::deserialize(Archive &archive) {
+ for (int i = 0; i < 4 ; ++i) {
+ archive >> _bounds[i];
+ }
+ archive >> _centered >> _scrollBar
+ >> _textColor >> _backgroundColor;
+}
+
+void ActionText::toConsole() {
+ debug("\tActionText: _name = %s, _text = %s, "
+ "_bound0 = %u, _bound1 = %u, _bound2 = %u, _bound3 = %u _centered = %u, _scrollBar = %u, _textColor = %u _backgroundColor = %u",
+ _name.c_str(), _text.c_str(), _bounds[0], _bounds[1], _bounds[2], _bounds[3], _centered, _scrollBar, _textColor, _backgroundColor);
+}
+
+
+
+}
\ No newline at end of file
diff --git a/engines/pink/objects/actions/action_text.h b/engines/pink/objects/actions/action_text.h
new file mode 100644
index 0000000..e988254
--- /dev/null
+++ b/engines/pink/objects/actions/action_text.h
@@ -0,0 +1,47 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_ACTION_TEXT_H
+#define PINK_ACTION_TEXT_H
+
+#include "action.h"
+
+namespace Pink {
+
+class ActionText : public Action {
+public:
+ void deserialize(Archive &archive) override;
+
+ void toConsole() override;
+
+private:
+ Common::String _text;
+ uint32 _bounds[4];
+ uint32 _centered;
+ uint32 _scrollBar;
+ uint32 _textColor;
+ uint32 _backgroundColor;
+};
+
+} // End of namespace Pink
+
+#endif
Commit: 72dd7fae8b1bd3236371d3fb2b7621d91de291c4
https://github.com/scummvm/scummvm/commit/72dd7fae8b1bd3236371d3fb2b7621d91de291c4
Author: whiterandrek (whiteradnrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fixed missing arguments
Changed paths:
engines/pink/objects/actors/supporting_actor.cpp
diff --git a/engines/pink/objects/actors/supporting_actor.cpp b/engines/pink/objects/actors/supporting_actor.cpp
index 8e023bd..2cffbf1 100644
--- a/engines/pink/objects/actors/supporting_actor.cpp
+++ b/engines/pink/objects/actors/supporting_actor.cpp
@@ -34,7 +34,8 @@ void SupportingActor::deserialize(Archive &archive) {
}
void SupportingActor::toConsole() {
- debug("SupportingActor: _name = %s, _location=%s, _pdaLink=%s, _cursor=%s", _name.c_str());
+ debug("SupportingActor: _name = %s, _location=%s, _pdaLink=%s, _cursor=%s",
+ _name.c_str(), _location.c_str(), _pdaLink.c_str(), _cursor.c_str());
for (int i = 0; i < _actions.size(); ++i) {
_actions[i]->toConsole();
}
Commit: 2b1bc0900acf9e9eeeb8ce9e89e80e2c9aec5180
https://github.com/scummvm/scummvm/commit/2b1bc0900acf9e9eeeb8ce9e89e80e2c9aec5180
Author: whiterandrek (whiteradnrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added CursorActor
Changed paths:
A engines/pink/objects/actors/cursor_actor.h
diff --git a/engines/pink/objects/actors/cursor_actor.h b/engines/pink/objects/actors/cursor_actor.h
new file mode 100644
index 0000000..07616a2
--- /dev/null
+++ b/engines/pink/objects/actors/cursor_actor.h
@@ -0,0 +1,45 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_CURSOR_ACTOR_H
+#define PINK_CURSOR_ACTOR_H
+
+#include <common/debug.h>
+#include <pink/objects/actions/action.h>
+#include "actor.h"
+
+namespace Pink {
+
+//same as actor
+class CursorActor : public Actor {
+public:
+ void toConsole() {
+ debug("CursorActor: _name = %s", _name.c_str());
+ for (int i = 0; i < _actions.size(); ++i) {
+ _actions[i]->toConsole();
+ }
+ }
+};
+
+}
+
+#endif
Commit: f8de0028f23fcd41c64230acfb810572ed50f3f7
https://github.com/scummvm/scummvm/commit/f8de0028f23fcd41c64230acfb810572ed50f3f7
Author: whiterandrek (whiteradnrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added all missing objects to factory method. Unimplemented classes are commented out
Changed paths:
engines/pink/archive.cpp
engines/pink/cursor_mgr.h
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp
index 0316581..0d7155a 100644
--- a/engines/pink/archive.cpp
+++ b/engines/pink/archive.cpp
@@ -35,6 +35,15 @@
#include <engines/pink/objects/actions/action_sound.h>
#include <engines/pink/objects/actions/action_hide.h>
#include <engines/pink/objects/walk/walk_location.h>
+#include <engines/pink/objects/actions/walk_action.h>
+#include <engines/pink/objects/actors/supporting_actor.h>
+#include <engines/pink/objects/sequences/seq_timer.h>
+#include <engines/pink/objects/actions/action_loop.h>
+#include <engines/pink/objects/actions/action_play_with_sfx.h>
+#include <engines/pink/objects/actions/action_talk.h>
+#include <engines/pink/objects/actions/action_text.h>
+#include <engines/pink/objects/actors/cursor_actor.h>
+#include <engines/pink/objects/handlers/handler_timer.h>
namespace Pink {
@@ -68,6 +77,8 @@ enum {
kHandlerLeftClick,
kHandlerStartPage,
kHandlerTimer,
+ kHandlerTimerActions,
+ kHandlerTimerSequences,
kHandlerUseClick,
kInventoryActor,
kInventoryItem,
@@ -122,6 +133,8 @@ static const struct RuntimeClass {
{"HandlerLeftClick", kHandlerLeftClick},
{"HandlerStartPage", kHandlerStartPage},
{"HandlerTimer", kHandlerTimer},
+ {"HandlerTimerActions", kHandlerTimerActions},
+ {"HandlerTimerSequences", kHandlerTimerSequences},
{"HandlerUseClick", kHandlerUseClick},
{"InventoryActor", kInventoryActor},
{"InventoryItem", kInventoryItem},
@@ -153,36 +166,102 @@ static Object* createObject(int objectId){
switch (objectId){
case kActionHide:
return new ActionHide;
+ case kActionLoop:
+ return new ActionLoop;
case kActionPlay:
return new ActionPlay;
+ case kActionPlayWithSfx:
+ return new ActionPlayWithSfx;
+ case kActionSfx:
+ return new ActionSfx;
case kActionSound:
return new ActionSound;
case kActionStill:
return new ActionStill;
+ case kActionTalk:
+ return new ActionTalk;
+ case kActionText:
+ return new ActionText;
case kActor:
return new Actor;
+ //case kAudioInfoPDAButton:
+ // return new AudioInfoPDAButton;
+ case kConditionGameVariable:
+ return new ConditionGameVariable;
+ case kConditionInventoryItemOwner:
+ return new ConditionInventoryItemOwner;
+ case kConditionModuleVariable:
+ return new ConditionModuleVariable;
+ case kConditionNotInventoryItemOwner:
+ return new ConditionNotInventoryItemOwner;
+ case kConditionNotModuleVariable:
+ return new ConditionNotModuleVariable;
+ case kConditionNotPageVariable:
+ return new ConditionNotPageVariable;
+ case kConditionPageVariable:
+ return new ConditionPageVariable;
+ case kCursorActor:
+ return new CursorActor;
case kGamePage:
return new GamePage;
+ case kHandlerLeftClick:
+ return new HandlerLeftClick;
case kHandlerStartPage:
return new HandlerStartPage;
+ case kHandlerTimer:
+ return new HandlerTimer;
+ case kHandlerTimerActions:
+ return new HandlerTimerActions;
+ case kHandlerTimerSequences:
+ return new HandlerTimerSequences;
+ case kHandlerUseClick:
+ return new HandlerUseClick;
+ //case kInventoryActor:
+ // return new InventoryActor;
case kInventoryItem:
return new InventoryItem;
case kLeadActor:
return new LeadActor;
case kModuleProxy:
return new ModuleProxy;
+ //case kPDAButtonActor:
+ // return new PDAButtonActor;
+ //case kParlSqPink:
+ // return new ParlSqPink;
+ //case kPubPink:
+ // return new PubPink;
+ case kSeqTimer:
+ return new SeqTimer;
case kSequence:
return new Sequence;
+ //case kSequenceAudio:
+ // return new SequenceAudio;
case kSequenceItem:
return new SequenceItem;
case kSequenceItemDefaultAction:
return new SequenceItemDefaultAction;
case kSequenceItemLeader:
return new SequenceItemLeader;
+ case kSequenceItemLeaderAudio:
+ return new SequenceItemLeaderAudio;
case kSideEffectExit:
return new SideEffectExit;
+ case kSideEffectGameVariable:
+ return new SideEffectGameVariable;
+ case kSideEffectInventoryItemOwner:
+ return new SideEffectInventoryItemOwner;
+ case kSideEffectLocation:
+ return new SideEffectLocation;
case kSideEffectModuleVariable:
return new SideEffectModuleVariable;
+ case kSideEffectPageVariable:
+ return new SideEffectPageVariable;
+ case kSideEffectRandomPageVariable:
+ return new SideEffectRandomPageVariable;
+ case kSupportingActor:
+ return new SupportingActor;
+ case kWalkAction:
+ return new WalkAction;
case kWalkLocation:
return new WalkLocation;
default:
diff --git a/engines/pink/cursor_mgr.h b/engines/pink/cursor_mgr.h
index fac7c2e..bd5c17c 100644
--- a/engines/pink/cursor_mgr.h
+++ b/engines/pink/cursor_mgr.h
@@ -34,6 +34,7 @@ class CursorMgr : public Object {
public:
CursorMgr(GamePage *page);
+
private:
Actor *_actor;
GamePage *_page;
Commit: 7f5e2e69e81045f37833375c6d6e27dcc2e295fb
https://github.com/scummvm/scummvm/commit/7f5e2e69e81045f37833375c6d6e27dcc2e295fb
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added ParlSqPink and PubPink
Changed paths:
engines/pink/archive.cpp
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/actors/lead_actor.h
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp
index 0d7155a..0690454 100644
--- a/engines/pink/archive.cpp
+++ b/engines/pink/archive.cpp
@@ -226,10 +226,10 @@ static Object* createObject(int objectId){
return new ModuleProxy;
//case kPDAButtonActor:
// return new PDAButtonActor;
- //case kParlSqPink:
- // return new ParlSqPink;
- //case kPubPink:
- // return new PubPink;
+ case kParlSqPink:
+ return new ParlSqPink;
+ case kPubPink:
+ return new PubPink;
case kSeqTimer:
return new SeqTimer;
case kSequence:
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 8e7411e..88c579c 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -64,4 +64,18 @@ LeadActor::State LeadActor::getState() const {
return _state;
}
+void ParlSqPink::toConsole() {
+ debug("ParlSqPink: _name = %s", _name.c_str());
+ for (int i = 0; i < _actions.size(); ++i) {
+ _actions[i]->toConsole();
+ }
+}
+
+void PubPink::toConsole() {
+ debug("PubPink: _name = %s", _name.c_str());
+ for (int i = 0; i < _actions.size(); ++i) {
+ _actions[i]->toConsole();
+ }
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index 30c0a50..b511f40 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -60,6 +60,18 @@ private:
Sequencer *_sequencer;
};
+
+class ParlSqPink : public LeadActor {
+public:
+ void toConsole();
+};
+
+class PubPink : public LeadActor {
+public:
+ void toConsole();
+};
+
+
} // End of namespace Pink
#endif
Commit: 26f2ff66402d6469b34b627278bcd2678a7f9119
https://github.com/scummvm/scummvm/commit/26f2ff66402d6469b34b627278bcd2678a7f9119
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added InventoryActor and SequenceAudio
Changed paths:
A engines/pink/objects/actors/inventory_actor.h
engines/pink/archive.cpp
engines/pink/module.mk
engines/pink/objects/sequences/sequence.cpp
engines/pink/objects/sequences/sequence.h
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp
index 0690454..6bd2959 100644
--- a/engines/pink/archive.cpp
+++ b/engines/pink/archive.cpp
@@ -44,6 +44,7 @@
#include <engines/pink/objects/actions/action_text.h>
#include <engines/pink/objects/actors/cursor_actor.h>
#include <engines/pink/objects/handlers/handler_timer.h>
+#include <engines/pink/objects/actors/inventory_actor.h>
namespace Pink {
@@ -184,8 +185,8 @@ static Object* createObject(int objectId){
return new ActionText;
case kActor:
return new Actor;
- //case kAudioInfoPDAButton:
- // return new AudioInfoPDAButton;
+ case kAudioInfoPDAButton:
+ // return new AudioInfoPDAButton;
case kConditionGameVariable:
return new ConditionGameVariable;
case kConditionInventoryItemOwner:
@@ -216,16 +217,16 @@ static Object* createObject(int objectId){
return new HandlerTimerSequences;
case kHandlerUseClick:
return new HandlerUseClick;
- //case kInventoryActor:
- // return new InventoryActor;
+ case kInventoryActor:
+ return new InventoryActor;
case kInventoryItem:
return new InventoryItem;
case kLeadActor:
return new LeadActor;
case kModuleProxy:
return new ModuleProxy;
- //case kPDAButtonActor:
- // return new PDAButtonActor;
+ case kPDAButtonActor:
+ //return new PDAButtonActor;
case kParlSqPink:
return new ParlSqPink;
case kPubPink:
@@ -234,8 +235,8 @@ static Object* createObject(int objectId){
return new SeqTimer;
case kSequence:
return new Sequence;
- //case kSequenceAudio:
- // return new SequenceAudio;
+ case kSequenceAudio:
+ return new SequenceAudio;
case kSequenceItem:
return new SequenceItem;
case kSequenceItemDefaultAction:
diff --git a/engines/pink/module.mk b/engines/pink/module.mk
index ca8812d..ff38c8a 100644
--- a/engines/pink/module.mk
+++ b/engines/pink/module.mk
@@ -34,6 +34,7 @@ MODULE_OBJS = \
objects/handlers/handler_timer.o \
objects/pages/page.o \
objects/pages/game_page.o \
+ objects/sequences/seq_timer.o \
objects/sequences/sequence.o \
objects/sequences/sequence_item.o \
objects/sequences/sequencer.o \
@@ -41,7 +42,7 @@ MODULE_OBJS = \
objects/walk/walk_location.o \
# This module can be built as a plugin
-ifeq ($(ENABLE_PLUMBERS), DYNAMIC_PLUGIN)
+ifeq ($(ENABLE_PINK), DYNAMIC_PLUGIN)
PLUGIN := 1
endif
diff --git a/engines/pink/objects/actors/inventory_actor.h b/engines/pink/objects/actors/inventory_actor.h
new file mode 100644
index 0000000..4b2b424
--- /dev/null
+++ b/engines/pink/objects/actors/inventory_actor.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_INVENTORY_ACTOR_H
+#define PINK_INVENTORY_ACTOR_H
+
+#include <pink/objects/actions/action.h>
+#include <common/debug.h>
+#include "actor.h"
+
+namespace Pink {
+
+class InventoryActor : public Actor {
+public:
+ void toConsole() {
+ debug("CursorActor: _name = %s", _name.c_str());
+ for (int i = 0; i < _actions.size(); ++i) {
+ _actions[i]->toConsole();
+ }
+ }
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp
index bad9621..984da5e 100644
--- a/engines/pink/objects/sequences/sequence.cpp
+++ b/engines/pink/objects/sequences/sequence.cpp
@@ -107,6 +107,21 @@ void Sequence::start(int unk) {
_context->_unk++;
}
+void SequenceAudio::deserialize(Archive &archive) {
+ Sequence::deserialize(archive);
+ archive >> _sound;
+}
+
+void SequenceAudio::toConsole() {
+ debug("\t\tSequenceAudio %s : _sound = %s", _name.c_str(), _sound.c_str());
+ debug("\t\t\tItems:");
+ for (int i = 0; i < _items.size(); ++i) {
+ _items[i]->toConsole();
+ }
+}
+
+
+
SequenceContext::SequenceContext(Sequence *sequence, Sequencer *sequencer)
: _sequence(sequence), _sequencer(sequencer),
_nextItemIndex(0), _unk(1), _actor(nullptr)
diff --git a/engines/pink/objects/sequences/sequence.h b/engines/pink/objects/sequences/sequence.h
index bdf11b2..a5522da 100644
--- a/engines/pink/objects/sequences/sequence.h
+++ b/engines/pink/objects/sequences/sequence.h
@@ -54,6 +54,17 @@ public:
};
+class SequenceAudio : public Sequence {
+public:
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
+
+private:
+ Common::String _sound;
+ int _unk1;
+ int _unk2;
+};
+
class SequenceActorState {
public:
SequenceActorState(const Common::String &name);
Commit: bba35c5f2c71aa8c83c7ba9180f08ce7f609c911
https://github.com/scummvm/scummvm/commit/bba35c5f2c71aa8c83c7ba9180f08ce7f609c911
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Started implementation of Director class . For now engine can play logo scene, but sprites are at wrong positions because decoder doesn't support getting coordinates from CEL
Changed paths:
A engines/pink/cel_decoder.cpp
A engines/pink/cel_decoder.h
A engines/pink/objects/sequences/sequence_context.cpp
A engines/pink/objects/sequences/sequence_context.h
engines/pink/director.cpp
engines/pink/director.h
engines/pink/module.mk
engines/pink/objects/actions/action.h
engines/pink/objects/actions/action_cel.cpp
engines/pink/objects/actions/action_cel.h
engines/pink/objects/actions/action_hide.h
engines/pink/objects/actions/action_play.cpp
engines/pink/objects/actions/action_play.h
engines/pink/objects/actions/action_play_with_sfx.h
engines/pink/objects/actions/action_still.cpp
engines/pink/objects/actions/action_still.h
engines/pink/objects/actors/actor.cpp
engines/pink/objects/actors/actor.h
engines/pink/objects/actors/lead_actor.h
engines/pink/objects/handlers/handler_timer.cpp
engines/pink/objects/handlers/handler_timer.h
engines/pink/objects/pages/game_page.cpp
engines/pink/objects/pages/page.cpp
engines/pink/objects/pages/page.h
engines/pink/objects/sequences/sequence.cpp
engines/pink/objects/sequences/sequence.h
engines/pink/objects/sequences/sequence_item.cpp
engines/pink/objects/sequences/sequence_item.h
engines/pink/objects/sequences/sequencer.cpp
engines/pink/pink.cpp
engines/pink/pink.h
engines/pink/resource_mgr.cpp
engines/pink/resource_mgr.h
diff --git a/engines/pink/cel_decoder.cpp b/engines/pink/cel_decoder.cpp
new file mode 100644
index 0000000..5d20e41
--- /dev/null
+++ b/engines/pink/cel_decoder.cpp
@@ -0,0 +1,25 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+namespace Pink {
+
+}
\ No newline at end of file
diff --git a/engines/pink/cel_decoder.h b/engines/pink/cel_decoder.h
new file mode 100644
index 0000000..0e8d612
--- /dev/null
+++ b/engines/pink/cel_decoder.h
@@ -0,0 +1,38 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_CEL_DECODER_H
+#define PINK_CEL_DECODER_H
+
+
+#include <video/flic_decoder.h>
+
+namespace Pink {
+
+class CelDecoder : public Video::FlicDecoder {
+
+
+};
+
+}
+
+#endif
diff --git a/engines/pink/director.cpp b/engines/pink/director.cpp
index e34e0bc..cdc60c8 100644
--- a/engines/pink/director.cpp
+++ b/engines/pink/director.cpp
@@ -20,7 +20,44 @@
*
*/
+#include "director.h"
+#include <engines/pink/objects/actions/action_cel.h>
+#include "graphics/surface.h"
+#include "graphics/palette.h"
+
namespace Pink {
+Director::Director(OSystem *system)
+ : _system(system) {}
+
+void Director::draw() {
+ bool needUpdate = 0;
+ for (int i = 0; i < _sprites.size(); ++i) {
+ Video::FlicDecoder *decoder = _sprites[i]->getDecoder();
+ if (decoder->needsUpdate()) {
+ const Graphics::Surface *surface = decoder->decodeNextFrame();
+ _system->copyRectToScreen(surface->getPixels(), surface->pitch, 0, 0, surface->w, surface->h);
+ needUpdate = 1;
+ }
+ }
+ if (needUpdate)
+ _system->updateScreen();
+}
+
+void Director::addSprite(ActionCEL *sprite) {
+ _sprites.push_back(sprite); //TODO impl sorting
+}
+
+void Director::removeSprite(ActionCEL *sprite) {
+ for (int i = 0; i < _sprites.size(); ++i) {
+ if (sprite == _sprites[i]) {
+ _sprites.remove_at(i);
+ break;
+ }
+ }
+}
+void Director::setPallette(const byte *pallete) {
+ _system->getPaletteManager()->setPalette(pallete, 0, 256);
+}
}
\ No newline at end of file
diff --git a/engines/pink/director.h b/engines/pink/director.h
index 8821649..0bd44f4 100644
--- a/engines/pink/director.h
+++ b/engines/pink/director.h
@@ -23,16 +23,28 @@
#ifndef PINK_DIRECTOR_H
#define PINK_DIRECTOR_H
+#include <common/array.h>
+#include <common/system.h>
+
namespace Pink {
+class ActionCEL;
+
class Director {
public:
+ Director(OSystem *system);
//void addSoundObject();
//void removeSound();
//void updateSoundAction
- //CActor *getActorByCoords();
-private:
+ //CActor *getActorByCoords()
+ void draw();
+ void addSprite(ActionCEL *sprite);
+ void removeSprite(ActionCEL *sprite);
+ void setPallette(const byte *pallete);
+private:
+ OSystem *_system;
+ Common::Array<ActionCEL*> _sprites;
};
} // End of namespace Pink
diff --git a/engines/pink/module.mk b/engines/pink/module.mk
index ff38c8a..1b83373 100644
--- a/engines/pink/module.mk
+++ b/engines/pink/module.mk
@@ -36,6 +36,7 @@ MODULE_OBJS = \
objects/pages/game_page.o \
objects/sequences/seq_timer.o \
objects/sequences/sequence.o \
+ objects/sequences/sequence_context.o \
objects/sequences/sequence_item.o \
objects/sequences/sequencer.o \
objects/walk/walk_mgr.o \
diff --git a/engines/pink/objects/actions/action.h b/engines/pink/objects/actions/action.h
index 5b164a3..3b79be2 100644
--- a/engines/pink/objects/actions/action.h
+++ b/engines/pink/objects/actions/action.h
@@ -28,6 +28,7 @@
namespace Pink {
class Actor;
+class Director;
class Action : public NamedObject {
public:
@@ -37,6 +38,8 @@ public:
virtual void update() {};
virtual void toConsole() {};
+ virtual bool initPallete(Director *director) { return 0;}
+
protected:
Actor *_actor;
};
diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp
index f1c3504..5385386 100644
--- a/engines/pink/objects/actions/action_cel.cpp
+++ b/engines/pink/objects/actions/action_cel.cpp
@@ -22,13 +22,49 @@
#include <common/debug.h>
#include "action_cel.h"
+#include <pink/objects/actors/actor.h>
#include "engines/pink/archive.h"
+#include "engines/pink/objects/pages/game_page.h"
+#include "pink/pink.h"
namespace Pink {
+ActionCEL::ActionCEL()
+ : _flicDecoder(nullptr) {
+
+}
+
void ActionCEL::deserialize(Archive &archive) {
Action::deserialize(archive);
archive >> _fileName >> _z;
}
+void ActionCEL::start(bool unk) {
+ if (!_flicDecoder)
+ _flicDecoder = _actor->getPage()->loadCel(_fileName);
+ _actor->getPage()->getGame()->getDirector()->addSprite(this);
+ this->onStart();
+}
+
+void ActionCEL::end() {
+ _actor->getPage()->getGame()->getDirector()->removeSprite(this);
+ delete _flicDecoder;
+ _flicDecoder = nullptr;
+}
+
+uint32 ActionCEL::getZ() {
+ return _z;
+}
+
+Video::FlicDecoder *ActionCEL::getDecoder() {
+ return _flicDecoder;
+}
+
+bool ActionCEL::initPallete(Director *director) {
+ _flicDecoder = _actor->getPage()->loadCel(_fileName);
+ _flicDecoder->decodeNextFrame();
+ director->setPallette(_flicDecoder->getPalette());
+ return 1;
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/actions/action_cel.h b/engines/pink/objects/actions/action_cel.h
index 8c6a61a..92986fb 100644
--- a/engines/pink/objects/actions/action_cel.h
+++ b/engines/pink/objects/actions/action_cel.h
@@ -23,15 +23,26 @@
#ifndef PINK_ACTION_CEL_H
#define PINK_ACTION_CEL_H
+#include <video/flic_decoder.h>
#include "action.h"
namespace Pink {
class ActionCEL : public Action {
public:
+ ActionCEL();
virtual void deserialize(Archive &archive);
+ virtual void start(bool unk);
+ virtual void end();
+
+ uint32 getZ();
+ Video::FlicDecoder *getDecoder();
+
+ virtual bool initPallete(Director *director);
protected:
+ virtual void onStart() {} ;
+ Video::FlicDecoder *_flicDecoder;
Common::String _fileName;
uint32 _z;
};
diff --git a/engines/pink/objects/actions/action_hide.h b/engines/pink/objects/actions/action_hide.h
index 2e52fdc..414d077 100644
--- a/engines/pink/objects/actions/action_hide.h
+++ b/engines/pink/objects/actions/action_hide.h
@@ -30,10 +30,9 @@ namespace Pink {
class ActionHide : public Action {
public:
virtual void deserialize(Archive &archive);
-
virtual void toConsole();
- virtual void start(bool unk_startNow);
+ virtual void start(bool unk);
virtual void end();
};
diff --git a/engines/pink/objects/actions/action_play.cpp b/engines/pink/objects/actions/action_play.cpp
index 051f3c4..3945fe6 100644
--- a/engines/pink/objects/actions/action_play.cpp
+++ b/engines/pink/objects/actions/action_play.cpp
@@ -37,12 +37,17 @@ void ActionPlay::toConsole() {
" _endFrame = %u", _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame);
}
-void ActionPlay::start(bool unk) {
- debug("Actor %s has now ActionPlay %s", _actor->getName().c_str(), _name.c_str());
-}
-
void ActionPlay::end() {
+ ActionCEL::end();
debug("ActionPlay %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
}
+void ActionPlay::onStart() {
+ debug("Actor %s has now ActionPlay %s", _actor->getName().c_str(), _name.c_str());
+ _flicDecoder->seekToFrame(_startFrame);
+ if (_stopFrame != -1)
+ _flicDecoder->setEndFrame(_stopFrame);
+ _flicDecoder->start();
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_play.h b/engines/pink/objects/actions/action_play.h
index f5c6357..a2f0ae3 100644
--- a/engines/pink/objects/actions/action_play.h
+++ b/engines/pink/objects/actions/action_play.h
@@ -33,10 +33,11 @@ public:
virtual void deserialize(Archive &archive);
virtual void toConsole();
- virtual void start(bool unk);
virtual void end();
protected:
+ virtual void onStart();
+
uint32 _stopFrame;
};
diff --git a/engines/pink/objects/actions/action_play_with_sfx.h b/engines/pink/objects/actions/action_play_with_sfx.h
index 0a9307b..6a10edd 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.h
+++ b/engines/pink/objects/actions/action_play_with_sfx.h
@@ -30,7 +30,7 @@ namespace Pink {
class ActionSfx;
-class ActionPlayWithSfx : ActionPlay {
+class ActionPlayWithSfx : public ActionPlay {
virtual void deserialize(Archive &archive);
virtual void toConsole();
@@ -39,7 +39,7 @@ private:
Common::Array<ActionSfx*> _sfxArray;
};
-class ActionSfx : Object {
+class ActionSfx : public Object {
public:
virtual void deserialize(Archive &archive);
virtual void toConsole();
diff --git a/engines/pink/objects/actions/action_still.cpp b/engines/pink/objects/actions/action_still.cpp
index ca5793b..8e90c83 100644
--- a/engines/pink/objects/actions/action_still.cpp
+++ b/engines/pink/objects/actions/action_still.cpp
@@ -37,12 +37,14 @@ void ActionStill::toConsole() {
_name.c_str(), _fileName.c_str(), _startFrame);
}
-void ActionStill::start(bool unk) {
- debug("Actor %s has now ActionStill %s", _actor->getName().c_str(), _name.c_str());
-}
-
void ActionStill::end() {
+ ActionCEL::end();
debug("ActionStill %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
}
+void ActionStill::onStart() {
+ debug("Actor %s has now ActionStill %s", _actor->getName().c_str(), _name.c_str());
+ _flicDecoder->seekToFrame(_startFrame);
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/actions/action_still.h b/engines/pink/objects/actions/action_still.h
index d777061..7568c9b 100644
--- a/engines/pink/objects/actions/action_still.h
+++ b/engines/pink/objects/actions/action_still.h
@@ -32,11 +32,11 @@ public:
virtual void deserialize(Archive &archive);
virtual void toConsole();
- virtual void start(bool unk);
-
virtual void end();
protected:
+ virtual void onStart();
+
uint32 _startFrame;
};
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index 14faae1..e612c83 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -61,10 +61,10 @@ void Actor::init(bool unk) {
}
if (!_action) {
- _isActionEnd = 1;
+ _isActionEnded = 1;
}
else {
- _isActionEnd = 0;
+ _isActionEnded = 0;
_action->start(unk);
}
}
@@ -74,7 +74,7 @@ void Actor::hide() {
}
void Actor::endAction() {
- _isActionEnd = 1;
+ _isActionEnded = 1;
}
void Actor::setAction(const Common::String &name) {
@@ -84,11 +84,11 @@ void Actor::setAction(const Common::String &name) {
void Actor::setAction(Action *newAction) {
if (_action) {
- _isActionEnd = 1;
+ _isActionEnded = 1;
_action->end();
}
if (newAction) {
- _isActionEnd = 0;
+ _isActionEnded = 0;
_action = newAction;
_action->start(0);
}
@@ -97,7 +97,7 @@ void Actor::setAction(Action *newAction) {
void Actor::setAction(Action *newAction, bool unk) {
if (unk){
assert(0); // want to see this
- _isActionEnd = 1;
+ _isActionEnded = 1;
_action = newAction;
}
else setAction(newAction);
@@ -108,7 +108,14 @@ Action *Actor::getAction() const {
}
bool Actor::isPlaying() {
- return _isActionEnd;
+ return _isActionEnded;
+}
+
+bool Actor::initPallete(Director *director) {
+ for (int i = 0; i < _actions.size(); ++i) {
+ if (_actions[i]->initPallete(director))
+ break;
+ }
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/actor.h b/engines/pink/objects/actors/actor.h
index 7bd65b3..dd75183 100644
--- a/engines/pink/objects/actors/actor.h
+++ b/engines/pink/objects/actors/actor.h
@@ -31,12 +31,13 @@ namespace Pink {
class GamePage;
class Action;
class Sequencer;
+class Director;
class Actor : public NamedObject {
public:
Actor()
: _page(nullptr), _action(nullptr),
- _isActionEnd(1)
+ _isActionEnded(1)
{};
virtual void deserialize(Archive &archive);
@@ -46,7 +47,6 @@ public:
GamePage *getPage() const;
Action *getAction() const;
-
bool isPlaying();
virtual void init(bool unk);
void hide();
@@ -57,11 +57,13 @@ public:
void setAction(Action *newAction);
void setAction(Action *newAction, bool unk);
+ bool initPallete(Director *director);
+
protected:
GamePage *_page;
Action *_action;
Common::Array<Action*> _actions;
- bool _isActionEnd;
+ bool _isActionEnded;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index b511f40..319c3f7 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -53,6 +53,8 @@ public:
State getState() const;
+ void start(bool isHandler);
+
private:
State _state;
CursorMgr *_cursorMgr;
diff --git a/engines/pink/objects/handlers/handler_timer.cpp b/engines/pink/objects/handlers/handler_timer.cpp
index 4954f01..44d58c2 100644
--- a/engines/pink/objects/handlers/handler_timer.cpp
+++ b/engines/pink/objects/handlers/handler_timer.cpp
@@ -72,7 +72,7 @@ void HandlerTimerActions::onMessage(LeadActor *actor) {
}
-void HandlerTimerSequences::handle(LeadActor *actor) {
+void HandlerTimerSequences::handle(Sequence *sequence) {
debug("HandlerTimerSequences function is not implemented");
}
diff --git a/engines/pink/objects/handlers/handler_timer.h b/engines/pink/objects/handlers/handler_timer.h
index d40dd6f..1147431 100644
--- a/engines/pink/objects/handlers/handler_timer.h
+++ b/engines/pink/objects/handlers/handler_timer.h
@@ -52,8 +52,8 @@ private:
class HandlerTimerSequences : public HandlerSequences { //originally it was inherited from HandlerTimer
public:
virtual void toConsole();
-private:
- virtual void handle(LeadActor *actor); // very big and hard function
+protected:
+ virtual void handle(Sequence *sequence); // very big and hard function
};
} // End of namespace Pink
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index 16f918d..465b1fc 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -26,7 +26,7 @@
#include "engines/pink/cursor_mgr.h"
#include "engines/pink/objects/actors/lead_actor.h"
#include "engines/pink/objects/sequences/sequencer.h"
-
+#include "pink/pink.h"
namespace Pink {
@@ -59,7 +59,18 @@ void GamePage::init(bool isLoadingSave) {
toConsole();
- Page::init();
+ for (int j = 0; j < _actors.size(); ++j) {
+ if (_actors[j]->initPallete(_module->getGame()->getDirector()))
+ break;
+ }
+
+
+ LeadActor::State state = _leadActor->getState();
+ bool unk = (state == LeadActor::kInventory || state == LeadActor::kPDA);
+
+ for (int i = 0; i < _actors.size(); ++i) {
+ _actors[i]->init(unk);
+ }
if (!isLoadingSave)
initHandler();
diff --git a/engines/pink/objects/pages/page.cpp b/engines/pink/objects/pages/page.cpp
index e7ea030..dc2bb43 100644
--- a/engines/pink/objects/pages/page.cpp
+++ b/engines/pink/objects/pages/page.cpp
@@ -44,6 +44,12 @@ Sound *Page::loadSound(Common::String &fileName) {
return _resMgr.loadSound(fileName);
}
+
+Video::FlicDecoder *Page::loadCel(Common::String &fileName) {
+ return _resMgr.loadCEL(fileName);
+}
+
+
void Page::toConsole() {
for (int i = 0; i < _actors.size(); ++i) {
_actors[i]->toConsole();
diff --git a/engines/pink/objects/pages/page.h b/engines/pink/objects/pages/page.h
index 208364c..5244ed9 100644
--- a/engines/pink/objects/pages/page.h
+++ b/engines/pink/objects/pages/page.h
@@ -23,6 +23,7 @@
#ifndef PINK_PAGE_H
#define PINK_PAGE_H
+#include <video/flic_decoder.h>
#include "engines/pink/objects/object.h"
#include "engines/pink/objects/module.h"
#include "engines/pink/resource_mgr.h"
@@ -39,6 +40,7 @@ public:
void load(Archive &archive);
Actor *findActor(Common::String &name);
Sound* loadSound(Common::String &fileName);
+ Video::FlicDecoder *loadCel(Common::String &fileName);
virtual void toConsole();
diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp
index 984da5e..efc0c01 100644
--- a/engines/pink/objects/sequences/sequence.cpp
+++ b/engines/pink/objects/sequences/sequence.cpp
@@ -27,6 +27,7 @@
#include "engines/pink/archive.h"
#include "engines/pink/objects/pages/game_page.h"
#include "engines/pink/objects/actors/actor.h"
+#include "sequence_context.h"
namespace Pink {
@@ -77,7 +78,7 @@ void Sequence::start(int unk) {
return;
}
- if (!_items[_context->_nextItemIndex]->execute(_context->_unk, this, unk)){
+ if (!_items[_context->_nextItemIndex]->execute(_context->_index, this, unk)){
//destroy context;
}
@@ -85,26 +86,16 @@ void Sequence::start(int unk) {
for (i = _context->_nextItemIndex + 1; i <_items.size(); ++i){
if (_items[i]->isLeader())
break;
- _items[i]->execute(_context->_unk, this, unk);
+ _items[i]->execute(_context->_index, this, unk);
}
_context->_nextItemIndex = i;
Common::Array<SequenceActorState> &states = _context->_states;
for (uint j = 0; j < states.size(); ++j) {
- if (states[j]._unk != _context->_unk &&
- !states[j]._actionName.empty()) {
- Actor *actor;
- Action *action;
- actor = _sequencer->_page->findActor(states[j]._actorName);
- assert(actor);
- action = actor->findAction(states[j]._actionName);
- assert(action);
- if (actor->getAction() != action)
- actor->setAction(action, unk);
- }
+ states[j].check(_context->_index, this, unk);
}
- _context->_unk++;
+ _context->_index++;
}
void SequenceAudio::deserialize(Archive &archive) {
@@ -120,41 +111,4 @@ void SequenceAudio::toConsole() {
}
}
-
-
-SequenceContext::SequenceContext(Sequence *sequence, Sequencer *sequencer)
- : _sequence(sequence), _sequencer(sequencer),
- _nextItemIndex(0), _unk(1), _actor(nullptr)
-{
- sequence->setContext(this);
- Common::Array<SequenceItem*> &items = sequence->getItems();
- debug("SequenceContext for %s", _sequence->getName().c_str());
-
- for (uint i = 0; i < items.size(); ++i) {
- bool found = 0;
- for (uint j = 0; j < _states.size(); ++j) {
- if (items[i]->getActor() == _states[j].getActor()){
- found = 1;
- break;
- }
- }
- if (!found) {
- debug(items[i]->getActor().c_str());
- _states.push_back({items[i]->getActor()});
- }
- }
-}
-
-SequenceContext::~SequenceContext() {
-
-}
-
-SequenceActorState::SequenceActorState(const Common::String &name)
- :_actorName(name), _unk(0)
-{}
-
-const Common::String &SequenceActorState::getActor() const {
- return _actorName;
-}
-
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/sequences/sequence.h b/engines/pink/objects/sequences/sequence.h
index a5522da..5fca545 100644
--- a/engines/pink/objects/sequences/sequence.h
+++ b/engines/pink/objects/sequences/sequence.h
@@ -46,6 +46,7 @@ public:
void init(int unk);
void start(int unk);
+
public:
SequenceContext *_context;
Sequencer *_sequencer;
@@ -65,34 +66,6 @@ private:
int _unk2;
};
-class SequenceActorState {
-public:
- SequenceActorState(const Common::String &name);
-
- const Common::String &getActor() const;
-
-public:
- Common::String _actorName;
- Common::String _actionName;
- int _unk;
-};
-
-class Actor;
-
-class SequenceContext {
-public:
- SequenceContext(Sequence *sequence, Sequencer* sequencer);
- ~SequenceContext();
-
-public:
- Sequence *_sequence;
- Sequencer *_sequencer;
- int _nextItemIndex;
- Actor *_actor;
- Common::Array<SequenceActorState> _states;
- int _unk;
-};
-
} // End of namespace Pink
#endif
diff --git a/engines/pink/objects/sequences/sequence_context.cpp b/engines/pink/objects/sequences/sequence_context.cpp
new file mode 100644
index 0000000..007213c
--- /dev/null
+++ b/engines/pink/objects/sequences/sequence_context.cpp
@@ -0,0 +1,74 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include <common/debug.h>
+#include "sequence_context.h"
+#include "sequence.h"
+#include "sequence_item.h"
+#include "sequencer.h"
+#include "engines/pink/objects/pages/game_page.h"
+#include "engines/pink/objects/actors/actor.h"
+
+namespace Pink {
+
+SequenceActorState::SequenceActorState(const Common::String &name)
+ :_actorName(name), _index(0)
+{}
+
+const Common::String &SequenceActorState::getActor() const {
+ return _actorName;
+}
+
+void SequenceActorState::check(int index, Sequence *sequence, bool unk) {
+ Actor *actor = sequence->_sequencer->_page->findActor(_actorName);
+ debug("%s %s", _actorName.c_str(), _actionName.c_str());
+ if (_index != index && !_actionName.empty()){
+ Action *action = actor->findAction(_actionName);
+ if (actor->getAction() != action)
+ actor->setAction(action, unk);
+ }
+}
+
+SequenceContext::SequenceContext(Sequence *sequence, Sequencer *sequencer)
+ : _sequence(sequence), _sequencer(sequencer),
+ _nextItemIndex(0), _index(1), _actor(nullptr)
+{
+ sequence->setContext(this);
+ Common::Array<SequenceItem*> &items = sequence->getItems();
+ debug("SequenceContext for %s", _sequence->getName().c_str());
+
+ for (uint i = 0; i < items.size(); ++i) {
+ bool found = 0;
+ for (uint j = 0; j < _states.size(); ++j) {
+ if (items[i]->getActor() == _states[j].getActor()){
+ found = 1;
+ break;
+ }
+ }
+ if (!found) {
+ debug(items[i]->getActor().c_str());
+ _states.push_back({items[i]->getActor()});
+ }
+ }
+}
+
+} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/sequences/sequence_context.h b/engines/pink/objects/sequences/sequence_context.h
new file mode 100644
index 0000000..0727127
--- /dev/null
+++ b/engines/pink/objects/sequences/sequence_context.h
@@ -0,0 +1,64 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_SEQUENCE_CONTEXT_H
+#define PINK_SEQUENCE_CONTEXT_H
+
+#include <common/array.h>
+
+namespace Pink {
+
+class Sequence;
+class Sequencer;
+
+class SequenceActorState {
+public:
+ SequenceActorState(const Common::String &name);
+
+ const Common::String &getActor() const;
+ void check(int index, Sequence *sequence, bool unk);
+
+public:
+ Common::String _actorName;
+ Common::String _actionName;
+ int _index;
+};
+
+class Actor;
+
+class SequenceContext {
+public:
+ SequenceContext(Sequence *sequence, Sequencer* sequencer);
+
+
+public:
+ Sequence *_sequence;
+ Sequencer *_sequencer;
+ int _nextItemIndex;
+ Actor *_actor;
+ Common::Array<SequenceActorState> _states;
+ int _index;
+};
+
+}
+
+#endif
diff --git a/engines/pink/objects/sequences/sequence_item.cpp b/engines/pink/objects/sequences/sequence_item.cpp
index 732424a..3644261 100644
--- a/engines/pink/objects/sequences/sequence_item.cpp
+++ b/engines/pink/objects/sequences/sequence_item.cpp
@@ -28,6 +28,7 @@
#include "engines/pink/archive.h"
#include "engines/pink/objects/pages/game_page.h"
#include "engines/pink/objects/actors/actor.h"
+#include "sequence_context.h"
namespace Pink {
@@ -47,7 +48,7 @@ const Common::String &SequenceItem::getAction() const {
return _action;
}
-bool SequenceItem::execute(int unk, Sequence *sequence, bool unk2) {
+bool SequenceItem::execute(int index, Sequence *sequence, bool unk2) {
Actor *actor;
Action *action;
if (!(actor = sequence->_sequencer->_page->findActor(_actor)) ||
@@ -60,7 +61,7 @@ bool SequenceItem::execute(int unk, Sequence *sequence, bool unk2) {
Common::Array<SequenceActorState> &states = sequence->_context->_states;
for (int i = 0; i < sequence->_context->_states.size(); ++i) {
if (states[i]._actorName == _actor){
- states[i]._unk = unk;
+ states[i]._index = index;
sequence->_context->_actor = isLeader() ? actor : sequence->_context->_actor;
break;
}
@@ -91,7 +92,7 @@ void SequenceItemLeaderAudio::toConsole() {
debug("\t\t\t\tSequenceItemLeaderAudio: _actor=%s, _action=%s", _actor.c_str(), _action.c_str());
}
-bool SequenceItemDefaultAction::execute(int unk, Sequence *sequence, bool unk2) {
+bool SequenceItemDefaultAction::execute(int index, Sequence *sequence, bool unk2) {
Common::Array<SequenceActorState> &actorStates = sequence->_context->_states;
for (int i = 0; i < actorStates.size(); ++i) {
if (actorStates[i]._actorName == _actor){
diff --git a/engines/pink/objects/sequences/sequence_item.h b/engines/pink/objects/sequences/sequence_item.h
index 1507aa8..197280f 100644
--- a/engines/pink/objects/sequences/sequence_item.h
+++ b/engines/pink/objects/sequences/sequence_item.h
@@ -38,7 +38,7 @@ public:
const Common::String &getActor() const;
const Common::String &getAction() const;
- virtual bool execute(int unk, Sequence *sequence, bool unk2);
+ virtual bool execute(int index, Sequence *sequence, bool unk2);
virtual bool isLeader();
protected:
@@ -64,7 +64,7 @@ private:
class SequenceItemDefaultAction : public SequenceItem {
public:
- virtual bool execute(int unk, Sequence *sequence, bool unk2);
+ virtual bool execute(int index, Sequence *sequence, bool unk2);
virtual void toConsole();
};
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index 1f667cf..0667f2b 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -24,6 +24,7 @@
#include <common/debug.h>
#include "sequencer.h"
#include "sequence.h"
+#include "sequence_context.h"
#include "engines/pink/archive.h"
namespace Pink {
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index ec0ad26..afcae8c 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -32,7 +32,7 @@ namespace Pink {
Pink::PinkEngine::PinkEngine(OSystem *system, const ADGameDescription *desc)
: Engine(system), _console(nullptr), _rnd("pink"),
- _desc(*desc), _bro(nullptr), _module(nullptr)
+ _desc(*desc), _bro(nullptr), _module(nullptr), _director(_system)
{
debug("PinkEngine constructed");
@@ -87,13 +87,8 @@ Common::Error Pink::PinkEngine::run() {
return error;
}
- Video::FlicDecoder flicDecoder;
- Common::File anim;
- anim.open("WANDRBOY.CEL");
- flicDecoder.loadStream(&anim);
- flicDecoder.start();
- _system->updateScreen();
- const Graphics::Surface *surface = flicDecoder.decodeNextFrame();
+
+ int i = 0;
while(!shouldQuit()){
Common::Event event;
while(_eventMan->pollEvent(event)){
@@ -118,12 +113,8 @@ Common::Error Pink::PinkEngine::run() {
break;
}
}
- //update();
- surface = flicDecoder.needsUpdate() ? flicDecoder.decodeNextFrame() : surface;
- if (surface) {
- _system->copyRectToScreen(surface->getPixels(), surface->pitch, 0, 0, surface->w, surface->h);
- _system->updateScreen();
- }
+
+ _director.draw();
_system->delayMillis(10);
}
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index e5dc3d5..f592a89 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -28,6 +28,7 @@
#include "gui/EventRecorder.h"
#include "gui/debugger.h"
#include "file.h"
+#include "director.h"
/*
@@ -76,6 +77,7 @@ public:
OrbFile *getOrb() { return &_orb; }
BroFile *getBro() { return _bro; }
Common::RandomSource &getRnd();
+ Director *getDirector() { return &_director;}
bool checkValueOfVariable(Common::String &variable, Common::String &value);
void setVariable(Common::String &variable, Common::String &value);
@@ -93,6 +95,8 @@ private:
OrbFile _orb;
BroFile *_bro;
+ Director _director;
+
Module *_module;
Common::Array<NamedObject*> _modules;
diff --git a/engines/pink/resource_mgr.cpp b/engines/pink/resource_mgr.cpp
index 208b206..b367a52 100644
--- a/engines/pink/resource_mgr.cpp
+++ b/engines/pink/resource_mgr.cpp
@@ -53,7 +53,7 @@ Sound *ResourceMgr::loadSound(Common::String &name) {
return new Sound(_game->_mixer, getResourceStream(name));
}
-Common::SeekableReadStream *ResourceMgr::getResourceStream(Common::String &name) {
+Common::SafeSeekableSubReadStream *ResourceMgr::getResourceStream(Common::String &name) {
Common::SeekableReadStream *stream;
uint i;
for (i = 0; i < _resCount; ++i) {
@@ -69,7 +69,7 @@ Common::SeekableReadStream *ResourceMgr::getResourceStream(Common::String &name)
stream->seek(_resDescTable[i].offset);
- return new Common::SeekableSubReadStream(stream, _resDescTable[i].offset,
+ return new Common::SafeSeekableSubReadStream(stream, _resDescTable[i].offset,
_resDescTable[i].offset + _resDescTable[i].size);
}
@@ -77,4 +77,10 @@ PinkEngine *ResourceMgr::getGame() const {
return _game;
}
+Video::FlicDecoder *ResourceMgr::loadCEL(Common::String &name) {
+ Video::FlicDecoder *decoder = new Video::FlicDecoder();
+ decoder->loadStream(getResourceStream(name));
+ return decoder;
+}
+
} // End of namespace Pink
diff --git a/engines/pink/resource_mgr.h b/engines/pink/resource_mgr.h
index 1188c12..8d04ec7 100644
--- a/engines/pink/resource_mgr.h
+++ b/engines/pink/resource_mgr.h
@@ -21,7 +21,7 @@
*/
#include <common/scummsys.h>
-#include <common/stream.h>
+#include <common/substream.h>
#ifndef PINK_RESOURCE_MGR_H
#define PINK_RESOURCE_MGR_H
@@ -46,15 +46,14 @@ public:
~ResourceMgr();
void init(PinkEngine *game, GamePage *page);
- //move methods to page
- //compiler must do RVO
+
//Common::String loadText(Common::String &name);
Sound *loadSound(Common::String &name);
- // loadCEL();
+ Video::FlicDecoder *loadCEL(Common::String &name);
PinkEngine *getGame() const;
private:
- Common::SeekableReadStream *getResourceStream(Common::String &name);
+ Common::SafeSeekableSubReadStream *getResourceStream(Common::String &name);
PinkEngine *_game;
ResourceDescription *_resDescTable;
Commit: c6df869fec46858d25d294854c1e446ca47fd85d
https://github.com/scummvm/scummvm/commit/c6df869fec46858d25d294854c1e446ca47fd85d
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Basic implementation of CEL decoder. Fixed sprite positioning
Changed paths:
engines/pink/cel_decoder.cpp
engines/pink/cel_decoder.h
engines/pink/director.cpp
engines/pink/module.mk
engines/pink/objects/actions/action_cel.cpp
engines/pink/objects/actions/action_cel.h
engines/pink/objects/actions/action_play.cpp
engines/pink/objects/actions/action_still.cpp
engines/pink/objects/pages/page.cpp
engines/pink/objects/pages/page.h
engines/pink/resource_mgr.cpp
engines/pink/resource_mgr.h
diff --git a/engines/pink/cel_decoder.cpp b/engines/pink/cel_decoder.cpp
index 5d20e41..bff0e4a 100644
--- a/engines/pink/cel_decoder.cpp
+++ b/engines/pink/cel_decoder.cpp
@@ -20,6 +20,107 @@
*
*/
+#include <common/stream.h>
+#include "cel_decoder.h"
+
namespace Pink {
-}
\ No newline at end of file
+bool CelDecoder::loadStream(Common::SeekableReadStream *stream) {
+ close();
+
+ /* uint32 frameSize = */ stream->readUint32LE();
+ uint16 frameType = stream->readUint16LE();
+
+ // Check FLC magic number
+ if (frameType != 0xAF12) {
+ warning("FlicDecoder::loadStream(): attempted to load non-FLC data (type = 0x%04X)", frameType);
+ return false;
+ }
+
+ uint16 frameCount = stream->readUint16LE();
+ uint16 width = stream->readUint16LE();
+ uint16 height = stream->readUint16LE();
+ uint16 colorDepth = stream->readUint16LE();
+ if (colorDepth != 8) {
+ warning("FlicDecoder::loadStream(): attempted to load an FLC with a palette of color depth %d. Only 8-bit color palettes are supported", colorDepth);
+ return false;
+ }
+
+ addTrack(new CelVideoTrack(stream, frameCount, width, height));
+ return true;
+}
+
+uint32 CelDecoder::getX(){
+ CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
+ if (!track)
+ return -1;
+ return track->getX();
+}
+
+uint32 CelDecoder::getY() {
+ CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
+ if (!track)
+ return -1;
+ return track->getY();
+}
+
+CelDecoder::CelVideoTrack::CelVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height, bool skipHeader)
+ : FlicVideoTrack(stream, frameCount, width, height, 1) {
+ readHeader();
+}
+
+#define PREFIX_TYPE 0xF100
+#define CEL_DATA 3
+
+void CelDecoder::CelVideoTrack::readPrefixChunk() {
+ _fileStream->seek(0x80);
+ uint32 chunkSize = _fileStream->readUint32LE();
+ uint16 chunkType = _fileStream->readUint16LE();
+ if (chunkType != PREFIX_TYPE)
+ return;
+ uint32 offset = 6;
+ while (offset < chunkSize) {
+ uint32 subchunkSize = _fileStream->readUint32LE();
+ uint16 subchunkType = _fileStream->readUint16LE();
+ switch (subchunkType) {
+ case CEL_DATA:
+ _fileStream->skip(2); // Unknown field
+ _center.x = _fileStream->readUint16LE();
+ _center.y = _fileStream->readUint16LE();
+ _fileStream->skip(subchunkSize - 6 - 6);
+ break;
+ default:
+ _fileStream->skip(subchunkSize - 6);
+ break;
+ }
+ offset += subchunkSize;
+ }
+}
+
+void CelDecoder::CelVideoTrack::readHeader() {
+ _fileStream->readUint16LE(); // flags
+ // Note: The normal delay is a 32-bit integer (dword), whereas the overridden delay is a 16-bit integer (word)
+ // the frame delay is the FLIC "speed", in milliseconds.
+ _frameDelay = _startFrameDelay = _fileStream->readUint32LE();
+
+ _fileStream->seek(80);
+ _offsetFrame1 = _fileStream->readUint32LE();
+ _offsetFrame2 = _fileStream->readUint32LE();
+
+ if (_offsetFrame1 > 0x80) {
+ readPrefixChunk();
+ }
+
+ // Seek to the first frame
+ _fileStream->seek(_offsetFrame1);
+}
+
+uint32 CelDecoder::CelVideoTrack::getX() const {
+ return _center.x - getWidth() / 2;
+}
+
+uint32 CelDecoder::CelVideoTrack::getY() const {
+ return _center.y - getHeight() / 2;
+}
+
+} // End of namepsace Pink
\ No newline at end of file
diff --git a/engines/pink/cel_decoder.h b/engines/pink/cel_decoder.h
index 0e8d612..c096793 100644
--- a/engines/pink/cel_decoder.h
+++ b/engines/pink/cel_decoder.h
@@ -29,8 +29,25 @@
namespace Pink {
class CelDecoder : public Video::FlicDecoder {
+public:
+ uint32 getX();
+ uint32 getY();
+ virtual bool loadStream(Common::SeekableReadStream *stream);
+protected:
+ class CelVideoTrack : public FlicVideoTrack {
+ public:
+ CelVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height, bool skipHeader = false);
+ virtual void readHeader();
+
+ uint32 getX() const;
+ uint32 getY() const;
+
+ private:
+ void readPrefixChunk();
+ Common::Point _center;
+ };
};
}
diff --git a/engines/pink/director.cpp b/engines/pink/director.cpp
index cdc60c8..f45948b 100644
--- a/engines/pink/director.cpp
+++ b/engines/pink/director.cpp
@@ -24,6 +24,7 @@
#include <engines/pink/objects/actions/action_cel.h>
#include "graphics/surface.h"
#include "graphics/palette.h"
+#include "cel_decoder.h"
namespace Pink {
Director::Director(OSystem *system)
@@ -32,10 +33,12 @@ Director::Director(OSystem *system)
void Director::draw() {
bool needUpdate = 0;
for (int i = 0; i < _sprites.size(); ++i) {
- Video::FlicDecoder *decoder = _sprites[i]->getDecoder();
+ CelDecoder *decoder = _sprites[i]->getDecoder();
if (decoder->needsUpdate()) {
const Graphics::Surface *surface = decoder->decodeNextFrame();
- _system->copyRectToScreen(surface->getPixels(), surface->pitch, 0, 0, surface->w, surface->h);
+ _system->copyRectToScreen(surface->getPixels(), surface->pitch,
+ decoder->getX(), decoder->getY(),
+ surface->w, surface->h);
needUpdate = 1;
}
}
diff --git a/engines/pink/module.mk b/engines/pink/module.mk
index 1b83373..4bff006 100644
--- a/engines/pink/module.mk
+++ b/engines/pink/module.mk
@@ -2,6 +2,7 @@ MODULE := engines/pink
MODULE_OBJS = \
archive.o \
+ cel_decoder.o \
console.o \
cursor_mgr.o \
detection.o \
diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp
index 5385386..abfc593 100644
--- a/engines/pink/objects/actions/action_cel.cpp
+++ b/engines/pink/objects/actions/action_cel.cpp
@@ -26,11 +26,12 @@
#include "engines/pink/archive.h"
#include "engines/pink/objects/pages/game_page.h"
#include "pink/pink.h"
+#include "pink/cel_decoder.h"
namespace Pink {
ActionCEL::ActionCEL()
- : _flicDecoder(nullptr) {
+ : _decoder(nullptr) {
}
@@ -40,30 +41,30 @@ void ActionCEL::deserialize(Archive &archive) {
}
void ActionCEL::start(bool unk) {
- if (!_flicDecoder)
- _flicDecoder = _actor->getPage()->loadCel(_fileName);
+ if (!_decoder)
+ _decoder = _actor->getPage()->loadCel(_fileName);
_actor->getPage()->getGame()->getDirector()->addSprite(this);
this->onStart();
}
void ActionCEL::end() {
_actor->getPage()->getGame()->getDirector()->removeSprite(this);
- delete _flicDecoder;
- _flicDecoder = nullptr;
+ delete _decoder;
+ _decoder = nullptr;
}
uint32 ActionCEL::getZ() {
return _z;
}
-Video::FlicDecoder *ActionCEL::getDecoder() {
- return _flicDecoder;
+CelDecoder *ActionCEL::getDecoder() {
+ return _decoder;
}
bool ActionCEL::initPallete(Director *director) {
- _flicDecoder = _actor->getPage()->loadCel(_fileName);
- _flicDecoder->decodeNextFrame();
- director->setPallette(_flicDecoder->getPalette());
+ _decoder = _actor->getPage()->loadCel(_fileName);
+ _decoder->decodeNextFrame();
+ director->setPallette(_decoder->getPalette());
return 1;
}
diff --git a/engines/pink/objects/actions/action_cel.h b/engines/pink/objects/actions/action_cel.h
index 92986fb..4dc3772 100644
--- a/engines/pink/objects/actions/action_cel.h
+++ b/engines/pink/objects/actions/action_cel.h
@@ -28,6 +28,8 @@
namespace Pink {
+class CelDecoder;
+
class ActionCEL : public Action {
public:
ActionCEL();
@@ -36,13 +38,13 @@ public:
virtual void end();
uint32 getZ();
- Video::FlicDecoder *getDecoder();
+ CelDecoder *getDecoder();
virtual bool initPallete(Director *director);
protected:
virtual void onStart() {} ;
- Video::FlicDecoder *_flicDecoder;
+ CelDecoder *_decoder;
Common::String _fileName;
uint32 _z;
};
diff --git a/engines/pink/objects/actions/action_play.cpp b/engines/pink/objects/actions/action_play.cpp
index 3945fe6..969eacf 100644
--- a/engines/pink/objects/actions/action_play.cpp
+++ b/engines/pink/objects/actions/action_play.cpp
@@ -24,6 +24,7 @@
#include "action_play.h"
#include "../actors/actor.h"
#include "engines/pink/archive.h"
+#include "pink/cel_decoder.h"
namespace Pink {
@@ -44,10 +45,10 @@ void ActionPlay::end() {
void ActionPlay::onStart() {
debug("Actor %s has now ActionPlay %s", _actor->getName().c_str(), _name.c_str());
- _flicDecoder->seekToFrame(_startFrame);
+ _decoder->seekToFrame(_startFrame);
if (_stopFrame != -1)
- _flicDecoder->setEndFrame(_stopFrame);
- _flicDecoder->start();
+ _decoder->setEndFrame(_stopFrame);
+ _decoder->start();
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_still.cpp b/engines/pink/objects/actions/action_still.cpp
index 8e90c83..563af93 100644
--- a/engines/pink/objects/actions/action_still.cpp
+++ b/engines/pink/objects/actions/action_still.cpp
@@ -24,6 +24,7 @@
#include "action_still.h"
#include "engines/pink/archive.h"
#include <engines/pink/objects/actors/actor.h>
+#include "pink/cel_decoder.h"
namespace Pink {
@@ -44,7 +45,7 @@ void ActionStill::end() {
void ActionStill::onStart() {
debug("Actor %s has now ActionStill %s", _actor->getName().c_str(), _name.c_str());
- _flicDecoder->seekToFrame(_startFrame);
+ _decoder->seekToFrame(_startFrame);
}
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/pages/page.cpp b/engines/pink/objects/pages/page.cpp
index dc2bb43..a57860e 100644
--- a/engines/pink/objects/pages/page.cpp
+++ b/engines/pink/objects/pages/page.cpp
@@ -45,7 +45,7 @@ Sound *Page::loadSound(Common::String &fileName) {
}
-Video::FlicDecoder *Page::loadCel(Common::String &fileName) {
+CelDecoder *Page::loadCel(Common::String &fileName) {
return _resMgr.loadCEL(fileName);
}
diff --git a/engines/pink/objects/pages/page.h b/engines/pink/objects/pages/page.h
index 5244ed9..282d061 100644
--- a/engines/pink/objects/pages/page.h
+++ b/engines/pink/objects/pages/page.h
@@ -40,7 +40,7 @@ public:
void load(Archive &archive);
Actor *findActor(Common::String &name);
Sound* loadSound(Common::String &fileName);
- Video::FlicDecoder *loadCel(Common::String &fileName);
+ CelDecoder *loadCel(Common::String &fileName);
virtual void toConsole();
diff --git a/engines/pink/resource_mgr.cpp b/engines/pink/resource_mgr.cpp
index b367a52..c91101e 100644
--- a/engines/pink/resource_mgr.cpp
+++ b/engines/pink/resource_mgr.cpp
@@ -28,6 +28,7 @@
#include "pink.h"
#include "sound.h"
#include "engines/pink/objects/pages/game_page.h"
+#include "cel_decoder.h"
namespace Pink {
@@ -77,8 +78,8 @@ PinkEngine *ResourceMgr::getGame() const {
return _game;
}
-Video::FlicDecoder *ResourceMgr::loadCEL(Common::String &name) {
- Video::FlicDecoder *decoder = new Video::FlicDecoder();
+CelDecoder *ResourceMgr::loadCEL(Common::String &name) {
+ CelDecoder *decoder = new CelDecoder();
decoder->loadStream(getResourceStream(name));
return decoder;
}
diff --git a/engines/pink/resource_mgr.h b/engines/pink/resource_mgr.h
index 8d04ec7..cc52ee8 100644
--- a/engines/pink/resource_mgr.h
+++ b/engines/pink/resource_mgr.h
@@ -37,6 +37,7 @@ class PinkEngine;
class OrbFile;
class BroFile;
class Sound;
+class CelDecoder;
struct ResourceDescription;
@@ -49,7 +50,7 @@ public:
//Common::String loadText(Common::String &name);
Sound *loadSound(Common::String &name);
- Video::FlicDecoder *loadCEL(Common::String &name);
+ CelDecoder *loadCEL(Common::String &name);
PinkEngine *getGame() const;
private:
Commit: 0e39a87862253841e133a8f098b492cd4f5dd255
https://github.com/scummvm/scummvm/commit/0e39a87862253841e133a8f098b492cd4f5dd255
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Implemented changing page and module, but without unloading old page. For now it can play logo of Wanderlust Interactive, then logo of MGM and Localizer Logo.
Changed paths:
engines/pink/cel_decoder.cpp
engines/pink/cel_decoder.h
engines/pink/director.cpp
engines/pink/director.h
engines/pink/file.cpp
engines/pink/objects/actions/action_cel.cpp
engines/pink/objects/actions/action_cel.h
engines/pink/objects/actions/action_sound.cpp
engines/pink/objects/actions/action_still.cpp
engines/pink/objects/actions/walk_action.cpp
engines/pink/objects/actors/actor.cpp
engines/pink/objects/actors/actor.h
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/actors/lead_actor.h
engines/pink/objects/module.cpp
engines/pink/objects/module.h
engines/pink/objects/pages/game_page.cpp
engines/pink/objects/pages/game_page.h
engines/pink/objects/sequences/sequence.cpp
engines/pink/objects/sequences/sequence.h
engines/pink/objects/sequences/sequencer.cpp
engines/pink/objects/sequences/sequencer.h
engines/pink/pink.cpp
engines/pink/pink.h
diff --git a/engines/pink/cel_decoder.cpp b/engines/pink/cel_decoder.cpp
index bff0e4a..7e7a993 100644
--- a/engines/pink/cel_decoder.cpp
+++ b/engines/pink/cel_decoder.cpp
@@ -64,6 +64,13 @@ uint32 CelDecoder::getY() {
return track->getY();
}
+Graphics::Surface *CelDecoder::getCurrentFrame() {
+ CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
+ if (!track)
+ return nullptr;
+ return nullptr;
+}
+
CelDecoder::CelVideoTrack::CelVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height, bool skipHeader)
: FlicVideoTrack(stream, frameCount, width, height, 1) {
readHeader();
diff --git a/engines/pink/cel_decoder.h b/engines/pink/cel_decoder.h
index c096793..ef43e80 100644
--- a/engines/pink/cel_decoder.h
+++ b/engines/pink/cel_decoder.h
@@ -33,6 +33,8 @@ public:
uint32 getX();
uint32 getY();
+ Graphics::Surface *getCurrentFrame();
+
virtual bool loadStream(Common::SeekableReadStream *stream);
protected:
diff --git a/engines/pink/director.cpp b/engines/pink/director.cpp
index f45948b..18ec0b2 100644
--- a/engines/pink/director.cpp
+++ b/engines/pink/director.cpp
@@ -21,6 +21,7 @@
*/
#include "director.h"
+#include <engines/pink/objects/actions/action_sound.h>
#include <engines/pink/objects/actions/action_cel.h>
#include "graphics/surface.h"
#include "graphics/palette.h"
@@ -47,7 +48,14 @@ void Director::draw() {
}
void Director::addSprite(ActionCEL *sprite) {
- _sprites.push_back(sprite); //TODO impl sorting
+ _sprites.push_back(sprite);
+ int i;
+ for (i = _sprites.size() - 1; i > 0 ; --i) {
+ if (sprite->getZ() < _sprites[i - 1]->getZ()){
+ _sprites[i] = _sprites[i - 1];
+ } else break;
+ }
+ _sprites[i] = sprite;
}
void Director::removeSprite(ActionCEL *sprite) {
@@ -63,4 +71,24 @@ void Director::setPallette(const byte *pallete) {
_system->getPaletteManager()->setPalette(pallete, 0, 256);
}
+void Director::update() {
+ for (int i = 0; i < _sounds.size(); ++i) {
+ _sounds[i]->update();
+ }
+ for (int i = 0; i < _sprites.size(); ++i) {
+ _sprites[i]->update();
+ }
+}
+
+void Director::addSound(ActionSound *sound) {
+ _sounds.push_back(sound);
+}
+
+void Director::removeSound(ActionSound *sound) {
+ for (int i = 0; i < _sounds.size(); ++i) {
+ if (_sounds[i] == sound)
+ _sounds.remove_at(i);
+ }
+}
+
}
\ No newline at end of file
diff --git a/engines/pink/director.h b/engines/pink/director.h
index 0bd44f4..ac88bce 100644
--- a/engines/pink/director.h
+++ b/engines/pink/director.h
@@ -29,22 +29,27 @@
namespace Pink {
class ActionCEL;
+class ActionSound;
class Director {
public:
Director(OSystem *system);
- //void addSoundObject();
- //void removeSound();
- //void updateSoundAction
//CActor *getActorByCoords()
void draw();
+ void update();
+
void addSprite(ActionCEL *sprite);
void removeSprite(ActionCEL *sprite);
void setPallette(const byte *pallete);
+
+ void addSound(ActionSound* sound);
+ void removeSound(ActionSound* sound);
+
private:
OSystem *_system;
Common::Array<ActionCEL*> _sprites;
+ Common::Array<ActionSound*> _sounds;
};
} // End of namespace Pink
diff --git a/engines/pink/file.cpp b/engines/pink/file.cpp
index 996a13d..d5e9059 100644
--- a/engines/pink/file.cpp
+++ b/engines/pink/file.cpp
@@ -167,7 +167,7 @@ void ResourceDescription::load(Common::File &file) {
uint16 temp;
file.read(&temp, sizeof(temp));
- inBro = temp ? true : false;
+ inBro = temp;
}
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp
index abfc593..dc18ee3 100644
--- a/engines/pink/objects/actions/action_cel.cpp
+++ b/engines/pink/objects/actions/action_cel.cpp
@@ -64,8 +64,17 @@ CelDecoder *ActionCEL::getDecoder() {
bool ActionCEL::initPallete(Director *director) {
_decoder = _actor->getPage()->loadCel(_fileName);
_decoder->decodeNextFrame();
+ _decoder->rewind();
director->setPallette(_decoder->getPalette());
+
return 1;
}
+void ActionCEL::update() {
+ if (_decoder->endOfVideo()){
+ _decoder->stop();
+ _actor->endAction();
+ }
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/actions/action_cel.h b/engines/pink/objects/actions/action_cel.h
index 4dc3772..7c0f750 100644
--- a/engines/pink/objects/actions/action_cel.h
+++ b/engines/pink/objects/actions/action_cel.h
@@ -36,6 +36,7 @@ public:
virtual void deserialize(Archive &archive);
virtual void start(bool unk);
virtual void end();
+ virtual void update();
uint32 getZ();
CelDecoder *getDecoder();
diff --git a/engines/pink/objects/actions/action_sound.cpp b/engines/pink/objects/actions/action_sound.cpp
index 38f8687..42d2795 100644
--- a/engines/pink/objects/actions/action_sound.cpp
+++ b/engines/pink/objects/actions/action_sound.cpp
@@ -26,6 +26,7 @@
#include <engines/pink/objects/actors/actor.h>
#include <engines/pink/objects/pages/game_page.h>
#include <engines/pink/sound.h>
+#include "engines/pink/pink.h"
namespace Pink {
@@ -53,6 +54,10 @@ void ActionSound::start(bool unk) {
Audio::Mixer::SoundType soundType = _isBackground ? Audio::Mixer::SoundType::kMusicSoundType
: Audio::Mixer::SoundType::kSpeechSoundType;
+
+ Director *director = _actor->getPage()->getGame()->getDirector();
+ director->addSound(this);
+
_sound->play(soundType, _volume, _isLoop);
if (_isLoop)
_actor->endAction();
@@ -62,6 +67,10 @@ void ActionSound::start(bool unk) {
void ActionSound::end() {
debug("ActionSound %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
+
+ Director *director = _actor->getPage()->getGame()->getDirector();
+ director->removeSound(this);
+
_sound->stop();
delete _sound;
_sound = nullptr;
diff --git a/engines/pink/objects/actions/action_still.cpp b/engines/pink/objects/actions/action_still.cpp
index 563af93..c49e52a 100644
--- a/engines/pink/objects/actions/action_still.cpp
+++ b/engines/pink/objects/actions/action_still.cpp
@@ -34,8 +34,8 @@ void ActionStill::deserialize(Archive &archive) {
}
void ActionStill::toConsole() {
- debug("\tActionStill: _name = %s, _fileName = %s, _startFrame = %u",
- _name.c_str(), _fileName.c_str(), _startFrame);
+ debug("\tActionStill: _name = %s, _fileName = %s, _z =%u _startFrame = %u",
+ _name.c_str(), _fileName.c_str(), _z, _startFrame);
}
void ActionStill::end() {
diff --git a/engines/pink/objects/actions/walk_action.cpp b/engines/pink/objects/actions/walk_action.cpp
index 39be8f4..7b7c3e3 100644
--- a/engines/pink/objects/actions/walk_action.cpp
+++ b/engines/pink/objects/actions/walk_action.cpp
@@ -22,14 +22,13 @@
#include "walk_action.h"
#include <engines/pink/archive.h>
-#include <common/debug.h>
namespace Pink {
void WalkAction::deserialize(Archive &archive) {
ActionCEL::deserialize(archive);
uint32 calcFramePositions = archive.readDWORD();
- _toCalcFramePositions = calcFramePositions ? true : false;
+ _toCalcFramePositions = calcFramePositions;
}
void WalkAction::toConsole() {
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index e612c83..ba270ff 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -108,14 +108,15 @@ Action *Actor::getAction() const {
}
bool Actor::isPlaying() {
- return _isActionEnded;
+ return !_isActionEnded;
}
bool Actor::initPallete(Director *director) {
for (int i = 0; i < _actions.size(); ++i) {
if (_actions[i]->initPallete(director))
- break;
+ return true;
}
+ return false;
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/actor.h b/engines/pink/objects/actors/actor.h
index dd75183..2dc9769 100644
--- a/engines/pink/objects/actors/actor.h
+++ b/engines/pink/objects/actors/actor.h
@@ -59,6 +59,8 @@ public:
bool initPallete(Director *director);
+ void update() {};
+
protected:
GamePage *_page;
Action *_action;
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 88c579c..43e144b 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -50,6 +50,7 @@ void LeadActor::init(bool unk) {
_state = kReady;
}
_page->getModule()->getInventoryMgr()->setLeadActor(this);
+ _page->getGame()->setLeadActor(this);
Actor::init(unk);
}
@@ -64,6 +65,19 @@ LeadActor::State LeadActor::getState() const {
return _state;
}
+void LeadActor::update() {
+ switch (_state) {
+ case kPlayingVideo:
+ _sequencer->update();
+ if (!_sequencer->_context){
+ _state = kUnk_Loading;
+ _page->getGame()->changeScene(_page);
+ }
+ default:
+ break;
+ }
+}
+
void ParlSqPink::toConsole() {
debug("ParlSqPink: _name = %s", _name.c_str());
for (int i = 0; i < _actions.size(); ++i) {
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index 319c3f7..d7c45e0 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -54,6 +54,7 @@ public:
State getState() const;
void start(bool isHandler);
+ void update();
private:
State _state;
diff --git a/engines/pink/objects/module.cpp b/engines/pink/objects/module.cpp
index 97f78d4..d1e16f3 100644
--- a/engines/pink/objects/module.cpp
+++ b/engines/pink/objects/module.cpp
@@ -22,6 +22,7 @@
#include "module.h"
#include "engines/pink/objects/pages/game_page.h"
+#include "pink/pink.h"
namespace Pink {
@@ -45,52 +46,36 @@ void Module::load(Archive &archive){
archive >> _pages;
}
-void Module::init(bool isLoadingSave, const Common::String *pageName) {
- // debugging original
+void Module::init(bool isLoadingSave, const Common::String &pageName) {
// 0 0 - new game
// 0 1 - module changed
// 1 0 - from save
-
- // 1 1 - haven't seen those values
-
- //this func will be rewrited after testing
-
- if (_page) {
- debug("loading from save");
- }
- if (pageName){
- debug("module changed");
- }
- assert(_pages.size() != 0);
-
- if (pageName) {
- uint i;
- for (i = 0; i < _pages.size(); ++i) {
- if(*pageName == _pages[i]->getName()) {
- _page = _pages[i];
- }
- }
- assert(i < _pages.size());
- }
-
- if (_page) {
- _page->init(isLoadingSave); // module changed or from save
- return;
+ if (!pageName.empty()) {
+ _page = findPage(pageName);
}
- if (_page != _pages[0]) {
- if (_page) {
- assert(0); // in original code there is call to page func but I've never seen it
- return;
- }
+ if (!_page)
_page = _pages[0];
- _page->init(isLoadingSave); // new game
- return;
- }
- assert(0);
+ _page->init(isLoadingSave);
+}
+
+void Module::changePage(const Common::String &pageName) {
+ GamePage *page = nullptr;
+ page = findPage(pageName);
+ assert(_page != page);
+ //_page->clear
+ page->init(kLoadingNewGame);
}
+GamePage *Module::findPage(const Common::String &pageName) const {
+ return *Common::find_if(_pages.begin(), _pages.end(), [&pageName]
+ (GamePage* page) {
+ return pageName == page->getName();
+ });
+}
+
+
PinkEngine *Module::getGame() const {
return _game;
}
diff --git a/engines/pink/objects/module.h b/engines/pink/objects/module.h
index 214ff2a..959f886 100644
--- a/engines/pink/objects/module.h
+++ b/engines/pink/objects/module.h
@@ -45,13 +45,13 @@ public:
Module(PinkEngine *game, const Common::String &name);
void load(Archive &archive);
- void init(bool isLoadingSave, const Common::String *pageName);
+ void init(bool isLoadingSave, const Common::String &pageName);
+ void changePage(const Common::String &pageName);
void OnLeftButtonDown();
void OnMouseMove();
void OnKeyboardButtonClick();
-
PinkEngine *getGame() const;
InventoryMgr *getInventoryMgr();
@@ -59,6 +59,8 @@ public:
void setVariable(Common::String &variable, Common::String &value);
private:
+ GamePage *findPage(const Common::String &pageName) const;
+
PinkEngine *_game;
GamePage *_page;
Common::Array<GamePage*> _pages;
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index 465b1fc..5acc1f1 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -64,27 +64,29 @@ void GamePage::init(bool isLoadingSave) {
break;
}
-
LeadActor::State state = _leadActor->getState();
- bool unk = (state == LeadActor::kInventory || state == LeadActor::kPDA);
+ bool startNow = !(state == LeadActor::kInventory || state == LeadActor::kPDA);
for (int i = 0; i < _actors.size(); ++i) {
- _actors[i]->init(unk);
+ _actors[i]->init(startNow);
}
- if (!isLoadingSave)
- initHandler();
-
+ bool isHandler = 0;
+ if (!isLoadingSave) {
+ isHandler = initHandler();
+ }
+ //_leadActor->start(isHandler);
}
-void GamePage::initHandler() {
+bool GamePage::initHandler() {
for (uint i = 0; i < _handlers.size(); ++i) {
if (_handlers[i]->isSuitable(_leadActor)){
_handlers[i]->onMessage(_leadActor);
- break;
+ return true;
}
}
+ return false;
}
void GamePage::loadManagers() {
diff --git a/engines/pink/objects/pages/game_page.h b/engines/pink/objects/pages/game_page.h
index 74d1976..94bff54 100644
--- a/engines/pink/objects/pages/game_page.h
+++ b/engines/pink/objects/pages/game_page.h
@@ -53,7 +53,7 @@ public:
virtual void toConsole();
private:
- void initHandler();
+ bool initHandler();
int perhapsIsLoaded;
diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp
index efc0c01..80f5c58 100644
--- a/engines/pink/objects/sequences/sequence.cpp
+++ b/engines/pink/objects/sequences/sequence.cpp
@@ -69,17 +69,15 @@ void Sequence::init(int unk) {
start(unk);
}
-class Action;
-
void Sequence::start(int unk) {
- if (_context->_nextItemIndex > _items.size()){
- debug("Sequence %s ended", _name);
- //TODO destroy context
+ if (_context->_nextItemIndex >= _items.size()){
+ debug("Sequence %s ended", _name.c_str());
+ end();
return;
}
if (!_items[_context->_nextItemIndex]->execute(_context->_index, this, unk)){
- //destroy context;
+ assert(0);
}
uint i;
@@ -98,6 +96,19 @@ void Sequence::start(int unk) {
_context->_index++;
}
+void Sequence::update() {
+ if (!_context->_actor->isPlaying()){
+ debug("Sequence step ended");
+ start(0);
+ }
+}
+
+void Sequence::end() {
+ _context->_actor = 0;
+ _unk = 1;
+ _sequencer->removeContext(_context);
+}
+
void SequenceAudio::deserialize(Archive &archive) {
Sequence::deserialize(archive);
archive >> _sound;
diff --git a/engines/pink/objects/sequences/sequence.h b/engines/pink/objects/sequences/sequence.h
index 5fca545..3975acf 100644
--- a/engines/pink/objects/sequences/sequence.h
+++ b/engines/pink/objects/sequences/sequence.h
@@ -45,7 +45,9 @@ public:
void setContext(SequenceContext *context);
void init(int unk);
void start(int unk);
+ void end();
+ void update();
public:
SequenceContext *_context;
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index 0667f2b..fea28e5 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -25,6 +25,7 @@
#include "sequencer.h"
#include "sequence.h"
#include "sequence_context.h"
+#include "pink/objects/actors/actor.h"
#include "engines/pink/archive.h"
namespace Pink {
@@ -71,4 +72,13 @@ void Sequencer::toConsole() {
}
}
+void Sequencer::update() {
+ _context->_sequence->update();
+}
+
+void Sequencer::removeContext(SequenceContext *context) {
+ delete _context;
+ _context = 0;
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/sequences/sequencer.h b/engines/pink/objects/sequences/sequencer.h
index 36e9ba0..55e8529 100644
--- a/engines/pink/objects/sequences/sequencer.h
+++ b/engines/pink/objects/sequences/sequencer.h
@@ -45,9 +45,14 @@ public:
Sequence* findSequence(const Common::String &name);
void authorSequence(Sequence *sequence, bool unk);
+ void removeContext(SequenceContext *context);
+
+ void update();
+
+
public:
SequenceContext *_context;
- // unknown objects array
+ // context array
Common::Array<Sequence*> _sequences;
Common::String _currentSequenceName;
Common::Array<SeqTimer*> _timers;
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index afcae8c..4c5b7ce 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -26,6 +26,7 @@
#include <common/debug-channels.h>
#include <video/flic_decoder.h>
#include "engines/pink/objects/module.h"
+#include "engines/pink/objects/actors/lead_actor.h"
#include <graphics/surface.h>
namespace Pink {
@@ -75,8 +76,8 @@ Common::Error PinkEngine::init() {
// TODO load cursor
_orb.loadGame(this);
- _nextModule = _modules[0]->getName();
- initModule();
+ const Common::String empty;
+ initModule(_modules[0]->getName(), kLoadingNewGame, empty);
return Common::kNoError;
}
@@ -88,7 +89,6 @@ Common::Error Pink::PinkEngine::run() {
}
- int i = 0;
while(!shouldQuit()){
Common::Event event;
while(_eventMan->pollEvent(event)){
@@ -104,18 +104,21 @@ Common::Error Pink::PinkEngine::run() {
break;
- // don't know why it is used in orginal
- case Common::EVENT_LBUTTONUP:
- case Common::EVENT_RBUTTONDOWN:
case Common::EVENT_KEYDOWN:
break;
+
+ // don't know why it is used in original
+ case Common::EVENT_LBUTTONUP:
+ case Common::EVENT_RBUTTONDOWN:
default:
break;
}
}
+ _actor->update();
+ _director.update();
_director.draw();
- _system->delayMillis(10);
+ _system->delayMillis(50);
}
return Common::kNoError;
@@ -127,20 +130,17 @@ void PinkEngine::load(Archive &archive) {
archive >> _modules;
}
-void PinkEngine::initModule() {
+void PinkEngine::initModule(const Common::String &moduleName, bool isLoadingFromSave, const Common::String &pageName) {
if (_module) {
- assert(_module->getName() != _nextModule);
//call module function (smth with unloading)
- //check additional field of game(unk_1)
uint i;
for (i = 0; i < _modules.size(); ++i) {
if (_module == _modules[i]){
break;
}
}
- assert(i != _modules.size());
_modules[i] = new ModuleProxy(_module->getName());
@@ -148,20 +148,26 @@ void PinkEngine::initModule() {
_module = nullptr;
}
- assert(_modules.size() != 0);
-
uint i;
for (i = 0; i < _modules.size(); ++i) {
- assert(dynamic_cast<Module*>(_modules[i]) == 0);
- if (_modules[i]->getName() == _nextModule) {
+ if (_modules[i]->getName() == moduleName) {
loadModule(i);
break;
}
}
- assert(i < _modules.size());
_module = static_cast<Module*>(_modules[i]);
- _module->init(LoadingNotSave, 0);
+ _module->init(isLoadingFromSave, pageName);
+}
+
+void PinkEngine::changeScene(GamePage *page) {
+ if (!_nextModule.empty() && _nextModule.compareTo(_module->getName())) {
+ initModule(_nextModule, kLoadingNewGame, _nextPage);
+ }
+ else {
+ assert(!_nextPage.empty());
+ _module->changePage(_nextPage);
+ }
}
@@ -171,8 +177,6 @@ void PinkEngine::setNextExecutors(const Common::String &nextModule, const Common
}
void PinkEngine::loadModule(int index) {
- assert(dynamic_cast<Module*>(_modules[index]) == 0);
-
Module *module = new Module(this, _modules[index]->getName());
_orb.loadObject(module, module->getName());
@@ -190,8 +194,4 @@ void PinkEngine::setVariable(Common::String &variable, Common::String &value) {
_variables[variable] = value;
}
-Common::RandomSource &PinkEngine::getRnd() {
- return _rnd;
-}
-
}
\ No newline at end of file
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index f592a89..591d288 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -49,6 +49,8 @@ class Console;
class Archive;
class NamedObject;
class Module;
+class GamePage;
+class LeadActor;
enum {
kPinkDebugGeneral = 1 << 0,
@@ -59,8 +61,8 @@ enum {
};
enum {
- LoadingSave = 1,
- LoadingNotSave = 0
+ kLoadingSave = 1,
+ kLoadingNewGame = 0
};
class PinkEngine : public Engine {
@@ -69,18 +71,21 @@ public:
~PinkEngine();
virtual Common::Error run();
- void load(Archive &archive);
- void initModule();
- void setNextExecutors(const Common::String &nextModule, const Common::String &nextPage);
+ void load(Archive &archive);
+ void initModule(const Common::String &moduleName, bool isLoadingFromSave, const Common::String &pageName);
+ void changeScene(GamePage *page);
OrbFile *getOrb() { return &_orb; }
BroFile *getBro() { return _bro; }
- Common::RandomSource &getRnd();
- Director *getDirector() { return &_director;}
+ Common::RandomSource &getRnd() { return _rnd; };
+ Director *getDirector() { return &_director; }
+
+ void setNextExecutors(const Common::String &nextModule, const Common::String &nextPage);
+ void setLeadActor(LeadActor *actor) { _actor = actor; };
- bool checkValueOfVariable(Common::String &variable, Common::String &value);
void setVariable(Common::String &variable, Common::String &value);
+ bool checkValueOfVariable(Common::String &variable, Common::String &value);
private:
Common::Error init();
@@ -96,6 +101,7 @@ private:
BroFile *_bro;
Director _director;
+ LeadActor *_actor;
Module *_module;
Common::Array<NamedObject*> _modules;
Commit: 17c2bcfb948a24f9a1d99eeac85f799d45549d9f
https://github.com/scummvm/scummvm/commit/17c2bcfb948a24f9a1d99eeac85f799d45549d9f
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fixed ActionSfx deserialization
Changed paths:
engines/pink/objects/actions/action_play_with_sfx.cpp
engines/pink/objects/actions/action_play_with_sfx.h
diff --git a/engines/pink/objects/actions/action_play_with_sfx.cpp b/engines/pink/objects/actions/action_play_with_sfx.cpp
index 9e4767d..60ecd2a 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.cpp
+++ b/engines/pink/objects/actions/action_play_with_sfx.cpp
@@ -22,7 +22,6 @@
#include "action_play_with_sfx.h"
#include <pink/archive.h>
-#include <common/debug.h>
namespace Pink {
@@ -40,11 +39,13 @@ void Pink::ActionPlayWithSfx::toConsole() {
}
void Pink::ActionSfx::deserialize(Pink::Archive &archive) {
- archive >> _sfx >> _volume >> _frame;
+ archive >> _frame >> _volume >> _sfx;
+ _action = (ActionPlayWithSfx*) archive.readObject();
+
}
void Pink::ActionSfx::toConsole() {
- debug("\t\tActionSfx: _name = %s, _volume = %u, _frame = %u");
+ debug("\t\tActionSfx: _sfx = %s, _volume = %u, _frame = %u", _sfx.c_str(), _volume, _frame);
}
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/actions/action_play_with_sfx.h b/engines/pink/objects/actions/action_play_with_sfx.h
index 6a10edd..b558ee1c 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.h
+++ b/engines/pink/objects/actions/action_play_with_sfx.h
@@ -45,6 +45,7 @@ public:
virtual void toConsole();
private:
+ ActionPlayWithSfx *_action;
Common::String _sfx;
uint32 _volume;
uint32 _frame;
Commit: c37bd09354cb233404bec5aed6ded79412650cef
https://github.com/scummvm/scummvm/commit/c37bd09354cb233404bec5aed6ded79412650cef
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: implemented drawing of transparent drawing, but it seems that original handles this a bit different.(intro of Peril first sprite keeps transparent colour index somewhere else)
Changed paths:
engines/pink/cel_decoder.cpp
engines/pink/cel_decoder.h
engines/pink/director.cpp
engines/pink/director.h
engines/pink/objects/actions/action_cel.cpp
engines/pink/objects/actions/action_loop.h
engines/pink/objects/actions/action_still.cpp
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/module.cpp
engines/pink/objects/pages/game_page.cpp
diff --git a/engines/pink/cel_decoder.cpp b/engines/pink/cel_decoder.cpp
index 7e7a993..82dca7b 100644
--- a/engines/pink/cel_decoder.cpp
+++ b/engines/pink/cel_decoder.cpp
@@ -64,15 +64,23 @@ uint32 CelDecoder::getY() {
return track->getY();
}
-Graphics::Surface *CelDecoder::getCurrentFrame() {
+
+uint16 CelDecoder::getTransparentColourIndex() {
+ CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
+ if (!track)
+ return 0;
+ return track->getTransparentColourIndex();
+}
+
+const Graphics::Surface *CelDecoder::getCurrentFrame() {
CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
if (!track)
- return nullptr;
- return nullptr;
+ return 0;
+ return track->getCurrentFrame();
}
CelDecoder::CelVideoTrack::CelVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height, bool skipHeader)
- : FlicVideoTrack(stream, frameCount, width, height, 1) {
+ : FlicVideoTrack(stream, frameCount, width, height, 1), _center(0,0), _transparentColourIndex(0){
readHeader();
}
@@ -86,22 +94,33 @@ void CelDecoder::CelVideoTrack::readPrefixChunk() {
if (chunkType != PREFIX_TYPE)
return;
uint32 offset = 6;
- while (offset < chunkSize) {
- uint32 subchunkSize = _fileStream->readUint32LE();
- uint16 subchunkType = _fileStream->readUint16LE();
- switch (subchunkType) {
- case CEL_DATA:
- _fileStream->skip(2); // Unknown field
- _center.x = _fileStream->readUint16LE();
- _center.y = _fileStream->readUint16LE();
- _fileStream->skip(subchunkSize - 6 - 6);
- break;
- default:
- _fileStream->skip(subchunkSize - 6);
- break;
- }
- offset += subchunkSize;
+
+ uint32 subchunkSize = _fileStream->readUint32LE();
+ uint16 subchunkType = _fileStream->readUint16LE();
+
+ switch (subchunkType) {
+ case CEL_DATA:
+ debug("%u", _fileStream->readUint16LE());
+ _center.x = _fileStream->readUint16LE();
+ _center.y = _fileStream->readUint16LE();
+ debug("stretch x: %u", _fileStream->readUint16LE());
+ debug("stretch y: %u", _fileStream->readUint16LE());
+ debug("rotation x: %u", _fileStream->readUint16LE());
+ debug("rotation y: %u", _fileStream->readUint16LE());
+ debug("rotation z: %u", _fileStream->readUint16LE());
+ debug("current Frame: %u", _fileStream->readUint16LE());
+ debug("next frame offset: %u",_fileStream->readUint32LE());
+ debug("tcolor: %u", _transparentColourIndex = _fileStream->readUint16LE());
+ for (int j = 0; j < 18; ++j) {
+ debug("%u", _fileStream->readUint16LE());
+ }
+ break;
+ default:
+ error("Unknown subchunk type");
+ _fileStream->skip(subchunkSize - 6);
+ break;
}
+
}
void CelDecoder::CelVideoTrack::readHeader() {
@@ -130,4 +149,12 @@ uint32 CelDecoder::CelVideoTrack::getY() const {
return _center.y - getHeight() / 2;
}
+uint16 CelDecoder::CelVideoTrack::getTransparentColourIndex() {
+ return _transparentColourIndex;
+}
+
+const Graphics::Surface *CelDecoder::CelVideoTrack::getCurrentFrame() {
+ return _surface;
+}
+
} // End of namepsace Pink
\ No newline at end of file
diff --git a/engines/pink/cel_decoder.h b/engines/pink/cel_decoder.h
index ef43e80..3ccea1a 100644
--- a/engines/pink/cel_decoder.h
+++ b/engines/pink/cel_decoder.h
@@ -32,8 +32,8 @@ class CelDecoder : public Video::FlicDecoder {
public:
uint32 getX();
uint32 getY();
-
- Graphics::Surface *getCurrentFrame();
+ uint16 getTransparentColourIndex();
+ const Graphics::Surface *getCurrentFrame();
virtual bool loadStream(Common::SeekableReadStream *stream);
@@ -46,8 +46,12 @@ protected:
uint32 getX() const;
uint32 getY() const;
+ uint16 getTransparentColourIndex();
+ const Graphics::Surface *getCurrentFrame();
+
private:
void readPrefixChunk();
+ uint16 _transparentColourIndex;
Common::Point _center;
};
};
diff --git a/engines/pink/director.cpp b/engines/pink/director.cpp
index 18ec0b2..a7ed2f8 100644
--- a/engines/pink/director.cpp
+++ b/engines/pink/director.cpp
@@ -23,7 +23,7 @@
#include "director.h"
#include <engines/pink/objects/actions/action_sound.h>
#include <engines/pink/objects/actions/action_cel.h>
-#include "graphics/surface.h"
+#include <graphics/managed_surface.h>
#include "graphics/palette.h"
#include "cel_decoder.h"
@@ -32,21 +32,41 @@ Director::Director(OSystem *system)
: _system(system) {}
void Director::draw() {
- bool needUpdate = 0;
for (int i = 0; i < _sprites.size(); ++i) {
CelDecoder *decoder = _sprites[i]->getDecoder();
- if (decoder->needsUpdate()) {
- const Graphics::Surface *surface = decoder->decodeNextFrame();
- _system->copyRectToScreen(surface->getPixels(), surface->pitch,
- decoder->getX(), decoder->getY(),
- surface->w, surface->h);
- needUpdate = 1;
+ drawSprite(decoder);
+ }
+ _system->updateScreen();
+}
+
+void Director::drawSprite(CelDecoder *decoder) {
+ const Graphics::Surface *surface;
+ if (decoder->needsUpdate())
+ surface = decoder->decodeNextFrame();
+ else surface = decoder->getCurrentFrame();
+
+
+
+ uint16 colourIndex = decoder->getTransparentColourIndex();
+ if (colourIndex != 0) {
+ Graphics::Surface *screen = _system->lockScreen();
+ for (int y = 0; y < decoder->getHeight(); ++y) {
+ for (int x = 0; x < decoder->getWidth(); ++x) {
+ byte spritePixelColourIndex = *(byte*)surface->getBasePtr(x, y);
+ if (spritePixelColourIndex != colourIndex || spritePixelColourIndex == 1) {
+ *(byte *) screen->getBasePtr(decoder->getX() + x, decoder->getY() + y) = spritePixelColourIndex;
+ }
+ }
}
+ _system->unlockScreen();
}
- if (needUpdate)
- _system->updateScreen();
+ else _system->copyRectToScreen(surface->getPixels(), surface->pitch,
+ decoder->getX(), decoder->getY(),
+ surface->w, surface->h);
+
}
+
void Director::addSprite(ActionCEL *sprite) {
_sprites.push_back(sprite);
int i;
@@ -91,4 +111,8 @@ void Director::removeSound(ActionSound *sound) {
}
}
+void Director::clear() {
+ _sprites.clear();
+}
+
}
\ No newline at end of file
diff --git a/engines/pink/director.h b/engines/pink/director.h
index ac88bce..ce7d96f 100644
--- a/engines/pink/director.h
+++ b/engines/pink/director.h
@@ -30,6 +30,7 @@ namespace Pink {
class ActionCEL;
class ActionSound;
+class CelDecoder;
class Director {
public:
@@ -46,7 +47,11 @@ public:
void addSound(ActionSound* sound);
void removeSound(ActionSound* sound);
+ void clear();
private:
+ void drawSprite(CelDecoder *decoder);
+
+
OSystem *_system;
Common::Array<ActionCEL*> _sprites;
Common::Array<ActionSound*> _sounds;
diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp
index dc18ee3..312ae31 100644
--- a/engines/pink/objects/actions/action_cel.cpp
+++ b/engines/pink/objects/actions/action_cel.cpp
@@ -43,6 +43,8 @@ void ActionCEL::deserialize(Archive &archive) {
void ActionCEL::start(bool unk) {
if (!_decoder)
_decoder = _actor->getPage()->loadCel(_fileName);
+ //if (_fileName =="IT01PP01.CEL")
+ // initPallete(_actor->getPage()->getGame()->getDirector());
_actor->getPage()->getGame()->getDirector()->addSprite(this);
this->onStart();
}
diff --git a/engines/pink/objects/actions/action_loop.h b/engines/pink/objects/actions/action_loop.h
index 82b2c1e..a031bd1 100644
--- a/engines/pink/objects/actions/action_loop.h
+++ b/engines/pink/objects/actions/action_loop.h
@@ -36,7 +36,7 @@ protected:
enum Style {
kPingPong = 2,
kRandom = 3,
- kForward // unknown
+ kForward = 4
};
uint _intro;
Style _style;
diff --git a/engines/pink/objects/actions/action_still.cpp b/engines/pink/objects/actions/action_still.cpp
index c49e52a..442fe85 100644
--- a/engines/pink/objects/actions/action_still.cpp
+++ b/engines/pink/objects/actions/action_still.cpp
@@ -45,7 +45,9 @@ void ActionStill::end() {
void ActionStill::onStart() {
debug("Actor %s has now ActionStill %s", _actor->getName().c_str(), _name.c_str());
- _decoder->seekToFrame(_startFrame);
+ for (int i = 0; i < _startFrame; ++i) {
+ _decoder->decodeNextFrame();
+ }
}
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 43e144b..5586113 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -33,6 +33,7 @@ namespace Pink {
void LeadActor::deserialize(Archive &archive) {
Actor::deserialize(archive);
+ _state = kReady;
_cursorMgr = static_cast<CursorMgr*>(archive.readObject());
_walkMgr = static_cast<WalkMgr*>(archive.readObject());
_sequencer = static_cast<Sequencer*>(archive.readObject());
diff --git a/engines/pink/objects/module.cpp b/engines/pink/objects/module.cpp
index d1e16f3..f768020 100644
--- a/engines/pink/objects/module.cpp
+++ b/engines/pink/objects/module.cpp
@@ -81,7 +81,9 @@ PinkEngine *Module::getGame() const {
}
bool Module::checkValueOfVariable(Common::String &variable, Common::String &value) {
- assert(_variables.contains(variable));
+ //assert(_variables.contains(variable));
+ if (!_variables.contains(variable))
+ return value == "UNDEFINED";
return _variables[variable] == value;
}
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index 5acc1f1..8711a7e 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -56,6 +56,7 @@ void GamePage::init(bool isLoadingSave) {
//assert(perhapsIsLoaded == 0);
loadManagers();
}
+ getGame()->getDirector()->clear();
toConsole();
Commit: dbc709a140fc2d01d35dcd3515c45ea9621fe18b
https://github.com/scummvm/scummvm/commit/dbc709a140fc2d01d35dcd3515c45ea9621fe18b
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fixes to get first game scene of Hokus Pokus loaded and hack for Peril intro sprite, which has wrong transparent colour index
Changed paths:
engines/pink/director.cpp
engines/pink/objects/handlers/handler.cpp
engines/pink/objects/handlers/handler_mgr.cpp
engines/pink/objects/module.cpp
engines/pink/objects/pages/game_page.cpp
engines/pink/pink.cpp
diff --git a/engines/pink/director.cpp b/engines/pink/director.cpp
index a7ed2f8..18b1d38 100644
--- a/engines/pink/director.cpp
+++ b/engines/pink/director.cpp
@@ -53,7 +53,7 @@ void Director::drawSprite(CelDecoder *decoder) {
for (int y = 0; y < decoder->getHeight(); ++y) {
for (int x = 0; x < decoder->getWidth(); ++x) {
byte spritePixelColourIndex = *(byte*)surface->getBasePtr(x, y);
- if (spritePixelColourIndex != colourIndex || spritePixelColourIndex == 1) {
+ if (spritePixelColourIndex != colourIndex && spritePixelColourIndex != 229) { // hack because sprite have wrong colour index
*(byte *) screen->getBasePtr(decoder->getX() + x, decoder->getY() + y) = spritePixelColourIndex;
}
}
diff --git a/engines/pink/objects/handlers/handler.cpp b/engines/pink/objects/handlers/handler.cpp
index de29615..ed553a1 100644
--- a/engines/pink/objects/handlers/handler.cpp
+++ b/engines/pink/objects/handlers/handler.cpp
@@ -29,7 +29,6 @@
#include <engines/pink/objects/actors/lead_actor.h>
#include <engines/pink/objects/pages/game_page.h>
#include <engines/pink/pink.h>
-#include <common/debug.h>
namespace Pink {
@@ -123,6 +122,7 @@ void HandlerLeftClick::toConsole() {
void HandlerUseClick::deserialize(Archive &archive) {
HandlerSequences::deserialize(archive);
+ archive >> _inventoryItem >> _recepient;
}
void HandlerUseClick::toConsole() {
diff --git a/engines/pink/objects/handlers/handler_mgr.cpp b/engines/pink/objects/handlers/handler_mgr.cpp
index da695b4..6e7755a 100644
--- a/engines/pink/objects/handlers/handler_mgr.cpp
+++ b/engines/pink/objects/handlers/handler_mgr.cpp
@@ -10,7 +10,7 @@
namespace Pink {
-void HandlerMgr::deserialize(Pink::Archive &archive) {
+void HandlerMgr::deserialize(Archive &archive) {
archive >> _leftClickHandlers >> _useClickHandlers >> _timerHandlers;
}
@@ -19,10 +19,10 @@ void HandlerMgr::toConsole() {
for (int i = 0; i < _leftClickHandlers.size(); ++i) {
_leftClickHandlers[i]->toConsole();
}
- for (int i = 0; i < _leftClickHandlers.size(); ++i) {
+ for (int i = 0; i < _useClickHandlers.size(); ++i) {
_useClickHandlers[i]->toConsole();
}
- for (int i = 0; i < _leftClickHandlers.size(); ++i) {
+ for (int i = 0; i < _timerHandlers.size(); ++i) {
_timerHandlers[i]->toConsole();
}
}
diff --git a/engines/pink/objects/module.cpp b/engines/pink/objects/module.cpp
index f768020..eb6d792 100644
--- a/engines/pink/objects/module.cpp
+++ b/engines/pink/objects/module.cpp
@@ -81,7 +81,6 @@ PinkEngine *Module::getGame() const {
}
bool Module::checkValueOfVariable(Common::String &variable, Common::String &value) {
- //assert(_variables.contains(variable));
if (!_variables.contains(variable))
return value == "UNDEFINED";
return _variables[variable] == value;
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index 8711a7e..5ff7f0b 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -115,7 +115,8 @@ Module *GamePage::getModule() const {
}
bool GamePage::checkValueOfVariable(Common::String &variable, Common::String &value) {
- assert(_variables.contains(variable));
+ if (!_variables.contains(variable))
+ return value == "UNDEFINED";
return _variables[variable] == value;
}
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index 4c5b7ce..5ced8cb 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -186,7 +186,8 @@ void PinkEngine::loadModule(int index) {
}
bool PinkEngine::checkValueOfVariable(Common::String &variable, Common::String &value) {
- assert(_variables.contains(variable));
+ if (!_variables.contains(variable))
+ return value == "UNDEFINED";
return _variables[variable] == value;
}
Commit: 7168242832e8bd71e0e2a2617f6e8e6e56e6cd8e
https://github.com/scummvm/scummvm/commit/7168242832e8bd71e0e2a2617f6e8e6e56e6cd8e
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: small fixes and implemented skipping of sequence by buttons
Changed paths:
engines/pink/archive.cpp
engines/pink/file.cpp
engines/pink/file.h
engines/pink/objects/actions/action_sound.cpp
engines/pink/objects/actions/action_sound.h
engines/pink/objects/actors/actor.h
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/actors/lead_actor.h
engines/pink/objects/module.cpp
engines/pink/objects/sequences/sequence_context.cpp
engines/pink/objects/sequences/sequence_context.h
engines/pink/objects/sequences/sequencer.cpp
engines/pink/objects/sequences/sequencer.h
engines/pink/pink.cpp
engines/pink/pink.h
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp
index 6bd2959..919d5fc 100644
--- a/engines/pink/archive.cpp
+++ b/engines/pink/archive.cpp
@@ -308,7 +308,7 @@ Object *Archive::readObject() {
Object *Archive::parseObject(bool &isCopyReturned) {
char className[kMaxClassLength];
int objectId = 0;
- Object *res = 0;
+ Object *res = nullptr;
uint obTag = _file.readUint16LE();
@@ -355,7 +355,7 @@ Object *Archive::parseObject(bool &isCopyReturned) {
}
uint Archive::findObjectId(const char *name) {
- RuntimeClass * found = static_cast<RuntimeClass*>
+ RuntimeClass *found = static_cast<RuntimeClass*>
(bsearch(name, classMap, sizeof(classMap) / sizeof(RuntimeClass) , sizeof(RuntimeClass), [] (const void *a, const void *b) {
return strcmp((const char *) a, *(const char **) b);
}));
diff --git a/engines/pink/file.cpp b/engines/pink/file.cpp
index d5e9059..2c27dab 100644
--- a/engines/pink/file.cpp
+++ b/engines/pink/file.cpp
@@ -30,13 +30,7 @@ OrbFile::OrbFile()
: File(), _timestamp(0),
_tableOffset(0),
_tableSize(0),
- _table(nullptr)
-{
- debug("Object Description size: %u", sizeof(ObjectDescription));
- debug("Resource Description size: %u", sizeof(ResourceDescription));
- debug("OrbFile size: %lu", sizeof(OrbFile));
- debug("BroFile size: %lu", sizeof(BroFile));
-}
+ _table(nullptr) {}
OrbFile::~OrbFile() {
delete[] _table;
@@ -69,13 +63,10 @@ bool OrbFile::open(const Common::String &name) {
_tableSize = readUint32LE();
_table = new ObjectDescription[_tableSize];
- debug("Orb has %u object descriptions", _tableSize);
-
seek(_tableOffset);
for (size_t i = 0; i < _tableSize; ++i) {
_table[i].load(*this);
- debug("Object description %s loaded", _table[i].name);
}
return true;
@@ -83,10 +74,8 @@ bool OrbFile::open(const Common::String &name) {
void OrbFile::loadGame(PinkEngine *game) {
seekToObject("PinkGame");
-
Archive archive(*this);
archive.mapObject((Object *) game); // hack
-
game->load(archive);
}
@@ -126,7 +115,7 @@ ResourceDescription *OrbFile::getResDescTable(ObjectDescription *objDesc){
seek(objDesc->resourcesOffset);
ResourceDescription *table = new ResourceDescription[size];
- for (uint i = 0; i < size; ++i) {
+ for (size_t i = 0; i < size; ++i) {
table[i].load(*this);
}
@@ -143,7 +132,7 @@ bool BroFile::open(Common::String &name, uint32 orbTimestamp) {
debug("Bro v%hu.%hu loaded", major, minor);
- if (minor || major != 1){
+ if (major != 1 || minor != 0){
return false;
}
@@ -167,7 +156,7 @@ void ResourceDescription::load(Common::File &file) {
uint16 temp;
file.read(&temp, sizeof(temp));
- inBro = temp;
+ inBro = (bool) temp;
}
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/file.h b/engines/pink/file.h
index 36a6af2..ddaba37 100644
--- a/engines/pink/file.h
+++ b/engines/pink/file.h
@@ -44,17 +44,17 @@ struct ResourceDescription {
uint32 offset;
uint32 size;
bool inBro; // in original it is short.
- // Don't know what's better to use.(Perhaps no diffrence because of padding)
+ // Don't know what's better to use.(Perhaps no difference because of padding)
};
class PinkEngine;
+
class Object;
class OrbFile : public Common::File {
public:
OrbFile();
virtual ~OrbFile();
-
virtual bool open(const Common::String &name);
void loadGame(PinkEngine *game);
@@ -67,7 +67,7 @@ public:
uint32 getTimestamp();
private:
- void seekToObject(const char * name);
+ void seekToObject(const char *name);
uint32 _timestamp;
uint32 _tableOffset;
@@ -77,9 +77,6 @@ private:
class BroFile : public Common::File {
public:
- BroFile() = default;
- virtual ~BroFile() = default;
-
virtual bool open(Common::String &name, uint32 orbTimestamp);
};
diff --git a/engines/pink/objects/actions/action_sound.cpp b/engines/pink/objects/actions/action_sound.cpp
index 42d2795..44dfda4 100644
--- a/engines/pink/objects/actions/action_sound.cpp
+++ b/engines/pink/objects/actions/action_sound.cpp
@@ -35,6 +35,10 @@ ActionSound::ActionSound()
: _sound(nullptr), _isStopped(1)
{}
+ActionSound::~ActionSound(){
+ end();
+}
+
void ActionSound::deserialize(Archive &archive) {
Action::deserialize(archive);
archive >> _fileName;
@@ -66,14 +70,17 @@ void ActionSound::start(bool unk) {
}
void ActionSound::end() {
- debug("ActionSound %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
+ if (_sound) {
+ debug("ActionSound %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
- Director *director = _actor->getPage()->getGame()->getDirector();
- director->removeSound(this);
+ Director *director = _actor->getPage()->getGame()->getDirector();
+ director->removeSound(this);
+
+ _sound->stop();
- _sound->stop();
- delete _sound;
- _sound = nullptr;
+ delete _sound;
+ _sound = nullptr;
+ }
}
void ActionSound::update() {
diff --git a/engines/pink/objects/actions/action_sound.h b/engines/pink/objects/actions/action_sound.h
index e4bb2f1..3c71da4 100644
--- a/engines/pink/objects/actions/action_sound.h
+++ b/engines/pink/objects/actions/action_sound.h
@@ -32,6 +32,8 @@ class Sound;
class ActionSound : public Action {
public:
ActionSound();
+ ~ActionSound();
+
virtual void deserialize(Archive &archive);
virtual void toConsole();
diff --git a/engines/pink/objects/actors/actor.h b/engines/pink/objects/actors/actor.h
index 2dc9769..1d6fdf4 100644
--- a/engines/pink/objects/actors/actor.h
+++ b/engines/pink/objects/actors/actor.h
@@ -59,7 +59,7 @@ public:
bool initPallete(Director *director);
- void update() {};
+ virtual void update() {};
protected:
GamePage *_page;
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 5586113..7f750e1 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -32,6 +32,7 @@
namespace Pink {
void LeadActor::deserialize(Archive &archive) {
+ _state = kReady;
Actor::deserialize(archive);
_state = kReady;
_cursorMgr = static_cast<CursorMgr*>(archive.readObject());
@@ -79,6 +80,16 @@ void LeadActor::update() {
}
}
+void LeadActor::OnKeyboardButtonClick(Common::KeyCode code) {
+ switch (code) {
+ case Common::KEYCODE_SPACE:
+ case Common::KEYCODE_RIGHT:
+ _sequencer->skipSequence();
+
+ }
+
+}
+
void ParlSqPink::toConsole() {
debug("ParlSqPink: _name = %s", _name.c_str());
for (int i = 0; i < _actions.size(); ++i) {
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index d7c45e0..b60e35c 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -23,6 +23,7 @@
#ifndef PINK_LEAD_ACTOR_H
#define PINK_LEAD_ACTOR_H
+#include <common/keyboard.h>
#include "actor.h"
namespace Pink {
@@ -44,6 +45,7 @@ public:
kUnk_Loading // ????
};
+
virtual void deserialize(Archive &archive);
virtual void toConsole();
@@ -56,6 +58,7 @@ public:
void start(bool isHandler);
void update();
+ void OnKeyboardButtonClick(Common::KeyCode code);
private:
State _state;
CursorMgr *_cursorMgr;
diff --git a/engines/pink/objects/module.cpp b/engines/pink/objects/module.cpp
index eb6d792..f78f290 100644
--- a/engines/pink/objects/module.cpp
+++ b/engines/pink/objects/module.cpp
@@ -64,7 +64,10 @@ void Module::changePage(const Common::String &pageName) {
GamePage *page = nullptr;
page = findPage(pageName);
assert(_page != page);
+
//_page->clear
+
+
page->init(kLoadingNewGame);
}
diff --git a/engines/pink/objects/sequences/sequence_context.cpp b/engines/pink/objects/sequences/sequence_context.cpp
index 007213c..62717d0 100644
--- a/engines/pink/objects/sequences/sequence_context.cpp
+++ b/engines/pink/objects/sequences/sequence_context.cpp
@@ -71,4 +71,12 @@ SequenceContext::SequenceContext(Sequence *sequence, Sequencer *sequencer)
}
}
+int SequenceContext::getNextItemIndex() const {
+ return _nextItemIndex;
+}
+
+Sequence *SequenceContext::getSequence() const {
+ return _sequence;
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/sequences/sequence_context.h b/engines/pink/objects/sequences/sequence_context.h
index 0727127..47b35ee 100644
--- a/engines/pink/objects/sequences/sequence_context.h
+++ b/engines/pink/objects/sequences/sequence_context.h
@@ -49,6 +49,8 @@ class SequenceContext {
public:
SequenceContext(Sequence *sequence, Sequencer* sequencer);
+ int getNextItemIndex() const;
+ Sequence *getSequence() const;
public:
Sequence *_sequence;
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index fea28e5..272065b 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -81,4 +81,9 @@ void Sequencer::removeContext(SequenceContext *context) {
_context = 0;
}
+void Sequencer::skipSequence() {
+ if (_context && _context->getNextItemIndex() < _context->getSequence()->getItems().size())
+ _context->getSequence()->start(0);
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/sequences/sequencer.h b/engines/pink/objects/sequences/sequencer.h
index 55e8529..3ddf387 100644
--- a/engines/pink/objects/sequences/sequencer.h
+++ b/engines/pink/objects/sequences/sequencer.h
@@ -49,6 +49,7 @@ public:
void update();
+ void skipSequence();
public:
SequenceContext *_context;
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index 5ced8cb..40bfaed 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -29,6 +29,7 @@
#include "engines/pink/objects/actors/lead_actor.h"
#include <graphics/surface.h>
+
namespace Pink {
Pink::PinkEngine::PinkEngine(OSystem *system, const ADGameDescription *desc)
@@ -105,6 +106,7 @@ Common::Error Pink::PinkEngine::run() {
break;
case Common::EVENT_KEYDOWN:
+ _actor->OnKeyboardButtonClick(event.kbd.keycode);
break;
// don't know why it is used in original
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index 591d288..63a9a21 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -91,6 +91,8 @@ private:
Common::Error init();
void loadModule(int index);
+
+
Console *_console;
Common::RandomSource _rnd;
Commit: 43a5e46ce2156527ddec41be06fe09c26214ddbb
https://github.com/scummvm/scummvm/commit/43a5e46ce2156527ddec41be06fe09c26214ddbb
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added placeholders for remaining buttons
Changed paths:
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/actors/lead_actor.h
engines/pink/objects/sequences/sequencer.cpp
engines/pink/objects/sequences/sequencer.h
engines/pink/pink.cpp
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 7f750e1..b406dc7 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -81,11 +81,37 @@ void LeadActor::update() {
}
void LeadActor::OnKeyboardButtonClick(Common::KeyCode code) {
- switch (code) {
- case Common::KEYCODE_SPACE:
- case Common::KEYCODE_RIGHT:
- _sequencer->skipSequence();
-
+ switch(_state) {
+ case kMoving:
+ switch (code){
+ case Common::KEYCODE_ESCAPE:
+ // set unk variables
+ // Fall Through intended
+ case Common::KEYCODE_SPACE:
+ //skip walking animation
+ default:
+ break;
+ }
+ case kInDialog1:
+ case kInDialog2:
+ case kPlayingVideo:
+ switch (code) {
+ case Common::KEYCODE_SPACE:
+ case Common::KEYCODE_RIGHT:
+ _sequencer->skipSubSequence();
+ break;
+ case Common::KEYCODE_ESCAPE:
+ //End sequence
+ break;
+ case Common::KEYCODE_LEFT:
+ //return to start of sequence
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
}
}
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index b60e35c..4e17bf2 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -36,13 +36,13 @@ class LeadActor : public Actor {
public:
enum State {
kReady = 0,
- kMoving,
- kInDialog1, //???
- kInventory,
- kPDA,
- kInDialog2,//???
- kPlayingVideo, // ???
- kUnk_Loading // ????
+ kMoving = 1,
+ kInDialog1 = 2, //???
+ kInventory = 3,
+ kPDA = 4,
+ kInDialog2 = 5,//???
+ kPlayingVideo = 6, // ???
+ kUnk_Loading = 7// ????
};
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index 272065b..6175140 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -81,7 +81,7 @@ void Sequencer::removeContext(SequenceContext *context) {
_context = 0;
}
-void Sequencer::skipSequence() {
+void Sequencer::skipSubSequence() {
if (_context && _context->getNextItemIndex() < _context->getSequence()->getItems().size())
_context->getSequence()->start(0);
}
diff --git a/engines/pink/objects/sequences/sequencer.h b/engines/pink/objects/sequences/sequencer.h
index 3ddf387..182862f 100644
--- a/engines/pink/objects/sequences/sequencer.h
+++ b/engines/pink/objects/sequences/sequencer.h
@@ -49,7 +49,7 @@ public:
void update();
- void skipSequence();
+ void skipSubSequence();
public:
SequenceContext *_context;
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index 40bfaed..4513015 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -104,7 +104,6 @@ Common::Error Pink::PinkEngine::run() {
case Common::EVENT_LBUTTONDOWN:
break;
-
case Common::EVENT_KEYDOWN:
_actor->OnKeyboardButtonClick(event.kbd.keycode);
break;
Commit: 675f83256a01528cdaadd40d46bcbdc717633dd9
https://github.com/scummvm/scummvm/commit/675f83256a01528cdaadd40d46bcbdc717633dd9
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added button to toggle Drawing of Bounding Rectangles
Changed paths:
engines/pink/director.cpp
engines/pink/director.h
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/sequences/sequencer.cpp
engines/pink/objects/sequences/sequencer.h
engines/pink/pink.cpp
diff --git a/engines/pink/director.cpp b/engines/pink/director.cpp
index 18b1d38..3d218cb 100644
--- a/engines/pink/director.cpp
+++ b/engines/pink/director.cpp
@@ -29,7 +29,7 @@
namespace Pink {
Director::Director(OSystem *system)
- : _system(system) {}
+ : _system(system), showBounds(0) {}
void Director::draw() {
for (int i = 0; i < _sprites.size(); ++i) {
@@ -48,7 +48,7 @@ void Director::drawSprite(CelDecoder *decoder) {
uint16 colourIndex = decoder->getTransparentColourIndex();
- if (colourIndex != 0) {
+ if (!showBounds && colourIndex != 0) {
Graphics::Surface *screen = _system->lockScreen();
for (int y = 0; y < decoder->getHeight(); ++y) {
for (int x = 0; x < decoder->getWidth(); ++x) {
diff --git a/engines/pink/director.h b/engines/pink/director.h
index ce7d96f..63c6227 100644
--- a/engines/pink/director.h
+++ b/engines/pink/director.h
@@ -48,10 +48,11 @@ public:
void removeSound(ActionSound* sound);
void clear();
-private:
- void drawSprite(CelDecoder *decoder);
+ bool showBounds;
+private:
+ void drawSprite(CelDecoder *decoder);
OSystem *_system;
Common::Array<ActionCEL*> _sprites;
Common::Array<ActionSound*> _sounds;
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index b406dc7..1b38c86 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -101,10 +101,10 @@ void LeadActor::OnKeyboardButtonClick(Common::KeyCode code) {
_sequencer->skipSubSequence();
break;
case Common::KEYCODE_ESCAPE:
- //End sequence
+ _sequencer->skipToLastSubSequence();
break;
case Common::KEYCODE_LEFT:
- //return to start of sequence
+ _sequencer->startSequenceAgain();
break;
default:
break;
@@ -113,7 +113,6 @@ void LeadActor::OnKeyboardButtonClick(Common::KeyCode code) {
default:
break;
}
-
}
void ParlSqPink::toConsole() {
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index 6175140..69396c2 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -86,4 +86,12 @@ void Sequencer::skipSubSequence() {
_context->getSequence()->start(0);
}
+void Sequencer::startSequenceAgain() {
+
+}
+
+void Sequencer::skipToLastSubSequence() {
+
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/sequences/sequencer.h b/engines/pink/objects/sequences/sequencer.h
index 182862f..8099f2d 100644
--- a/engines/pink/objects/sequences/sequencer.h
+++ b/engines/pink/objects/sequences/sequencer.h
@@ -50,6 +50,8 @@ public:
void update();
void skipSubSequence();
+ void startSequenceAgain();
+ void skipToLastSubSequence();
public:
SequenceContext *_context;
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index 4513015..ac1060e 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -96,7 +96,6 @@ Common::Error Pink::PinkEngine::run() {
switch (event.type){
case Common::EVENT_QUIT:
case Common::EVENT_RTL:
- debug("Quit Event");
return Common::kNoError;
case Common::EVENT_MOUSEMOVE:
@@ -105,7 +104,9 @@ Common::Error Pink::PinkEngine::run() {
break;
case Common::EVENT_KEYDOWN:
- _actor->OnKeyboardButtonClick(event.kbd.keycode);
+ if (event.kbd.keycode == Common::KEYCODE_d)
+ _director.showBounds = !_director.showBounds;
+ else _actor->OnKeyboardButtonClick(event.kbd.keycode);
break;
// don't know why it is used in original
Commit: ea5cb3a60e281a76dd68335b95ba6b591b71fc22
https://github.com/scummvm/scummvm/commit/ea5cb3a60e281a76dd68335b95ba6b591b71fc22
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: implemented sequence restarting
Changed paths:
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/sequences/sequence.cpp
engines/pink/objects/sequences/sequence.h
engines/pink/objects/sequences/sequence_context.cpp
engines/pink/objects/sequences/sequence_context.h
engines/pink/objects/sequences/sequencer.cpp
engines/pink/objects/sequences/sequencer.h
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 1b38c86..be7dfbe 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -22,6 +22,7 @@
#include "lead_actor.h"
#include <engines/pink/objects/actions/action.h>
+#include <engines/pink/objects/sequences/sequence_context.h>
#include "engines/pink/objects/walk/walk_mgr.h"
#include "engines/pink/cursor_mgr.h"
#include "engines/pink/objects/sequences/sequencer.h"
@@ -104,7 +105,7 @@ void LeadActor::OnKeyboardButtonClick(Common::KeyCode code) {
_sequencer->skipToLastSubSequence();
break;
case Common::KEYCODE_LEFT:
- _sequencer->startSequenceAgain();
+ _sequencer->restartSequence();
break;
default:
break;
diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp
index 80f5c58..0ef7803 100644
--- a/engines/pink/objects/sequences/sequence.cpp
+++ b/engines/pink/objects/sequences/sequence.cpp
@@ -109,6 +109,12 @@ void Sequence::end() {
_sequencer->removeContext(_context);
}
+void Sequence::restart() {
+ _context->setNextItemIndex(0);
+ _context->clearActionsFromActorStates();
+ start(0);
+}
+
void SequenceAudio::deserialize(Archive &archive) {
Sequence::deserialize(archive);
archive >> _sound;
diff --git a/engines/pink/objects/sequences/sequence.h b/engines/pink/objects/sequences/sequence.h
index 3975acf..45d10e5 100644
--- a/engines/pink/objects/sequences/sequence.h
+++ b/engines/pink/objects/sequences/sequence.h
@@ -48,7 +48,7 @@ public:
void end();
void update();
-
+ void restart();
public:
SequenceContext *_context;
Sequencer *_sequencer;
diff --git a/engines/pink/objects/sequences/sequence_context.cpp b/engines/pink/objects/sequences/sequence_context.cpp
index 62717d0..675e567 100644
--- a/engines/pink/objects/sequences/sequence_context.cpp
+++ b/engines/pink/objects/sequences/sequence_context.cpp
@@ -79,4 +79,14 @@ Sequence *SequenceContext::getSequence() const {
return _sequence;
}
+void SequenceContext::clearActionsFromActorStates() {
+ for (int i = 0; i < _states.size(); ++i) {
+ _states[i]._actionName.clear();
+ }
+}
+
+void SequenceContext::setNextItemIndex(int index) {
+ _nextItemIndex = index;
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/sequences/sequence_context.h b/engines/pink/objects/sequences/sequence_context.h
index 47b35ee..f35f5e4 100644
--- a/engines/pink/objects/sequences/sequence_context.h
+++ b/engines/pink/objects/sequences/sequence_context.h
@@ -52,6 +52,10 @@ public:
int getNextItemIndex() const;
Sequence *getSequence() const;
+ void setNextItemIndex(int index);
+
+ void clearActionsFromActorStates();
+
public:
Sequence *_sequence;
Sequencer *_sequencer;
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index 69396c2..c08e7fe 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -86,8 +86,8 @@ void Sequencer::skipSubSequence() {
_context->getSequence()->start(0);
}
-void Sequencer::startSequenceAgain() {
-
+void Sequencer::restartSequence() {
+ _context->getSequence()->restart();
}
void Sequencer::skipToLastSubSequence() {
diff --git a/engines/pink/objects/sequences/sequencer.h b/engines/pink/objects/sequences/sequencer.h
index 8099f2d..f453ffb 100644
--- a/engines/pink/objects/sequences/sequencer.h
+++ b/engines/pink/objects/sequences/sequencer.h
@@ -50,7 +50,7 @@ public:
void update();
void skipSubSequence();
- void startSequenceAgain();
+ void restartSequence();
void skipToLastSubSequence();
public:
Commit: 48d34128b25a70c78bdfbcc6f15f673b643e20b1
https://github.com/scummvm/scummvm/commit/48d34128b25a70c78bdfbcc6f15f673b643e20b1
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: implemented skipping to last subsequence
Changed paths:
engines/pink/objects/sequences/sequence.cpp
engines/pink/objects/sequences/sequence.h
engines/pink/objects/sequences/sequence_item.cpp
engines/pink/objects/sequences/sequence_item.h
engines/pink/objects/sequences/sequencer.cpp
diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp
index 0ef7803..070147a 100644
--- a/engines/pink/objects/sequences/sequence.cpp
+++ b/engines/pink/objects/sequences/sequence.cpp
@@ -115,6 +115,24 @@ void Sequence::restart() {
start(0);
}
+void Sequence::skipToLastSubSequence() {
+ if (_unk && _context->getNextItemIndex() < _items.size()){
+ int i = _items.size() - 1;
+ while(i >= 0 && !_items[i--]->isLeader());
+ assert(i >= 0);
+ _context->setNextItemIndex(i);
+ _context->clearActionsFromActorStates();
+ skipItemsTo(i);
+ start(0);
+ }
+}
+
+void Sequence::skipItemsTo(int index) {
+ for(int i = 0; i < index; ++i){
+ _items[i]->skip(this);
+ }
+}
+
void SequenceAudio::deserialize(Archive &archive) {
Sequence::deserialize(archive);
archive >> _sound;
diff --git a/engines/pink/objects/sequences/sequence.h b/engines/pink/objects/sequences/sequence.h
index 45d10e5..1ca4079 100644
--- a/engines/pink/objects/sequences/sequence.h
+++ b/engines/pink/objects/sequences/sequence.h
@@ -49,6 +49,9 @@ public:
void update();
void restart();
+ void skipToLastSubSequence();
+ void skipItemsTo(int index);
+
public:
SequenceContext *_context;
Sequencer *_sequencer;
diff --git a/engines/pink/objects/sequences/sequence_item.cpp b/engines/pink/objects/sequences/sequence_item.cpp
index 3644261..f7870d3 100644
--- a/engines/pink/objects/sequences/sequence_item.cpp
+++ b/engines/pink/objects/sequences/sequence_item.cpp
@@ -107,4 +107,8 @@ void SequenceItemDefaultAction::toConsole() {
debug("\t\t\t\tSequenceItemDefaultAction: _actor=%s, _action=%s", _actor.c_str(), _action.c_str());
}
+void SequenceItemDefaultAction::skip(Sequence *sequence) {
+ execute(0, sequence, 1);
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/sequences/sequence_item.h b/engines/pink/objects/sequences/sequence_item.h
index 197280f..f217eaf 100644
--- a/engines/pink/objects/sequences/sequence_item.h
+++ b/engines/pink/objects/sequences/sequence_item.h
@@ -40,6 +40,7 @@ public:
virtual bool execute(int index, Sequence *sequence, bool unk2);
virtual bool isLeader();
+ virtual void skip(Sequence *sequence) {};
protected:
Common::String _actor;
@@ -65,6 +66,7 @@ private:
class SequenceItemDefaultAction : public SequenceItem {
public:
virtual bool execute(int index, Sequence *sequence, bool unk2);
+ virtual void skip(Sequence *sequence);
virtual void toConsole();
};
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index c08e7fe..4e59f18 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -78,7 +78,7 @@ void Sequencer::update() {
void Sequencer::removeContext(SequenceContext *context) {
delete _context;
- _context = 0;
+ _context = nullptr;
}
void Sequencer::skipSubSequence() {
@@ -91,7 +91,7 @@ void Sequencer::restartSequence() {
}
void Sequencer::skipToLastSubSequence() {
-
+ _context->getSequence()->skipToLastSubSequence();
}
} // End of namespace Pink
\ No newline at end of file
Commit: 896511c34ac1a5b0b41fcbd01e81272c219fb8bb
https://github.com/scummvm/scummvm/commit/896511c34ac1a5b0b41fcbd01e81272c219fb8bb
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: hacky implementation of SequenceAudio
Changed paths:
engines/pink/objects/sequences/sequence.cpp
engines/pink/objects/sequences/sequence.h
engines/pink/objects/sequences/sequencer.cpp
diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp
index 070147a..c2a0f73 100644
--- a/engines/pink/objects/sequences/sequence.cpp
+++ b/engines/pink/objects/sequences/sequence.cpp
@@ -28,6 +28,7 @@
#include "engines/pink/objects/pages/game_page.h"
#include "engines/pink/objects/actors/actor.h"
#include "sequence_context.h"
+#include "pink/sound.h"
namespace Pink {
@@ -135,15 +136,33 @@ void Sequence::skipItemsTo(int index) {
void SequenceAudio::deserialize(Archive &archive) {
Sequence::deserialize(archive);
- archive >> _sound;
+ archive >> _soundName;
}
void SequenceAudio::toConsole() {
- debug("\t\tSequenceAudio %s : _sound = %s", _name.c_str(), _sound.c_str());
+ debug("\t\tSequenceAudio %s : _sound = %s", _name.c_str(), _soundName.c_str());
debug("\t\t\tItems:");
for (int i = 0; i < _items.size(); ++i) {
_items[i]->toConsole();
}
}
+void SequenceAudio::end() {
+ delete _sound;
+ _sound = nullptr;
+ Sequence::end();
+}
+
+void SequenceAudio::update() {
+ // Not Working. In original there is check for current buffer size of wav file
+ Sequence::update();
+}
+
+void SequenceAudio::init(int unk) {
+ _unk2 = 0;
+ _sound = _sequencer->_page->loadSound(_soundName);
+ _sound->play(Audio::Mixer::SoundType::kMusicSoundType, 100, 0);
+ Sequence::init(unk);
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/sequences/sequence.h b/engines/pink/objects/sequences/sequence.h
index 1ca4079..08d0271 100644
--- a/engines/pink/objects/sequences/sequence.h
+++ b/engines/pink/objects/sequences/sequence.h
@@ -43,11 +43,11 @@ public:
Common::Array<SequenceItem*> &getItems();
void setContext(SequenceContext *context);
- void init(int unk);
+ virtual void init(int unk);
void start(int unk);
- void end();
+ virtual void end();
- void update();
+ virtual void update();
void restart();
void skipToLastSubSequence();
void skipItemsTo(int index);
@@ -57,17 +57,22 @@ public:
Sequencer *_sequencer;
Common::Array<SequenceItem*> _items;
int _unk;
-
};
+class Sound;
+
class SequenceAudio : public Sequence {
public:
virtual void deserialize(Archive &archive);
virtual void toConsole();
+ virtual void init(int unk);
+ virtual void end();
+ virtual void update();
+
private:
- Common::String _sound;
- int _unk1;
+ Common::String _soundName;
+ Sound *_sound;
int _unk2;
};
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index 4e59f18..057603a 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -60,7 +60,7 @@ void Sequencer::authorSequence(Sequence *sequence, bool unk) {
_context = new SequenceContext(sequence, this);
//unload array of unknown objects
_currentSequenceName = sequence->getName();
- sequence->start(unk);
+ sequence->init(unk);
}
else _currentSequenceName.clear();
}
Commit: e55839ff20ac5bd51fffb151bbb98249c94d2e77
https://github.com/scummvm/scummvm/commit/e55839ff20ac5bd51fffb151bbb98249c94d2e77
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added restart method to SequenceAudio
Changed paths:
engines/pink/objects/sequences/sequence.cpp
engines/pink/objects/sequences/sequence.h
diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp
index c2a0f73..f9aafa4 100644
--- a/engines/pink/objects/sequences/sequence.cpp
+++ b/engines/pink/objects/sequences/sequence.cpp
@@ -165,4 +165,9 @@ void SequenceAudio::init(int unk) {
Sequence::init(unk);
}
+void SequenceAudio::restart() {
+ _sound->play(Audio::Mixer::SoundType::kMusicSoundType, 100, 0);
+ Sequence::restart();
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/sequences/sequence.h b/engines/pink/objects/sequences/sequence.h
index 08d0271..8a9264a 100644
--- a/engines/pink/objects/sequences/sequence.h
+++ b/engines/pink/objects/sequences/sequence.h
@@ -48,7 +48,7 @@ public:
virtual void end();
virtual void update();
- void restart();
+ virtual void restart();
void skipToLastSubSequence();
void skipItemsTo(int index);
@@ -69,6 +69,7 @@ public:
virtual void init(int unk);
virtual void end();
virtual void update();
+ virtual void restart();
private:
Common::String _soundName;
Commit: 37dbe057a89d919ad61fa5c2e09c3b0415e91f2b
https://github.com/scummvm/scummvm/commit/37dbe057a89d919ad61fa5c2e09c3b0415e91f2b
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fixed sideEffect and choosing of handler
Changed paths:
engines/pink/objects/handlers/handler.cpp
engines/pink/objects/side_effect.cpp
engines/pink/pink.cpp
diff --git a/engines/pink/objects/handlers/handler.cpp b/engines/pink/objects/handlers/handler.cpp
index ed553a1..0e92616 100644
--- a/engines/pink/objects/handlers/handler.cpp
+++ b/engines/pink/objects/handlers/handler.cpp
@@ -39,7 +39,7 @@ void Handler::deserialize(Archive &archive) {
bool Handler::isSuitable(LeadActor *actor) {
for (int i = 0; i < _conditions.size(); ++i) {
- if (_conditions[i]->evaluate(actor)){
+ if (!_conditions[i]->evaluate(actor)){
return false;
}
}
diff --git a/engines/pink/objects/side_effect.cpp b/engines/pink/objects/side_effect.cpp
index 8e6fb5e..516a509 100644
--- a/engines/pink/objects/side_effect.cpp
+++ b/engines/pink/objects/side_effect.cpp
@@ -88,7 +88,7 @@ void SideEffectGameVariable::toConsole() {
void SideEffectModuleVariable::execute(LeadActor *actor) {
- actor->getPage()->setVariable(_name, _value);
+ actor->getPage()->getModule()->setVariable(_name, _value);
}
void SideEffectModuleVariable::toConsole() {
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index ac1060e..a4b603d 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -76,6 +76,7 @@ Common::Error PinkEngine::init() {
// TODO load cursor
+
_orb.loadGame(this);
const Common::String empty;
initModule(_modules[0]->getName(), kLoadingNewGame, empty);
Commit: a75aeb62eec1208482a04e401cc105adc1ac3a4d
https://github.com/scummvm/scummvm/commit/a75aeb62eec1208482a04e401cc105adc1ac3a4d
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fixes for Peril
Changed paths:
engines/pink/archive.cpp
engines/pink/objects/actors/actor.cpp
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp
index 919d5fc..e3fab53 100644
--- a/engines/pink/archive.cpp
+++ b/engines/pink/archive.cpp
@@ -210,9 +210,8 @@ static Object* createObject(int objectId){
case kHandlerStartPage:
return new HandlerStartPage;
case kHandlerTimer:
- return new HandlerTimer;
case kHandlerTimerActions:
- return new HandlerTimerActions;
+ return new HandlerTimerActions; // hack for Peril, but behavior is correct
case kHandlerTimerSequences:
return new HandlerTimerSequences;
case kHandlerUseClick:
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index ba270ff..dc4e59f 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -45,10 +45,13 @@ Sequencer *Actor::getSequencer() const {
}
Action *Actor::findAction(const Common::String &name) {
- return *Common::find_if(_actions.begin(), _actions.end(), [&name]
+ Action ** action = Common::find_if(_actions.begin(), _actions.end(), [&name]
(Action* action) {
return name == action->getName();
});;
+ if (!action)
+ return nullptr;
+ return *action;
}
GamePage *Actor::getPage() const {
Commit: f9c94a40a43ae26ca493c06e9356a1757f5d4d02
https://github.com/scummvm/scummvm/commit/f9c94a40a43ae26ca493c06e9356a1757f5d4d02
Author: whitertandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Implemented SequenceAudio as in original.
Now Peril's intro is almost like in original
Changed paths:
engines/pink/objects/sequences/sequence.cpp
engines/pink/objects/sequences/sequence.h
engines/pink/objects/sequences/sequence_item.cpp
engines/pink/objects/sequences/sequence_item.h
engines/pink/sound.cpp
engines/pink/sound.h
diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp
index f9aafa4..2071683 100644
--- a/engines/pink/objects/sequences/sequence.cpp
+++ b/engines/pink/objects/sequences/sequence.cpp
@@ -147,6 +147,15 @@ void SequenceAudio::toConsole() {
}
}
+void SequenceAudio::start(int unk) {
+ Sequence::start(unk);
+ int index = _context->getNextItemIndex();
+ if (index < _items.size()) {
+ auto leaderAudio = (SequenceItemLeaderAudio*) _items[index];
+ _sample = leaderAudio->getSample();
+ }
+}
+
void SequenceAudio::end() {
delete _sound;
_sound = nullptr;
@@ -154,12 +163,15 @@ void SequenceAudio::end() {
}
void SequenceAudio::update() {
- // Not Working. In original there is check for current buffer size of wav file
- Sequence::update();
+ if (!_sound->isPlaying())
+ end();
+ else if (_sample <= _sound->getCurrentSample()){
+ start(0);
+ }
}
void SequenceAudio::init(int unk) {
- _unk2 = 0;
+ _sample = 0;
_sound = _sequencer->_page->loadSound(_soundName);
_sound->play(Audio::Mixer::SoundType::kMusicSoundType, 100, 0);
Sequence::init(unk);
diff --git a/engines/pink/objects/sequences/sequence.h b/engines/pink/objects/sequences/sequence.h
index 8a9264a..e4695f2 100644
--- a/engines/pink/objects/sequences/sequence.h
+++ b/engines/pink/objects/sequences/sequence.h
@@ -44,7 +44,7 @@ public:
void setContext(SequenceContext *context);
virtual void init(int unk);
- void start(int unk);
+ virtual void start(int unk);
virtual void end();
virtual void update();
@@ -67,6 +67,7 @@ public:
virtual void toConsole();
virtual void init(int unk);
+ virtual void start(int unk);
virtual void end();
virtual void update();
virtual void restart();
@@ -74,7 +75,7 @@ public:
private:
Common::String _soundName;
Sound *_sound;
- int _unk2;
+ int _sample;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/sequences/sequence_item.cpp b/engines/pink/objects/sequences/sequence_item.cpp
index f7870d3..5ea7b74 100644
--- a/engines/pink/objects/sequences/sequence_item.cpp
+++ b/engines/pink/objects/sequences/sequence_item.cpp
@@ -85,11 +85,15 @@ void SequenceItemLeader::toConsole() {
void SequenceItemLeaderAudio::deserialize(Archive &archive) {
SequenceItem::deserialize(archive);
- archive.readDWORD();
+ _sample = archive.readDWORD();
}
void SequenceItemLeaderAudio::toConsole() {
- debug("\t\t\t\tSequenceItemLeaderAudio: _actor=%s, _action=%s", _actor.c_str(), _action.c_str());
+ debug("\t\t\t\tSequenceItemLeaderAudio: _actor=%s, _action=%s _sample=%d", _actor.c_str(), _action.c_str(), _sample);
+}
+
+uint32 SequenceItemLeaderAudio::getSample() {
+ return _sample;
}
bool SequenceItemDefaultAction::execute(int index, Sequence *sequence, bool unk2) {
diff --git a/engines/pink/objects/sequences/sequence_item.h b/engines/pink/objects/sequences/sequence_item.h
index f217eaf..0563310 100644
--- a/engines/pink/objects/sequences/sequence_item.h
+++ b/engines/pink/objects/sequences/sequence_item.h
@@ -53,14 +53,14 @@ public:
virtual bool isLeader();
};
-// behaviour is identical to SequenceItemLeader
class SequenceItemLeaderAudio : public SequenceItemLeader {
public:
virtual void deserialize(Archive &archive);
virtual void toConsole();
+ uint32 getSample();
private:
- //uint32 _sample; // zero in data files and not used;
+ uint32 _sample;
};
class SequenceItemDefaultAction : public SequenceItem {
diff --git a/engines/pink/sound.cpp b/engines/pink/sound.cpp
index cf62f03..5312c96 100644
--- a/engines/pink/sound.cpp
+++ b/engines/pink/sound.cpp
@@ -84,4 +84,8 @@ void Sound::setBalance(int8 balance) {
_mixer->setChannelBalance(_handle, balance);
}
+uint32 Sound::getCurrentSample() {
+ return _mixer->getSoundElapsedTime(_handle) * 22050 / 1000;
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/sound.h b/engines/pink/sound.h
index fdd5e23..9e9dbdf 100644
--- a/engines/pink/sound.h
+++ b/engines/pink/sound.h
@@ -49,6 +49,7 @@ public:
void resume();
void stop();
+ uint32 getCurrentSample();
void setBalance(int8 balance);
private:
Commit: 65eccb7ba7e0d93ed9afc58e6312ee4bd04aa21e
https://github.com/scummvm/scummvm/commit/65eccb7ba7e0d93ed9afc58e6312ee4bd04aa21e
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added basic ActionLoop implementation
Changed paths:
engines/pink/objects/actions/action.h
engines/pink/objects/actions/action_cel.cpp
engines/pink/objects/actions/action_cel.h
engines/pink/objects/actions/action_loop.cpp
engines/pink/objects/actions/action_loop.h
engines/pink/objects/actors/actor.cpp
diff --git a/engines/pink/objects/actions/action.h b/engines/pink/objects/actions/action.h
index 3b79be2..f981b52 100644
--- a/engines/pink/objects/actions/action.h
+++ b/engines/pink/objects/actions/action.h
@@ -38,7 +38,7 @@ public:
virtual void update() {};
virtual void toConsole() {};
- virtual bool initPallete(Director *director) { return 0;}
+ virtual bool initPalette(Director *director) { return 0;}
protected:
Actor *_actor;
diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp
index 312ae31..c8d9eb7 100644
--- a/engines/pink/objects/actions/action_cel.cpp
+++ b/engines/pink/objects/actions/action_cel.cpp
@@ -63,7 +63,7 @@ CelDecoder *ActionCEL::getDecoder() {
return _decoder;
}
-bool ActionCEL::initPallete(Director *director) {
+bool ActionCEL::initPalette(Director *director) {
_decoder = _actor->getPage()->loadCel(_fileName);
_decoder->decodeNextFrame();
_decoder->rewind();
diff --git a/engines/pink/objects/actions/action_cel.h b/engines/pink/objects/actions/action_cel.h
index 7c0f750..43fe847 100644
--- a/engines/pink/objects/actions/action_cel.h
+++ b/engines/pink/objects/actions/action_cel.h
@@ -41,7 +41,7 @@ public:
uint32 getZ();
CelDecoder *getDecoder();
- virtual bool initPallete(Director *director);
+ virtual bool initPalette(Director *director);
protected:
virtual void onStart() {} ;
diff --git a/engines/pink/objects/actions/action_loop.cpp b/engines/pink/objects/actions/action_loop.cpp
index 25e4d66..81760c5 100644
--- a/engines/pink/objects/actions/action_loop.cpp
+++ b/engines/pink/objects/actions/action_loop.cpp
@@ -22,8 +22,9 @@
#include "action_loop.h"
-#include <common/debug.h>
#include <pink/archive.h>
+#include <pink/objects/actors/actor.h>
+#include <pink/cel_decoder.h>
namespace Pink {
@@ -40,8 +41,8 @@ void ActionLoop::deserialize(Archive &archive) {
break;
default:
_style = kForward;
+ break;
}
- //_style = static_cast<Style>(style);
}
void ActionLoop::toConsole() {
@@ -50,4 +51,19 @@ void ActionLoop::toConsole() {
_name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame, _intro, _style);
}
+void ActionLoop::update() {
+ // for now it supports only forward loop animation
+ if (_style == kForward) {
+ if (_decoder->endOfVideo()){
+ debug("ACTION LOOP : NEXT ITERATION");
+ _decoder->rewind();
+ }
+ }
+}
+
+void ActionLoop::onStart() {
+ ActionPlay::onStart();
+ _actor->endAction();
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/actions/action_loop.h b/engines/pink/objects/actions/action_loop.h
index a031bd1..b8f5be3 100644
--- a/engines/pink/objects/actions/action_loop.h
+++ b/engines/pink/objects/actions/action_loop.h
@@ -31,8 +31,10 @@ class ActionLoop : public ActionPlay {
public:
virtual void deserialize(Archive &archive);
virtual void toConsole();
-
+ virtual void update();
protected:
+ virtual void onStart();
+
enum Style {
kPingPong = 2,
kRandom = 3,
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index dc4e59f..c6ea1dc 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -116,7 +116,7 @@ bool Actor::isPlaying() {
bool Actor::initPallete(Director *director) {
for (int i = 0; i < _actions.size(); ++i) {
- if (_actions[i]->initPallete(director))
+ if (_actions[i]->initPalette(director))
return true;
}
return false;
Commit: 1a2bd666b0830ac2daa7a1b8778091b259c7021a
https://github.com/scummvm/scummvm/commit/1a2bd666b0830ac2daa7a1b8778091b259c7021a
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added ActionPlayWithSfx implementation
Changed paths:
engines/pink/file.cpp
engines/pink/file.h
engines/pink/objects/actions/action_cel.cpp
engines/pink/objects/actions/action_play_with_sfx.cpp
engines/pink/objects/actions/action_play_with_sfx.h
engines/pink/objects/actions/action_text.cpp
engines/pink/objects/actions/walk_action.h
engines/pink/objects/actors/cursor_actor.h
engines/pink/objects/side_effect.cpp
engines/pink/objects/side_effect.h
diff --git a/engines/pink/file.cpp b/engines/pink/file.cpp
index 2c27dab..b308c5b 100644
--- a/engines/pink/file.cpp
+++ b/engines/pink/file.cpp
@@ -101,7 +101,6 @@ void OrbFile::seekToObject(const char *name) {
seek(desc->objectsOffset);
}
-
ObjectDescription *OrbFile::getObjDesc(const char *name){
ObjectDescription *desc = static_cast<ObjectDescription*>(bsearch(name, _table, _tableSize, sizeof(ObjectDescription),
[] (const void *a, const void *b) {
diff --git a/engines/pink/file.h b/engines/pink/file.h
index ddaba37..c87fd79 100644
--- a/engines/pink/file.h
+++ b/engines/pink/file.h
@@ -48,7 +48,6 @@ struct ResourceDescription {
};
class PinkEngine;
-
class Object;
class OrbFile : public Common::File {
diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp
index c8d9eb7..7436c85 100644
--- a/engines/pink/objects/actions/action_cel.cpp
+++ b/engines/pink/objects/actions/action_cel.cpp
@@ -43,8 +43,6 @@ void ActionCEL::deserialize(Archive &archive) {
void ActionCEL::start(bool unk) {
if (!_decoder)
_decoder = _actor->getPage()->loadCel(_fileName);
- //if (_fileName =="IT01PP01.CEL")
- // initPallete(_actor->getPage()->getGame()->getDirector());
_actor->getPage()->getGame()->getDirector()->addSprite(this);
this->onStart();
}
diff --git a/engines/pink/objects/actions/action_play_with_sfx.cpp b/engines/pink/objects/actions/action_play_with_sfx.cpp
index 60ecd2a..a28a067 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.cpp
+++ b/engines/pink/objects/actions/action_play_with_sfx.cpp
@@ -21,7 +21,10 @@
*/
#include "action_play_with_sfx.h"
-#include <pink/archive.h>
+#include <pink/objects/pages/game_page.h>
+#include <pink/sound.h>
+#include <pink/objects/actors/actor.h>
+#include <pink/cel_decoder.h>
namespace Pink {
@@ -38,14 +41,58 @@ void Pink::ActionPlayWithSfx::toConsole() {
}
}
-void Pink::ActionSfx::deserialize(Pink::Archive &archive) {
- archive >> _frame >> _volume >> _sfx;
- _action = (ActionPlayWithSfx*) archive.readObject();
+void ActionPlayWithSfx::update() {
+ if (_decoder->endOfVideo() && _isLoop) {
+ _decoder->rewind();
+ } else if (_decoder->endOfVideo()) {
+ _decoder->stop();
+ _actor->endAction();
+ }
+ updateSound();
+}
+void ActionPlayWithSfx::onStart() {
+ ActionPlay::onStart();
+ if (_isLoop) {
+ _actor->endAction();
+ }
+ updateSound();
+}
+
+void ActionPlayWithSfx::updateSound() {
+ for (int i = 0; i < _sfxArray.size(); ++i) {
+ if (_sfxArray[i]->getFrame() == _decoder->getCurFrame()) {
+ _sfxArray[i]->play(_actor->getPage());
+ }
+ }
+}
+
+ActionPlayWithSfx::~ActionPlayWithSfx() {
+ for (int i = 0; i < _sfxArray.size(); ++i) {
+ delete _sfxArray[i];
+ }
+}
+
+void Pink::ActionSfx::deserialize(Pink::Archive &archive) {
+ archive >> _frame >> _volume >> _sfxName;
+ archive.readObject();
}
void Pink::ActionSfx::toConsole() {
- debug("\t\tActionSfx: _sfx = %s, _volume = %u, _frame = %u", _sfx.c_str(), _volume, _frame);
+ debug("\t\tActionSfx: _sfx = %s, _volume = %u, _frame = %u", _sfxName.c_str(), _volume, _frame);
+}
+
+void ActionSfx::play(GamePage *page) {
+ _sound = page->loadSound(_sfxName);
+ _sound->play(Audio::Mixer::SoundType::kSFXSoundType, _volume, 0);
+}
+
+ActionSfx::~ActionSfx() {
+ delete _sound;
+}
+
+uint32 ActionSfx::getFrame() {
+ return _frame;
}
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/actions/action_play_with_sfx.h b/engines/pink/objects/actions/action_play_with_sfx.h
index b558ee1c..7782e91 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.h
+++ b/engines/pink/objects/actions/action_play_with_sfx.h
@@ -31,26 +31,39 @@ namespace Pink {
class ActionSfx;
class ActionPlayWithSfx : public ActionPlay {
+ virtual ~ActionPlayWithSfx();
virtual void deserialize(Archive &archive);
virtual void toConsole();
+ virtual void update();
+
+protected:
+ virtual void onStart();
private:
+ void updateSound();
uint32 _isLoop;
Common::Array<ActionSfx*> _sfxArray;
};
+class Sound;
+class GamePage;
+
class ActionSfx : public Object {
public:
+ virtual ~ActionSfx();
virtual void deserialize(Archive &archive);
virtual void toConsole();
+ void play(GamePage *page);
+ uint32 getFrame();
+
private:
- ActionPlayWithSfx *_action;
- Common::String _sfx;
+ Sound *_sound;
+ Common::String _sfxName;
uint32 _volume;
uint32 _frame;
};
-}
+} // End of namespace Pink
#endif
diff --git a/engines/pink/objects/actions/action_text.cpp b/engines/pink/objects/actions/action_text.cpp
index ef21ef3..eaf1611 100644
--- a/engines/pink/objects/actions/action_text.cpp
+++ b/engines/pink/objects/actions/action_text.cpp
@@ -40,6 +40,4 @@ void ActionText::toConsole() {
_name.c_str(), _text.c_str(), _bounds[0], _bounds[1], _bounds[2], _bounds[3], _centered, _scrollBar, _textColor, _backgroundColor);
}
-
-
-}
\ No newline at end of file
+} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/actions/walk_action.h b/engines/pink/objects/actions/walk_action.h
index 923811f..6dbc6a9 100644
--- a/engines/pink/objects/actions/walk_action.h
+++ b/engines/pink/objects/actions/walk_action.h
@@ -37,6 +37,6 @@ private:
bool _toCalcFramePositions;
};
-}
+} // End of namespace Pink
#endif
diff --git a/engines/pink/objects/actors/cursor_actor.h b/engines/pink/objects/actors/cursor_actor.h
index 07616a2..32e433f 100644
--- a/engines/pink/objects/actors/cursor_actor.h
+++ b/engines/pink/objects/actors/cursor_actor.h
@@ -40,6 +40,6 @@ public:
}
};
-}
+} // End of namespace Pink
#endif
diff --git a/engines/pink/objects/side_effect.cpp b/engines/pink/objects/side_effect.cpp
index 516a509..124ba8a 100644
--- a/engines/pink/objects/side_effect.cpp
+++ b/engines/pink/objects/side_effect.cpp
@@ -44,7 +44,6 @@ void SideEffectExit::toConsole() {
debug("\t\tSideEffectExit: _nextModule=%s, _nextPage=%s", _nextModule.c_str(), _nextPage.c_str());
}
-
void SideEffectLocation::deserialize(Archive &archive) {
archive >> _location;
}
@@ -59,7 +58,6 @@ void SideEffectLocation::toConsole() {
debug("\t\tSideEffectLocation: _location=%s", _location.c_str());
}
-
void SideEffectInventoryItemOwner::deserialize(Archive &archive) {
archive >> _item >> _owner;
}
@@ -72,12 +70,10 @@ void SideEffectInventoryItemOwner::toConsole() {
debug("\t\tSideEffectInventoryItemOwner: _item=%s, _owner=%s", _item.c_str(), _owner.c_str());
}
-
void SideEffectVariable::deserialize(Pink::Archive &archive) {
archive >> _name >> _value;
}
-
void SideEffectGameVariable::execute(LeadActor *actor) {
actor->getPage()->getGame()->setVariable(_name, _value);
}
@@ -86,7 +82,6 @@ void SideEffectGameVariable::toConsole() {
debug("\t\tSideEffectGameVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
}
-
void SideEffectModuleVariable::execute(LeadActor *actor) {
actor->getPage()->getModule()->setVariable(_name, _value);
}
@@ -95,7 +90,6 @@ void SideEffectModuleVariable::toConsole() {
debug("\t\tSideEffectModuleVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
}
-
void SideEffectPageVariable::execute(LeadActor *actor) {
actor->getPage()->setVariable(_name, _value);
}
@@ -104,13 +98,12 @@ void SideEffectPageVariable::toConsole() {
debug("\t\tSideEffectPageVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
}
-
void SideEffectRandomPageVariable::deserialize(Archive &archive) {
archive >> _name >> _values;
}
void SideEffectRandomPageVariable::execute(LeadActor *actor) {
- assert(_values.size());
+ assert(!_values.empty());
Common::RandomSource &rnd = actor->getPage()->getGame()->getRnd();
uint index = rnd.getRandomNumber(_values.size() - 1);
diff --git a/engines/pink/objects/side_effect.h b/engines/pink/objects/side_effect.h
index 5134226..4542b7f 100644
--- a/engines/pink/objects/side_effect.h
+++ b/engines/pink/objects/side_effect.h
@@ -101,9 +101,9 @@ class SideEffectRandomPageVariable : public SideEffect
public:
virtual void deserialize(Archive &archive);
virtual void toConsole();
+ virtual void execute(LeadActor *actor);
private:
- virtual void execute(LeadActor *actor);
Common::String _name;
Common::StringArray _values;
};
Commit: 5db9a454581ff9b3f5e8160e401c0c741f321e9c
https://github.com/scummvm/scummvm/commit/5db9a454581ff9b3f5e8160e401c0c741f321e9c
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added ActionTalk implementation
Changed paths:
engines/pink/objects/actions/action_play_with_sfx.cpp
engines/pink/objects/actions/action_play_with_sfx.h
engines/pink/objects/actions/action_sound.cpp
engines/pink/objects/actions/action_sound.h
engines/pink/objects/actions/action_talk.cpp
engines/pink/objects/actions/action_talk.h
diff --git a/engines/pink/objects/actions/action_play_with_sfx.cpp b/engines/pink/objects/actions/action_play_with_sfx.cpp
index a28a067..8c41176 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.cpp
+++ b/engines/pink/objects/actions/action_play_with_sfx.cpp
@@ -68,6 +68,11 @@ void ActionPlayWithSfx::updateSound() {
}
ActionPlayWithSfx::~ActionPlayWithSfx() {
+ end();
+}
+
+void ActionPlayWithSfx::end() {
+ ActionPlay::end();
for (int i = 0; i < _sfxArray.size(); ++i) {
delete _sfxArray[i];
}
diff --git a/engines/pink/objects/actions/action_play_with_sfx.h b/engines/pink/objects/actions/action_play_with_sfx.h
index 7782e91..7e4448a 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.h
+++ b/engines/pink/objects/actions/action_play_with_sfx.h
@@ -36,6 +36,9 @@ class ActionPlayWithSfx : public ActionPlay {
virtual void toConsole();
virtual void update();
+public:
+ virtual void end();
+
protected:
virtual void onStart();
diff --git a/engines/pink/objects/actions/action_sound.cpp b/engines/pink/objects/actions/action_sound.cpp
index 44dfda4..f1829a1 100644
--- a/engines/pink/objects/actions/action_sound.cpp
+++ b/engines/pink/objects/actions/action_sound.cpp
@@ -32,7 +32,7 @@
namespace Pink {
ActionSound::ActionSound()
- : _sound(nullptr), _isStopped(1)
+ : _sound(nullptr)
{}
ActionSound::~ActionSound(){
diff --git a/engines/pink/objects/actions/action_sound.h b/engines/pink/objects/actions/action_sound.h
index 3c71da4..b13481c 100644
--- a/engines/pink/objects/actions/action_sound.h
+++ b/engines/pink/objects/actions/action_sound.h
@@ -48,7 +48,6 @@ private:
uint32 _volume;
bool _isLoop;
bool _isBackground;
- bool _isStopped;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_talk.cpp b/engines/pink/objects/actions/action_talk.cpp
index da37204..b974300 100644
--- a/engines/pink/objects/actions/action_talk.cpp
+++ b/engines/pink/objects/actions/action_talk.cpp
@@ -22,7 +22,9 @@
#include "action_talk.h"
#include <pink/archive.h>
-#include <common/debug.h>
+#include <pink/objects/actors/actor.h>
+#include <pink/objects/pages/game_page.h>
+#include <pink/sound.h>
namespace Pink {
@@ -37,4 +39,21 @@ void ActionTalk::toConsole() {
_name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame, _intro, _style, _vox.c_str());
}
+void ActionTalk::onStart() {
+ ActionPlay::onStart();
+ _sound = _actor->getPage()->loadSound(_vox);
+ _sound->play(Audio::Mixer::SoundType::kSpeechSoundType, 100, 0);
+}
+
+void ActionTalk::update() {
+ ActionLoop::update();
+ if (!_sound->isPlaying())
+ _actor->endAction();
+}
+
+void ActionTalk::end() {
+ ActionPlay::end();
+ delete _sound;
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/actions/action_talk.h b/engines/pink/objects/actions/action_talk.h
index 4c28a6f..9b6d26f 100644
--- a/engines/pink/objects/actions/action_talk.h
+++ b/engines/pink/objects/actions/action_talk.h
@@ -27,12 +27,21 @@
namespace Pink {
+class Sound;
+
class ActionTalk : public ActionLoop {
public:
virtual void deserialize(Archive &archive);
virtual void toConsole();
+ virtual void update();
+
+ virtual void end();
+
+protected:
+ virtual void onStart();
private:
+ Sound *_sound;
Common::String _vox;
};
Commit: 475f6a62bdaa058cff6371989004291fcec9feb1
https://github.com/scummvm/scummvm/commit/475f6a62bdaa058cff6371989004291fcec9feb1
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fixed some segfaults
Changed paths:
engines/pink/objects/actions/action_play_with_sfx.cpp
engines/pink/objects/actions/action_play_with_sfx.h
engines/pink/sound.cpp
diff --git a/engines/pink/objects/actions/action_play_with_sfx.cpp b/engines/pink/objects/actions/action_play_with_sfx.cpp
index 8c41176..8c8cf6f 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.cpp
+++ b/engines/pink/objects/actions/action_play_with_sfx.cpp
@@ -28,12 +28,12 @@
namespace Pink {
-void Pink::ActionPlayWithSfx::deserialize(Pink::Archive &archive) {
+void ActionPlayWithSfx::deserialize(Pink::Archive &archive) {
ActionPlay::deserialize(archive);
archive >> _isLoop >> _sfxArray;
}
-void Pink::ActionPlayWithSfx::toConsole() {
+void ActionPlayWithSfx::toConsole() {
debug("\tActionPlayWithSfx: _name = %s, _fileName = %s, z = %u, _startFrame = %u,"
" _endFrame = %u, _isLoop = %u", _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame);
for (int i = 0; i < _sfxArray.size(); ++i) {
@@ -68,36 +68,49 @@ void ActionPlayWithSfx::updateSound() {
}
ActionPlayWithSfx::~ActionPlayWithSfx() {
- end();
+ for (int i = 0; i < _sfxArray.size(); ++i) {
+ delete _sfxArray[i];
+ }
}
void ActionPlayWithSfx::end() {
ActionPlay::end();
for (int i = 0; i < _sfxArray.size(); ++i) {
- delete _sfxArray[i];
+ _sfxArray[i]->end();
}
}
-void Pink::ActionSfx::deserialize(Pink::Archive &archive) {
+void ActionSfx::deserialize(Pink::Archive &archive) {
archive >> _frame >> _volume >> _sfxName;
archive.readObject();
}
-void Pink::ActionSfx::toConsole() {
+void ActionSfx::toConsole() {
debug("\t\tActionSfx: _sfx = %s, _volume = %u, _frame = %u", _sfxName.c_str(), _volume, _frame);
}
void ActionSfx::play(GamePage *page) {
- _sound = page->loadSound(_sfxName);
+ if (!_sound)
+ _sound = page->loadSound(_sfxName);
+
_sound->play(Audio::Mixer::SoundType::kSFXSoundType, _volume, 0);
}
ActionSfx::~ActionSfx() {
- delete _sound;
+ end();
}
uint32 ActionSfx::getFrame() {
return _frame;
}
+ActionSfx::ActionSfx()
+ : _sound(nullptr)
+{}
+
+void ActionSfx::end() {
+ delete _sound;
+ _sound = nullptr;
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/actions/action_play_with_sfx.h b/engines/pink/objects/actions/action_play_with_sfx.h
index 7e4448a..020b380 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.h
+++ b/engines/pink/objects/actions/action_play_with_sfx.h
@@ -53,12 +53,14 @@ class GamePage;
class ActionSfx : public Object {
public:
+ ActionSfx();
virtual ~ActionSfx();
virtual void deserialize(Archive &archive);
virtual void toConsole();
void play(GamePage *page);
uint32 getFrame();
+ void end();
private:
Sound *_sound;
diff --git a/engines/pink/sound.cpp b/engines/pink/sound.cpp
index 5312c96..73899a3 100644
--- a/engines/pink/sound.cpp
+++ b/engines/pink/sound.cpp
@@ -64,14 +64,14 @@ void Sound::play(Audio::Mixer::SoundType type, int volume, bool isLoop) {
_stream = Audio::makeLoopingAudioStream(seekableStream, 0, 0, 0);
}
- _mixer->playStream(type, &_handle ,_stream);
+ _mixer->playStream(type, &_handle ,_stream, -1 , Audio::Mixer::kMaxChannelVolume, 0,DisposeAfterUse::NO);
}
bool Sound::load(Common::SeekableReadStream *stream) {
// Vox files in pink have wave format.
// RIFF (little-endian) data, WAVE audio, Microsoft PCM, 8 bit, mono 22050 Hz
- _stream = Audio::makeWAVStream(stream, DisposeAfterUse::NO);
+ _stream = Audio::makeWAVStream(stream, DisposeAfterUse::YES);
return isLoaded();
}
Commit: e48ac17f68ccd1b4432d9d6e15e811a88ea8daf4
https://github.com/scummvm/scummvm/commit/e48ac17f68ccd1b4432d9d6e15e811a88ea8daf4
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: small fixes
Changed paths:
engines/pink/file.cpp
engines/pink/objects/handlers/handler.cpp
engines/pink/objects/module.cpp
engines/pink/sound.cpp
diff --git a/engines/pink/file.cpp b/engines/pink/file.cpp
index b308c5b..5158601 100644
--- a/engines/pink/file.cpp
+++ b/engines/pink/file.cpp
@@ -75,7 +75,7 @@ bool OrbFile::open(const Common::String &name) {
void OrbFile::loadGame(PinkEngine *game) {
seekToObject("PinkGame");
Archive archive(*this);
- archive.mapObject((Object *) game); // hack
+ archive.mapObject(reinterpret_cast<Object*>(game)); // hack
game->load(archive);
}
diff --git a/engines/pink/objects/handlers/handler.cpp b/engines/pink/objects/handlers/handler.cpp
index 0e92616..a848cfd 100644
--- a/engines/pink/objects/handlers/handler.cpp
+++ b/engines/pink/objects/handlers/handler.cpp
@@ -65,7 +65,7 @@ void HandlerSequences::onMessage(LeadActor *actor) {
Handler::onMessage(actor);
Sequencer *sequencer = actor->getSequencer();
- assert(_sequences.size());
+ assert(!_sequences.empty());
Common::RandomSource &rnd = actor->getPage()->getGame()->getRnd();
uint index = rnd.getRandomNumber(_sequences.size() - 1);
diff --git a/engines/pink/objects/module.cpp b/engines/pink/objects/module.cpp
index f78f290..a8166de 100644
--- a/engines/pink/objects/module.cpp
+++ b/engines/pink/objects/module.cpp
@@ -50,11 +50,9 @@ void Module::init(bool isLoadingSave, const Common::String &pageName) {
// 0 0 - new game
// 0 1 - module changed
// 1 0 - from save
- if (!pageName.empty()) {
+ if (!pageName.empty())
_page = findPage(pageName);
- }
-
- if (!_page)
+ else if (!_page)
_page = _pages[0];
_page->init(isLoadingSave);
@@ -67,7 +65,6 @@ void Module::changePage(const Common::String &pageName) {
//_page->clear
-
page->init(kLoadingNewGame);
}
@@ -78,7 +75,6 @@ GamePage *Module::findPage(const Common::String &pageName) const {
});
}
-
PinkEngine *Module::getGame() const {
return _game;
}
diff --git a/engines/pink/sound.cpp b/engines/pink/sound.cpp
index 73899a3..b022751 100644
--- a/engines/pink/sound.cpp
+++ b/engines/pink/sound.cpp
@@ -34,8 +34,8 @@ Sound::Sound(Audio::Mixer *mixer, Common::SeekableReadStream *stream)
}
Sound::~Sound() {
- //look for mem leak
stop();
+ delete _stream;
}
bool Sound::isPlaying() {
@@ -64,7 +64,7 @@ void Sound::play(Audio::Mixer::SoundType type, int volume, bool isLoop) {
_stream = Audio::makeLoopingAudioStream(seekableStream, 0, 0, 0);
}
- _mixer->playStream(type, &_handle ,_stream, -1 , Audio::Mixer::kMaxChannelVolume, 0,DisposeAfterUse::NO);
+ _mixer->playStream(type, &_handle ,_stream, -1 , Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
}
bool Sound::load(Common::SeekableReadStream *stream) {
Commit: 49d5ea28c023a43f7d1444b55ac8c06df9966128
https://github.com/scummvm/scummvm/commit/49d5ea28c023a43f7d1444b55ac8c06df9966128
Author: whiterandrek (whiterandrek at gmail,com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added basic cursor implementation, fixed sequenceAudio restarting and skipping, fixed various mem leaks, hopefully fixed finding of transparent color index.
Changed paths:
A engines/pink/constants.h
engines/pink/archive.cpp
engines/pink/cel_decoder.cpp
engines/pink/cel_decoder.h
engines/pink/cursor_mgr.cpp
engines/pink/cursor_mgr.h
engines/pink/detection_tables.h
engines/pink/director.cpp
engines/pink/director.h
engines/pink/objects/actions/action.h
engines/pink/objects/actions/action_cel.cpp
engines/pink/objects/actions/action_loop.cpp
engines/pink/objects/actions/action_play_with_sfx.cpp
engines/pink/objects/actions/action_play_with_sfx.h
engines/pink/objects/actors/actor.cpp
engines/pink/objects/actors/actor.h
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/actors/lead_actor.h
engines/pink/objects/actors/supporting_actor.cpp
engines/pink/objects/actors/supporting_actor.h
engines/pink/objects/condition.cpp
engines/pink/objects/condition.h
engines/pink/objects/handlers/handler.cpp
engines/pink/objects/handlers/handler.h
engines/pink/objects/handlers/handler_mgr.cpp
engines/pink/objects/handlers/handler_mgr.h
engines/pink/objects/module.cpp
engines/pink/objects/module.h
engines/pink/objects/pages/game_page.cpp
engines/pink/objects/pages/game_page.h
engines/pink/objects/pages/page.cpp
engines/pink/objects/pages/page.h
engines/pink/objects/sequences/sequence.cpp
engines/pink/objects/sequences/sequence.h
engines/pink/objects/sequences/sequencer.cpp
engines/pink/pink.cpp
engines/pink/pink.h
engines/pink/sound.cpp
engines/pink/sound.h
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp
index e3fab53..4db6d8e 100644
--- a/engines/pink/archive.cpp
+++ b/engines/pink/archive.cpp
@@ -45,68 +45,10 @@
#include <engines/pink/objects/actors/cursor_actor.h>
#include <engines/pink/objects/handlers/handler_timer.h>
#include <engines/pink/objects/actors/inventory_actor.h>
+#include "constants.h"
namespace Pink {
-enum {
- kMaxClassLength = 32,
- kMaxStringLength = 64, // adjust
- kNullObject = 0
-};
-
-enum {
- kActionHide,
- kActionLoop,
- kActionPlay,
- kActionPlayWithSfx,
- kActionSfx,
- kActionSound,
- kActionStill,
- kActionTalk,
- kActionText,
- kActor,
- kAudioInfoPDAButton,
- kConditionGameVariable,
- kConditionInventoryItemOwner,
- kConditionModuleVariable,
- kConditionNotInventoryItemOwner,
- kConditionNotModuleVariable,
- kConditionNotPageVariable,
- kConditionPageVariable,
- kCursorActor,
- kGamePage,
- kHandlerLeftClick,
- kHandlerStartPage,
- kHandlerTimer,
- kHandlerTimerActions,
- kHandlerTimerSequences,
- kHandlerUseClick,
- kInventoryActor,
- kInventoryItem,
- kLeadActor,
- kModuleProxy,
- kPDAButtonActor,
- kParlSqPink,
- kPubPink,
- kSeqTimer,
- kSequence,
- kSequenceAudio,
- kSequenceItem,
- kSequenceItemDefaultAction,
- kSequenceItemLeader,
- kSequenceItemLeaderAudio,
- kSideEffectExit,
- kSideEffectGameVariable,
- kSideEffectInventoryItemOwner,
- kSideEffectLocation,
- kSideEffectModuleVariable,
- kSideEffectPageVariable,
- kSideEffectRandomPageVariable,
- kSupportingActor,
- kWalkAction,
- kWalkLocation
-};
-
static const struct RuntimeClass {
const char *name;
int id;
diff --git a/engines/pink/cel_decoder.cpp b/engines/pink/cel_decoder.cpp
index 82dca7b..b907f45 100644
--- a/engines/pink/cel_decoder.cpp
+++ b/engines/pink/cel_decoder.cpp
@@ -21,6 +21,7 @@
*/
#include <common/stream.h>
+#include <graphics/surface.h>
#include "cel_decoder.h"
namespace Pink {
@@ -79,6 +80,18 @@ const Graphics::Surface *CelDecoder::getCurrentFrame() {
return track->getCurrentFrame();
}
+Common::Point CelDecoder::getCenter() {
+ CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
+ if (!track)
+ return {0,0};
+ return track->getCenter();
+}
+
+Common::Rect &CelDecoder::getRectangle() {
+ CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
+ return track->getRect();
+}
+
CelDecoder::CelVideoTrack::CelVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height, bool skipHeader)
: FlicVideoTrack(stream, frameCount, width, height, 1), _center(0,0), _transparentColourIndex(0){
readHeader();
@@ -100,33 +113,21 @@ void CelDecoder::CelVideoTrack::readPrefixChunk() {
switch (subchunkType) {
case CEL_DATA:
- debug("%u", _fileStream->readUint16LE());
+ _fileStream->readUint16LE();
_center.x = _fileStream->readUint16LE();
_center.y = _fileStream->readUint16LE();
- debug("stretch x: %u", _fileStream->readUint16LE());
- debug("stretch y: %u", _fileStream->readUint16LE());
- debug("rotation x: %u", _fileStream->readUint16LE());
- debug("rotation y: %u", _fileStream->readUint16LE());
- debug("rotation z: %u", _fileStream->readUint16LE());
- debug("current Frame: %u", _fileStream->readUint16LE());
- debug("next frame offset: %u",_fileStream->readUint32LE());
- debug("tcolor: %u", _transparentColourIndex = _fileStream->readUint16LE());
- for (int j = 0; j < 18; ++j) {
- debug("%u", _fileStream->readUint16LE());
- }
break;
default:
error("Unknown subchunk type");
_fileStream->skip(subchunkSize - 6);
break;
}
-
+ _rect = Common::Rect::center(_center.x, _center.y, _surface->w, _surface->h);
}
void CelDecoder::CelVideoTrack::readHeader() {
- _fileStream->readUint16LE(); // flags
- // Note: The normal delay is a 32-bit integer (dword), whereas the overridden delay is a 16-bit integer (word)
- // the frame delay is the FLIC "speed", in milliseconds.
+ _fileStream->readUint16LE();
+
_frameDelay = _startFrameDelay = _fileStream->readUint32LE();
_fileStream->seek(80);
@@ -137,7 +138,6 @@ void CelDecoder::CelVideoTrack::readHeader() {
readPrefixChunk();
}
- // Seek to the first frame
_fileStream->seek(_offsetFrame1);
}
@@ -157,4 +157,42 @@ const Graphics::Surface *CelDecoder::CelVideoTrack::getCurrentFrame() {
return _surface;
}
+Common::Point CelDecoder::CelVideoTrack::getCenter() {
+ return _center;
+}
+
+Common::Rect &CelDecoder::CelVideoTrack::getRect() {
+ return _rect;
+}
+
+#define FRAME_TYPE 0xF1FA
+
+const Graphics::Surface *CelDecoder::CelVideoTrack::decodeNextFrame() {
+ // Read chunk
+ /*uint32 frameSize = */ _fileStream->readUint32LE();
+ uint16 frameType = _fileStream->readUint16LE();
+
+ switch (frameType) {
+ case FRAME_TYPE:
+ handleFrame();
+ break;
+ default:
+ error("FlicDecoder::decodeFrame(): unknown main chunk type (type = 0x%02X)", frameType);
+ break;
+ }
+
+ _curFrame++;
+ _nextFrameStartTime += _frameDelay;
+
+ if (_atRingFrame) {
+ // If we decoded the ring frame, seek to the second frame
+ _atRingFrame = false;
+ _fileStream->seek(_offsetFrame2);
+ }
+
+ if (_curFrame == 0)
+ _transparentColourIndex = *(byte*)_surface->getBasePtr(0,0);
+ return _surface;
+}
+
} // End of namepsace Pink
\ No newline at end of file
diff --git a/engines/pink/cel_decoder.h b/engines/pink/cel_decoder.h
index 3ccea1a..f0c612d 100644
--- a/engines/pink/cel_decoder.h
+++ b/engines/pink/cel_decoder.h
@@ -32,6 +32,9 @@ class CelDecoder : public Video::FlicDecoder {
public:
uint32 getX();
uint32 getY();
+ Common::Point getCenter();
+ Common::Rect &getRectangle();
+
uint16 getTransparentColourIndex();
const Graphics::Surface *getCurrentFrame();
@@ -45,14 +48,19 @@ protected:
uint32 getX() const;
uint32 getY() const;
+ Common::Point getCenter();
+ Common::Rect &getRect();
uint16 getTransparentColourIndex();
const Graphics::Surface *getCurrentFrame();
private:
+ const Graphics::Surface *decodeNextFrame();
void readPrefixChunk();
- uint16 _transparentColourIndex;
+
Common::Point _center;
+ Common::Rect _rect;
+ byte _transparentColourIndex;
};
};
diff --git a/engines/pink/constants.h b/engines/pink/constants.h
new file mode 100644
index 0000000..db9c60a
--- /dev/null
+++ b/engines/pink/constants.h
@@ -0,0 +1,136 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_CONSTANTS_H
+#define PINK_CONSTANTS_H
+
+namespace Pink {
+
+enum {
+ kMaxClassLength = 32,
+ kMaxStringLength = 64,
+ kNullObject = 0
+};
+
+enum {
+ kActionHide,
+ kActionLoop,
+ kActionPlay,
+ kActionPlayWithSfx,
+ kActionSfx,
+ kActionSound,
+ kActionStill,
+ kActionTalk,
+ kActionText,
+ kActor,
+ kAudioInfoPDAButton,
+ kConditionGameVariable,
+ kConditionInventoryItemOwner,
+ kConditionModuleVariable,
+ kConditionNotInventoryItemOwner,
+ kConditionNotModuleVariable,
+ kConditionNotPageVariable,
+ kConditionPageVariable,
+ kCursorActor,
+ kGamePage,
+ kHandlerLeftClick,
+ kHandlerStartPage,
+ kHandlerTimer,
+ kHandlerTimerActions,
+ kHandlerTimerSequences,
+ kHandlerUseClick,
+ kInventoryActor,
+ kInventoryItem,
+ kLeadActor,
+ kModuleProxy,
+ kPDAButtonActor,
+ kParlSqPink,
+ kPubPink,
+ kSeqTimer,
+ kSequence,
+ kSequenceAudio,
+ kSequenceItem,
+ kSequenceItemDefaultAction,
+ kSequenceItemLeader,
+ kSequenceItemLeaderAudio,
+ kSideEffectExit,
+ kSideEffectGameVariable,
+ kSideEffectInventoryItemOwner,
+ kSideEffectLocation,
+ kSideEffectModuleVariable,
+ kSideEffectPageVariable,
+ kSideEffectRandomPageVariable,
+ kSupportingActor,
+ kWalkAction,
+ kWalkLocation
+};
+
+enum {
+ kCursorsCount = 11
+};
+
+enum {
+ kLoadingCursor = 0,
+ kExitForwardCursor = 1,
+ kExitLeftCursor = 2,
+ kExitRightCursor = 3,
+ kDefaultCursor = 4,
+ kClickableFirstFrameCursor = 5,
+ kClickableSecondFrameCursor = 6,
+ kNotClickableCursor = 7,
+ kHoldingItemCursor = 8,
+ kPDAFirstCursor = 9,
+ kPDASecondCursor = 10
+};
+
+
+// values are from Hokus Pokus
+enum {
+ kPokusLoadingCursorID = 135,
+ kPokusExitForwardCursorID = 138,
+ kPokusExitLeftCursorID = 133,
+ kPokusExitRightCursorID = 134,
+ kPokusClickableFirstCursorID = 137,
+ kPokusClickableSecondCursorID = 136,
+ kPokusClickableThirdCursorID = 145,
+ kPokusNotClickableCursorID = 140,
+ kPokusHoldingItemCursorID = 147,
+ kPokusPDAFirstCursorID = 141,
+ kPokusPDASecondCursorID = 144
+};
+
+// from Peril
+// it contains cursors whose ids differ
+enum {
+ kPerilClickableThirdCursorID = 140,
+ kPerilNotClickableCursorID = 139,
+ kPerilPDASecondCursorID = 142
+};
+
+enum {
+ kLoadingSave = 1,
+ kLoadingNewGame = 0
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/cursor_mgr.cpp b/engines/pink/cursor_mgr.cpp
index b5f9d4c..b1a2182 100644
--- a/engines/pink/cursor_mgr.cpp
+++ b/engines/pink/cursor_mgr.cpp
@@ -21,9 +21,57 @@
*/
#include "cursor_mgr.h"
+#include "pink.h"
namespace Pink {
-CursorMgr::CursorMgr(GamePage *page) : _page(page) {}
+CursorMgr::CursorMgr(PinkEngine *game, GamePage *page)
+ : _actor(nullptr), _page(page), _game(game),
+ _isPlayingAnimation(0), _firstFrameIndex(0)
+{}
+
+CursorMgr::~CursorMgr() {}
+
+void CursorMgr::setCursor(uint index, Common::Point point) {
+ if (index == kClickableFirstFrameCursor) {
+ if (!_isPlayingAnimation) {
+ _isPlayingAnimation = 1;
+ _time = _game->getTotalPlayTime();
+ _firstFrameIndex = index;
+ _isSecondFrame = 0;
+ _game->setCursor(index);
+ }
+ }
+ else {
+ _isPlayingAnimation = 0;
+ _game->setCursor(index);
+ }
+}
+
+void CursorMgr::update() {
+ if (!_isPlayingAnimation)
+ return;
+
+ uint newTime = _game->getTotalPlayTime();
+ if (newTime - _time > 0xC8){
+ _time = newTime;
+ _isSecondFrame = !_isSecondFrame;
+ _game->setCursor(_firstFrameIndex + _isSecondFrame);
+ }
+}
+
+void CursorMgr::setCursor(Common::String &cursorName, Common::Point point) {
+ uint index;
+ if (cursorName == "ExitLeft") {
+ index = kExitLeftCursor;
+ }
+ else if (cursorName == "ExitRight"){
+ index = kExitRightCursor;
+ }
+ else if (cursorName == "ExitForward")
+ index = kExitForwardCursor;
+ else assert(0);
+ setCursor(index, point);
+}
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/cursor_mgr.h b/engines/pink/cursor_mgr.h
index bd5c17c..2b7d37d 100644
--- a/engines/pink/cursor_mgr.h
+++ b/engines/pink/cursor_mgr.h
@@ -23,21 +23,35 @@
#ifndef PINK_CURSOR_MGR_H
#define PINK_CURSOR_MGR_H
-#include "engines/pink/objects/object.h"
+#include <graphics/wincursor.h>
+#include <engines/pink/objects/object.h>
+#include <common/rect.h>
namespace Pink {
+
class Actor;
class GamePage;
+class PinkEngine;
class CursorMgr : public Object {
public:
- CursorMgr(GamePage *page);
+ CursorMgr(PinkEngine *game, GamePage *page);
+ ~CursorMgr();
+ void update();
+ void setCursor(uint index, Common::Point point);
+ void setCursor(Common::String &cursorName, Common::Point point);
private:
Actor *_actor;
GamePage *_page;
+ PinkEngine *_game;
+
+ uint _time;
+ uint _firstFrameIndex;
+ bool _isPlayingAnimation;
+ bool _isSecondFrame;
};
} // End of namespace Pink
diff --git a/engines/pink/detection_tables.h b/engines/pink/detection_tables.h
index b14803b..a59e4e3 100644
--- a/engines/pink/detection_tables.h
+++ b/engines/pink/detection_tables.h
@@ -33,6 +33,7 @@ static const ADGameDescription gameDescriptions[] = {
0,{
{"PPTP.ORB", NULL, NULL, -1},
{"PPTP.BRO", NULL, NULL, -1},
+ {"PPTP.EXE", NULL, NULL, -1},
AD_LISTEND},
Common::EN_ANY,
Common::kPlatformWindows,
@@ -41,8 +42,10 @@ static const ADGameDescription gameDescriptions[] = {
},
{
"pokus",
- 0,
- AD_ENTRY1s("hpp.ORB", NULL, -1),
+ 0, {
+ {"HPP.orb", NULL, NULL, -1},
+ {"hpp.exe", NULL, NULL, -1},
+ AD_LISTEND},
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
diff --git a/engines/pink/director.cpp b/engines/pink/director.cpp
index 3d218cb..3fa149e 100644
--- a/engines/pink/director.cpp
+++ b/engines/pink/director.cpp
@@ -32,28 +32,28 @@ Director::Director(OSystem *system)
: _system(system), showBounds(0) {}
void Director::draw() {
+ _system->fillScreen(0);
for (int i = 0; i < _sprites.size(); ++i) {
- CelDecoder *decoder = _sprites[i]->getDecoder();
- drawSprite(decoder);
+ drawSprite(_sprites[i]);
}
_system->updateScreen();
}
-void Director::drawSprite(CelDecoder *decoder) {
+void Director::drawSprite(ActionCEL *sprite) {
+ CelDecoder *decoder = sprite->getDecoder();
const Graphics::Surface *surface;
if (decoder->needsUpdate())
surface = decoder->decodeNextFrame();
else surface = decoder->getCurrentFrame();
-
- uint16 colourIndex = decoder->getTransparentColourIndex();
- if (!showBounds && colourIndex != 0) {
+ if (!showBounds) {
Graphics::Surface *screen = _system->lockScreen();
+
for (int y = 0; y < decoder->getHeight(); ++y) {
for (int x = 0; x < decoder->getWidth(); ++x) {
- byte spritePixelColourIndex = *(byte*)surface->getBasePtr(x, y);
- if (spritePixelColourIndex != colourIndex && spritePixelColourIndex != 229) { // hack because sprite have wrong colour index
+ uint16 spritePixelColourIndex = *(byte*)surface->getBasePtr(x, y);
+ if (spritePixelColourIndex != decoder->getTransparentColourIndex()) {
*(byte *) screen->getBasePtr(decoder->getX() + x, decoder->getY() + y) = spritePixelColourIndex;
}
}
@@ -115,4 +115,16 @@ void Director::clear() {
_sprites.clear();
}
+Actor *Director::getActorByPoint(Common::Point point) {
+ for (int i = _sprites.size() - 1; i > 0; --i) {
+ CelDecoder *decoder = _sprites[i]->getDecoder();
+ if (decoder->getRectangle().contains(point) &&
+ *(byte*)decoder->getCurrentFrame()->getBasePtr(640 - point.x, 480 - point.y)
+ != decoder->getTransparentColourIndex())
+ return _sprites[i]->getActor();
+ }
+
+ return nullptr;
+}
+
}
\ No newline at end of file
diff --git a/engines/pink/director.h b/engines/pink/director.h
index 63c6227..b03f22e 100644
--- a/engines/pink/director.h
+++ b/engines/pink/director.h
@@ -25,9 +25,11 @@
#include <common/array.h>
#include <common/system.h>
+#include <common/rect.h>
namespace Pink {
+class Actor;
class ActionCEL;
class ActionSound;
class CelDecoder;
@@ -49,10 +51,11 @@ public:
void clear();
+ Actor *getActorByPoint(Common::Point point);
bool showBounds;
private:
- void drawSprite(CelDecoder *decoder);
+ void drawSprite(ActionCEL *sprite);
OSystem *_system;
Common::Array<ActionCEL*> _sprites;
Common::Array<ActionSound*> _sounds;
diff --git a/engines/pink/objects/actions/action.h b/engines/pink/objects/actions/action.h
index f981b52..72e9b8f 100644
--- a/engines/pink/objects/actions/action.h
+++ b/engines/pink/objects/actions/action.h
@@ -40,6 +40,8 @@ public:
virtual bool initPalette(Director *director) { return 0;}
+ Actor *getActor() { return _actor;}
+
protected:
Actor *_actor;
};
diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp
index 7436c85..938d117 100644
--- a/engines/pink/objects/actions/action_cel.cpp
+++ b/engines/pink/objects/actions/action_cel.cpp
@@ -23,6 +23,7 @@
#include <common/debug.h>
#include "action_cel.h"
#include <pink/objects/actors/actor.h>
+#include <graphics/surface.h>
#include "engines/pink/archive.h"
#include "engines/pink/objects/pages/game_page.h"
#include "pink/pink.h"
@@ -44,6 +45,7 @@ void ActionCEL::start(bool unk) {
if (!_decoder)
_decoder = _actor->getPage()->loadCel(_fileName);
_actor->getPage()->getGame()->getDirector()->addSprite(this);
+
this->onStart();
}
diff --git a/engines/pink/objects/actions/action_loop.cpp b/engines/pink/objects/actions/action_loop.cpp
index 81760c5..c821fb1 100644
--- a/engines/pink/objects/actions/action_loop.cpp
+++ b/engines/pink/objects/actions/action_loop.cpp
@@ -55,7 +55,7 @@ void ActionLoop::update() {
// for now it supports only forward loop animation
if (_style == kForward) {
if (_decoder->endOfVideo()){
- debug("ACTION LOOP : NEXT ITERATION");
+ //debug("ACTION LOOP : NEXT ITERATION");
_decoder->rewind();
}
}
diff --git a/engines/pink/objects/actions/action_play_with_sfx.cpp b/engines/pink/objects/actions/action_play_with_sfx.cpp
index 8c8cf6f..fc4d48c 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.cpp
+++ b/engines/pink/objects/actions/action_play_with_sfx.cpp
@@ -93,7 +93,8 @@ void ActionSfx::play(GamePage *page) {
if (!_sound)
_sound = page->loadSound(_sfxName);
- _sound->play(Audio::Mixer::SoundType::kSFXSoundType, _volume, 0);
+ if (!_sound->isPlaying())
+ _sound->play(Audio::Mixer::SoundType::kSFXSoundType, _volume, 0);
}
ActionSfx::~ActionSfx() {
diff --git a/engines/pink/objects/actions/action_play_with_sfx.h b/engines/pink/objects/actions/action_play_with_sfx.h
index 020b380..c7aab59 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.h
+++ b/engines/pink/objects/actions/action_play_with_sfx.h
@@ -31,12 +31,11 @@ namespace Pink {
class ActionSfx;
class ActionPlayWithSfx : public ActionPlay {
+public:
virtual ~ActionPlayWithSfx();
virtual void deserialize(Archive &archive);
virtual void toConsole();
virtual void update();
-
-public:
virtual void end();
protected:
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index c6ea1dc..2bd6af4 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -20,10 +20,12 @@
*
*/
+#include <engines/pink/constants.h>
#include "actor.h"
#include "engines/pink/objects/pages/game_page.h"
#include "lead_actor.h"
#include "engines/pink/objects/actions/action.h"
+#include "pink/cursor_mgr.h"
namespace Pink {
@@ -122,4 +124,14 @@ bool Actor::initPallete(Director *director) {
return false;
}
+void Actor::onMouseOver(Common::Point point, CursorMgr *mgr) {
+ mgr->setCursor(kDefaultCursor, point);
+}
+
+Actor::~Actor() {
+ for (int i = 0; i < _actions.size(); ++i) {
+ delete _actions[i];
+ }
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/actor.h b/engines/pink/objects/actors/actor.h
index 1d6fdf4..270ac99 100644
--- a/engines/pink/objects/actors/actor.h
+++ b/engines/pink/objects/actors/actor.h
@@ -24,6 +24,7 @@
#define PINK_ACTOR_H
#include <common/array.h>
+#include <common/rect.h>
#include "engines/pink/objects/object.h"
namespace Pink {
@@ -32,6 +33,7 @@ class GamePage;
class Action;
class Sequencer;
class Director;
+class CursorMgr;
class Actor : public NamedObject {
public:
@@ -39,6 +41,7 @@ public:
: _page(nullptr), _action(nullptr),
_isActionEnded(1)
{};
+ ~Actor();
virtual void deserialize(Archive &archive);
virtual void toConsole();
@@ -61,6 +64,9 @@ public:
virtual void update() {};
+ virtual void onMouseOver(Common::Point point, CursorMgr *mgr);
+
+ virtual bool isClickable() { return 0;}
protected:
GamePage *_page;
Action *_action;
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index be7dfbe..e26b50a 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -29,13 +29,13 @@
#include "engines/pink/archive.h"
#include "engines/pink/objects/pages/game_page.h"
#include "engines/pink/pink.h"
+#include "supporting_actor.h"
namespace Pink {
void LeadActor::deserialize(Archive &archive) {
_state = kReady;
Actor::deserialize(archive);
- _state = kReady;
_cursorMgr = static_cast<CursorMgr*>(archive.readObject());
_walkMgr = static_cast<WalkMgr*>(archive.readObject());
_sequencer = static_cast<Sequencer*>(archive.readObject());
@@ -70,18 +70,36 @@ LeadActor::State LeadActor::getState() const {
void LeadActor::update() {
switch (_state) {
+ case kReady:
+
+ _sequencer->update();
+ //fall-through intended
+ case kMoving:
+
+ _cursorMgr->update();
+ break;
+ case kInDialog1:
+ case kInDialog2:
+ _sequencer->update();
+ break;
+
+ case kInventory:
+ case kPDA:
+ break;
+
case kPlayingVideo:
_sequencer->update();
if (!_sequencer->_context){
_state = kUnk_Loading;
_page->getGame()->changeScene(_page);
}
- default:
+ break;
+ case kUnk_Loading:
break;
}
}
-void LeadActor::OnKeyboardButtonClick(Common::KeyCode code) {
+void LeadActor::onKeyboardButtonClick(Common::KeyCode code) {
switch(_state) {
case kMoving:
switch (code){
@@ -116,6 +134,73 @@ void LeadActor::OnKeyboardButtonClick(Common::KeyCode code) {
}
}
+void LeadActor::start(bool isHandler) {
+ if (isHandler && _state != kPlayingVideo){
+ _state = kReady;
+ }
+ updateCursor({0,0});
+}
+
+void LeadActor::onMouseMove(Common::Point point) {
+ if (_state != kPDA)
+ updateCursor(point);
+ else error("pda is not supported");
+}
+
+void LeadActor::updateCursor(Common::Point point) {
+ switch (_state) {
+ case kReady:
+ case kMoving: {
+ Director *director = _page->getGame()->getDirector();
+ Actor *actor = director->getActorByPoint(point);
+ if (actor)
+ actor->onMouseOver(point, _cursorMgr);
+ else _cursorMgr->setCursor(kDefaultCursor, point);
+ break;
+ }
+ case kInDialog1:
+ case kInDialog2:
+ case kPlayingVideo:
+ _cursorMgr->setCursor(kNotClickableCursor, point);
+ break;
+ case kPDA:
+ case kInventory:
+ _cursorMgr->setCursor(kDefaultCursor, point);
+ break;
+ default:
+ break;
+ }
+}
+
+void LeadActor::onLeftButtonClick(Common::Point point) {
+ switch (_state) {
+ case kReady:
+ case kMoving: {
+ Actor *actor = _page->getGame()->getDirector()->getActorByPoint(point);
+ if (this == actor){
+ // inventory is not implemented
+ return;
+ }
+
+ if (actor->isClickable() &&
+ ((SupportingActor*) actor)->isLeftClickHandlers())
+
+
+
+
+ break;
+ }
+ case kPDA:
+
+ break;
+ case kInventory:
+
+ break;
+ default:
+ break;
+ }
+}
+
void ParlSqPink::toConsole() {
debug("ParlSqPink: _name = %s", _name.c_str());
for (int i = 0; i < _actions.size(); ++i) {
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index 4e17bf2..3a64893 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -24,6 +24,7 @@
#define PINK_LEAD_ACTOR_H
#include <common/keyboard.h>
+#include <common/rect.h>
#include "actor.h"
namespace Pink {
@@ -58,8 +59,14 @@ public:
void start(bool isHandler);
void update();
- void OnKeyboardButtonClick(Common::KeyCode code);
+ void onKeyboardButtonClick(Common::KeyCode code);
+ void onLeftButtonClick(Common::Point point);
+ void onMouseMove(Common::Point point);
+
private:
+ void updateCursor(Common::Point point);
+
+
State _state;
CursorMgr *_cursorMgr;
WalkMgr *_walkMgr;
diff --git a/engines/pink/objects/actors/supporting_actor.cpp b/engines/pink/objects/actors/supporting_actor.cpp
index 2cffbf1..a7e1b79 100644
--- a/engines/pink/objects/actors/supporting_actor.cpp
+++ b/engines/pink/objects/actors/supporting_actor.cpp
@@ -23,7 +23,8 @@
#include "supporting_actor.h"
#include <engines/pink/archive.h>
#include <engines/pink/objects/actions/action.h>
-#include <common/debug.h>
+#include <engines/pink/constants.h>
+#include "pink/cursor_mgr.h"
namespace Pink {
@@ -42,4 +43,18 @@ void SupportingActor::toConsole() {
_handlerMgr.toConsole();
}
+void SupportingActor::onMouseOver(Common::Point point, CursorMgr *mgr) {
+ if (isLeftClickHandlers()){
+ if (!_cursor.empty()){
+ mgr->setCursor(_cursor, point);
+ }
+ else mgr->setCursor(kClickableFirstFrameCursor, point);
+ }
+ else Actor::onMouseOver(point, mgr);
+}
+
+bool SupportingActor::isLeftClickHandlers() {
+ return _handlerMgr.isLeftClickHandler(this);
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/actors/supporting_actor.h b/engines/pink/objects/actors/supporting_actor.h
index a9dd69a..bfee083 100644
--- a/engines/pink/objects/actors/supporting_actor.h
+++ b/engines/pink/objects/actors/supporting_actor.h
@@ -33,6 +33,11 @@ public:
virtual void deserialize(Archive &archive);
virtual void toConsole();
+ virtual void onMouseOver(Common::Point point, CursorMgr *mgr);
+
+ virtual bool isClickable() { return 1; }
+ bool isLeftClickHandlers();
+
private:
HandlerMgr _handlerMgr;
Common::String _location;
diff --git a/engines/pink/objects/condition.cpp b/engines/pink/objects/condition.cpp
index 71a68d4..b0e0938 100644
--- a/engines/pink/objects/condition.cpp
+++ b/engines/pink/objects/condition.cpp
@@ -32,7 +32,7 @@ void Pink::ConditionVariable::deserialize(Archive &archive) {
archive >> _name >> _value;
}
-bool Pink::ConditionGameVariable::evaluate(LeadActor *leadActor) {
+bool Pink::ConditionGameVariable::evaluate(Actor *leadActor) {
return leadActor->getPage()->getModule()->getGame()->checkValueOfVariable(_name, _value);
}
@@ -40,7 +40,7 @@ void ConditionGameVariable::toConsole() {
debug("\t\tConditionGameVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
}
-bool Pink::ConditionModuleVariable::evaluate(LeadActor *leadActor) {
+bool Pink::ConditionModuleVariable::evaluate(Actor *leadActor) {
return leadActor->getPage()->getModule()->checkValueOfVariable(_name, _value);
}
@@ -48,7 +48,7 @@ void ConditionModuleVariable::toConsole() {
debug("\t\tConditionModuleVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
}
-bool Pink::ConditionNotModuleVariable::evaluate(LeadActor *leadActor) {
+bool Pink::ConditionNotModuleVariable::evaluate(Actor *leadActor) {
return !ConditionModuleVariable::evaluate(leadActor);
}
@@ -56,7 +56,7 @@ void ConditionNotModuleVariable::toConsole() {
debug("\t\tConditionNotModuleVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
}
-bool ConditionPageVariable::evaluate(LeadActor *leadActor) {
+bool ConditionPageVariable::evaluate(Actor *leadActor) {
return leadActor->getPage()->checkValueOfVariable(_name, _value);
}
@@ -64,7 +64,7 @@ void ConditionPageVariable::toConsole() {
debug("\t\tConditionPageVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
}
-bool ConditionNotPageVariable::evaluate(LeadActor *leadActor) {
+bool ConditionNotPageVariable::evaluate(Actor *leadActor) {
return !ConditionPageVariable::evaluate(leadActor);
}
@@ -76,7 +76,7 @@ void ConditionInventoryItemOwner::deserialize(Archive &archive) {
archive >> _item >> _owner;
}
-bool ConditionInventoryItemOwner::evaluate(LeadActor *leadActor) {
+bool ConditionInventoryItemOwner::evaluate(Actor *leadActor) {
InventoryMgr *mgr = leadActor->getPage()->getModule()->getInventoryMgr();
InventoryItem *item = mgr->findInventoryItem(_item);
return item->getCurrentOwner() == _owner;
@@ -86,7 +86,7 @@ void ConditionInventoryItemOwner::toConsole() {
debug("\t\tConditionInventoryItemOwner: _item=%s, _owner=%s", _item.c_str(), _owner.c_str());
}
-bool ConditionNotInventoryItemOwner::evaluate(LeadActor *leadActor) {
+bool ConditionNotInventoryItemOwner::evaluate(Actor *leadActor) {
return !ConditionInventoryItemOwner::evaluate(leadActor);
}
diff --git a/engines/pink/objects/condition.h b/engines/pink/objects/condition.h
index 6df1920..3ab1ff0 100644
--- a/engines/pink/objects/condition.h
+++ b/engines/pink/objects/condition.h
@@ -32,14 +32,14 @@ class LeadActor;
class Condition : public Object {
public:
virtual void deserialize(Archive &archive) = 0;
- virtual bool evaluate(LeadActor *leadActor) = 0;
+ virtual bool evaluate(Actor *leadActor) = 0;
};
class ConditionVariable : public Condition {
public:
virtual void deserialize(Archive &archive);
- virtual bool evaluate(LeadActor *leadActor) = 0;
+ virtual bool evaluate(Actor *actor) = 0;
protected:
Common::String _name;
@@ -49,7 +49,7 @@ protected:
class ConditionGameVariable : public ConditionVariable {
public:
virtual void toConsole();
- virtual bool evaluate(LeadActor *leadActor);
+ virtual bool evaluate(Actor *actor);
};
/*
@@ -62,32 +62,32 @@ class ConditionNotGameVariable : public ConditionGameVariable {
class ConditionModuleVariable : public ConditionVariable {
public:
virtual void toConsole();
- virtual bool evaluate(LeadActor *leadActor);
+ virtual bool evaluate(Actor *actor);
};
class ConditionNotModuleVariable : public ConditionModuleVariable {
public:
virtual void toConsole();
- virtual bool evaluate(LeadActor *leadActor);
+ virtual bool evaluate(Actor *actor);
};
class ConditionPageVariable : public ConditionVariable {
public:
virtual void toConsole();
- virtual bool evaluate(LeadActor *leadActor);
+ virtual bool evaluate(Actor *actor);
};
class ConditionNotPageVariable : public ConditionPageVariable {
public:
virtual void toConsole();
- virtual bool evaluate(LeadActor *leadActor);
+ virtual bool evaluate(Actor *actor);
};
class ConditionInventoryItemOwner : public Condition {
public:
virtual void toConsole();
virtual void deserialize(Archive &archive);
- virtual bool evaluate(LeadActor *leadActor);
+ virtual bool evaluate(Actor *actor);
protected:
Common::String _item;
@@ -97,7 +97,7 @@ protected:
class ConditionNotInventoryItemOwner : public ConditionInventoryItemOwner {
public:
virtual void toConsole();
- virtual bool evaluate(LeadActor *leadActor);
+ virtual bool evaluate(Actor *actor);
};
} // End of namespace Pink
diff --git a/engines/pink/objects/handlers/handler.cpp b/engines/pink/objects/handlers/handler.cpp
index a848cfd..8916bc0 100644
--- a/engines/pink/objects/handlers/handler.cpp
+++ b/engines/pink/objects/handlers/handler.cpp
@@ -37,7 +37,7 @@ void Handler::deserialize(Archive &archive) {
archive >> _sideEffects;
}
-bool Handler::isSuitable(LeadActor *actor) {
+bool Handler::isSuitable(Actor *actor) {
for (int i = 0; i < _conditions.size(); ++i) {
if (!_conditions[i]->evaluate(actor)){
return false;
@@ -56,6 +56,15 @@ void Handler::onMessage(LeadActor *actor) {
executeSideEffects(actor);
}
+Handler::~Handler() {
+ for (int i = 0; i < _sideEffects.size(); ++i) {
+ delete _sideEffects[i];
+ }
+ for (int i = 0; i < _conditions.size(); ++i) {
+ delete _conditions[i];
+ }
+}
+
void HandlerSequences::deserialize(Archive &archive) {
Handler::deserialize(archive);
archive >> _sequences;
diff --git a/engines/pink/objects/handlers/handler.h b/engines/pink/objects/handlers/handler.h
index b2e5fcf..ed42ed7 100644
--- a/engines/pink/objects/handlers/handler.h
+++ b/engines/pink/objects/handlers/handler.h
@@ -33,12 +33,14 @@ namespace Pink {
class Condition;
class SideEffect;
class LeadActor;
+class Actor;
class Handler : public Object {
public:
+ ~Handler();
virtual void deserialize(Archive &archive);
virtual void onMessage(LeadActor *actor);
- bool isSuitable(LeadActor *actor);
+ bool isSuitable(Actor *actor);
protected:
void executeSideEffects(LeadActor *actor);
diff --git a/engines/pink/objects/handlers/handler_mgr.cpp b/engines/pink/objects/handlers/handler_mgr.cpp
index 6e7755a..83236de 100644
--- a/engines/pink/objects/handlers/handler_mgr.cpp
+++ b/engines/pink/objects/handlers/handler_mgr.cpp
@@ -27,4 +27,13 @@ void HandlerMgr::toConsole() {
}
}
+bool HandlerMgr::isLeftClickHandler(Actor *actor) {
+ for (int i = 0; i < _leftClickHandlers.size(); ++i) {
+ if (_leftClickHandlers[i]->isSuitable(actor))
+ return true;
+ }
+
+ return false;
+}
+
}
diff --git a/engines/pink/objects/handlers/handler_mgr.h b/engines/pink/objects/handlers/handler_mgr.h
index 0de44cf..f939d59 100644
--- a/engines/pink/objects/handlers/handler_mgr.h
+++ b/engines/pink/objects/handlers/handler_mgr.h
@@ -31,6 +31,7 @@ namespace Pink {
class HandlerLeftClick;
class HandlerUseClick;
class HandlerTimer;
+class Actor;
class HandlerMgr : public Object {
public:
@@ -38,6 +39,8 @@ public:
virtual void toConsole();
+ bool isLeftClickHandler(Actor *actor);
+
private:
Common::Array<HandlerLeftClick*> _leftClickHandlers;
Common::Array<HandlerUseClick*> _useClickHandlers;
diff --git a/engines/pink/objects/module.cpp b/engines/pink/objects/module.cpp
index a8166de..f7b6add 100644
--- a/engines/pink/objects/module.cpp
+++ b/engines/pink/objects/module.cpp
@@ -93,6 +93,12 @@ InventoryMgr *Module::getInventoryMgr() {
return &_invMgr;
}
+Module::~Module() {
+ for (int i = 0; i < _pages.size(); ++i) {
+ delete _pages[i];
+ }
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/module.h b/engines/pink/objects/module.h
index 959f886..2824191 100644
--- a/engines/pink/objects/module.h
+++ b/engines/pink/objects/module.h
@@ -43,6 +43,7 @@ class GamePage;
class Module : public NamedObject {
public:
Module(PinkEngine *game, const Common::String &name);
+ ~Module();
void load(Archive &archive);
void init(bool isLoadingSave, const Common::String &pageName);
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index 5ff7f0b..6a90b48 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -77,7 +77,7 @@ void GamePage::init(bool isLoadingSave) {
isHandler = initHandler();
}
- //_leadActor->start(isHandler);
+ _leadActor->start(isHandler);
}
bool GamePage::initHandler() {
@@ -92,7 +92,7 @@ bool GamePage::initHandler() {
void GamePage::loadManagers() {
perhapsIsLoaded = true;
- _cursorMgr = new CursorMgr(this);
+ _cursorMgr = new CursorMgr(_module->getGame(), this);
_walkMgr = new WalkMgr;
_sequencer = new Sequencer(this);
@@ -137,4 +137,19 @@ void GamePage::toConsole() {
}
}
+GamePage::~GamePage() {
+ delete _cursorMgr;
+ delete _walkMgr;
+ delete _sequencer;
+ for (int i = 0; i < _handlers.size(); ++i) {
+ delete _handlers[i];
+ }
+}
+
+GamePage::GamePage()
+ : _cursorMgr(nullptr), _walkMgr(nullptr), _sequencer(nullptr)
+{
+
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/pages/game_page.h b/engines/pink/objects/pages/game_page.h
index 94bff54..705fb32 100644
--- a/engines/pink/objects/pages/game_page.h
+++ b/engines/pink/objects/pages/game_page.h
@@ -34,6 +34,8 @@ class HandlerStartPage;
class GamePage : public Page {
public:
+ GamePage();
+ ~GamePage();
virtual void deserialize(Archive &archive);
virtual void load(Archive &archive);
diff --git a/engines/pink/objects/pages/page.cpp b/engines/pink/objects/pages/page.cpp
index a57860e..a579d19 100644
--- a/engines/pink/objects/pages/page.cpp
+++ b/engines/pink/objects/pages/page.cpp
@@ -65,4 +65,10 @@ void Page::init() {
}
}
+Page::~Page() {
+ for (int i = 0; i < _actors.size(); ++i) {
+ delete _actors[i];
+ }
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/pages/page.h b/engines/pink/objects/pages/page.h
index 282d061..81a49db 100644
--- a/engines/pink/objects/pages/page.h
+++ b/engines/pink/objects/pages/page.h
@@ -36,7 +36,7 @@ class LeadActor;
class Page : public NamedObject {
public:
-
+ ~Page();
void load(Archive &archive);
Actor *findActor(Common::String &name);
Sound* loadSound(Common::String &fileName);
diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp
index 2071683..098330b 100644
--- a/engines/pink/objects/sequences/sequence.cpp
+++ b/engines/pink/objects/sequences/sequence.cpp
@@ -134,6 +134,11 @@ void Sequence::skipItemsTo(int index) {
}
}
+void Sequence::skipSubSequence() {
+ if (_context->getNextItemIndex() < _context->getSequence()->getItems().size())
+ _context->getSequence()->start(0);
+}
+
void SequenceAudio::deserialize(Archive &archive) {
Sequence::deserialize(archive);
archive >> _soundName;
@@ -182,4 +187,8 @@ void SequenceAudio::restart() {
Sequence::restart();
}
+void SequenceAudio::skipToLastSubSequence() {
+ end();
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/sequences/sequence.h b/engines/pink/objects/sequences/sequence.h
index e4695f2..5db00b4 100644
--- a/engines/pink/objects/sequences/sequence.h
+++ b/engines/pink/objects/sequences/sequence.h
@@ -49,9 +49,11 @@ public:
virtual void update();
virtual void restart();
- void skipToLastSubSequence();
+ virtual void skipSubSequence();
+ virtual void skipToLastSubSequence();
void skipItemsTo(int index);
+
public:
SequenceContext *_context;
Sequencer *_sequencer;
@@ -69,9 +71,13 @@ public:
virtual void init(int unk);
virtual void start(int unk);
virtual void end();
+
virtual void update();
virtual void restart();
+ virtual void skipSubSequence() {};
+ virtual void skipToLastSubSequence();
+
private:
Common::String _soundName;
Sound *_sound;
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index 057603a..871a2e2 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -73,7 +73,8 @@ void Sequencer::toConsole() {
}
void Sequencer::update() {
- _context->_sequence->update();
+ if (_context)
+ _context->_sequence->update();
}
void Sequencer::removeContext(SequenceContext *context) {
@@ -82,8 +83,8 @@ void Sequencer::removeContext(SequenceContext *context) {
}
void Sequencer::skipSubSequence() {
- if (_context && _context->getNextItemIndex() < _context->getSequence()->getItems().size())
- _context->getSequence()->start(0);
+ if (_context)
+ _context->getSequence()->skipSubSequence();
}
void Sequencer::restartSequence() {
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index a4b603d..9cc0ee5 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -28,6 +28,8 @@
#include "engines/pink/objects/module.h"
#include "engines/pink/objects/actors/lead_actor.h"
#include <graphics/surface.h>
+#include <graphics/cursorman.h>
+#include <common/winexe_pe.h>
namespace Pink {
@@ -51,6 +53,9 @@ Pink::PinkEngine::~PinkEngine() {
for (uint i = 0; i < _modules.size(); ++i) {
delete _modules[i];
}
+ for (int j = 0; j < _cursors.size(); ++j) {
+ delete _cursors[j];
+ }
DebugMan.clearAllDebugChannels();
}
@@ -65,7 +70,7 @@ Common::Error PinkEngine::init() {
Common::String orbName{_desc.filesDescriptions[0].fileName};
Common::String broName{_desc.filesDescriptions[1].fileName};
- if (!broName.empty()){
+ if (strcmp(_desc.gameId, "peril") == 0){
_bro = new BroFile();
}
else debug("This game doesn't need to use bro");
@@ -74,8 +79,11 @@ Common::Error PinkEngine::init() {
return Common::kNoGameDataFoundError;
}
- // TODO load cursor
+ if (!loadCursors())
+ return Common::kNoGameDataFoundError;
+ setCursor(kLoadingCursor);
+ _system->showMouse(1);
_orb.loadGame(this);
const Common::String empty;
@@ -86,10 +94,8 @@ Common::Error PinkEngine::init() {
Common::Error Pink::PinkEngine::run() {
Common::Error error = init();
- if (error.getCode() != Common::kNoError){
+ if (error.getCode() != Common::kNoError)
return error;
- }
-
while(!shouldQuit()){
Common::Event event;
@@ -99,15 +105,15 @@ Common::Error Pink::PinkEngine::run() {
case Common::EVENT_RTL:
return Common::kNoError;
case Common::EVENT_MOUSEMOVE:
-
+ _actor->onMouseMove(event.mouse);
break;
case Common::EVENT_LBUTTONDOWN:
-
+ _actor->onLeftButtonClick(event.mouse);
break;
case Common::EVENT_KEYDOWN:
if (event.kbd.keycode == Common::KEYCODE_d)
_director.showBounds = !_director.showBounds;
- else _actor->OnKeyboardButtonClick(event.kbd.keycode);
+ else _actor->onKeyboardButtonClick(event.kbd.keycode);
break;
// don't know why it is used in original
@@ -118,10 +124,11 @@ Common::Error Pink::PinkEngine::run() {
}
}
+
_actor->update();
_director.update();
_director.draw();
- _system->delayMillis(50);
+ _system->delayMillis(5);
}
return Common::kNoError;
@@ -135,35 +142,30 @@ void PinkEngine::load(Archive &archive) {
void PinkEngine::initModule(const Common::String &moduleName, bool isLoadingFromSave, const Common::String &pageName) {
if (_module) {
+ for (uint i = 0; i < _modules.size(); ++i) {
+ if (_module == _modules[i]){
+ _modules[i] = new ModuleProxy(_module->getName());
- //call module function (smth with unloading)
+ delete _module;
+ _module = nullptr;
- uint i;
- for (i = 0; i < _modules.size(); ++i) {
- if (_module == _modules[i]){
break;
}
}
-
- _modules[i] = new ModuleProxy(_module->getName());
-
- delete _module;
- _module = nullptr;
}
- uint i;
- for (i = 0; i < _modules.size(); ++i) {
+ for (uint i = 0; i < _modules.size(); ++i) {
if (_modules[i]->getName() == moduleName) {
loadModule(i);
+ _module = static_cast<Module*>(_modules[i]);
+ _module->init(isLoadingFromSave, pageName);
break;
}
}
-
- _module = static_cast<Module*>(_modules[i]);
- _module->init(isLoadingFromSave, pageName);
}
void PinkEngine::changeScene(GamePage *page) {
+ setCursor(kLoadingCursor);
if (!_nextModule.empty() && _nextModule.compareTo(_module->getName())) {
initModule(_nextModule, kLoadingNewGame, _nextPage);
}
@@ -198,4 +200,47 @@ void PinkEngine::setVariable(Common::String &variable, Common::String &value) {
_variables[variable] = value;
}
+bool PinkEngine::loadCursors() {
+ Common::PEResources exeResources;
+ bool isPokus = !strcmp(_desc.gameId, "pokus");
+ Common::String fileName = isPokus ? _desc.filesDescriptions[1].fileName : _desc.filesDescriptions[2].fileName;
+ if (!exeResources.loadFromEXE(fileName))
+ return false;
+
+ _cursors.reserve(kCursorsCount);
+
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusLoadingCursorID));
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusExitForwardCursorID));
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusExitLeftCursorID));
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusExitRightCursorID));
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusClickableFirstCursorID));
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusClickableSecondCursorID));
+
+ if (isPokus) {
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusClickableThirdCursorID));
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusNotClickableCursorID));
+ }
+ else {
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPerilClickableThirdCursorID));
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPerilNotClickableCursorID));
+ }
+
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusHoldingItemCursorID));
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusPDAFirstCursorID));
+
+ if (isPokus)
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusPDASecondCursorID));
+ else
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPerilPDASecondCursorID));
+
+ return true;
+}
+
+void PinkEngine::setCursor(uint cursorIndex) {
+ Graphics::Cursor *cursor = _cursors[cursorIndex]->cursors[0].cursor;
+ _system->setCursorPalette(cursor->getPalette(), cursor->getPaletteStartIndex(), cursor->getPaletteCount());
+ _system->setMouseCursor(cursor->getSurface(), cursor->getWidth(), cursor->getHeight(),
+ cursor->getHotspotX(), cursor->getHotspotY(), cursor->getKeyColor());
+}
+
}
\ No newline at end of file
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index 63a9a21..32de7c9 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -23,13 +23,14 @@
#ifndef PINK_PINK_H
#define PINK_PINK_H
+#include <graphics/wincursor.h>
#include "common/random.h"
#include "engines/engine.h"
#include "gui/EventRecorder.h"
#include "gui/debugger.h"
#include "file.h"
#include "director.h"
-
+#include "constants.h"
/*
* This is the namespace of the Pink engine.
@@ -60,11 +61,6 @@ enum {
kPinkDebugSound = 1 << 4
};
-enum {
- kLoadingSave = 1,
- kLoadingNewGame = 0
-};
-
class PinkEngine : public Engine {
public:
PinkEngine(OSystem *system, const ADGameDescription *desc);
@@ -87,14 +83,16 @@ public:
void setVariable(Common::String &variable, Common::String &value);
bool checkValueOfVariable(Common::String &variable, Common::String &value);
+ inline void setCursor(uint cursorIndex);
private:
Common::Error init();
- void loadModule(int index);
-
+ bool loadCursors();
+ void loadModule(int index);
Console *_console;
Common::RandomSource _rnd;
+ Common::Array<Graphics::WinCursorGroup*> _cursors;
Common::String _nextModule;
Common::String _nextPage;
diff --git a/engines/pink/sound.cpp b/engines/pink/sound.cpp
index b022751..fda91e5 100644
--- a/engines/pink/sound.cpp
+++ b/engines/pink/sound.cpp
@@ -23,24 +23,24 @@
#include <audio/audiostream.h>
#include <audio/decoders/wave.h>
#include <audio/decoders/adpcm.h>
+#include <common/substream.h>
#include "sound.h"
namespace Pink {
-Sound::Sound(Audio::Mixer *mixer, Common::SeekableReadStream *stream)
- : _mixer(mixer)
+Sound::Sound(Audio::Mixer *mixer, Common::SafeSeekableSubReadStream *stream)
+ : _mixer(mixer), _fileStream(stream)
{
- load(stream);
+
}
Sound::~Sound() {
stop();
- delete _stream;
+ delete _fileStream;
}
bool Sound::isPlaying() {
return _mixer->isSoundHandleActive(_handle);
-
}
void Sound::pause() {
@@ -56,28 +56,19 @@ void Sound::stop() {
}
void Sound::play(Audio::Mixer::SoundType type, int volume, bool isLoop) {
+ // Vox files in pink have wave format.
+ // RIFF (little-endian) data, WAVE audio, Microsoft PCM, 8 bit, mono 22050 Hz
_mixer->stopHandle(_handle);
+ _fileStream->seek(0);
+ Audio::AudioStream *audioStream ;
+ Audio::SeekableAudioStream *wavStream = Audio::makeWAVStream(_fileStream, DisposeAfterUse::NO);
if (isLoop) {
- //bad impl?
- Audio::SeekableAudioStream *seekableStream = dynamic_cast<Audio::SeekableAudioStream*>(_stream);
- _stream = Audio::makeLoopingAudioStream(seekableStream, 0, 0, 0);
+ audioStream = Audio::makeLoopingAudioStream(wavStream, 0, 0, 0);
}
+ else audioStream = wavStream;
- _mixer->playStream(type, &_handle ,_stream, -1 , Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
-}
-
-bool Sound::load(Common::SeekableReadStream *stream) {
- // Vox files in pink have wave format.
- // RIFF (little-endian) data, WAVE audio, Microsoft PCM, 8 bit, mono 22050 Hz
-
- _stream = Audio::makeWAVStream(stream, DisposeAfterUse::YES);
-
- return isLoaded();
-}
-
-bool Sound::isLoaded() {
- return _stream != nullptr;
+ _mixer->playStream(type, &_handle , audioStream, -1 , Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::YES);
}
void Sound::setBalance(int8 balance) {
diff --git a/engines/pink/sound.h b/engines/pink/sound.h
index 9e9dbdf..0116825 100644
--- a/engines/pink/sound.h
+++ b/engines/pink/sound.h
@@ -36,13 +36,11 @@ namespace Pink {
class Sound {
public:
- Sound(Audio::Mixer *mixer, Common::SeekableReadStream *stream);
+ Sound(Audio::Mixer *mixer, Common::SafeSeekableSubReadStream *stream);
~Sound();
- bool load(Common::SeekableReadStream *stream);
void play(Audio::Mixer::SoundType type, int volume, bool isLoop);
- bool isLoaded();
bool isPlaying();
void pause();
@@ -54,8 +52,8 @@ public:
private:
Audio::Mixer *_mixer;
- Audio::AudioStream *_stream;
Audio::SoundHandle _handle;
+ Common::SafeSeekableSubReadStream *_fileStream;
};
} // End of namespace Pink
Commit: f6d620f6831cb3605d621ec107fd8c4ae5722154
https://github.com/scummvm/scummvm/commit/f6d620f6831cb3605d621ec107fd8c4ae5722154
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fixed finding actor on screen
Changed paths:
engines/pink/director.cpp
diff --git a/engines/pink/director.cpp b/engines/pink/director.cpp
index 3fa149e..455690e 100644
--- a/engines/pink/director.cpp
+++ b/engines/pink/director.cpp
@@ -118,8 +118,10 @@ void Director::clear() {
Actor *Director::getActorByPoint(Common::Point point) {
for (int i = _sprites.size() - 1; i > 0; --i) {
CelDecoder *decoder = _sprites[i]->getDecoder();
- if (decoder->getRectangle().contains(point) &&
- *(byte*)decoder->getCurrentFrame()->getBasePtr(640 - point.x, 480 - point.y)
+ const Graphics::Surface *frame = decoder->getCurrentFrame();
+ Common::Rect &rect = decoder->getRectangle();
+ if (rect.contains(point) &&
+ *(byte*)frame->getBasePtr(point.x - rect.left, point.y - rect.top)
!= decoder->getTransparentColourIndex())
return _sprites[i]->getActor();
}
Commit: 4b7c75607a5d54d95c383fabf381d82d4ac77b94
https://github.com/scummvm/scummvm/commit/4b7c75607a5d54d95c383fabf381d82d4ac77b94
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added onMouseOver method to LeadActor
Changed paths:
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/actors/lead_actor.h
engines/pink/objects/inventory.cpp
engines/pink/objects/inventory.h
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index e26b50a..c583d9a 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -201,6 +201,12 @@ void LeadActor::onLeftButtonClick(Common::Point point) {
}
}
+void LeadActor::onMouseOver(Common::Point point, CursorMgr *mgr) {
+ if (_page->getModule()->getInventoryMgr()->isPinkOwnsAnyItems())
+ _cursorMgr->setCursor(kClickableFirstFrameCursor, {0, 0});
+ else Actor::onMouseOver(point, mgr);
+}
+
void ParlSqPink::toConsole() {
debug("ParlSqPink: _name = %s", _name.c_str());
for (int i = 0; i < _actions.size(); ++i) {
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index 3a64893..208bfaa 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -63,6 +63,8 @@ public:
void onLeftButtonClick(Common::Point point);
void onMouseMove(Common::Point point);
+ virtual void onMouseOver(Common::Point point, CursorMgr *mgr);
+
private:
void updateCursor(Common::Point point);
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
index feed41a..0f1b711 100644
--- a/engines/pink/objects/inventory.cpp
+++ b/engines/pink/objects/inventory.cpp
@@ -24,9 +24,15 @@
#include <common/debug.h>
#include "inventory.h"
#include "engines/pink/archive.h"
+#include "pink/objects/actors/lead_actor.h"
namespace Pink {
+InventoryMgr::InventoryMgr()
+ : _lead(nullptr), _item(nullptr)
+{
+}
+
void Pink::InventoryItem::deserialize(Archive &archive) {
NamedObject::deserialize(archive);
_initialOwner = archive.readString();
@@ -69,6 +75,25 @@ void InventoryMgr::toConsole() {
}
}
+bool InventoryMgr::isPinkOwnsAnyItems() {
+ if (_item)
+ return true;
+
+ for (int i = 0; i < _items.size(); ++i) {
+ if (_items[i]->getCurrentOwner() == _lead->getName()){
+ _item = _items[i];
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void InventoryMgr::setItemOwner(const Common::String &owner, InventoryItem *item) {
+ item->_currentOwner = owner;
+ _item = item;
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/inventory.h b/engines/pink/objects/inventory.h
index ca1ef7f..908f2a8 100644
--- a/engines/pink/objects/inventory.h
+++ b/engines/pink/objects/inventory.h
@@ -38,6 +38,7 @@ public:
Common::String &getCurrentOwner();
+ friend class InventoryMgr;
private:
Common::String _initialOwner;
Common::String _currentOwner;
@@ -47,6 +48,7 @@ class LeadActor;
class InventoryMgr : public Object {
public:
+ InventoryMgr();
virtual ~InventoryMgr();
virtual void deserialize(Archive &archive);
@@ -55,8 +57,12 @@ public:
void setLeadActor(LeadActor *lead);
InventoryItem* findInventoryItem(Common::String &name);
+ bool isPinkOwnsAnyItems();
+ void setItemOwner(const Common::String &owner, InventoryItem *item);
+
private:
LeadActor *_lead;
+ InventoryItem *_item;
Common::Array<InventoryItem*> _items;
// other fields. haven't RE them yet
};
Commit: cad72b1532faa96c68848392766f25a4a58398ab
https://github.com/scummvm/scummvm/commit/cad72b1532faa96c68848392766f25a4a58398ab
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: basic walk, left click and seqTimer implementation
Changed paths:
A engines/pink/objects/walk/walk_shortest_path.cpp
A engines/pink/objects/walk/walk_shortest_path.h
engines/pink/cursor_mgr.cpp
engines/pink/director.cpp
engines/pink/module.mk
engines/pink/objects/actions/action_still.cpp
engines/pink/objects/actions/walk_action.cpp
engines/pink/objects/actions/walk_action.h
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/actors/lead_actor.h
engines/pink/objects/actors/supporting_actor.cpp
engines/pink/objects/actors/supporting_actor.h
engines/pink/objects/handlers/handler.cpp
engines/pink/objects/handlers/handler.h
engines/pink/objects/handlers/handler_mgr.cpp
engines/pink/objects/handlers/handler_mgr.h
engines/pink/objects/handlers/handler_timer.cpp
engines/pink/objects/handlers/handler_timer.h
engines/pink/objects/module.cpp
engines/pink/objects/pages/game_page.cpp
engines/pink/objects/pages/page.cpp
engines/pink/objects/pages/page.h
engines/pink/objects/sequences/seq_timer.cpp
engines/pink/objects/sequences/seq_timer.h
engines/pink/objects/sequences/sequence.cpp
engines/pink/objects/sequences/sequence_item.cpp
engines/pink/objects/sequences/sequencer.cpp
engines/pink/objects/sequences/sequencer.h
engines/pink/objects/side_effect.cpp
engines/pink/objects/side_effect.h
engines/pink/objects/walk/walk_location.cpp
engines/pink/objects/walk/walk_location.h
engines/pink/objects/walk/walk_mgr.cpp
engines/pink/objects/walk/walk_mgr.h
engines/pink/pink.cpp
engines/pink/sound.cpp
diff --git a/engines/pink/cursor_mgr.cpp b/engines/pink/cursor_mgr.cpp
index b1a2182..a07f577 100644
--- a/engines/pink/cursor_mgr.cpp
+++ b/engines/pink/cursor_mgr.cpp
@@ -68,7 +68,7 @@ void CursorMgr::setCursor(Common::String &cursorName, Common::Point point) {
else if (cursorName == "ExitRight"){
index = kExitRightCursor;
}
- else if (cursorName == "ExitForward")
+ else if (cursorName == "ExitForward" || cursorName == "ExitUp")
index = kExitForwardCursor;
else assert(0);
setCursor(index, point);
diff --git a/engines/pink/director.cpp b/engines/pink/director.cpp
index 455690e..4003ca5 100644
--- a/engines/pink/director.cpp
+++ b/engines/pink/director.cpp
@@ -42,11 +42,12 @@ void Director::draw() {
void Director::drawSprite(ActionCEL *sprite) {
CelDecoder *decoder = sprite->getDecoder();
const Graphics::Surface *surface;
- if (decoder->needsUpdate())
+ if (decoder->needsUpdate()) {
+
surface = decoder->decodeNextFrame();
+ }
else surface = decoder->getCurrentFrame();
-
if (!showBounds) {
Graphics::Surface *screen = _system->lockScreen();
@@ -116,7 +117,7 @@ void Director::clear() {
}
Actor *Director::getActorByPoint(Common::Point point) {
- for (int i = _sprites.size() - 1; i > 0; --i) {
+ for (int i = _sprites.size() - 1; i >= 0; --i) {
CelDecoder *decoder = _sprites[i]->getDecoder();
const Graphics::Surface *frame = decoder->getCurrentFrame();
Common::Rect &rect = decoder->getRectangle();
diff --git a/engines/pink/module.mk b/engines/pink/module.mk
index 4bff006..53627ec 100644
--- a/engines/pink/module.mk
+++ b/engines/pink/module.mk
@@ -42,6 +42,7 @@ MODULE_OBJS = \
objects/sequences/sequencer.o \
objects/walk/walk_mgr.o \
objects/walk/walk_location.o \
+ objects/walk/walk_shortest_path.o \
# This module can be built as a plugin
ifeq ($(ENABLE_PINK), DYNAMIC_PLUGIN)
diff --git a/engines/pink/objects/actions/action_still.cpp b/engines/pink/objects/actions/action_still.cpp
index 442fe85..0af57a0 100644
--- a/engines/pink/objects/actions/action_still.cpp
+++ b/engines/pink/objects/actions/action_still.cpp
@@ -48,6 +48,8 @@ void ActionStill::onStart() {
for (int i = 0; i < _startFrame; ++i) {
_decoder->decodeNextFrame();
}
+ _decoder->stop();
+ _actor->endAction();
}
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/actions/walk_action.cpp b/engines/pink/objects/actions/walk_action.cpp
index 7b7c3e3..9c5dac5 100644
--- a/engines/pink/objects/actions/walk_action.cpp
+++ b/engines/pink/objects/actions/walk_action.cpp
@@ -22,6 +22,7 @@
#include "walk_action.h"
#include <engines/pink/archive.h>
+#include "pink/cel_decoder.h"
namespace Pink {
@@ -36,4 +37,8 @@ void WalkAction::toConsole() {
_name.c_str(), _fileName.c_str(), _toCalcFramePositions);
}
+void WalkAction::onStart() {
+ _decoder->start();
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/actions/walk_action.h b/engines/pink/objects/actions/walk_action.h
index 6dbc6a9..f74adb8 100644
--- a/engines/pink/objects/actions/walk_action.h
+++ b/engines/pink/objects/actions/walk_action.h
@@ -33,6 +33,9 @@ public:
virtual void toConsole();
+protected:
+ void onStart() override;
+
private:
bool _toCalcFramePositions;
};
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index c583d9a..faa0d5a 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -71,16 +71,20 @@ LeadActor::State LeadActor::getState() const {
void LeadActor::update() {
switch (_state) {
case kReady:
-
_sequencer->update();
- //fall-through intended
+ _cursorMgr->update();
+ break;
case kMoving:
-
+ _walkMgr->update();
_cursorMgr->update();
break;
case kInDialog1:
case kInDialog2:
_sequencer->update();
+ if (!_sequencer->_context){
+ _state = _nextState;
+ _nextState = kUnk_Loading;
+ }
break;
case kInventory:
@@ -136,7 +140,8 @@ void LeadActor::onKeyboardButtonClick(Common::KeyCode code) {
void LeadActor::start(bool isHandler) {
if (isHandler && _state != kPlayingVideo){
- _state = kReady;
+ _state = kInDialog1;
+ _nextState = kReady;
}
updateCursor({0,0});
}
@@ -177,17 +182,19 @@ void LeadActor::onLeftButtonClick(Common::Point point) {
case kReady:
case kMoving: {
Actor *actor = _page->getGame()->getDirector()->getActorByPoint(point);
+
if (this == actor){
// inventory is not implemented
return;
}
+ _recipient = (SupportingActor*) actor;
if (actor->isClickable() &&
- ((SupportingActor*) actor)->isLeftClickHandlers())
-
-
-
-
+ _recipient->isLeftClickHandlers()){
+ _state = kMoving;
+ _nextState = kInDialog1;
+ _walkMgr->start(_walkMgr->findLocation(_recipient->getLocation()));
+ }
break;
}
case kPDA:
@@ -207,6 +214,27 @@ void LeadActor::onMouseOver(Common::Point point, CursorMgr *mgr) {
else Actor::onMouseOver(point, mgr);
}
+void LeadActor::onWalkEnd() {
+ State oldNextState = _nextState;
+ _state = kReady;
+ _nextState = kUnk_Loading;
+ if (_recipient && oldNextState == kInDialog1){
+ // if use click not impl
+ sendLeftClickMessage(_recipient);
+ }
+}
+
+bool LeadActor::sendUseClickMessage(SupportingActor *actor) {
+ return false;
+}
+
+bool LeadActor::sendLeftClickMessage(SupportingActor *actor) {
+ actor->onLeftClickMessage();
+ _nextState = _state != kPlayingVideo ? kReady : kPlayingVideo;
+ _state = kInDialog1;
+ return false;
+}
+
void ParlSqPink::toConsole() {
debug("ParlSqPink: _name = %s", _name.c_str());
for (int i = 0; i < _actions.size(); ++i) {
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index 208bfaa..261b5dc 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -27,12 +27,15 @@
#include <common/rect.h>
#include "actor.h"
+
namespace Pink {
class CursorMgr;
class WalkMgr;
class Sequencer;
+class SupportingActor;
+
class LeadActor : public Actor {
public:
enum State {
@@ -62,14 +65,22 @@ public:
void onKeyboardButtonClick(Common::KeyCode code);
void onLeftButtonClick(Common::Point point);
void onMouseMove(Common::Point point);
+ void onWalkEnd();
virtual void onMouseOver(Common::Point point, CursorMgr *mgr);
private:
void updateCursor(Common::Point point);
+ bool sendUseClickMessage(SupportingActor *actor);
+ bool sendLeftClickMessage(SupportingActor *actor);
+
State _state;
+ State _nextState;
+
+ SupportingActor *_recipient;
+
CursorMgr *_cursorMgr;
WalkMgr *_walkMgr;
Sequencer *_sequencer;
diff --git a/engines/pink/objects/actors/supporting_actor.cpp b/engines/pink/objects/actors/supporting_actor.cpp
index a7e1b79..d43f871 100644
--- a/engines/pink/objects/actors/supporting_actor.cpp
+++ b/engines/pink/objects/actors/supporting_actor.cpp
@@ -57,4 +57,20 @@ bool SupportingActor::isLeftClickHandlers() {
return _handlerMgr.isLeftClickHandler(this);
}
+void SupportingActor::onTimerMessage() {
+ _handlerMgr.onTimerMessage(this);
+}
+
+bool SupportingActor::onLeftClickMessage() {
+ return _handlerMgr.onLeftClickMessage(this);
+}
+
+bool SupportingActor::onUseClickMessage() {
+ return _handlerMgr.onUseClickMessage(this);
+}
+
+const Common::String &SupportingActor::getLocation() const {
+ return _location;
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/actors/supporting_actor.h b/engines/pink/objects/actors/supporting_actor.h
index bfee083..2888582 100644
--- a/engines/pink/objects/actors/supporting_actor.h
+++ b/engines/pink/objects/actors/supporting_actor.h
@@ -38,6 +38,13 @@ public:
virtual bool isClickable() { return 1; }
bool isLeftClickHandlers();
+ void onTimerMessage();
+ bool onLeftClickMessage();
+ bool onUseClickMessage();
+
+ const Common::String &getLocation() const;
+
+
private:
HandlerMgr _handlerMgr;
Common::String _location;
diff --git a/engines/pink/objects/handlers/handler.cpp b/engines/pink/objects/handlers/handler.cpp
index 8916bc0..7c2bcaa 100644
--- a/engines/pink/objects/handlers/handler.cpp
+++ b/engines/pink/objects/handlers/handler.cpp
@@ -46,13 +46,13 @@ bool Handler::isSuitable(Actor *actor) {
return true;
}
-void Handler::executeSideEffects(LeadActor *actor) {
+void Handler::executeSideEffects(Actor *actor) {
for (int i = 0; i < _sideEffects.size(); ++i) {
_sideEffects[i]->execute(actor);
}
}
-void Handler::onMessage(LeadActor *actor) {
+void Handler::handle(Actor *actor) {
executeSideEffects(actor);
}
@@ -70,8 +70,8 @@ void HandlerSequences::deserialize(Archive &archive) {
archive >> _sequences;
}
-void HandlerSequences::onMessage(LeadActor *actor) {
- Handler::onMessage(actor);
+void HandlerSequences::handle(Actor *actor) {
+ Handler::handle(actor);
Sequencer *sequencer = actor->getSequencer();
assert(!_sequences.empty());
@@ -84,10 +84,10 @@ void HandlerSequences::onMessage(LeadActor *actor) {
assert(sequence);
sequencer->authorSequence(sequence, 0);
- handle(sequence);
+ execute(sequence);
}
-void HandlerStartPage::handle(Sequence *sequence) {
+void HandlerStartPage::execute(Sequence *sequence) {
sequence->_unk = 1;
}
@@ -152,7 +152,7 @@ void HandlerUseClick::toConsole() {
}
}
-void HandlerUseClick::handle(Sequence *sequence) {
+void HandlerUseClick::execute(Sequence *sequence) {
}
diff --git a/engines/pink/objects/handlers/handler.h b/engines/pink/objects/handlers/handler.h
index ed42ed7..47f9ab8 100644
--- a/engines/pink/objects/handlers/handler.h
+++ b/engines/pink/objects/handlers/handler.h
@@ -39,11 +39,11 @@ class Handler : public Object {
public:
~Handler();
virtual void deserialize(Archive &archive);
- virtual void onMessage(LeadActor *actor);
+ virtual void handle(Actor *actor);
bool isSuitable(Actor *actor);
protected:
- void executeSideEffects(LeadActor *actor);
+ void executeSideEffects(Actor *actor);
Common::Array<Condition*> _conditions;
Common::Array<SideEffect*> _sideEffects;
@@ -54,10 +54,10 @@ class Sequence;
class HandlerSequences : public Handler {
public:
virtual void deserialize(Archive &archive);
- virtual void onMessage(LeadActor *actor);
+ virtual void handle(Actor *actor);
protected:
- virtual void handle(Sequence *sequence) = 0;
+ virtual void execute(Sequence *sequence) = 0;
Common::StringArray _sequences;
};
@@ -67,7 +67,7 @@ public:
virtual void toConsole();
private:
- virtual void handle(Sequence *sequence);
+ virtual void execute(Sequence *sequence);
};
class HandlerLeftClick : public HandlerSequences {
@@ -75,7 +75,7 @@ public:
virtual void toConsole();
private:
- virtual void handle(Sequence *sequence) {}
+ virtual void execute(Sequence *sequence) {}
};
class HandlerUseClick : public HandlerSequences {
@@ -84,7 +84,7 @@ public:
virtual void toConsole();
private:
- virtual void handle(Sequence *sequence);
+ virtual void execute(Sequence *sequence);
Common::String _inventoryItem;
Common::String _recepient;
diff --git a/engines/pink/objects/handlers/handler_mgr.cpp b/engines/pink/objects/handlers/handler_mgr.cpp
index 83236de..76c2cf6 100644
--- a/engines/pink/objects/handlers/handler_mgr.cpp
+++ b/engines/pink/objects/handlers/handler_mgr.cpp
@@ -36,4 +36,55 @@ bool HandlerMgr::isLeftClickHandler(Actor *actor) {
return false;
}
+void HandlerMgr::onTimerMessage(Actor *actor) {
+ Handler *handler = findSuitableHandlerTimer(actor);
+ if (handler)
+ handler->handle(actor);
+}
+
+bool HandlerMgr::onLeftClickMessage(Actor *actor) {
+ Handler *handler = findSuitableHandlerLeftClick(actor);
+ if (handler) {
+ handler->handle(actor);
+ return 1;
+ }
+ return 0;
+}
+
+bool HandlerMgr::onUseClickMessage(Actor *actor) {
+ Handler *handler = findSuitableHandlerUseClick(actor);
+ if (handler) {
+ handler->handle(actor);
+ return 1;
+ }
+ return 0;
+}
+
+Handler *HandlerMgr::findSuitableHandlerTimer(Actor *actor) {
+ for (int i = 0; i < _timerHandlers.size(); ++i) {
+ if (_timerHandlers[i]->isSuitable(actor))
+ return _timerHandlers[i];
+ }
+
+ return nullptr;
+}
+
+Handler *HandlerMgr::findSuitableHandlerLeftClick(Actor *actor) {
+ for (int i = 0; i < _leftClickHandlers.size(); ++i) {
+ if (_leftClickHandlers[i]->isSuitable(actor))
+ return _leftClickHandlers[i];
+ }
+
+ return nullptr;
+}
+
+Handler *HandlerMgr::findSuitableHandlerUseClick(Actor *actor) {
+ for (int i = 0; i < _useClickHandlers.size(); ++i) {
+ if (_useClickHandlers[i]->isSuitable(actor))
+ return _useClickHandlers[i];
+ }
+
+ return nullptr;
+}
+
}
diff --git a/engines/pink/objects/handlers/handler_mgr.h b/engines/pink/objects/handlers/handler_mgr.h
index f939d59..0816087 100644
--- a/engines/pink/objects/handlers/handler_mgr.h
+++ b/engines/pink/objects/handlers/handler_mgr.h
@@ -28,6 +28,7 @@
namespace Pink {
+class Handler;
class HandlerLeftClick;
class HandlerUseClick;
class HandlerTimer;
@@ -41,7 +42,15 @@ public:
bool isLeftClickHandler(Actor *actor);
+ void onTimerMessage(Actor *actor);
+ bool onLeftClickMessage(Actor *actor);
+ bool onUseClickMessage(Actor *actor);
+
private:
+ Handler *findSuitableHandlerTimer(Actor *actor);
+ Handler *findSuitableHandlerLeftClick(Actor *actor);
+ Handler *findSuitableHandlerUseClick(Actor *actor);
+
Common::Array<HandlerLeftClick*> _leftClickHandlers;
Common::Array<HandlerUseClick*> _useClickHandlers;
Common::Array<HandlerTimer*> _timerHandlers;
diff --git a/engines/pink/objects/handlers/handler_timer.cpp b/engines/pink/objects/handlers/handler_timer.cpp
index 44d58c2..6fdbce1 100644
--- a/engines/pink/objects/handlers/handler_timer.cpp
+++ b/engines/pink/objects/handlers/handler_timer.cpp
@@ -59,8 +59,8 @@ void HandlerTimerActions::toConsole() {
}
}
-void HandlerTimerActions::onMessage(LeadActor *actor) {
- Handler::onMessage(actor);
+void HandlerTimerActions::handle(Actor *actor) {
+ Handler::handle(actor);
assert(_actions.size());
if (!actor->isPlaying()){
Common::RandomSource &rnd = actor->getPage()->getGame()->getRnd();
@@ -72,7 +72,7 @@ void HandlerTimerActions::onMessage(LeadActor *actor) {
}
-void HandlerTimerSequences::handle(Sequence *sequence) {
+void HandlerTimerSequences::execute(Sequence *sequence) {
debug("HandlerTimerSequences function is not implemented");
}
diff --git a/engines/pink/objects/handlers/handler_timer.h b/engines/pink/objects/handlers/handler_timer.h
index 1147431..540c7dc 100644
--- a/engines/pink/objects/handlers/handler_timer.h
+++ b/engines/pink/objects/handlers/handler_timer.h
@@ -42,7 +42,7 @@ class HandlerTimerActions : public HandlerTimer {
public:
virtual void toConsole();
virtual void deserialize(Archive &archive);
- virtual void onMessage(LeadActor *actor);
+ virtual void handle(Actor *actor);
private:
Common::StringArray _actions;
@@ -53,7 +53,7 @@ class HandlerTimerSequences : public HandlerSequences { //originally it was inhe
public:
virtual void toConsole();
protected:
- virtual void handle(Sequence *sequence); // very big and hard function
+ virtual void execute(Sequence *sequence); // very big and hard function
};
} // End of namespace Pink
diff --git a/engines/pink/objects/module.cpp b/engines/pink/objects/module.cpp
index f7b6add..dc9a06e 100644
--- a/engines/pink/objects/module.cpp
+++ b/engines/pink/objects/module.cpp
@@ -65,7 +65,9 @@ void Module::changePage(const Common::String &pageName) {
//_page->clear
- page->init(kLoadingNewGame);
+
+ _page = page;
+ _page->init(kLoadingNewGame);
}
GamePage *Module::findPage(const Common::String &pageName) const {
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index 6a90b48..c878180 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -83,7 +83,7 @@ void GamePage::init(bool isLoadingSave) {
bool GamePage::initHandler() {
for (uint i = 0; i < _handlers.size(); ++i) {
if (_handlers[i]->isSuitable(_leadActor)){
- _handlers[i]->onMessage(_leadActor);
+ _handlers[i]->handle(_leadActor);
return true;
}
}
diff --git a/engines/pink/objects/pages/page.cpp b/engines/pink/objects/pages/page.cpp
index a579d19..471cf87 100644
--- a/engines/pink/objects/pages/page.cpp
+++ b/engines/pink/objects/pages/page.cpp
@@ -71,4 +71,8 @@ Page::~Page() {
}
}
+LeadActor *Page::getLeadActor() {
+ return _leadActor;
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/pages/page.h b/engines/pink/objects/pages/page.h
index 81a49db..7eb1a33 100644
--- a/engines/pink/objects/pages/page.h
+++ b/engines/pink/objects/pages/page.h
@@ -39,11 +39,13 @@ public:
~Page();
void load(Archive &archive);
Actor *findActor(Common::String &name);
- Sound* loadSound(Common::String &fileName);
+ Sound *loadSound(Common::String &fileName);
CelDecoder *loadCel(Common::String &fileName);
virtual void toConsole();
+ LeadActor *getLeadActor();
+
protected:
void init();
Common::Array<Actor*> _actors;
diff --git a/engines/pink/objects/sequences/seq_timer.cpp b/engines/pink/objects/sequences/seq_timer.cpp
index d2b761c..d5029e6 100644
--- a/engines/pink/objects/sequences/seq_timer.cpp
+++ b/engines/pink/objects/sequences/seq_timer.cpp
@@ -24,11 +24,14 @@
#include <engines/pink/archive.h>
#include "./sequencer.h"
#include <common/debug.h>
+#include <engines/pink/objects/actors/supporting_actor.h>
+#include "pink/objects/pages/game_page.h"
+#include "pink/pink.h"
namespace Pink {
SeqTimer::SeqTimer()
- : _unk(0) {
+ : _updatesToMessage(0) {
}
@@ -43,4 +46,21 @@ void SeqTimer::toConsole() {
debug("\tSeqTimer: _actor=%s _period=%u _range=%u", _actor.c_str(), _period, _range);
}
+void SeqTimer::update() {
+ Common::RandomSource &random =_sequencer->_page->getGame()->getRnd();
+ if (_updatesToMessage--)
+ return;
+
+ calculateUpdatesCount();
+ SupportingActor *actor = static_cast<SupportingActor*>(_sequencer->_page->findActor(_actor));
+ if (!_sequencer->findSequenceActorState(actor->getName())){
+ actor->onTimerMessage();
+ }
+}
+
+void SeqTimer::calculateUpdatesCount() {
+ Common::RandomSource &random =_sequencer->_page->getGame()->getRnd();
+ _updatesToMessage = _range ? _period + random.getRandomNumber(_range) : _period;
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/sequences/seq_timer.h b/engines/pink/objects/sequences/seq_timer.h
index 4319b92..0b961c0 100644
--- a/engines/pink/objects/sequences/seq_timer.h
+++ b/engines/pink/objects/sequences/seq_timer.h
@@ -35,12 +35,16 @@ public:
virtual void deserialize(Archive &archive);
virtual void toConsole();
+ virtual void update();
+
+
private:
+ void calculateUpdatesCount();
Common::String _actor;
+ Sequencer *_sequencer;
int _period;
int _range;
- int _unk;
- Sequencer *_sequencer;
+ int _updatesToMessage;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp
index 098330b..b956057 100644
--- a/engines/pink/objects/sequences/sequence.cpp
+++ b/engines/pink/objects/sequences/sequence.cpp
@@ -119,7 +119,7 @@ void Sequence::restart() {
void Sequence::skipToLastSubSequence() {
if (_unk && _context->getNextItemIndex() < _items.size()){
int i = _items.size() - 1;
- while(i >= 0 && !_items[i--]->isLeader());
+ while(i >= 0 && !_items[--i]->isLeader());
assert(i >= 0);
_context->setNextItemIndex(i);
_context->clearActionsFromActorStates();
diff --git a/engines/pink/objects/sequences/sequence_item.cpp b/engines/pink/objects/sequences/sequence_item.cpp
index 5ea7b74..c7b5213 100644
--- a/engines/pink/objects/sequences/sequence_item.cpp
+++ b/engines/pink/objects/sequences/sequence_item.cpp
@@ -58,14 +58,10 @@ bool SequenceItem::execute(int index, Sequence *sequence, bool unk2) {
}
actor->setAction(action, unk2);
- Common::Array<SequenceActorState> &states = sequence->_context->_states;
- for (int i = 0; i < sequence->_context->_states.size(); ++i) {
- if (states[i]._actorName == _actor){
- states[i]._index = index;
- sequence->_context->_actor = isLeader() ? actor : sequence->_context->_actor;
- break;
- }
- }
+
+ SequenceActorState *state = sequence->_sequencer->findSequenceActorState(_actor);
+ state->_index = index;
+ sequence->_context->_actor = isLeader() ? actor : sequence->_context->_actor;
return true;
}
@@ -97,13 +93,8 @@ uint32 SequenceItemLeaderAudio::getSample() {
}
bool SequenceItemDefaultAction::execute(int index, Sequence *sequence, bool unk2) {
- Common::Array<SequenceActorState> &actorStates = sequence->_context->_states;
- for (int i = 0; i < actorStates.size(); ++i) {
- if (actorStates[i]._actorName == _actor){
- actorStates[i]._actionName = _action;
- break;
- }
- }
+ SequenceActorState *state = sequence->_sequencer->findSequenceActorState(_actor);
+ state->_actionName = _action;
return true;
}
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index 871a2e2..f996dc1 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -27,11 +27,14 @@
#include "sequence_context.h"
#include "pink/objects/actors/actor.h"
#include "engines/pink/archive.h"
+#include "pink/objects/pages/game_page.h"
+#include "pink/pink.h"
+#include "pink/objects/sequences/seq_timer.h"
namespace Pink {
Sequencer::Sequencer(GamePage *page)
- : _context(nullptr), _page(page)
+ : _context(nullptr), _page(page), _time(0)
{}
Sequencer::~Sequencer() {
@@ -70,11 +73,15 @@ void Sequencer::toConsole() {
for (int i = 0; i < _sequences.size(); ++i) {
_sequences[i]->toConsole();
}
+ for (int i = 0; i < _timers.size(); ++i) {
+ _timers[i]->toConsole();
+ }
}
void Sequencer::update() {
if (_context)
_context->_sequence->update();
+ updateTimers();
}
void Sequencer::removeContext(SequenceContext *context) {
@@ -95,4 +102,28 @@ void Sequencer::skipToLastSubSequence() {
_context->getSequence()->skipToLastSubSequence();
}
+void Sequencer::updateTimers() {
+ uint time = _page->getGame()->getTotalPlayTime();
+ if (time - _time <= 0x64) {
+ return;
+ }
+
+ _time = time;
+ for (int i = 0; i < _timers.size(); ++i) {
+ _timers[i]->update();
+ }
+}
+
+SequenceActorState *Sequencer::findSequenceActorState(const Common::String &name) {
+ if (!_context)
+ return nullptr;
+
+ for (int i = 0; i < _context->_states.size(); ++i) {
+ if (_context->_states[i].getActor() == name)
+ return &_context->_states[i];
+ }
+
+ return nullptr;
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/sequences/sequencer.h b/engines/pink/objects/sequences/sequencer.h
index f453ffb..1ae4689 100644
--- a/engines/pink/objects/sequences/sequencer.h
+++ b/engines/pink/objects/sequences/sequencer.h
@@ -33,6 +33,7 @@ class Sequence;
class SequenceContext;
class GamePage;
class SeqTimer;
+class SequenceActorState;
class Sequencer : public Object {
public:
@@ -43,6 +44,8 @@ public:
virtual void deserialize(Archive &archive);
Sequence* findSequence(const Common::String &name);
+ SequenceActorState *findSequenceActorState(const Common::String &name);
+
void authorSequence(Sequence *sequence, bool unk);
void removeContext(SequenceContext *context);
@@ -54,13 +57,15 @@ public:
void skipToLastSubSequence();
public:
+ void updateTimers();
+
SequenceContext *_context;
// context array
Common::Array<Sequence*> _sequences;
Common::String _currentSequenceName;
Common::Array<SeqTimer*> _timers;
GamePage *_page;
- int unk;
+ uint _time;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/side_effect.cpp b/engines/pink/objects/side_effect.cpp
index 124ba8a..1790917 100644
--- a/engines/pink/objects/side_effect.cpp
+++ b/engines/pink/objects/side_effect.cpp
@@ -36,8 +36,8 @@ void SideEffectExit::deserialize(Archive &archive) {
archive >> _nextModule >> _nextPage;
}
-void SideEffectExit::execute(LeadActor *actor) {
- actor->setNextExecutors(_nextModule, _nextPage);
+void SideEffectExit::execute(Actor *actor) {
+ actor->getPage()->getLeadActor()->setNextExecutors(_nextModule, _nextPage);
}
void SideEffectExit::toConsole() {
@@ -48,10 +48,11 @@ void SideEffectLocation::deserialize(Archive &archive) {
archive >> _location;
}
-void SideEffectLocation::execute(LeadActor *actor) {
+void SideEffectLocation::execute(Actor *actor) {
WalkMgr *mgr = actor->getPage()->getWalkMgr();
WalkLocation *location = mgr->findLocation(_location);
- //TODO end this method
+ assert(location);
+ mgr->setCurrentWayPoint(location);
}
void SideEffectLocation::toConsole() {
@@ -62,8 +63,10 @@ void SideEffectInventoryItemOwner::deserialize(Archive &archive) {
archive >> _item >> _owner;
}
-void SideEffectInventoryItemOwner::execute(LeadActor *actor) {
- //TODO
+void SideEffectInventoryItemOwner::execute(Actor *actor) {
+ InventoryMgr *mgr = actor->getPage()->getModule()->getInventoryMgr();
+ InventoryItem *item = mgr->findInventoryItem(_item);
+ mgr->setItemOwner(_item, item);
}
void SideEffectInventoryItemOwner::toConsole() {
@@ -74,7 +77,7 @@ void SideEffectVariable::deserialize(Pink::Archive &archive) {
archive >> _name >> _value;
}
-void SideEffectGameVariable::execute(LeadActor *actor) {
+void SideEffectGameVariable::execute(Actor *actor) {
actor->getPage()->getGame()->setVariable(_name, _value);
}
@@ -82,7 +85,7 @@ void SideEffectGameVariable::toConsole() {
debug("\t\tSideEffectGameVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
}
-void SideEffectModuleVariable::execute(LeadActor *actor) {
+void SideEffectModuleVariable::execute(Actor *actor) {
actor->getPage()->getModule()->setVariable(_name, _value);
}
@@ -90,7 +93,7 @@ void SideEffectModuleVariable::toConsole() {
debug("\t\tSideEffectModuleVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
}
-void SideEffectPageVariable::execute(LeadActor *actor) {
+void SideEffectPageVariable::execute(Actor *actor) {
actor->getPage()->setVariable(_name, _value);
}
@@ -102,7 +105,7 @@ void SideEffectRandomPageVariable::deserialize(Archive &archive) {
archive >> _name >> _values;
}
-void SideEffectRandomPageVariable::execute(LeadActor *actor) {
+void SideEffectRandomPageVariable::execute(Actor *actor) {
assert(!_values.empty());
Common::RandomSource &rnd = actor->getPage()->getGame()->getRnd();
diff --git a/engines/pink/objects/side_effect.h b/engines/pink/objects/side_effect.h
index 4542b7f..b184eb6 100644
--- a/engines/pink/objects/side_effect.h
+++ b/engines/pink/objects/side_effect.h
@@ -28,19 +28,19 @@
namespace Pink {
-class LeadActor;
+class Actor;
class SideEffect : public Object {
public:
virtual void deserialize(Archive &archive) = 0;
- virtual void execute(LeadActor *actor) = 0;
+ virtual void execute(Actor *actor) = 0;
};
class SideEffectExit : public SideEffect {
public:
virtual void deserialize(Archive &archive);
virtual void toConsole();
- virtual void execute(LeadActor *actor);
+ virtual void execute(Actor *actor);
private:
Common::String _nextModule;
@@ -50,7 +50,7 @@ private:
class SideEffectLocation : public SideEffect {
public:
virtual void deserialize(Archive &archive);
- virtual void execute(LeadActor *actor);
+ virtual void execute(Actor *actor);
virtual void toConsole();
private:
@@ -60,7 +60,7 @@ private:
class SideEffectInventoryItemOwner : public SideEffect {
public:
virtual void deserialize(Archive &archive);
- virtual void execute(LeadActor *actor);
+ virtual void execute(Actor *actor);
virtual void toConsole();
private:
@@ -71,7 +71,7 @@ private:
class SideEffectVariable : public SideEffect {
public:
virtual void deserialize(Archive &archive);
- virtual void execute(LeadActor *actor) = 0;
+ virtual void execute(Actor *actor) = 0;
protected:
Common::String _name;
@@ -81,19 +81,19 @@ protected:
class SideEffectGameVariable : public SideEffectVariable {
public:
virtual void toConsole();
- virtual void execute(LeadActor *actor);
+ virtual void execute(Actor *actor);
};
class SideEffectModuleVariable : public SideEffectVariable {
public:
virtual void toConsole();
- virtual void execute(LeadActor *actor);
+ virtual void execute(Actor *actor);
};
class SideEffectPageVariable : public SideEffectVariable {
public:
virtual void toConsole();
- virtual void execute(LeadActor *actor);
+ virtual void execute(Actor *actor);
};
class SideEffectRandomPageVariable : public SideEffect
@@ -101,7 +101,7 @@ class SideEffectRandomPageVariable : public SideEffect
public:
virtual void deserialize(Archive &archive);
virtual void toConsole();
- virtual void execute(LeadActor *actor);
+ virtual void execute(Actor *actor);
private:
Common::String _name;
diff --git a/engines/pink/objects/walk/walk_location.cpp b/engines/pink/objects/walk/walk_location.cpp
index e5f5ea7..c4b56d9 100644
--- a/engines/pink/objects/walk/walk_location.cpp
+++ b/engines/pink/objects/walk/walk_location.cpp
@@ -20,10 +20,23 @@
*
*/
+#include <common/debug.h>
#include "walk_location.h"
#include "engines/pink/archive.h"
-void Pink::WalkLocation::deserialize(Pink::Archive &archive) {
+namespace Pink {
+
+void WalkLocation::deserialize(Pink::Archive &archive) {
NamedObject::deserialize(archive);
archive >> _neighbors;
}
+
+void WalkLocation::toConsole() {
+ debug("\tWalkLocation: _name =%s", _name.c_str());
+ debug("\tNeighbors:");
+ for (int i = 0; i < _neighbors.size(); ++i) {
+ debug("\t\t%s", _neighbors[i].c_str());
+ }
+}
+
+} // End of namespace Pink;
\ No newline at end of file
diff --git a/engines/pink/objects/walk/walk_location.h b/engines/pink/objects/walk/walk_location.h
index 82e6436..b9515cd 100644
--- a/engines/pink/objects/walk/walk_location.h
+++ b/engines/pink/objects/walk/walk_location.h
@@ -33,6 +33,8 @@ class WalkLocation : public NamedObject {
public:
virtual void deserialize(Archive &archive);
+ void toConsole() override;
+ Common::StringArray &getNeigbors() { return _neighbors;}
private:
Common::StringArray _neighbors;
};
diff --git a/engines/pink/objects/walk/walk_mgr.cpp b/engines/pink/objects/walk/walk_mgr.cpp
index 1b5ceef..0cacbd0 100644
--- a/engines/pink/objects/walk/walk_mgr.cpp
+++ b/engines/pink/objects/walk/walk_mgr.cpp
@@ -1,20 +1,153 @@
-//
-// Created by andrei on 3/17/18.
-//
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
#include "walk_mgr.h"
#include "walk_location.h"
+#include "engines/pink/objects/actions/walk_action.h"
#include "engines/pink/objects/actors/lead_actor.h"
#include "engines/pink/archive.h"
+#include "pink/cel_decoder.h"
+namespace Pink {
-void Pink::WalkMgr::deserialize(Pink::Archive &archive) {
- _leadActor = static_cast<LeadActor*>(archive.readObject());
+WalkMgr::WalkMgr()
+ : _isWalking(false), _leadActor(nullptr)
+{
+
+}
+
+void WalkMgr::deserialize(Pink::Archive &archive) {
+ _leadActor = static_cast<LeadActor *>(archive.readObject());
archive >> _locations;
}
-Pink::WalkLocation *Pink::WalkMgr::findLocation(Common::String &name) {
- return *Common::find_if(_locations.begin(), _locations.end(), [&name] (WalkLocation *location) {
+WalkLocation *WalkMgr::findLocation(const Common::String &name) {
+ auto it = Common::find_if(_locations.begin(), _locations.end(), [&name](WalkLocation *location) {
return location->getName() == name;
});
+ if (it == _locations.end())
+ return nullptr;
+
+ return *it;
+}
+
+void WalkMgr::toConsole() {
+ debug("WalkMgr:");
+ for (int i = 0; i < _locations.size(); ++i) {
+ _locations[i]->toConsole();
+ }
+}
+
+void WalkMgr::start(WalkLocation *destination) {
+ if (_isWalking)
+ return;
+
+ if (_current.name.empty()) {
+ _current.name = _locations[0]->getName();
+ _current.coord = getLocationCoordinates(_locations[0]->getName());
+ }
+
+ _destination = destination;
+
+ if (_current.name == _destination->getName()) {
+ end();
+ }
+ else {
+ _isWalking = true;
+ WalkLocation *currentLocation = findLocation(_current.name);
+ WalkShortestPath path(this);
+ WalkLocation *nextLocation = path.next(currentLocation, _destination);
+ initNextWayPoint(nextLocation);
+ _leadActor->setAction(getWalkAction(), 0);
+ }
+}
+
+void WalkMgr::initNextWayPoint(WalkLocation *location) {
+ _next.name = location->getName();
+ _next.coord = getLocationCoordinates(location->getName());
+}
+
+WalkAction *WalkMgr::getWalkAction() {
+ Common::String walkActionName;
+ if (_current.coord.z == _next.coord.z){
+ if (_next.coord.x > _current.coord.x){
+ walkActionName = Common::String::format("%dRight", _current.coord.z);
+ }
+ else walkActionName = Common::String::format("%dLeft", _next.coord.z);
+ }
+ else walkActionName = Common::String::format("%dTo%d", _current.coord.z, _next.coord.z);
+
+ Action *action = _leadActor->findAction(walkActionName);
+
+
+ return static_cast<WalkAction*>(action);
}
+
+double WalkMgr::getLengthBetweenLocations(WalkLocation *first, WalkLocation *second) {
+ Coordinates firstCoord = getLocationCoordinates(first->getName());
+ Coordinates secondCoord = getLocationCoordinates(second->getName());
+ return sqrt((secondCoord.x - firstCoord.x) * (secondCoord.x - firstCoord.x) +
+ (secondCoord.y - firstCoord.y) * (secondCoord.y - firstCoord.y));
+}
+
+WalkMgr::Coordinates WalkMgr::getLocationCoordinates(const Common::String &locationName) {
+ Coordinates coords;
+ ActionCEL *action = static_cast<ActionCEL*>(_leadActor->findAction(locationName));
+
+ action->start(0);
+ CelDecoder *decoder = action->getDecoder();
+
+ coords.x = decoder->getX() + decoder->getWidth() / 2;
+ coords.y = decoder->getY() + decoder->getHeight() / 2;
+ coords.z = action->getZ();
+
+ action->end();
+
+ return coords;
+}
+
+void WalkMgr::setCurrentWayPoint(WalkLocation *location) {
+ _current.name = location->getName();
+ _current.coord = getLocationCoordinates(_current.name);
+}
+
+void WalkMgr::update() {
+ if (_leadActor->isPlaying())
+ return;
+
+ WalkShortestPath path(this);
+ _current = _next;
+ WalkLocation *next = path.next(findLocation(_current.name), _destination);
+ if (next){
+ initNextWayPoint(next);
+ _leadActor->setAction(getWalkAction(), 0);
+ }
+ else end();
+
+}
+
+void WalkMgr::end() {
+ _isWalking = false;
+ _leadActor->onWalkEnd();
+}
+
+} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/walk/walk_mgr.h b/engines/pink/objects/walk/walk_mgr.h
index 0ae7ef6..403cc7e 100644
--- a/engines/pink/objects/walk/walk_mgr.h
+++ b/engines/pink/objects/walk/walk_mgr.h
@@ -25,20 +25,49 @@
#include <common/array.h>
#include "engines/pink/objects/object.h"
+#include "walk_shortest_path.h"
namespace Pink {
class WalkLocation;
class LeadActor;
+class WalkAction;
class WalkMgr : public Object {
public:
+ WalkMgr();
virtual void deserialize(Archive &archive);
- WalkLocation *findLocation(Common::String &name);
+ void toConsole() override;
+
+ WalkLocation *findLocation(const Common::String &name);
+ void start(WalkLocation *destination);
+ void update();
+
+ double getLengthBetweenLocations(WalkLocation *first, WalkLocation *second);
+ void setCurrentWayPoint(WalkLocation *location);
private:
+ struct Coordinates {
+ int x;
+ int y;
+ int z;
+ };
+ struct WayPoint {
+ Common::String name;
+ Coordinates coord;
+ };
+
+ Coordinates getLocationCoordinates(const Common::String &locationName);
+ void end();
+ void initNextWayPoint(WalkLocation *location);
+ WalkAction *getWalkAction();
+
LeadActor *_leadActor;
+ WalkLocation *_destination;
Common::Array<WalkLocation*> _locations;
+ WayPoint _current;
+ WayPoint _next;
+ bool _isWalking;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/walk/walk_shortest_path.cpp b/engines/pink/objects/walk/walk_shortest_path.cpp
new file mode 100644
index 0000000..77562e8
--- /dev/null
+++ b/engines/pink/objects/walk/walk_shortest_path.cpp
@@ -0,0 +1,159 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "walk_shortest_path.h"
+#include "walk_mgr.h"
+#include "walk_location.h"
+
+namespace Pink {
+
+WalkShortestPath::WalkShortestPath(WalkMgr *manager)
+ : _manager(manager)
+{}
+
+WalkLocation *WalkShortestPath::next(WalkLocation *start, WalkLocation *destination) {
+ if (start == destination)
+ return nullptr;
+ add(start, 0.0, 0);
+ while (build() != destination);
+ return getNearestNeighbor(destination);
+}
+
+void WalkShortestPath::add(WalkLocation *wl, double val, WalkLocation *nearest) {
+ _locations.push_back(wl);
+ _visited.push_back(wl);
+ _weight.push_back(val);
+ _nearestNeigbor.push_back(nearest);
+}
+
+WalkLocation *WalkShortestPath::build() {
+ WalkLocation *nearest = nullptr;
+ WalkLocation *location = nullptr;
+ double len = -1.0;
+ addLocationsToVisit();
+ for (int i = 0; i < _toVisit.size(); ++i) {
+ double curLen = getLengthToNearestNeigbor(_toVisit[i]);
+ if (curLen < 0) {
+ remove(_toVisit[i]);
+ continue;
+ }
+ curLen += getWeight(_toVisit[i]);
+ if (len < 0.0 || len > curLen) {
+ len = curLen;
+ location = _toVisit[i];
+ nearest = getNearestNeighbor(_toVisit[i]);
+ if (!nearest)
+ nearest = findNearestNeighbor(_toVisit[i]);
+ }
+ }
+
+ WalkLocation *neighbor = findNearestNeighbor(location);
+ if (neighbor)
+ add(neighbor, len, nearest);
+
+ return neighbor;
+}
+
+WalkLocation *WalkShortestPath::getNearestNeighbor(WalkLocation *location) {
+ for(int i = 0; i < _visited.size(); ++i){
+ if (_visited[i] == location)
+ return _nearestNeigbor[i];
+ }
+
+ return nullptr;
+}
+
+void WalkShortestPath::addLocationsToVisit() {
+ _toVisit.resize(_locations.size());
+ for (int i = 0; i < _locations.size(); ++i) {
+ _toVisit[i] = _locations[i];
+ }
+}
+
+double WalkShortestPath::getLengthToNearestNeigbor(WalkLocation *location) {
+ double minLength = -1.0;
+ auto &neighbors = location->getNeigbors();
+ for (int i = 0; i < neighbors.size(); ++i) {
+ WalkLocation *neighbor = _manager->findLocation(neighbors[i]);
+ if (!isLocationVisited(neighbor)){
+ double length = _manager->getLengthBetweenLocations(location, neighbor);
+ if (minLength >= 0.0) {
+ if (length < minLength)
+ minLength = length;
+ }
+ else minLength = length;
+ }
+ }
+
+ return minLength;
+}
+
+WalkLocation *WalkShortestPath::findNearestNeighbor(WalkLocation *location) {
+ double minLength = -1.0;
+ WalkLocation *nearest = nullptr;
+ auto neighbors = location->getNeigbors();
+ for (int i = 0; i < neighbors.size(); ++i) {
+ WalkLocation *neighbor = _manager->findLocation(neighbors[i]);
+ if (!isLocationVisited(neighbor)){
+ double length = _manager->getLengthBetweenLocations(location, neighbor);
+ if (minLength >= 0.0) {
+ if (length < minLength) {
+ nearest = neighbor;
+ minLength = length;
+ }
+ }
+ else {
+ nearest = neighbor;
+ minLength = length;
+ }
+ }
+ }
+
+ return nearest;
+}
+
+double WalkShortestPath::getWeight(WalkLocation *location) {
+ for (int i = 0; i < _locations.size(); ++i) {
+ if (_locations[i] == location)
+ return _weight[i];
+ }
+ return 0.0;
+}
+
+bool WalkShortestPath::isLocationVisited(WalkLocation *location) {
+ for (int i = 0; i < _visited.size(); ++i) {
+ if (_visited[i] == location)
+ return 1;
+ }
+ return 0;
+}
+
+void WalkShortestPath::remove(WalkLocation *location) {
+ for (int i = 0; i < _locations.size(); ++i) {
+ if (_locations[i] == location){
+ _locations.remove_at(i);
+ _weight.remove_at(i);
+ }
+ }
+}
+
+} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/walk/walk_shortest_path.h b/engines/pink/objects/walk/walk_shortest_path.h
new file mode 100644
index 0000000..8b7dc80
--- /dev/null
+++ b/engines/pink/objects/walk/walk_shortest_path.h
@@ -0,0 +1,61 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_WALK_SHORTEST_PATH_H
+#define PINK_WALK_SHORTEST_PATH_H
+
+#include <common/array.h>
+
+namespace Pink {
+
+class WalkLocation;
+class WalkMgr;
+
+class WalkShortestPath {
+public:
+ WalkShortestPath(WalkMgr *manager);
+ WalkLocation *next(WalkLocation *start, WalkLocation *destination);
+
+private:
+ void add(WalkLocation *wl, double val, WalkLocation *nearest);
+ void remove(WalkLocation *location);
+ WalkLocation *build();
+ WalkLocation *getNearestNeighbor(WalkLocation *location);
+ WalkLocation *findNearestNeighbor(WalkLocation *location);
+ double getLengthToNearestNeigbor(WalkLocation *location);
+ double getWeight(WalkLocation *location);
+ void addLocationsToVisit();
+ bool isLocationVisited(WalkLocation *location);
+
+
+ WalkMgr *_manager;
+ Common::Array<WalkLocation*> _locations;
+ Common::Array<WalkLocation*> _toVisit;
+ Common::Array<double> _weight;
+ Common::Array<WalkLocation*> _visited;
+ Common::Array<WalkLocation*> _nearestNeigbor;
+};
+
+} // End of namespace Pink
+
+
+#endif
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index 9cc0ee5..008f827 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -30,6 +30,7 @@
#include <graphics/surface.h>
#include <graphics/cursorman.h>
#include <common/winexe_pe.h>
+#include <common/config-manager.h>
namespace Pink {
diff --git a/engines/pink/sound.cpp b/engines/pink/sound.cpp
index fda91e5..a4a47be 100644
--- a/engines/pink/sound.cpp
+++ b/engines/pink/sound.cpp
@@ -68,7 +68,7 @@ void Sound::play(Audio::Mixer::SoundType type, int volume, bool isLoop) {
}
else audioStream = wavStream;
- _mixer->playStream(type, &_handle , audioStream, -1 , Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::YES);
+ _mixer->playStream(type, &_handle , audioStream, -1 , 50, 0, DisposeAfterUse::YES);
}
void Sound::setBalance(int8 balance) {
Commit: c29b1d1112b70fcb017359f9a28eb8b7de49a5ab
https://github.com/scummvm/scummvm/commit/c29b1d1112b70fcb017359f9a28eb8b7de49a5ab
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: started inventory implementation
Changed paths:
engines/pink/director.h
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/actors/lead_actor.h
engines/pink/objects/actors/supporting_actor.cpp
engines/pink/objects/actors/supporting_actor.h
engines/pink/objects/handlers/handler.cpp
engines/pink/objects/handlers/handler.h
engines/pink/objects/handlers/handler_mgr.cpp
engines/pink/objects/handlers/handler_mgr.h
engines/pink/objects/inventory.cpp
diff --git a/engines/pink/director.h b/engines/pink/director.h
index b03f22e..2fc042c 100644
--- a/engines/pink/director.h
+++ b/engines/pink/director.h
@@ -37,7 +37,7 @@ class CelDecoder;
class Director {
public:
Director(OSystem *system);
- //CActor *getActorByCoords()
+ Actor *getActorByPoint(Common::Point point);
void draw();
void update();
@@ -51,7 +51,6 @@ public:
void clear();
- Actor *getActorByPoint(Common::Point point);
bool showBounds;
private:
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index faa0d5a..516569f 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -184,16 +184,16 @@ void LeadActor::onLeftButtonClick(Common::Point point) {
Actor *actor = _page->getGame()->getDirector()->getActorByPoint(point);
if (this == actor){
- // inventory is not implemented
+ // inventory is not implemented
return;
}
_recipient = (SupportingActor*) actor;
if (actor->isClickable() &&
_recipient->isLeftClickHandlers()){
- _state = kMoving;
- _nextState = kInDialog1;
- _walkMgr->start(_walkMgr->findLocation(_recipient->getLocation()));
+ _state = kMoving;
+ _nextState = kInDialog1;
+ _walkMgr->start(_walkMgr->findLocation(_recipient->getLocation()));
}
break;
}
@@ -229,10 +229,24 @@ bool LeadActor::sendUseClickMessage(SupportingActor *actor) {
}
bool LeadActor::sendLeftClickMessage(SupportingActor *actor) {
- actor->onLeftClickMessage();
_nextState = _state != kPlayingVideo ? kReady : kPlayingVideo;
_state = kInDialog1;
- return false;
+ return actor->onLeftClickMessage();
+}
+
+void LeadActor::onClick() {
+ if (_isHaveItem) {
+ _isHaveItem = false;
+ _nextState = _state != kMoving ?
+ kUnk_Loading : kReady;
+ }
+ else {
+ if (_state == kMoving) {
+ this->_recipient = nullptr;
+ this->_nextState = nullptr;
+ }
+
+ }
}
void ParlSqPink::toConsole() {
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index 261b5dc..a2c2ede 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -66,6 +66,7 @@ public:
void onLeftButtonClick(Common::Point point);
void onMouseMove(Common::Point point);
void onWalkEnd();
+ void onClick();
virtual void onMouseOver(Common::Point point, CursorMgr *mgr);
@@ -75,10 +76,11 @@ private:
bool sendUseClickMessage(SupportingActor *actor);
bool sendLeftClickMessage(SupportingActor *actor);
-
State _state;
State _nextState;
+ bool _isHaveItem;
+
SupportingActor *_recipient;
CursorMgr *_cursorMgr;
diff --git a/engines/pink/objects/actors/supporting_actor.cpp b/engines/pink/objects/actors/supporting_actor.cpp
index d43f871..e32c89f 100644
--- a/engines/pink/objects/actors/supporting_actor.cpp
+++ b/engines/pink/objects/actors/supporting_actor.cpp
@@ -65,8 +65,8 @@ bool SupportingActor::onLeftClickMessage() {
return _handlerMgr.onLeftClickMessage(this);
}
-bool SupportingActor::onUseClickMessage() {
- return _handlerMgr.onUseClickMessage(this);
+bool SupportingActor::onUseClickMessage(InventoryItem *item, InventoryMgr *mgr) {
+ return _handlerMgr.onUseClickMessage(this, item, mgr);
}
const Common::String &SupportingActor::getLocation() const {
diff --git a/engines/pink/objects/actors/supporting_actor.h b/engines/pink/objects/actors/supporting_actor.h
index 2888582..33b469f 100644
--- a/engines/pink/objects/actors/supporting_actor.h
+++ b/engines/pink/objects/actors/supporting_actor.h
@@ -28,6 +28,9 @@
namespace Pink {
+class InventoryItem;
+class InventoryMgr;
+
class SupportingActor : public Actor {
public:
virtual void deserialize(Archive &archive);
@@ -40,7 +43,7 @@ public:
void onTimerMessage();
bool onLeftClickMessage();
- bool onUseClickMessage();
+ bool onUseClickMessage(InventoryItem *item, InventoryMgr *mgr);
const Common::String &getLocation() const;
diff --git a/engines/pink/objects/handlers/handler.cpp b/engines/pink/objects/handlers/handler.cpp
index 7c2bcaa..dd24925 100644
--- a/engines/pink/objects/handlers/handler.cpp
+++ b/engines/pink/objects/handlers/handler.cpp
@@ -152,8 +152,4 @@ void HandlerUseClick::toConsole() {
}
}
-void HandlerUseClick::execute(Sequence *sequence) {
-
-}
-
} // End of namespace Pink
diff --git a/engines/pink/objects/handlers/handler.h b/engines/pink/objects/handlers/handler.h
index 47f9ab8..bf1f26b 100644
--- a/engines/pink/objects/handlers/handler.h
+++ b/engines/pink/objects/handlers/handler.h
@@ -83,8 +83,11 @@ public:
virtual void deserialize(Archive &archive);
virtual void toConsole();
+ const Common::String &getInventoryItem() const { return _inventoryItem; }
+ const Common::String &getRecepient() const { return _recepient; }
+
private:
- virtual void execute(Sequence *sequence);
+ virtual void execute(Sequence *sequence) {};
Common::String _inventoryItem;
Common::String _recepient;
diff --git a/engines/pink/objects/handlers/handler_mgr.cpp b/engines/pink/objects/handlers/handler_mgr.cpp
index 76c2cf6..db53c6a 100644
--- a/engines/pink/objects/handlers/handler_mgr.cpp
+++ b/engines/pink/objects/handlers/handler_mgr.cpp
@@ -7,6 +7,7 @@
#include "handler_timer.h"
#include <pink/archive.h>
#include <common/debug.h>
+#include <pink/objects/inventory.h>
namespace Pink {
@@ -46,18 +47,20 @@ bool HandlerMgr::onLeftClickMessage(Actor *actor) {
Handler *handler = findSuitableHandlerLeftClick(actor);
if (handler) {
handler->handle(actor);
- return 1;
+ return true;
}
- return 0;
+ return false;
}
-bool HandlerMgr::onUseClickMessage(Actor *actor) {
- Handler *handler = findSuitableHandlerUseClick(actor);
+bool HandlerMgr::onUseClickMessage(Actor *actor, InventoryItem *item, InventoryMgr *mgr) {
+ HandlerUseClick *handler = (HandlerUseClick*) findSuitableHandlerUseClick(actor);
if (handler) {
handler->handle(actor);
- return 1;
+ mgr->setItemOwner(handler->getRecepient(), item);
+ handler->handle(actor);
+ return true;
}
- return 0;
+ return false;
}
Handler *HandlerMgr::findSuitableHandlerTimer(Actor *actor) {
diff --git a/engines/pink/objects/handlers/handler_mgr.h b/engines/pink/objects/handlers/handler_mgr.h
index 0816087..7ff498e 100644
--- a/engines/pink/objects/handlers/handler_mgr.h
+++ b/engines/pink/objects/handlers/handler_mgr.h
@@ -28,10 +28,14 @@
namespace Pink {
+class InventoryItem;
+class InventoryMgr;
+
class Handler;
class HandlerLeftClick;
class HandlerUseClick;
class HandlerTimer;
+
class Actor;
class HandlerMgr : public Object {
@@ -44,7 +48,7 @@ public:
void onTimerMessage(Actor *actor);
bool onLeftClickMessage(Actor *actor);
- bool onUseClickMessage(Actor *actor);
+ bool onUseClickMessage(Actor *actor, InventoryItem *item, InventoryMgr *mgr);
private:
Handler *findSuitableHandlerTimer(Actor *actor);
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
index 0f1b711..9bbc279 100644
--- a/engines/pink/objects/inventory.cpp
+++ b/engines/pink/objects/inventory.cpp
@@ -90,8 +90,15 @@ bool InventoryMgr::isPinkOwnsAnyItems() {
}
void InventoryMgr::setItemOwner(const Common::String &owner, InventoryItem *item) {
+ if (owner == item->getCurrentOwner())
+ return;
+
+ if (item == _item && _lead->getName() != owner)
+ _item = nullptr;
+ else if (_lead->getName() == owner)
+ _item = item;
+
item->_currentOwner = owner;
- _item = item;
}
} // End of namespace Pink
Commit: 78c4ed85ab7a84b18c8c7fd2e93c6bf2798acab6
https://github.com/scummvm/scummvm/commit/78c4ed85ab7a84b18c8c7fd2e93c6bf2798acab6
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: implemented page state saving
Changed paths:
engines/pink/archive.cpp
engines/pink/archive.h
engines/pink/cel_decoder.cpp
engines/pink/cel_decoder.h
engines/pink/director.cpp
engines/pink/file.cpp
engines/pink/objects/actions/action_cel.cpp
engines/pink/objects/actions/action_cel.h
engines/pink/objects/actions/action_hide.cpp
engines/pink/objects/actions/action_hide.h
engines/pink/objects/actions/action_play.cpp
engines/pink/objects/actions/action_still.cpp
engines/pink/objects/actors/actor.cpp
engines/pink/objects/actors/actor.h
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/actors/supporting_actor.cpp
engines/pink/objects/actors/supporting_actor.h
engines/pink/objects/handlers/handler_mgr.cpp
engines/pink/objects/handlers/handler_mgr.h
engines/pink/objects/module.cpp
engines/pink/objects/pages/game_page.cpp
engines/pink/objects/pages/game_page.h
engines/pink/objects/pages/page.cpp
engines/pink/objects/pages/page.h
engines/pink/pink.h
engines/pink/resource_mgr.cpp
engines/pink/resource_mgr.h
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp
index 4db6d8e..ac56b87 100644
--- a/engines/pink/archive.cpp
+++ b/engines/pink/archive.cpp
@@ -211,8 +211,15 @@ static Object* createObject(int objectId){
}
}
-Archive::Archive(Common::File &file)
- : _file(file)
+Archive::Archive(Common::SeekableReadStream *stream)
+ : _readStream(stream), _writeStream(nullptr)
+{
+ _objectMap.push_back(0);
+ _objectIdMap.push_back(kNullObject);
+}
+
+Archive::Archive(Common::WriteStream *stream)
+ : _writeStream(stream), _readStream(nullptr)
{
_objectMap.push_back(0);
_objectIdMap.push_back(kNullObject);
@@ -227,10 +234,10 @@ void Archive::mapObject(Object *obj) {
}
int Archive::readCount() {
- int count = _file.readUint16LE();
+ int count = _readStream->readUint16LE();
if (count == 0xffff)
- count = _file.readUint32LE();
+ count = _readStream->readUint32LE();
return count;
}
@@ -251,15 +258,15 @@ Object *Archive::parseObject(bool &isCopyReturned) {
int objectId = 0;
Object *res = nullptr;
- uint obTag = _file.readUint16LE();
+ uint obTag = _readStream->readUint16LE();
if (obTag == 0x0000) {
return nullptr;
} else if (obTag == 0xffff) {
- int schema = _file.readUint16LE();
+ int schema = _readStream->readUint16LE();
- int size = _file.readUint16LE();
- _file.read(className, size);
+ int size = _readStream->readUint16LE();
+ _readStream->read(className, size);
className[size] = '\0';
objectId = findObjectId(className + 1);
@@ -308,18 +315,32 @@ uint Archive::findObjectId(const char *name) {
}
Common::String Archive::readString() {
- char buffer[kMaxStringLength]; // test and lower then
- byte len = _file.readByte();
- _file.read(buffer, len);
+ char buffer[kMaxStringLength];
+ byte len = _readStream->readByte();
+ assert(len <= 64);
+ _readStream->read(buffer, len);
return Common::String(buffer, len);
}
uint32 Archive::readDWORD() {
- return _file.readUint32LE();
+ return _readStream->readUint32LE();
}
uint16 Archive::readWORD() {
- return _file.readUint16LE();
+ return _readStream->readUint16LE();
+}
+
+void Archive::writeDWORD(uint32 val) {
+ _writeStream->writeUint32LE(val);
+}
+
+void Archive::writeWORD(uint16 val) {
+ _writeStream->writeUint16LE(val);
+}
+
+void Archive::writeString(const Common::String &string) {
+ _writeStream->writeByte(string.size());
+ _writeStream->write(string.c_str(), string.size());
}
} // End of namespace Pink
diff --git a/engines/pink/archive.h b/engines/pink/archive.h
index 5e6c091..45554b8 100644
--- a/engines/pink/archive.h
+++ b/engines/pink/archive.h
@@ -25,6 +25,8 @@
#include <engines/pink/objects/object.h>
#include <common/str-array.h>
+#include "common/stream.h"
+#include "common/hash-str.h"
namespace Common {
@@ -36,7 +38,8 @@ namespace Pink {
class Archive {
public:
- Archive(Common::File &file);
+ Archive(Common::SeekableReadStream *stream);
+ Archive(Common::WriteStream *stream);
~Archive();
void mapObject(Object *obj);
@@ -45,8 +48,12 @@ public:
uint32 readDWORD();
uint16 readWORD();
+ void writeDWORD(uint32 val);
+ void writeWORD(uint16 val);
+
Object *readObject();
Common::String readString();
+ void writeString(const Common::String &string);
private:
uint findObjectId(const char *name);
@@ -55,7 +62,8 @@ private:
Common::Array<Object *> _objectMap;
Common::Array<uint> _objectIdMap;
- Common::File &_file;
+ Common::SeekableReadStream *_readStream;
+ Common::WriteStream *_writeStream;
};
template <typename T>
@@ -63,7 +71,8 @@ inline Archive &operator>>(Archive &archive, Common::Array<T> &arr){
uint size = archive.readCount();
arr.resize(size);
for (uint i = 0; i < size; ++i) {
- arr[i] = reinterpret_cast<T> (archive.readObject());
+ arr[i] = dynamic_cast<T>(archive.readObject());
+ assert(arr[i]);
}
return archive;
}
@@ -98,6 +107,45 @@ inline Archive &operator>>(Archive &archive, Common::StringArray &array){
return archive;
}
+inline Archive &operator>>(Archive &archive, Common::StringMap &map){
+ archive.readCount();
+ map.setVal(archive.readString(), archive.readString());
+ return archive;
+}
+
+inline Archive &operator<<(Archive &archive, Common::String &string){
+ archive.writeString(string);
+ return archive;
+}
+
+inline Archive &operator<<(Archive &archive, uint32 &num){
+ archive.writeDWORD(num);
+ return archive;
+}
+
+inline Archive &operator<<(Archive &archive, uint16 &num){
+ archive.writeWORD(num);
+ return archive;
+}
+
+inline Archive &operator<<(Archive &archive, Common::StringArray &array){
+ archive.writeWORD(array.size());
+ for (uint i = 0; i < array.size(); ++i) {
+ archive.writeString(array[i]);
+ }
+ return archive;
+}
+
+inline Archive &operator<<(Archive &archive, Common::StringMap &map){
+ archive.writeWORD(map.size());
+ for (auto &pair : map) {
+ archive.writeString(pair._key);
+ archive.writeString(pair._value);
+ }
+ map.setVal(archive.readString(), archive.readString());
+ return archive;
+}
+
} // End of namespace Pink
#endif
diff --git a/engines/pink/cel_decoder.cpp b/engines/pink/cel_decoder.cpp
index b907f45..1e7a36a 100644
--- a/engines/pink/cel_decoder.cpp
+++ b/engines/pink/cel_decoder.cpp
@@ -192,6 +192,7 @@ const Graphics::Surface *CelDecoder::CelVideoTrack::decodeNextFrame() {
if (_curFrame == 0)
_transparentColourIndex = *(byte*)_surface->getBasePtr(0,0);
+
return _surface;
}
diff --git a/engines/pink/cel_decoder.h b/engines/pink/cel_decoder.h
index f0c612d..c3ecce0 100644
--- a/engines/pink/cel_decoder.h
+++ b/engines/pink/cel_decoder.h
@@ -30,16 +30,16 @@ namespace Pink {
class CelDecoder : public Video::FlicDecoder {
public:
+ virtual bool loadStream(Common::SeekableReadStream *stream);
+
uint32 getX();
uint32 getY();
+ uint16 getTransparentColourIndex();
+
Common::Point getCenter();
Common::Rect &getRectangle();
-
- uint16 getTransparentColourIndex();
const Graphics::Surface *getCurrentFrame();
- virtual bool loadStream(Common::SeekableReadStream *stream);
-
protected:
class CelVideoTrack : public FlicVideoTrack {
public:
@@ -48,10 +48,10 @@ protected:
uint32 getX() const;
uint32 getY() const;
+ uint16 getTransparentColourIndex();
+
Common::Point getCenter();
Common::Rect &getRect();
-
- uint16 getTransparentColourIndex();
const Graphics::Surface *getCurrentFrame();
private:
diff --git a/engines/pink/director.cpp b/engines/pink/director.cpp
index 4003ca5..25ffa5a 100644
--- a/engines/pink/director.cpp
+++ b/engines/pink/director.cpp
@@ -32,7 +32,7 @@ Director::Director(OSystem *system)
: _system(system), showBounds(0) {}
void Director::draw() {
- _system->fillScreen(0);
+ //dd_system->fillScreen(0);
for (int i = 0; i < _sprites.size(); ++i) {
drawSprite(_sprites[i]);
}
diff --git a/engines/pink/file.cpp b/engines/pink/file.cpp
index 5158601..4729032 100644
--- a/engines/pink/file.cpp
+++ b/engines/pink/file.cpp
@@ -74,20 +74,20 @@ bool OrbFile::open(const Common::String &name) {
void OrbFile::loadGame(PinkEngine *game) {
seekToObject("PinkGame");
- Archive archive(*this);
+ Archive archive(this);
archive.mapObject(reinterpret_cast<Object*>(game)); // hack
game->load(archive);
}
void OrbFile::loadObject(Object *obj, const Common::String &name) {
seekToObject(name.c_str());
- Archive archive(*this);
+ Archive archive(this);
obj->load(archive);
}
void OrbFile::loadObject(Object *obj, ObjectDescription *objDesc) {
seek(objDesc->objectsOffset);
- Archive archive(*this);
+ Archive archive(this);
obj->load(archive);
}
diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp
index 938d117..e9e5247 100644
--- a/engines/pink/objects/actions/action_cel.cpp
+++ b/engines/pink/objects/actions/action_cel.cpp
@@ -79,4 +79,8 @@ void ActionCEL::update() {
}
}
+ActionCEL::~ActionCEL() {
+ delete _decoder;
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/actions/action_cel.h b/engines/pink/objects/actions/action_cel.h
index 43fe847..2ae5308 100644
--- a/engines/pink/objects/actions/action_cel.h
+++ b/engines/pink/objects/actions/action_cel.h
@@ -32,6 +32,8 @@ class CelDecoder;
class ActionCEL : public Action {
public:
+ ~ActionCEL() override;
+
ActionCEL();
virtual void deserialize(Archive &archive);
virtual void start(bool unk);
diff --git a/engines/pink/objects/actions/action_hide.cpp b/engines/pink/objects/actions/action_hide.cpp
index b89d4c9..ed2c903 100644
--- a/engines/pink/objects/actions/action_hide.cpp
+++ b/engines/pink/objects/actions/action_hide.cpp
@@ -23,7 +23,6 @@
#include "action_hide.h"
#include "engines/pink/objects/actors/actor.h"
#include <engines/pink/archive.h>
-#include <common/debug.h>
namespace Pink {
@@ -45,4 +44,6 @@ void ActionHide::toConsole() {
debug("\tActionHide: _name = %s", _name.c_str());
}
+ActionHide::~ActionHide() {}
+
} //End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/actions/action_hide.h b/engines/pink/objects/actions/action_hide.h
index 414d077..bc62a5f 100644
--- a/engines/pink/objects/actions/action_hide.h
+++ b/engines/pink/objects/actions/action_hide.h
@@ -29,6 +29,8 @@ namespace Pink {
class ActionHide : public Action {
public:
+ ~ActionHide() override;
+
virtual void deserialize(Archive &archive);
virtual void toConsole();
diff --git a/engines/pink/objects/actions/action_play.cpp b/engines/pink/objects/actions/action_play.cpp
index 969eacf..d3ded9a 100644
--- a/engines/pink/objects/actions/action_play.cpp
+++ b/engines/pink/objects/actions/action_play.cpp
@@ -45,10 +45,13 @@ void ActionPlay::end() {
void ActionPlay::onStart() {
debug("Actor %s has now ActionPlay %s", _actor->getName().c_str(), _name.c_str());
- _decoder->seekToFrame(_startFrame);
+ _decoder->start();
+ for (int i = 0; i <= _startFrame; ++i) {
+ _decoder->decodeNextFrame();
+ }
+
if (_stopFrame != -1)
_decoder->setEndFrame(_stopFrame);
- _decoder->start();
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_still.cpp b/engines/pink/objects/actions/action_still.cpp
index 0af57a0..fc835f1 100644
--- a/engines/pink/objects/actions/action_still.cpp
+++ b/engines/pink/objects/actions/action_still.cpp
@@ -45,7 +45,7 @@ void ActionStill::end() {
void ActionStill::onStart() {
debug("Actor %s has now ActionStill %s", _actor->getName().c_str(), _name.c_str());
- for (int i = 0; i < _startFrame; ++i) {
+ for (int i = 0; i <= _startFrame; ++i) {
_decoder->decodeNextFrame();
}
_decoder->stop();
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index 2bd6af4..6a20a46 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -130,8 +130,21 @@ void Actor::onMouseOver(Common::Point point, CursorMgr *mgr) {
Actor::~Actor() {
for (int i = 0; i < _actions.size(); ++i) {
+ _actions[i]->toConsole();
delete _actions[i];
+ _actions[i] = nullptr;
}
}
+void Actor::loadState(Archive &archive) {
+ Common::String actionName;
+ archive >> actionName;
+ _action = findAction(actionName);
+}
+
+void Actor::saveState(Archive &archive) {
+ assert(_action);
+ archive.writeString(_action->getName());
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/actor.h b/engines/pink/objects/actors/actor.h
index 270ac99..69cf37b 100644
--- a/engines/pink/objects/actors/actor.h
+++ b/engines/pink/objects/actors/actor.h
@@ -60,6 +60,9 @@ public:
void setAction(Action *newAction);
void setAction(Action *newAction, bool unk);
+ void loadState(Archive &archive);
+ void saveState(Archive &archive);
+
bool initPallete(Director *director);
virtual void update() {};
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 516569f..d89ecb4 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -115,6 +115,7 @@ void LeadActor::onKeyboardButtonClick(Common::KeyCode code) {
default:
break;
}
+ break;
case kInDialog1:
case kInDialog2:
case kPlayingVideo:
@@ -242,8 +243,8 @@ void LeadActor::onClick() {
}
else {
if (_state == kMoving) {
- this->_recipient = nullptr;
- this->_nextState = nullptr;
+ _recipient = nullptr;
+ _nextState = kReady;
}
}
diff --git a/engines/pink/objects/actors/supporting_actor.cpp b/engines/pink/objects/actors/supporting_actor.cpp
index e32c89f..735e85e 100644
--- a/engines/pink/objects/actors/supporting_actor.cpp
+++ b/engines/pink/objects/actors/supporting_actor.cpp
@@ -73,4 +73,8 @@ const Common::String &SupportingActor::getLocation() const {
return _location;
}
+SupportingActor::~SupportingActor() {
+
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/actors/supporting_actor.h b/engines/pink/objects/actors/supporting_actor.h
index 33b469f..fe6dfce 100644
--- a/engines/pink/objects/actors/supporting_actor.h
+++ b/engines/pink/objects/actors/supporting_actor.h
@@ -33,6 +33,7 @@ class InventoryMgr;
class SupportingActor : public Actor {
public:
+ virtual ~SupportingActor();
virtual void deserialize(Archive &archive);
virtual void toConsole();
diff --git a/engines/pink/objects/handlers/handler_mgr.cpp b/engines/pink/objects/handlers/handler_mgr.cpp
index db53c6a..a8a8846 100644
--- a/engines/pink/objects/handlers/handler_mgr.cpp
+++ b/engines/pink/objects/handlers/handler_mgr.cpp
@@ -90,4 +90,16 @@ Handler *HandlerMgr::findSuitableHandlerUseClick(Actor *actor) {
return nullptr;
}
+HandlerMgr::~HandlerMgr() {
+ for (int i = 0; i < _leftClickHandlers.size(); ++i) {
+ delete _leftClickHandlers[i];
+ }
+ for (int j = 0; j < _useClickHandlers.size(); ++j) {
+ delete _useClickHandlers[j];
+ }
+ for (int k = 0; k < _timerHandlers.size(); ++k) {
+ delete _timerHandlers[k];
+ }
+}
+
}
diff --git a/engines/pink/objects/handlers/handler_mgr.h b/engines/pink/objects/handlers/handler_mgr.h
index 7ff498e..aa1d334 100644
--- a/engines/pink/objects/handlers/handler_mgr.h
+++ b/engines/pink/objects/handlers/handler_mgr.h
@@ -40,6 +40,7 @@ class Actor;
class HandlerMgr : public Object {
public:
+ virtual ~HandlerMgr();
virtual void deserialize(Archive &archive);
virtual void toConsole();
diff --git a/engines/pink/objects/module.cpp b/engines/pink/objects/module.cpp
index dc9a06e..621cd8c 100644
--- a/engines/pink/objects/module.cpp
+++ b/engines/pink/objects/module.cpp
@@ -36,6 +36,12 @@ Module::Module(PinkEngine *game, const Common::String &name)
: NamedObject(name), _game(game), _page(nullptr)
{}
+Module::~Module() {
+ for (int i = 0; i < _pages.size(); ++i) {
+ delete _pages[i];
+ }
+}
+
void Module::load(Archive &archive){
archive.mapObject(this);
NamedObject::deserialize(archive);
@@ -63,7 +69,7 @@ void Module::changePage(const Common::String &pageName) {
page = findPage(pageName);
assert(_page != page);
- //_page->clear
+ _page->clear();
_page = page;
@@ -95,12 +101,6 @@ InventoryMgr *Module::getInventoryMgr() {
return &_invMgr;
}
-Module::~Module() {
- for (int i = 0; i < _pages.size(); ++i) {
- delete _pages[i];
- }
-}
-
} // End of namespace Pink
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index c878180..d12c034 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -30,6 +30,24 @@
namespace Pink {
+GamePage::GamePage()
+ : _cursorMgr(nullptr), _walkMgr(nullptr), _sequencer(nullptr),
+ _perhapsIsLoaded(false), _memFile(nullptr)
+{}
+
+GamePage::~GamePage() {
+ clear();
+}
+
+void GamePage::toConsole() {
+ Page::toConsole();
+ _walkMgr->toConsole();
+ _sequencer->toConsole();
+ for (int i = 0; i < _handlers.size(); ++i) {
+ _handlers[i]->toConsole();
+ }
+}
+
void GamePage::deserialize(Archive &archive) {
Page::deserialize(archive);
_module = static_cast<Module*>(archive.readObject());
@@ -52,10 +70,9 @@ void GamePage::load(Archive &archive) {
}
void GamePage::init(bool isLoadingSave) {
- if (!isLoadingSave){
- //assert(perhapsIsLoaded == 0);
+ if (!_perhapsIsLoaded)
loadManagers();
- }
+
getGame()->getDirector()->clear();
toConsole();
@@ -91,15 +108,18 @@ bool GamePage::initHandler() {
}
void GamePage::loadManagers() {
- perhapsIsLoaded = true;
+ _perhapsIsLoaded = true;
_cursorMgr = new CursorMgr(_module->getGame(), this);
_walkMgr = new WalkMgr;
_sequencer = new Sequencer(this);
_resMgr.init(_module->getGame(), this);
- // memfile manipulations if from save or page changing
-
+ if (_memFile != nullptr) {
+ loadState();
+ delete _memFile;
+ _memFile = nullptr;
+ }
}
PinkEngine *GamePage::getGame() {
@@ -128,28 +148,49 @@ WalkMgr *GamePage::getWalkMgr() {
return _walkMgr;
}
-void GamePage::toConsole() {
- Page::toConsole();
- _walkMgr->toConsole();
- _sequencer->toConsole();
- for (int i = 0; i < _handlers.size(); ++i) {
- _handlers[i]->toConsole();
+void GamePage::loadState() {
+ Archive archive(static_cast<Common::SeekableReadStream*>(_memFile));
+ archive >> _variables;
+
+ uint16 actorCount;
+ archive >> actorCount;
+
+ Common::String actorName;
+ for (int i = 0; i < actorCount; ++i) {
+ actorName = archive.readString();
+ findActor(actorName)->loadState(archive);
}
}
-GamePage::~GamePage() {
- delete _cursorMgr;
- delete _walkMgr;
- delete _sequencer;
- for (int i = 0; i < _handlers.size(); ++i) {
- delete _handlers[i];
+void GamePage::saveState() {
+ _memFile = new Common::MemoryReadWriteStream(DisposeAfterUse::YES);
+ Archive archive(static_cast<Common::WriteStream*>(_memFile));
+ archive << _variables;
+
+ archive.writeWORD(_actors.size());
+ for (int i = 0; i < _actors.size(); ++i) {
+ archive.writeString(_actors[i]->getName());
+ _actors[i]->saveState(archive);
}
}
-GamePage::GamePage()
- : _cursorMgr(nullptr), _walkMgr(nullptr), _sequencer(nullptr)
-{
+void GamePage::unload() {
+ _leadActor->setAction(_leadActor->findAction("Idle"));
+ saveState();
+ clear();
+}
+void GamePage::clear() {
+ Page::clear();
+ _variables.clear(1);
+ for (int i = 0; i < _handlers.size(); ++i) {
+ delete _handlers[i];
+ }
+ _handlers.clear();
+ delete _cursorMgr;
+ delete _sequencer;
+ delete _walkMgr;
}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/pages/game_page.h b/engines/pink/objects/pages/game_page.h
index 705fb32..79a4bee 100644
--- a/engines/pink/objects/pages/game_page.h
+++ b/engines/pink/objects/pages/game_page.h
@@ -23,6 +23,7 @@
#ifndef PINK_GAME_PAGE_H
#define PINK_GAME_PAGE_H
+#include <common/memstream.h>
#include "page.h"
namespace Pink {
@@ -36,12 +37,12 @@ class GamePage : public Page {
public:
GamePage();
~GamePage();
+ virtual void toConsole();
virtual void deserialize(Archive &archive);
virtual void load(Archive &archive);
-
+ void unload();
void loadManagers();
-
void init(bool isLoadingSave);
PinkEngine *getGame();
@@ -52,25 +53,21 @@ public:
bool checkValueOfVariable(Common::String &variable, Common::String &value);
void setVariable(Common::String &variable, Common::String &value);
- virtual void toConsole();
+ virtual void clear();
private:
bool initHandler();
+ void loadState();
+ void saveState();
-
- int perhapsIsLoaded;
+ bool _perhapsIsLoaded;
+ Common::MemoryReadWriteStream *_memFile;
Module *_module;
CursorMgr *_cursorMgr;
WalkMgr *_walkMgr;
Sequencer *_sequencer;
Common::Array<HandlerStartPage*> _handlers;
Common::StringMap _variables;
-
- /*
- int cunk_1;
- int memfile;
- int unk;
- */
};
}
diff --git a/engines/pink/objects/pages/page.cpp b/engines/pink/objects/pages/page.cpp
index 471cf87..e068367 100644
--- a/engines/pink/objects/pages/page.cpp
+++ b/engines/pink/objects/pages/page.cpp
@@ -22,10 +22,15 @@
#include "page.h"
#include "engines/pink/objects/actors/lead_actor.h"
+#include "engines/pink/director.h"
namespace Pink {
+Page::~Page() {
+ clear();
+}
+
void Page::load(Archive &archive) {
archive.mapObject(this);
NamedObject::deserialize(archive);
@@ -65,14 +70,18 @@ void Page::init() {
}
}
-Page::~Page() {
+LeadActor *Page::getLeadActor() {
+ return _leadActor;
+}
+
+void Page::clear() {
for (int i = 0; i < _actors.size(); ++i) {
delete _actors[i];
}
+ _actors.clear();
+ _resMgr.clear();
}
-LeadActor *Page::getLeadActor() {
- return _leadActor;
-}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/pages/page.h b/engines/pink/objects/pages/page.h
index 7eb1a33..b9820fe 100644
--- a/engines/pink/objects/pages/page.h
+++ b/engines/pink/objects/pages/page.h
@@ -37,25 +37,23 @@ class LeadActor;
class Page : public NamedObject {
public:
~Page();
+ virtual void toConsole();
+
void load(Archive &archive);
Actor *findActor(Common::String &name);
+ LeadActor *getLeadActor();
+
Sound *loadSound(Common::String &fileName);
CelDecoder *loadCel(Common::String &fileName);
- virtual void toConsole();
-
- LeadActor *getLeadActor();
+ virtual void clear();
protected:
void init();
+
Common::Array<Actor*> _actors;
ResourceMgr _resMgr;
LeadActor *_leadActor;
-
- /*
- int unk_1;
- CString _str;
- */
};
} // End of namespace Pink
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index 32de7c9..7f993dc 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -79,11 +79,11 @@ public:
void setNextExecutors(const Common::String &nextModule, const Common::String &nextPage);
void setLeadActor(LeadActor *actor) { _actor = actor; };
+ void setCursor(uint cursorIndex);
void setVariable(Common::String &variable, Common::String &value);
bool checkValueOfVariable(Common::String &variable, Common::String &value);
- inline void setCursor(uint cursorIndex);
private:
Common::Error init();
bool loadCursors();
diff --git a/engines/pink/resource_mgr.cpp b/engines/pink/resource_mgr.cpp
index c91101e..8695191 100644
--- a/engines/pink/resource_mgr.cpp
+++ b/engines/pink/resource_mgr.cpp
@@ -37,7 +37,7 @@ ResourceMgr::ResourceMgr()
_resCount(0) {}
ResourceMgr::~ResourceMgr() {
- delete[] _resDescTable;
+ clear();
}
void ResourceMgr::init(PinkEngine *game, GamePage *page) {
@@ -84,4 +84,9 @@ CelDecoder *ResourceMgr::loadCEL(Common::String &name) {
return decoder;
}
+void ResourceMgr::clear() {
+ delete[] _resDescTable;
+ _resDescTable = nullptr;
+}
+
} // End of namespace Pink
diff --git a/engines/pink/resource_mgr.h b/engines/pink/resource_mgr.h
index cc52ee8..ff451aa 100644
--- a/engines/pink/resource_mgr.h
+++ b/engines/pink/resource_mgr.h
@@ -47,6 +47,7 @@ public:
~ResourceMgr();
void init(PinkEngine *game, GamePage *page);
+ void clear();
//Common::String loadText(Common::String &name);
Sound *loadSound(Common::String &name);
Commit: dac8d2a72b427cdecedfe4a951aa6166ce7b3720
https://github.com/scummvm/scummvm/commit/dac8d2a72b427cdecedfe4a951aa6166ce7b3720
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: bugfixes and added basic inventory implementation
Changed paths:
engines/pink/archive.h
engines/pink/director.cpp
engines/pink/objects/actions/action.h
engines/pink/objects/actions/action_cel.cpp
engines/pink/objects/actions/action_cel.h
engines/pink/objects/actions/action_play_with_sfx.cpp
engines/pink/objects/actions/action_sound.cpp
engines/pink/objects/actions/action_sound.h
engines/pink/objects/actions/action_talk.cpp
engines/pink/objects/actions/action_talk.h
engines/pink/objects/actors/actor.cpp
engines/pink/objects/actors/actor.h
engines/pink/objects/actors/inventory_actor.h
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/actors/lead_actor.h
engines/pink/objects/inventory.cpp
engines/pink/objects/inventory.h
engines/pink/objects/module.cpp
engines/pink/objects/pages/game_page.cpp
engines/pink/objects/pages/game_page.h
engines/pink/objects/pages/page.cpp
engines/pink/objects/pages/page.h
engines/pink/objects/sequences/sequencer.h
engines/pink/objects/side_effect.cpp
engines/pink/objects/walk/walk_location.h
diff --git a/engines/pink/archive.h b/engines/pink/archive.h
index 45554b8..b74b0f5 100644
--- a/engines/pink/archive.h
+++ b/engines/pink/archive.h
@@ -108,8 +108,12 @@ inline Archive &operator>>(Archive &archive, Common::StringArray &array){
}
inline Archive &operator>>(Archive &archive, Common::StringMap &map){
- archive.readCount();
- map.setVal(archive.readString(), archive.readString());
+ uint size = archive.readCount();
+ for (int i = 0; i < size; ++i) {
+ Common::String key = archive.readString();
+ Common::String val = archive.readString();
+ map.setVal(key, val);
+ }
return archive;
}
@@ -142,7 +146,6 @@ inline Archive &operator<<(Archive &archive, Common::StringMap &map){
archive.writeString(pair._key);
archive.writeString(pair._value);
}
- map.setVal(archive.readString(), archive.readString());
return archive;
}
diff --git a/engines/pink/director.cpp b/engines/pink/director.cpp
index 25ffa5a..4003ca5 100644
--- a/engines/pink/director.cpp
+++ b/engines/pink/director.cpp
@@ -32,7 +32,7 @@ Director::Director(OSystem *system)
: _system(system), showBounds(0) {}
void Director::draw() {
- //dd_system->fillScreen(0);
+ _system->fillScreen(0);
for (int i = 0; i < _sprites.size(); ++i) {
drawSprite(_sprites[i]);
}
diff --git a/engines/pink/objects/actions/action.h b/engines/pink/objects/actions/action.h
index 72e9b8f..ae3b083 100644
--- a/engines/pink/objects/actions/action.h
+++ b/engines/pink/objects/actions/action.h
@@ -42,6 +42,9 @@ public:
Actor *getActor() { return _actor;}
+ virtual void pause() {};
+ virtual void unpause() {};
+
protected:
Actor *_actor;
};
diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp
index e9e5247..33e8823 100644
--- a/engines/pink/objects/actions/action_cel.cpp
+++ b/engines/pink/objects/actions/action_cel.cpp
@@ -80,7 +80,15 @@ void ActionCEL::update() {
}
ActionCEL::~ActionCEL() {
- delete _decoder;
+ end();
+}
+
+void ActionCEL::pause() {
+ _decoder->pauseVideo(1);
+}
+
+void ActionCEL::unpause() {
+ _decoder->pauseVideo(0);
}
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/actions/action_cel.h b/engines/pink/objects/actions/action_cel.h
index 2ae5308..a86eadc 100644
--- a/engines/pink/objects/actions/action_cel.h
+++ b/engines/pink/objects/actions/action_cel.h
@@ -45,6 +45,10 @@ public:
virtual bool initPalette(Director *director);
+ void pause() override;
+
+ void unpause() override;
+
protected:
virtual void onStart() {} ;
CelDecoder *_decoder;
diff --git a/engines/pink/objects/actions/action_play_with_sfx.cpp b/engines/pink/objects/actions/action_play_with_sfx.cpp
index fc4d48c..9ead26b 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.cpp
+++ b/engines/pink/objects/actions/action_play_with_sfx.cpp
@@ -48,6 +48,7 @@ void ActionPlayWithSfx::update() {
_decoder->stop();
_actor->endAction();
}
+
updateSound();
}
@@ -60,6 +61,9 @@ void ActionPlayWithSfx::onStart() {
}
void ActionPlayWithSfx::updateSound() {
+ if (!_actor->isPlaying() && !_isLoop)
+ return;
+
for (int i = 0; i < _sfxArray.size(); ++i) {
if (_sfxArray[i]->getFrame() == _decoder->getCurFrame()) {
_sfxArray[i]->play(_actor->getPage());
@@ -68,6 +72,7 @@ void ActionPlayWithSfx::updateSound() {
}
ActionPlayWithSfx::~ActionPlayWithSfx() {
+ ActionPlay::end();
for (int i = 0; i < _sfxArray.size(); ++i) {
delete _sfxArray[i];
}
diff --git a/engines/pink/objects/actions/action_sound.cpp b/engines/pink/objects/actions/action_sound.cpp
index f1829a1..f4acb50 100644
--- a/engines/pink/objects/actions/action_sound.cpp
+++ b/engines/pink/objects/actions/action_sound.cpp
@@ -88,4 +88,14 @@ void ActionSound::update() {
_actor->endAction();
}
+void ActionSound::pause() {
+ if (_sound)
+ _sound->pause();
+}
+
+void ActionSound::unpause() {
+ if (_sound)
+ _sound->resume();
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/actions/action_sound.h b/engines/pink/objects/actions/action_sound.h
index b13481c..e96c41d 100644
--- a/engines/pink/objects/actions/action_sound.h
+++ b/engines/pink/objects/actions/action_sound.h
@@ -42,6 +42,9 @@ public:
virtual void end();
virtual void update();
+ void pause() override;
+ void unpause() override;
+
private:
Sound *_sound;
Common::String _fileName;
diff --git a/engines/pink/objects/actions/action_talk.cpp b/engines/pink/objects/actions/action_talk.cpp
index b974300..30412ee 100644
--- a/engines/pink/objects/actions/action_talk.cpp
+++ b/engines/pink/objects/actions/action_talk.cpp
@@ -54,6 +54,19 @@ void ActionTalk::update() {
void ActionTalk::end() {
ActionPlay::end();
delete _sound;
+ _sound = nullptr;
+}
+
+void ActionTalk::pause() {
+ ActionCEL::pause();
+ if (_sound)
+ _sound->pause();
+}
+
+void ActionTalk::unpause() {
+ ActionCEL::unpause();
+ if (_sound)
+ _sound->resume();
}
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/actions/action_talk.h b/engines/pink/objects/actions/action_talk.h
index 9b6d26f..bbe16eb 100644
--- a/engines/pink/objects/actions/action_talk.h
+++ b/engines/pink/objects/actions/action_talk.h
@@ -37,6 +37,9 @@ public:
virtual void end();
+ void pause() override;
+ void unpause() override;
+
protected:
virtual void onStart();
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index 6a20a46..a7717d3 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -130,9 +130,7 @@ void Actor::onMouseOver(Common::Point point, CursorMgr *mgr) {
Actor::~Actor() {
for (int i = 0; i < _actions.size(); ++i) {
- _actions[i]->toConsole();
delete _actions[i];
- _actions[i] = nullptr;
}
}
@@ -143,8 +141,22 @@ void Actor::loadState(Archive &archive) {
}
void Actor::saveState(Archive &archive) {
- assert(_action);
- archive.writeString(_action->getName());
+ Common::String actionName;
+
+ if (_action)
+ actionName = _action->getName();
+
+ archive.writeString(actionName);
+}
+
+void Actor::pause() {
+ if (_action)
+ _action->pause();
+}
+
+void Actor::unpause() {
+ if (_action)
+ _action->unpause();
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/actor.h b/engines/pink/objects/actors/actor.h
index 69cf37b..0761b8f 100644
--- a/engines/pink/objects/actors/actor.h
+++ b/engines/pink/objects/actors/actor.h
@@ -70,6 +70,10 @@ public:
virtual void onMouseOver(Common::Point point, CursorMgr *mgr);
virtual bool isClickable() { return 0;}
+
+ virtual void pause();
+ virtual void unpause();
+
protected:
GamePage *_page;
Action *_action;
diff --git a/engines/pink/objects/actors/inventory_actor.h b/engines/pink/objects/actors/inventory_actor.h
index 4b2b424..55dd83b 100644
--- a/engines/pink/objects/actors/inventory_actor.h
+++ b/engines/pink/objects/actors/inventory_actor.h
@@ -37,6 +37,8 @@ public:
_actions[i]->toConsole();
}
}
+
+ void pause() {}
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index d89ecb4..2a0f84d 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -88,6 +88,8 @@ void LeadActor::update() {
break;
case kInventory:
+ getPage()->getModule()->getInventoryMgr()->update();
+ break;
case kPDA:
break;
@@ -184,25 +186,34 @@ void LeadActor::onLeftButtonClick(Common::Point point) {
case kMoving: {
Actor *actor = _page->getGame()->getDirector()->getActorByPoint(point);
- if (this == actor){
- // inventory is not implemented
+ if (this == actor) {
+ onClick();
return;
}
_recipient = (SupportingActor*) actor;
if (actor->isClickable() &&
- _recipient->isLeftClickHandlers()){
- _state = kMoving;
- _nextState = kInDialog1;
- _walkMgr->start(_walkMgr->findLocation(_recipient->getLocation()));
+ _recipient->isLeftClickHandlers()) {
+ WalkLocation *location = _walkMgr->findLocation(_recipient->getLocation());
+ if (location) {
+ _state = kMoving;
+ _nextState = kInDialog1;
+ _walkMgr->start(location);
+ }
+ else if (_state == kReady){
+ if (_isHaveItem)
+ sendUseClickMessage(_recipient);
+ else sendLeftClickMessage(_recipient);
+ }
}
- break;
+
+ break;
}
case kPDA:
break;
case kInventory:
-
+ _page->getModule()->getInventoryMgr()->onClick(point);
break;
default:
break;
@@ -220,8 +231,9 @@ void LeadActor::onWalkEnd() {
_state = kReady;
_nextState = kUnk_Loading;
if (_recipient && oldNextState == kInDialog1){
- // if use click not impl
- sendLeftClickMessage(_recipient);
+ if (_isHaveItem)
+ sendUseClickMessage(_recipient);
+ else sendLeftClickMessage(_recipient);
}
}
@@ -238,7 +250,7 @@ bool LeadActor::sendLeftClickMessage(SupportingActor *actor) {
void LeadActor::onClick() {
if (_isHaveItem) {
_isHaveItem = false;
- _nextState = _state != kMoving ?
+ _nextState = (_state != kMoving) ?
kUnk_Loading : kReady;
}
else {
@@ -246,10 +258,28 @@ void LeadActor::onClick() {
_recipient = nullptr;
_nextState = kReady;
}
-
+ if (_page->getModule()->getInventoryMgr()->start(1)){
+ _stateCopy = _state;
+ _state = kInventory;
+ _page->pause();
+ }
}
}
+LeadActor::LeadActor()
+ : _state(kReady), _nextState(kReady),
+ _isHaveItem(false), _recipient(nullptr),
+ _cursorMgr(nullptr), _walkMgr(nullptr),
+ _sequencer(nullptr)
+{}
+
+void LeadActor::onInventoryClosed(bool isItemClicked) {
+ _isHaveItem = isItemClicked;
+ _state = _stateCopy;
+ _stateCopy = kUnk_Loading;
+ _page->unpause();
+}
+
void ParlSqPink::toConsole() {
debug("ParlSqPink: _name = %s", _name.c_str());
for (int i = 0; i < _actions.size(); ++i) {
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index a2c2ede..45e27f9 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -35,9 +35,11 @@ class WalkMgr;
class Sequencer;
class SupportingActor;
+class InventoryItem;
class LeadActor : public Actor {
public:
+ LeadActor();
enum State {
kReady = 0,
kMoving = 1,
@@ -67,6 +69,7 @@ public:
void onMouseMove(Common::Point point);
void onWalkEnd();
void onClick();
+ void onInventoryClosed(bool isItemClicked);
virtual void onMouseOver(Common::Point point, CursorMgr *mgr);
@@ -78,6 +81,7 @@ private:
State _state;
State _nextState;
+ State _stateCopy;
bool _isHaveItem;
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
index 9bbc279..2c4aa59 100644
--- a/engines/pink/objects/inventory.cpp
+++ b/engines/pink/objects/inventory.cpp
@@ -25,11 +25,15 @@
#include "inventory.h"
#include "engines/pink/archive.h"
#include "pink/objects/actors/lead_actor.h"
+#include "pink/objects/actions/action.h"
+#include "pink/objects/pages/game_page.h"
+#include "pink/director.h"
+#include "pink/pink.h"
namespace Pink {
InventoryMgr::InventoryMgr()
- : _lead(nullptr), _item(nullptr)
+ : _lead(nullptr), _item(nullptr), _isClickedOnItem(false)
{
}
@@ -57,11 +61,12 @@ void InventoryMgr::deserialize(Archive &archive) {
archive >> _items;
}
-InventoryItem *InventoryMgr::findInventoryItem(Common::String &name) {
- return *Common::find_if(_items.begin(), _items.end(), [&name]
+InventoryItem *InventoryMgr::findInventoryItem(const Common::String &name) {
+ auto it = Common::find_if(_items.begin(), _items.end(), [&name]
(InventoryItem *item) {
return name == item->getName();
});;
+ return it != _items.end() ? *it : nullptr;
}
void InventoryMgr::setLeadActor(LeadActor *lead) {
@@ -101,6 +106,86 @@ void InventoryMgr::setItemOwner(const Common::String &owner, InventoryItem *item
item->_currentOwner = owner;
}
+bool InventoryMgr::start(bool playOpening) {
+ if (!_item) {
+ _item = findInventoryItem(_lead->getName());
+ if (!_item)
+ return false;
+ }
+
+ _window = _lead->getPage()->findActor("InventoryWindow");
+ _itemActor = _lead->getPage()->findActor("InventoryItem");
+ _rightArrow = _lead->getPage()->findActor("InventoryRightArrow");
+ _leftArrow = _lead->getPage()->findActor("InventoryLeftArrow");
+
+ if (playOpening){
+ _window->setAction("Open");
+ _state = kOpening;
+ }
+
+ return true;
+}
+
+void InventoryMgr::update() {
+ if (_state == kOpening && !_window->isPlaying()){
+ _state = kReady;
+ _itemActor->setAction(_item->getName());
+ _window->setAction("Show");
+ _leftArrow->setAction("Show");
+ _rightArrow->setAction("Show");
+ }
+ else if (_state == kClosing && !_window->isPlaying()){
+ _window->setAction("Idle");
+
+ _lead->onInventoryClosed(_isClickedOnItem);
+
+ _state = kIdle;
+ _window = nullptr;
+ _itemActor = nullptr;
+ _isClickedOnItem = false;
+ }
+}
+
+void InventoryMgr::onClick(Common::Point point) {
+ Actor *actor = _lead->getPage()->getGame()->getDirector()->getActorByPoint(point);
+ if (actor == _itemActor || actor == _window) {
+ _isClickedOnItem = true;
+ close();
+ }
+ else if (actor == _leftArrow) {
+ showNextItem(kLeft);
+ }
+ else if (actor == _rightArrow) {
+ showNextItem(kRight);
+ }
+ else close();
+}
+
+void InventoryMgr::close() {
+ _state = kClosing;
+
+ _window->setAction("Close");
+ _itemActor->setAction("Idle");
+ _leftArrow->setAction("Idle");
+ _rightArrow->setAction("Idle");
+}
+
+void InventoryMgr::showNextItem(bool direction) {
+ int index = 0;
+ for (int i = 0; i < _items.size(); ++i) {
+ if (_item == _items[i]) {
+ index = i + _items.size();
+ break;
+ }
+ }
+ index = (direction == kLeft) ? --index : ++index;
+ index %= _items.size();
+
+ //add check for item owner
+ _itemActor->setAction(_items[index]->getName());
+ _item = _items[index];
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/inventory.h b/engines/pink/objects/inventory.h
index 908f2a8..db67f4e 100644
--- a/engines/pink/objects/inventory.h
+++ b/engines/pink/objects/inventory.h
@@ -25,6 +25,7 @@
#include <common/array.h>
+#include <common/rect.h>
#include "engines/pink/objects/object.h"
namespace Pink {
@@ -45,26 +46,51 @@ private:
};
class LeadActor;
+class Actor;
class InventoryMgr : public Object {
public:
InventoryMgr();
virtual ~InventoryMgr();
virtual void deserialize(Archive &archive);
-
virtual void toConsole();
+ void update();
+ void onClick(Common::Point point);
+
+ bool start(bool playOpening);
+
void setLeadActor(LeadActor *lead);
- InventoryItem* findInventoryItem(Common::String &name);
+ InventoryItem* findInventoryItem(const Common::String &name);
bool isPinkOwnsAnyItems();
void setItemOwner(const Common::String &owner, InventoryItem *item);
private:
- LeadActor *_lead;
+ void close();
+ enum Direction {
+ kLeft = 0,
+ kRight = 1,
+ };
+ void showNextItem(bool direction);
+
+
InventoryItem *_item;
Common::Array<InventoryItem*> _items;
- // other fields. haven't RE them yet
+
+ LeadActor *_lead;
+ Actor *_window;
+ Actor *_itemActor;
+ Actor *_rightArrow;
+ Actor *_leftArrow;
+
+ enum State {
+ kIdle = 0,
+ kOpening = 1,
+ kReady = 2,
+ kClosing = 3,
+ } _state;
+ bool _isClickedOnItem;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/module.cpp b/engines/pink/objects/module.cpp
index 621cd8c..d35f794 100644
--- a/engines/pink/objects/module.cpp
+++ b/engines/pink/objects/module.cpp
@@ -69,8 +69,7 @@ void Module::changePage(const Common::String &pageName) {
page = findPage(pageName);
assert(_page != page);
- _page->clear();
-
+ _page->unload();
_page = page;
_page->init(kLoadingNewGame);
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index d12c034..e38bed8 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -32,7 +32,7 @@ namespace Pink {
GamePage::GamePage()
: _cursorMgr(nullptr), _walkMgr(nullptr), _sequencer(nullptr),
- _perhapsIsLoaded(false), _memFile(nullptr)
+ _isLoaded(false), _memFile(nullptr)
{}
GamePage::~GamePage() {
@@ -64,17 +64,14 @@ void GamePage::load(Archive &archive) {
_leadActor = static_cast<LeadActor*>(archive.readObject());
_walkMgr->deserialize(archive);
-
_sequencer->deserialize(archive);
archive >> _handlers;
}
void GamePage::init(bool isLoadingSave) {
- if (!_perhapsIsLoaded)
+ if (!_isLoaded)
loadManagers();
- getGame()->getDirector()->clear();
-
toConsole();
for (int j = 0; j < _actors.size(); ++j) {
@@ -108,7 +105,7 @@ bool GamePage::initHandler() {
}
void GamePage::loadManagers() {
- _perhapsIsLoaded = true;
+ _isLoaded = true;
_cursorMgr = new CursorMgr(_module->getGame(), this);
_walkMgr = new WalkMgr;
_sequencer = new Sequencer(this);
@@ -150,6 +147,7 @@ WalkMgr *GamePage::getWalkMgr() {
void GamePage::loadState() {
Archive archive(static_cast<Common::SeekableReadStream*>(_memFile));
+ _variables.clear(0);
archive >> _variables;
uint16 actorCount;
@@ -165,6 +163,7 @@ void GamePage::loadState() {
void GamePage::saveState() {
_memFile = new Common::MemoryReadWriteStream(DisposeAfterUse::YES);
Archive archive(static_cast<Common::WriteStream*>(_memFile));
+
archive << _variables;
archive.writeWORD(_actors.size());
@@ -172,12 +171,14 @@ void GamePage::saveState() {
archive.writeString(_actors[i]->getName());
_actors[i]->saveState(archive);
}
+
}
void GamePage::unload() {
_leadActor->setAction(_leadActor->findAction("Idle"));
saveState();
clear();
+ _isLoaded = false;
}
void GamePage::clear() {
@@ -187,9 +188,9 @@ void GamePage::clear() {
delete _handlers[i];
}
_handlers.clear();
- delete _cursorMgr;
- delete _sequencer;
- delete _walkMgr;
+ delete _cursorMgr; _cursorMgr = nullptr;
+ delete _sequencer; _sequencer = nullptr;
+ delete _walkMgr; _walkMgr = nullptr;
}
diff --git a/engines/pink/objects/pages/game_page.h b/engines/pink/objects/pages/game_page.h
index 79a4bee..c4f6dfb 100644
--- a/engines/pink/objects/pages/game_page.h
+++ b/engines/pink/objects/pages/game_page.h
@@ -60,7 +60,7 @@ private:
void loadState();
void saveState();
- bool _perhapsIsLoaded;
+ bool _isLoaded;
Common::MemoryReadWriteStream *_memFile;
Module *_module;
CursorMgr *_cursorMgr;
diff --git a/engines/pink/objects/pages/page.cpp b/engines/pink/objects/pages/page.cpp
index e068367..1c0c67e 100644
--- a/engines/pink/objects/pages/page.cpp
+++ b/engines/pink/objects/pages/page.cpp
@@ -38,7 +38,7 @@ void Page::load(Archive &archive) {
archive >> _actors;
}
-Actor *Page::findActor(Common::String &name) {
+Actor *Page::findActor(const Common::String &name) {
return *Common::find_if(_actors.begin(), _actors.end(), [&name]
(Actor *actor) {
return name == actor->getName();
@@ -82,6 +82,17 @@ void Page::clear() {
_resMgr.clear();
}
+void Page::pause() {
+ for (int i = 0; i < _actors.size(); ++i) {
+ _actors[i]->pause();
+ }
+}
+
+void Page::unpause() {
+ for (int i = 0; i < _actors.size(); ++i) {
+ _actors[i]->unpause();
+ }
+}
} // End of namespace Pink
diff --git a/engines/pink/objects/pages/page.h b/engines/pink/objects/pages/page.h
index b9820fe..23b060c 100644
--- a/engines/pink/objects/pages/page.h
+++ b/engines/pink/objects/pages/page.h
@@ -40,13 +40,15 @@ public:
virtual void toConsole();
void load(Archive &archive);
- Actor *findActor(Common::String &name);
+ Actor *findActor(const Common::String &name);
LeadActor *getLeadActor();
Sound *loadSound(Common::String &fileName);
CelDecoder *loadCel(Common::String &fileName);
virtual void clear();
+ void pause();
+ void unpause();
protected:
void init();
diff --git a/engines/pink/objects/sequences/sequencer.h b/engines/pink/objects/sequences/sequencer.h
index 1ae4689..6ae5550 100644
--- a/engines/pink/objects/sequences/sequencer.h
+++ b/engines/pink/objects/sequences/sequencer.h
@@ -56,6 +56,7 @@ public:
void restartSequence();
void skipToLastSubSequence();
+
public:
void updateTimers();
diff --git a/engines/pink/objects/side_effect.cpp b/engines/pink/objects/side_effect.cpp
index 1790917..548a29f 100644
--- a/engines/pink/objects/side_effect.cpp
+++ b/engines/pink/objects/side_effect.cpp
@@ -66,7 +66,7 @@ void SideEffectInventoryItemOwner::deserialize(Archive &archive) {
void SideEffectInventoryItemOwner::execute(Actor *actor) {
InventoryMgr *mgr = actor->getPage()->getModule()->getInventoryMgr();
InventoryItem *item = mgr->findInventoryItem(_item);
- mgr->setItemOwner(_item, item);
+ mgr->setItemOwner(_owner, item);
}
void SideEffectInventoryItemOwner::toConsole() {
diff --git a/engines/pink/objects/walk/walk_location.h b/engines/pink/objects/walk/walk_location.h
index b9515cd..19674a1 100644
--- a/engines/pink/objects/walk/walk_location.h
+++ b/engines/pink/objects/walk/walk_location.h
@@ -32,9 +32,9 @@ namespace Pink {
class WalkLocation : public NamedObject {
public:
virtual void deserialize(Archive &archive);
-
void toConsole() override;
Common::StringArray &getNeigbors() { return _neighbors;}
+
private:
Common::StringArray _neighbors;
};
Commit: 8c5bfed75678dd8b083c1cc024bbd80f1facb13c
https://github.com/scummvm/scummvm/commit/8c5bfed75678dd8b083c1cc024bbd80f1facb13c
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: created constants for magic numbers, improved code in file
Changed paths:
engines/pink/constants.h
engines/pink/file.cpp
engines/pink/file.h
diff --git a/engines/pink/constants.h b/engines/pink/constants.h
index db9c60a..da572d1 100644
--- a/engines/pink/constants.h
+++ b/engines/pink/constants.h
@@ -131,6 +131,16 @@ enum {
kLoadingNewGame = 0
};
+enum {
+ kOrbMajorVersion = 2,
+ kOrbMinorVersion = 0,
+ kBroMajorVersion = 1,
+ kBroMinorVersion = 0,
+};
+
+
+const char *kPinkGame = "PinkGame";
+
} // End of namespace Pink
#endif
diff --git a/engines/pink/file.cpp b/engines/pink/file.cpp
index 4729032..4f2867b 100644
--- a/engines/pink/file.cpp
+++ b/engines/pink/file.cpp
@@ -41,7 +41,6 @@ bool OrbFile::open(const Common::String &name) {
return false;
if (readUint32BE() != 'ORB\0'){
- close();
return false;
}
@@ -50,7 +49,7 @@ bool OrbFile::open(const Common::String &name) {
debug("Orb v%hu.%hu loaded", major, minor);
- if (minor || major != 2){
+ if (major != kOrbMajorVersion || minor != kOrbMinorVersion){
return false;
}
@@ -73,7 +72,7 @@ bool OrbFile::open(const Common::String &name) {
}
void OrbFile::loadGame(PinkEngine *game) {
- seekToObject("PinkGame");
+ seekToObject(kPinkGame);
Archive archive(this);
archive.mapObject(reinterpret_cast<Object*>(game)); // hack
game->load(archive);
@@ -91,7 +90,6 @@ void OrbFile::loadObject(Object *obj, ObjectDescription *objDesc) {
obj->load(archive);
}
-
uint32 OrbFile::getTimestamp() {
return _timestamp;
}
@@ -110,11 +108,10 @@ ObjectDescription *OrbFile::getObjDesc(const char *name){
}
ResourceDescription *OrbFile::getResDescTable(ObjectDescription *objDesc){
- const uint32 size = objDesc->resourcesCount;
+ ResourceDescription *table = new ResourceDescription[objDesc->resourcesCount];
seek(objDesc->resourcesOffset);
- ResourceDescription *table = new ResourceDescription[size];
- for (size_t i = 0; i < size; ++i) {
+ for (size_t i = 0; i < objDesc->resourcesCount; ++i) {
table[i].load(*this);
}
@@ -122,7 +119,7 @@ ResourceDescription *OrbFile::getResDescTable(ObjectDescription *objDesc){
}
-bool BroFile::open(Common::String &name, uint32 orbTimestamp) {
+bool BroFile::open(const Common::String &name, uint32 orbTimestamp) {
if (!File::open(name) || readUint32BE() != 'BRO\0')
return false;
@@ -131,31 +128,30 @@ bool BroFile::open(Common::String &name, uint32 orbTimestamp) {
debug("Bro v%hu.%hu loaded", major, minor);
- if (major != 1 || minor != 0){
+ if (major != kBroMajorVersion || minor != kBroMinorVersion){
return false;
}
- uint32 _timestamp = readUint32LE();
+ uint32 timestamp = readUint32LE();
- return _timestamp == orbTimestamp;
+ return timestamp == orbTimestamp;
}
void ObjectDescription::load(Common::File &file) {
file.read(name, sizeof(name));
- file.read(&objectsOffset, sizeof(objectsOffset));
- file.read(&objectsCount, sizeof(objectsCount));
- file.read(&resourcesOffset, sizeof(resourcesOffset));
- file.read(&resourcesCount, sizeof(resourcesCount));
+
+ objectsOffset = file.readUint32LE();
+ objectsCount = file.readUint32LE();
+ resourcesOffset = file.readUint32LE();
+ resourcesCount = file.readUint32LE();
}
void ResourceDescription::load(Common::File &file) {
file.read(name, sizeof(name));
- file.read(&offset, sizeof(offset));
- file.read(&size, sizeof(offset));
- uint16 temp;
- file.read(&temp, sizeof(temp));
- inBro = (bool) temp;
+ offset = file.readUint32LE();
+ size = file.readUint32LE();
+ inBro = (bool) file.readUint16LE();
}
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/file.h b/engines/pink/file.h
index c87fd79..0e78eeb 100644
--- a/engines/pink/file.h
+++ b/engines/pink/file.h
@@ -76,7 +76,7 @@ private:
class BroFile : public Common::File {
public:
- virtual bool open(Common::String &name, uint32 orbTimestamp);
+ virtual bool open(const Common::String &name, uint32 orbTimestamp);
};
} // End of namespace Pink
Commit: 2f43cbafa0da1266ab55e39b94a88af65c844ea0
https://github.com/scummvm/scummvm/commit/2f43cbafa0da1266ab55e39b94a88af65c844ea0
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: moved more values to constants section
Changed paths:
engines/pink/constants.h
engines/pink/objects/module.cpp
engines/pink/objects/pages/game_page.cpp
engines/pink/pink.cpp
diff --git a/engines/pink/constants.h b/engines/pink/constants.h
index da572d1..6d2b02a 100644
--- a/engines/pink/constants.h
+++ b/engines/pink/constants.h
@@ -138,8 +138,12 @@ enum {
kBroMinorVersion = 0,
};
+static const char *kPinkGame = "PinkGame";
-const char *kPinkGame = "PinkGame";
+static const char *kPokus = "pokus";
+static const char *kPeril = "peril";
+
+static const char *kUndefined = "UNDEFINED";
} // End of namespace Pink
diff --git a/engines/pink/objects/module.cpp b/engines/pink/objects/module.cpp
index d35f794..46ea8e1 100644
--- a/engines/pink/objects/module.cpp
+++ b/engines/pink/objects/module.cpp
@@ -88,7 +88,7 @@ PinkEngine *Module::getGame() const {
bool Module::checkValueOfVariable(Common::String &variable, Common::String &value) {
if (!_variables.contains(variable))
- return value == "UNDEFINED";
+ return value == kUndefined;
return _variables[variable] == value;
}
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index e38bed8..6b029fb 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -133,7 +133,7 @@ Module *GamePage::getModule() const {
bool GamePage::checkValueOfVariable(Common::String &variable, Common::String &value) {
if (!_variables.contains(variable))
- return value == "UNDEFINED";
+ return value == kUndefined;
return _variables[variable] == value;
}
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index 008f827..df23a48 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -68,10 +68,10 @@ Common::Error PinkEngine::init() {
_console = new Console(this);
- Common::String orbName{_desc.filesDescriptions[0].fileName};
- Common::String broName{_desc.filesDescriptions[1].fileName};
+ const Common::String orbName{_desc.filesDescriptions[0].fileName};
+ const Common::String broName{_desc.filesDescriptions[1].fileName};
- if (strcmp(_desc.gameId, "peril") == 0){
+ if (strcmp(_desc.gameId, kPeril) == 0){
_bro = new BroFile();
}
else debug("This game doesn't need to use bro");
@@ -87,8 +87,8 @@ Common::Error PinkEngine::init() {
_system->showMouse(1);
_orb.loadGame(this);
- const Common::String empty;
- initModule(_modules[0]->getName(), kLoadingNewGame, empty);
+
+ initModule(_modules[0]->getName(), kLoadingNewGame, "");
return Common::kNoError;
}
@@ -193,7 +193,7 @@ void PinkEngine::loadModule(int index) {
bool PinkEngine::checkValueOfVariable(Common::String &variable, Common::String &value) {
if (!_variables.contains(variable))
- return value == "UNDEFINED";
+ return value == kUndefined;
return _variables[variable] == value;
}
@@ -203,7 +203,7 @@ void PinkEngine::setVariable(Common::String &variable, Common::String &value) {
bool PinkEngine::loadCursors() {
Common::PEResources exeResources;
- bool isPokus = !strcmp(_desc.gameId, "pokus");
+ bool isPokus = !strcmp(_desc.gameId, kPokus);
Common::String fileName = isPokus ? _desc.filesDescriptions[1].fileName : _desc.filesDescriptions[2].fileName;
if (!exeResources.loadFromEXE(fileName))
return false;
Commit: ec96a3b1e7c888fa4b3a2957854942d7fed3e766
https://github.com/scummvm/scummvm/commit/ec96a3b1e7c888fa4b3a2957854942d7fed3e766
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added check for item owner
Changed paths:
engines/pink/objects/inventory.cpp
engines/pink/objects/pages/game_page.cpp
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
index 2c4aa59..1b5ac2b 100644
--- a/engines/pink/objects/inventory.cpp
+++ b/engines/pink/objects/inventory.cpp
@@ -178,12 +178,16 @@ void InventoryMgr::showNextItem(bool direction) {
break;
}
}
- index = (direction == kLeft) ? --index : ++index;
- index %= _items.size();
- //add check for item owner
- _itemActor->setAction(_items[index]->getName());
- _item = _items[index];
+ int i = 0;
+ do {
+ index = (direction == kLeft) ? --index : ++index;
+ } while(_items[index % _items.size()]->getCurrentOwner() != _item->getCurrentOwner() && ++i < _items.size());
+
+ if (i != _items.size()) {
+ _item = _items[index % _items.size()];
+ _itemActor->setAction(_item->getName());
+ }
}
} // End of namespace Pink
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index 6b029fb..47437a8 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -86,7 +86,7 @@ void GamePage::init(bool isLoadingSave) {
_actors[i]->init(startNow);
}
- bool isHandler = 0;
+ bool isHandler = false;
if (!isLoadingSave) {
isHandler = initHandler();
}
@@ -106,6 +106,7 @@ bool GamePage::initHandler() {
void GamePage::loadManagers() {
_isLoaded = true;
+
_cursorMgr = new CursorMgr(_module->getGame(), this);
_walkMgr = new WalkMgr;
_sequencer = new Sequencer(this);
@@ -114,6 +115,7 @@ void GamePage::loadManagers() {
if (_memFile != nullptr) {
loadState();
+
delete _memFile;
_memFile = nullptr;
}
@@ -176,18 +178,23 @@ void GamePage::saveState() {
void GamePage::unload() {
_leadActor->setAction(_leadActor->findAction("Idle"));
+
saveState();
clear();
+
_isLoaded = false;
}
void GamePage::clear() {
Page::clear();
_variables.clear(1);
+
for (int i = 0; i < _handlers.size(); ++i) {
delete _handlers[i];
}
+
_handlers.clear();
+
delete _cursorMgr; _cursorMgr = nullptr;
delete _sequencer; _sequencer = nullptr;
delete _walkMgr; _walkMgr = nullptr;
Commit: 888f5b668fb4d06e38b0dc581b24ab37f5a1852e
https://github.com/scummvm/scummvm/commit/888f5b668fb4d06e38b0dc581b24ab37f5a1852e
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added more constants
Changed paths:
engines/pink/constants.h
engines/pink/cursor_mgr.cpp
engines/pink/cursor_mgr.h
engines/pink/objects/actors/actor.cpp
engines/pink/objects/handlers/handler_mgr.cpp
engines/pink/objects/inventory.cpp
engines/pink/objects/sequences/sequencer.cpp
engines/pink/sound.cpp
diff --git a/engines/pink/constants.h b/engines/pink/constants.h
index 6d2b02a..2f5239f 100644
--- a/engines/pink/constants.h
+++ b/engines/pink/constants.h
@@ -138,6 +138,15 @@ enum {
kBroMinorVersion = 0,
};
+enum {
+ kTimersUpdateTime = 0x64,
+ kCursorsUpdateTime = 0xC8
+};
+
+enum {
+ kSampleRate = 22050
+};
+
static const char *kPinkGame = "PinkGame";
static const char *kPokus = "pokus";
@@ -145,6 +154,25 @@ static const char *kPeril = "peril";
static const char *kUndefined = "UNDEFINED";
+
+static const char *kCloseAction = "Close";
+static const char *kIdleAction = "Idle";
+static const char *kOpenAction = "Open";
+static const char *kPlayAction = "Play";
+static const char *kShowAction = "Show";
+static const char *kHideAction = "Hide";
+
+static const char *kInventoryWindowActor = "InventoryWindow";
+static const char *kInventoryItemActor = "InventoryItem";
+static const char *kInventoryRightArrowActor = "InventoryWindow";
+static const char *kInventoryLeftArrowActor = "InventoryWindow";
+
+static const char *kCursorNameExitUp = "ExitUp";
+static const char *kCursorNameExitLeft = "ExitLeft";
+static const char *kCursorNameExitRight = "ExitRight";
+static const char *kCursorNameExitForward = "ExitForward";
+
+
} // End of namespace Pink
#endif
diff --git a/engines/pink/cursor_mgr.cpp b/engines/pink/cursor_mgr.cpp
index a07f577..872b5b2 100644
--- a/engines/pink/cursor_mgr.cpp
+++ b/engines/pink/cursor_mgr.cpp
@@ -53,7 +53,7 @@ void CursorMgr::update() {
return;
uint newTime = _game->getTotalPlayTime();
- if (newTime - _time > 0xC8){
+ if (newTime - _time > kCursorsUpdateTime){
_time = newTime;
_isSecondFrame = !_isSecondFrame;
_game->setCursor(_firstFrameIndex + _isSecondFrame);
@@ -62,15 +62,16 @@ void CursorMgr::update() {
void CursorMgr::setCursor(Common::String &cursorName, Common::Point point) {
uint index;
- if (cursorName == "ExitLeft") {
+ if (cursorName == kCursorNameExitLeft) {
index = kExitLeftCursor;
}
- else if (cursorName == "ExitRight"){
+ else if (cursorName == kCursorNameExitRight){
index = kExitRightCursor;
}
- else if (cursorName == "ExitForward" || cursorName == "ExitUp")
+ else if (cursorName == kCursorNameExitForward || cursorName == kCursorNameExitUp)
index = kExitForwardCursor;
else assert(0);
+
setCursor(index, point);
}
diff --git a/engines/pink/cursor_mgr.h b/engines/pink/cursor_mgr.h
index 2b7d37d..b02837b 100644
--- a/engines/pink/cursor_mgr.h
+++ b/engines/pink/cursor_mgr.h
@@ -50,6 +50,7 @@ private:
uint _time;
uint _firstFrameIndex;
+
bool _isPlayingAnimation;
bool _isSecondFrame;
};
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index a7717d3..b2cfdb6 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -62,7 +62,7 @@ GamePage *Actor::getPage() const {
void Actor::init(bool unk) {
if (!_action) {
- _action = findAction({"Idle"});
+ _action = findAction(kIdleAction);
}
if (!_action) {
@@ -75,7 +75,7 @@ void Actor::init(bool unk) {
}
void Actor::hide() {
- setAction({"Hide"});
+ setAction(kHideAction);
}
void Actor::endAction() {
diff --git a/engines/pink/objects/handlers/handler_mgr.cpp b/engines/pink/objects/handlers/handler_mgr.cpp
index a8a8846..477d1f6 100644
--- a/engines/pink/objects/handlers/handler_mgr.cpp
+++ b/engines/pink/objects/handlers/handler_mgr.cpp
@@ -1,6 +1,24 @@
-//
-// Created by andrei on 3/21/18.
-//
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
#include "handler_mgr.h"
#include "handler.h"
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
index 1b5ac2b..8183f9d 100644
--- a/engines/pink/objects/inventory.cpp
+++ b/engines/pink/objects/inventory.cpp
@@ -113,13 +113,13 @@ bool InventoryMgr::start(bool playOpening) {
return false;
}
- _window = _lead->getPage()->findActor("InventoryWindow");
- _itemActor = _lead->getPage()->findActor("InventoryItem");
- _rightArrow = _lead->getPage()->findActor("InventoryRightArrow");
- _leftArrow = _lead->getPage()->findActor("InventoryLeftArrow");
+ _window = _lead->getPage()->findActor(kInventoryWindowActor);
+ _itemActor = _lead->getPage()->findActor(kInventoryItemActor);
+ _rightArrow = _lead->getPage()->findActor(kInventoryRightArrowActor);
+ _leftArrow = _lead->getPage()->findActor(kInventoryLeftArrowActor);
if (playOpening){
- _window->setAction("Open");
+ _window->setAction(kOpenAction);
_state = kOpening;
}
@@ -130,16 +130,17 @@ void InventoryMgr::update() {
if (_state == kOpening && !_window->isPlaying()){
_state = kReady;
_itemActor->setAction(_item->getName());
- _window->setAction("Show");
- _leftArrow->setAction("Show");
- _rightArrow->setAction("Show");
+ _window->setAction(kShowAction);
+ _leftArrow->setAction(kShowAction);
+ _rightArrow->setAction(kShowAction);
}
else if (_state == kClosing && !_window->isPlaying()){
- _window->setAction("Idle");
+ _window->setAction(kIdleAction);
_lead->onInventoryClosed(_isClickedOnItem);
_state = kIdle;
+
_window = nullptr;
_itemActor = nullptr;
_isClickedOnItem = false;
@@ -164,10 +165,10 @@ void InventoryMgr::onClick(Common::Point point) {
void InventoryMgr::close() {
_state = kClosing;
- _window->setAction("Close");
- _itemActor->setAction("Idle");
- _leftArrow->setAction("Idle");
- _rightArrow->setAction("Idle");
+ _window->setAction(kCloseAction);
+ _itemActor->setAction(kIdleAction);
+ _leftArrow->setAction(kIdleAction);
+ _rightArrow->setAction(kIdleAction);
}
void InventoryMgr::showNextItem(bool direction) {
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index f996dc1..e0a1f5f 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -104,7 +104,7 @@ void Sequencer::skipToLastSubSequence() {
void Sequencer::updateTimers() {
uint time = _page->getGame()->getTotalPlayTime();
- if (time - _time <= 0x64) {
+ if (time - _time <= kTimersUpdateTime) {
return;
}
diff --git a/engines/pink/sound.cpp b/engines/pink/sound.cpp
index a4a47be..7077d16 100644
--- a/engines/pink/sound.cpp
+++ b/engines/pink/sound.cpp
@@ -25,6 +25,7 @@
#include <audio/decoders/adpcm.h>
#include <common/substream.h>
#include "sound.h"
+#include "constants.h"
namespace Pink {
@@ -76,7 +77,7 @@ void Sound::setBalance(int8 balance) {
}
uint32 Sound::getCurrentSample() {
- return _mixer->getSoundElapsedTime(_handle) * 22050 / 1000;
+ return _mixer->getSoundElapsedTime(_handle) * kSampleRate / 1000;
}
} // End of namespace Pink
\ No newline at end of file
Commit: 9f8356e52e25b11d0e842728d2134d5c32e22e3b
https://github.com/scummvm/scummvm/commit/9f8356e52e25b11d0e842728d2134d5c32e22e3b
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fixed Inventory onClick method and other bugfixes
Changed paths:
engines/pink/constants.h
engines/pink/file.cpp
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/actors/lead_actor.h
engines/pink/objects/handlers/handler_timer.cpp
engines/pink/objects/inventory.cpp
engines/pink/objects/walk/walk_mgr.cpp
engines/pink/objects/walk/walk_shortest_path.cpp
engines/pink/resource_mgr.cpp
engines/pink/sound.h
diff --git a/engines/pink/constants.h b/engines/pink/constants.h
index 2f5239f..fd4ccbd 100644
--- a/engines/pink/constants.h
+++ b/engines/pink/constants.h
@@ -164,8 +164,8 @@ static const char *kHideAction = "Hide";
static const char *kInventoryWindowActor = "InventoryWindow";
static const char *kInventoryItemActor = "InventoryItem";
-static const char *kInventoryRightArrowActor = "InventoryWindow";
-static const char *kInventoryLeftArrowActor = "InventoryWindow";
+static const char *kInventoryRightArrowActor = "InventoryRightArrow";
+static const char *kInventoryLeftArrowActor = "InventoryLeftArrow";
static const char *kCursorNameExitUp = "ExitUp";
static const char *kCursorNameExitLeft = "ExitLeft";
diff --git a/engines/pink/file.cpp b/engines/pink/file.cpp
index 4f2867b..8db4542 100644
--- a/engines/pink/file.cpp
+++ b/engines/pink/file.cpp
@@ -53,8 +53,7 @@ bool OrbFile::open(const Common::String &name) {
return false;
}
- _timestamp = readUint32LE();
- if (!_timestamp){
+ if (!(_timestamp = readUint32LE())){
return false;
}
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 2a0f84d..fd4ed71 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -146,7 +146,7 @@ void LeadActor::start(bool isHandler) {
_state = kInDialog1;
_nextState = kReady;
}
- updateCursor({0,0});
+ forceUpdateCursor();
}
void LeadActor::onMouseMove(Common::Point point) {
@@ -222,7 +222,7 @@ void LeadActor::onLeftButtonClick(Common::Point point) {
void LeadActor::onMouseOver(Common::Point point, CursorMgr *mgr) {
if (_page->getModule()->getInventoryMgr()->isPinkOwnsAnyItems())
- _cursorMgr->setCursor(kClickableFirstFrameCursor, {0, 0});
+ _cursorMgr->setCursor(kClickableFirstFrameCursor, point);
else Actor::onMouseOver(point, mgr);
}
@@ -278,6 +278,12 @@ void LeadActor::onInventoryClosed(bool isItemClicked) {
_state = _stateCopy;
_stateCopy = kUnk_Loading;
_page->unpause();
+ forceUpdateCursor();
+}
+
+void LeadActor::forceUpdateCursor() {
+ Common::Point point = _page->getGame()->getEventManager()->getMousePos();
+ updateCursor(point);
}
void ParlSqPink::toConsole() {
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index 45e27f9..5988c4c 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -75,6 +75,7 @@ public:
private:
void updateCursor(Common::Point point);
+ void forceUpdateCursor();
bool sendUseClickMessage(SupportingActor *actor);
bool sendLeftClickMessage(SupportingActor *actor);
diff --git a/engines/pink/objects/handlers/handler_timer.cpp b/engines/pink/objects/handlers/handler_timer.cpp
index 6fdbce1..3de4ad4 100644
--- a/engines/pink/objects/handlers/handler_timer.cpp
+++ b/engines/pink/objects/handlers/handler_timer.cpp
@@ -73,7 +73,7 @@ void HandlerTimerActions::handle(Actor *actor) {
void HandlerTimerSequences::execute(Sequence *sequence) {
- debug("HandlerTimerSequences function is not implemented");
+ error("HandlerTimerSequences function is not implemented");
}
void HandlerTimerSequences::toConsole() {
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
index 8183f9d..8406fe7 100644
--- a/engines/pink/objects/inventory.cpp
+++ b/engines/pink/objects/inventory.cpp
@@ -148,6 +148,9 @@ void InventoryMgr::update() {
}
void InventoryMgr::onClick(Common::Point point) {
+ if (_state != kReady)
+ return;
+
Actor *actor = _lead->getPage()->getGame()->getDirector()->getActorByPoint(point);
if (actor == _itemActor || actor == _window) {
_isClickedOnItem = true;
diff --git a/engines/pink/objects/walk/walk_mgr.cpp b/engines/pink/objects/walk/walk_mgr.cpp
index 0cacbd0..b87429d 100644
--- a/engines/pink/objects/walk/walk_mgr.cpp
+++ b/engines/pink/objects/walk/walk_mgr.cpp
@@ -44,10 +44,7 @@ WalkLocation *WalkMgr::findLocation(const Common::String &name) {
auto it = Common::find_if(_locations.begin(), _locations.end(), [&name](WalkLocation *location) {
return location->getName() == name;
});
- if (it == _locations.end())
- return nullptr;
-
- return *it;
+ return (it != _locations.end()) ? *it : nullptr;
}
void WalkMgr::toConsole() {
diff --git a/engines/pink/objects/walk/walk_shortest_path.cpp b/engines/pink/objects/walk/walk_shortest_path.cpp
index 77562e8..4c6f84a 100644
--- a/engines/pink/objects/walk/walk_shortest_path.cpp
+++ b/engines/pink/objects/walk/walk_shortest_path.cpp
@@ -142,9 +142,9 @@ double WalkShortestPath::getWeight(WalkLocation *location) {
bool WalkShortestPath::isLocationVisited(WalkLocation *location) {
for (int i = 0; i < _visited.size(); ++i) {
if (_visited[i] == location)
- return 1;
+ return true;
}
- return 0;
+ return false;
}
void WalkShortestPath::remove(WalkLocation *location) {
@@ -152,6 +152,7 @@ void WalkShortestPath::remove(WalkLocation *location) {
if (_locations[i] == location){
_locations.remove_at(i);
_weight.remove_at(i);
+ break;
}
}
}
diff --git a/engines/pink/resource_mgr.cpp b/engines/pink/resource_mgr.cpp
index 8695191..b3c9636 100644
--- a/engines/pink/resource_mgr.cpp
+++ b/engines/pink/resource_mgr.cpp
@@ -56,22 +56,21 @@ Sound *ResourceMgr::loadSound(Common::String &name) {
Common::SafeSeekableSubReadStream *ResourceMgr::getResourceStream(Common::String &name) {
Common::SeekableReadStream *stream;
- uint i;
- for (i = 0; i < _resCount; ++i) {
- if (name.compareToIgnoreCase(_resDescTable[i].name) == 0){
- break;
- }
- }
- assert(i < _resDescTable[i].size);
-
- if (_resDescTable[i].inBro)
+
+ const ResourceDescription &desc = *Common::find_if(_resDescTable, _resDescTable + _resCount,
+ [&] (const ResourceDescription &desc) {
+ return name.compareToIgnoreCase(desc.name) == 0;
+ });
+
+
+ if (desc.inBro)
stream = _game->getBro();
else stream = _game->getOrb();
- stream->seek(_resDescTable[i].offset);
+ stream->seek(desc.offset);
- return new Common::SafeSeekableSubReadStream(stream, _resDescTable[i].offset,
- _resDescTable[i].offset + _resDescTable[i].size);
+ return new Common::SafeSeekableSubReadStream(stream, desc.offset,
+ desc.offset + desc.size);
}
PinkEngine *ResourceMgr::getGame() const {
diff --git a/engines/pink/sound.h b/engines/pink/sound.h
index 0116825..e1074d2 100644
--- a/engines/pink/sound.h
+++ b/engines/pink/sound.h
@@ -25,6 +25,7 @@
#include <common/stream.h>
#include <audio/mixer.h>
+#include <common/substream.h>
namespace Pink {
Commit: c9887c6151f2206ef3a1349b2def5924759b4535
https://github.com/scummvm/scummvm/commit/c9887c6151f2206ef3a1349b2def5924759b4535
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added PDAButtonActor and AudioInfoPDAButton
Changed paths:
A engines/pink/objects/actors/audio_info_pda_button.h
A engines/pink/objects/actors/pda_button_actor.cpp
A engines/pink/objects/actors/pda_button_actor.h
engines/pink/archive.cpp
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp
index ac56b87..16f54b7 100644
--- a/engines/pink/archive.cpp
+++ b/engines/pink/archive.cpp
@@ -45,7 +45,8 @@
#include <engines/pink/objects/actors/cursor_actor.h>
#include <engines/pink/objects/handlers/handler_timer.h>
#include <engines/pink/objects/actors/inventory_actor.h>
-#include "constants.h"
+#include <engines/pink/objects/actors/audio_info_pda_button.h>
+#include <engines/pink/objects/actors/pda_button_actor.h>
namespace Pink {
@@ -128,7 +129,7 @@ static Object* createObject(int objectId){
case kActor:
return new Actor;
case kAudioInfoPDAButton:
- // return new AudioInfoPDAButton;
+ return new AudioInfoPDAButton;
case kConditionGameVariable:
return new ConditionGameVariable;
case kConditionInventoryItemOwner:
@@ -167,7 +168,7 @@ static Object* createObject(int objectId){
case kModuleProxy:
return new ModuleProxy;
case kPDAButtonActor:
- //return new PDAButtonActor;
+ return new PDAButtonActor;
case kParlSqPink:
return new ParlSqPink;
case kPubPink:
@@ -207,6 +208,7 @@ static Object* createObject(int objectId){
case kWalkLocation:
return new WalkLocation;
default:
+ error("Unknown object id");
return nullptr;
}
}
diff --git a/engines/pink/objects/actors/audio_info_pda_button.h b/engines/pink/objects/actors/audio_info_pda_button.h
new file mode 100644
index 0000000..f869596
--- /dev/null
+++ b/engines/pink/objects/actors/audio_info_pda_button.h
@@ -0,0 +1,54 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_AUDIO_INFO_PDA_BUTTON_H
+#define PINK_AUDIO_INFO_PDA_BUTTON_H
+
+#include <common/debug.h>
+#include <pink/objects/actions/action.h>
+#include <engines/pink/constants.h>
+#include <engines/pink/cursor_mgr.h>
+#include "actor.h"
+
+namespace Pink {
+
+class AudioInfoPDAButton : public Actor {
+public:
+ void toConsole() {
+ debug("CursorActor: _name = %s", _name.c_str());
+ for (int i = 0; i < _actions.size(); ++i) {
+ _actions[i]->toConsole();
+ }
+ }
+
+ void onMouseOver(Common::Point point, CursorMgr *mgr) override {
+ mgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
+ }
+
+ void onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) override {
+ onMouseOver(point, cursorMgr);
+ }
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/objects/actors/pda_button_actor.cpp b/engines/pink/objects/actors/pda_button_actor.cpp
new file mode 100644
index 0000000..8ccaf60
--- /dev/null
+++ b/engines/pink/objects/actors/pda_button_actor.cpp
@@ -0,0 +1,43 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "pda_button_actor.h"
+#include "pink/archive.h"
+
+namespace Pink {
+
+void PDAButtonActor::deserialize(Archive &archive) {
+ Actor::deserialize(archive);
+ _hideOnStop = (bool) archive.readDWORD();
+ _opaque = (bool) archive.readDWORD();
+
+ int comm = archive.readDWORD();
+ assert(comm <= 4);
+ _command = (Command) comm;
+}
+
+void PDAButtonActor::toConsole() {
+ debug("PDAButtonActor: _name = %s, _x = %u _y = %u _hideOnStop = %u, _opaque = %u, _command = %u",
+ _name.c_str(), _x, _y, _hideOnStop, _opaque, (int) _command);
+}
+
+} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/actors/pda_button_actor.h b/engines/pink/objects/actors/pda_button_actor.h
new file mode 100644
index 0000000..15bf8ae
--- /dev/null
+++ b/engines/pink/objects/actors/pda_button_actor.h
@@ -0,0 +1,49 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_PDA_BUTTON_ACTOR_H
+#define PINK_PDA_BUTTON_ACTOR_H
+
+#include "actor.h"
+
+namespace Pink {
+
+class PDAButtonActor : Actor {
+public:
+ enum Command {Null = 0, GoToPage = 1, Close = 2, Unk = 4};
+
+ void deserialize(Archive &archive) override;
+ void toConsole() override;
+
+private:
+ int _x;
+ int _y;
+
+ bool _hideOnStop;
+ bool _opaque;
+
+ Command _command;
+};
+
+}
+
+#endif
Commit: ba29d37ccd73b2077a1a8e59dd59d1a383c935d6
https://github.com/scummvm/scummvm/commit/ba29d37ccd73b2077a1a8e59dd59d1a383c935d6
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fixed stopping sfx according to disasm
Changed paths:
engines/pink/objects/actions/action_play_with_sfx.cpp
engines/pink/objects/actions/action_play_with_sfx.h
diff --git a/engines/pink/objects/actions/action_play_with_sfx.cpp b/engines/pink/objects/actions/action_play_with_sfx.cpp
index 9ead26b..d9215e3 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.cpp
+++ b/engines/pink/objects/actions/action_play_with_sfx.cpp
@@ -78,13 +78,6 @@ ActionPlayWithSfx::~ActionPlayWithSfx() {
}
}
-void ActionPlayWithSfx::end() {
- ActionPlay::end();
- for (int i = 0; i < _sfxArray.size(); ++i) {
- _sfxArray[i]->end();
- }
-}
-
void ActionSfx::deserialize(Pink::Archive &archive) {
archive >> _frame >> _volume >> _sfxName;
archive.readObject();
diff --git a/engines/pink/objects/actions/action_play_with_sfx.h b/engines/pink/objects/actions/action_play_with_sfx.h
index c7aab59..9a1b069 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.h
+++ b/engines/pink/objects/actions/action_play_with_sfx.h
@@ -36,7 +36,6 @@ public:
virtual void deserialize(Archive &archive);
virtual void toConsole();
virtual void update();
- virtual void end();
protected:
virtual void onStart();
Commit: 6f128e9146cf28d219860a0ae9ec1e3d315abb38
https://github.com/scummvm/scummvm/commit/6f128e9146cf28d219860a0ae9ec1e3d315abb38
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added missing parameter in ActionPlayWithSfx::toConsole method;
Changed paths:
engines/pink/objects/actions/action_play_with_sfx.cpp
diff --git a/engines/pink/objects/actions/action_play_with_sfx.cpp b/engines/pink/objects/actions/action_play_with_sfx.cpp
index d9215e3..eaea104 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.cpp
+++ b/engines/pink/objects/actions/action_play_with_sfx.cpp
@@ -35,7 +35,7 @@ void ActionPlayWithSfx::deserialize(Pink::Archive &archive) {
void ActionPlayWithSfx::toConsole() {
debug("\tActionPlayWithSfx: _name = %s, _fileName = %s, z = %u, _startFrame = %u,"
- " _endFrame = %u, _isLoop = %u", _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame);
+ " _endFrame = %u, _isLoop = %u", _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame, _isLoop);
for (int i = 0; i < _sfxArray.size(); ++i) {
_sfxArray[i]->toConsole();
}
Commit: 52df3e15f83d503d42b9b19958009c4d7f9feca8
https://github.com/scummvm/scummvm/commit/52df3e15f83d503d42b9b19958009c4d7f9feca8
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: removed unnecessary method call
Changed paths:
engines/pink/objects/actions/action_sound.cpp
diff --git a/engines/pink/objects/actions/action_sound.cpp b/engines/pink/objects/actions/action_sound.cpp
index f4acb50..af14fce 100644
--- a/engines/pink/objects/actions/action_sound.cpp
+++ b/engines/pink/objects/actions/action_sound.cpp
@@ -76,8 +76,6 @@ void ActionSound::end() {
Director *director = _actor->getPage()->getGame()->getDirector();
director->removeSound(this);
- _sound->stop();
-
delete _sound;
_sound = nullptr;
}
Commit: ed3fce3267da8037663e0441eeee9d9499da6f8b
https://github.com/scummvm/scummvm/commit/ed3fce3267da8037663e0441eeee9d9499da6f8b
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fixed compilation error
Changed paths:
engines/pink/objects/actors/pda_button_actor.h
diff --git a/engines/pink/objects/actors/pda_button_actor.h b/engines/pink/objects/actors/pda_button_actor.h
index 15bf8ae..f1e244f 100644
--- a/engines/pink/objects/actors/pda_button_actor.h
+++ b/engines/pink/objects/actors/pda_button_actor.h
@@ -27,7 +27,7 @@
namespace Pink {
-class PDAButtonActor : Actor {
+class PDAButtonActor : public Actor {
public:
enum Command {Null = 0, GoToPage = 1, Close = 2, Unk = 4};
Commit: 604c74ab0778c82dd7c9fec8e41b379fd7f6f839
https://github.com/scummvm/scummvm/commit/604c74ab0778c82dd7c9fec8e41b379fd7f6f839
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added missing cursor
Changed paths:
engines/pink/constants.h
engines/pink/pink.cpp
diff --git a/engines/pink/constants.h b/engines/pink/constants.h
index fd4ccbd..b8874df 100644
--- a/engines/pink/constants.h
+++ b/engines/pink/constants.h
@@ -123,6 +123,7 @@ enum {
enum {
kPerilClickableThirdCursorID = 140,
kPerilNotClickableCursorID = 139,
+ kPerilHoldingItemCursorID = 101,
kPerilPDASecondCursorID = 142
};
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index df23a48..81c1c48 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -220,13 +220,14 @@ bool PinkEngine::loadCursors() {
if (isPokus) {
_cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusClickableThirdCursorID));
_cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusNotClickableCursorID));
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusHoldingItemCursorID));
}
else {
_cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPerilClickableThirdCursorID));
_cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPerilNotClickableCursorID));
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPerilHoldingItemCursorID));
}
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusHoldingItemCursorID));
_cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusPDAFirstCursorID));
if (isPokus)
Commit: 181b89035a47daec35c1c4f4b565e047c313de7d
https://github.com/scummvm/scummvm/commit/181b89035a47daec35c1c4f4b565e047c313de7d
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added implementation of item using
Changed paths:
engines/pink/cursor_mgr.cpp
engines/pink/cursor_mgr.h
engines/pink/objects/actors/actor.cpp
engines/pink/objects/actors/actor.h
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/actors/lead_actor.h
engines/pink/objects/actors/supporting_actor.cpp
engines/pink/objects/actors/supporting_actor.h
engines/pink/objects/handlers/handler_mgr.cpp
engines/pink/objects/handlers/handler_mgr.h
engines/pink/objects/inventory.cpp
engines/pink/objects/inventory.h
engines/pink/objects/pages/game_page.cpp
engines/pink/objects/pages/game_page.h
diff --git a/engines/pink/cursor_mgr.cpp b/engines/pink/cursor_mgr.cpp
index 872b5b2..d845349 100644
--- a/engines/pink/cursor_mgr.cpp
+++ b/engines/pink/cursor_mgr.cpp
@@ -20,19 +20,23 @@
*
*/
+#include <engines/pink/objects/actors/actor.h>
+#include <engines/pink/objects/actions/action_cel.h>
+#include <engines/pink/cel_decoder.h>
#include "cursor_mgr.h"
#include "pink.h"
+#include "objects/pages/game_page.h"
namespace Pink {
CursorMgr::CursorMgr(PinkEngine *game, GamePage *page)
- : _actor(nullptr), _page(page), _game(game),
+ : _actor(nullptr), _action(nullptr), _page(page), _game(game),
_isPlayingAnimation(0), _firstFrameIndex(0)
{}
CursorMgr::~CursorMgr() {}
-void CursorMgr::setCursor(uint index, Common::Point point) {
+void CursorMgr::setCursor(uint index, Common::Point point, const Common::String &itemName) {
if (index == kClickableFirstFrameCursor) {
if (!_isPlayingAnimation) {
_isPlayingAnimation = 1;
@@ -41,11 +45,30 @@ void CursorMgr::setCursor(uint index, Common::Point point) {
_isSecondFrame = 0;
_game->setCursor(index);
}
+ return;
}
- else {
+ if (index != kHoldingItemCursor){
_isPlayingAnimation = 0;
_game->setCursor(index);
+ return;
}
+
+ _game->setCursor(index);
+ _actor = _actor ? _actor : _page->findActor(kCursor);
+ assert(_actor);
+
+ Action *action = _actor->findAction(itemName);
+ assert(action);
+ if (action != _action) {
+ _action = action;
+ _actor->setAction(action, 0);
+ }
+
+ assert(dynamic_cast<ActionCEL*>(action));
+ CelDecoder *decoder = static_cast<ActionCEL*>(_action)->getDecoder();
+ // this is buggy
+ //decoder->setX(point.x);
+ //decoder->setY(point.y);
}
void CursorMgr::update() {
@@ -68,11 +91,12 @@ void CursorMgr::setCursor(Common::String &cursorName, Common::Point point) {
else if (cursorName == kCursorNameExitRight){
index = kExitRightCursor;
}
- else if (cursorName == kCursorNameExitForward || cursorName == kCursorNameExitUp)
+ else //if (cursorName == kCursorNameExitForward || cursorName == kCursorNameExitUp)
index = kExitForwardCursor;
- else assert(0);
+ //else assert(0);
+
- setCursor(index, point);
+ setCursor(index, point, Common::String());
}
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/cursor_mgr.h b/engines/pink/cursor_mgr.h
index b02837b..643e052 100644
--- a/engines/pink/cursor_mgr.h
+++ b/engines/pink/cursor_mgr.h
@@ -29,8 +29,8 @@
namespace Pink {
-
class Actor;
+class Action;
class GamePage;
class PinkEngine;
@@ -40,11 +40,15 @@ public:
~CursorMgr();
void update();
- void setCursor(uint index, Common::Point point);
+ void setCursor(uint index, Common::Point point, const Common::String &itemName);
void setCursor(Common::String &cursorName, Common::Point point);
private:
+ void hideItem();
+ void stopAnimation();
+
Actor *_actor;
+ Action *_action;
GamePage *_page;
PinkEngine *_game;
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index b2cfdb6..bedea25 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -125,7 +125,7 @@ bool Actor::initPallete(Director *director) {
}
void Actor::onMouseOver(Common::Point point, CursorMgr *mgr) {
- mgr->setCursor(kDefaultCursor, point);
+ mgr->setCursor(kDefaultCursor, point, Common::String());
}
Actor::~Actor() {
@@ -159,4 +159,8 @@ void Actor::unpause() {
_action->unpause();
}
+void Actor::onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) {
+ cursorMgr->setCursor(kHoldingItemCursor, point, itemName);
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/actor.h b/engines/pink/objects/actors/actor.h
index 0761b8f..2c56e81 100644
--- a/engines/pink/objects/actors/actor.h
+++ b/engines/pink/objects/actors/actor.h
@@ -34,6 +34,8 @@ class Action;
class Sequencer;
class Director;
class CursorMgr;
+class InventoryItem;
+class InventoryMgr;
class Actor : public NamedObject {
public:
@@ -68,6 +70,7 @@ public:
virtual void update() {};
virtual void onMouseOver(Common::Point point, CursorMgr *mgr);
+ virtual void onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr);
virtual bool isClickable() { return 0;}
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index fd4ed71..bf6d330 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -161,19 +161,26 @@ void LeadActor::updateCursor(Common::Point point) {
case kMoving: {
Director *director = _page->getGame()->getDirector();
Actor *actor = director->getActorByPoint(point);
- if (actor)
+ InventoryItem *item = _page->getModule()->getInventoryMgr()->getCurrentItem();
+ if (_isHaveItem) {
+ if (actor) {
+ actor->onHover(point, item->getName(), _cursorMgr);
+ }
+ else _cursorMgr->setCursor(kHoldingItemCursor, point, item->getName());
+ }
+ else if (actor)
actor->onMouseOver(point, _cursorMgr);
- else _cursorMgr->setCursor(kDefaultCursor, point);
+ else _cursorMgr->setCursor(kDefaultCursor, point, Common::String());
break;
}
case kInDialog1:
case kInDialog2:
case kPlayingVideo:
- _cursorMgr->setCursor(kNotClickableCursor, point);
+ _cursorMgr->setCursor(kNotClickableCursor, point, Common::String());
break;
case kPDA:
case kInventory:
- _cursorMgr->setCursor(kDefaultCursor, point);
+ _cursorMgr->setCursor(kDefaultCursor, point, Common::String());
break;
default:
break;
@@ -181,6 +188,8 @@ void LeadActor::updateCursor(Common::Point point) {
}
void LeadActor::onLeftButtonClick(Common::Point point) {
+ InventoryMgr *invMgr = _page->getModule()->getInventoryMgr();
+
switch (_state) {
case kReady:
case kMoving: {
@@ -192,9 +201,8 @@ void LeadActor::onLeftButtonClick(Common::Point point) {
}
_recipient = (SupportingActor*) actor;
- if (actor->isClickable() &&
- _recipient->isLeftClickHandlers()) {
- WalkLocation *location = _walkMgr->findLocation(_recipient->getLocation());
+ if (actor->isClickable() && isInteractingWith(_recipient)) {
+ WalkLocation *location = getWalkDestination();
if (location) {
_state = kMoving;
_nextState = kInDialog1;
@@ -213,7 +221,7 @@ void LeadActor::onLeftButtonClick(Common::Point point) {
break;
case kInventory:
- _page->getModule()->getInventoryMgr()->onClick(point);
+ invMgr->onClick(point);
break;
default:
break;
@@ -222,7 +230,7 @@ void LeadActor::onLeftButtonClick(Common::Point point) {
void LeadActor::onMouseOver(Common::Point point, CursorMgr *mgr) {
if (_page->getModule()->getInventoryMgr()->isPinkOwnsAnyItems())
- _cursorMgr->setCursor(kClickableFirstFrameCursor, point);
+ _cursorMgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
else Actor::onMouseOver(point, mgr);
}
@@ -238,7 +246,14 @@ void LeadActor::onWalkEnd() {
}
bool LeadActor::sendUseClickMessage(SupportingActor *actor) {
- return false;
+ InventoryMgr *mgr = _page->getModule()->getInventoryMgr();
+ _nextState = _state != kPlayingVideo ? kReady : kPlayingVideo;
+ _state = kInDialog1;
+ actor->onUseClickMessage(mgr->getCurrentItem(), mgr);
+ if (mgr->getCurrentItem() == nullptr
+ || mgr->getCurrentItem()->getCurrentOwner() != this->_name)
+ _isHaveItem = false;
+ return true;
}
bool LeadActor::sendLeftClickMessage(SupportingActor *actor) {
@@ -286,6 +301,17 @@ void LeadActor::forceUpdateCursor() {
updateCursor(point);
}
+WalkLocation *LeadActor::getWalkDestination() {
+ return _walkMgr->findLocation(_recipient->getLocation());
+}
+
+bool LeadActor::isInteractingWith(SupportingActor *actor) {
+ if (!_isHaveItem)
+ return actor->isLeftClickHandlers();
+
+ return actor->isUseClickHandlers(_page->getModule()->getInventoryMgr()->getCurrentItem());
+}
+
void ParlSqPink::toConsole() {
debug("ParlSqPink: _name = %s", _name.c_str());
for (int i = 0; i < _actions.size(); ++i) {
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index 5988c4c..fe2b613 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -68,18 +68,22 @@ public:
void onLeftButtonClick(Common::Point point);
void onMouseMove(Common::Point point);
void onWalkEnd();
- void onClick();
+ virtual void onClick();
void onInventoryClosed(bool isItemClicked);
virtual void onMouseOver(Common::Point point, CursorMgr *mgr);
-private:
- void updateCursor(Common::Point point);
+ bool isInteractingWith(SupportingActor *actor);
+
+protected:
+ virtual void updateCursor(Common::Point point);
void forceUpdateCursor();
- bool sendUseClickMessage(SupportingActor *actor);
+ virtual bool sendUseClickMessage(SupportingActor *actor);
bool sendLeftClickMessage(SupportingActor *actor);
+ virtual WalkLocation *getWalkDestination();
+
State _state;
State _nextState;
State _stateCopy;
diff --git a/engines/pink/objects/actors/supporting_actor.cpp b/engines/pink/objects/actors/supporting_actor.cpp
index 735e85e..9d6b2d7 100644
--- a/engines/pink/objects/actors/supporting_actor.cpp
+++ b/engines/pink/objects/actors/supporting_actor.cpp
@@ -25,6 +25,7 @@
#include <engines/pink/objects/actions/action.h>
#include <engines/pink/constants.h>
#include "pink/cursor_mgr.h"
+#include "../inventory.h"
namespace Pink {
@@ -48,7 +49,7 @@ void SupportingActor::onMouseOver(Common::Point point, CursorMgr *mgr) {
if (!_cursor.empty()){
mgr->setCursor(_cursor, point);
}
- else mgr->setCursor(kClickableFirstFrameCursor, point);
+ else mgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
}
else Actor::onMouseOver(point, mgr);
}
@@ -57,6 +58,10 @@ bool SupportingActor::isLeftClickHandlers() {
return _handlerMgr.isLeftClickHandler(this);
}
+bool SupportingActor::isUseClickHandlers(InventoryItem *item) {
+ return _handlerMgr.isUseClickHandler(this, item->getName());
+}
+
void SupportingActor::onTimerMessage() {
_handlerMgr.onTimerMessage(this);
}
@@ -73,8 +78,14 @@ const Common::String &SupportingActor::getLocation() const {
return _location;
}
-SupportingActor::~SupportingActor() {
+SupportingActor::~SupportingActor() {}
+void SupportingActor::onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) {
+ Common::String item = itemName;
+ if (_handlerMgr.isUseClickHandler(this, itemName)) {
+ item += kClickable;
+ }
+ Actor::onHover(point, item, cursorMgr);
}
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/actors/supporting_actor.h b/engines/pink/objects/actors/supporting_actor.h
index fe6dfce..4c8b6cf 100644
--- a/engines/pink/objects/actors/supporting_actor.h
+++ b/engines/pink/objects/actors/supporting_actor.h
@@ -41,11 +41,14 @@ public:
virtual bool isClickable() { return 1; }
bool isLeftClickHandlers();
+ bool isUseClickHandlers(InventoryItem *item);
void onTimerMessage();
bool onLeftClickMessage();
bool onUseClickMessage(InventoryItem *item, InventoryMgr *mgr);
+ virtual void onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr);
+
const Common::String &getLocation() const;
diff --git a/engines/pink/objects/handlers/handler_mgr.cpp b/engines/pink/objects/handlers/handler_mgr.cpp
index 477d1f6..caa5582 100644
--- a/engines/pink/objects/handlers/handler_mgr.cpp
+++ b/engines/pink/objects/handlers/handler_mgr.cpp
@@ -22,9 +22,7 @@
#include "handler_mgr.h"
#include "handler.h"
-#include "handler_timer.h"
#include <pink/archive.h>
-#include <common/debug.h>
#include <pink/objects/inventory.h>
namespace Pink {
@@ -55,6 +53,17 @@ bool HandlerMgr::isLeftClickHandler(Actor *actor) {
return false;
}
+bool HandlerMgr::isUseClickHandler(Actor *actor, const Common::String &itemName){
+ for (int i = 0; i < _useClickHandlers.size(); ++i) {
+ if (itemName == _useClickHandlers[i]->getInventoryItem() &&
+ _useClickHandlers[i]->isSuitable(actor))
+ return true;
+ }
+
+ return false;
+}
+
+
void HandlerMgr::onTimerMessage(Actor *actor) {
Handler *handler = findSuitableHandlerTimer(actor);
if (handler)
@@ -71,10 +80,10 @@ bool HandlerMgr::onLeftClickMessage(Actor *actor) {
}
bool HandlerMgr::onUseClickMessage(Actor *actor, InventoryItem *item, InventoryMgr *mgr) {
- HandlerUseClick *handler = (HandlerUseClick*) findSuitableHandlerUseClick(actor);
+ HandlerUseClick *handler = findSuitableHandlerUseClick(actor, item);
if (handler) {
- handler->handle(actor);
- mgr->setItemOwner(handler->getRecepient(), item);
+ if (!handler->getRecepient().empty())
+ mgr->setItemOwner(handler->getRecepient(), item);
handler->handle(actor);
return true;
}
@@ -90,7 +99,7 @@ Handler *HandlerMgr::findSuitableHandlerTimer(Actor *actor) {
return nullptr;
}
-Handler *HandlerMgr::findSuitableHandlerLeftClick(Actor *actor) {
+HandlerLeftClick *HandlerMgr::findSuitableHandlerLeftClick(Actor *actor) {
for (int i = 0; i < _leftClickHandlers.size(); ++i) {
if (_leftClickHandlers[i]->isSuitable(actor))
return _leftClickHandlers[i];
@@ -99,9 +108,9 @@ Handler *HandlerMgr::findSuitableHandlerLeftClick(Actor *actor) {
return nullptr;
}
-Handler *HandlerMgr::findSuitableHandlerUseClick(Actor *actor) {
+HandlerUseClick *HandlerMgr::findSuitableHandlerUseClick(Actor *actor, InventoryItem *item) {
for (int i = 0; i < _useClickHandlers.size(); ++i) {
- if (_useClickHandlers[i]->isSuitable(actor))
+ if (item->getName() == _useClickHandlers[i]->getInventoryItem() && _useClickHandlers[i]->isSuitable(actor))
return _useClickHandlers[i];
}
diff --git a/engines/pink/objects/handlers/handler_mgr.h b/engines/pink/objects/handlers/handler_mgr.h
index aa1d334..48de703 100644
--- a/engines/pink/objects/handlers/handler_mgr.h
+++ b/engines/pink/objects/handlers/handler_mgr.h
@@ -46,6 +46,7 @@ public:
virtual void toConsole();
bool isLeftClickHandler(Actor *actor);
+ bool isUseClickHandler(Actor *actor, const Common::String &itemName);
void onTimerMessage(Actor *actor);
bool onLeftClickMessage(Actor *actor);
@@ -53,12 +54,12 @@ public:
private:
Handler *findSuitableHandlerTimer(Actor *actor);
- Handler *findSuitableHandlerLeftClick(Actor *actor);
- Handler *findSuitableHandlerUseClick(Actor *actor);
+ HandlerLeftClick *findSuitableHandlerLeftClick(Actor *actor);
+ HandlerUseClick *findSuitableHandlerUseClick(Actor *actor, InventoryItem *item);
Common::Array<HandlerLeftClick*> _leftClickHandlers;
Common::Array<HandlerUseClick*> _useClickHandlers;
- Common::Array<HandlerTimer*> _timerHandlers;
+ Common::Array<Handler*> _timerHandlers;
};
}
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
index 8406fe7..6d13f8a 100644
--- a/engines/pink/objects/inventory.cpp
+++ b/engines/pink/objects/inventory.cpp
@@ -100,10 +100,11 @@ void InventoryMgr::setItemOwner(const Common::String &owner, InventoryItem *item
if (item == _item && _lead->getName() != owner)
_item = nullptr;
- else if (_lead->getName() == owner)
- _item = item;
item->_currentOwner = owner;
+
+ if (_lead->getName() == owner)
+ _item = item;
}
bool InventoryMgr::start(bool playOpening) {
@@ -194,6 +195,10 @@ void InventoryMgr::showNextItem(bool direction) {
}
}
+InventoryItem *InventoryMgr::getCurrentItem() {
+ return _item;
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/inventory.h b/engines/pink/objects/inventory.h
index db67f4e..d5953eb 100644
--- a/engines/pink/objects/inventory.h
+++ b/engines/pink/objects/inventory.h
@@ -66,6 +66,8 @@ public:
bool isPinkOwnsAnyItems();
void setItemOwner(const Common::String &owner, InventoryItem *item);
+ InventoryItem *getCurrentItem();
+
private:
void close();
enum Direction {
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index 47437a8..63a2607 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -133,7 +133,7 @@ Module *GamePage::getModule() const {
return _module;
}
-bool GamePage::checkValueOfVariable(Common::String &variable, Common::String &value) {
+bool GamePage::checkValueOfVariable(const Common::String &variable, const Common::String &value) {
if (!_variables.contains(variable))
return value == kUndefined;
return _variables[variable] == value;
@@ -141,6 +141,7 @@ bool GamePage::checkValueOfVariable(Common::String &variable, Common::String &va
void GamePage::setVariable(Common::String &variable, Common::String &value) {
_variables[variable] = value;
+ _leadActor->onVariableSet();
}
WalkMgr *GamePage::getWalkMgr() {
@@ -149,8 +150,11 @@ WalkMgr *GamePage::getWalkMgr() {
void GamePage::loadState() {
Archive archive(static_cast<Common::SeekableReadStream*>(_memFile));
- _variables.clear(0);
- archive >> _variables;
+ //_variables.clear(1);
+ Common::StringMap mapTest; // HACK. Without it isn't working
+ //archive >> _variables;
+ archive >> mapTest;
+ _variables = mapTest;
uint16 actorCount;
archive >> actorCount;
@@ -177,7 +181,7 @@ void GamePage::saveState() {
}
void GamePage::unload() {
- _leadActor->setAction(_leadActor->findAction("Idle"));
+ _leadActor->setAction(_leadActor->findAction(kIdleAction));
saveState();
clear();
@@ -187,7 +191,7 @@ void GamePage::unload() {
void GamePage::clear() {
Page::clear();
- _variables.clear(1);
+ //_variables.clear(1);
for (int i = 0; i < _handlers.size(); ++i) {
delete _handlers[i];
diff --git a/engines/pink/objects/pages/game_page.h b/engines/pink/objects/pages/game_page.h
index c4f6dfb..469d1b3 100644
--- a/engines/pink/objects/pages/game_page.h
+++ b/engines/pink/objects/pages/game_page.h
@@ -50,7 +50,7 @@ public:
WalkMgr *getWalkMgr();
Module *getModule() const;
- bool checkValueOfVariable(Common::String &variable, Common::String &value);
+ bool checkValueOfVariable(const Common::String &variable, const Common::String &value);
void setVariable(Common::String &variable, Common::String &value);
virtual void clear();
Commit: d83022b60754698054dc8dcb675ceee36f171bf8
https://github.com/scummvm/scummvm/commit/d83022b60754698054dc8dcb675ceee36f171bf8
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added implementation of mini-games (PubPink and ParlSqPink)
Changed paths:
engines/pink/constants.h
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/actors/lead_actor.h
diff --git a/engines/pink/constants.h b/engines/pink/constants.h
index b8874df..8e70f5a 100644
--- a/engines/pink/constants.h
+++ b/engines/pink/constants.h
@@ -155,7 +155,6 @@ static const char *kPeril = "peril";
static const char *kUndefined = "UNDEFINED";
-
static const char *kCloseAction = "Close";
static const char *kIdleAction = "Idle";
static const char *kOpenAction = "Open";
@@ -173,6 +172,22 @@ static const char *kCursorNameExitLeft = "ExitLeft";
static const char *kCursorNameExitRight = "ExitRight";
static const char *kCursorNameExitForward = "ExitForward";
+static const char *kClickable = "Clickable";
+static const char *kCursor = "Cursor";
+
+static const char *kFoodPuzzle = "FoodPuzzle";
+static const char *kJackson = "Jackson";
+static const char *kBolted = "Bolted";
+static const char *kDrunkLocation = "DrunkLocation";
+static const char *kDrunk = "Drunk";
+
+static const char *kFirstRound = "15.1";
+static const char *kSecondRound = "15.2";
+static const char *kThirdRound = "15.3";
+
+static const char *kBoy = "Boy";
+static const char *kSirBaldley = "SirBaldley";
+static const char *kBoyBlocked = "BoyBlocked";
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index bf6d330..8c34354 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -319,6 +319,19 @@ void ParlSqPink::toConsole() {
}
}
+WalkLocation *ParlSqPink::getWalkDestination() {
+ if (_recipient->getName() == kBoy &&
+ _page->checkValueOfVariable(kBoyBlocked, kUndefined))
+ {
+ return _walkMgr->findLocation(kSirBaldley);
+ }
+ return LeadActor::getWalkDestination();
+}
+
+PubPink::PubPink() :
+ LeadActor(), _round(0)
+{}
+
void PubPink::toConsole() {
debug("PubPink: _name = %s", _name.c_str());
for (int i = 0; i < _actions.size(); ++i) {
@@ -326,4 +339,77 @@ void PubPink::toConsole() {
}
}
+bool PubPink::playingMiniGame() {
+ return !(_page->checkValueOfVariable(kFoodPuzzle, "TRUE") ||
+ _page->checkValueOfVariable(kFoodPuzzle, kUndefined));
+}
+
+void PubPink::onClick() {
+ if (!playingMiniGame())
+ LeadActor::onClick();
+}
+
+void PubPink::updateCursor(Common::Point point) {
+ if (playingMiniGame()) {
+ SupportingActor *actor = static_cast<SupportingActor*>(_page->getGame()->getDirector()->getActorByPoint(point));
+ if (_state == kReady &&
+ actor &&
+ actor->isUseClickHandlers(_page->getModule()->getInventoryMgr()->getCurrentItem()))
+ {
+ _cursorMgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
+ }
+ else _cursorMgr->setCursor(kDefaultCursor, point, Common::String());
+ }
+ else LeadActor::updateCursor(point);
+}
+
+WalkLocation *PubPink::getWalkDestination() {
+ if (playingMiniGame())
+ return nullptr;
+
+ if (_recipient->getName() == kJackson &&
+ !_page->checkValueOfVariable(kDrunkLocation, kBolted))
+ {
+ return _walkMgr->findLocation(_page->findActor(kDrunk)->getName());
+ }
+
+ return LeadActor::getWalkDestination();
+}
+
+bool PubPink::sendUseClickMessage(SupportingActor *actor) {
+ if (!LeadActor::sendUseClickMessage(actor) &&
+ playingMiniGame()) {
+ _nextState = _state;
+ _state = kInDialog1;
+
+ const char *roundName;
+ switch (_round++ % 3) {
+ case 0:
+ roundName = kFirstRound;
+ break;
+ case 1:
+ roundName = kSecondRound;
+ break;
+ case 2:
+ roundName = kThirdRound;
+ break;
+ default:
+ roundName = nullptr;
+ assert(0);
+ break;
+ }
+ _sequencer->authorSequence(_sequencer->findSequence(roundName), 0);
+ }
+
+ if (playingMiniGame())
+ _isHaveItem = true;
+
+ return true;
+}
+
+void PubPink::onVariableSet() {
+ if (playingMiniGame())
+ _isHaveItem = true;
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index fe2b613..977096b 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -32,6 +32,7 @@ namespace Pink {
class CursorMgr;
class WalkMgr;
+class WalkLocation;
class Sequencer;
class SupportingActor;
@@ -70,6 +71,7 @@ public:
void onWalkEnd();
virtual void onClick();
void onInventoryClosed(bool isItemClicked);
+ virtual void onVariableSet() {};
virtual void onMouseOver(Common::Point point, CursorMgr *mgr);
@@ -100,12 +102,27 @@ protected:
class ParlSqPink : public LeadActor {
public:
+ virtual WalkLocation *getWalkDestination();
void toConsole();
};
class PubPink : public LeadActor {
public:
+ PubPink();
+
void toConsole();
+
+ virtual void onClick();
+ virtual void onVariableSet();
+
+private:
+ int _round;
+
+ virtual bool sendUseClickMessage(SupportingActor *actor);
+ virtual void updateCursor(Common::Point point);
+ virtual WalkLocation *getWalkDestination();
+
+ bool playingMiniGame();
};
Commit: 362db13d172eee5dedcd35aab3ea537dcc4bae5c
https://github.com/scummvm/scummvm/commit/362db13d172eee5dedcd35aab3ea537dcc4bae5c
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fixed SideEffectLocation
Changed paths:
engines/pink/objects/side_effect.cpp
diff --git a/engines/pink/objects/side_effect.cpp b/engines/pink/objects/side_effect.cpp
index 548a29f..7cdb2c9 100644
--- a/engines/pink/objects/side_effect.cpp
+++ b/engines/pink/objects/side_effect.cpp
@@ -51,8 +51,8 @@ void SideEffectLocation::deserialize(Archive &archive) {
void SideEffectLocation::execute(Actor *actor) {
WalkMgr *mgr = actor->getPage()->getWalkMgr();
WalkLocation *location = mgr->findLocation(_location);
- assert(location);
- mgr->setCurrentWayPoint(location);
+ if (location)
+ mgr->setCurrentWayPoint(location);
}
void SideEffectLocation::toConsole() {
Commit: 954ee72b87d3a762cc26bd655cf99a7692e7a0c9
https://github.com/scummvm/scummvm/commit/954ee72b87d3a762cc26bd655cf99a7692e7a0c9
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fixed finding nullptr action
Changed paths:
engines/pink/objects/actors/actor.cpp
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index bedea25..5cdf6e3 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -47,11 +47,11 @@ Sequencer *Actor::getSequencer() const {
}
Action *Actor::findAction(const Common::String &name) {
- Action ** action = Common::find_if(_actions.begin(), _actions.end(), [&name]
+ auto action = Common::find_if(_actions.begin(), _actions.end(), [&name]
(Action* action) {
return name == action->getName();
- });;
- if (!action)
+ });
+ if (action == _actions.end())
return nullptr;
return *action;
}
@@ -94,7 +94,6 @@ void Actor::setAction(Action *newAction) {
}
if (newAction) {
_isActionEnded = 0;
- _action = newAction;
_action->start(0);
}
}
Commit: 9364010e5e347abc14488f8a03aaaea508a28b67
https://github.com/scummvm/scummvm/commit/9364010e5e347abc14488f8a03aaaea508a28b67
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fixed setting action method
Changed paths:
engines/pink/objects/actors/actor.cpp
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index 5cdf6e3..776a403 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -92,6 +92,7 @@ void Actor::setAction(Action *newAction) {
_isActionEnded = 1;
_action->end();
}
+ _action = newAction;
if (newAction) {
_isActionEnded = 0;
_action->start(0);
Commit: 866b552eed2d10fd73ce2c0b4e288fce1c64c64e
https://github.com/scummvm/scummvm/commit/866b552eed2d10fd73ce2c0b4e288fce1c64c64e
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: changed static_cast to dynamic_cast
Changed paths:
engines/pink/objects/actors/lead_actor.cpp
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 8c34354..ddc4052 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -200,7 +200,7 @@ void LeadActor::onLeftButtonClick(Common::Point point) {
return;
}
- _recipient = (SupportingActor*) actor;
+ _recipient = dynamic_cast<SupportingActor*>(actor);
if (actor->isClickable() && isInteractingWith(_recipient)) {
WalkLocation *location = getWalkDestination();
if (location) {
@@ -351,7 +351,7 @@ void PubPink::onClick() {
void PubPink::updateCursor(Common::Point point) {
if (playingMiniGame()) {
- SupportingActor *actor = static_cast<SupportingActor*>(_page->getGame()->getDirector()->getActorByPoint(point));
+ SupportingActor *actor = dynamic_cast<SupportingActor*>(_page->getGame()->getDirector()->getActorByPoint(point));
if (_state == kReady &&
actor &&
actor->isUseClickHandlers(_page->getModule()->getInventoryMgr()->getCurrentItem()))
Commit: 0d82a3062c0b4d8b0d922d76d2096ed619ccd267
https://github.com/scummvm/scummvm/commit/0d82a3062c0b4d8b0d922d76d2096ed619ccd267
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added movement for picked item from inventory
Changed paths:
engines/pink/cel_decoder.cpp
engines/pink/cel_decoder.h
engines/pink/cursor_mgr.cpp
engines/pink/cursor_mgr.h
engines/pink/director.cpp
diff --git a/engines/pink/cel_decoder.cpp b/engines/pink/cel_decoder.cpp
index 1e7a36a..39b797b 100644
--- a/engines/pink/cel_decoder.cpp
+++ b/engines/pink/cel_decoder.cpp
@@ -51,14 +51,14 @@ bool CelDecoder::loadStream(Common::SeekableReadStream *stream) {
return true;
}
-uint32 CelDecoder::getX(){
+int32 CelDecoder::getX(){
CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
if (!track)
return -1;
return track->getX();
}
-uint32 CelDecoder::getY() {
+int32 CelDecoder::getY() {
CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
if (!track)
return -1;
@@ -92,6 +92,16 @@ Common::Rect &CelDecoder::getRectangle() {
return track->getRect();
}
+void CelDecoder::setX(int32 x) {
+ CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
+ track->setX(x);
+}
+
+void CelDecoder::setY(int32 y) {
+ CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
+ track->setY(y);
+}
+
CelDecoder::CelVideoTrack::CelVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height, bool skipHeader)
: FlicVideoTrack(stream, frameCount, width, height, 1), _center(0,0), _transparentColourIndex(0){
readHeader();
@@ -141,12 +151,12 @@ void CelDecoder::CelVideoTrack::readHeader() {
_fileStream->seek(_offsetFrame1);
}
-uint32 CelDecoder::CelVideoTrack::getX() const {
- return _center.x - getWidth() / 2;
+int32 CelDecoder::CelVideoTrack::getX() const {
+ return (_center.x - getWidth() / 2) < 0 ? 0 : _center.x - getWidth() / 2;
}
-uint32 CelDecoder::CelVideoTrack::getY() const {
- return _center.y - getHeight() / 2;
+int32 CelDecoder::CelVideoTrack::getY() const {
+ return (_center.y - getHeight() / 2) < 0 ? 0 : _center.y - getHeight() / 2;
}
uint16 CelDecoder::CelVideoTrack::getTransparentColourIndex() {
@@ -196,4 +206,12 @@ const Graphics::Surface *CelDecoder::CelVideoTrack::decodeNextFrame() {
return _surface;
}
+void CelDecoder::CelVideoTrack::setX(int32 x) {
+ _center.x = x ;//+ getWidth() / 2;
+}
+
+void CelDecoder::CelVideoTrack::setY(int32 y) {
+ _center.y = y;//+ getHeight() / 2;
+}
+
} // End of namepsace Pink
\ No newline at end of file
diff --git a/engines/pink/cel_decoder.h b/engines/pink/cel_decoder.h
index c3ecce0..d52318b 100644
--- a/engines/pink/cel_decoder.h
+++ b/engines/pink/cel_decoder.h
@@ -32,28 +32,34 @@ class CelDecoder : public Video::FlicDecoder {
public:
virtual bool loadStream(Common::SeekableReadStream *stream);
- uint32 getX();
- uint32 getY();
+ int32 getX();
+ int32 getY();
uint16 getTransparentColourIndex();
Common::Point getCenter();
Common::Rect &getRectangle();
const Graphics::Surface *getCurrentFrame();
+ void setX(int32 x);
+ void setY(int32 y);
+
protected:
class CelVideoTrack : public FlicVideoTrack {
public:
CelVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height, bool skipHeader = false);
virtual void readHeader();
- uint32 getX() const;
- uint32 getY() const;
+ int32 getX() const;
+ int32 getY() const;
uint16 getTransparentColourIndex();
Common::Point getCenter();
Common::Rect &getRect();
const Graphics::Surface *getCurrentFrame();
+ void setX(int32 x);
+ void setY(int32 y);
+
private:
const Graphics::Surface *decodeNextFrame();
void readPrefixChunk();
diff --git a/engines/pink/cursor_mgr.cpp b/engines/pink/cursor_mgr.cpp
index d845349..00259b7 100644
--- a/engines/pink/cursor_mgr.cpp
+++ b/engines/pink/cursor_mgr.cpp
@@ -30,7 +30,7 @@
namespace Pink {
CursorMgr::CursorMgr(PinkEngine *game, GamePage *page)
- : _actor(nullptr), _action(nullptr), _page(page), _game(game),
+ : _actor(nullptr), _page(page), _game(game),
_isPlayingAnimation(0), _firstFrameIndex(0)
{}
@@ -38,37 +38,42 @@ CursorMgr::~CursorMgr() {}
void CursorMgr::setCursor(uint index, Common::Point point, const Common::String &itemName) {
if (index == kClickableFirstFrameCursor) {
- if (!_isPlayingAnimation) {
- _isPlayingAnimation = 1;
- _time = _game->getTotalPlayTime();
- _firstFrameIndex = index;
- _isSecondFrame = 0;
+ startAnimation(index);
+ return hideItem();
+ }
+ else if (index != kHoldingItemCursor){
+
+ if (index != kPDASecondCursor) {
_game->setCursor(index);
+ _isPlayingAnimation = 0;
+ return hideItem();
}
- return;
- }
- if (index != kHoldingItemCursor){
- _isPlayingAnimation = 0;
- _game->setCursor(index);
- return;
+
+ hideItem();
+ return startAnimation(index);
}
_game->setCursor(index);
+ _isPlayingAnimation = 0;
+
_actor = _actor ? _actor : _page->findActor(kCursor);
assert(_actor);
Action *action = _actor->findAction(itemName);
- assert(action);
- if (action != _action) {
- _action = action;
+ assert(dynamic_cast<ActionCEL*>(action));
+
+ if (action != _actor->getAction()) {
_actor->setAction(action, 0);
+ CelDecoder *decoder = static_cast<ActionCEL*>(action)->getDecoder();
+ decoder->setX(point.x);
+ decoder->setY(point.y);
+ }
+ else {
+ CelDecoder *decoder = static_cast<ActionCEL*>(action)->getDecoder();
+ decoder->setX(point.x);
+ decoder->setY(point.y);
}
- assert(dynamic_cast<ActionCEL*>(action));
- CelDecoder *decoder = static_cast<ActionCEL*>(_action)->getDecoder();
- // this is buggy
- //decoder->setX(point.x);
- //decoder->setY(point.y);
}
void CursorMgr::update() {
@@ -99,4 +104,18 @@ void CursorMgr::setCursor(Common::String &cursorName, Common::Point point) {
setCursor(index, point, Common::String());
}
+void CursorMgr::hideItem() {
+ if (_actor) _actor->hide();
+}
+
+void CursorMgr::startAnimation(int index) {
+ if (!_isPlayingAnimation) {
+ _isPlayingAnimation = 1;
+ _time = _game->getTotalPlayTime();
+ _firstFrameIndex = index;
+ _isSecondFrame = 0;
+ _game->setCursor(index);
+ }
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/cursor_mgr.h b/engines/pink/cursor_mgr.h
index 643e052..1a0094d 100644
--- a/engines/pink/cursor_mgr.h
+++ b/engines/pink/cursor_mgr.h
@@ -45,10 +45,9 @@ public:
private:
void hideItem();
- void stopAnimation();
+ void startAnimation(int index);
Actor *_actor;
- Action *_action;
GamePage *_page;
PinkEngine *_game;
diff --git a/engines/pink/director.cpp b/engines/pink/director.cpp
index 4003ca5..d92269e 100644
--- a/engines/pink/director.cpp
+++ b/engines/pink/director.cpp
@@ -29,7 +29,7 @@
namespace Pink {
Director::Director(OSystem *system)
- : _system(system), showBounds(0) {}
+ : _system(system), showBounds(1) {}
void Director::draw() {
_system->fillScreen(0);
@@ -48,11 +48,18 @@ void Director::drawSprite(ActionCEL *sprite) {
}
else surface = decoder->getCurrentFrame();
+ int h = surface->h;
+ if (surface->h + decoder->getY() > 480)
+ h = 480 - decoder->getY();
+ int w = surface->w;
+ if (surface->w + decoder->getX() > 640)
+ w = 640 - decoder->getX();
+
if (!showBounds) {
Graphics::Surface *screen = _system->lockScreen();
- for (int y = 0; y < decoder->getHeight(); ++y) {
- for (int x = 0; x < decoder->getWidth(); ++x) {
+ for (int y = 0; y < h; ++y) {
+ for (int x = 0; x < w; ++x) {
uint16 spritePixelColourIndex = *(byte*)surface->getBasePtr(x, y);
if (spritePixelColourIndex != decoder->getTransparentColourIndex()) {
*(byte *) screen->getBasePtr(decoder->getX() + x, decoder->getY() + y) = spritePixelColourIndex;
@@ -63,7 +70,7 @@ void Director::drawSprite(ActionCEL *sprite) {
}
else _system->copyRectToScreen(surface->getPixels(), surface->pitch,
decoder->getX(), decoder->getY(),
- surface->w, surface->h);
+ w, h);
}
Commit: 84529c917764275e3f74ed711f9eebcf07ff822c
https://github.com/scummvm/scummvm/commit/84529c917764275e3f74ed711f9eebcf07ff822c
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fixed entering to Mucky Duck Pub
Changed paths:
engines/pink/objects/handlers/handler_timer.cpp
diff --git a/engines/pink/objects/handlers/handler_timer.cpp b/engines/pink/objects/handlers/handler_timer.cpp
index 3de4ad4..2c478fc 100644
--- a/engines/pink/objects/handlers/handler_timer.cpp
+++ b/engines/pink/objects/handlers/handler_timer.cpp
@@ -24,7 +24,6 @@
#include "handler_timer.h"
#include <common/debug.h>
#include <engines/pink/archive.h>
-#include <engines/pink/objects/condition.h>
#include <engines/pink/objects/sequences/sequence.h>
#include <engines/pink/objects/side_effect.h>
#include <engines/pink/objects/actors/lead_actor.h>
@@ -61,8 +60,7 @@ void HandlerTimerActions::toConsole() {
void HandlerTimerActions::handle(Actor *actor) {
Handler::handle(actor);
- assert(_actions.size());
- if (!actor->isPlaying()){
+ if (!actor->isPlaying() && _actions.size()) {
Common::RandomSource &rnd = actor->getPage()->getGame()->getRnd();
uint index = rnd.getRandomNumber(_actions.size() - 1);
Action *action = actor->findAction(_actions[index]);
Commit: 9cfa4970a24aea17530ad567905e8e38d207c951
https://github.com/scummvm/scummvm/commit/9cfa4970a24aea17530ad567905e8e38d207c951
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fixed choosing item after getting it from click using other item
Changed paths:
engines/pink/objects/actors/lead_actor.cpp
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index ddc4052..cb87a24 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -249,10 +249,10 @@ bool LeadActor::sendUseClickMessage(SupportingActor *actor) {
InventoryMgr *mgr = _page->getModule()->getInventoryMgr();
_nextState = _state != kPlayingVideo ? kReady : kPlayingVideo;
_state = kInDialog1;
+ InventoryItem *item = mgr->getCurrentItem();
actor->onUseClickMessage(mgr->getCurrentItem(), mgr);
- if (mgr->getCurrentItem() == nullptr
- || mgr->getCurrentItem()->getCurrentOwner() != this->_name)
- _isHaveItem = false;
+ if (item->getCurrentOwner() != this->_name)
+ _isHaveItem = false;
return true;
}
Commit: 08d065229757c597d2a087d4901e115115f023e7
https://github.com/scummvm/scummvm/commit/08d065229757c597d2a087d4901e115115f023e7
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: implemented stopFrame
Changed paths:
engines/pink/objects/actions/action_loop.cpp
engines/pink/objects/actions/action_play.cpp
engines/pink/objects/actions/action_play_with_sfx.cpp
diff --git a/engines/pink/objects/actions/action_loop.cpp b/engines/pink/objects/actions/action_loop.cpp
index c821fb1..b9e8600 100644
--- a/engines/pink/objects/actions/action_loop.cpp
+++ b/engines/pink/objects/actions/action_loop.cpp
@@ -54,7 +54,7 @@ void ActionLoop::toConsole() {
void ActionLoop::update() {
// for now it supports only forward loop animation
if (_style == kForward) {
- if (_decoder->endOfVideo()){
+ if (_decoder->endOfVideo() || _decoder->getCurFrame() == _stopFrame){
//debug("ACTION LOOP : NEXT ITERATION");
_decoder->rewind();
}
diff --git a/engines/pink/objects/actions/action_play.cpp b/engines/pink/objects/actions/action_play.cpp
index d3ded9a..7749bc6 100644
--- a/engines/pink/objects/actions/action_play.cpp
+++ b/engines/pink/objects/actions/action_play.cpp
@@ -49,9 +49,13 @@ void ActionPlay::onStart() {
for (int i = 0; i <= _startFrame; ++i) {
_decoder->decodeNextFrame();
}
+}
- if (_stopFrame != -1)
- _decoder->setEndFrame(_stopFrame);
+void ActionPlay::update() {
+ if (_decoder->endOfVideo() || _decoder->getCurFrame() == _stopFrame){
+ _decoder->stop();
+ _actor->endAction();
+ }
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_play_with_sfx.cpp b/engines/pink/objects/actions/action_play_with_sfx.cpp
index eaea104..a724dab 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.cpp
+++ b/engines/pink/objects/actions/action_play_with_sfx.cpp
@@ -42,9 +42,9 @@ void ActionPlayWithSfx::toConsole() {
}
void ActionPlayWithSfx::update() {
- if (_decoder->endOfVideo() && _isLoop) {
+ if ((_decoder->endOfVideo() || _decoder->getCurFrame() == _stopFrame) && _isLoop) {
_decoder->rewind();
- } else if (_decoder->endOfVideo()) {
+ } else if (_decoder->endOfVideo() || _decoder->getCurFrame() == _stopFrame) {
_decoder->stop();
_actor->endAction();
}
Commit: c9e7c001ada8a9439d2eaf281baf226f6b626ee1
https://github.com/scummvm/scummvm/commit/c9e7c001ada8a9439d2eaf281baf226f6b626ee1
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fixed unstoppable talk animation
Changed paths:
engines/pink/objects/actions/action_talk.cpp
diff --git a/engines/pink/objects/actions/action_talk.cpp b/engines/pink/objects/actions/action_talk.cpp
index 30412ee..09dc972 100644
--- a/engines/pink/objects/actions/action_talk.cpp
+++ b/engines/pink/objects/actions/action_talk.cpp
@@ -24,6 +24,7 @@
#include <pink/archive.h>
#include <pink/objects/actors/actor.h>
#include <pink/objects/pages/game_page.h>
+#include <pink/cel_decoder.h>
#include <pink/sound.h>
namespace Pink {
@@ -47,8 +48,10 @@ void ActionTalk::onStart() {
void ActionTalk::update() {
ActionLoop::update();
- if (!_sound->isPlaying())
+ if (!_sound->isPlaying()) {
+ _decoder->stop();
_actor->endAction();
+ }
}
void ActionTalk::end() {
Commit: 4ce6b3dbd2a8dafa9e0d7d3f21a60431a1bd056f
https://github.com/scummvm/scummvm/commit/4ce6b3dbd2a8dafa9e0d7d3f21a60431a1bd056f
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fixed compilation errors
Changed paths:
engines/pink/objects/actions/action_play.h
diff --git a/engines/pink/objects/actions/action_play.h b/engines/pink/objects/actions/action_play.h
index a2f0ae3..1d519a8 100644
--- a/engines/pink/objects/actions/action_play.h
+++ b/engines/pink/objects/actions/action_play.h
@@ -35,6 +35,8 @@ public:
virtual void end();
+ void update() override;
+
protected:
virtual void onStart();
Commit: e11bc29abcc4f7a8a13f210cf83687377165ce05
https://github.com/scummvm/scummvm/commit/e11bc29abcc4f7a8a13f210cf83687377165ce05
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: increased buffer size (fixes crash in India Location)
Changed paths:
engines/pink/archive.cpp
engines/pink/constants.h
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp
index 16f54b7..2cb607b 100644
--- a/engines/pink/archive.cpp
+++ b/engines/pink/archive.cpp
@@ -319,7 +319,7 @@ uint Archive::findObjectId(const char *name) {
Common::String Archive::readString() {
char buffer[kMaxStringLength];
byte len = _readStream->readByte();
- assert(len <= 64);
+ assert(len <= kMaxStringLength);
_readStream->read(buffer, len);
return Common::String(buffer, len);
}
diff --git a/engines/pink/constants.h b/engines/pink/constants.h
index 8e70f5a..16765ff 100644
--- a/engines/pink/constants.h
+++ b/engines/pink/constants.h
@@ -27,7 +27,7 @@ namespace Pink {
enum {
kMaxClassLength = 32,
- kMaxStringLength = 64,
+ kMaxStringLength = 128,
kNullObject = 0
};
Commit: a7ad5fe86a5f35dd7b47bccabd3e709a563ca3ae
https://github.com/scummvm/scummvm/commit/a7ad5fe86a5f35dd7b47bccabd3e709a563ca3ae
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fixes crash on loading final scene of Passport to Peril(not tested)
Changed paths:
engines/pink/objects/sequences/sequence_item.cpp
diff --git a/engines/pink/objects/sequences/sequence_item.cpp b/engines/pink/objects/sequences/sequence_item.cpp
index c7b5213..dfc4613 100644
--- a/engines/pink/objects/sequences/sequence_item.cpp
+++ b/engines/pink/objects/sequences/sequence_item.cpp
@@ -53,7 +53,6 @@ bool SequenceItem::execute(int index, Sequence *sequence, bool unk2) {
Action *action;
if (!(actor = sequence->_sequencer->_page->findActor(_actor)) ||
!(action = actor->findAction(_action))) {
- assert(0);
return false;
}
Commit: 7528c332240f07b2d6eb5f398e4148b872516fd1
https://github.com/scummvm/scummvm/commit/7528c332240f07b2d6eb5f398e4148b872516fd1
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: updated description of engine. Passport to Peril is now fully playable*
Changed paths:
engines/pink/pink.h
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index 7f993dc..6516d83 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -42,6 +42,22 @@
* Games using this engine:
* - The Pink Panther: Passport to Peril
* - The Pink Panther: Hokus Pokus Pink
+ *
+ * Peril game status:
+ * Fully playable*
+ * (crashes on cutscene before Stonehenge because of strange sprite format.
+ * Currently I use hack which isn't in branch.)
+ *
+ * Pokus game status:
+ * Playable before entering to BlackHole (HandlerTimerSequences)
+ *
+ * Known bugs:
+ * High CPU usage(no dirty rects)
+ * Walking sprites don't recalculate position
+ * Walking can't be skipped
+ * PDA doesn't work
+ * Sprites, which has not zero startFrame start playing with delay
+ *
*/
namespace Pink {
Commit: 0103b904a8394d084fd99d3c62a64723bd8aa3d5
https://github.com/scummvm/scummvm/commit/0103b904a8394d084fd99d3c62a64723bd8aa3d5
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added missing include
Changed paths:
engines/pink/objects/handlers/handler_timer.cpp
diff --git a/engines/pink/objects/handlers/handler_timer.cpp b/engines/pink/objects/handlers/handler_timer.cpp
index 2c478fc..9fe9d8a 100644
--- a/engines/pink/objects/handlers/handler_timer.cpp
+++ b/engines/pink/objects/handlers/handler_timer.cpp
@@ -26,6 +26,7 @@
#include <engines/pink/archive.h>
#include <engines/pink/objects/sequences/sequence.h>
#include <engines/pink/objects/side_effect.h>
+#include <engines/pink/objects/condition.h>
#include <engines/pink/objects/actors/lead_actor.h>
#include <engines/pink/objects/pages/game_page.h>
#include <engines/pink/pink.h>
Commit: 23157a6450dfb95d3200d6405c7524352f110e71
https://github.com/scummvm/scummvm/commit/23157a6450dfb95d3200d6405c7524352f110e71
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix for Pokus game
Changed paths:
engines/pink/objects/sequences/sequence.cpp
diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp
index b956057..577b310 100644
--- a/engines/pink/objects/sequences/sequence.cpp
+++ b/engines/pink/objects/sequences/sequence.cpp
@@ -71,16 +71,12 @@ void Sequence::init(int unk) {
}
void Sequence::start(int unk) {
- if (_context->_nextItemIndex >= _items.size()){
+ if (_context->_nextItemIndex >= _items.size() || !_items[_context->_nextItemIndex]->execute(_context->_index, this, unk)){
debug("Sequence %s ended", _name.c_str());
end();
return;
}
- if (!_items[_context->_nextItemIndex]->execute(_context->_index, this, unk)){
- assert(0);
- }
-
uint i;
for (i = _context->_nextItemIndex + 1; i <_items.size(); ++i){
if (_items[i]->isLeader())
Commit: cdcb8f5ec61b1cb63113d2e78804dc80ddf210c4
https://github.com/scummvm/scummvm/commit/cdcb8f5ec61b1cb63113d2e78804dc80ddf210c4
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: changed size method to empty to improve readability
Changed paths:
engines/pink/objects/handlers/handler_timer.cpp
diff --git a/engines/pink/objects/handlers/handler_timer.cpp b/engines/pink/objects/handlers/handler_timer.cpp
index 9fe9d8a..757790e 100644
--- a/engines/pink/objects/handlers/handler_timer.cpp
+++ b/engines/pink/objects/handlers/handler_timer.cpp
@@ -61,7 +61,7 @@ void HandlerTimerActions::toConsole() {
void HandlerTimerActions::handle(Actor *actor) {
Handler::handle(actor);
- if (!actor->isPlaying() && _actions.size()) {
+ if (!actor->isPlaying() && !_actions.empty()) {
Common::RandomSource &rnd = actor->getPage()->getGame()->getRnd();
uint index = rnd.getRandomNumber(_actions.size() - 1);
Action *action = actor->findAction(_actions[index]);
Commit: ab4980aa59ffafcf54c1f791d9619ad317dda7a7
https://github.com/scummvm/scummvm/commit/ab4980aa59ffafcf54c1f791d9619ad317dda7a7
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added basic implementation of HandlerTimerSequences just to make Hokus Pokus playable after Black Hole
Changed paths:
engines/pink/objects/handlers/handler_timer.cpp
engines/pink/objects/handlers/handler_timer.h
diff --git a/engines/pink/objects/handlers/handler_timer.cpp b/engines/pink/objects/handlers/handler_timer.cpp
index 757790e..b0bfb90 100644
--- a/engines/pink/objects/handlers/handler_timer.cpp
+++ b/engines/pink/objects/handlers/handler_timer.cpp
@@ -29,6 +29,7 @@
#include <engines/pink/objects/condition.h>
#include <engines/pink/objects/actors/lead_actor.h>
#include <engines/pink/objects/pages/game_page.h>
+#include <engines/pink/objects/sequences/sequencer.h>
#include <engines/pink/pink.h>
@@ -94,4 +95,18 @@ void HandlerTimerSequences::toConsole() {
}
}
+void HandlerTimerSequences::handle(Actor *actor) {
+ Handler::handle(actor);
+ Sequencer *sequencer = actor->getSequencer();
+
+ assert(!_sequences.empty());
+
+ Common::RandomSource &rnd = actor->getPage()->getGame()->getRnd();
+ uint index = rnd.getRandomNumber(_sequences.size() - 1);
+
+ Sequence *sequence = sequencer->findSequence(_sequences[index]);
+
+ assert(sequence);
+}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/handlers/handler_timer.h b/engines/pink/objects/handlers/handler_timer.h
index 540c7dc..3f54582 100644
--- a/engines/pink/objects/handlers/handler_timer.h
+++ b/engines/pink/objects/handlers/handler_timer.h
@@ -30,15 +30,15 @@ namespace Pink {
class LeadActor;
-//TODO: in Peril create HandlerTimerActions when it is request for HandlerTimer
-
+/*
// This class has differences in games
class HandlerTimer : public Handler {
};
+*/
//in Peril this is HandlerTimer
-class HandlerTimerActions : public HandlerTimer {
+class HandlerTimerActions : public Handler {
public:
virtual void toConsole();
virtual void deserialize(Archive &archive);
@@ -52,8 +52,11 @@ private:
class HandlerTimerSequences : public HandlerSequences { //originally it was inherited from HandlerTimer
public:
virtual void toConsole();
+
+ virtual void handle(Actor *actor);
+
protected:
- virtual void execute(Sequence *sequence); // very big and hard function
+ virtual void execute(Sequence *sequence);
};
} // End of namespace Pink
Commit: d11115a6aabb36043220b7c5e26e2b8f3a83660b
https://github.com/scummvm/scummvm/commit/d11115a6aabb36043220b7c5e26e2b8f3a83660b
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fixed finding of nullptr Actor
Changed paths:
engines/pink/objects/pages/page.cpp
diff --git a/engines/pink/objects/pages/page.cpp b/engines/pink/objects/pages/page.cpp
index 1c0c67e..33ccf15 100644
--- a/engines/pink/objects/pages/page.cpp
+++ b/engines/pink/objects/pages/page.cpp
@@ -39,10 +39,15 @@ void Page::load(Archive &archive) {
}
Actor *Page::findActor(const Common::String &name) {
- return *Common::find_if(_actors.begin(), _actors.end(), [&name]
+ auto it = Common::find_if(_actors.begin(), _actors.end(), [&name]
(Actor *actor) {
return name == actor->getName();
- });;
+ });
+
+ if (it == _actors.end())
+ return nullptr;
+
+ return *it;
}
Sound *Page::loadSound(Common::String &fileName) {
Commit: c1af0371ee4ab8f8e8dfaf01c590329a4671ec8a
https://github.com/scummvm/scummvm/commit/c1af0371ee4ab8f8e8dfaf01c590329a4671ec8a
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fixed crash in Hokus Pokus
Changed paths:
engines/pink/objects/sequences/seq_timer.cpp
diff --git a/engines/pink/objects/sequences/seq_timer.cpp b/engines/pink/objects/sequences/seq_timer.cpp
index d5029e6..78a5bd5 100644
--- a/engines/pink/objects/sequences/seq_timer.cpp
+++ b/engines/pink/objects/sequences/seq_timer.cpp
@@ -53,7 +53,7 @@ void SeqTimer::update() {
calculateUpdatesCount();
SupportingActor *actor = static_cast<SupportingActor*>(_sequencer->_page->findActor(_actor));
- if (!_sequencer->findSequenceActorState(actor->getName())){
+ if (actor && !_sequencer->findSequenceActorState(actor->getName())){
actor->onTimerMessage();
}
}
Commit: f03d5811ec87b916ea8a7c08ad9c31fa1a292b1f
https://github.com/scummvm/scummvm/commit/f03d5811ec87b916ea8a7c08ad9c31fa1a292b1f
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: updated status of engine
Changed paths:
engines/pink/pink.h
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index 6516d83..ecd8928 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -49,7 +49,8 @@
* Currently I use hack which isn't in branch.)
*
* Pokus game status:
- * Playable before entering to BlackHole (HandlerTimerSequences)
+ * Fully Playable*
+ * sequences by timer are broken (HandlerTimerSequences)
*
* Known bugs:
* High CPU usage(no dirty rects)
Commit: 956643968383f6294ead85cebc506d25e68b4690
https://github.com/scummvm/scummvm/commit/956643968383f6294ead85cebc506d25e68b4690
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fixed sprites which start playing with delay
Changed paths:
engines/pink/cel_decoder.cpp
engines/pink/cel_decoder.h
engines/pink/objects/actions/action_play.cpp
engines/pink/objects/actions/action_still.cpp
engines/pink/pink.h
diff --git a/engines/pink/cel_decoder.cpp b/engines/pink/cel_decoder.cpp
index 39b797b..e143885 100644
--- a/engines/pink/cel_decoder.cpp
+++ b/engines/pink/cel_decoder.cpp
@@ -102,6 +102,11 @@ void CelDecoder::setY(int32 y) {
track->setY(y);
}
+void CelDecoder::skipFrame() {
+ CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
+ track->skipFrame();
+}
+
CelDecoder::CelVideoTrack::CelVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height, bool skipHeader)
: FlicVideoTrack(stream, frameCount, width, height, 1), _center(0,0), _transparentColourIndex(0){
readHeader();
@@ -177,6 +182,34 @@ Common::Rect &CelDecoder::CelVideoTrack::getRect() {
#define FRAME_TYPE 0xF1FA
+void CelDecoder::CelVideoTrack::skipFrame() {
+ // Read chunk
+ /*uint32 frameSize = */ _fileStream->readUint32LE();
+ uint16 frameType = _fileStream->readUint16LE();
+
+ switch (frameType) {
+ case FRAME_TYPE:
+ handleFrame();
+ break;
+ default:
+ error("FlicDecoder::decodeFrame(): unknown main chunk type (type = 0x%02X)", frameType);
+ break;
+ }
+
+ _curFrame++;
+ //_nextFrameStartTime += _frameDelay;
+
+ if (_atRingFrame) {
+ // If we decoded the ring frame, seek to the second frame
+ _atRingFrame = false;
+ _fileStream->seek(_offsetFrame2);
+ }
+
+ if (_curFrame == 0)
+ _transparentColourIndex = *(byte*)_surface->getBasePtr(0,0);
+
+}
+
const Graphics::Surface *CelDecoder::CelVideoTrack::decodeNextFrame() {
// Read chunk
/*uint32 frameSize = */ _fileStream->readUint32LE();
diff --git a/engines/pink/cel_decoder.h b/engines/pink/cel_decoder.h
index d52318b..d49c6e2 100644
--- a/engines/pink/cel_decoder.h
+++ b/engines/pink/cel_decoder.h
@@ -39,6 +39,7 @@ public:
Common::Point getCenter();
Common::Rect &getRectangle();
const Graphics::Surface *getCurrentFrame();
+ void skipFrame();
void setX(int32 x);
void setY(int32 y);
@@ -60,6 +61,7 @@ protected:
void setX(int32 x);
void setY(int32 y);
+ void skipFrame();
private:
const Graphics::Surface *decodeNextFrame();
void readPrefixChunk();
diff --git a/engines/pink/objects/actions/action_play.cpp b/engines/pink/objects/actions/action_play.cpp
index 7749bc6..bf73e8d 100644
--- a/engines/pink/objects/actions/action_play.cpp
+++ b/engines/pink/objects/actions/action_play.cpp
@@ -46,9 +46,10 @@ void ActionPlay::end() {
void ActionPlay::onStart() {
debug("Actor %s has now ActionPlay %s", _actor->getName().c_str(), _name.c_str());
_decoder->start();
- for (int i = 0; i <= _startFrame; ++i) {
- _decoder->decodeNextFrame();
+ for (int i = 0; i < _startFrame; ++i) {
+ _decoder->skipFrame();
}
+ _decoder->decodeNextFrame();
}
void ActionPlay::update() {
diff --git a/engines/pink/objects/actions/action_still.cpp b/engines/pink/objects/actions/action_still.cpp
index fc835f1..f1c26cd 100644
--- a/engines/pink/objects/actions/action_still.cpp
+++ b/engines/pink/objects/actions/action_still.cpp
@@ -45,9 +45,10 @@ void ActionStill::end() {
void ActionStill::onStart() {
debug("Actor %s has now ActionStill %s", _actor->getName().c_str(), _name.c_str());
- for (int i = 0; i <= _startFrame; ++i) {
- _decoder->decodeNextFrame();
+ for (int i = 0; i < _startFrame; ++i) {
+ _decoder->skipFrame();
}
+ _decoder->decodeNextFrame();
_decoder->stop();
_actor->endAction();
}
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index ecd8928..56686fc 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -57,7 +57,6 @@
* Walking sprites don't recalculate position
* Walking can't be skipped
* PDA doesn't work
- * Sprites, which has not zero startFrame start playing with delay
*
*/
Commit: f3ac46e8877fbcfa877ed12d4c9ea9104224ffd3
https://github.com/scummvm/scummvm/commit/f3ac46e8877fbcfa877ed12d4c9ea9104224ffd3
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: renamed method parameters to appropriate names in Condition classes
Changed paths:
engines/pink/objects/condition.cpp
engines/pink/objects/condition.h
diff --git a/engines/pink/objects/condition.cpp b/engines/pink/objects/condition.cpp
index b0e0938..ec9675b 100644
--- a/engines/pink/objects/condition.cpp
+++ b/engines/pink/objects/condition.cpp
@@ -32,40 +32,40 @@ void Pink::ConditionVariable::deserialize(Archive &archive) {
archive >> _name >> _value;
}
-bool Pink::ConditionGameVariable::evaluate(Actor *leadActor) {
- return leadActor->getPage()->getModule()->getGame()->checkValueOfVariable(_name, _value);
+bool Pink::ConditionGameVariable::evaluate(Actor *actor) {
+ return actor->getPage()->getModule()->getGame()->checkValueOfVariable(_name, _value);
}
void ConditionGameVariable::toConsole() {
debug("\t\tConditionGameVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
}
-bool Pink::ConditionModuleVariable::evaluate(Actor *leadActor) {
- return leadActor->getPage()->getModule()->checkValueOfVariable(_name, _value);
+bool Pink::ConditionModuleVariable::evaluate(Actor *actor) {
+ return actor->getPage()->getModule()->checkValueOfVariable(_name, _value);
}
void ConditionModuleVariable::toConsole() {
debug("\t\tConditionModuleVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
}
-bool Pink::ConditionNotModuleVariable::evaluate(Actor *leadActor) {
- return !ConditionModuleVariable::evaluate(leadActor);
+bool Pink::ConditionNotModuleVariable::evaluate(Actor *actor) {
+ return !ConditionModuleVariable::evaluate(actor);
}
void ConditionNotModuleVariable::toConsole() {
debug("\t\tConditionNotModuleVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
}
-bool ConditionPageVariable::evaluate(Actor *leadActor) {
- return leadActor->getPage()->checkValueOfVariable(_name, _value);
+bool ConditionPageVariable::evaluate(Actor *actor) {
+ return actor->getPage()->checkValueOfVariable(_name, _value);
}
void ConditionPageVariable::toConsole() {
debug("\t\tConditionPageVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
}
-bool ConditionNotPageVariable::evaluate(Actor *leadActor) {
- return !ConditionPageVariable::evaluate(leadActor);
+bool ConditionNotPageVariable::evaluate(Actor *actor) {
+ return !ConditionPageVariable::evaluate(actor);
}
void ConditionNotPageVariable::toConsole() {
@@ -76,8 +76,8 @@ void ConditionInventoryItemOwner::deserialize(Archive &archive) {
archive >> _item >> _owner;
}
-bool ConditionInventoryItemOwner::evaluate(Actor *leadActor) {
- InventoryMgr *mgr = leadActor->getPage()->getModule()->getInventoryMgr();
+bool ConditionInventoryItemOwner::evaluate(Actor *actor) {
+ InventoryMgr *mgr = actor->getPage()->getModule()->getInventoryMgr();
InventoryItem *item = mgr->findInventoryItem(_item);
return item->getCurrentOwner() == _owner;
}
@@ -86,8 +86,8 @@ void ConditionInventoryItemOwner::toConsole() {
debug("\t\tConditionInventoryItemOwner: _item=%s, _owner=%s", _item.c_str(), _owner.c_str());
}
-bool ConditionNotInventoryItemOwner::evaluate(Actor *leadActor) {
- return !ConditionInventoryItemOwner::evaluate(leadActor);
+bool ConditionNotInventoryItemOwner::evaluate(Actor *actor) {
+ return !ConditionInventoryItemOwner::evaluate(actor);
}
void ConditionNotInventoryItemOwner::toConsole() {
diff --git a/engines/pink/objects/condition.h b/engines/pink/objects/condition.h
index 3ab1ff0..8f3b976 100644
--- a/engines/pink/objects/condition.h
+++ b/engines/pink/objects/condition.h
@@ -32,7 +32,7 @@ class LeadActor;
class Condition : public Object {
public:
virtual void deserialize(Archive &archive) = 0;
- virtual bool evaluate(Actor *leadActor) = 0;
+ virtual bool evaluate(Actor *actor) = 0;
};
class ConditionVariable : public Condition {
Commit: d54c2a68cb45cadbc43d94e58bbcb73c8cb297c6
https://github.com/scummvm/scummvm/commit/d54c2a68cb45cadbc43d94e58bbcb73c8cb297c6
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fixed forward declaration
Changed paths:
engines/pink/objects/condition.h
diff --git a/engines/pink/objects/condition.h b/engines/pink/objects/condition.h
index 8f3b976..e9c9fd4 100644
--- a/engines/pink/objects/condition.h
+++ b/engines/pink/objects/condition.h
@@ -27,7 +27,7 @@
namespace Pink {
-class LeadActor;
+class Actor;
class Condition : public Object {
public:
Commit: 3411750a1ce0a78826a38b88124ec2e3d580f776
https://github.com/scummvm/scummvm/commit/3411750a1ce0a78826a38b88124ec2e3d580f776
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: removed single-line function from SeqTimer
Changed paths:
engines/pink/objects/sequences/seq_timer.cpp
engines/pink/objects/sequences/seq_timer.h
diff --git a/engines/pink/objects/sequences/seq_timer.cpp b/engines/pink/objects/sequences/seq_timer.cpp
index 78a5bd5..26c8afa 100644
--- a/engines/pink/objects/sequences/seq_timer.cpp
+++ b/engines/pink/objects/sequences/seq_timer.cpp
@@ -31,9 +31,7 @@
namespace Pink {
SeqTimer::SeqTimer()
- : _updatesToMessage(0) {
-
-}
+ : _updatesToMessage(0) {}
void SeqTimer::deserialize(Archive &archive) {
archive >> _actor;
@@ -47,20 +45,18 @@ void SeqTimer::toConsole() {
}
void SeqTimer::update() {
- Common::RandomSource &random =_sequencer->_page->getGame()->getRnd();
+ Common::RandomSource &rnd =_sequencer->_page->getGame()->getRnd();
if (_updatesToMessage--)
return;
- calculateUpdatesCount();
- SupportingActor *actor = static_cast<SupportingActor*>(_sequencer->_page->findActor(_actor));
+ _updatesToMessage = _range ? _period + rnd.getRandomNumber(_range) : _period;
+
+ SupportingActor *actor = static_cast<SupportingActor*>(_sequencer->_page->findActor(_actor));
if (actor && !_sequencer->findSequenceActorState(actor->getName())){
actor->onTimerMessage();
}
}
-void SeqTimer::calculateUpdatesCount() {
- Common::RandomSource &random =_sequencer->_page->getGame()->getRnd();
- _updatesToMessage = _range ? _period + random.getRandomNumber(_range) : _period;
-}
+
} // End of namespace Pink
\ No newline at end of file
diff --git a/engines/pink/objects/sequences/seq_timer.h b/engines/pink/objects/sequences/seq_timer.h
index 0b961c0..5970d2a 100644
--- a/engines/pink/objects/sequences/seq_timer.h
+++ b/engines/pink/objects/sequences/seq_timer.h
@@ -34,12 +34,9 @@ public:
SeqTimer();
virtual void deserialize(Archive &archive);
virtual void toConsole();
-
virtual void update();
-
private:
- void calculateUpdatesCount();
Common::String _actor;
Sequencer *_sequencer;
int _period;
Commit: 38ff5b1e801fda7fdc3c818469cfda5cb27f9937
https://github.com/scummvm/scummvm/commit/38ff5b1e801fda7fdc3c818469cfda5cb27f9937
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: remove bug from description
Changed paths:
engines/pink/pink.h
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index 56686fc..17d266f 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -45,8 +45,6 @@
*
* Peril game status:
* Fully playable*
- * (crashes on cutscene before Stonehenge because of strange sprite format.
- * Currently I use hack which isn't in branch.)
*
* Pokus game status:
* Fully Playable*
Commit: 39ed15d2f700575ad68c638808f9cf07dc786ec1
https://github.com/scummvm/scummvm/commit/39ed15d2f700575ad68c638808f9cf07dc786ec1
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix includes
Changed paths:
engines/pink/archive.cpp
engines/pink/archive.h
engines/pink/cel_decoder.cpp
engines/pink/cel_decoder.h
engines/pink/cursor_mgr.cpp
engines/pink/cursor_mgr.h
engines/pink/detection.cpp
engines/pink/detection_tables.h
engines/pink/director.cpp
engines/pink/director.h
engines/pink/file.cpp
engines/pink/file.h
engines/pink/objects/actions/action.cpp
engines/pink/objects/actions/action.h
engines/pink/objects/actions/action_cel.cpp
engines/pink/objects/actions/action_cel.h
engines/pink/objects/actions/action_hide.cpp
engines/pink/objects/actions/action_hide.h
engines/pink/objects/actions/action_loop.cpp
engines/pink/objects/actions/action_loop.h
engines/pink/objects/actions/action_play.cpp
engines/pink/objects/actions/action_play.h
engines/pink/objects/actions/action_play_with_sfx.cpp
engines/pink/objects/actions/action_play_with_sfx.h
engines/pink/objects/actions/action_sound.cpp
engines/pink/objects/actions/action_sound.h
engines/pink/objects/actions/action_still.cpp
engines/pink/objects/actions/action_still.h
engines/pink/objects/actions/action_talk.cpp
engines/pink/objects/actions/action_talk.h
engines/pink/objects/actions/action_text.cpp
engines/pink/objects/actions/action_text.h
engines/pink/objects/actions/walk_action.cpp
engines/pink/objects/actions/walk_action.h
engines/pink/objects/actors/actor.cpp
engines/pink/objects/actors/actor.h
engines/pink/objects/actors/audio_info_pda_button.h
engines/pink/objects/actors/cursor_actor.h
engines/pink/objects/actors/inventory_actor.h
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/actors/lead_actor.h
engines/pink/objects/actors/pda_button_actor.cpp
engines/pink/objects/actors/pda_button_actor.h
engines/pink/objects/actors/supporting_actor.cpp
engines/pink/objects/actors/supporting_actor.h
engines/pink/objects/condition.cpp
engines/pink/objects/condition.h
engines/pink/objects/handlers/handler.cpp
engines/pink/objects/handlers/handler.h
engines/pink/objects/handlers/handler_mgr.cpp
engines/pink/objects/handlers/handler_mgr.h
engines/pink/objects/handlers/handler_timer.cpp
engines/pink/objects/handlers/handler_timer.h
engines/pink/objects/inventory.cpp
engines/pink/objects/inventory.h
engines/pink/objects/module.cpp
engines/pink/objects/module.h
engines/pink/objects/object.cpp
engines/pink/objects/object.h
engines/pink/objects/pages/game_page.cpp
engines/pink/objects/pages/game_page.h
engines/pink/objects/pages/page.cpp
engines/pink/objects/pages/page.h
engines/pink/objects/sequences/seq_timer.cpp
engines/pink/objects/sequences/seq_timer.h
engines/pink/objects/sequences/sequence.cpp
engines/pink/objects/sequences/sequence.h
engines/pink/objects/sequences/sequence_context.cpp
engines/pink/objects/sequences/sequence_context.h
engines/pink/objects/sequences/sequence_item.cpp
engines/pink/objects/sequences/sequence_item.h
engines/pink/objects/sequences/sequencer.cpp
engines/pink/objects/sequences/sequencer.h
engines/pink/objects/side_effect.cpp
engines/pink/objects/side_effect.h
engines/pink/objects/walk/walk_location.cpp
engines/pink/objects/walk/walk_location.h
engines/pink/objects/walk/walk_mgr.cpp
engines/pink/objects/walk/walk_mgr.h
engines/pink/objects/walk/walk_shortest_path.cpp
engines/pink/objects/walk/walk_shortest_path.h
engines/pink/pink.cpp
engines/pink/pink.h
engines/pink/resource_mgr.cpp
engines/pink/resource_mgr.h
engines/pink/sound.cpp
engines/pink/sound.h
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp
index 2cb607b..6b442ae 100644
--- a/engines/pink/archive.cpp
+++ b/engines/pink/archive.cpp
@@ -20,33 +20,31 @@
*
*/
-#include <common/debug.h>
-#include <common/file.h>
-#include <engines/pink/objects/object.h>
-#include <engines/pink/objects/module.h>
-#include <engines/pink/objects/pages/game_page.h>
-#include <engines/pink/objects/actors/lead_actor.h>
-#include <engines/pink/objects/condition.h>
-#include <engines/pink/objects/side_effect.h>
-#include <engines/pink/objects/sequences/sequence_item.h>
-#include <engines/pink/objects/sequences/sequence.h>
-#include <engines/pink/objects/handlers/handler.h>
-#include <engines/pink/objects/actions/action_play.h>
-#include <engines/pink/objects/actions/action_sound.h>
-#include <engines/pink/objects/actions/action_hide.h>
-#include <engines/pink/objects/walk/walk_location.h>
-#include <engines/pink/objects/actions/walk_action.h>
-#include <engines/pink/objects/actors/supporting_actor.h>
-#include <engines/pink/objects/sequences/seq_timer.h>
-#include <engines/pink/objects/actions/action_loop.h>
-#include <engines/pink/objects/actions/action_play_with_sfx.h>
-#include <engines/pink/objects/actions/action_talk.h>
-#include <engines/pink/objects/actions/action_text.h>
-#include <engines/pink/objects/actors/cursor_actor.h>
-#include <engines/pink/objects/handlers/handler_timer.h>
-#include <engines/pink/objects/actors/inventory_actor.h>
-#include <engines/pink/objects/actors/audio_info_pda_button.h>
-#include <engines/pink/objects/actors/pda_button_actor.h>
+#include "common/debug.h"
+#include "common/file.h"
+
+#include "pink/objects/condition.h"
+#include "pink/objects/module.h"
+#include "pink/objects/side_effect.h"
+#include "pink/objects/actions/action_hide.h"
+#include "pink/objects/actions/action_play_with_sfx.h"
+#include "pink/objects/actions/action_sound.h"
+#include "pink/objects/actions/action_talk.h"
+#include "pink/objects/actions/action_text.h"
+#include "pink/objects/actions/walk_action.h"
+#include "pink/objects/actors/audio_info_pda_button.h"
+#include "pink/objects/actors/cursor_actor.h"
+#include "pink/objects/actors/inventory_actor.h"
+#include "pink/objects/actors/lead_actor.h"
+#include "pink/objects/actors/pda_button_actor.h"
+#include "pink/objects/actors/supporting_actor.h"
+#include "pink/objects/handlers/handler.h"
+#include "pink/objects/handlers/handler_timer.h"
+#include "pink/objects/pages/game_page.h"
+#include "pink/objects/sequences/seq_timer.h"
+#include "pink/objects/sequences/sequence.h"
+#include "pink/objects/sequences/sequence_item.h"
+#include "pink/objects/walk/walk_location.h"
namespace Pink {
diff --git a/engines/pink/archive.h b/engines/pink/archive.h
index b74b0f5..6b74c14 100644
--- a/engines/pink/archive.h
+++ b/engines/pink/archive.h
@@ -23,10 +23,11 @@
#ifndef PINK_ARCHIVE_H
#define PINK_ARCHIVE_H
-#include <engines/pink/objects/object.h>
-#include <common/str-array.h>
-#include "common/stream.h"
#include "common/hash-str.h"
+#include "common/str-array.h"
+#include "common/stream.h"
+
+#include "pink/objects/object.h"
namespace Common {
diff --git a/engines/pink/cel_decoder.cpp b/engines/pink/cel_decoder.cpp
index e143885..ad0a7ac 100644
--- a/engines/pink/cel_decoder.cpp
+++ b/engines/pink/cel_decoder.cpp
@@ -20,9 +20,11 @@
*
*/
-#include <common/stream.h>
-#include <graphics/surface.h>
-#include "cel_decoder.h"
+#include "common/stream.h"
+
+#include "graphics/surface.h"
+
+#include "pink/cel_decoder.h"
namespace Pink {
diff --git a/engines/pink/cel_decoder.h b/engines/pink/cel_decoder.h
index d49c6e2..7ae9129 100644
--- a/engines/pink/cel_decoder.h
+++ b/engines/pink/cel_decoder.h
@@ -23,8 +23,7 @@
#ifndef PINK_CEL_DECODER_H
#define PINK_CEL_DECODER_H
-
-#include <video/flic_decoder.h>
+#include "video/flic_decoder.h"
namespace Pink {
diff --git a/engines/pink/cursor_mgr.cpp b/engines/pink/cursor_mgr.cpp
index 00259b7..b42ef74 100644
--- a/engines/pink/cursor_mgr.cpp
+++ b/engines/pink/cursor_mgr.cpp
@@ -20,12 +20,12 @@
*
*/
-#include <engines/pink/objects/actors/actor.h>
-#include <engines/pink/objects/actions/action_cel.h>
-#include <engines/pink/cel_decoder.h>
-#include "cursor_mgr.h"
-#include "pink.h"
-#include "objects/pages/game_page.h"
+#include "pink/pink.h"
+#include "pink/cel_decoder.h"
+#include "pink/cursor_mgr.h"
+#include "pink/objects/actions/action_cel.h"
+#include "pink/objects/actors/actor.h"
+#include "pink/objects/pages/game_page.h"
namespace Pink {
diff --git a/engines/pink/cursor_mgr.h b/engines/pink/cursor_mgr.h
index 1a0094d..c873010 100644
--- a/engines/pink/cursor_mgr.h
+++ b/engines/pink/cursor_mgr.h
@@ -23,9 +23,11 @@
#ifndef PINK_CURSOR_MGR_H
#define PINK_CURSOR_MGR_H
-#include <graphics/wincursor.h>
-#include <engines/pink/objects/object.h>
-#include <common/rect.h>
+#include "common/rect.h"
+
+#include "graphics/wincursor.h"
+
+#include "pink/objects/object.h"
namespace Pink {
diff --git a/engines/pink/detection.cpp b/engines/pink/detection.cpp
index d3a7a08..546dd21 100644
--- a/engines/pink/detection.cpp
+++ b/engines/pink/detection.cpp
@@ -20,9 +20,9 @@
*
*/
-#include <gui/EventRecorder.h>
-#include "pink.h"
+#include "gui/EventRecorder.h"
+#include "pink/pink.h"
static const PlainGameDescriptor pinkGames[] = {
{"peril", "The Pink Panther: Passport to Peril"},
diff --git a/engines/pink/detection_tables.h b/engines/pink/detection_tables.h
index a59e4e3..5d31233 100644
--- a/engines/pink/detection_tables.h
+++ b/engines/pink/detection_tables.h
@@ -23,7 +23,7 @@
#ifndef PINK_DETECTION_TABLES_H
#define PINK_DETECTION_TABLES_H
-#include <gui/EventRecorder.h>
+#include "gui/EventRecorder.h"
namespace Pink {
diff --git a/engines/pink/director.cpp b/engines/pink/director.cpp
index d92269e..fb5a034 100644
--- a/engines/pink/director.cpp
+++ b/engines/pink/director.cpp
@@ -20,12 +20,13 @@
*
*/
-#include "director.h"
-#include <engines/pink/objects/actions/action_sound.h>
-#include <engines/pink/objects/actions/action_cel.h>
-#include <graphics/managed_surface.h>
+#include "graphics/managed_surface.h"
#include "graphics/palette.h"
-#include "cel_decoder.h"
+
+#include "pink/cel_decoder.h"
+#include "pink/director.h"
+#include "pink/objects/actions/action_sound.h"
+#include "pink/objects/actions/action_cel.h"
namespace Pink {
Director::Director(OSystem *system)
diff --git a/engines/pink/director.h b/engines/pink/director.h
index 2fc042c..c2decd0 100644
--- a/engines/pink/director.h
+++ b/engines/pink/director.h
@@ -23,9 +23,9 @@
#ifndef PINK_DIRECTOR_H
#define PINK_DIRECTOR_H
-#include <common/array.h>
-#include <common/system.h>
-#include <common/rect.h>
+#include "common/array.h"
+#include "common/rect.h"
+#include "common/system.h"
namespace Pink {
diff --git a/engines/pink/file.cpp b/engines/pink/file.cpp
index 8db4542..9067b72 100644
--- a/engines/pink/file.cpp
+++ b/engines/pink/file.cpp
@@ -20,9 +20,10 @@
*
*/
-#include <common/str.h>
-#include "engines/pink/objects/pages/game_page.h"
-#include "pink.h"
+#include "common/str.h"
+
+#include "pink/pink.h"
+#include "pink/objects/pages/game_page.h"
namespace Pink {
diff --git a/engines/pink/file.h b/engines/pink/file.h
index 0e78eeb..dbcfaae 100644
--- a/engines/pink/file.h
+++ b/engines/pink/file.h
@@ -23,7 +23,7 @@
#ifndef PINK_FILE_H
#define PINK_FILE_H
-#include <common/file.h>
+#include "common/file.h"
namespace Pink {
diff --git a/engines/pink/objects/actions/action.cpp b/engines/pink/objects/actions/action.cpp
index 0853e37..c639883 100644
--- a/engines/pink/objects/actions/action.cpp
+++ b/engines/pink/objects/actions/action.cpp
@@ -20,9 +20,9 @@
*
*/
-#include "action.h"
-#include "engines/pink/objects/actors/actor.h"
-#include "engines/pink/archive.h"
+#include "pink/archive.h"
+#include "pink/objects/actions/action.h"
+#include "pink/objects/actors/actor.h"
namespace Pink {
diff --git a/engines/pink/objects/actions/action.h b/engines/pink/objects/actions/action.h
index ae3b083..0d57fbb 100644
--- a/engines/pink/objects/actions/action.h
+++ b/engines/pink/objects/actions/action.h
@@ -23,7 +23,7 @@
#ifndef PINK_ACTION_H
#define PINK_ACTION_H
-#include "engines/pink/objects/object.h"
+#include "pink/objects/object.h"
namespace Pink {
diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp
index 33e8823..e878c3e 100644
--- a/engines/pink/objects/actions/action_cel.cpp
+++ b/engines/pink/objects/actions/action_cel.cpp
@@ -20,14 +20,14 @@
*
*/
-#include <common/debug.h>
-#include "action_cel.h"
-#include <pink/objects/actors/actor.h>
-#include <graphics/surface.h>
-#include "engines/pink/archive.h"
-#include "engines/pink/objects/pages/game_page.h"
-#include "pink/pink.h"
+#include "common/debug.h"
+
+#include "pink/archive.h"
#include "pink/cel_decoder.h"
+#include "pink/pink.h"
+#include "pink/objects/actions/action_cel.h"
+#include "pink/objects/actors/actor.h"
+#include "pink/objects/pages/game_page.h"
namespace Pink {
diff --git a/engines/pink/objects/actions/action_cel.h b/engines/pink/objects/actions/action_cel.h
index a86eadc..937c23b 100644
--- a/engines/pink/objects/actions/action_cel.h
+++ b/engines/pink/objects/actions/action_cel.h
@@ -23,8 +23,7 @@
#ifndef PINK_ACTION_CEL_H
#define PINK_ACTION_CEL_H
-#include <video/flic_decoder.h>
-#include "action.h"
+#include "pink/objects/actions/action.h"
namespace Pink {
diff --git a/engines/pink/objects/actions/action_hide.cpp b/engines/pink/objects/actions/action_hide.cpp
index ed2c903..6678d93 100644
--- a/engines/pink/objects/actions/action_hide.cpp
+++ b/engines/pink/objects/actions/action_hide.cpp
@@ -20,10 +20,9 @@
*
*/
-#include "action_hide.h"
-#include "engines/pink/objects/actors/actor.h"
-#include <engines/pink/archive.h>
-
+#include "pink/archive.h"
+#include "pink/objects/actions/action_hide.h"
+#include "pink/objects/actors/actor.h"
namespace Pink {
diff --git a/engines/pink/objects/actions/action_hide.h b/engines/pink/objects/actions/action_hide.h
index bc62a5f..a7c23a4 100644
--- a/engines/pink/objects/actions/action_hide.h
+++ b/engines/pink/objects/actions/action_hide.h
@@ -23,7 +23,7 @@
#ifndef PINK_ACTION_HIDE_H
#define PINK_ACTION_HIDE_H
-#include "action.h"
+#include "pink/objects/actions/action.h"
namespace Pink {
diff --git a/engines/pink/objects/actions/action_loop.cpp b/engines/pink/objects/actions/action_loop.cpp
index b9e8600..2c46b61 100644
--- a/engines/pink/objects/actions/action_loop.cpp
+++ b/engines/pink/objects/actions/action_loop.cpp
@@ -20,11 +20,10 @@
*
*/
-
-#include "action_loop.h"
-#include <pink/archive.h>
-#include <pink/objects/actors/actor.h>
-#include <pink/cel_decoder.h>
+#include "pink/archive.h"
+#include "pink/cel_decoder.h"
+#include "pink/objects/actions/action_loop.h"
+#include "pink/objects/actors/actor.h"
namespace Pink {
diff --git a/engines/pink/objects/actions/action_loop.h b/engines/pink/objects/actions/action_loop.h
index b8f5be3..12c9e2d 100644
--- a/engines/pink/objects/actions/action_loop.h
+++ b/engines/pink/objects/actions/action_loop.h
@@ -23,7 +23,7 @@
#ifndef PINK_ACTION_LOOP_H
#define PINK_ACTION_LOOP_H
-#include "action_play.h"
+#include "pink/objects/actions/action_play.h"
namespace Pink {
diff --git a/engines/pink/objects/actions/action_play.cpp b/engines/pink/objects/actions/action_play.cpp
index bf73e8d..8c0be27 100644
--- a/engines/pink/objects/actions/action_play.cpp
+++ b/engines/pink/objects/actions/action_play.cpp
@@ -20,11 +20,12 @@
*
*/
-#include <common/debug.h>
-#include "action_play.h"
-#include "../actors/actor.h"
-#include "engines/pink/archive.h"
+#include "common/debug.h"
+
+#include "pink/archive.h"
#include "pink/cel_decoder.h"
+#include "pink/objects/actions/action_play.h"
+#include "pink/objects/actors/actor.h"
namespace Pink {
diff --git a/engines/pink/objects/actions/action_play.h b/engines/pink/objects/actions/action_play.h
index 1d519a8..83318b0 100644
--- a/engines/pink/objects/actions/action_play.h
+++ b/engines/pink/objects/actions/action_play.h
@@ -23,8 +23,7 @@
#ifndef PINK_ACTION_PLAY_H
#define PINK_ACTION_PLAY_H
-#include "action.h"
-#include "action_still.h"
+#include "pink/objects/actions/action_still.h"
namespace Pink {
diff --git a/engines/pink/objects/actions/action_play_with_sfx.cpp b/engines/pink/objects/actions/action_play_with_sfx.cpp
index a724dab..b43b498 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.cpp
+++ b/engines/pink/objects/actions/action_play_with_sfx.cpp
@@ -20,11 +20,11 @@
*
*/
-#include "action_play_with_sfx.h"
-#include <pink/objects/pages/game_page.h>
-#include <pink/sound.h>
-#include <pink/objects/actors/actor.h>
-#include <pink/cel_decoder.h>
+#include "pink/cel_decoder.h"
+#include "pink/sound.h"
+#include "pink/objects/actors/actor.h"
+#include "pink/objects/actions/action_play_with_sfx.h"
+#include "pink/objects/pages/game_page.h"
namespace Pink {
diff --git a/engines/pink/objects/actions/action_play_with_sfx.h b/engines/pink/objects/actions/action_play_with_sfx.h
index 9a1b069..44b3342 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.h
+++ b/engines/pink/objects/actions/action_play_with_sfx.h
@@ -23,8 +23,9 @@
#ifndef PINK_ACTION_PLAY_WITH_SFX_H
#define PINK_ACTION_PLAY_WITH_SFX_H
-#include <common/array.h>
-#include "action_play.h"
+#include "common/array.h"
+
+#include "pink/objects/actions/action_play.h"
namespace Pink {
diff --git a/engines/pink/objects/actions/action_sound.cpp b/engines/pink/objects/actions/action_sound.cpp
index af14fce..a125ec0 100644
--- a/engines/pink/objects/actions/action_sound.cpp
+++ b/engines/pink/objects/actions/action_sound.cpp
@@ -20,14 +20,14 @@
*
*/
-#include <common/debug.h>
-#include "action_sound.h"
-#include "engines/pink/archive.h"
-#include <engines/pink/objects/actors/actor.h>
-#include <engines/pink/objects/pages/game_page.h>
-#include <engines/pink/sound.h>
-#include "engines/pink/pink.h"
-
+#include "common/debug.h"
+
+#include "pink/archive.h"
+#include "pink/pink.h"
+#include "pink/sound.h"
+#include "pink/objects/actions/action_sound.h"
+#include "pink/objects/actors/actor.h"
+#include "pink/objects/pages/game_page.h"
namespace Pink {
diff --git a/engines/pink/objects/actions/action_sound.h b/engines/pink/objects/actions/action_sound.h
index e96c41d..0fb39bb 100644
--- a/engines/pink/objects/actions/action_sound.h
+++ b/engines/pink/objects/actions/action_sound.h
@@ -23,7 +23,7 @@
#ifndef PINK_ACTION_SOUND_H
#define PINK_ACTION_SOUND_H
-#include "action.h"
+#include "pink/objects/actions/action.h"
namespace Pink {
diff --git a/engines/pink/objects/actions/action_still.cpp b/engines/pink/objects/actions/action_still.cpp
index f1c26cd..acc0a2e 100644
--- a/engines/pink/objects/actions/action_still.cpp
+++ b/engines/pink/objects/actions/action_still.cpp
@@ -20,11 +20,12 @@
*
*/
-#include <common/debug.h>
-#include "action_still.h"
-#include "engines/pink/archive.h"
-#include <engines/pink/objects/actors/actor.h>
+#include "common/debug.h"
+
+#include "pink/archive.h"
#include "pink/cel_decoder.h"
+#include "pink/objects/actions/action_still.h"
+#include "pink/objects/actors/actor.h"
namespace Pink {
diff --git a/engines/pink/objects/actions/action_still.h b/engines/pink/objects/actions/action_still.h
index 7568c9b..cef3967 100644
--- a/engines/pink/objects/actions/action_still.h
+++ b/engines/pink/objects/actions/action_still.h
@@ -23,7 +23,7 @@
#ifndef PINK_ACTION_STILL_H
#define PINK_ACTION_STILL_H
-#include "action_cel.h"
+#include "pink/objects/actions/action_cel.h"
namespace Pink {
diff --git a/engines/pink/objects/actions/action_talk.cpp b/engines/pink/objects/actions/action_talk.cpp
index 09dc972..644e143 100644
--- a/engines/pink/objects/actions/action_talk.cpp
+++ b/engines/pink/objects/actions/action_talk.cpp
@@ -19,13 +19,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
-
-#include "action_talk.h"
-#include <pink/archive.h>
-#include <pink/objects/actors/actor.h>
-#include <pink/objects/pages/game_page.h>
-#include <pink/cel_decoder.h>
-#include <pink/sound.h>
+
+#include "pink/archive.h"
+#include "pink/cel_decoder.h"
+#include "pink/sound.h"
+#include "pink/objects/actions/action_talk.h"
+#include "pink/objects/actors/actor.h"
+#include "pink/objects/pages/game_page.h"
namespace Pink {
diff --git a/engines/pink/objects/actions/action_talk.h b/engines/pink/objects/actions/action_talk.h
index bbe16eb..77e8d90 100644
--- a/engines/pink/objects/actions/action_talk.h
+++ b/engines/pink/objects/actions/action_talk.h
@@ -23,7 +23,7 @@
#ifndef PINK_ACTION_TALK_H
#define PINK_ACTION_TALK_H
-#include <engines/pink/objects/actions/action_loop.h>
+#include "pink/objects/actions/action_loop.h"
namespace Pink {
diff --git a/engines/pink/objects/actions/action_text.cpp b/engines/pink/objects/actions/action_text.cpp
index eaf1611..034aa1d 100644
--- a/engines/pink/objects/actions/action_text.cpp
+++ b/engines/pink/objects/actions/action_text.cpp
@@ -20,9 +20,10 @@
*
*/
-#include "action_text.h"
-#include <pink/archive.h>
-#include <common/debug.h>
+#include "common/debug.h"
+
+#include "pink/archive.h"
+#include "pink/objects/actions/action_text.h"
namespace Pink {
diff --git a/engines/pink/objects/actions/action_text.h b/engines/pink/objects/actions/action_text.h
index e988254..2215949 100644
--- a/engines/pink/objects/actions/action_text.h
+++ b/engines/pink/objects/actions/action_text.h
@@ -23,7 +23,7 @@
#ifndef PINK_ACTION_TEXT_H
#define PINK_ACTION_TEXT_H
-#include "action.h"
+#include "pink/objects/actions/action.h"
namespace Pink {
diff --git a/engines/pink/objects/actions/walk_action.cpp b/engines/pink/objects/actions/walk_action.cpp
index 9c5dac5..42ce90e 100644
--- a/engines/pink/objects/actions/walk_action.cpp
+++ b/engines/pink/objects/actions/walk_action.cpp
@@ -20,9 +20,9 @@
*
*/
-#include "walk_action.h"
-#include <engines/pink/archive.h>
+#include "pink/archive.h"
#include "pink/cel_decoder.h"
+#include "pink/objects/actions/walk_action.h"
namespace Pink {
diff --git a/engines/pink/objects/actions/walk_action.h b/engines/pink/objects/actions/walk_action.h
index f74adb8..21926ab 100644
--- a/engines/pink/objects/actions/walk_action.h
+++ b/engines/pink/objects/actions/walk_action.h
@@ -23,7 +23,7 @@
#ifndef PINK_WALK_ACTION_H
#define PINK_WALK_ACTION_H
-#include "action_cel.h"
+#include "pink/objects/actions/action_cel.h"
namespace Pink {
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index 776a403..3bfd1eb 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -20,12 +20,12 @@
*
*/
-#include <engines/pink/constants.h>
-#include "actor.h"
-#include "engines/pink/objects/pages/game_page.h"
-#include "lead_actor.h"
-#include "engines/pink/objects/actions/action.h"
+#include "pink/constants.h"
#include "pink/cursor_mgr.h"
+#include "pink/objects/actions/action.h"
+#include "pink/objects/actors/actor.h"
+#include "pink/objects/actors/lead_actor.h"
+#include "pink/objects/pages/game_page.h"
namespace Pink {
diff --git a/engines/pink/objects/actors/actor.h b/engines/pink/objects/actors/actor.h
index 2c56e81..4992a75 100644
--- a/engines/pink/objects/actors/actor.h
+++ b/engines/pink/objects/actors/actor.h
@@ -23,9 +23,10 @@
#ifndef PINK_ACTOR_H
#define PINK_ACTOR_H
-#include <common/array.h>
-#include <common/rect.h>
-#include "engines/pink/objects/object.h"
+#include "common/array.h"
+#include "common/rect.h"
+
+#include "pink/objects/object.h"
namespace Pink {
diff --git a/engines/pink/objects/actors/audio_info_pda_button.h b/engines/pink/objects/actors/audio_info_pda_button.h
index f869596..f27f70a 100644
--- a/engines/pink/objects/actors/audio_info_pda_button.h
+++ b/engines/pink/objects/actors/audio_info_pda_button.h
@@ -23,11 +23,12 @@
#ifndef PINK_AUDIO_INFO_PDA_BUTTON_H
#define PINK_AUDIO_INFO_PDA_BUTTON_H
-#include <common/debug.h>
-#include <pink/objects/actions/action.h>
-#include <engines/pink/constants.h>
-#include <engines/pink/cursor_mgr.h>
-#include "actor.h"
+#include "common/debug.h"
+
+#include "pink/constants.h"
+#include "pink/cursor_mgr.h"
+#include "pink/objects/actions/action.h"
+#include "pink/objects/actors/actor.h"
namespace Pink {
diff --git a/engines/pink/objects/actors/cursor_actor.h b/engines/pink/objects/actors/cursor_actor.h
index 32e433f..8e0005a 100644
--- a/engines/pink/objects/actors/cursor_actor.h
+++ b/engines/pink/objects/actors/cursor_actor.h
@@ -23,9 +23,10 @@
#ifndef PINK_CURSOR_ACTOR_H
#define PINK_CURSOR_ACTOR_H
-#include <common/debug.h>
-#include <pink/objects/actions/action.h>
-#include "actor.h"
+#include "common/debug.h"
+
+#include "pink/objects/actions/action.h"
+#include "pink/objects/actors/actor.h"
namespace Pink {
diff --git a/engines/pink/objects/actors/inventory_actor.h b/engines/pink/objects/actors/inventory_actor.h
index 55dd83b..3f9c1ec 100644
--- a/engines/pink/objects/actors/inventory_actor.h
+++ b/engines/pink/objects/actors/inventory_actor.h
@@ -23,9 +23,10 @@
#ifndef PINK_INVENTORY_ACTOR_H
#define PINK_INVENTORY_ACTOR_H
-#include <pink/objects/actions/action.h>
-#include <common/debug.h>
-#include "actor.h"
+#include "common/debug.h"
+
+#include "pink/objects/actions/action.h"
+#include "pink/objects/actors/actor.h"
namespace Pink {
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index cb87a24..5de351b 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -20,16 +20,16 @@
*
*/
-#include "lead_actor.h"
-#include <engines/pink/objects/actions/action.h>
-#include <engines/pink/objects/sequences/sequence_context.h>
-#include "engines/pink/objects/walk/walk_mgr.h"
-#include "engines/pink/cursor_mgr.h"
-#include "engines/pink/objects/sequences/sequencer.h"
-#include "engines/pink/archive.h"
-#include "engines/pink/objects/pages/game_page.h"
-#include "engines/pink/pink.h"
-#include "supporting_actor.h"
+#include "pink/archive.h"
+#include "pink/cursor_mgr.h"
+#include "pink/pink.h"
+#include "pink/objects/actions/action.h"
+#include "pink/objects/actors/supporting_actor.h"
+#include "pink/objects/actors/lead_actor.h"
+#include "pink/objects/pages/game_page.h"
+#include "pink/objects/sequences/sequence_context.h"
+#include "pink/objects/sequences/sequencer.h"
+#include "pink/objects/walk/walk_mgr.h"
namespace Pink {
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index 977096b..b6f91ac 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -23,10 +23,10 @@
#ifndef PINK_LEAD_ACTOR_H
#define PINK_LEAD_ACTOR_H
-#include <common/keyboard.h>
-#include <common/rect.h>
-#include "actor.h"
+#include "common/rect.h"
+#include "common/keyboard.h"
+#include "pink/objects/actors/actor.h"
namespace Pink {
diff --git a/engines/pink/objects/actors/pda_button_actor.cpp b/engines/pink/objects/actors/pda_button_actor.cpp
index 8ccaf60..18e29a6 100644
--- a/engines/pink/objects/actors/pda_button_actor.cpp
+++ b/engines/pink/objects/actors/pda_button_actor.cpp
@@ -20,8 +20,8 @@
*
*/
-#include "pda_button_actor.h"
#include "pink/archive.h"
+#include "pink/objects/actors/pda_button_actor.h"
namespace Pink {
diff --git a/engines/pink/objects/actors/pda_button_actor.h b/engines/pink/objects/actors/pda_button_actor.h
index f1e244f..b3a6d20 100644
--- a/engines/pink/objects/actors/pda_button_actor.h
+++ b/engines/pink/objects/actors/pda_button_actor.h
@@ -23,7 +23,7 @@
#ifndef PINK_PDA_BUTTON_ACTOR_H
#define PINK_PDA_BUTTON_ACTOR_H
-#include "actor.h"
+#include "pink/objects/actors/actor.h"
namespace Pink {
diff --git a/engines/pink/objects/actors/supporting_actor.cpp b/engines/pink/objects/actors/supporting_actor.cpp
index 9d6b2d7..5fd575d 100644
--- a/engines/pink/objects/actors/supporting_actor.cpp
+++ b/engines/pink/objects/actors/supporting_actor.cpp
@@ -20,12 +20,12 @@
*
*/
-#include "supporting_actor.h"
-#include <engines/pink/archive.h>
-#include <engines/pink/objects/actions/action.h>
-#include <engines/pink/constants.h>
+#include "pink/archive.h"
+#include "pink/constants.h"
#include "pink/cursor_mgr.h"
-#include "../inventory.h"
+#include "pink/objects/inventory.h"
+#include "pink/objects/actions/action.h"
+#include "pink/objects/actors/supporting_actor.h"
namespace Pink {
diff --git a/engines/pink/objects/actors/supporting_actor.h b/engines/pink/objects/actors/supporting_actor.h
index 4c8b6cf..eecee3a 100644
--- a/engines/pink/objects/actors/supporting_actor.h
+++ b/engines/pink/objects/actors/supporting_actor.h
@@ -23,8 +23,8 @@
#ifndef PINK_SUPPORTING_ACTOR_H
#define PINK_SUPPORTING_ACTOR_H
-#include <engines/pink/objects/handlers/handler_mgr.h>
-#include "actor.h"
+#include "pink/objects/actors/actor.h"
+#include "pink/objects/handlers/handler_mgr.h"
namespace Pink {
diff --git a/engines/pink/objects/condition.cpp b/engines/pink/objects/condition.cpp
index ec9675b..3de8605 100644
--- a/engines/pink/objects/condition.cpp
+++ b/engines/pink/objects/condition.cpp
@@ -20,11 +20,11 @@
*
*/
-#include <engines/pink/archive.h>
-#include <engines/pink/objects/actors/lead_actor.h>
-#include <engines/pink/objects/pages/game_page.h>
-#include <engines/pink/pink.h>
-#include "condition.h"
+#include "pink/archive.h"
+#include "pink/pink.h"
+#include "pink/objects/condition.h"
+#include "pink/objects/actors/lead_actor.h"
+#include "pink/objects/pages/game_page.h"
namespace Pink {
diff --git a/engines/pink/objects/condition.h b/engines/pink/objects/condition.h
index e9c9fd4..4b48d83 100644
--- a/engines/pink/objects/condition.h
+++ b/engines/pink/objects/condition.h
@@ -23,7 +23,7 @@
#ifndef PINK_CONDITION_H
#define PINK_CONDITION_H
-#include <engines/pink/objects/object.h>
+#include "pink/objects/object.h"
namespace Pink {
diff --git a/engines/pink/objects/handlers/handler.cpp b/engines/pink/objects/handlers/handler.cpp
index dd24925..cd55d5a 100644
--- a/engines/pink/objects/handlers/handler.cpp
+++ b/engines/pink/objects/handlers/handler.cpp
@@ -20,15 +20,15 @@
*
*/
-#include "handler.h"
-#include "engines/pink/archive.h"
-#include "engines/pink/objects/side_effect.h"
-#include <engines/pink/objects/condition.h>
-#include <engines/pink/objects/sequences/sequencer.h>
-#include <engines/pink/objects/sequences/sequence.h>
-#include <engines/pink/objects/actors/lead_actor.h>
-#include <engines/pink/objects/pages/game_page.h>
-#include <engines/pink/pink.h>
+#include "pink/archive.h"
+#include "pink/pink.h"
+#include "pink/objects/side_effect.h"
+#include "pink/objects/condition.h"
+#include "pink/objects/actors/actor.h"
+#include "pink/objects/handlers/handler.h"
+#include "pink/objects/pages/game_page.h"
+#include "pink/objects/sequences/sequencer.h"
+#include "pink/objects/sequences/sequence.h"
namespace Pink {
diff --git a/engines/pink/objects/handlers/handler.h b/engines/pink/objects/handlers/handler.h
index bf1f26b..769a4c3 100644
--- a/engines/pink/objects/handlers/handler.h
+++ b/engines/pink/objects/handlers/handler.h
@@ -23,10 +23,9 @@
#ifndef PINK_HANDLER_H
#define PINK_HANDLER_H
-#include <common/array.h>
-#include <common/str-array.h>
-#include <engines/pink/objects/object.h>
+#include "common/str-array.h"
+#include "pink/objects/object.h"
namespace Pink {
diff --git a/engines/pink/objects/handlers/handler_mgr.cpp b/engines/pink/objects/handlers/handler_mgr.cpp
index caa5582..f11c728 100644
--- a/engines/pink/objects/handlers/handler_mgr.cpp
+++ b/engines/pink/objects/handlers/handler_mgr.cpp
@@ -20,10 +20,10 @@
*
*/
-#include "handler_mgr.h"
-#include "handler.h"
-#include <pink/archive.h>
-#include <pink/objects/inventory.h>
+#include "pink/archive.h"
+#include "pink/objects/inventory.h"
+#include "pink/objects/handlers/handler.h"
+#include "pink/objects/handlers/handler_mgr.h"
namespace Pink {
diff --git a/engines/pink/objects/handlers/handler_mgr.h b/engines/pink/objects/handlers/handler_mgr.h
index 48de703..f9a0739 100644
--- a/engines/pink/objects/handlers/handler_mgr.h
+++ b/engines/pink/objects/handlers/handler_mgr.h
@@ -23,8 +23,9 @@
#ifndef PINK_HANDLER_MGR_H
#define PINK_HANDLER_MGR_H
-#include <engines/pink/objects/object.h>
-#include <common/array.h>
+#include "common/array.h"
+
+#include "pink/objects/object.h"
namespace Pink {
diff --git a/engines/pink/objects/handlers/handler_timer.cpp b/engines/pink/objects/handlers/handler_timer.cpp
index b0bfb90..18818ab 100644
--- a/engines/pink/objects/handlers/handler_timer.cpp
+++ b/engines/pink/objects/handlers/handler_timer.cpp
@@ -20,18 +20,17 @@
*
*/
-
-#include "handler_timer.h"
-#include <common/debug.h>
-#include <engines/pink/archive.h>
-#include <engines/pink/objects/sequences/sequence.h>
-#include <engines/pink/objects/side_effect.h>
-#include <engines/pink/objects/condition.h>
-#include <engines/pink/objects/actors/lead_actor.h>
-#include <engines/pink/objects/pages/game_page.h>
-#include <engines/pink/objects/sequences/sequencer.h>
-#include <engines/pink/pink.h>
-
+#include "common/debug.h"
+
+#include "pink/archive.h"
+#include "pink/pink.h"
+#include "pink/objects/side_effect.h"
+#include "pink/objects/condition.h"
+#include "pink/objects/actors/lead_actor.h"
+#include "pink/objects/handlers/handler_timer.h"
+#include "pink/objects/pages/game_page.h"
+#include "pink/objects/sequences/sequence.h"
+#include "pink/objects/sequences/sequencer.h"
namespace Pink {
diff --git a/engines/pink/objects/handlers/handler_timer.h b/engines/pink/objects/handlers/handler_timer.h
index 3f54582..737804f 100644
--- a/engines/pink/objects/handlers/handler_timer.h
+++ b/engines/pink/objects/handlers/handler_timer.h
@@ -23,8 +23,9 @@
#ifndef PINK_HANDLER_TIMER_H
#define PINK_HANDLER_TIMER_H
-#include <common/str-array.h>
-#include "handler.h"
+#include "common/str-array.h"
+
+#include "pink/objects/handlers/handler.h"
namespace Pink {
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
index 6d13f8a..66dbd40 100644
--- a/engines/pink/objects/inventory.cpp
+++ b/engines/pink/objects/inventory.cpp
@@ -21,14 +21,15 @@
*/
-#include <common/debug.h>
-#include "inventory.h"
-#include "engines/pink/archive.h"
-#include "pink/objects/actors/lead_actor.h"
-#include "pink/objects/actions/action.h"
-#include "pink/objects/pages/game_page.h"
+#include "common/debug.h"
+
+#include "pink/archive.h"
#include "pink/director.h"
#include "pink/pink.h"
+#include "pink/objects/inventory.h"
+#include "pink/objects/actions/action.h"
+#include "pink/objects/actors/lead_actor.h"
+#include "pink/objects/pages/game_page.h"
namespace Pink {
diff --git a/engines/pink/objects/inventory.h b/engines/pink/objects/inventory.h
index d5953eb..8cb4f0a 100644
--- a/engines/pink/objects/inventory.h
+++ b/engines/pink/objects/inventory.h
@@ -23,10 +23,10 @@
#ifndef PINK_INVENTORY_H
#define PINK_INVENTORY_H
+#include "common/array.h"
+#include "common/rect.h"
-#include <common/array.h>
-#include <common/rect.h>
-#include "engines/pink/objects/object.h"
+#include "pink/objects/object.h"
namespace Pink {
diff --git a/engines/pink/objects/module.cpp b/engines/pink/objects/module.cpp
index 46ea8e1..0d60778 100644
--- a/engines/pink/objects/module.cpp
+++ b/engines/pink/objects/module.cpp
@@ -20,9 +20,9 @@
*
*/
-#include "module.h"
-#include "engines/pink/objects/pages/game_page.h"
#include "pink/pink.h"
+#include "pink/objects/module.h"
+#include "pink/objects/pages/game_page.h"
namespace Pink {
diff --git a/engines/pink/objects/module.h b/engines/pink/objects/module.h
index 2824191..c19571b 100644
--- a/engines/pink/objects/module.h
+++ b/engines/pink/objects/module.h
@@ -23,11 +23,12 @@
#ifndef PINK_MODULE_H
#define PINK_MODULE_H
-#include "engines/pink/archive.h"
-#include "engines/pink/objects/object.h"
-#include <common/debug.h>
-#include <common/hash-str.h>
-#include "engines/pink/objects/inventory.h"
+#include "common/debug.h"
+#include "common/hash-str.h"
+
+#include "pink/archive.h"
+#include "pink/objects/object.h"
+#include "pink/objects/inventory.h"
namespace Pink {
diff --git a/engines/pink/objects/object.cpp b/engines/pink/objects/object.cpp
index eac48bd..d123aaf 100644
--- a/engines/pink/objects/object.cpp
+++ b/engines/pink/objects/object.cpp
@@ -20,9 +20,10 @@
*
*/
-#include <common/debug.h>
-#include "object.h"
-#include "engines/pink/archive.h"
+#include "common/debug.h"
+
+#include "pink/archive.h"
+#include "pink/objects/object.h"
namespace Pink {
diff --git a/engines/pink/objects/object.h b/engines/pink/objects/object.h
index 1f67c3d..f2301df 100644
--- a/engines/pink/objects/object.h
+++ b/engines/pink/objects/object.h
@@ -23,7 +23,7 @@
#ifndef PINK_OBJECT_H
#define PINK_OBJECT_H
-#include <common/str.h>
+#include "common/str.h"
namespace Pink {
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index 63a2607..2ac88fb 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -20,13 +20,13 @@
*
*/
-#include <engines/pink/objects/handlers/handler.h>
-#include "game_page.h"
-#include <engines/pink/objects/walk/walk_mgr.h>
-#include "engines/pink/cursor_mgr.h"
-#include "engines/pink/objects/actors/lead_actor.h"
-#include "engines/pink/objects/sequences/sequencer.h"
+#include "pink/cursor_mgr.h"
#include "pink/pink.h"
+#include "pink/objects/actors/lead_actor.h"
+#include "pink/objects/handlers/handler.h"
+#include "pink/objects/pages/game_page.h"
+#include "pink/objects/sequences/sequencer.h"
+#include "pink/objects/walk/walk_mgr.h"
namespace Pink {
diff --git a/engines/pink/objects/pages/game_page.h b/engines/pink/objects/pages/game_page.h
index 469d1b3..9aa5422 100644
--- a/engines/pink/objects/pages/game_page.h
+++ b/engines/pink/objects/pages/game_page.h
@@ -23,8 +23,9 @@
#ifndef PINK_GAME_PAGE_H
#define PINK_GAME_PAGE_H
-#include <common/memstream.h>
-#include "page.h"
+#include "common/memstream.h"
+
+#include "pink/objects/pages/page.h"
namespace Pink {
diff --git a/engines/pink/objects/pages/page.cpp b/engines/pink/objects/pages/page.cpp
index 33ccf15..f2b8bb4 100644
--- a/engines/pink/objects/pages/page.cpp
+++ b/engines/pink/objects/pages/page.cpp
@@ -20,10 +20,9 @@
*
*/
-#include "page.h"
-#include "engines/pink/objects/actors/lead_actor.h"
-#include "engines/pink/director.h"
-
+#include "pink/director.h"
+#include "pink/objects/actors/lead_actor.h"
+#include "pink/objects/pages/page.h"
namespace Pink {
diff --git a/engines/pink/objects/pages/page.h b/engines/pink/objects/pages/page.h
index 23b060c..c6d8220 100644
--- a/engines/pink/objects/pages/page.h
+++ b/engines/pink/objects/pages/page.h
@@ -23,10 +23,8 @@
#ifndef PINK_PAGE_H
#define PINK_PAGE_H
-#include <video/flic_decoder.h>
-#include "engines/pink/objects/object.h"
-#include "engines/pink/objects/module.h"
-#include "engines/pink/resource_mgr.h"
+#include "pink/resource_mgr.h"
+#include "pink/objects/module.h"
namespace Pink {
diff --git a/engines/pink/objects/sequences/seq_timer.cpp b/engines/pink/objects/sequences/seq_timer.cpp
index 26c8afa..c8d166a 100644
--- a/engines/pink/objects/sequences/seq_timer.cpp
+++ b/engines/pink/objects/sequences/seq_timer.cpp
@@ -20,13 +20,14 @@
*
*/
-#include "seq_timer.h"
-#include <engines/pink/archive.h>
-#include "./sequencer.h"
-#include <common/debug.h>
-#include <engines/pink/objects/actors/supporting_actor.h>
-#include "pink/objects/pages/game_page.h"
+#include "common/debug.h"
+
+#include "pink/archive.h"
#include "pink/pink.h"
+#include "pink/objects/actors/supporting_actor.h"
+#include "pink/objects/pages/game_page.h"
+#include "pink/objects/sequences/seq_timer.h"
+#include "pink/objects/sequences/sequencer.h"
namespace Pink {
diff --git a/engines/pink/objects/sequences/seq_timer.h b/engines/pink/objects/sequences/seq_timer.h
index 5970d2a..bfd6295 100644
--- a/engines/pink/objects/sequences/seq_timer.h
+++ b/engines/pink/objects/sequences/seq_timer.h
@@ -23,7 +23,7 @@
#ifndef PINK_SEQ_TIMER_H
#define PINK_SEQ_TIMER_H
-#include <engines/pink/objects/object.h>
+#include "pink/objects/object.h"
namespace Pink {
diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp
index 577b310..c41d225 100644
--- a/engines/pink/objects/sequences/sequence.cpp
+++ b/engines/pink/objects/sequences/sequence.cpp
@@ -20,15 +20,16 @@
*
*/
-#include <common/debug.h>
-#include "sequence_item.h"
-#include "sequence.h"
-#include "sequencer.h"
-#include "engines/pink/archive.h"
-#include "engines/pink/objects/pages/game_page.h"
-#include "engines/pink/objects/actors/actor.h"
-#include "sequence_context.h"
+#include "common/debug.h"
+
+#include "pink/archive.h"
#include "pink/sound.h"
+#include "pink/objects/actors/actor.h"
+#include "pink/objects/pages/game_page.h"
+#include "pink/objects/sequences/sequence.h"
+#include "pink/objects/sequences/sequence_context.h"
+#include "pink/objects/sequences/sequence_item.h"
+#include "pink/objects/sequences/sequencer.h"
namespace Pink {
diff --git a/engines/pink/objects/sequences/sequence.h b/engines/pink/objects/sequences/sequence.h
index 5db00b4..2cbdff4 100644
--- a/engines/pink/objects/sequences/sequence.h
+++ b/engines/pink/objects/sequences/sequence.h
@@ -23,8 +23,9 @@
#ifndef PINK_SEQUENCE_H
#define PINK_SEQUENCE_H
-#include <engines/pink/objects/object.h>
-#include <common/array.h>
+#include "common/array.h"
+
+#include "pink/objects/object.h"
namespace Pink {
diff --git a/engines/pink/objects/sequences/sequence_context.cpp b/engines/pink/objects/sequences/sequence_context.cpp
index 675e567..01b76a8 100644
--- a/engines/pink/objects/sequences/sequence_context.cpp
+++ b/engines/pink/objects/sequences/sequence_context.cpp
@@ -20,13 +20,14 @@
*
*/
-#include <common/debug.h>
-#include "sequence_context.h"
-#include "sequence.h"
-#include "sequence_item.h"
-#include "sequencer.h"
-#include "engines/pink/objects/pages/game_page.h"
-#include "engines/pink/objects/actors/actor.h"
+#include "common/debug.h"
+
+#include "pink/objects/actors/actor.h"
+#include "pink/objects/pages/game_page.h"
+#include "pink/objects/sequences/sequence.h"
+#include "pink/objects/sequences/sequence_context.h"
+#include "pink/objects/sequences/sequence_item.h"
+#include "pink/objects/sequences/sequencer.h"
namespace Pink {
diff --git a/engines/pink/objects/sequences/sequence_context.h b/engines/pink/objects/sequences/sequence_context.h
index f35f5e4..11b43bb 100644
--- a/engines/pink/objects/sequences/sequence_context.h
+++ b/engines/pink/objects/sequences/sequence_context.h
@@ -23,7 +23,7 @@
#ifndef PINK_SEQUENCE_CONTEXT_H
#define PINK_SEQUENCE_CONTEXT_H
-#include <common/array.h>
+#include "common/array.h"
namespace Pink {
diff --git a/engines/pink/objects/sequences/sequence_item.cpp b/engines/pink/objects/sequences/sequence_item.cpp
index dfc4613..a6574b1 100644
--- a/engines/pink/objects/sequences/sequence_item.cpp
+++ b/engines/pink/objects/sequences/sequence_item.cpp
@@ -20,15 +20,16 @@
*
*/
-#include "sequence_item.h"
-#include <common/debug.h>
-#include <engines/pink/objects/sequences/sequence.h>
-#include <engines/pink/objects/sequences/sequencer.h>
-#include <engines/pink/objects/actions/action.h>
-#include "engines/pink/archive.h"
-#include "engines/pink/objects/pages/game_page.h"
-#include "engines/pink/objects/actors/actor.h"
-#include "sequence_context.h"
+#include "common/debug.h"
+
+#include "pink/archive.h"
+#include "pink/objects/actions/action.h"
+#include "pink/objects/actors/actor.h"
+#include "pink/objects/pages/game_page.h"
+#include "pink/objects/sequences/sequence_item.h"
+#include "pink/objects/sequences/sequence.h"
+#include "pink/objects/sequences/sequencer.h"
+#include "pink/objects/sequences/sequence_context.h"
namespace Pink {
diff --git a/engines/pink/objects/sequences/sequence_item.h b/engines/pink/objects/sequences/sequence_item.h
index 0563310..dd026a8 100644
--- a/engines/pink/objects/sequences/sequence_item.h
+++ b/engines/pink/objects/sequences/sequence_item.h
@@ -23,7 +23,7 @@
#ifndef PINK_SEQUENCE_ITEM_H
#define PINK_SEQUENCE_ITEM_H
-#include <engines/pink/objects/object.h>
+#include "pink/objects/object.h"
namespace Pink {
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index e0a1f5f..349f7ad 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -20,15 +20,15 @@
*
*/
+#include "common/debug.h"
-#include <common/debug.h>
-#include "sequencer.h"
-#include "sequence.h"
-#include "sequence_context.h"
+#include "pink/archive.h"
+#include "pink/pink.h"
#include "pink/objects/actors/actor.h"
-#include "engines/pink/archive.h"
#include "pink/objects/pages/game_page.h"
-#include "pink/pink.h"
+#include "pink/objects/sequences/sequencer.h"
+#include "pink/objects/sequences/sequence.h"
+#include "pink/objects/sequences/sequence_context.h"
#include "pink/objects/sequences/seq_timer.h"
namespace Pink {
diff --git a/engines/pink/objects/sequences/sequencer.h b/engines/pink/objects/sequences/sequencer.h
index 6ae5550..850649d 100644
--- a/engines/pink/objects/sequences/sequencer.h
+++ b/engines/pink/objects/sequences/sequencer.h
@@ -20,12 +20,12 @@
*
*/
-
#ifndef PINK_SEQUENCER_H
#define PINK_SEQUENCER_H
-#include <common/array.h>
-#include "engines/pink/objects/object.h"
+#include "common/array.h"
+
+#include "pink/objects/object.h"
namespace Pink {
diff --git a/engines/pink/objects/side_effect.cpp b/engines/pink/objects/side_effect.cpp
index 7cdb2c9..ec0f24e 100644
--- a/engines/pink/objects/side_effect.cpp
+++ b/engines/pink/objects/side_effect.cpp
@@ -20,15 +20,15 @@
*
*/
-#include <common/hash-str.h>
-#include "side_effect.h"
-#include <engines/pink/archive.h>
-#include <engines/pink/objects/actors/lead_actor.h>
-#include <engines/pink/objects/pages/game_page.h>
-#include <engines/pink/pink.h>
-#include <engines/pink/objects/walk/walk_location.h>
-#include <engines/pink/objects/walk/walk_mgr.h>
-
+#include "common/hash-str.h"
+
+#include "pink/archive.h"
+#include "pink/pink.h"
+#include "pink/objects/side_effect.h"
+#include "pink/objects/actors/lead_actor.h"
+#include "pink/objects/pages/game_page.h"
+#include "pink/objects/walk/walk_location.h"
+#include "pink/objects/walk/walk_mgr.h"
namespace Pink {
diff --git a/engines/pink/objects/side_effect.h b/engines/pink/objects/side_effect.h
index b184eb6..da6d548 100644
--- a/engines/pink/objects/side_effect.h
+++ b/engines/pink/objects/side_effect.h
@@ -23,8 +23,9 @@
#ifndef PINK_SIDE_EFFECT_H
#define PINK_SIDE_EFFECT_H
-#include <engines/pink/objects/object.h>
-#include <common/str-array.h>
+#include "common/str-array.h"
+
+#include "pink/objects/object.h"
namespace Pink {
diff --git a/engines/pink/objects/walk/walk_location.cpp b/engines/pink/objects/walk/walk_location.cpp
index c4b56d9..9ef6a7f 100644
--- a/engines/pink/objects/walk/walk_location.cpp
+++ b/engines/pink/objects/walk/walk_location.cpp
@@ -20,9 +20,10 @@
*
*/
-#include <common/debug.h>
-#include "walk_location.h"
-#include "engines/pink/archive.h"
+#include "common/debug.h"
+
+#include "pink/archive.h"
+#include "pink/objects/walk/walk_location.h"
namespace Pink {
diff --git a/engines/pink/objects/walk/walk_location.h b/engines/pink/objects/walk/walk_location.h
index 19674a1..3de0390 100644
--- a/engines/pink/objects/walk/walk_location.h
+++ b/engines/pink/objects/walk/walk_location.h
@@ -22,10 +22,9 @@
#ifndef PINK_WALK_LOCATION_H
#define PINK_WALK_LOCATION_H
-#include <engines/pink/objects/object.h>
-#include <common/array.h>
-#include <common/str-array.h>
+#include "common/str-array.h"
+#include "pink/objects/object.h"
namespace Pink {
diff --git a/engines/pink/objects/walk/walk_mgr.cpp b/engines/pink/objects/walk/walk_mgr.cpp
index b87429d..ed6cb39 100644
--- a/engines/pink/objects/walk/walk_mgr.cpp
+++ b/engines/pink/objects/walk/walk_mgr.cpp
@@ -20,12 +20,12 @@
*
*/
-#include "walk_mgr.h"
-#include "walk_location.h"
-#include "engines/pink/objects/actions/walk_action.h"
-#include "engines/pink/objects/actors/lead_actor.h"
-#include "engines/pink/archive.h"
+#include "pink/archive.h"
#include "pink/cel_decoder.h"
+#include "pink/objects/actions/walk_action.h"
+#include "pink/objects/actors/lead_actor.h"
+#include "pink/objects/walk/walk_mgr.h"
+#include "pink/objects/walk/walk_location.h"
namespace Pink {
diff --git a/engines/pink/objects/walk/walk_mgr.h b/engines/pink/objects/walk/walk_mgr.h
index 403cc7e..522dcf8 100644
--- a/engines/pink/objects/walk/walk_mgr.h
+++ b/engines/pink/objects/walk/walk_mgr.h
@@ -23,9 +23,10 @@
#ifndef PINK_WALK_MGR_H
#define PINK_WALK_MGR_H
-#include <common/array.h>
-#include "engines/pink/objects/object.h"
-#include "walk_shortest_path.h"
+#include "common/array.h"
+
+#include "pink/objects/object.h"
+#include "pink/objects/walk/walk_shortest_path.h"
namespace Pink {
diff --git a/engines/pink/objects/walk/walk_shortest_path.cpp b/engines/pink/objects/walk/walk_shortest_path.cpp
index 4c6f84a..2148d4c 100644
--- a/engines/pink/objects/walk/walk_shortest_path.cpp
+++ b/engines/pink/objects/walk/walk_shortest_path.cpp
@@ -20,9 +20,9 @@
*
*/
-#include "walk_shortest_path.h"
-#include "walk_mgr.h"
-#include "walk_location.h"
+#include "pink/objects/walk/walk_location.h"
+#include "pink/objects/walk/walk_mgr.h"
+#include "pink/objects/walk/walk_shortest_path.h"
namespace Pink {
diff --git a/engines/pink/objects/walk/walk_shortest_path.h b/engines/pink/objects/walk/walk_shortest_path.h
index 8b7dc80..3b9734f 100644
--- a/engines/pink/objects/walk/walk_shortest_path.h
+++ b/engines/pink/objects/walk/walk_shortest_path.h
@@ -23,7 +23,7 @@
#ifndef PINK_WALK_SHORTEST_PATH_H
#define PINK_WALK_SHORTEST_PATH_H
-#include <common/array.h>
+#include "common/array.h"
namespace Pink {
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index 81c1c48..56166b0 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -20,18 +20,20 @@
*
*/
-#include "pink.h"
-#include "console.h"
-#include <engines/util.h>
-#include <common/debug-channels.h>
-#include <video/flic_decoder.h>
-#include "engines/pink/objects/module.h"
-#include "engines/pink/objects/actors/lead_actor.h"
-#include <graphics/surface.h>
-#include <graphics/cursorman.h>
-#include <common/winexe_pe.h>
-#include <common/config-manager.h>
+#include "common/debug-channels.h"
+#include "common/winexe_pe.h"
+#include "common/config-manager.h"
+#include "engines/util.h"
+
+#include "graphics/cursorman.h"
+
+#include "pink/pink.h"
+#include "pink/console.h"
+#include "pink/objects/side_effect.h"
+#include "pink/objects/module.h"
+#include "pink/objects/actors/lead_actor.h"
+#include "pink/objects/sequences/sequencer.h"
namespace Pink {
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index 17d266f..634adcd 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -23,14 +23,18 @@
#ifndef PINK_PINK_H
#define PINK_PINK_H
-#include <graphics/wincursor.h>
#include "common/random.h"
+
#include "engines/engine.h"
+
+#include "graphics/wincursor.h"
+
#include "gui/EventRecorder.h"
#include "gui/debugger.h"
-#include "file.h"
-#include "director.h"
-#include "constants.h"
+
+#include "pink/constants.h"
+#include "pink/director.h"
+#include "pink/file.h"
/*
* This is the namespace of the Pink engine.
diff --git a/engines/pink/resource_mgr.cpp b/engines/pink/resource_mgr.cpp
index b3c9636..bbf7e7e 100644
--- a/engines/pink/resource_mgr.cpp
+++ b/engines/pink/resource_mgr.cpp
@@ -20,15 +20,14 @@
*
*/
-#include <video/flic_decoder.h>
-#include <common/substream.h>
-#include <graphics/surface.h>
-#include "resource_mgr.h"
-#include "file.h"
-#include "pink.h"
-#include "sound.h"
-#include "engines/pink/objects/pages/game_page.h"
-#include "cel_decoder.h"
+#include "common/substream.h"
+
+#include "pink/cel_decoder.h"
+#include "pink/file.h"
+#include "pink/pink.h"
+#include "pink/resource_mgr.h"
+#include "pink/sound.h"
+#include "pink/objects/pages/game_page.h"
namespace Pink {
diff --git a/engines/pink/resource_mgr.h b/engines/pink/resource_mgr.h
index ff451aa..4cef651 100644
--- a/engines/pink/resource_mgr.h
+++ b/engines/pink/resource_mgr.h
@@ -20,13 +20,11 @@
*
*/
-#include <common/scummsys.h>
-#include <common/substream.h>
-
#ifndef PINK_RESOURCE_MGR_H
#define PINK_RESOURCE_MGR_H
namespace Common {
+ class SafeSeekableSubReadStream;
class String;
}
diff --git a/engines/pink/sound.cpp b/engines/pink/sound.cpp
index 7077d16..6fbd5fc 100644
--- a/engines/pink/sound.cpp
+++ b/engines/pink/sound.cpp
@@ -20,12 +20,13 @@
*
*/
-#include <audio/audiostream.h>
-#include <audio/decoders/wave.h>
-#include <audio/decoders/adpcm.h>
-#include <common/substream.h>
-#include "sound.h"
-#include "constants.h"
+#include "audio/audiostream.h"
+#include "audio/decoders/wave.h"
+
+#include "common/substream.h"
+
+#include "pink/constants.h"
+#include "pink/sound.h"
namespace Pink {
diff --git a/engines/pink/sound.h b/engines/pink/sound.h
index e1074d2..f6207f4 100644
--- a/engines/pink/sound.h
+++ b/engines/pink/sound.h
@@ -23,9 +23,10 @@
#ifndef PINK_SOUND_H
#define PINK_SOUND_H
-#include <common/stream.h>
-#include <audio/mixer.h>
-#include <common/substream.h>
+#include "audio/mixer.h"
+
+#include "common/stream.h"
+#include "common/substream.h"
namespace Pink {
Commit: 8733e54cd413819f87cb470e6c645d1320a54bf2
https://github.com/scummvm/scummvm/commit/8733e54cd413819f87cb470e6c645d1320a54bf2
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: remove the use of auto variables
Changed paths:
engines/pink/archive.h
engines/pink/objects/actors/actor.cpp
engines/pink/objects/inventory.cpp
engines/pink/objects/pages/page.cpp
engines/pink/objects/sequences/sequence.cpp
engines/pink/objects/walk/walk_mgr.cpp
engines/pink/objects/walk/walk_shortest_path.cpp
diff --git a/engines/pink/archive.h b/engines/pink/archive.h
index 6b74c14..f12c3e5 100644
--- a/engines/pink/archive.h
+++ b/engines/pink/archive.h
@@ -143,10 +143,10 @@ inline Archive &operator<<(Archive &archive, Common::StringArray &array){
inline Archive &operator<<(Archive &archive, Common::StringMap &map){
archive.writeWORD(map.size());
- for (auto &pair : map) {
- archive.writeString(pair._key);
- archive.writeString(pair._value);
- }
+ for (Common::StringMap::const_iterator it = map.begin(); it != map.end(); ++it) {
+ archive.writeString(it->_key);
+ archive.writeString(it->_value);
+ }
return archive;
}
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index 3bfd1eb..189e531 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -47,13 +47,12 @@ Sequencer *Actor::getSequencer() const {
}
Action *Actor::findAction(const Common::String &name) {
- auto action = Common::find_if(_actions.begin(), _actions.end(), [&name]
- (Action* action) {
- return name == action->getName();
- });
- if (action == _actions.end())
- return nullptr;
- return *action;
+ for (uint i = 0; i < _actions.size(); ++i) {
+ if (_actions[i]->getName() == name) {
+ return _actions[i];
+ }
+ }
+ return nullptr;
}
GamePage *Actor::getPage() const {
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
index 66dbd40..d62530c 100644
--- a/engines/pink/objects/inventory.cpp
+++ b/engines/pink/objects/inventory.cpp
@@ -63,11 +63,12 @@ void InventoryMgr::deserialize(Archive &archive) {
}
InventoryItem *InventoryMgr::findInventoryItem(const Common::String &name) {
- auto it = Common::find_if(_items.begin(), _items.end(), [&name]
- (InventoryItem *item) {
- return name == item->getName();
- });;
- return it != _items.end() ? *it : nullptr;
+ for (uint i = 0; i < _items.size(); ++i) {
+ if (_items[i]->getName() == name) {
+ return _items[i];
+ }
+ }
+ return nullptr;
}
void InventoryMgr::setLeadActor(LeadActor *lead) {
diff --git a/engines/pink/objects/pages/page.cpp b/engines/pink/objects/pages/page.cpp
index f2b8bb4..9c923e2 100644
--- a/engines/pink/objects/pages/page.cpp
+++ b/engines/pink/objects/pages/page.cpp
@@ -38,15 +38,12 @@ void Page::load(Archive &archive) {
}
Actor *Page::findActor(const Common::String &name) {
- auto it = Common::find_if(_actors.begin(), _actors.end(), [&name]
- (Actor *actor) {
- return name == actor->getName();
- });
-
- if (it == _actors.end())
- return nullptr;
-
- return *it;
+ for (uint i = 0; i < _actors.size(); ++i) {
+ if (_actors[i]->getName() == name) {
+ return _actors[i];
+ }
+ }
+ return nullptr;
}
Sound *Page::loadSound(Common::String &fileName) {
diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp
index c41d225..b2cc5e7 100644
--- a/engines/pink/objects/sequences/sequence.cpp
+++ b/engines/pink/objects/sequences/sequence.cpp
@@ -153,7 +153,7 @@ void SequenceAudio::start(int unk) {
Sequence::start(unk);
int index = _context->getNextItemIndex();
if (index < _items.size()) {
- auto leaderAudio = (SequenceItemLeaderAudio*) _items[index];
+ SequenceItemLeaderAudio* leaderAudio = (SequenceItemLeaderAudio*) _items[index];
_sample = leaderAudio->getSample();
}
}
diff --git a/engines/pink/objects/walk/walk_mgr.cpp b/engines/pink/objects/walk/walk_mgr.cpp
index ed6cb39..eb2ce5e 100644
--- a/engines/pink/objects/walk/walk_mgr.cpp
+++ b/engines/pink/objects/walk/walk_mgr.cpp
@@ -41,10 +41,12 @@ void WalkMgr::deserialize(Pink::Archive &archive) {
}
WalkLocation *WalkMgr::findLocation(const Common::String &name) {
- auto it = Common::find_if(_locations.begin(), _locations.end(), [&name](WalkLocation *location) {
- return location->getName() == name;
- });
- return (it != _locations.end()) ? *it : nullptr;
+ for (uint i = 0; i < _locations.size(); ++i) {
+ if (_locations[i]->getName() == name) {
+ return _locations[i];
+ }
+ }
+ return nullptr;
}
void WalkMgr::toConsole() {
diff --git a/engines/pink/objects/walk/walk_shortest_path.cpp b/engines/pink/objects/walk/walk_shortest_path.cpp
index 2148d4c..ca07da9 100644
--- a/engines/pink/objects/walk/walk_shortest_path.cpp
+++ b/engines/pink/objects/walk/walk_shortest_path.cpp
@@ -91,7 +91,7 @@ void WalkShortestPath::addLocationsToVisit() {
double WalkShortestPath::getLengthToNearestNeigbor(WalkLocation *location) {
double minLength = -1.0;
- auto &neighbors = location->getNeigbors();
+ Common::StringArray &neighbors = location->getNeigbors();
for (int i = 0; i < neighbors.size(); ++i) {
WalkLocation *neighbor = _manager->findLocation(neighbors[i]);
if (!isLocationVisited(neighbor)){
@@ -110,7 +110,7 @@ double WalkShortestPath::getLengthToNearestNeigbor(WalkLocation *location) {
WalkLocation *WalkShortestPath::findNearestNeighbor(WalkLocation *location) {
double minLength = -1.0;
WalkLocation *nearest = nullptr;
- auto neighbors = location->getNeigbors();
+ Common::StringArray &neighbors = location->getNeigbors();
for (int i = 0; i < neighbors.size(); ++i) {
WalkLocation *neighbor = _manager->findLocation(neighbors[i]);
if (!isLocationVisited(neighbor)){
Commit: 656ca285ac7ac6f365fdde45accb020b80ec7898
https://github.com/scummvm/scummvm/commit/656ca285ac7ac6f365fdde45accb020b80ec7898
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: change size_t to uint
Changed paths:
engines/pink/file.cpp
diff --git a/engines/pink/file.cpp b/engines/pink/file.cpp
index 9067b72..2f2bc69 100644
--- a/engines/pink/file.cpp
+++ b/engines/pink/file.cpp
@@ -64,7 +64,7 @@ bool OrbFile::open(const Common::String &name) {
seek(_tableOffset);
- for (size_t i = 0; i < _tableSize; ++i) {
+ for (uint i = 0; i < _tableSize; ++i) {
_table[i].load(*this);
}
@@ -111,7 +111,7 @@ ResourceDescription *OrbFile::getResDescTable(ObjectDescription *objDesc){
ResourceDescription *table = new ResourceDescription[objDesc->resourcesCount];
seek(objDesc->resourcesOffset);
- for (size_t i = 0; i < objDesc->resourcesCount; ++i) {
+ for (uint i = 0; i < objDesc->resourcesCount; ++i) {
table[i].load(*this);
}
Commit: a45e58319d7aa6da38f4ecee3ca07889a75d3a82
https://github.com/scummvm/scummvm/commit/a45e58319d7aa6da38f4ecee3ca07889a75d3a82
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix signed vs unsigned comparison
Changed paths:
engines/pink/archive.h
engines/pink/director.cpp
engines/pink/objects/actions/action_play.cpp
engines/pink/objects/actions/action_play_with_sfx.cpp
engines/pink/objects/actions/action_still.cpp
engines/pink/objects/actors/actor.cpp
engines/pink/objects/actors/audio_info_pda_button.h
engines/pink/objects/actors/cursor_actor.h
engines/pink/objects/actors/inventory_actor.h
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/actors/supporting_actor.cpp
engines/pink/objects/handlers/handler.cpp
engines/pink/objects/handlers/handler_mgr.cpp
engines/pink/objects/handlers/handler_timer.cpp
engines/pink/objects/inventory.cpp
engines/pink/objects/module.cpp
engines/pink/objects/pages/game_page.cpp
engines/pink/objects/pages/page.cpp
engines/pink/objects/sequences/sequence.cpp
engines/pink/objects/sequences/sequence.h
engines/pink/objects/sequences/sequence_context.cpp
engines/pink/objects/sequences/sequence_context.h
engines/pink/objects/sequences/sequencer.cpp
engines/pink/objects/side_effect.cpp
engines/pink/objects/walk/walk_location.cpp
engines/pink/objects/walk/walk_mgr.cpp
engines/pink/objects/walk/walk_shortest_path.cpp
engines/pink/pink.cpp
diff --git a/engines/pink/archive.h b/engines/pink/archive.h
index f12c3e5..9a18758 100644
--- a/engines/pink/archive.h
+++ b/engines/pink/archive.h
@@ -110,7 +110,7 @@ inline Archive &operator>>(Archive &archive, Common::StringArray &array){
inline Archive &operator>>(Archive &archive, Common::StringMap &map){
uint size = archive.readCount();
- for (int i = 0; i < size; ++i) {
+ for (uint i = 0; i < size; ++i) {
Common::String key = archive.readString();
Common::String val = archive.readString();
map.setVal(key, val);
diff --git a/engines/pink/director.cpp b/engines/pink/director.cpp
index fb5a034..c504194 100644
--- a/engines/pink/director.cpp
+++ b/engines/pink/director.cpp
@@ -34,7 +34,7 @@ Director::Director(OSystem *system)
void Director::draw() {
_system->fillScreen(0);
- for (int i = 0; i < _sprites.size(); ++i) {
+ for (uint i = 0; i < _sprites.size(); ++i) {
drawSprite(_sprites[i]);
}
_system->updateScreen();
@@ -88,7 +88,7 @@ void Director::addSprite(ActionCEL *sprite) {
}
void Director::removeSprite(ActionCEL *sprite) {
- for (int i = 0; i < _sprites.size(); ++i) {
+ for (uint i = 0; i < _sprites.size(); ++i) {
if (sprite == _sprites[i]) {
_sprites.remove_at(i);
break;
@@ -101,10 +101,10 @@ void Director::setPallette(const byte *pallete) {
}
void Director::update() {
- for (int i = 0; i < _sounds.size(); ++i) {
+ for (uint i = 0; i < _sounds.size(); ++i) {
_sounds[i]->update();
}
- for (int i = 0; i < _sprites.size(); ++i) {
+ for (uint i = 0; i < _sprites.size(); ++i) {
_sprites[i]->update();
}
}
@@ -114,7 +114,7 @@ void Director::addSound(ActionSound *sound) {
}
void Director::removeSound(ActionSound *sound) {
- for (int i = 0; i < _sounds.size(); ++i) {
+ for (uint i = 0; i < _sounds.size(); ++i) {
if (_sounds[i] == sound)
_sounds.remove_at(i);
}
diff --git a/engines/pink/objects/actions/action_play.cpp b/engines/pink/objects/actions/action_play.cpp
index 8c0be27..34f1100 100644
--- a/engines/pink/objects/actions/action_play.cpp
+++ b/engines/pink/objects/actions/action_play.cpp
@@ -47,7 +47,7 @@ void ActionPlay::end() {
void ActionPlay::onStart() {
debug("Actor %s has now ActionPlay %s", _actor->getName().c_str(), _name.c_str());
_decoder->start();
- for (int i = 0; i < _startFrame; ++i) {
+ for (uint i = 0; i < _startFrame; ++i) {
_decoder->skipFrame();
}
_decoder->decodeNextFrame();
diff --git a/engines/pink/objects/actions/action_play_with_sfx.cpp b/engines/pink/objects/actions/action_play_with_sfx.cpp
index b43b498..4403370 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.cpp
+++ b/engines/pink/objects/actions/action_play_with_sfx.cpp
@@ -36,7 +36,7 @@ void ActionPlayWithSfx::deserialize(Pink::Archive &archive) {
void ActionPlayWithSfx::toConsole() {
debug("\tActionPlayWithSfx: _name = %s, _fileName = %s, z = %u, _startFrame = %u,"
" _endFrame = %u, _isLoop = %u", _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame, _isLoop);
- for (int i = 0; i < _sfxArray.size(); ++i) {
+ for (uint i = 0; i < _sfxArray.size(); ++i) {
_sfxArray[i]->toConsole();
}
}
@@ -64,7 +64,7 @@ void ActionPlayWithSfx::updateSound() {
if (!_actor->isPlaying() && !_isLoop)
return;
- for (int i = 0; i < _sfxArray.size(); ++i) {
+ for (uint i = 0; i < _sfxArray.size(); ++i) {
if (_sfxArray[i]->getFrame() == _decoder->getCurFrame()) {
_sfxArray[i]->play(_actor->getPage());
}
@@ -73,7 +73,7 @@ void ActionPlayWithSfx::updateSound() {
ActionPlayWithSfx::~ActionPlayWithSfx() {
ActionPlay::end();
- for (int i = 0; i < _sfxArray.size(); ++i) {
+ for (uint i = 0; i < _sfxArray.size(); ++i) {
delete _sfxArray[i];
}
}
diff --git a/engines/pink/objects/actions/action_still.cpp b/engines/pink/objects/actions/action_still.cpp
index acc0a2e..0bcfceb 100644
--- a/engines/pink/objects/actions/action_still.cpp
+++ b/engines/pink/objects/actions/action_still.cpp
@@ -46,7 +46,7 @@ void ActionStill::end() {
void ActionStill::onStart() {
debug("Actor %s has now ActionStill %s", _actor->getName().c_str(), _name.c_str());
- for (int i = 0; i < _startFrame; ++i) {
+ for (uint i = 0; i < _startFrame; ++i) {
_decoder->skipFrame();
}
_decoder->decodeNextFrame();
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index 189e531..67e0b2a 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -37,7 +37,7 @@ void Actor::deserialize(Archive &archive) {
void Actor::toConsole() {
debug("Actor: _name = %s", _name.c_str());
- for (int i = 0; i < _actions.size(); ++i) {
+ for (uint i = 0; i < _actions.size(); ++i) {
_actions[i]->toConsole();
}
}
@@ -116,7 +116,7 @@ bool Actor::isPlaying() {
}
bool Actor::initPallete(Director *director) {
- for (int i = 0; i < _actions.size(); ++i) {
+ for (uint i = 0; i < _actions.size(); ++i) {
if (_actions[i]->initPalette(director))
return true;
}
@@ -128,7 +128,7 @@ void Actor::onMouseOver(Common::Point point, CursorMgr *mgr) {
}
Actor::~Actor() {
- for (int i = 0; i < _actions.size(); ++i) {
+ for (uint i = 0; i < _actions.size(); ++i) {
delete _actions[i];
}
}
diff --git a/engines/pink/objects/actors/audio_info_pda_button.h b/engines/pink/objects/actors/audio_info_pda_button.h
index f27f70a..63badfd 100644
--- a/engines/pink/objects/actors/audio_info_pda_button.h
+++ b/engines/pink/objects/actors/audio_info_pda_button.h
@@ -36,7 +36,7 @@ class AudioInfoPDAButton : public Actor {
public:
void toConsole() {
debug("CursorActor: _name = %s", _name.c_str());
- for (int i = 0; i < _actions.size(); ++i) {
+ for (uint i = 0; i < _actions.size(); ++i) {
_actions[i]->toConsole();
}
}
diff --git a/engines/pink/objects/actors/cursor_actor.h b/engines/pink/objects/actors/cursor_actor.h
index 8e0005a..7c83a6b 100644
--- a/engines/pink/objects/actors/cursor_actor.h
+++ b/engines/pink/objects/actors/cursor_actor.h
@@ -35,7 +35,7 @@ class CursorActor : public Actor {
public:
void toConsole() {
debug("CursorActor: _name = %s", _name.c_str());
- for (int i = 0; i < _actions.size(); ++i) {
+ for (uint i = 0; i < _actions.size(); ++i) {
_actions[i]->toConsole();
}
}
diff --git a/engines/pink/objects/actors/inventory_actor.h b/engines/pink/objects/actors/inventory_actor.h
index 3f9c1ec..61ebbc4 100644
--- a/engines/pink/objects/actors/inventory_actor.h
+++ b/engines/pink/objects/actors/inventory_actor.h
@@ -34,7 +34,7 @@ class InventoryActor : public Actor {
public:
void toConsole() {
debug("CursorActor: _name = %s", _name.c_str());
- for (int i = 0; i < _actions.size(); ++i) {
+ for (uint i = 0; i < _actions.size(); ++i) {
_actions[i]->toConsole();
}
}
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 5de351b..05d9a76 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -59,7 +59,7 @@ void LeadActor::init(bool unk) {
void LeadActor::toConsole() {
debug("LeadActor: _name = %s", _name.c_str());
- for (int i = 0; i < _actions.size(); ++i) {
+ for (uint i = 0; i < _actions.size(); ++i) {
_actions[i]->toConsole();
}
}
@@ -314,7 +314,7 @@ bool LeadActor::isInteractingWith(SupportingActor *actor) {
void ParlSqPink::toConsole() {
debug("ParlSqPink: _name = %s", _name.c_str());
- for (int i = 0; i < _actions.size(); ++i) {
+ for (uint i = 0; i < _actions.size(); ++i) {
_actions[i]->toConsole();
}
}
@@ -334,7 +334,7 @@ PubPink::PubPink() :
void PubPink::toConsole() {
debug("PubPink: _name = %s", _name.c_str());
- for (int i = 0; i < _actions.size(); ++i) {
+ for (uint i = 0; i < _actions.size(); ++i) {
_actions[i]->toConsole();
}
}
diff --git a/engines/pink/objects/actors/supporting_actor.cpp b/engines/pink/objects/actors/supporting_actor.cpp
index 5fd575d..4971cca 100644
--- a/engines/pink/objects/actors/supporting_actor.cpp
+++ b/engines/pink/objects/actors/supporting_actor.cpp
@@ -38,7 +38,7 @@ void SupportingActor::deserialize(Archive &archive) {
void SupportingActor::toConsole() {
debug("SupportingActor: _name = %s, _location=%s, _pdaLink=%s, _cursor=%s",
_name.c_str(), _location.c_str(), _pdaLink.c_str(), _cursor.c_str());
- for (int i = 0; i < _actions.size(); ++i) {
+ for (uint i = 0; i < _actions.size(); ++i) {
_actions[i]->toConsole();
}
_handlerMgr.toConsole();
diff --git a/engines/pink/objects/handlers/handler.cpp b/engines/pink/objects/handlers/handler.cpp
index cd55d5a..4c30222 100644
--- a/engines/pink/objects/handlers/handler.cpp
+++ b/engines/pink/objects/handlers/handler.cpp
@@ -38,7 +38,7 @@ void Handler::deserialize(Archive &archive) {
}
bool Handler::isSuitable(Actor *actor) {
- for (int i = 0; i < _conditions.size(); ++i) {
+ for (uint i = 0; i < _conditions.size(); ++i) {
if (!_conditions[i]->evaluate(actor)){
return false;
}
@@ -47,7 +47,7 @@ bool Handler::isSuitable(Actor *actor) {
}
void Handler::executeSideEffects(Actor *actor) {
- for (int i = 0; i < _sideEffects.size(); ++i) {
+ for (uint i = 0; i < _sideEffects.size(); ++i) {
_sideEffects[i]->execute(actor);
}
}
@@ -57,10 +57,10 @@ void Handler::handle(Actor *actor) {
}
Handler::~Handler() {
- for (int i = 0; i < _sideEffects.size(); ++i) {
+ for (uint i = 0; i < _sideEffects.size(); ++i) {
delete _sideEffects[i];
}
- for (int i = 0; i < _conditions.size(); ++i) {
+ for (uint i = 0; i < _conditions.size(); ++i) {
delete _conditions[i];
}
}
@@ -95,17 +95,17 @@ void HandlerStartPage::toConsole() {
debug("HandlerStartPage:");
debug("\tSideEffects:");
- for (int i = 0; i < _sideEffects.size(); ++i) {
+ for (uint i = 0; i < _sideEffects.size(); ++i) {
_sideEffects[i]->toConsole();
}
debug("\tConditions:");
- for (int i = 0; i < _conditions.size(); ++i) {
+ for (uint i = 0; i < _conditions.size(); ++i) {
_conditions[i]->toConsole();
}
debug("\tSequences:");
- for (int i = 0; i < _sequences.size(); ++i) {
+ for (uint i = 0; i < _sequences.size(); ++i) {
debug("\t\t%s", _sequences[i].c_str());
}
}
@@ -114,17 +114,17 @@ void HandlerLeftClick::toConsole() {
debug("HandlerLeftClick:");
debug("\tSideEffects:");
- for (int i = 0; i < _sideEffects.size(); ++i) {
+ for (uint i = 0; i < _sideEffects.size(); ++i) {
_sideEffects[i]->toConsole();
}
debug("\tConditions:");
- for (int i = 0; i < _conditions.size(); ++i) {
+ for (uint i = 0; i < _conditions.size(); ++i) {
_conditions[i]->toConsole();
}
debug("\tSequences:");
- for (int i = 0; i < _sequences.size(); ++i) {
+ for (uint i = 0; i < _sequences.size(); ++i) {
debug("\t\t%s", _sequences[i].c_str());
}
}
@@ -137,17 +137,17 @@ void HandlerUseClick::deserialize(Archive &archive) {
void HandlerUseClick::toConsole() {
debug("HandlerUseClick: _inventoryItem=%s, _recepient=%s", _inventoryItem.c_str(), _recepient.c_str());
debug("\tSideEffects:");
- for (int i = 0; i < _sideEffects.size(); ++i) {
+ for (uint i = 0; i < _sideEffects.size(); ++i) {
_sideEffects[i]->toConsole();
}
debug("\tConditions:");
- for (int i = 0; i < _conditions.size(); ++i) {
+ for (uint i = 0; i < _conditions.size(); ++i) {
_conditions[i]->toConsole();
}
debug("\tSequences:");
- for (int i = 0; i < _sequences.size(); ++i) {
+ for (uint i = 0; i < _sequences.size(); ++i) {
debug("\t\t%s", _sequences[i].c_str());
}
}
diff --git a/engines/pink/objects/handlers/handler_mgr.cpp b/engines/pink/objects/handlers/handler_mgr.cpp
index f11c728..c326ae8 100644
--- a/engines/pink/objects/handlers/handler_mgr.cpp
+++ b/engines/pink/objects/handlers/handler_mgr.cpp
@@ -33,19 +33,19 @@ void HandlerMgr::deserialize(Archive &archive) {
void HandlerMgr::toConsole() {
debug("HandlerMgr:");
- for (int i = 0; i < _leftClickHandlers.size(); ++i) {
+ for (uint i = 0; i < _leftClickHandlers.size(); ++i) {
_leftClickHandlers[i]->toConsole();
}
- for (int i = 0; i < _useClickHandlers.size(); ++i) {
+ for (uint i = 0; i < _useClickHandlers.size(); ++i) {
_useClickHandlers[i]->toConsole();
}
- for (int i = 0; i < _timerHandlers.size(); ++i) {
+ for (uint i = 0; i < _timerHandlers.size(); ++i) {
_timerHandlers[i]->toConsole();
}
}
bool HandlerMgr::isLeftClickHandler(Actor *actor) {
- for (int i = 0; i < _leftClickHandlers.size(); ++i) {
+ for (uint i = 0; i < _leftClickHandlers.size(); ++i) {
if (_leftClickHandlers[i]->isSuitable(actor))
return true;
}
@@ -54,7 +54,7 @@ bool HandlerMgr::isLeftClickHandler(Actor *actor) {
}
bool HandlerMgr::isUseClickHandler(Actor *actor, const Common::String &itemName){
- for (int i = 0; i < _useClickHandlers.size(); ++i) {
+ for (uint i = 0; i < _useClickHandlers.size(); ++i) {
if (itemName == _useClickHandlers[i]->getInventoryItem() &&
_useClickHandlers[i]->isSuitable(actor))
return true;
@@ -91,7 +91,7 @@ bool HandlerMgr::onUseClickMessage(Actor *actor, InventoryItem *item, InventoryM
}
Handler *HandlerMgr::findSuitableHandlerTimer(Actor *actor) {
- for (int i = 0; i < _timerHandlers.size(); ++i) {
+ for (uint i = 0; i < _timerHandlers.size(); ++i) {
if (_timerHandlers[i]->isSuitable(actor))
return _timerHandlers[i];
}
@@ -100,7 +100,7 @@ Handler *HandlerMgr::findSuitableHandlerTimer(Actor *actor) {
}
HandlerLeftClick *HandlerMgr::findSuitableHandlerLeftClick(Actor *actor) {
- for (int i = 0; i < _leftClickHandlers.size(); ++i) {
+ for (uint i = 0; i < _leftClickHandlers.size(); ++i) {
if (_leftClickHandlers[i]->isSuitable(actor))
return _leftClickHandlers[i];
}
@@ -109,7 +109,7 @@ HandlerLeftClick *HandlerMgr::findSuitableHandlerLeftClick(Actor *actor) {
}
HandlerUseClick *HandlerMgr::findSuitableHandlerUseClick(Actor *actor, InventoryItem *item) {
- for (int i = 0; i < _useClickHandlers.size(); ++i) {
+ for (uint i = 0; i < _useClickHandlers.size(); ++i) {
if (item->getName() == _useClickHandlers[i]->getInventoryItem() && _useClickHandlers[i]->isSuitable(actor))
return _useClickHandlers[i];
}
@@ -118,13 +118,13 @@ HandlerUseClick *HandlerMgr::findSuitableHandlerUseClick(Actor *actor, Inventory
}
HandlerMgr::~HandlerMgr() {
- for (int i = 0; i < _leftClickHandlers.size(); ++i) {
+ for (uint i = 0; i < _leftClickHandlers.size(); ++i) {
delete _leftClickHandlers[i];
}
- for (int j = 0; j < _useClickHandlers.size(); ++j) {
+ for (uint j = 0; j < _useClickHandlers.size(); ++j) {
delete _useClickHandlers[j];
}
- for (int k = 0; k < _timerHandlers.size(); ++k) {
+ for (uint k = 0; k < _timerHandlers.size(); ++k) {
delete _timerHandlers[k];
}
}
diff --git a/engines/pink/objects/handlers/handler_timer.cpp b/engines/pink/objects/handlers/handler_timer.cpp
index 18818ab..e9af952 100644
--- a/engines/pink/objects/handlers/handler_timer.cpp
+++ b/engines/pink/objects/handlers/handler_timer.cpp
@@ -44,17 +44,17 @@ void HandlerTimerActions::toConsole() {
debug("HandlerTimerActions:");
debug("\tSideEffects:");
- for (int i = 0; i < _sideEffects.size(); ++i) {
+ for (uint i = 0; i < _sideEffects.size(); ++i) {
_sideEffects[i]->toConsole();
}
debug("\tConditions:");
- for (int i = 0; i < _conditions.size(); ++i) {
+ for (uint i = 0; i < _conditions.size(); ++i) {
_conditions[i]->toConsole();
}
debug("\tActions:");
- for (int i = 0; i < _actions.size(); ++i) {
+ for (uint i = 0; i < _actions.size(); ++i) {
debug("\t\t%s", _actions[i].c_str());
}
}
@@ -79,17 +79,17 @@ void HandlerTimerSequences::toConsole() {
debug("HandlerTimerSequences:");
debug("\tSideEffects:");
- for (int i = 0; i < _sideEffects.size(); ++i) {
+ for (uint i = 0; i < _sideEffects.size(); ++i) {
_sideEffects[i]->toConsole();
}
debug("\tConditions:");
- for (int i = 0; i < _conditions.size(); ++i) {
+ for (uint i = 0; i < _conditions.size(); ++i) {
_conditions[i]->toConsole();
}
debug("\tSequences:");
- for (int i = 0; i < _sequences.size(); ++i) {
+ for (uint i = 0; i < _sequences.size(); ++i) {
debug("\t\t%s", _sequences[i].c_str());
}
}
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
index d62530c..1869147 100644
--- a/engines/pink/objects/inventory.cpp
+++ b/engines/pink/objects/inventory.cpp
@@ -77,7 +77,7 @@ void InventoryMgr::setLeadActor(LeadActor *lead) {
void InventoryMgr::toConsole() {
debug("InventoryMgr:");
- for (int i = 0; i < _items.size(); ++i) {
+ for (uint i = 0; i < _items.size(); ++i) {
_items[i]->toConsole();
}
}
@@ -86,7 +86,7 @@ bool InventoryMgr::isPinkOwnsAnyItems() {
if (_item)
return true;
- for (int i = 0; i < _items.size(); ++i) {
+ for (uint i = 0; i < _items.size(); ++i) {
if (_items[i]->getCurrentOwner() == _lead->getName()){
_item = _items[i];
return true;
@@ -179,14 +179,14 @@ void InventoryMgr::close() {
void InventoryMgr::showNextItem(bool direction) {
int index = 0;
- for (int i = 0; i < _items.size(); ++i) {
+ for (uint i = 0; i < _items.size(); ++i) {
if (_item == _items[i]) {
index = i + _items.size();
break;
}
}
- int i = 0;
+ uint i = 0;
do {
index = (direction == kLeft) ? --index : ++index;
} while(_items[index % _items.size()]->getCurrentOwner() != _item->getCurrentOwner() && ++i < _items.size());
diff --git a/engines/pink/objects/module.cpp b/engines/pink/objects/module.cpp
index 0d60778..2b15187 100644
--- a/engines/pink/objects/module.cpp
+++ b/engines/pink/objects/module.cpp
@@ -37,7 +37,7 @@ Module::Module(PinkEngine *game, const Common::String &name)
{}
Module::~Module() {
- for (int i = 0; i < _pages.size(); ++i) {
+ for (uint i = 0; i < _pages.size(); ++i) {
delete _pages[i];
}
}
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index 2ac88fb..bdfb92b 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -43,7 +43,7 @@ void GamePage::toConsole() {
Page::toConsole();
_walkMgr->toConsole();
_sequencer->toConsole();
- for (int i = 0; i < _handlers.size(); ++i) {
+ for (uint i = 0; i < _handlers.size(); ++i) {
_handlers[i]->toConsole();
}
}
@@ -74,7 +74,7 @@ void GamePage::init(bool isLoadingSave) {
toConsole();
- for (int j = 0; j < _actors.size(); ++j) {
+ for (uint j = 0; j < _actors.size(); ++j) {
if (_actors[j]->initPallete(_module->getGame()->getDirector()))
break;
}
@@ -82,7 +82,7 @@ void GamePage::init(bool isLoadingSave) {
LeadActor::State state = _leadActor->getState();
bool startNow = !(state == LeadActor::kInventory || state == LeadActor::kPDA);
- for (int i = 0; i < _actors.size(); ++i) {
+ for (uint i = 0; i < _actors.size(); ++i) {
_actors[i]->init(startNow);
}
@@ -173,7 +173,7 @@ void GamePage::saveState() {
archive << _variables;
archive.writeWORD(_actors.size());
- for (int i = 0; i < _actors.size(); ++i) {
+ for (uint i = 0; i < _actors.size(); ++i) {
archive.writeString(_actors[i]->getName());
_actors[i]->saveState(archive);
}
@@ -193,7 +193,7 @@ void GamePage::clear() {
Page::clear();
//_variables.clear(1);
- for (int i = 0; i < _handlers.size(); ++i) {
+ for (uint i = 0; i < _handlers.size(); ++i) {
delete _handlers[i];
}
diff --git a/engines/pink/objects/pages/page.cpp b/engines/pink/objects/pages/page.cpp
index 9c923e2..cf2d3a0 100644
--- a/engines/pink/objects/pages/page.cpp
+++ b/engines/pink/objects/pages/page.cpp
@@ -57,7 +57,7 @@ CelDecoder *Page::loadCel(Common::String &fileName) {
void Page::toConsole() {
- for (int i = 0; i < _actors.size(); ++i) {
+ for (uint i = 0; i < _actors.size(); ++i) {
_actors[i]->toConsole();
}
}
@@ -66,7 +66,7 @@ void Page::init() {
LeadActor::State state = _leadActor->getState();
bool unk = (state == LeadActor::kInventory || state == LeadActor::kPDA);
- for (int i = 0; i < _actors.size(); ++i) {
+ for (uint i = 0; i < _actors.size(); ++i) {
_actors[i]->init(unk);
}
}
@@ -76,7 +76,7 @@ LeadActor *Page::getLeadActor() {
}
void Page::clear() {
- for (int i = 0; i < _actors.size(); ++i) {
+ for (uint i = 0; i < _actors.size(); ++i) {
delete _actors[i];
}
_actors.clear();
@@ -84,13 +84,13 @@ void Page::clear() {
}
void Page::pause() {
- for (int i = 0; i < _actors.size(); ++i) {
+ for (uint i = 0; i < _actors.size(); ++i) {
_actors[i]->pause();
}
}
void Page::unpause() {
- for (int i = 0; i < _actors.size(); ++i) {
+ for (uint i = 0; i < _actors.size(); ++i) {
_actors[i]->unpause();
}
}
diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp
index b2cc5e7..ae97965 100644
--- a/engines/pink/objects/sequences/sequence.cpp
+++ b/engines/pink/objects/sequences/sequence.cpp
@@ -38,7 +38,7 @@ Sequence::Sequence()
_sequencer(nullptr) {}
Sequence::~Sequence() {
- for (int i = 0; i < _items.size(); ++i) {
+ for (uint i = 0; i < _items.size(); ++i) {
delete _items[i];
}
}
@@ -52,7 +52,7 @@ void Sequence::deserialize(Archive &archive) {
void Sequence::toConsole() {
debug("\t\tSequence %s", _name.c_str());
debug("\t\t\tItems:");
- for (int i = 0; i < _items.size(); ++i) {
+ for (uint i = 0; i < _items.size(); ++i) {
_items[i]->toConsole();
}
}
@@ -144,14 +144,14 @@ void SequenceAudio::deserialize(Archive &archive) {
void SequenceAudio::toConsole() {
debug("\t\tSequenceAudio %s : _sound = %s", _name.c_str(), _soundName.c_str());
debug("\t\t\tItems:");
- for (int i = 0; i < _items.size(); ++i) {
+ for (uint i = 0; i < _items.size(); ++i) {
_items[i]->toConsole();
}
}
void SequenceAudio::start(int unk) {
Sequence::start(unk);
- int index = _context->getNextItemIndex();
+ uint index = _context->getNextItemIndex();
if (index < _items.size()) {
SequenceItemLeaderAudio* leaderAudio = (SequenceItemLeaderAudio*) _items[index];
_sample = leaderAudio->getSample();
diff --git a/engines/pink/objects/sequences/sequence.h b/engines/pink/objects/sequences/sequence.h
index 2cbdff4..ba6d3be 100644
--- a/engines/pink/objects/sequences/sequence.h
+++ b/engines/pink/objects/sequences/sequence.h
@@ -82,7 +82,7 @@ public:
private:
Common::String _soundName;
Sound *_sound;
- int _sample;
+ uint _sample;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/sequences/sequence_context.cpp b/engines/pink/objects/sequences/sequence_context.cpp
index 01b76a8..4aec5fe 100644
--- a/engines/pink/objects/sequences/sequence_context.cpp
+++ b/engines/pink/objects/sequences/sequence_context.cpp
@@ -72,7 +72,7 @@ SequenceContext::SequenceContext(Sequence *sequence, Sequencer *sequencer)
}
}
-int SequenceContext::getNextItemIndex() const {
+uint SequenceContext::getNextItemIndex() const {
return _nextItemIndex;
}
@@ -81,7 +81,7 @@ Sequence *SequenceContext::getSequence() const {
}
void SequenceContext::clearActionsFromActorStates() {
- for (int i = 0; i < _states.size(); ++i) {
+ for (uint i = 0; i < _states.size(); ++i) {
_states[i]._actionName.clear();
}
}
diff --git a/engines/pink/objects/sequences/sequence_context.h b/engines/pink/objects/sequences/sequence_context.h
index 11b43bb..334553c 100644
--- a/engines/pink/objects/sequences/sequence_context.h
+++ b/engines/pink/objects/sequences/sequence_context.h
@@ -49,7 +49,7 @@ class SequenceContext {
public:
SequenceContext(Sequence *sequence, Sequencer* sequencer);
- int getNextItemIndex() const;
+ uint getNextItemIndex() const;
Sequence *getSequence() const;
void setNextItemIndex(int index);
@@ -59,7 +59,7 @@ public:
public:
Sequence *_sequence;
Sequencer *_sequencer;
- int _nextItemIndex;
+ uint _nextItemIndex;
Actor *_actor;
Common::Array<SequenceActorState> _states;
int _index;
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index 349f7ad..b862819 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -38,7 +38,7 @@ Sequencer::Sequencer(GamePage *page)
{}
Sequencer::~Sequencer() {
- for (int i = 0; i < _sequences.size(); ++i) {
+ for (uint i = 0; i < _sequences.size(); ++i) {
delete _sequences[i];
}
}
@@ -70,10 +70,10 @@ void Sequencer::authorSequence(Sequence *sequence, bool unk) {
void Sequencer::toConsole() {
debug("Sequencer:");
- for (int i = 0; i < _sequences.size(); ++i) {
+ for (uint i = 0; i < _sequences.size(); ++i) {
_sequences[i]->toConsole();
}
- for (int i = 0; i < _timers.size(); ++i) {
+ for (uint i = 0; i < _timers.size(); ++i) {
_timers[i]->toConsole();
}
}
@@ -109,7 +109,7 @@ void Sequencer::updateTimers() {
}
_time = time;
- for (int i = 0; i < _timers.size(); ++i) {
+ for (uint i = 0; i < _timers.size(); ++i) {
_timers[i]->update();
}
}
@@ -118,7 +118,7 @@ SequenceActorState *Sequencer::findSequenceActorState(const Common::String &name
if (!_context)
return nullptr;
- for (int i = 0; i < _context->_states.size(); ++i) {
+ for (uint i = 0; i < _context->_states.size(); ++i) {
if (_context->_states[i].getActor() == name)
return &_context->_states[i];
}
diff --git a/engines/pink/objects/side_effect.cpp b/engines/pink/objects/side_effect.cpp
index ec0f24e..cbd8291 100644
--- a/engines/pink/objects/side_effect.cpp
+++ b/engines/pink/objects/side_effect.cpp
@@ -116,7 +116,7 @@ void SideEffectRandomPageVariable::execute(Actor *actor) {
void SideEffectRandomPageVariable::toConsole() {
Common::String values("{");
- for (int i = 0; i < _values.size(); ++i) {
+ for (uint i = 0; i < _values.size(); ++i) {
values += _values[i];
values += ',';
}
diff --git a/engines/pink/objects/walk/walk_location.cpp b/engines/pink/objects/walk/walk_location.cpp
index 9ef6a7f..da5718f 100644
--- a/engines/pink/objects/walk/walk_location.cpp
+++ b/engines/pink/objects/walk/walk_location.cpp
@@ -35,7 +35,7 @@ void WalkLocation::deserialize(Pink::Archive &archive) {
void WalkLocation::toConsole() {
debug("\tWalkLocation: _name =%s", _name.c_str());
debug("\tNeighbors:");
- for (int i = 0; i < _neighbors.size(); ++i) {
+ for (uint i = 0; i < _neighbors.size(); ++i) {
debug("\t\t%s", _neighbors[i].c_str());
}
}
diff --git a/engines/pink/objects/walk/walk_mgr.cpp b/engines/pink/objects/walk/walk_mgr.cpp
index eb2ce5e..ad447a9 100644
--- a/engines/pink/objects/walk/walk_mgr.cpp
+++ b/engines/pink/objects/walk/walk_mgr.cpp
@@ -51,7 +51,7 @@ WalkLocation *WalkMgr::findLocation(const Common::String &name) {
void WalkMgr::toConsole() {
debug("WalkMgr:");
- for (int i = 0; i < _locations.size(); ++i) {
+ for (uint i = 0; i < _locations.size(); ++i) {
_locations[i]->toConsole();
}
}
diff --git a/engines/pink/objects/walk/walk_shortest_path.cpp b/engines/pink/objects/walk/walk_shortest_path.cpp
index ca07da9..aa74f0e 100644
--- a/engines/pink/objects/walk/walk_shortest_path.cpp
+++ b/engines/pink/objects/walk/walk_shortest_path.cpp
@@ -50,7 +50,7 @@ WalkLocation *WalkShortestPath::build() {
WalkLocation *location = nullptr;
double len = -1.0;
addLocationsToVisit();
- for (int i = 0; i < _toVisit.size(); ++i) {
+ for (uint i = 0; i < _toVisit.size(); ++i) {
double curLen = getLengthToNearestNeigbor(_toVisit[i]);
if (curLen < 0) {
remove(_toVisit[i]);
@@ -74,7 +74,7 @@ WalkLocation *WalkShortestPath::build() {
}
WalkLocation *WalkShortestPath::getNearestNeighbor(WalkLocation *location) {
- for(int i = 0; i < _visited.size(); ++i){
+ for(uint i = 0; i < _visited.size(); ++i){
if (_visited[i] == location)
return _nearestNeigbor[i];
}
@@ -84,7 +84,7 @@ WalkLocation *WalkShortestPath::getNearestNeighbor(WalkLocation *location) {
void WalkShortestPath::addLocationsToVisit() {
_toVisit.resize(_locations.size());
- for (int i = 0; i < _locations.size(); ++i) {
+ for (uint i = 0; i < _locations.size(); ++i) {
_toVisit[i] = _locations[i];
}
}
@@ -92,7 +92,7 @@ void WalkShortestPath::addLocationsToVisit() {
double WalkShortestPath::getLengthToNearestNeigbor(WalkLocation *location) {
double minLength = -1.0;
Common::StringArray &neighbors = location->getNeigbors();
- for (int i = 0; i < neighbors.size(); ++i) {
+ for (uint i = 0; i < neighbors.size(); ++i) {
WalkLocation *neighbor = _manager->findLocation(neighbors[i]);
if (!isLocationVisited(neighbor)){
double length = _manager->getLengthBetweenLocations(location, neighbor);
@@ -111,7 +111,7 @@ WalkLocation *WalkShortestPath::findNearestNeighbor(WalkLocation *location) {
double minLength = -1.0;
WalkLocation *nearest = nullptr;
Common::StringArray &neighbors = location->getNeigbors();
- for (int i = 0; i < neighbors.size(); ++i) {
+ for (uint i = 0; i < neighbors.size(); ++i) {
WalkLocation *neighbor = _manager->findLocation(neighbors[i]);
if (!isLocationVisited(neighbor)){
double length = _manager->getLengthBetweenLocations(location, neighbor);
@@ -132,7 +132,7 @@ WalkLocation *WalkShortestPath::findNearestNeighbor(WalkLocation *location) {
}
double WalkShortestPath::getWeight(WalkLocation *location) {
- for (int i = 0; i < _locations.size(); ++i) {
+ for (uint i = 0; i < _locations.size(); ++i) {
if (_locations[i] == location)
return _weight[i];
}
@@ -140,7 +140,7 @@ double WalkShortestPath::getWeight(WalkLocation *location) {
}
bool WalkShortestPath::isLocationVisited(WalkLocation *location) {
- for (int i = 0; i < _visited.size(); ++i) {
+ for (uint i = 0; i < _visited.size(); ++i) {
if (_visited[i] == location)
return true;
}
@@ -148,7 +148,7 @@ bool WalkShortestPath::isLocationVisited(WalkLocation *location) {
}
void WalkShortestPath::remove(WalkLocation *location) {
- for (int i = 0; i < _locations.size(); ++i) {
+ for (uint i = 0; i < _locations.size(); ++i) {
if (_locations[i] == location){
_locations.remove_at(i);
_weight.remove_at(i);
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index 56166b0..1923c00 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -56,7 +56,7 @@ Pink::PinkEngine::~PinkEngine() {
for (uint i = 0; i < _modules.size(); ++i) {
delete _modules[i];
}
- for (int j = 0; j < _cursors.size(); ++j) {
+ for (uint j = 0; j < _cursors.size(); ++j) {
delete _cursors[j];
}
Commit: c32c642eba165d6804195e21b8bfbe42f8e5059e
https://github.com/scummvm/scummvm/commit/c32c642eba165d6804195e21b8bfbe42f8e5059e
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: change _endFrame type from uint32 to int32
Changed paths:
engines/pink/archive.h
engines/pink/objects/actions/action_loop.cpp
engines/pink/objects/actions/action_play.cpp
engines/pink/objects/actions/action_play.h
engines/pink/objects/actions/action_play_with_sfx.cpp
engines/pink/objects/actions/action_talk.cpp
diff --git a/engines/pink/archive.h b/engines/pink/archive.h
index 9a18758..cc6711e 100644
--- a/engines/pink/archive.h
+++ b/engines/pink/archive.h
@@ -89,6 +89,11 @@ inline Archive &operator>>(Archive &archive, Common::String &string){
return archive;
}
+inline Archive &operator>>(Archive &archive, int32 &num){
+ num = archive.readDWORD();
+ return archive;
+}
+
inline Archive &operator>>(Archive &archive, uint32 &num){
num = archive.readDWORD();
return archive;
diff --git a/engines/pink/objects/actions/action_loop.cpp b/engines/pink/objects/actions/action_loop.cpp
index 2c46b61..45a1b08 100644
--- a/engines/pink/objects/actions/action_loop.cpp
+++ b/engines/pink/objects/actions/action_loop.cpp
@@ -46,7 +46,7 @@ void ActionLoop::deserialize(Archive &archive) {
void ActionLoop::toConsole() {
debug("\tActionLoop: _name = %s, _fileName = %s, z = %u, _startFrame = %u,"
- " _endFrame = %u, _intro = %u, _style = %u",
+ " _endFrame = %d, _intro = %u, _style = %u",
_name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame, _intro, _style);
}
diff --git a/engines/pink/objects/actions/action_play.cpp b/engines/pink/objects/actions/action_play.cpp
index 34f1100..d8172a7 100644
--- a/engines/pink/objects/actions/action_play.cpp
+++ b/engines/pink/objects/actions/action_play.cpp
@@ -36,7 +36,7 @@ void ActionPlay::deserialize(Archive &archive) {
void ActionPlay::toConsole() {
debug("\tActionPlay: _name = %s, _fileName = %s, z = %u, _startFrame = %u,"
- " _endFrame = %u", _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame);
+ " _endFrame = %d", _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame);
}
void ActionPlay::end() {
diff --git a/engines/pink/objects/actions/action_play.h b/engines/pink/objects/actions/action_play.h
index 83318b0..319d059 100644
--- a/engines/pink/objects/actions/action_play.h
+++ b/engines/pink/objects/actions/action_play.h
@@ -39,7 +39,7 @@ public:
protected:
virtual void onStart();
- uint32 _stopFrame;
+ int32 _stopFrame;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_play_with_sfx.cpp b/engines/pink/objects/actions/action_play_with_sfx.cpp
index 4403370..2c23fa0 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.cpp
+++ b/engines/pink/objects/actions/action_play_with_sfx.cpp
@@ -35,7 +35,7 @@ void ActionPlayWithSfx::deserialize(Pink::Archive &archive) {
void ActionPlayWithSfx::toConsole() {
debug("\tActionPlayWithSfx: _name = %s, _fileName = %s, z = %u, _startFrame = %u,"
- " _endFrame = %u, _isLoop = %u", _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame, _isLoop);
+ " _endFrame = %d, _isLoop = %u", _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame, _isLoop);
for (uint i = 0; i < _sfxArray.size(); ++i) {
_sfxArray[i]->toConsole();
}
diff --git a/engines/pink/objects/actions/action_talk.cpp b/engines/pink/objects/actions/action_talk.cpp
index 644e143..20abdc0 100644
--- a/engines/pink/objects/actions/action_talk.cpp
+++ b/engines/pink/objects/actions/action_talk.cpp
@@ -36,7 +36,7 @@ void ActionTalk::deserialize(Archive &archive) {
void ActionTalk::toConsole() {
debug("\tActionTalk: _name = %s, _fileName = %s, z = %u, _startFrame = %u,"
- " _endFrame = %u, _intro = %u, _style = %u, _vox = %s",
+ " _endFrame = %d, _intro = %u, _style = %u, _vox = %s",
_name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame, _intro, _style, _vox.c_str());
}
Commit: b89de53fb1b3184455512fe56d7a1bfb5e733fcb
https://github.com/scummvm/scummvm/commit/b89de53fb1b3184455512fe56d7a1bfb5e733fcb
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix arguments in InventoryItem method
Changed paths:
engines/pink/objects/inventory.cpp
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
index 1869147..c2607be 100644
--- a/engines/pink/objects/inventory.cpp
+++ b/engines/pink/objects/inventory.cpp
@@ -49,7 +49,7 @@ Common::String &InventoryItem::getCurrentOwner() {
}
void InventoryItem::toConsole() {
- debug("\tInventoryItem: _initialOwner=%s _currentOwner=%s", _initialOwner, _currentOwner);
+ debug("\tInventoryItem: _initialOwner=%s _currentOwner=%s", _initialOwner.c_str(), _currentOwner.c_str());
}
InventoryMgr::~InventoryMgr() {
Commit: d8e42e739547868f61efd5818133b2045c89d77a
https://github.com/scummvm/scummvm/commit/d8e42e739547868f61efd5818133b2045c89d77a
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: change hex to dec numbers
Changed paths:
engines/pink/constants.h
diff --git a/engines/pink/constants.h b/engines/pink/constants.h
index 16765ff..b60d53f 100644
--- a/engines/pink/constants.h
+++ b/engines/pink/constants.h
@@ -140,8 +140,8 @@ enum {
};
enum {
- kTimersUpdateTime = 0x64,
- kCursorsUpdateTime = 0xC8
+ kTimersUpdateTime = 100,
+ kCursorsUpdateTime = 200
};
enum {
Commit: 37574a3bcf2a85e0faf23b0278b560ab1a36086e
https://github.com/scummvm/scummvm/commit/37574a3bcf2a85e0faf23b0278b560ab1a36086e
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: remove >> << operators
Changed paths:
A engines/pink/utils.h
engines/pink/archive.h
engines/pink/file.h
engines/pink/objects/actions/action_cel.cpp
engines/pink/objects/actions/action_loop.cpp
engines/pink/objects/actions/action_play.cpp
engines/pink/objects/actions/action_play_with_sfx.cpp
engines/pink/objects/actions/action_play_with_sfx.h
engines/pink/objects/actions/action_sound.cpp
engines/pink/objects/actions/action_still.cpp
engines/pink/objects/actions/action_talk.cpp
engines/pink/objects/actions/action_text.cpp
engines/pink/objects/actors/actor.cpp
engines/pink/objects/actors/actor.h
engines/pink/objects/actors/pda_button_actor.cpp
engines/pink/objects/actors/supporting_actor.cpp
engines/pink/objects/condition.cpp
engines/pink/objects/handlers/handler.cpp
engines/pink/objects/handlers/handler.h
engines/pink/objects/handlers/handler_mgr.cpp
engines/pink/objects/handlers/handler_mgr.h
engines/pink/objects/handlers/handler_timer.cpp
engines/pink/objects/handlers/handler_timer.h
engines/pink/objects/inventory.cpp
engines/pink/objects/inventory.h
engines/pink/objects/module.cpp
engines/pink/objects/module.h
engines/pink/objects/object.cpp
engines/pink/objects/pages/game_page.cpp
engines/pink/objects/pages/game_page.h
engines/pink/objects/pages/page.cpp
engines/pink/objects/pages/page.h
engines/pink/objects/sequences/seq_timer.cpp
engines/pink/objects/sequences/sequence.cpp
engines/pink/objects/sequences/sequence.h
engines/pink/objects/sequences/sequence_item.cpp
engines/pink/objects/sequences/sequencer.cpp
engines/pink/objects/sequences/sequencer.h
engines/pink/objects/side_effect.cpp
engines/pink/objects/side_effect.h
engines/pink/objects/walk/walk_location.cpp
engines/pink/objects/walk/walk_location.h
engines/pink/objects/walk/walk_mgr.cpp
engines/pink/objects/walk/walk_mgr.h
engines/pink/pink.cpp
engines/pink/pink.h
diff --git a/engines/pink/archive.h b/engines/pink/archive.h
index cc6711e..e936987 100644
--- a/engines/pink/archive.h
+++ b/engines/pink/archive.h
@@ -67,94 +67,6 @@ private:
Common::WriteStream *_writeStream;
};
-template <typename T>
-inline Archive &operator>>(Archive &archive, Common::Array<T> &arr){
- uint size = archive.readCount();
- arr.resize(size);
- for (uint i = 0; i < size; ++i) {
- arr[i] = dynamic_cast<T>(archive.readObject());
- assert(arr[i]);
- }
- return archive;
-}
-
-template <typename T>
-inline Archive &operator>>(Archive &archive, Object &obj){
- obj.load(archive);
- return archive;
-}
-
-inline Archive &operator>>(Archive &archive, Common::String &string){
- string = archive.readString();
- return archive;
-}
-
-inline Archive &operator>>(Archive &archive, int32 &num){
- num = archive.readDWORD();
- return archive;
-}
-
-inline Archive &operator>>(Archive &archive, uint32 &num){
- num = archive.readDWORD();
- return archive;
-}
-
-inline Archive &operator>>(Archive &archive, uint16 &num){
- num = archive.readWORD();
- return archive;
-}
-
-inline Archive &operator>>(Archive &archive, Common::StringArray &array){
- uint32 size = archive.readCount();
- array.resize(size);
- for (uint i = 0; i < size; ++i) {
- array[i] = archive.readString();
- }
- return archive;
-}
-
-inline Archive &operator>>(Archive &archive, Common::StringMap &map){
- uint size = archive.readCount();
- for (uint i = 0; i < size; ++i) {
- Common::String key = archive.readString();
- Common::String val = archive.readString();
- map.setVal(key, val);
- }
- return archive;
-}
-
-inline Archive &operator<<(Archive &archive, Common::String &string){
- archive.writeString(string);
- return archive;
-}
-
-inline Archive &operator<<(Archive &archive, uint32 &num){
- archive.writeDWORD(num);
- return archive;
-}
-
-inline Archive &operator<<(Archive &archive, uint16 &num){
- archive.writeWORD(num);
- return archive;
-}
-
-inline Archive &operator<<(Archive &archive, Common::StringArray &array){
- archive.writeWORD(array.size());
- for (uint i = 0; i < array.size(); ++i) {
- archive.writeString(array[i]);
- }
- return archive;
-}
-
-inline Archive &operator<<(Archive &archive, Common::StringMap &map){
- archive.writeWORD(map.size());
- for (Common::StringMap::const_iterator it = map.begin(); it != map.end(); ++it) {
- archive.writeString(it->_key);
- archive.writeString(it->_value);
- }
- return archive;
-}
-
} // End of namespace Pink
#endif
diff --git a/engines/pink/file.h b/engines/pink/file.h
index dbcfaae..d7053a1 100644
--- a/engines/pink/file.h
+++ b/engines/pink/file.h
@@ -71,7 +71,6 @@ private:
uint32 _timestamp;
uint32 _tableOffset;
uint32 _tableSize;
- ObjectDescription *_table;
};
class BroFile : public Common::File {
diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp
index e878c3e..1b33fd7 100644
--- a/engines/pink/objects/actions/action_cel.cpp
+++ b/engines/pink/objects/actions/action_cel.cpp
@@ -38,7 +38,8 @@ ActionCEL::ActionCEL()
void ActionCEL::deserialize(Archive &archive) {
Action::deserialize(archive);
- archive >> _fileName >> _z;
+ _fileName = archive.readString();
+ _z = archive.readDWORD();
}
void ActionCEL::start(bool unk) {
diff --git a/engines/pink/objects/actions/action_loop.cpp b/engines/pink/objects/actions/action_loop.cpp
index 45a1b08..03c04f9 100644
--- a/engines/pink/objects/actions/action_loop.cpp
+++ b/engines/pink/objects/actions/action_loop.cpp
@@ -30,7 +30,8 @@ namespace Pink {
void ActionLoop::deserialize(Archive &archive) {
ActionPlay::deserialize(archive);
uint16 style;
- archive >> _intro >> style;
+ _intro = archive.readDWORD();
+ style = archive.readWORD();
switch (style) {
case kPingPong:
_style = kPingPong;
diff --git a/engines/pink/objects/actions/action_play.cpp b/engines/pink/objects/actions/action_play.cpp
index d8172a7..6ab21db 100644
--- a/engines/pink/objects/actions/action_play.cpp
+++ b/engines/pink/objects/actions/action_play.cpp
@@ -31,7 +31,7 @@ namespace Pink {
void ActionPlay::deserialize(Archive &archive) {
ActionStill::deserialize(archive);
- archive >> _stopFrame;
+ _stopFrame = archive.readDWORD();
}
void ActionPlay::toConsole() {
diff --git a/engines/pink/objects/actions/action_play_with_sfx.cpp b/engines/pink/objects/actions/action_play_with_sfx.cpp
index 2c23fa0..f54d81c 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.cpp
+++ b/engines/pink/objects/actions/action_play_with_sfx.cpp
@@ -30,7 +30,8 @@ namespace Pink {
void ActionPlayWithSfx::deserialize(Pink::Archive &archive) {
ActionPlay::deserialize(archive);
- archive >> _isLoop >> _sfxArray;
+ _isLoop = archive.readDWORD();
+ _sfxArray.deserialize(archive);
}
void ActionPlayWithSfx::toConsole() {
@@ -79,8 +80,10 @@ ActionPlayWithSfx::~ActionPlayWithSfx() {
}
void ActionSfx::deserialize(Pink::Archive &archive) {
- archive >> _frame >> _volume >> _sfxName;
- archive.readObject();
+ _frame = archive.readDWORD();
+ _volume = archive.readDWORD();
+ _sfxName = archive.readString();
+ archive.readObject(); // pointer of ActionPlayWithSfx
}
void ActionSfx::toConsole() {
diff --git a/engines/pink/objects/actions/action_play_with_sfx.h b/engines/pink/objects/actions/action_play_with_sfx.h
index 44b3342..865f368 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.h
+++ b/engines/pink/objects/actions/action_play_with_sfx.h
@@ -23,8 +23,6 @@
#ifndef PINK_ACTION_PLAY_WITH_SFX_H
#define PINK_ACTION_PLAY_WITH_SFX_H
-#include "common/array.h"
-
#include "pink/objects/actions/action_play.h"
namespace Pink {
@@ -44,7 +42,7 @@ protected:
private:
void updateSound();
uint32 _isLoop;
- Common::Array<ActionSfx*> _sfxArray;
+ Array<ActionSfx*> _sfxArray;
};
class Sound;
diff --git a/engines/pink/objects/actions/action_sound.cpp b/engines/pink/objects/actions/action_sound.cpp
index a125ec0..196ae61 100644
--- a/engines/pink/objects/actions/action_sound.cpp
+++ b/engines/pink/objects/actions/action_sound.cpp
@@ -41,7 +41,7 @@ ActionSound::~ActionSound(){
void ActionSound::deserialize(Archive &archive) {
Action::deserialize(archive);
- archive >> _fileName;
+ _fileName = archive.readString();
_volume = archive.readDWORD();
_isLoop = (bool) archive.readDWORD();
_isBackground = (bool) archive.readDWORD();
diff --git a/engines/pink/objects/actions/action_still.cpp b/engines/pink/objects/actions/action_still.cpp
index 0bcfceb..6afa2df 100644
--- a/engines/pink/objects/actions/action_still.cpp
+++ b/engines/pink/objects/actions/action_still.cpp
@@ -31,7 +31,7 @@ namespace Pink {
void ActionStill::deserialize(Archive &archive) {
ActionCEL::deserialize(archive);
- archive >> _startFrame;
+ _startFrame = archive.readDWORD();
}
void ActionStill::toConsole() {
diff --git a/engines/pink/objects/actions/action_talk.cpp b/engines/pink/objects/actions/action_talk.cpp
index 20abdc0..ab15aed 100644
--- a/engines/pink/objects/actions/action_talk.cpp
+++ b/engines/pink/objects/actions/action_talk.cpp
@@ -31,7 +31,7 @@ namespace Pink {
void ActionTalk::deserialize(Archive &archive) {
ActionLoop::deserialize(archive);
- archive >> _vox;
+ _vox = archive.readString();
}
void ActionTalk::toConsole() {
diff --git a/engines/pink/objects/actions/action_text.cpp b/engines/pink/objects/actions/action_text.cpp
index 034aa1d..27bcafe 100644
--- a/engines/pink/objects/actions/action_text.cpp
+++ b/engines/pink/objects/actions/action_text.cpp
@@ -29,10 +29,12 @@ namespace Pink {
void ActionText::deserialize(Archive &archive) {
for (int i = 0; i < 4 ; ++i) {
- archive >> _bounds[i];
+ _bounds[i] = archive.readDWORD();
}
- archive >> _centered >> _scrollBar
- >> _textColor >> _backgroundColor;
+ _centered = archive.readDWORD();
+ _scrollBar = archive.readDWORD();
+ _textColor = archive.readDWORD();
+ _backgroundColor = archive.readDWORD();
}
void ActionText::toConsole() {
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index 67e0b2a..c807937 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -32,7 +32,7 @@ namespace Pink {
void Actor::deserialize(Archive &archive) {
NamedObject::deserialize(archive);
_page = static_cast<GamePage*>(archive.readObject());
- archive >> _actions;
+ _actions.deserialize(archive);
}
void Actor::toConsole() {
@@ -135,7 +135,7 @@ Actor::~Actor() {
void Actor::loadState(Archive &archive) {
Common::String actionName;
- archive >> actionName;
+ actionName = archive.readString();
_action = findAction(actionName);
}
diff --git a/engines/pink/objects/actors/actor.h b/engines/pink/objects/actors/actor.h
index 4992a75..b7650a2 100644
--- a/engines/pink/objects/actors/actor.h
+++ b/engines/pink/objects/actors/actor.h
@@ -23,10 +23,9 @@
#ifndef PINK_ACTOR_H
#define PINK_ACTOR_H
-#include "common/array.h"
#include "common/rect.h"
-#include "pink/objects/object.h"
+#include "pink/utils.h"
namespace Pink {
@@ -81,7 +80,7 @@ public:
protected:
GamePage *_page;
Action *_action;
- Common::Array<Action*> _actions;
+ Array<Action*> _actions;
bool _isActionEnded;
};
diff --git a/engines/pink/objects/actors/pda_button_actor.cpp b/engines/pink/objects/actors/pda_button_actor.cpp
index 18e29a6..d1bd63c 100644
--- a/engines/pink/objects/actors/pda_button_actor.cpp
+++ b/engines/pink/objects/actors/pda_button_actor.cpp
@@ -20,7 +20,6 @@
*
*/
-#include "pink/archive.h"
#include "pink/objects/actors/pda_button_actor.h"
namespace Pink {
diff --git a/engines/pink/objects/actors/supporting_actor.cpp b/engines/pink/objects/actors/supporting_actor.cpp
index 4971cca..04fbb8b 100644
--- a/engines/pink/objects/actors/supporting_actor.cpp
+++ b/engines/pink/objects/actors/supporting_actor.cpp
@@ -20,7 +20,7 @@
*
*/
-#include "pink/archive.h"
+#include "pink/utils.h"
#include "pink/constants.h"
#include "pink/cursor_mgr.h"
#include "pink/objects/inventory.h"
@@ -31,7 +31,9 @@ namespace Pink {
void SupportingActor::deserialize(Archive &archive) {
Actor::deserialize(archive);
- archive >> _location >> _pdaLink >> _cursor;
+ _location = archive.readString();
+ _pdaLink = archive.readString();
+ _cursor = archive.readString();
_handlerMgr.deserialize(archive);
}
diff --git a/engines/pink/objects/condition.cpp b/engines/pink/objects/condition.cpp
index 3de8605..be12730 100644
--- a/engines/pink/objects/condition.cpp
+++ b/engines/pink/objects/condition.cpp
@@ -29,7 +29,8 @@
namespace Pink {
void Pink::ConditionVariable::deserialize(Archive &archive) {
- archive >> _name >> _value;
+ _name = archive.readString();
+ _value = archive.readString();
}
bool Pink::ConditionGameVariable::evaluate(Actor *actor) {
@@ -73,7 +74,8 @@ void ConditionNotPageVariable::toConsole() {
}
void ConditionInventoryItemOwner::deserialize(Archive &archive) {
- archive >> _item >> _owner;
+ _item = archive.readString();
+ _owner = archive.readString();
}
bool ConditionInventoryItemOwner::evaluate(Actor *actor) {
diff --git a/engines/pink/objects/handlers/handler.cpp b/engines/pink/objects/handlers/handler.cpp
index 4c30222..8833153 100644
--- a/engines/pink/objects/handlers/handler.cpp
+++ b/engines/pink/objects/handlers/handler.cpp
@@ -33,8 +33,8 @@
namespace Pink {
void Handler::deserialize(Archive &archive) {
- archive >> _conditions;
- archive >> _sideEffects;
+ _conditions.deserialize(archive);
+ _sideEffects.deserialize(archive);
}
bool Handler::isSuitable(Actor *actor) {
@@ -67,7 +67,7 @@ Handler::~Handler() {
void HandlerSequences::deserialize(Archive &archive) {
Handler::deserialize(archive);
- archive >> _sequences;
+ _sequences.deserialize(archive);
}
void HandlerSequences::handle(Actor *actor) {
@@ -131,7 +131,8 @@ void HandlerLeftClick::toConsole() {
void HandlerUseClick::deserialize(Archive &archive) {
HandlerSequences::deserialize(archive);
- archive >> _inventoryItem >> _recepient;
+ _inventoryItem = archive.readString();
+ _recepient = archive.readString();
}
void HandlerUseClick::toConsole() {
diff --git a/engines/pink/objects/handlers/handler.h b/engines/pink/objects/handlers/handler.h
index 769a4c3..9d0d298 100644
--- a/engines/pink/objects/handlers/handler.h
+++ b/engines/pink/objects/handlers/handler.h
@@ -44,8 +44,8 @@ public:
protected:
void executeSideEffects(Actor *actor);
- Common::Array<Condition*> _conditions;
- Common::Array<SideEffect*> _sideEffects;
+ Array<Condition*> _conditions;
+ Array<SideEffect*> _sideEffects;
};
class Sequence;
@@ -58,7 +58,7 @@ public:
protected:
virtual void execute(Sequence *sequence) = 0;
- Common::StringArray _sequences;
+ StringArray _sequences;
};
class HandlerStartPage : public HandlerSequences {
diff --git a/engines/pink/objects/handlers/handler_mgr.cpp b/engines/pink/objects/handlers/handler_mgr.cpp
index c326ae8..2c5230e 100644
--- a/engines/pink/objects/handlers/handler_mgr.cpp
+++ b/engines/pink/objects/handlers/handler_mgr.cpp
@@ -28,7 +28,9 @@
namespace Pink {
void HandlerMgr::deserialize(Archive &archive) {
- archive >> _leftClickHandlers >> _useClickHandlers >> _timerHandlers;
+ _leftClickHandlers.deserialize(archive);
+ _useClickHandlers.deserialize(archive);
+ _timerHandlers.deserialize(archive);
}
void HandlerMgr::toConsole() {
diff --git a/engines/pink/objects/handlers/handler_mgr.h b/engines/pink/objects/handlers/handler_mgr.h
index f9a0739..36e2b05 100644
--- a/engines/pink/objects/handlers/handler_mgr.h
+++ b/engines/pink/objects/handlers/handler_mgr.h
@@ -23,8 +23,6 @@
#ifndef PINK_HANDLER_MGR_H
#define PINK_HANDLER_MGR_H
-#include "common/array.h"
-
#include "pink/objects/object.h"
namespace Pink {
@@ -58,9 +56,9 @@ private:
HandlerLeftClick *findSuitableHandlerLeftClick(Actor *actor);
HandlerUseClick *findSuitableHandlerUseClick(Actor *actor, InventoryItem *item);
- Common::Array<HandlerLeftClick*> _leftClickHandlers;
- Common::Array<HandlerUseClick*> _useClickHandlers;
- Common::Array<Handler*> _timerHandlers;
+ Array<HandlerLeftClick*> _leftClickHandlers;
+ Array<HandlerUseClick*> _useClickHandlers;
+ Array<Handler*> _timerHandlers;
};
}
diff --git a/engines/pink/objects/handlers/handler_timer.cpp b/engines/pink/objects/handlers/handler_timer.cpp
index e9af952..469b6f9 100644
--- a/engines/pink/objects/handlers/handler_timer.cpp
+++ b/engines/pink/objects/handlers/handler_timer.cpp
@@ -37,7 +37,7 @@ namespace Pink {
void HandlerTimerActions::deserialize(Archive &archive) {
Handler::deserialize(archive);
- archive >> _actions;
+ _actions.deserialize(archive);
}
void HandlerTimerActions::toConsole() {
diff --git a/engines/pink/objects/handlers/handler_timer.h b/engines/pink/objects/handlers/handler_timer.h
index 737804f..b0fb4bc 100644
--- a/engines/pink/objects/handlers/handler_timer.h
+++ b/engines/pink/objects/handlers/handler_timer.h
@@ -23,8 +23,6 @@
#ifndef PINK_HANDLER_TIMER_H
#define PINK_HANDLER_TIMER_H
-#include "common/str-array.h"
-
#include "pink/objects/handlers/handler.h"
namespace Pink {
@@ -46,7 +44,7 @@ public:
virtual void handle(Actor *actor);
private:
- Common::StringArray _actions;
+ StringArray _actions;
};
//appear in HokusPokus
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
index c2607be..4280cd5 100644
--- a/engines/pink/objects/inventory.cpp
+++ b/engines/pink/objects/inventory.cpp
@@ -23,7 +23,6 @@
#include "common/debug.h"
-#include "pink/archive.h"
#include "pink/director.h"
#include "pink/pink.h"
#include "pink/objects/inventory.h"
@@ -59,7 +58,7 @@ InventoryMgr::~InventoryMgr() {
}
void InventoryMgr::deserialize(Archive &archive) {
- archive >> _items;
+ _items.deserialize(archive);
}
InventoryItem *InventoryMgr::findInventoryItem(const Common::String &name) {
diff --git a/engines/pink/objects/inventory.h b/engines/pink/objects/inventory.h
index 8cb4f0a..b8de36b 100644
--- a/engines/pink/objects/inventory.h
+++ b/engines/pink/objects/inventory.h
@@ -23,14 +23,12 @@
#ifndef PINK_INVENTORY_H
#define PINK_INVENTORY_H
-#include "common/array.h"
#include "common/rect.h"
-#include "pink/objects/object.h"
+#include "pink/utils.h"
namespace Pink {
-
class InventoryItem : public NamedObject {
public:
virtual void deserialize(Archive &archive);
@@ -77,8 +75,7 @@ private:
void showNextItem(bool direction);
- InventoryItem *_item;
- Common::Array<InventoryItem*> _items;
+
LeadActor *_lead;
Actor *_window;
@@ -86,6 +83,9 @@ private:
Actor *_rightArrow;
Actor *_leftArrow;
+ InventoryItem *_item;
+ Array<InventoryItem*> _items;
+
enum State {
kIdle = 0,
kOpening = 1,
diff --git a/engines/pink/objects/module.cpp b/engines/pink/objects/module.cpp
index 2b15187..6f9fab0 100644
--- a/engines/pink/objects/module.cpp
+++ b/engines/pink/objects/module.cpp
@@ -49,7 +49,7 @@ void Module::load(Archive &archive){
archive.readString(); // skip directory
_invMgr.deserialize(archive);
- archive >> _pages;
+ _pages.deserialize(archive);
}
void Module::init(bool isLoadingSave, const Common::String &pageName) {
diff --git a/engines/pink/objects/module.h b/engines/pink/objects/module.h
index c19571b..622381d 100644
--- a/engines/pink/objects/module.h
+++ b/engines/pink/objects/module.h
@@ -65,7 +65,7 @@ private:
PinkEngine *_game;
GamePage *_page;
- Common::Array<GamePage*> _pages;
+ Array<GamePage*> _pages;
InventoryMgr _invMgr;
Common::StringMap _variables;
};
diff --git a/engines/pink/objects/object.cpp b/engines/pink/objects/object.cpp
index d123aaf..796b356 100644
--- a/engines/pink/objects/object.cpp
+++ b/engines/pink/objects/object.cpp
@@ -23,7 +23,6 @@
#include "common/debug.h"
#include "pink/archive.h"
-#include "pink/objects/object.h"
namespace Pink {
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index bdfb92b..ca9f304 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -65,7 +65,7 @@ void GamePage::load(Archive &archive) {
_walkMgr->deserialize(archive);
_sequencer->deserialize(archive);
- archive >> _handlers;
+ _handlers.deserialize(archive);
}
void GamePage::init(bool isLoadingSave) {
@@ -153,11 +153,17 @@ void GamePage::loadState() {
//_variables.clear(1);
Common::StringMap mapTest; // HACK. Without it isn't working
//archive >> _variables;
- archive >> mapTest;
+
+ uint size = archive.readCount();
+ for (uint i = 0; i < size; ++i) {
+ Common::String key = archive.readString();
+ Common::String val = archive.readString();
+ mapTest.setVal(key, val);
+ }
+
_variables = mapTest;
- uint16 actorCount;
- archive >> actorCount;
+ uint16 actorCount = archive.readWORD();
Common::String actorName;
for (int i = 0; i < actorCount; ++i) {
@@ -170,7 +176,10 @@ void GamePage::saveState() {
_memFile = new Common::MemoryReadWriteStream(DisposeAfterUse::YES);
Archive archive(static_cast<Common::WriteStream*>(_memFile));
- archive << _variables;
+ for (Common::StringMap::const_iterator it = _variables.begin(); it != _variables.end(); ++it) {
+ archive.writeString(it->_key);
+ archive.writeString(it->_value);
+ }
archive.writeWORD(_actors.size());
for (uint i = 0; i < _actors.size(); ++i) {
diff --git a/engines/pink/objects/pages/game_page.h b/engines/pink/objects/pages/game_page.h
index 9aa5422..37584ee 100644
--- a/engines/pink/objects/pages/game_page.h
+++ b/engines/pink/objects/pages/game_page.h
@@ -67,7 +67,7 @@ private:
CursorMgr *_cursorMgr;
WalkMgr *_walkMgr;
Sequencer *_sequencer;
- Common::Array<HandlerStartPage*> _handlers;
+ Array<HandlerStartPage*> _handlers;
Common::StringMap _variables;
};
diff --git a/engines/pink/objects/pages/page.cpp b/engines/pink/objects/pages/page.cpp
index cf2d3a0..3c46d19 100644
--- a/engines/pink/objects/pages/page.cpp
+++ b/engines/pink/objects/pages/page.cpp
@@ -34,7 +34,7 @@ void Page::load(Archive &archive) {
archive.mapObject(this);
NamedObject::deserialize(archive);
archive.readString(); //skip directory
- archive >> _actors;
+ _actors.deserialize(archive);
}
Actor *Page::findActor(const Common::String &name) {
diff --git a/engines/pink/objects/pages/page.h b/engines/pink/objects/pages/page.h
index c6d8220..2d1990c 100644
--- a/engines/pink/objects/pages/page.h
+++ b/engines/pink/objects/pages/page.h
@@ -51,7 +51,7 @@ public:
protected:
void init();
- Common::Array<Actor*> _actors;
+ Array<Actor*> _actors;
ResourceMgr _resMgr;
LeadActor *_leadActor;
};
diff --git a/engines/pink/objects/sequences/seq_timer.cpp b/engines/pink/objects/sequences/seq_timer.cpp
index c8d166a..e661308 100644
--- a/engines/pink/objects/sequences/seq_timer.cpp
+++ b/engines/pink/objects/sequences/seq_timer.cpp
@@ -35,7 +35,7 @@ SeqTimer::SeqTimer()
: _updatesToMessage(0) {}
void SeqTimer::deserialize(Archive &archive) {
- archive >> _actor;
+ _actor = archive.readString();
_period = archive.readDWORD();
_range = archive.readDWORD();
_sequencer = static_cast<Sequencer*>(archive.readObject());
diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp
index ae97965..4cd041b 100644
--- a/engines/pink/objects/sequences/sequence.cpp
+++ b/engines/pink/objects/sequences/sequence.cpp
@@ -46,7 +46,7 @@ Sequence::~Sequence() {
void Sequence::deserialize(Archive &archive) {
NamedObject::deserialize(archive);
_sequencer = static_cast<Sequencer*>(archive.readObject());
- archive >> _items;
+ _items.deserialize(archive);
}
void Sequence::toConsole() {
@@ -138,7 +138,7 @@ void Sequence::skipSubSequence() {
void SequenceAudio::deserialize(Archive &archive) {
Sequence::deserialize(archive);
- archive >> _soundName;
+ _soundName = archive.readString();
}
void SequenceAudio::toConsole() {
diff --git a/engines/pink/objects/sequences/sequence.h b/engines/pink/objects/sequences/sequence.h
index ba6d3be..e40b016 100644
--- a/engines/pink/objects/sequences/sequence.h
+++ b/engines/pink/objects/sequences/sequence.h
@@ -23,8 +23,6 @@
#ifndef PINK_SEQUENCE_H
#define PINK_SEQUENCE_H
-#include "common/array.h"
-
#include "pink/objects/object.h"
namespace Pink {
@@ -58,7 +56,7 @@ public:
public:
SequenceContext *_context;
Sequencer *_sequencer;
- Common::Array<SequenceItem*> _items;
+ Array<SequenceItem*> _items;
int _unk;
};
diff --git a/engines/pink/objects/sequences/sequence_item.cpp b/engines/pink/objects/sequences/sequence_item.cpp
index a6574b1..07c708b 100644
--- a/engines/pink/objects/sequences/sequence_item.cpp
+++ b/engines/pink/objects/sequences/sequence_item.cpp
@@ -34,7 +34,8 @@
namespace Pink {
void SequenceItem::deserialize(Archive &archive) {
- archive >> _actor >> _action;
+ _actor = archive.readString();
+ _action = archive.readString();
}
void SequenceItem::toConsole() {
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index b862819..852011c 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -44,7 +44,8 @@ Sequencer::~Sequencer() {
}
void Sequencer::deserialize(Archive &archive) {
- archive >> _sequences >> _timers;
+ _sequences.deserialize(archive);
+ _timers.deserialize(archive);
}
Sequence *Sequencer::findSequence(const Common::String &name) {
diff --git a/engines/pink/objects/sequences/sequencer.h b/engines/pink/objects/sequences/sequencer.h
index 850649d..a484397 100644
--- a/engines/pink/objects/sequences/sequencer.h
+++ b/engines/pink/objects/sequences/sequencer.h
@@ -23,8 +23,6 @@
#ifndef PINK_SEQUENCER_H
#define PINK_SEQUENCER_H
-#include "common/array.h"
-
#include "pink/objects/object.h"
namespace Pink {
@@ -62,10 +60,10 @@ public:
SequenceContext *_context;
// context array
- Common::Array<Sequence*> _sequences;
- Common::String _currentSequenceName;
- Common::Array<SeqTimer*> _timers;
- GamePage *_page;
+ Array<Sequence*> _sequences;
+ Array<SeqTimer*> _timers;
+ Common::String _currentSequenceName;
+ GamePage *_page;
uint _time;
};
diff --git a/engines/pink/objects/side_effect.cpp b/engines/pink/objects/side_effect.cpp
index cbd8291..79d1c7f 100644
--- a/engines/pink/objects/side_effect.cpp
+++ b/engines/pink/objects/side_effect.cpp
@@ -33,7 +33,8 @@
namespace Pink {
void SideEffectExit::deserialize(Archive &archive) {
- archive >> _nextModule >> _nextPage;
+ _nextModule = archive.readString();
+ _nextPage = archive.readString();
}
void SideEffectExit::execute(Actor *actor) {
@@ -45,7 +46,7 @@ void SideEffectExit::toConsole() {
}
void SideEffectLocation::deserialize(Archive &archive) {
- archive >> _location;
+ _location = archive.readString();
}
void SideEffectLocation::execute(Actor *actor) {
@@ -60,7 +61,8 @@ void SideEffectLocation::toConsole() {
}
void SideEffectInventoryItemOwner::deserialize(Archive &archive) {
- archive >> _item >> _owner;
+ _item = archive.readString();
+ _owner = archive.readString();
}
void SideEffectInventoryItemOwner::execute(Actor *actor) {
@@ -74,7 +76,8 @@ void SideEffectInventoryItemOwner::toConsole() {
}
void SideEffectVariable::deserialize(Pink::Archive &archive) {
- archive >> _name >> _value;
+ _name = archive.readString();
+ _value = archive.readString();
}
void SideEffectGameVariable::execute(Actor *actor) {
@@ -102,7 +105,8 @@ void SideEffectPageVariable::toConsole() {
}
void SideEffectRandomPageVariable::deserialize(Archive &archive) {
- archive >> _name >> _values;
+ _name = archive.readString();
+ _values.deserialize(archive);
}
void SideEffectRandomPageVariable::execute(Actor *actor) {
diff --git a/engines/pink/objects/side_effect.h b/engines/pink/objects/side_effect.h
index da6d548..1a08d85 100644
--- a/engines/pink/objects/side_effect.h
+++ b/engines/pink/objects/side_effect.h
@@ -23,8 +23,7 @@
#ifndef PINK_SIDE_EFFECT_H
#define PINK_SIDE_EFFECT_H
-#include "common/str-array.h"
-
+#include "pink/utils.h"
#include "pink/objects/object.h"
namespace Pink {
@@ -46,6 +45,7 @@ public:
private:
Common::String _nextModule;
Common::String _nextPage;
+ Common::StringMap map;
};
class SideEffectLocation : public SideEffect {
@@ -106,9 +106,9 @@ public:
private:
Common::String _name;
- Common::StringArray _values;
+ StringArray _values;
};
-}
+} // End of namespace Pink
#endif
diff --git a/engines/pink/objects/walk/walk_location.cpp b/engines/pink/objects/walk/walk_location.cpp
index da5718f..e3998da 100644
--- a/engines/pink/objects/walk/walk_location.cpp
+++ b/engines/pink/objects/walk/walk_location.cpp
@@ -29,7 +29,7 @@ namespace Pink {
void WalkLocation::deserialize(Pink::Archive &archive) {
NamedObject::deserialize(archive);
- archive >> _neighbors;
+ _neighbors.deserialize(archive);
}
void WalkLocation::toConsole() {
diff --git a/engines/pink/objects/walk/walk_location.h b/engines/pink/objects/walk/walk_location.h
index 3de0390..b9b2a0a 100644
--- a/engines/pink/objects/walk/walk_location.h
+++ b/engines/pink/objects/walk/walk_location.h
@@ -22,9 +22,7 @@
#ifndef PINK_WALK_LOCATION_H
#define PINK_WALK_LOCATION_H
-#include "common/str-array.h"
-
-#include "pink/objects/object.h"
+#include "pink/utils.h"
namespace Pink {
@@ -35,7 +33,7 @@ public:
Common::StringArray &getNeigbors() { return _neighbors;}
private:
- Common::StringArray _neighbors;
+ StringArray _neighbors;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/walk/walk_mgr.cpp b/engines/pink/objects/walk/walk_mgr.cpp
index ad447a9..4c0b120 100644
--- a/engines/pink/objects/walk/walk_mgr.cpp
+++ b/engines/pink/objects/walk/walk_mgr.cpp
@@ -37,7 +37,7 @@ WalkMgr::WalkMgr()
void WalkMgr::deserialize(Pink::Archive &archive) {
_leadActor = static_cast<LeadActor *>(archive.readObject());
- archive >> _locations;
+ _locations.deserialize(archive);
}
WalkLocation *WalkMgr::findLocation(const Common::String &name) {
diff --git a/engines/pink/objects/walk/walk_mgr.h b/engines/pink/objects/walk/walk_mgr.h
index 522dcf8..9947969 100644
--- a/engines/pink/objects/walk/walk_mgr.h
+++ b/engines/pink/objects/walk/walk_mgr.h
@@ -23,8 +23,6 @@
#ifndef PINK_WALK_MGR_H
#define PINK_WALK_MGR_H
-#include "common/array.h"
-
#include "pink/objects/object.h"
#include "pink/objects/walk/walk_shortest_path.h"
@@ -65,7 +63,7 @@ private:
LeadActor *_leadActor;
WalkLocation *_destination;
- Common::Array<WalkLocation*> _locations;
+ Array<WalkLocation*> _locations;
WayPoint _current;
WayPoint _next;
bool _isWalking;
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index 1923c00..ee564dc 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -30,7 +30,6 @@
#include "pink/pink.h"
#include "pink/console.h"
-#include "pink/objects/side_effect.h"
#include "pink/objects/module.h"
#include "pink/objects/actors/lead_actor.h"
#include "pink/objects/sequences/sequencer.h"
@@ -140,7 +139,7 @@ Common::Error Pink::PinkEngine::run() {
void PinkEngine::load(Archive &archive) {
archive.readString();
archive.readString();
- archive >> _modules;
+ _modules.deserialize(archive);
}
void PinkEngine::initModule(const Common::String &moduleName, bool isLoadingFromSave, const Common::String &pageName) {
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index 634adcd..e77ba72 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -35,6 +35,7 @@
#include "pink/constants.h"
#include "pink/director.h"
#include "pink/file.h"
+#include "pink/utils.h"
/*
* This is the namespace of the Pink engine.
@@ -122,7 +123,7 @@ private:
LeadActor *_actor;
Module *_module;
- Common::Array<NamedObject*> _modules;
+ Array<NamedObject*> _modules;
Common::StringMap _variables;
diff --git a/engines/pink/utils.h b/engines/pink/utils.h
new file mode 100644
index 0000000..77efdb9
--- /dev/null
+++ b/engines/pink/utils.h
@@ -0,0 +1,55 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_UTILS_H
+#define PINK_UTILS_H
+
+#include "pink/archive.h"
+
+namespace Pink {
+
+template <typename T>
+class Array : public Common::Array<T>, public Object {
+public:
+ virtual void deserialize(Archive &archive) {
+ uint size = archive.readCount();
+ this->resize(size);
+ for (uint i = 0; i < size; ++i) {
+ this->data()[i] = reinterpret_cast<T>(archive.readObject()); // dynamic_cast needs to know complete type
+ }
+ }
+};
+
+class StringArray : public Common::StringArray {
+public:
+ inline void deserialize(Archive &archive) {
+ uint32 size = archive.readCount();
+ this->resize(size);
+ for (uint i = 0; i < size; ++i) {
+ this->data()[i] = archive.readString();
+ }
+ }
+};
+
+} // End of namespace Pink
+
+#endif
\ No newline at end of file
Commit: c06452594f13c93fe2d21f61e04a99d430ced65b
https://github.com/scummvm/scummvm/commit/c06452594f13c93fe2d21f61e04a99d430ced65b
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix no newline warning
Changed paths:
engines/pink/archive.cpp
engines/pink/cel_decoder.cpp
engines/pink/cursor_mgr.cpp
engines/pink/director.cpp
engines/pink/file.cpp
engines/pink/objects/actions/action_cel.cpp
engines/pink/objects/actions/action_hide.cpp
engines/pink/objects/actions/action_loop.cpp
engines/pink/objects/actions/action_play_with_sfx.cpp
engines/pink/objects/actions/action_sound.cpp
engines/pink/objects/actions/action_still.cpp
engines/pink/objects/actions/action_talk.cpp
engines/pink/objects/actions/action_text.cpp
engines/pink/objects/actions/walk_action.cpp
engines/pink/objects/actors/actor.cpp
engines/pink/objects/actors/pda_button_actor.cpp
engines/pink/objects/actors/pda_button_actor.h
engines/pink/objects/actors/supporting_actor.cpp
engines/pink/objects/condition.cpp
engines/pink/objects/condition.h
engines/pink/objects/handlers/handler_mgr.cpp
engines/pink/objects/handlers/handler_timer.cpp
engines/pink/objects/handlers/handler_timer.h
engines/pink/objects/inventory.cpp
engines/pink/objects/module.cpp
engines/pink/objects/object.cpp
engines/pink/objects/object.h
engines/pink/objects/pages/game_page.cpp
engines/pink/objects/pages/game_page.h
engines/pink/objects/pages/page.cpp
engines/pink/objects/pages/page.h
engines/pink/objects/sequences/seq_timer.cpp
engines/pink/objects/sequences/sequence.cpp
engines/pink/objects/sequences/sequence_context.cpp
engines/pink/objects/sequences/sequence_item.cpp
engines/pink/objects/sequences/sequencer.cpp
engines/pink/objects/sequences/sequencer.h
engines/pink/objects/side_effect.cpp
engines/pink/objects/walk/walk_location.cpp
engines/pink/objects/walk/walk_location.h
engines/pink/objects/walk/walk_mgr.cpp
engines/pink/objects/walk/walk_shortest_path.cpp
engines/pink/objects/walk/walk_shortest_path.h
engines/pink/pink.cpp
engines/pink/pink.h
engines/pink/sound.cpp
engines/pink/utils.h
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp
index 6b442ae..a3c968b 100644
--- a/engines/pink/archive.cpp
+++ b/engines/pink/archive.cpp
@@ -344,5 +344,3 @@ void Archive::writeString(const Common::String &string) {
}
} // End of namespace Pink
-
-
diff --git a/engines/pink/cel_decoder.cpp b/engines/pink/cel_decoder.cpp
index ad0a7ac..044a8d0 100644
--- a/engines/pink/cel_decoder.cpp
+++ b/engines/pink/cel_decoder.cpp
@@ -249,4 +249,4 @@ void CelDecoder::CelVideoTrack::setY(int32 y) {
_center.y = y;//+ getHeight() / 2;
}
-} // End of namepsace Pink
\ No newline at end of file
+} // End of namepsace Pink
diff --git a/engines/pink/cursor_mgr.cpp b/engines/pink/cursor_mgr.cpp
index b42ef74..867a0f3 100644
--- a/engines/pink/cursor_mgr.cpp
+++ b/engines/pink/cursor_mgr.cpp
@@ -118,4 +118,4 @@ void CursorMgr::startAnimation(int index) {
}
}
-} // End of namespace Pink
\ No newline at end of file
+} // End of namespace Pink
diff --git a/engines/pink/director.cpp b/engines/pink/director.cpp
index c504194..10c3e1d 100644
--- a/engines/pink/director.cpp
+++ b/engines/pink/director.cpp
@@ -138,4 +138,4 @@ Actor *Director::getActorByPoint(Common::Point point) {
return nullptr;
}
-}
\ No newline at end of file
+}
diff --git a/engines/pink/file.cpp b/engines/pink/file.cpp
index 2f2bc69..72de8eb 100644
--- a/engines/pink/file.cpp
+++ b/engines/pink/file.cpp
@@ -154,4 +154,4 @@ void ResourceDescription::load(Common::File &file) {
inBro = (bool) file.readUint16LE();
}
-} // End of namespace Pink
\ No newline at end of file
+} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp
index 1b33fd7..352c635 100644
--- a/engines/pink/objects/actions/action_cel.cpp
+++ b/engines/pink/objects/actions/action_cel.cpp
@@ -92,4 +92,4 @@ void ActionCEL::unpause() {
_decoder->pauseVideo(0);
}
-} // End of namespace Pink
\ No newline at end of file
+} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_hide.cpp b/engines/pink/objects/actions/action_hide.cpp
index 6678d93..a8a9a3a 100644
--- a/engines/pink/objects/actions/action_hide.cpp
+++ b/engines/pink/objects/actions/action_hide.cpp
@@ -45,4 +45,4 @@ void ActionHide::toConsole() {
ActionHide::~ActionHide() {}
-} //End of namespace Pink
\ No newline at end of file
+} //End of namespace Pink
diff --git a/engines/pink/objects/actions/action_loop.cpp b/engines/pink/objects/actions/action_loop.cpp
index 03c04f9..77a1763 100644
--- a/engines/pink/objects/actions/action_loop.cpp
+++ b/engines/pink/objects/actions/action_loop.cpp
@@ -66,4 +66,4 @@ void ActionLoop::onStart() {
_actor->endAction();
}
-} // End of namespace Pink
\ No newline at end of file
+} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_play_with_sfx.cpp b/engines/pink/objects/actions/action_play_with_sfx.cpp
index f54d81c..e6f5570 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.cpp
+++ b/engines/pink/objects/actions/action_play_with_sfx.cpp
@@ -115,4 +115,4 @@ void ActionSfx::end() {
_sound = nullptr;
}
-} // End of namespace Pink
\ No newline at end of file
+} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_sound.cpp b/engines/pink/objects/actions/action_sound.cpp
index 196ae61..45d74be 100644
--- a/engines/pink/objects/actions/action_sound.cpp
+++ b/engines/pink/objects/actions/action_sound.cpp
@@ -96,4 +96,4 @@ void ActionSound::unpause() {
_sound->resume();
}
-} // End of namespace Pink
\ No newline at end of file
+} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_still.cpp b/engines/pink/objects/actions/action_still.cpp
index 6afa2df..c72e634 100644
--- a/engines/pink/objects/actions/action_still.cpp
+++ b/engines/pink/objects/actions/action_still.cpp
@@ -54,4 +54,4 @@ void ActionStill::onStart() {
_actor->endAction();
}
-} // End of namespace Pink
\ No newline at end of file
+} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_talk.cpp b/engines/pink/objects/actions/action_talk.cpp
index ab15aed..fad3f19 100644
--- a/engines/pink/objects/actions/action_talk.cpp
+++ b/engines/pink/objects/actions/action_talk.cpp
@@ -72,4 +72,4 @@ void ActionTalk::unpause() {
_sound->resume();
}
-} // End of namespace Pink
\ No newline at end of file
+} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_text.cpp b/engines/pink/objects/actions/action_text.cpp
index 27bcafe..12e2809 100644
--- a/engines/pink/objects/actions/action_text.cpp
+++ b/engines/pink/objects/actions/action_text.cpp
@@ -43,4 +43,4 @@ void ActionText::toConsole() {
_name.c_str(), _text.c_str(), _bounds[0], _bounds[1], _bounds[2], _bounds[3], _centered, _scrollBar, _textColor, _backgroundColor);
}
-} // End of namespace Pink
\ No newline at end of file
+} // End of namespace Pink
diff --git a/engines/pink/objects/actions/walk_action.cpp b/engines/pink/objects/actions/walk_action.cpp
index 42ce90e..d05e94e 100644
--- a/engines/pink/objects/actions/walk_action.cpp
+++ b/engines/pink/objects/actions/walk_action.cpp
@@ -41,4 +41,4 @@ void WalkAction::onStart() {
_decoder->start();
}
-} // End of namespace Pink
\ No newline at end of file
+} // End of namespace Pink
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index c807937..4853f8d 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -99,12 +99,14 @@ void Actor::setAction(Action *newAction) {
}
void Actor::setAction(Action *newAction, bool unk) {
- if (unk){
+ if (unk) {
assert(0); // want to see this
_isActionEnded = 1;
_action = newAction;
}
- else setAction(newAction);
+ else {
+ setAction(newAction);
+ }
}
Action *Actor::getAction() const {
diff --git a/engines/pink/objects/actors/pda_button_actor.cpp b/engines/pink/objects/actors/pda_button_actor.cpp
index d1bd63c..1057a06 100644
--- a/engines/pink/objects/actors/pda_button_actor.cpp
+++ b/engines/pink/objects/actors/pda_button_actor.cpp
@@ -39,4 +39,4 @@ void PDAButtonActor::toConsole() {
_name.c_str(), _x, _y, _hideOnStop, _opaque, (int) _command);
}
-} // End of namespace Pink
\ No newline at end of file
+} // End of namespace Pink
diff --git a/engines/pink/objects/actors/pda_button_actor.h b/engines/pink/objects/actors/pda_button_actor.h
index b3a6d20..c3cd845 100644
--- a/engines/pink/objects/actors/pda_button_actor.h
+++ b/engines/pink/objects/actors/pda_button_actor.h
@@ -44,6 +44,6 @@ private:
Command _command;
};
-}
+} // End of namespace Pink
#endif
diff --git a/engines/pink/objects/actors/supporting_actor.cpp b/engines/pink/objects/actors/supporting_actor.cpp
index 04fbb8b..9c06dee 100644
--- a/engines/pink/objects/actors/supporting_actor.cpp
+++ b/engines/pink/objects/actors/supporting_actor.cpp
@@ -90,4 +90,4 @@ void SupportingActor::onHover(Common::Point point, const Common::String &itemNam
Actor::onHover(point, item, cursorMgr);
}
-} // End of namespace Pink
\ No newline at end of file
+} // End of namespace Pink
diff --git a/engines/pink/objects/condition.cpp b/engines/pink/objects/condition.cpp
index be12730..4e0b376 100644
--- a/engines/pink/objects/condition.cpp
+++ b/engines/pink/objects/condition.cpp
@@ -97,4 +97,3 @@ void ConditionNotInventoryItemOwner::toConsole() {
}
} // End of namespace Pink
-
diff --git a/engines/pink/objects/condition.h b/engines/pink/objects/condition.h
index 4b48d83..505ed2d 100644
--- a/engines/pink/objects/condition.h
+++ b/engines/pink/objects/condition.h
@@ -102,5 +102,4 @@ public:
} // End of namespace Pink
-
#endif
diff --git a/engines/pink/objects/handlers/handler_mgr.cpp b/engines/pink/objects/handlers/handler_mgr.cpp
index 2c5230e..695030f 100644
--- a/engines/pink/objects/handlers/handler_mgr.cpp
+++ b/engines/pink/objects/handlers/handler_mgr.cpp
@@ -131,4 +131,4 @@ HandlerMgr::~HandlerMgr() {
}
}
-}
+} // End of namespace Pink
diff --git a/engines/pink/objects/handlers/handler_timer.cpp b/engines/pink/objects/handlers/handler_timer.cpp
index 469b6f9..d9f75f6 100644
--- a/engines/pink/objects/handlers/handler_timer.cpp
+++ b/engines/pink/objects/handlers/handler_timer.cpp
@@ -108,4 +108,4 @@ void HandlerTimerSequences::handle(Actor *actor) {
assert(sequence);
}
-} // End of namespace Pink
\ No newline at end of file
+} // End of namespace Pink
diff --git a/engines/pink/objects/handlers/handler_timer.h b/engines/pink/objects/handlers/handler_timer.h
index b0fb4bc..cbe6824 100644
--- a/engines/pink/objects/handlers/handler_timer.h
+++ b/engines/pink/objects/handlers/handler_timer.h
@@ -60,5 +60,4 @@ protected:
} // End of namespace Pink
-
#endif
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
index 4280cd5..a7a483f 100644
--- a/engines/pink/objects/inventory.cpp
+++ b/engines/pink/objects/inventory.cpp
@@ -201,5 +201,3 @@ InventoryItem *InventoryMgr::getCurrentItem() {
}
} // End of namespace Pink
-
-
diff --git a/engines/pink/objects/module.cpp b/engines/pink/objects/module.cpp
index 6f9fab0..9ad5365 100644
--- a/engines/pink/objects/module.cpp
+++ b/engines/pink/objects/module.cpp
@@ -101,6 +101,3 @@ InventoryMgr *Module::getInventoryMgr() {
}
} // End of namespace Pink
-
-
-
diff --git a/engines/pink/objects/object.cpp b/engines/pink/objects/object.cpp
index 796b356..6e50053 100644
--- a/engines/pink/objects/object.cpp
+++ b/engines/pink/objects/object.cpp
@@ -43,4 +43,3 @@ void NamedObject::store(Archive &archive) {
}
} // End of namespace Pink
-
diff --git a/engines/pink/objects/object.h b/engines/pink/objects/object.h
index f2301df..88ce35b 100644
--- a/engines/pink/objects/object.h
+++ b/engines/pink/objects/object.h
@@ -55,4 +55,4 @@ protected:
} // End of namespace Pink
-#endif
\ No newline at end of file
+#endif
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index ca9f304..952ea42 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -213,5 +213,4 @@ void GamePage::clear() {
delete _walkMgr; _walkMgr = nullptr;
}
-
-} // End of namespace Pink
\ No newline at end of file
+} // End of namespace Pink
diff --git a/engines/pink/objects/pages/game_page.h b/engines/pink/objects/pages/game_page.h
index 37584ee..5aad7ac 100644
--- a/engines/pink/objects/pages/game_page.h
+++ b/engines/pink/objects/pages/game_page.h
@@ -73,4 +73,4 @@ private:
}
-#endif //SCUMMVM_GAME_PAGE_H
+#endif
diff --git a/engines/pink/objects/pages/page.cpp b/engines/pink/objects/pages/page.cpp
index 3c46d19..4b2f5f1 100644
--- a/engines/pink/objects/pages/page.cpp
+++ b/engines/pink/objects/pages/page.cpp
@@ -95,5 +95,4 @@ void Page::unpause() {
}
}
-
} // End of namespace Pink
diff --git a/engines/pink/objects/pages/page.h b/engines/pink/objects/pages/page.h
index 2d1990c..1d96a93 100644
--- a/engines/pink/objects/pages/page.h
+++ b/engines/pink/objects/pages/page.h
@@ -58,4 +58,4 @@ protected:
} // End of namespace Pink
-#endif
\ No newline at end of file
+#endif
diff --git a/engines/pink/objects/sequences/seq_timer.cpp b/engines/pink/objects/sequences/seq_timer.cpp
index e661308..974056a 100644
--- a/engines/pink/objects/sequences/seq_timer.cpp
+++ b/engines/pink/objects/sequences/seq_timer.cpp
@@ -58,6 +58,4 @@ void SeqTimer::update() {
}
}
-
-
-} // End of namespace Pink
\ No newline at end of file
+} // End of namespace Pink
diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp
index 4cd041b..1e08bb5 100644
--- a/engines/pink/objects/sequences/sequence.cpp
+++ b/engines/pink/objects/sequences/sequence.cpp
@@ -188,4 +188,4 @@ void SequenceAudio::skipToLastSubSequence() {
end();
}
-} // End of namespace Pink
\ No newline at end of file
+} // End of namespace Pink
diff --git a/engines/pink/objects/sequences/sequence_context.cpp b/engines/pink/objects/sequences/sequence_context.cpp
index 4aec5fe..8ce85b7 100644
--- a/engines/pink/objects/sequences/sequence_context.cpp
+++ b/engines/pink/objects/sequences/sequence_context.cpp
@@ -90,4 +90,4 @@ void SequenceContext::setNextItemIndex(int index) {
_nextItemIndex = index;
}
-} // End of namespace Pink
\ No newline at end of file
+} // End of namespace Pink
diff --git a/engines/pink/objects/sequences/sequence_item.cpp b/engines/pink/objects/sequences/sequence_item.cpp
index 07c708b..a530390 100644
--- a/engines/pink/objects/sequences/sequence_item.cpp
+++ b/engines/pink/objects/sequences/sequence_item.cpp
@@ -107,4 +107,4 @@ void SequenceItemDefaultAction::skip(Sequence *sequence) {
execute(0, sequence, 1);
}
-} // End of namespace Pink
\ No newline at end of file
+} // End of namespace Pink
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index 852011c..37cd03c 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -127,4 +127,4 @@ SequenceActorState *Sequencer::findSequenceActorState(const Common::String &name
return nullptr;
}
-} // End of namespace Pink
\ No newline at end of file
+} // End of namespace Pink
diff --git a/engines/pink/objects/sequences/sequencer.h b/engines/pink/objects/sequences/sequencer.h
index a484397..0213728 100644
--- a/engines/pink/objects/sequences/sequencer.h
+++ b/engines/pink/objects/sequences/sequencer.h
@@ -69,4 +69,4 @@ public:
} // End of namespace Pink
-#endif
\ No newline at end of file
+#endif
diff --git a/engines/pink/objects/side_effect.cpp b/engines/pink/objects/side_effect.cpp
index 79d1c7f..228b8d5 100644
--- a/engines/pink/objects/side_effect.cpp
+++ b/engines/pink/objects/side_effect.cpp
@@ -128,4 +128,4 @@ void SideEffectRandomPageVariable::toConsole() {
debug("\t\tSideEffectRandomPageVariable: _name=%s, _values=%s", _name.c_str(), values.c_str());
}
-} // End of namespace Pink
\ No newline at end of file
+} // End of namespace Pink
diff --git a/engines/pink/objects/walk/walk_location.cpp b/engines/pink/objects/walk/walk_location.cpp
index e3998da..ec2dbc9 100644
--- a/engines/pink/objects/walk/walk_location.cpp
+++ b/engines/pink/objects/walk/walk_location.cpp
@@ -40,4 +40,4 @@ void WalkLocation::toConsole() {
}
}
-} // End of namespace Pink;
\ No newline at end of file
+} // End of namespace Pink
diff --git a/engines/pink/objects/walk/walk_location.h b/engines/pink/objects/walk/walk_location.h
index b9b2a0a..ef1cbab 100644
--- a/engines/pink/objects/walk/walk_location.h
+++ b/engines/pink/objects/walk/walk_location.h
@@ -38,4 +38,4 @@ private:
} // End of namespace Pink
-#endif
\ No newline at end of file
+#endif
diff --git a/engines/pink/objects/walk/walk_mgr.cpp b/engines/pink/objects/walk/walk_mgr.cpp
index 4c0b120..989f69e 100644
--- a/engines/pink/objects/walk/walk_mgr.cpp
+++ b/engines/pink/objects/walk/walk_mgr.cpp
@@ -149,4 +149,4 @@ void WalkMgr::end() {
_leadActor->onWalkEnd();
}
-} // End of namespace Pink
\ No newline at end of file
+} // End of namespace Pink
diff --git a/engines/pink/objects/walk/walk_shortest_path.cpp b/engines/pink/objects/walk/walk_shortest_path.cpp
index aa74f0e..2625323 100644
--- a/engines/pink/objects/walk/walk_shortest_path.cpp
+++ b/engines/pink/objects/walk/walk_shortest_path.cpp
@@ -157,4 +157,4 @@ void WalkShortestPath::remove(WalkLocation *location) {
}
}
-} // End of namespace Pink
\ No newline at end of file
+} // End of namespace Pink
diff --git a/engines/pink/objects/walk/walk_shortest_path.h b/engines/pink/objects/walk/walk_shortest_path.h
index 3b9734f..deb7770 100644
--- a/engines/pink/objects/walk/walk_shortest_path.h
+++ b/engines/pink/objects/walk/walk_shortest_path.h
@@ -57,5 +57,4 @@ private:
} // End of namespace Pink
-
#endif
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index ee564dc..f2b18aa 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -246,4 +246,4 @@ void PinkEngine::setCursor(uint cursorIndex) {
cursor->getHotspotX(), cursor->getHotspotY(), cursor->getKeyColor());
}
-}
\ No newline at end of file
+}
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index e77ba72..710f590 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -132,4 +132,4 @@ private:
} // End of namespace Pink
-#endif
\ No newline at end of file
+#endif
diff --git a/engines/pink/sound.cpp b/engines/pink/sound.cpp
index 6fbd5fc..b4b8f2a 100644
--- a/engines/pink/sound.cpp
+++ b/engines/pink/sound.cpp
@@ -81,4 +81,4 @@ uint32 Sound::getCurrentSample() {
return _mixer->getSoundElapsedTime(_handle) * kSampleRate / 1000;
}
-} // End of namespace Pink
\ No newline at end of file
+} // End of namespace Pink
diff --git a/engines/pink/utils.h b/engines/pink/utils.h
index 77efdb9..d5ef9a4 100644
--- a/engines/pink/utils.h
+++ b/engines/pink/utils.h
@@ -52,4 +52,4 @@ public:
} // End of namespace Pink
-#endif
\ No newline at end of file
+#endif
Commit: ea5c09341013805e3be3a40d96a54baa7548b5d0
https://github.com/scummvm/scummvm/commit/ea5c09341013805e3be3a40d96a54baa7548b5d0
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: remove lambda functions
PINK: remove lambda functions
PINK: remove >> << operators
Changed paths:
engines/pink/archive.cpp
engines/pink/file.cpp
engines/pink/objects/module.cpp
engines/pink/objects/sequences/sequencer.cpp
engines/pink/resource_mgr.cpp
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp
index a3c968b..caaca5f 100644
--- a/engines/pink/archive.cpp
+++ b/engines/pink/archive.cpp
@@ -302,14 +302,15 @@ Object *Archive::parseObject(bool &isCopyReturned) {
return res;
}
+static int runtimeClassCmp(const void *key, const void *elem) {
+ return strcmp((const char *) key, *(const char **) elem);
+}
+
uint Archive::findObjectId(const char *name) {
- RuntimeClass *found = static_cast<RuntimeClass*>
- (bsearch(name, classMap, sizeof(classMap) / sizeof(RuntimeClass) , sizeof(RuntimeClass), [] (const void *a, const void *b) {
- return strcmp((const char *) a, *(const char **) b);
- }));
+ RuntimeClass *found = (RuntimeClass*) bsearch(name, classMap, sizeof(classMap) / sizeof(RuntimeClass) , sizeof(RuntimeClass), runtimeClassCmp);
if (!found)
- error("Class %s is not in class Map", name);
+ error("Class %s is not in class Map", name);
return found->id;
}
diff --git a/engines/pink/file.cpp b/engines/pink/file.cpp
index 72de8eb..a62a9d8 100644
--- a/engines/pink/file.cpp
+++ b/engines/pink/file.cpp
@@ -99,10 +99,12 @@ void OrbFile::seekToObject(const char *name) {
seek(desc->objectsOffset);
}
+static int objDescComp(const void *a, const void *b) {
+ return scumm_stricmp((char *) a, (char *) b);
+}
+
ObjectDescription *OrbFile::getObjDesc(const char *name){
- ObjectDescription *desc = static_cast<ObjectDescription*>(bsearch(name, _table, _tableSize, sizeof(ObjectDescription),
- [] (const void *a, const void *b) {
- return scumm_stricmp((char *) a, (char *) b); }));
+ ObjectDescription *desc = (ObjectDescription*) bsearch(name, _table, _tableSize, sizeof(ObjectDescription), objDescComp);
assert(desc != nullptr);
return desc;
}
diff --git a/engines/pink/objects/module.cpp b/engines/pink/objects/module.cpp
index 9ad5365..019f71b 100644
--- a/engines/pink/objects/module.cpp
+++ b/engines/pink/objects/module.cpp
@@ -76,10 +76,11 @@ void Module::changePage(const Common::String &pageName) {
}
GamePage *Module::findPage(const Common::String &pageName) const {
- return *Common::find_if(_pages.begin(), _pages.end(), [&pageName]
- (GamePage* page) {
- return pageName == page->getName();
- });
+ for (uint i = 0; i < _pages.size(); ++i) {
+ if (_pages[i]->getName() == pageName)
+ return _pages[i];
+ }
+ return nullptr;
}
PinkEngine *Module::getGame() const {
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index 37cd03c..5644aa8 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -49,10 +49,11 @@ void Sequencer::deserialize(Archive &archive) {
}
Sequence *Sequencer::findSequence(const Common::String &name) {
- return *Common::find_if(_sequences.begin(), _sequences.end(), [&name]
- (Sequence* sequence) {
- return name == sequence->getName();
- });
+ for (uint i = 0; i < _sequences.size(); ++i) {
+ if (_sequences[i]->getName() == name)
+ return _sequences[i];
+ }
+ return nullptr;
}
void Sequencer::authorSequence(Sequence *sequence, bool unk) {
diff --git a/engines/pink/resource_mgr.cpp b/engines/pink/resource_mgr.cpp
index bbf7e7e..9c72fc7 100644
--- a/engines/pink/resource_mgr.cpp
+++ b/engines/pink/resource_mgr.cpp
@@ -56,11 +56,11 @@ Sound *ResourceMgr::loadSound(Common::String &name) {
Common::SafeSeekableSubReadStream *ResourceMgr::getResourceStream(Common::String &name) {
Common::SeekableReadStream *stream;
- const ResourceDescription &desc = *Common::find_if(_resDescTable, _resDescTable + _resCount,
- [&] (const ResourceDescription &desc) {
- return name.compareToIgnoreCase(desc.name) == 0;
- });
-
+ ResourceDescription &desc = _resDescTable[0];
+ for (uint i = 0; i < _resCount; ++i) {
+ if (name.compareToIgnoreCase(_resDescTable[i].name) == 0)
+ desc = _resDescTable[i];
+ }
if (desc.inBro)
stream = _game->getBro();
Commit: 931d6adbcbbe063857814dc76886e9a967b2a4f3
https://github.com/scummvm/scummvm/commit/931d6adbcbbe063857814dc76886e9a967b2a4f3
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: return deleted variable declaration by mistake
Changed paths:
engines/pink/file.h
diff --git a/engines/pink/file.h b/engines/pink/file.h
index d7053a1..469885f 100644
--- a/engines/pink/file.h
+++ b/engines/pink/file.h
@@ -67,7 +67,7 @@ public:
private:
void seekToObject(const char *name);
-
+ ObjectDescription *_table;
uint32 _timestamp;
uint32 _tableOffset;
uint32 _tableSize;
Commit: 82974a9ce37aba6240f7c3543947631170f012c2
https://github.com/scummvm/scummvm/commit/82974a9ce37aba6240f7c3543947631170f012c2
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix indentation
Changed paths:
engines/pink/archive.cpp
engines/pink/archive.h
engines/pink/cel_decoder.cpp
engines/pink/cel_decoder.h
engines/pink/console.h
engines/pink/constants.h
engines/pink/cursor_mgr.cpp
engines/pink/cursor_mgr.h
engines/pink/detection.cpp
engines/pink/detection_tables.h
engines/pink/director.cpp
engines/pink/director.h
engines/pink/file.cpp
engines/pink/file.h
engines/pink/module.mk
engines/pink/objects/actions/action.cpp
engines/pink/objects/actions/action.h
engines/pink/objects/actions/action_cel.cpp
engines/pink/objects/actions/action_cel.h
engines/pink/objects/actions/action_hide.cpp
engines/pink/objects/actions/action_hide.h
engines/pink/objects/actions/action_loop.cpp
engines/pink/objects/actions/action_loop.h
engines/pink/objects/actions/action_play.cpp
engines/pink/objects/actions/action_play.h
engines/pink/objects/actions/action_play_with_sfx.cpp
engines/pink/objects/actions/action_play_with_sfx.h
engines/pink/objects/actions/action_sound.cpp
engines/pink/objects/actions/action_sound.h
engines/pink/objects/actions/action_still.cpp
engines/pink/objects/actions/action_still.h
engines/pink/objects/actions/action_talk.cpp
engines/pink/objects/actions/action_talk.h
engines/pink/objects/actions/action_text.cpp
engines/pink/objects/actions/action_text.h
engines/pink/objects/actions/walk_action.cpp
engines/pink/objects/actions/walk_action.h
engines/pink/objects/actors/actor.cpp
engines/pink/objects/actors/actor.h
engines/pink/objects/actors/audio_info_pda_button.h
engines/pink/objects/actors/cursor_actor.h
engines/pink/objects/actors/inventory_actor.h
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/actors/lead_actor.h
engines/pink/objects/actors/pda_button_actor.cpp
engines/pink/objects/actors/pda_button_actor.h
engines/pink/objects/actors/supporting_actor.cpp
engines/pink/objects/actors/supporting_actor.h
engines/pink/objects/condition.cpp
engines/pink/objects/condition.h
engines/pink/objects/handlers/handler.cpp
engines/pink/objects/handlers/handler.h
engines/pink/objects/handlers/handler_mgr.cpp
engines/pink/objects/handlers/handler_mgr.h
engines/pink/objects/handlers/handler_timer.cpp
engines/pink/objects/handlers/handler_timer.h
engines/pink/objects/inventory.cpp
engines/pink/objects/inventory.h
engines/pink/objects/module.cpp
engines/pink/objects/module.h
engines/pink/objects/object.cpp
engines/pink/objects/object.h
engines/pink/objects/pages/game_page.cpp
engines/pink/objects/pages/game_page.h
engines/pink/objects/pages/page.cpp
engines/pink/objects/pages/page.h
engines/pink/objects/sequences/seq_timer.cpp
engines/pink/objects/sequences/seq_timer.h
engines/pink/objects/sequences/sequence.cpp
engines/pink/objects/sequences/sequence.h
engines/pink/objects/sequences/sequence_context.cpp
engines/pink/objects/sequences/sequence_context.h
engines/pink/objects/sequences/sequence_item.cpp
engines/pink/objects/sequences/sequence_item.h
engines/pink/objects/sequences/sequencer.cpp
engines/pink/objects/sequences/sequencer.h
engines/pink/objects/side_effect.cpp
engines/pink/objects/side_effect.h
engines/pink/objects/walk/walk_location.cpp
engines/pink/objects/walk/walk_location.h
engines/pink/objects/walk/walk_mgr.cpp
engines/pink/objects/walk/walk_mgr.h
engines/pink/objects/walk/walk_shortest_path.cpp
engines/pink/objects/walk/walk_shortest_path.h
engines/pink/pink.cpp
engines/pink/pink.h
engines/pink/resource_mgr.cpp
engines/pink/resource_mgr.h
engines/pink/sound.cpp
engines/pink/sound.h
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp
index caaca5f..36eda11 100644
--- a/engines/pink/archive.cpp
+++ b/engines/pink/archive.cpp
@@ -49,257 +49,257 @@
namespace Pink {
static const struct RuntimeClass {
- const char *name;
- int id;
+ const char *name;
+ int id;
} classMap[] = {
- {"ActionHide", kActionHide},
- {"ActionLoop", kActionLoop},
- {"ActionPlay", kActionPlay},
- {"ActionPlayWithSfx", kActionPlayWithSfx},
- {"ActionSfx", kActionSfx},
- {"ActionSound", kActionSound},
- {"ActionStill", kActionStill},
- {"ActionTalk", kActionTalk},
- {"ActionText", kActionText},
- {"Actor", kActor},
- {"AudioInfoPDAButton", kAudioInfoPDAButton},
- {"ConditionGameVariable", kConditionGameVariable},
- {"ConditionInventoryItemOwner", kConditionInventoryItemOwner},
- {"ConditionModuleVariable", kConditionModuleVariable},
- {"ConditionNotInventoryItemOwner", kConditionNotInventoryItemOwner},
- {"ConditionNotModuleVariable", kConditionNotModuleVariable},
- {"ConditionNotPageVariable", kConditionNotPageVariable},
- {"ConditionPageVariable", kConditionPageVariable},
- {"CursorActor", kCursorActor},
- {"GamePage", kGamePage},
- {"HandlerLeftClick", kHandlerLeftClick},
- {"HandlerStartPage", kHandlerStartPage},
- {"HandlerTimer", kHandlerTimer},
- {"HandlerTimerActions", kHandlerTimerActions},
- {"HandlerTimerSequences", kHandlerTimerSequences},
- {"HandlerUseClick", kHandlerUseClick},
- {"InventoryActor", kInventoryActor},
- {"InventoryItem", kInventoryItem},
- {"LeadActor", kLeadActor},
- {"ModuleProxy", kModuleProxy},
- {"PDAButtonActor", kPDAButtonActor},
- {"ParlSqPink", kParlSqPink},
- {"PubPink", kPubPink},
- {"SeqTimer", kSeqTimer},
- {"Sequence", kSequence},
- {"SequenceAudio", kSequenceAudio},
- {"SequenceItem", kSequenceItem},
- {"SequenceItemDefaultAction", kSequenceItemDefaultAction},
- {"SequenceItemLeader", kSequenceItemLeader},
- {"SequenceItemLeaderAudio", kSequenceItemLeaderAudio},
- {"SideEffectExit", kSideEffectExit},
- {"SideEffectGameVariable", kSideEffectGameVariable},
- {"SideEffectInventoryItemOwner", kSideEffectInventoryItemOwner},
- {"SideEffectLocation", kSideEffectLocation},
- {"SideEffectModuleVariable", kSideEffectModuleVariable},
- {"SideEffectPageVariable", kSideEffectPageVariable},
- {"SideEffectRandomPageVariable", kSideEffectRandomPageVariable},
- {"SupportingActor", kSupportingActor},
- {"WalkAction", kWalkAction},
- {"WalkLocation", kWalkLocation}
+ {"ActionHide", kActionHide},
+ {"ActionLoop", kActionLoop},
+ {"ActionPlay", kActionPlay},
+ {"ActionPlayWithSfx", kActionPlayWithSfx},
+ {"ActionSfx", kActionSfx},
+ {"ActionSound", kActionSound},
+ {"ActionStill", kActionStill},
+ {"ActionTalk", kActionTalk},
+ {"ActionText", kActionText},
+ {"Actor", kActor},
+ {"AudioInfoPDAButton", kAudioInfoPDAButton},
+ {"ConditionGameVariable", kConditionGameVariable},
+ {"ConditionInventoryItemOwner", kConditionInventoryItemOwner},
+ {"ConditionModuleVariable", kConditionModuleVariable},
+ {"ConditionNotInventoryItemOwner", kConditionNotInventoryItemOwner},
+ {"ConditionNotModuleVariable", kConditionNotModuleVariable},
+ {"ConditionNotPageVariable", kConditionNotPageVariable},
+ {"ConditionPageVariable", kConditionPageVariable},
+ {"CursorActor", kCursorActor},
+ {"GamePage", kGamePage},
+ {"HandlerLeftClick", kHandlerLeftClick},
+ {"HandlerStartPage", kHandlerStartPage},
+ {"HandlerTimer", kHandlerTimer},
+ {"HandlerTimerActions", kHandlerTimerActions},
+ {"HandlerTimerSequences", kHandlerTimerSequences},
+ {"HandlerUseClick", kHandlerUseClick},
+ {"InventoryActor", kInventoryActor},
+ {"InventoryItem", kInventoryItem},
+ {"LeadActor", kLeadActor},
+ {"ModuleProxy", kModuleProxy},
+ {"PDAButtonActor", kPDAButtonActor},
+ {"ParlSqPink", kParlSqPink},
+ {"PubPink", kPubPink},
+ {"SeqTimer", kSeqTimer},
+ {"Sequence", kSequence},
+ {"SequenceAudio", kSequenceAudio},
+ {"SequenceItem", kSequenceItem},
+ {"SequenceItemDefaultAction", kSequenceItemDefaultAction},
+ {"SequenceItemLeader", kSequenceItemLeader},
+ {"SequenceItemLeaderAudio", kSequenceItemLeaderAudio},
+ {"SideEffectExit", kSideEffectExit},
+ {"SideEffectGameVariable", kSideEffectGameVariable},
+ {"SideEffectInventoryItemOwner", kSideEffectInventoryItemOwner},
+ {"SideEffectLocation", kSideEffectLocation},
+ {"SideEffectModuleVariable", kSideEffectModuleVariable},
+ {"SideEffectPageVariable", kSideEffectPageVariable},
+ {"SideEffectRandomPageVariable", kSideEffectRandomPageVariable},
+ {"SupportingActor", kSupportingActor},
+ {"WalkAction", kWalkAction},
+ {"WalkLocation", kWalkLocation}
};
static Object* createObject(int objectId){
- switch (objectId){
- case kActionHide:
- return new ActionHide;
- case kActionLoop:
- return new ActionLoop;
- case kActionPlay:
- return new ActionPlay;
- case kActionPlayWithSfx:
- return new ActionPlayWithSfx;
- case kActionSfx:
- return new ActionSfx;
- case kActionSound:
- return new ActionSound;
- case kActionStill:
- return new ActionStill;
- case kActionTalk:
- return new ActionTalk;
- case kActionText:
- return new ActionText;
- case kActor:
- return new Actor;
- case kAudioInfoPDAButton:
- return new AudioInfoPDAButton;
- case kConditionGameVariable:
- return new ConditionGameVariable;
- case kConditionInventoryItemOwner:
- return new ConditionInventoryItemOwner;
- case kConditionModuleVariable:
- return new ConditionModuleVariable;
- case kConditionNotInventoryItemOwner:
- return new ConditionNotInventoryItemOwner;
- case kConditionNotModuleVariable:
- return new ConditionNotModuleVariable;
- case kConditionNotPageVariable:
- return new ConditionNotPageVariable;
- case kConditionPageVariable:
- return new ConditionPageVariable;
- case kCursorActor:
- return new CursorActor;
- case kGamePage:
- return new GamePage;
- case kHandlerLeftClick:
- return new HandlerLeftClick;
- case kHandlerStartPage:
- return new HandlerStartPage;
- case kHandlerTimer:
- case kHandlerTimerActions:
- return new HandlerTimerActions; // hack for Peril, but behavior is correct
- case kHandlerTimerSequences:
- return new HandlerTimerSequences;
- case kHandlerUseClick:
- return new HandlerUseClick;
- case kInventoryActor:
- return new InventoryActor;
- case kInventoryItem:
- return new InventoryItem;
- case kLeadActor:
- return new LeadActor;
- case kModuleProxy:
- return new ModuleProxy;
- case kPDAButtonActor:
- return new PDAButtonActor;
- case kParlSqPink:
- return new ParlSqPink;
- case kPubPink:
- return new PubPink;
- case kSeqTimer:
- return new SeqTimer;
- case kSequence:
- return new Sequence;
- case kSequenceAudio:
- return new SequenceAudio;
- case kSequenceItem:
- return new SequenceItem;
- case kSequenceItemDefaultAction:
- return new SequenceItemDefaultAction;
- case kSequenceItemLeader:
- return new SequenceItemLeader;
- case kSequenceItemLeaderAudio:
- return new SequenceItemLeaderAudio;
- case kSideEffectExit:
- return new SideEffectExit;
- case kSideEffectGameVariable:
- return new SideEffectGameVariable;
- case kSideEffectInventoryItemOwner:
- return new SideEffectInventoryItemOwner;
- case kSideEffectLocation:
- return new SideEffectLocation;
- case kSideEffectModuleVariable:
- return new SideEffectModuleVariable;
- case kSideEffectPageVariable:
- return new SideEffectPageVariable;
- case kSideEffectRandomPageVariable:
- return new SideEffectRandomPageVariable;
- case kSupportingActor:
- return new SupportingActor;
- case kWalkAction:
- return new WalkAction;
- case kWalkLocation:
- return new WalkLocation;
- default:
- error("Unknown object id");
- return nullptr;
- }
+ switch (objectId){
+ case kActionHide:
+ return new ActionHide;
+ case kActionLoop:
+ return new ActionLoop;
+ case kActionPlay:
+ return new ActionPlay;
+ case kActionPlayWithSfx:
+ return new ActionPlayWithSfx;
+ case kActionSfx:
+ return new ActionSfx;
+ case kActionSound:
+ return new ActionSound;
+ case kActionStill:
+ return new ActionStill;
+ case kActionTalk:
+ return new ActionTalk;
+ case kActionText:
+ return new ActionText;
+ case kActor:
+ return new Actor;
+ case kAudioInfoPDAButton:
+ return new AudioInfoPDAButton;
+ case kConditionGameVariable:
+ return new ConditionGameVariable;
+ case kConditionInventoryItemOwner:
+ return new ConditionInventoryItemOwner;
+ case kConditionModuleVariable:
+ return new ConditionModuleVariable;
+ case kConditionNotInventoryItemOwner:
+ return new ConditionNotInventoryItemOwner;
+ case kConditionNotModuleVariable:
+ return new ConditionNotModuleVariable;
+ case kConditionNotPageVariable:
+ return new ConditionNotPageVariable;
+ case kConditionPageVariable:
+ return new ConditionPageVariable;
+ case kCursorActor:
+ return new CursorActor;
+ case kGamePage:
+ return new GamePage;
+ case kHandlerLeftClick:
+ return new HandlerLeftClick;
+ case kHandlerStartPage:
+ return new HandlerStartPage;
+ case kHandlerTimer:
+ case kHandlerTimerActions:
+ return new HandlerTimerActions; // hack for Peril, but behavior is correct
+ case kHandlerTimerSequences:
+ return new HandlerTimerSequences;
+ case kHandlerUseClick:
+ return new HandlerUseClick;
+ case kInventoryActor:
+ return new InventoryActor;
+ case kInventoryItem:
+ return new InventoryItem;
+ case kLeadActor:
+ return new LeadActor;
+ case kModuleProxy:
+ return new ModuleProxy;
+ case kPDAButtonActor:
+ return new PDAButtonActor;
+ case kParlSqPink:
+ return new ParlSqPink;
+ case kPubPink:
+ return new PubPink;
+ case kSeqTimer:
+ return new SeqTimer;
+ case kSequence:
+ return new Sequence;
+ case kSequenceAudio:
+ return new SequenceAudio;
+ case kSequenceItem:
+ return new SequenceItem;
+ case kSequenceItemDefaultAction:
+ return new SequenceItemDefaultAction;
+ case kSequenceItemLeader:
+ return new SequenceItemLeader;
+ case kSequenceItemLeaderAudio:
+ return new SequenceItemLeaderAudio;
+ case kSideEffectExit:
+ return new SideEffectExit;
+ case kSideEffectGameVariable:
+ return new SideEffectGameVariable;
+ case kSideEffectInventoryItemOwner:
+ return new SideEffectInventoryItemOwner;
+ case kSideEffectLocation:
+ return new SideEffectLocation;
+ case kSideEffectModuleVariable:
+ return new SideEffectModuleVariable;
+ case kSideEffectPageVariable:
+ return new SideEffectPageVariable;
+ case kSideEffectRandomPageVariable:
+ return new SideEffectRandomPageVariable;
+ case kSupportingActor:
+ return new SupportingActor;
+ case kWalkAction:
+ return new WalkAction;
+ case kWalkLocation:
+ return new WalkLocation;
+ default:
+ error("Unknown object id");
+ return nullptr;
+ }
}
Archive::Archive(Common::SeekableReadStream *stream)
- : _readStream(stream), _writeStream(nullptr)
+ : _readStream(stream), _writeStream(nullptr)
{
- _objectMap.push_back(0);
- _objectIdMap.push_back(kNullObject);
+ _objectMap.push_back(0);
+ _objectIdMap.push_back(kNullObject);
}
Archive::Archive(Common::WriteStream *stream)
- : _writeStream(stream), _readStream(nullptr)
+ : _writeStream(stream), _readStream(nullptr)
{
- _objectMap.push_back(0);
- _objectIdMap.push_back(kNullObject);
+ _objectMap.push_back(0);
+ _objectIdMap.push_back(kNullObject);
}
Archive::~Archive()
{}
void Archive::mapObject(Object *obj) {
- _objectMap.push_back(obj);
- _objectIdMap.push_back(0);
+ _objectMap.push_back(obj);
+ _objectIdMap.push_back(0);
}
int Archive::readCount() {
- int count = _readStream->readUint16LE();
+ int count = _readStream->readUint16LE();
- if (count == 0xffff)
- count = _readStream->readUint32LE();
+ if (count == 0xffff)
+ count = _readStream->readUint32LE();
- return count;
+ return count;
}
Object *Archive::readObject() {
- bool isCopyReturned;
- Object *res = parseObject(isCopyReturned);
+ bool isCopyReturned;
+ Object *res = parseObject(isCopyReturned);
- if (res && !isCopyReturned) {
- res->deserialize(*this);
- }
+ if (res && !isCopyReturned) {
+ res->deserialize(*this);
+ }
- return res;
+ return res;
}
Object *Archive::parseObject(bool &isCopyReturned) {
- char className[kMaxClassLength];
- int objectId = 0;
- Object *res = nullptr;
+ char className[kMaxClassLength];
+ int objectId = 0;
+ Object *res = nullptr;
- uint obTag = _readStream->readUint16LE();
+ uint obTag = _readStream->readUint16LE();
- if (obTag == 0x0000) {
- return nullptr;
- } else if (obTag == 0xffff) {
- int schema = _readStream->readUint16LE();
+ if (obTag == 0x0000) {
+ return nullptr;
+ } else if (obTag == 0xffff) {
+ int schema = _readStream->readUint16LE();
- int size = _readStream->readUint16LE();
- _readStream->read(className, size);
- className[size] = '\0';
+ int size = _readStream->readUint16LE();
+ _readStream->read(className, size);
+ className[size] = '\0';
- objectId = findObjectId(className + 1);
+ objectId = findObjectId(className + 1);
- res = createObject(objectId);
- if (!res) error("Class %s is not implemented", className);
+ res = createObject(objectId);
+ if (!res) error("Class %s is not implemented", className);
- _objectMap.push_back(res);
- _objectIdMap.push_back(objectId);
+ _objectMap.push_back(res);
+ _objectIdMap.push_back(objectId);
- _objectMap.push_back(res); // Basically a hack, but behavior is all correct
- _objectIdMap.push_back(objectId);
+ _objectMap.push_back(res); // Basically a hack, but behavior is all correct
+ _objectIdMap.push_back(objectId);
- isCopyReturned = false;
- } else if ((obTag & 0x8000) == 0) {
+ isCopyReturned = false;
+ } else if ((obTag & 0x8000) == 0) {
- res = _objectMap[obTag];
+ res = _objectMap[obTag];
- isCopyReturned = true;
- } else {
+ isCopyReturned = true;
+ } else {
- obTag &= ~0x8000;
+ obTag &= ~0x8000;
- objectId = _objectIdMap[obTag];
+ objectId = _objectIdMap[obTag];
- res = createObject(objectId);
- _objectMap.push_back(res);
- _objectIdMap.push_back(objectId);
+ res = createObject(objectId);
+ _objectMap.push_back(res);
+ _objectIdMap.push_back(objectId);
- isCopyReturned = false;
- }
+ isCopyReturned = false;
+ }
- return res;
+ return res;
}
static int runtimeClassCmp(const void *key, const void *elem) {
@@ -307,41 +307,41 @@ static int runtimeClassCmp(const void *key, const void *elem) {
}
uint Archive::findObjectId(const char *name) {
- RuntimeClass *found = (RuntimeClass*) bsearch(name, classMap, sizeof(classMap) / sizeof(RuntimeClass) , sizeof(RuntimeClass), runtimeClassCmp);
+ RuntimeClass *found = (RuntimeClass*) bsearch(name, classMap, sizeof(classMap) / sizeof(RuntimeClass) , sizeof(RuntimeClass), runtimeClassCmp);
- if (!found)
- error("Class %s is not in class Map", name);
+ if (!found)
+ error("Class %s is not in class Map", name);
- return found->id;
+ return found->id;
}
Common::String Archive::readString() {
- char buffer[kMaxStringLength];
- byte len = _readStream->readByte();
- assert(len <= kMaxStringLength);
- _readStream->read(buffer, len);
- return Common::String(buffer, len);
+ char buffer[kMaxStringLength];
+ byte len = _readStream->readByte();
+ assert(len <= kMaxStringLength);
+ _readStream->read(buffer, len);
+ return Common::String(buffer, len);
}
uint32 Archive::readDWORD() {
- return _readStream->readUint32LE();
+ return _readStream->readUint32LE();
}
uint16 Archive::readWORD() {
- return _readStream->readUint16LE();
+ return _readStream->readUint16LE();
}
void Archive::writeDWORD(uint32 val) {
- _writeStream->writeUint32LE(val);
+ _writeStream->writeUint32LE(val);
}
void Archive::writeWORD(uint16 val) {
- _writeStream->writeUint16LE(val);
+ _writeStream->writeUint16LE(val);
}
void Archive::writeString(const Common::String &string) {
- _writeStream->writeByte(string.size());
- _writeStream->write(string.c_str(), string.size());
+ _writeStream->writeByte(string.size());
+ _writeStream->write(string.c_str(), string.size());
}
} // End of namespace Pink
diff --git a/engines/pink/archive.h b/engines/pink/archive.h
index e936987..552b2bc 100644
--- a/engines/pink/archive.h
+++ b/engines/pink/archive.h
@@ -39,32 +39,32 @@ namespace Pink {
class Archive {
public:
- Archive(Common::SeekableReadStream *stream);
- Archive(Common::WriteStream *stream);
- ~Archive();
+ Archive(Common::SeekableReadStream *stream);
+ Archive(Common::WriteStream *stream);
+ ~Archive();
- void mapObject(Object *obj);
+ void mapObject(Object *obj);
- int readCount();
- uint32 readDWORD();
- uint16 readWORD();
+ int readCount();
+ uint32 readDWORD();
+ uint16 readWORD();
- void writeDWORD(uint32 val);
- void writeWORD(uint16 val);
+ void writeDWORD(uint32 val);
+ void writeWORD(uint16 val);
- Object *readObject();
- Common::String readString();
- void writeString(const Common::String &string);
+ Object *readObject();
+ Common::String readString();
+ void writeString(const Common::String &string);
private:
- uint findObjectId(const char *name);
+ uint findObjectId(const char *name);
- Object *parseObject(bool &isCopyReturned);
+ Object *parseObject(bool &isCopyReturned);
- Common::Array<Object *> _objectMap;
- Common::Array<uint> _objectIdMap;
- Common::SeekableReadStream *_readStream;
- Common::WriteStream *_writeStream;
+ Common::Array<Object *> _objectMap;
+ Common::Array<uint> _objectIdMap;
+ Common::SeekableReadStream *_readStream;
+ Common::WriteStream *_writeStream;
};
} // End of namespace Pink
diff --git a/engines/pink/cel_decoder.cpp b/engines/pink/cel_decoder.cpp
index 044a8d0..0387873 100644
--- a/engines/pink/cel_decoder.cpp
+++ b/engines/pink/cel_decoder.cpp
@@ -29,224 +29,224 @@
namespace Pink {
bool CelDecoder::loadStream(Common::SeekableReadStream *stream) {
- close();
+ close();
- /* uint32 frameSize = */ stream->readUint32LE();
- uint16 frameType = stream->readUint16LE();
+ /* uint32 frameSize = */ stream->readUint32LE();
+ uint16 frameType = stream->readUint16LE();
- // Check FLC magic number
- if (frameType != 0xAF12) {
- warning("FlicDecoder::loadStream(): attempted to load non-FLC data (type = 0x%04X)", frameType);
- return false;
- }
+ // Check FLC magic number
+ if (frameType != 0xAF12) {
+ warning("FlicDecoder::loadStream(): attempted to load non-FLC data (type = 0x%04X)", frameType);
+ return false;
+ }
- uint16 frameCount = stream->readUint16LE();
- uint16 width = stream->readUint16LE();
- uint16 height = stream->readUint16LE();
- uint16 colorDepth = stream->readUint16LE();
- if (colorDepth != 8) {
- warning("FlicDecoder::loadStream(): attempted to load an FLC with a palette of color depth %d. Only 8-bit color palettes are supported", colorDepth);
- return false;
- }
+ uint16 frameCount = stream->readUint16LE();
+ uint16 width = stream->readUint16LE();
+ uint16 height = stream->readUint16LE();
+ uint16 colorDepth = stream->readUint16LE();
+ if (colorDepth != 8) {
+ warning("FlicDecoder::loadStream(): attempted to load an FLC with a palette of color depth %d. Only 8-bit color palettes are supported", colorDepth);
+ return false;
+ }
- addTrack(new CelVideoTrack(stream, frameCount, width, height));
- return true;
+ addTrack(new CelVideoTrack(stream, frameCount, width, height));
+ return true;
}
int32 CelDecoder::getX(){
- CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
- if (!track)
- return -1;
- return track->getX();
+ CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
+ if (!track)
+ return -1;
+ return track->getX();
}
int32 CelDecoder::getY() {
- CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
- if (!track)
- return -1;
- return track->getY();
+ CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
+ if (!track)
+ return -1;
+ return track->getY();
}
uint16 CelDecoder::getTransparentColourIndex() {
- CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
- if (!track)
- return 0;
- return track->getTransparentColourIndex();
+ CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
+ if (!track)
+ return 0;
+ return track->getTransparentColourIndex();
}
const Graphics::Surface *CelDecoder::getCurrentFrame() {
- CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
- if (!track)
- return 0;
- return track->getCurrentFrame();
+ CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
+ if (!track)
+ return 0;
+ return track->getCurrentFrame();
}
Common::Point CelDecoder::getCenter() {
- CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
- if (!track)
- return {0,0};
- return track->getCenter();
+ CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
+ if (!track)
+ return {0,0};
+ return track->getCenter();
}
Common::Rect &CelDecoder::getRectangle() {
- CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
- return track->getRect();
+ CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
+ return track->getRect();
}
void CelDecoder::setX(int32 x) {
- CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
- track->setX(x);
+ CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
+ track->setX(x);
}
void CelDecoder::setY(int32 y) {
- CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
- track->setY(y);
+ CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
+ track->setY(y);
}
void CelDecoder::skipFrame() {
- CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
- track->skipFrame();
+ CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
+ track->skipFrame();
}
CelDecoder::CelVideoTrack::CelVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height, bool skipHeader)
- : FlicVideoTrack(stream, frameCount, width, height, 1), _center(0,0), _transparentColourIndex(0){
- readHeader();
+ : FlicVideoTrack(stream, frameCount, width, height, 1), _center(0,0), _transparentColourIndex(0){
+ readHeader();
}
#define PREFIX_TYPE 0xF100
#define CEL_DATA 3
void CelDecoder::CelVideoTrack::readPrefixChunk() {
- _fileStream->seek(0x80);
- uint32 chunkSize = _fileStream->readUint32LE();
- uint16 chunkType = _fileStream->readUint16LE();
- if (chunkType != PREFIX_TYPE)
- return;
- uint32 offset = 6;
-
- uint32 subchunkSize = _fileStream->readUint32LE();
- uint16 subchunkType = _fileStream->readUint16LE();
-
- switch (subchunkType) {
- case CEL_DATA:
- _fileStream->readUint16LE();
- _center.x = _fileStream->readUint16LE();
- _center.y = _fileStream->readUint16LE();
- break;
- default:
- error("Unknown subchunk type");
- _fileStream->skip(subchunkSize - 6);
- break;
- }
- _rect = Common::Rect::center(_center.x, _center.y, _surface->w, _surface->h);
+ _fileStream->seek(0x80);
+ uint32 chunkSize = _fileStream->readUint32LE();
+ uint16 chunkType = _fileStream->readUint16LE();
+ if (chunkType != PREFIX_TYPE)
+ return;
+ uint32 offset = 6;
+
+ uint32 subchunkSize = _fileStream->readUint32LE();
+ uint16 subchunkType = _fileStream->readUint16LE();
+
+ switch (subchunkType) {
+ case CEL_DATA:
+ _fileStream->readUint16LE();
+ _center.x = _fileStream->readUint16LE();
+ _center.y = _fileStream->readUint16LE();
+ break;
+ default:
+ error("Unknown subchunk type");
+ _fileStream->skip(subchunkSize - 6);
+ break;
+ }
+ _rect = Common::Rect::center(_center.x, _center.y, _surface->w, _surface->h);
}
void CelDecoder::CelVideoTrack::readHeader() {
- _fileStream->readUint16LE();
+ _fileStream->readUint16LE();
- _frameDelay = _startFrameDelay = _fileStream->readUint32LE();
+ _frameDelay = _startFrameDelay = _fileStream->readUint32LE();
- _fileStream->seek(80);
- _offsetFrame1 = _fileStream->readUint32LE();
- _offsetFrame2 = _fileStream->readUint32LE();
+ _fileStream->seek(80);
+ _offsetFrame1 = _fileStream->readUint32LE();
+ _offsetFrame2 = _fileStream->readUint32LE();
- if (_offsetFrame1 > 0x80) {
- readPrefixChunk();
- }
+ if (_offsetFrame1 > 0x80) {
+ readPrefixChunk();
+ }
- _fileStream->seek(_offsetFrame1);
+ _fileStream->seek(_offsetFrame1);
}
int32 CelDecoder::CelVideoTrack::getX() const {
- return (_center.x - getWidth() / 2) < 0 ? 0 : _center.x - getWidth() / 2;
+ return (_center.x - getWidth() / 2) < 0 ? 0 : _center.x - getWidth() / 2;
}
int32 CelDecoder::CelVideoTrack::getY() const {
- return (_center.y - getHeight() / 2) < 0 ? 0 : _center.y - getHeight() / 2;
+ return (_center.y - getHeight() / 2) < 0 ? 0 : _center.y - getHeight() / 2;
}
uint16 CelDecoder::CelVideoTrack::getTransparentColourIndex() {
- return _transparentColourIndex;
+ return _transparentColourIndex;
}
const Graphics::Surface *CelDecoder::CelVideoTrack::getCurrentFrame() {
- return _surface;
+ return _surface;
}
Common::Point CelDecoder::CelVideoTrack::getCenter() {
- return _center;
+ return _center;
}
Common::Rect &CelDecoder::CelVideoTrack::getRect() {
- return _rect;
+ return _rect;
}
#define FRAME_TYPE 0xF1FA
void CelDecoder::CelVideoTrack::skipFrame() {
- // Read chunk
- /*uint32 frameSize = */ _fileStream->readUint32LE();
- uint16 frameType = _fileStream->readUint16LE();
+ // Read chunk
+ /*uint32 frameSize = */ _fileStream->readUint32LE();
+ uint16 frameType = _fileStream->readUint16LE();
- switch (frameType) {
- case FRAME_TYPE:
- handleFrame();
- break;
- default:
- error("FlicDecoder::decodeFrame(): unknown main chunk type (type = 0x%02X)", frameType);
- break;
- }
+ switch (frameType) {
+ case FRAME_TYPE:
+ handleFrame();
+ break;
+ default:
+ error("FlicDecoder::decodeFrame(): unknown main chunk type (type = 0x%02X)", frameType);
+ break;
+ }
- _curFrame++;
- //_nextFrameStartTime += _frameDelay;
+ _curFrame++;
+ //_nextFrameStartTime += _frameDelay;
- if (_atRingFrame) {
- // If we decoded the ring frame, seek to the second frame
- _atRingFrame = false;
- _fileStream->seek(_offsetFrame2);
- }
+ if (_atRingFrame) {
+ // If we decoded the ring frame, seek to the second frame
+ _atRingFrame = false;
+ _fileStream->seek(_offsetFrame2);
+ }
- if (_curFrame == 0)
- _transparentColourIndex = *(byte*)_surface->getBasePtr(0,0);
+ if (_curFrame == 0)
+ _transparentColourIndex = *(byte*)_surface->getBasePtr(0,0);
}
const Graphics::Surface *CelDecoder::CelVideoTrack::decodeNextFrame() {
- // Read chunk
- /*uint32 frameSize = */ _fileStream->readUint32LE();
- uint16 frameType = _fileStream->readUint16LE();
+ // Read chunk
+ /*uint32 frameSize = */ _fileStream->readUint32LE();
+ uint16 frameType = _fileStream->readUint16LE();
- switch (frameType) {
- case FRAME_TYPE:
- handleFrame();
- break;
- default:
- error("FlicDecoder::decodeFrame(): unknown main chunk type (type = 0x%02X)", frameType);
- break;
- }
+ switch (frameType) {
+ case FRAME_TYPE:
+ handleFrame();
+ break;
+ default:
+ error("FlicDecoder::decodeFrame(): unknown main chunk type (type = 0x%02X)", frameType);
+ break;
+ }
- _curFrame++;
- _nextFrameStartTime += _frameDelay;
+ _curFrame++;
+ _nextFrameStartTime += _frameDelay;
- if (_atRingFrame) {
- // If we decoded the ring frame, seek to the second frame
- _atRingFrame = false;
- _fileStream->seek(_offsetFrame2);
- }
+ if (_atRingFrame) {
+ // If we decoded the ring frame, seek to the second frame
+ _atRingFrame = false;
+ _fileStream->seek(_offsetFrame2);
+ }
- if (_curFrame == 0)
- _transparentColourIndex = *(byte*)_surface->getBasePtr(0,0);
+ if (_curFrame == 0)
+ _transparentColourIndex = *(byte*)_surface->getBasePtr(0,0);
- return _surface;
+ return _surface;
}
void CelDecoder::CelVideoTrack::setX(int32 x) {
- _center.x = x ;//+ getWidth() / 2;
+ _center.x = x ;//+ getWidth() / 2;
}
void CelDecoder::CelVideoTrack::setY(int32 y) {
- _center.y = y;//+ getHeight() / 2;
+ _center.y = y;//+ getHeight() / 2;
}
} // End of namepsace Pink
diff --git a/engines/pink/cel_decoder.h b/engines/pink/cel_decoder.h
index 7ae9129..1e4636b 100644
--- a/engines/pink/cel_decoder.h
+++ b/engines/pink/cel_decoder.h
@@ -29,46 +29,46 @@ namespace Pink {
class CelDecoder : public Video::FlicDecoder {
public:
- virtual bool loadStream(Common::SeekableReadStream *stream);
+ virtual bool loadStream(Common::SeekableReadStream *stream);
- int32 getX();
- int32 getY();
- uint16 getTransparentColourIndex();
+ int32 getX();
+ int32 getY();
+ uint16 getTransparentColourIndex();
- Common::Point getCenter();
- Common::Rect &getRectangle();
- const Graphics::Surface *getCurrentFrame();
- void skipFrame();
+ Common::Point getCenter();
+ Common::Rect &getRectangle();
+ const Graphics::Surface *getCurrentFrame();
+ void skipFrame();
- void setX(int32 x);
- void setY(int32 y);
+ void setX(int32 x);
+ void setY(int32 y);
protected:
- class CelVideoTrack : public FlicVideoTrack {
- public:
- CelVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height, bool skipHeader = false);
- virtual void readHeader();
+ class CelVideoTrack : public FlicVideoTrack {
+ public:
+ CelVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height, bool skipHeader = false);
+ virtual void readHeader();
- int32 getX() const;
- int32 getY() const;
- uint16 getTransparentColourIndex();
+ int32 getX() const;
+ int32 getY() const;
+ uint16 getTransparentColourIndex();
- Common::Point getCenter();
- Common::Rect &getRect();
- const Graphics::Surface *getCurrentFrame();
+ Common::Point getCenter();
+ Common::Rect &getRect();
+ const Graphics::Surface *getCurrentFrame();
- void setX(int32 x);
- void setY(int32 y);
+ void setX(int32 x);
+ void setY(int32 y);
- void skipFrame();
- private:
- const Graphics::Surface *decodeNextFrame();
- void readPrefixChunk();
+ void skipFrame();
+ private:
+ const Graphics::Surface *decodeNextFrame();
+ void readPrefixChunk();
- Common::Point _center;
- Common::Rect _rect;
- byte _transparentColourIndex;
- };
+ Common::Point _center;
+ Common::Rect _rect;
+ byte _transparentColourIndex;
+ };
};
}
diff --git a/engines/pink/console.h b/engines/pink/console.h
index 03f4882..bad3441 100644
--- a/engines/pink/console.h
+++ b/engines/pink/console.h
@@ -31,9 +31,9 @@ class PinkEngine;
class Console : public GUI::Debugger {
public:
- Console(PinkEngine *vm) {}
+ Console(PinkEngine *vm) {}
- virtual ~Console(void) {}
+ virtual ~Console(void) {}
};
} // End of namespace Pink
diff --git a/engines/pink/constants.h b/engines/pink/constants.h
index b60d53f..9cc624c 100644
--- a/engines/pink/constants.h
+++ b/engines/pink/constants.h
@@ -26,126 +26,126 @@
namespace Pink {
enum {
- kMaxClassLength = 32,
- kMaxStringLength = 128,
- kNullObject = 0
+ kMaxClassLength = 32,
+ kMaxStringLength = 128,
+ kNullObject = 0
};
enum {
- kActionHide,
- kActionLoop,
- kActionPlay,
- kActionPlayWithSfx,
- kActionSfx,
- kActionSound,
- kActionStill,
- kActionTalk,
- kActionText,
- kActor,
- kAudioInfoPDAButton,
- kConditionGameVariable,
- kConditionInventoryItemOwner,
- kConditionModuleVariable,
- kConditionNotInventoryItemOwner,
- kConditionNotModuleVariable,
- kConditionNotPageVariable,
- kConditionPageVariable,
- kCursorActor,
- kGamePage,
- kHandlerLeftClick,
- kHandlerStartPage,
- kHandlerTimer,
- kHandlerTimerActions,
- kHandlerTimerSequences,
- kHandlerUseClick,
- kInventoryActor,
- kInventoryItem,
- kLeadActor,
- kModuleProxy,
- kPDAButtonActor,
- kParlSqPink,
- kPubPink,
- kSeqTimer,
- kSequence,
- kSequenceAudio,
- kSequenceItem,
- kSequenceItemDefaultAction,
- kSequenceItemLeader,
- kSequenceItemLeaderAudio,
- kSideEffectExit,
- kSideEffectGameVariable,
- kSideEffectInventoryItemOwner,
- kSideEffectLocation,
- kSideEffectModuleVariable,
- kSideEffectPageVariable,
- kSideEffectRandomPageVariable,
- kSupportingActor,
- kWalkAction,
- kWalkLocation
+ kActionHide,
+ kActionLoop,
+ kActionPlay,
+ kActionPlayWithSfx,
+ kActionSfx,
+ kActionSound,
+ kActionStill,
+ kActionTalk,
+ kActionText,
+ kActor,
+ kAudioInfoPDAButton,
+ kConditionGameVariable,
+ kConditionInventoryItemOwner,
+ kConditionModuleVariable,
+ kConditionNotInventoryItemOwner,
+ kConditionNotModuleVariable,
+ kConditionNotPageVariable,
+ kConditionPageVariable,
+ kCursorActor,
+ kGamePage,
+ kHandlerLeftClick,
+ kHandlerStartPage,
+ kHandlerTimer,
+ kHandlerTimerActions,
+ kHandlerTimerSequences,
+ kHandlerUseClick,
+ kInventoryActor,
+ kInventoryItem,
+ kLeadActor,
+ kModuleProxy,
+ kPDAButtonActor,
+ kParlSqPink,
+ kPubPink,
+ kSeqTimer,
+ kSequence,
+ kSequenceAudio,
+ kSequenceItem,
+ kSequenceItemDefaultAction,
+ kSequenceItemLeader,
+ kSequenceItemLeaderAudio,
+ kSideEffectExit,
+ kSideEffectGameVariable,
+ kSideEffectInventoryItemOwner,
+ kSideEffectLocation,
+ kSideEffectModuleVariable,
+ kSideEffectPageVariable,
+ kSideEffectRandomPageVariable,
+ kSupportingActor,
+ kWalkAction,
+ kWalkLocation
};
enum {
- kCursorsCount = 11
+ kCursorsCount = 11
};
enum {
- kLoadingCursor = 0,
- kExitForwardCursor = 1,
- kExitLeftCursor = 2,
- kExitRightCursor = 3,
- kDefaultCursor = 4,
- kClickableFirstFrameCursor = 5,
- kClickableSecondFrameCursor = 6,
- kNotClickableCursor = 7,
- kHoldingItemCursor = 8,
- kPDAFirstCursor = 9,
- kPDASecondCursor = 10
+ kLoadingCursor = 0,
+ kExitForwardCursor = 1,
+ kExitLeftCursor = 2,
+ kExitRightCursor = 3,
+ kDefaultCursor = 4,
+ kClickableFirstFrameCursor = 5,
+ kClickableSecondFrameCursor = 6,
+ kNotClickableCursor = 7,
+ kHoldingItemCursor = 8,
+ kPDAFirstCursor = 9,
+ kPDASecondCursor = 10
};
// values are from Hokus Pokus
enum {
- kPokusLoadingCursorID = 135,
- kPokusExitForwardCursorID = 138,
- kPokusExitLeftCursorID = 133,
- kPokusExitRightCursorID = 134,
- kPokusClickableFirstCursorID = 137,
- kPokusClickableSecondCursorID = 136,
- kPokusClickableThirdCursorID = 145,
- kPokusNotClickableCursorID = 140,
- kPokusHoldingItemCursorID = 147,
- kPokusPDAFirstCursorID = 141,
- kPokusPDASecondCursorID = 144
+ kPokusLoadingCursorID = 135,
+ kPokusExitForwardCursorID = 138,
+ kPokusExitLeftCursorID = 133,
+ kPokusExitRightCursorID = 134,
+ kPokusClickableFirstCursorID = 137,
+ kPokusClickableSecondCursorID = 136,
+ kPokusClickableThirdCursorID = 145,
+ kPokusNotClickableCursorID = 140,
+ kPokusHoldingItemCursorID = 147,
+ kPokusPDAFirstCursorID = 141,
+ kPokusPDASecondCursorID = 144
};
// from Peril
// it contains cursors whose ids differ
enum {
- kPerilClickableThirdCursorID = 140,
- kPerilNotClickableCursorID = 139,
- kPerilHoldingItemCursorID = 101,
- kPerilPDASecondCursorID = 142
+ kPerilClickableThirdCursorID = 140,
+ kPerilNotClickableCursorID = 139,
+ kPerilHoldingItemCursorID = 101,
+ kPerilPDASecondCursorID = 142
};
enum {
- kLoadingSave = 1,
- kLoadingNewGame = 0
+ kLoadingSave = 1,
+ kLoadingNewGame = 0
};
enum {
- kOrbMajorVersion = 2,
- kOrbMinorVersion = 0,
- kBroMajorVersion = 1,
- kBroMinorVersion = 0,
+ kOrbMajorVersion = 2,
+ kOrbMinorVersion = 0,
+ kBroMajorVersion = 1,
+ kBroMinorVersion = 0,
};
enum {
- kTimersUpdateTime = 100,
- kCursorsUpdateTime = 200
+ kTimersUpdateTime = 100,
+ kCursorsUpdateTime = 200
};
enum {
- kSampleRate = 22050
+ kSampleRate = 22050
};
static const char *kPinkGame = "PinkGame";
diff --git a/engines/pink/cursor_mgr.cpp b/engines/pink/cursor_mgr.cpp
index 867a0f3..81fb61a 100644
--- a/engines/pink/cursor_mgr.cpp
+++ b/engines/pink/cursor_mgr.cpp
@@ -30,92 +30,92 @@
namespace Pink {
CursorMgr::CursorMgr(PinkEngine *game, GamePage *page)
- : _actor(nullptr), _page(page), _game(game),
- _isPlayingAnimation(0), _firstFrameIndex(0)
+ : _actor(nullptr), _page(page), _game(game),
+ _isPlayingAnimation(0), _firstFrameIndex(0)
{}
CursorMgr::~CursorMgr() {}
void CursorMgr::setCursor(uint index, Common::Point point, const Common::String &itemName) {
- if (index == kClickableFirstFrameCursor) {
- startAnimation(index);
- return hideItem();
- }
- else if (index != kHoldingItemCursor){
-
- if (index != kPDASecondCursor) {
- _game->setCursor(index);
- _isPlayingAnimation = 0;
- return hideItem();
- }
-
- hideItem();
- return startAnimation(index);
- }
-
- _game->setCursor(index);
- _isPlayingAnimation = 0;
-
- _actor = _actor ? _actor : _page->findActor(kCursor);
- assert(_actor);
-
- Action *action = _actor->findAction(itemName);
- assert(dynamic_cast<ActionCEL*>(action));
-
- if (action != _actor->getAction()) {
- _actor->setAction(action, 0);
- CelDecoder *decoder = static_cast<ActionCEL*>(action)->getDecoder();
- decoder->setX(point.x);
- decoder->setY(point.y);
- }
- else {
- CelDecoder *decoder = static_cast<ActionCEL*>(action)->getDecoder();
- decoder->setX(point.x);
- decoder->setY(point.y);
- }
+ if (index == kClickableFirstFrameCursor) {
+ startAnimation(index);
+ return hideItem();
+ }
+ else if (index != kHoldingItemCursor){
+
+ if (index != kPDASecondCursor) {
+ _game->setCursor(index);
+ _isPlayingAnimation = 0;
+ return hideItem();
+ }
+
+ hideItem();
+ return startAnimation(index);
+ }
+
+ _game->setCursor(index);
+ _isPlayingAnimation = 0;
+
+ _actor = _actor ? _actor : _page->findActor(kCursor);
+ assert(_actor);
+
+ Action *action = _actor->findAction(itemName);
+ assert(dynamic_cast<ActionCEL*>(action));
+
+ if (action != _actor->getAction()) {
+ _actor->setAction(action, 0);
+ CelDecoder *decoder = static_cast<ActionCEL*>(action)->getDecoder();
+ decoder->setX(point.x);
+ decoder->setY(point.y);
+ }
+ else {
+ CelDecoder *decoder = static_cast<ActionCEL*>(action)->getDecoder();
+ decoder->setX(point.x);
+ decoder->setY(point.y);
+ }
}
void CursorMgr::update() {
- if (!_isPlayingAnimation)
- return;
-
- uint newTime = _game->getTotalPlayTime();
- if (newTime - _time > kCursorsUpdateTime){
- _time = newTime;
- _isSecondFrame = !_isSecondFrame;
- _game->setCursor(_firstFrameIndex + _isSecondFrame);
- }
+ if (!_isPlayingAnimation)
+ return;
+
+ uint newTime = _game->getTotalPlayTime();
+ if (newTime - _time > kCursorsUpdateTime){
+ _time = newTime;
+ _isSecondFrame = !_isSecondFrame;
+ _game->setCursor(_firstFrameIndex + _isSecondFrame);
+ }
}
void CursorMgr::setCursor(Common::String &cursorName, Common::Point point) {
- uint index;
- if (cursorName == kCursorNameExitLeft) {
- index = kExitLeftCursor;
- }
- else if (cursorName == kCursorNameExitRight){
- index = kExitRightCursor;
- }
- else //if (cursorName == kCursorNameExitForward || cursorName == kCursorNameExitUp)
- index = kExitForwardCursor;
- //else assert(0);
-
-
- setCursor(index, point, Common::String());
+ uint index;
+ if (cursorName == kCursorNameExitLeft) {
+ index = kExitLeftCursor;
+ }
+ else if (cursorName == kCursorNameExitRight){
+ index = kExitRightCursor;
+ }
+ else //if (cursorName == kCursorNameExitForward || cursorName == kCursorNameExitUp)
+ index = kExitForwardCursor;
+ //else assert(0);
+
+
+ setCursor(index, point, Common::String());
}
void CursorMgr::hideItem() {
- if (_actor) _actor->hide();
+ if (_actor) _actor->hide();
}
void CursorMgr::startAnimation(int index) {
- if (!_isPlayingAnimation) {
- _isPlayingAnimation = 1;
- _time = _game->getTotalPlayTime();
- _firstFrameIndex = index;
- _isSecondFrame = 0;
- _game->setCursor(index);
- }
+ if (!_isPlayingAnimation) {
+ _isPlayingAnimation = 1;
+ _time = _game->getTotalPlayTime();
+ _firstFrameIndex = index;
+ _isSecondFrame = 0;
+ _game->setCursor(index);
+ }
}
} // End of namespace Pink
diff --git a/engines/pink/cursor_mgr.h b/engines/pink/cursor_mgr.h
index c873010..4f10d22 100644
--- a/engines/pink/cursor_mgr.h
+++ b/engines/pink/cursor_mgr.h
@@ -38,26 +38,26 @@ class PinkEngine;
class CursorMgr : public Object {
public:
- CursorMgr(PinkEngine *game, GamePage *page);
- ~CursorMgr();
+ CursorMgr(PinkEngine *game, GamePage *page);
+ ~CursorMgr();
- void update();
- void setCursor(uint index, Common::Point point, const Common::String &itemName);
- void setCursor(Common::String &cursorName, Common::Point point);
+ void update();
+ void setCursor(uint index, Common::Point point, const Common::String &itemName);
+ void setCursor(Common::String &cursorName, Common::Point point);
private:
- void hideItem();
- void startAnimation(int index);
+ void hideItem();
+ void startAnimation(int index);
- Actor *_actor;
- GamePage *_page;
- PinkEngine *_game;
+ Actor *_actor;
+ GamePage *_page;
+ PinkEngine *_game;
- uint _time;
- uint _firstFrameIndex;
+ uint _time;
+ uint _firstFrameIndex;
- bool _isPlayingAnimation;
- bool _isSecondFrame;
+ bool _isPlayingAnimation;
+ bool _isSecondFrame;
};
} // End of namespace Pink
diff --git a/engines/pink/detection.cpp b/engines/pink/detection.cpp
index 546dd21..f0a0901 100644
--- a/engines/pink/detection.cpp
+++ b/engines/pink/detection.cpp
@@ -25,41 +25,41 @@
#include "pink/pink.h"
static const PlainGameDescriptor pinkGames[] = {
- {"peril", "The Pink Panther: Passport to Peril"},
- {"pokus", "The Pink Panther: Hokus Pokus Pink"},
- {0, 0}
+ {"peril", "The Pink Panther: Passport to Peril"},
+ {"pokus", "The Pink Panther: Hokus Pokus Pink"},
+ {0, 0}
};
#include "detection_tables.h"
class PinkMetaEngine : public AdvancedMetaEngine {
public:
- PinkMetaEngine() : AdvancedMetaEngine(Pink::gameDescriptions, sizeof(ADGameDescription), pinkGames) {
- _gameIds = pinkGames;
- }
+ PinkMetaEngine() : AdvancedMetaEngine(Pink::gameDescriptions, sizeof(ADGameDescription), pinkGames) {
+ _gameIds = pinkGames;
+ }
- virtual const char *getName() const {
- return "Pink Panther Engine";
- }
+ virtual const char *getName() const {
+ return "Pink Panther Engine";
+ }
- virtual const char *getOriginalCopyright() const {
- return "Pink Panther Engine (C) Wanderlust Interactive";
- }
+ virtual const char *getOriginalCopyright() const {
+ return "Pink Panther Engine (C) Wanderlust Interactive";
+ }
- //virtual bool hasFeature(MetaEngineFeature f) const;
- //virtual int getMaximumSaveSlot() const { return 0; }
- //virtual SaveStateList listSaves(const char *target) const;
- //virtual void removeSaveState(const char *target, int slot) const;
- //virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const;
- virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
+ //virtual bool hasFeature(MetaEngineFeature f) const;
+ //virtual int getMaximumSaveSlot() const { return 0; }
+ //virtual SaveStateList listSaves(const char *target) const;
+ //virtual void removeSaveState(const char *target, int slot) const;
+ //virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const;
+ virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
};
bool PinkMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
- if (desc) {
- *engine = new Pink::PinkEngine(syst, desc);
- }
+ if (desc) {
+ *engine = new Pink::PinkEngine(syst, desc);
+ }
- return desc != 0;
+ return desc != 0;
}
#if PLUGIN_ENABLED_DYNAMIC(PINK)
diff --git a/engines/pink/detection_tables.h b/engines/pink/detection_tables.h
index 5d31233..e14e889 100644
--- a/engines/pink/detection_tables.h
+++ b/engines/pink/detection_tables.h
@@ -28,30 +28,30 @@
namespace Pink {
static const ADGameDescription gameDescriptions[] = {
- {
- "peril",
- 0,{
- {"PPTP.ORB", NULL, NULL, -1},
- {"PPTP.BRO", NULL, NULL, -1},
- {"PPTP.EXE", NULL, NULL, -1},
- AD_LISTEND},
- Common::EN_ANY,
- Common::kPlatformWindows,
- ADGF_UNSTABLE,
- GUIO1(GUIO_NONE)
- },
- {
- "pokus",
- 0, {
- {"HPP.orb", NULL, NULL, -1},
- {"hpp.exe", NULL, NULL, -1},
- AD_LISTEND},
- Common::EN_ANY,
- Common::kPlatformWindows,
- ADGF_UNSTABLE,
- GUIO1(GUIO_NONE)
- },
- AD_TABLE_END_MARKER
+ {
+ "peril",
+ 0,{
+ {"PPTP.ORB", NULL, NULL, -1},
+ {"PPTP.BRO", NULL, NULL, -1},
+ {"PPTP.EXE", NULL, NULL, -1},
+ AD_LISTEND},
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NONE)
+ },
+ {
+ "pokus",
+ 0, {
+ {"HPP.orb", NULL, NULL, -1},
+ {"hpp.exe", NULL, NULL, -1},
+ AD_LISTEND},
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NONE)
+ },
+ AD_TABLE_END_MARKER
};
} // End of namespace Pink
diff --git a/engines/pink/director.cpp b/engines/pink/director.cpp
index 10c3e1d..4ac5c94 100644
--- a/engines/pink/director.cpp
+++ b/engines/pink/director.cpp
@@ -30,112 +30,112 @@
namespace Pink {
Director::Director(OSystem *system)
- : _system(system), showBounds(1) {}
+ : _system(system), showBounds(1) {}
void Director::draw() {
- _system->fillScreen(0);
- for (uint i = 0; i < _sprites.size(); ++i) {
- drawSprite(_sprites[i]);
- }
- _system->updateScreen();
+ _system->fillScreen(0);
+ for (uint i = 0; i < _sprites.size(); ++i) {
+ drawSprite(_sprites[i]);
+ }
+ _system->updateScreen();
}
void Director::drawSprite(ActionCEL *sprite) {
- CelDecoder *decoder = sprite->getDecoder();
- const Graphics::Surface *surface;
- if (decoder->needsUpdate()) {
-
- surface = decoder->decodeNextFrame();
- }
- else surface = decoder->getCurrentFrame();
-
- int h = surface->h;
- if (surface->h + decoder->getY() > 480)
- h = 480 - decoder->getY();
- int w = surface->w;
- if (surface->w + decoder->getX() > 640)
- w = 640 - decoder->getX();
-
- if (!showBounds) {
- Graphics::Surface *screen = _system->lockScreen();
-
- for (int y = 0; y < h; ++y) {
- for (int x = 0; x < w; ++x) {
- uint16 spritePixelColourIndex = *(byte*)surface->getBasePtr(x, y);
- if (spritePixelColourIndex != decoder->getTransparentColourIndex()) {
- *(byte *) screen->getBasePtr(decoder->getX() + x, decoder->getY() + y) = spritePixelColourIndex;
- }
- }
- }
- _system->unlockScreen();
- }
- else _system->copyRectToScreen(surface->getPixels(), surface->pitch,
- decoder->getX(), decoder->getY(),
- w, h);
+ CelDecoder *decoder = sprite->getDecoder();
+ const Graphics::Surface *surface;
+ if (decoder->needsUpdate()) {
+
+ surface = decoder->decodeNextFrame();
+ }
+ else surface = decoder->getCurrentFrame();
+
+ int h = surface->h;
+ if (surface->h + decoder->getY() > 480)
+ h = 480 - decoder->getY();
+ int w = surface->w;
+ if (surface->w + decoder->getX() > 640)
+ w = 640 - decoder->getX();
+
+ if (!showBounds) {
+ Graphics::Surface *screen = _system->lockScreen();
+
+ for (int y = 0; y < h; ++y) {
+ for (int x = 0; x < w; ++x) {
+ uint16 spritePixelColourIndex = *(byte*)surface->getBasePtr(x, y);
+ if (spritePixelColourIndex != decoder->getTransparentColourIndex()) {
+ *(byte *) screen->getBasePtr(decoder->getX() + x, decoder->getY() + y) = spritePixelColourIndex;
+ }
+ }
+ }
+ _system->unlockScreen();
+ }
+ else _system->copyRectToScreen(surface->getPixels(), surface->pitch,
+ decoder->getX(), decoder->getY(),
+ w, h);
}
void Director::addSprite(ActionCEL *sprite) {
- _sprites.push_back(sprite);
- int i;
- for (i = _sprites.size() - 1; i > 0 ; --i) {
- if (sprite->getZ() < _sprites[i - 1]->getZ()){
- _sprites[i] = _sprites[i - 1];
- } else break;
- }
- _sprites[i] = sprite;
+ _sprites.push_back(sprite);
+ int i;
+ for (i = _sprites.size() - 1; i > 0 ; --i) {
+ if (sprite->getZ() < _sprites[i - 1]->getZ()){
+ _sprites[i] = _sprites[i - 1];
+ } else break;
+ }
+ _sprites[i] = sprite;
}
void Director::removeSprite(ActionCEL *sprite) {
- for (uint i = 0; i < _sprites.size(); ++i) {
- if (sprite == _sprites[i]) {
- _sprites.remove_at(i);
- break;
- }
- }
+ for (uint i = 0; i < _sprites.size(); ++i) {
+ if (sprite == _sprites[i]) {
+ _sprites.remove_at(i);
+ break;
+ }
+ }
}
void Director::setPallette(const byte *pallete) {
- _system->getPaletteManager()->setPalette(pallete, 0, 256);
+ _system->getPaletteManager()->setPalette(pallete, 0, 256);
}
void Director::update() {
- for (uint i = 0; i < _sounds.size(); ++i) {
- _sounds[i]->update();
- }
- for (uint i = 0; i < _sprites.size(); ++i) {
- _sprites[i]->update();
- }
+ for (uint i = 0; i < _sounds.size(); ++i) {
+ _sounds[i]->update();
+ }
+ for (uint i = 0; i < _sprites.size(); ++i) {
+ _sprites[i]->update();
+ }
}
void Director::addSound(ActionSound *sound) {
- _sounds.push_back(sound);
+ _sounds.push_back(sound);
}
void Director::removeSound(ActionSound *sound) {
- for (uint i = 0; i < _sounds.size(); ++i) {
- if (_sounds[i] == sound)
- _sounds.remove_at(i);
- }
+ for (uint i = 0; i < _sounds.size(); ++i) {
+ if (_sounds[i] == sound)
+ _sounds.remove_at(i);
+ }
}
void Director::clear() {
- _sprites.clear();
+ _sprites.clear();
}
Actor *Director::getActorByPoint(Common::Point point) {
- for (int i = _sprites.size() - 1; i >= 0; --i) {
- CelDecoder *decoder = _sprites[i]->getDecoder();
- const Graphics::Surface *frame = decoder->getCurrentFrame();
- Common::Rect &rect = decoder->getRectangle();
- if (rect.contains(point) &&
- *(byte*)frame->getBasePtr(point.x - rect.left, point.y - rect.top)
- != decoder->getTransparentColourIndex())
- return _sprites[i]->getActor();
- }
-
- return nullptr;
+ for (int i = _sprites.size() - 1; i >= 0; --i) {
+ CelDecoder *decoder = _sprites[i]->getDecoder();
+ const Graphics::Surface *frame = decoder->getCurrentFrame();
+ Common::Rect &rect = decoder->getRectangle();
+ if (rect.contains(point) &&
+ *(byte*)frame->getBasePtr(point.x - rect.left, point.y - rect.top)
+ != decoder->getTransparentColourIndex())
+ return _sprites[i]->getActor();
+ }
+
+ return nullptr;
}
}
diff --git a/engines/pink/director.h b/engines/pink/director.h
index c2decd0..b1566e7 100644
--- a/engines/pink/director.h
+++ b/engines/pink/director.h
@@ -36,28 +36,28 @@ class CelDecoder;
class Director {
public:
- Director(OSystem *system);
- Actor *getActorByPoint(Common::Point point);
+ Director(OSystem *system);
+ Actor *getActorByPoint(Common::Point point);
- void draw();
- void update();
+ void draw();
+ void update();
- void addSprite(ActionCEL *sprite);
- void removeSprite(ActionCEL *sprite);
- void setPallette(const byte *pallete);
+ void addSprite(ActionCEL *sprite);
+ void removeSprite(ActionCEL *sprite);
+ void setPallette(const byte *pallete);
- void addSound(ActionSound* sound);
- void removeSound(ActionSound* sound);
+ void addSound(ActionSound* sound);
+ void removeSound(ActionSound* sound);
- void clear();
+ void clear();
- bool showBounds;
+ bool showBounds;
private:
- void drawSprite(ActionCEL *sprite);
- OSystem *_system;
- Common::Array<ActionCEL*> _sprites;
- Common::Array<ActionSound*> _sounds;
+ void drawSprite(ActionCEL *sprite);
+ OSystem *_system;
+ Common::Array<ActionCEL*> _sprites;
+ Common::Array<ActionSound*> _sounds;
};
} // End of namespace Pink
diff --git a/engines/pink/file.cpp b/engines/pink/file.cpp
index a62a9d8..68fc53c 100644
--- a/engines/pink/file.cpp
+++ b/engines/pink/file.cpp
@@ -28,75 +28,75 @@
namespace Pink {
OrbFile::OrbFile()
- : File(), _timestamp(0),
- _tableOffset(0),
- _tableSize(0),
- _table(nullptr) {}
+ : File(), _timestamp(0),
+ _tableOffset(0),
+ _tableSize(0),
+ _table(nullptr) {}
OrbFile::~OrbFile() {
- delete[] _table;
+ delete[] _table;
}
bool OrbFile::open(const Common::String &name) {
- if (!File::open(name))
- return false;
+ if (!File::open(name))
+ return false;
- if (readUint32BE() != 'ORB\0'){
- return false;
- }
+ if (readUint32BE() != 'ORB\0'){
+ return false;
+ }
- uint16 minor = readUint16LE();
- uint16 major = readUint16LE();
+ uint16 minor = readUint16LE();
+ uint16 major = readUint16LE();
- debug("Orb v%hu.%hu loaded", major, minor);
+ debug("Orb v%hu.%hu loaded", major, minor);
- if (major != kOrbMajorVersion || minor != kOrbMinorVersion){
- return false;
- }
+ if (major != kOrbMajorVersion || minor != kOrbMinorVersion){
+ return false;
+ }
- if (!(_timestamp = readUint32LE())){
- return false;
- }
+ if (!(_timestamp = readUint32LE())){
+ return false;
+ }
- _tableOffset = readUint32LE();
- _tableSize = readUint32LE();
- _table = new ObjectDescription[_tableSize];
+ _tableOffset = readUint32LE();
+ _tableSize = readUint32LE();
+ _table = new ObjectDescription[_tableSize];
- seek(_tableOffset);
+ seek(_tableOffset);
- for (uint i = 0; i < _tableSize; ++i) {
- _table[i].load(*this);
- }
+ for (uint i = 0; i < _tableSize; ++i) {
+ _table[i].load(*this);
+ }
- return true;
+ return true;
}
void OrbFile::loadGame(PinkEngine *game) {
- seekToObject(kPinkGame);
- Archive archive(this);
- archive.mapObject(reinterpret_cast<Object*>(game)); // hack
- game->load(archive);
+ seekToObject(kPinkGame);
+ Archive archive(this);
+ archive.mapObject(reinterpret_cast<Object*>(game)); // hack
+ game->load(archive);
}
void OrbFile::loadObject(Object *obj, const Common::String &name) {
- seekToObject(name.c_str());
- Archive archive(this);
- obj->load(archive);
+ seekToObject(name.c_str());
+ Archive archive(this);
+ obj->load(archive);
}
void OrbFile::loadObject(Object *obj, ObjectDescription *objDesc) {
- seek(objDesc->objectsOffset);
- Archive archive(this);
- obj->load(archive);
+ seek(objDesc->objectsOffset);
+ Archive archive(this);
+ obj->load(archive);
}
uint32 OrbFile::getTimestamp() {
- return _timestamp;
+ return _timestamp;
}
void OrbFile::seekToObject(const char *name) {
- ObjectDescription *desc = getObjDesc(name);
- seek(desc->objectsOffset);
+ ObjectDescription *desc = getObjDesc(name);
+ seek(desc->objectsOffset);
}
static int objDescComp(const void *a, const void *b) {
@@ -104,56 +104,56 @@ static int objDescComp(const void *a, const void *b) {
}
ObjectDescription *OrbFile::getObjDesc(const char *name){
- ObjectDescription *desc = (ObjectDescription*) bsearch(name, _table, _tableSize, sizeof(ObjectDescription), objDescComp);
- assert(desc != nullptr);
- return desc;
+ ObjectDescription *desc = (ObjectDescription*) bsearch(name, _table, _tableSize, sizeof(ObjectDescription), objDescComp);
+ assert(desc != nullptr);
+ return desc;
}
ResourceDescription *OrbFile::getResDescTable(ObjectDescription *objDesc){
- ResourceDescription *table = new ResourceDescription[objDesc->resourcesCount];
- seek(objDesc->resourcesOffset);
+ ResourceDescription *table = new ResourceDescription[objDesc->resourcesCount];
+ seek(objDesc->resourcesOffset);
- for (uint i = 0; i < objDesc->resourcesCount; ++i) {
- table[i].load(*this);
- }
+ for (uint i = 0; i < objDesc->resourcesCount; ++i) {
+ table[i].load(*this);
+ }
- return table;
+ return table;
}
bool BroFile::open(const Common::String &name, uint32 orbTimestamp) {
- if (!File::open(name) || readUint32BE() != 'BRO\0')
- return false;
+ if (!File::open(name) || readUint32BE() != 'BRO\0')
+ return false;
- uint16 minor = readUint16LE();
- uint16 major = readUint16LE();
+ uint16 minor = readUint16LE();
+ uint16 major = readUint16LE();
- debug("Bro v%hu.%hu loaded", major, minor);
+ debug("Bro v%hu.%hu loaded", major, minor);
- if (major != kBroMajorVersion || minor != kBroMinorVersion){
- return false;
- }
+ if (major != kBroMajorVersion || minor != kBroMinorVersion){
+ return false;
+ }
- uint32 timestamp = readUint32LE();
+ uint32 timestamp = readUint32LE();
- return timestamp == orbTimestamp;
+ return timestamp == orbTimestamp;
}
void ObjectDescription::load(Common::File &file) {
- file.read(name, sizeof(name));
+ file.read(name, sizeof(name));
- objectsOffset = file.readUint32LE();
- objectsCount = file.readUint32LE();
- resourcesOffset = file.readUint32LE();
- resourcesCount = file.readUint32LE();
+ objectsOffset = file.readUint32LE();
+ objectsCount = file.readUint32LE();
+ resourcesOffset = file.readUint32LE();
+ resourcesCount = file.readUint32LE();
}
void ResourceDescription::load(Common::File &file) {
- file.read(name, sizeof(name));
+ file.read(name, sizeof(name));
- offset = file.readUint32LE();
- size = file.readUint32LE();
- inBro = (bool) file.readUint16LE();
+ offset = file.readUint32LE();
+ size = file.readUint32LE();
+ inBro = (bool) file.readUint16LE();
}
} // End of namespace Pink
diff --git a/engines/pink/file.h b/engines/pink/file.h
index 469885f..094a332 100644
--- a/engines/pink/file.h
+++ b/engines/pink/file.h
@@ -28,23 +28,23 @@
namespace Pink {
struct ObjectDescription {
- void load(Common::File &file);
+ void load(Common::File &file);
- char name[16];
- uint32 objectsOffset;
- uint32 objectsCount;
- uint32 resourcesOffset;
- uint32 resourcesCount;
+ char name[16];
+ uint32 objectsOffset;
+ uint32 objectsCount;
+ uint32 resourcesOffset;
+ uint32 resourcesCount;
};
struct ResourceDescription {
- void load(Common::File &file);
+ void load(Common::File &file);
- char name[16];
- uint32 offset;
- uint32 size;
- bool inBro; // in original it is short.
- // Don't know what's better to use.(Perhaps no difference because of padding)
+ char name[16];
+ uint32 offset;
+ uint32 size;
+ bool inBro; // in original it is short.
+ // Don't know what's better to use.(Perhaps no difference because of padding)
};
class PinkEngine;
@@ -52,30 +52,30 @@ class Object;
class OrbFile : public Common::File {
public:
- OrbFile();
- virtual ~OrbFile();
- virtual bool open(const Common::String &name);
+ OrbFile();
+ virtual ~OrbFile();
+ virtual bool open(const Common::String &name);
- void loadGame(PinkEngine *game);
- void loadObject(Object *obj, const Common::String &name);
- void loadObject(Object *obj, ObjectDescription *objDesc);
+ void loadGame(PinkEngine *game);
+ void loadObject(Object *obj, const Common::String &name);
+ void loadObject(Object *obj, ObjectDescription *objDesc);
- ObjectDescription *getObjDesc(const char *name);
- ResourceDescription *getResDescTable(ObjectDescription *objDesc);
+ ObjectDescription *getObjDesc(const char *name);
+ ResourceDescription *getResDescTable(ObjectDescription *objDesc);
- uint32 getTimestamp();
+ uint32 getTimestamp();
private:
- void seekToObject(const char *name);
+ void seekToObject(const char *name);
ObjectDescription *_table;
- uint32 _timestamp;
- uint32 _tableOffset;
- uint32 _tableSize;
+ uint32 _timestamp;
+ uint32 _tableOffset;
+ uint32 _tableSize;
};
class BroFile : public Common::File {
public:
- virtual bool open(const Common::String &name, uint32 orbTimestamp);
+ virtual bool open(const Common::String &name, uint32 orbTimestamp);
};
} // End of namespace Pink
diff --git a/engines/pink/module.mk b/engines/pink/module.mk
index 53627ec..94ba205 100644
--- a/engines/pink/module.mk
+++ b/engines/pink/module.mk
@@ -1,48 +1,48 @@
MODULE := engines/pink
MODULE_OBJS = \
- archive.o \
- cel_decoder.o \
- console.o \
- cursor_mgr.o \
+ archive.o \
+ cel_decoder.o \
+ console.o \
+ cursor_mgr.o \
detection.o \
director.o \
file.o \
pink.o \
resource_mgr.o \
sound.o \
- objects/object.o \
- objects/module.o \
- objects/inventory.o \
- objects/side_effect.o \
- objects/condition.o \
- objects/actions/action.o \
- objects/actions/action_cel.o \
- objects/actions/action_hide.o \
- objects/actions/action_loop.o \
- objects/actions/action_play.o \
- objects/actions/action_play_with_sfx.o \
- objects/actions/action_sound.o \
- objects/actions/action_still.o \
- objects/actions/action_talk.o \
- objects/actions/action_text.o \
- objects/actions/walk_action.o \
- objects/actors/actor.o \
- objects/actors/lead_actor.o \
- objects/actors/supporting_actor.o \
- objects/handlers/handler.o \
- objects/handlers/handler_mgr.o \
- objects/handlers/handler_timer.o \
- objects/pages/page.o \
- objects/pages/game_page.o \
- objects/sequences/seq_timer.o \
- objects/sequences/sequence.o \
- objects/sequences/sequence_context.o \
- objects/sequences/sequence_item.o \
- objects/sequences/sequencer.o \
- objects/walk/walk_mgr.o \
- objects/walk/walk_location.o \
- objects/walk/walk_shortest_path.o \
+ objects/object.o \
+ objects/module.o \
+ objects/inventory.o \
+ objects/side_effect.o \
+ objects/condition.o \
+ objects/actions/action.o \
+ objects/actions/action_cel.o \
+ objects/actions/action_hide.o \
+ objects/actions/action_loop.o \
+ objects/actions/action_play.o \
+ objects/actions/action_play_with_sfx.o \
+ objects/actions/action_sound.o \
+ objects/actions/action_still.o \
+ objects/actions/action_talk.o \
+ objects/actions/action_text.o \
+ objects/actions/walk_action.o \
+ objects/actors/actor.o \
+ objects/actors/lead_actor.o \
+ objects/actors/supporting_actor.o \
+ objects/handlers/handler.o \
+ objects/handlers/handler_mgr.o \
+ objects/handlers/handler_timer.o \
+ objects/pages/page.o \
+ objects/pages/game_page.o \
+ objects/sequences/seq_timer.o \
+ objects/sequences/sequence.o \
+ objects/sequences/sequence_context.o \
+ objects/sequences/sequence_item.o \
+ objects/sequences/sequencer.o \
+ objects/walk/walk_mgr.o \
+ objects/walk/walk_location.o \
+ objects/walk/walk_shortest_path.o \
# This module can be built as a plugin
ifeq ($(ENABLE_PINK), DYNAMIC_PLUGIN)
@@ -50,4 +50,4 @@ PLUGIN := 1
endif
# Include common rules
-include $(srcdir)/rules.mk
\ No newline at end of file
+include $(srcdir)/rules.mk
diff --git a/engines/pink/objects/actions/action.cpp b/engines/pink/objects/actions/action.cpp
index c639883..934d6fc 100644
--- a/engines/pink/objects/actions/action.cpp
+++ b/engines/pink/objects/actions/action.cpp
@@ -27,8 +27,8 @@
namespace Pink {
void Action::deserialize(Archive &archive) {
- NamedObject::deserialize(archive);
- _actor = static_cast<Actor*>(archive.readObject());
+ NamedObject::deserialize(archive);
+ _actor = static_cast<Actor*>(archive.readObject());
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action.h b/engines/pink/objects/actions/action.h
index 0d57fbb..241aee8 100644
--- a/engines/pink/objects/actions/action.h
+++ b/engines/pink/objects/actions/action.h
@@ -32,21 +32,21 @@ class Director;
class Action : public NamedObject {
public:
- virtual void deserialize(Archive &archive);
- virtual void start(bool unk) {};
- virtual void end() {};
- virtual void update() {};
- virtual void toConsole() {};
+ virtual void deserialize(Archive &archive);
+ virtual void start(bool unk) {};
+ virtual void end() {};
+ virtual void update() {};
+ virtual void toConsole() {};
- virtual bool initPalette(Director *director) { return 0;}
+ virtual bool initPalette(Director *director) { return 0;}
- Actor *getActor() { return _actor;}
+ Actor *getActor() { return _actor;}
- virtual void pause() {};
- virtual void unpause() {};
+ virtual void pause() {};
+ virtual void unpause() {};
protected:
- Actor *_actor;
+ Actor *_actor;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp
index 352c635..f38c127 100644
--- a/engines/pink/objects/actions/action_cel.cpp
+++ b/engines/pink/objects/actions/action_cel.cpp
@@ -32,64 +32,64 @@
namespace Pink {
ActionCEL::ActionCEL()
- : _decoder(nullptr) {
+ : _decoder(nullptr) {
}
void ActionCEL::deserialize(Archive &archive) {
- Action::deserialize(archive);
- _fileName = archive.readString();
- _z = archive.readDWORD();
+ Action::deserialize(archive);
+ _fileName = archive.readString();
+ _z = archive.readDWORD();
}
void ActionCEL::start(bool unk) {
- if (!_decoder)
- _decoder = _actor->getPage()->loadCel(_fileName);
- _actor->getPage()->getGame()->getDirector()->addSprite(this);
+ if (!_decoder)
+ _decoder = _actor->getPage()->loadCel(_fileName);
+ _actor->getPage()->getGame()->getDirector()->addSprite(this);
- this->onStart();
+ this->onStart();
}
void ActionCEL::end() {
- _actor->getPage()->getGame()->getDirector()->removeSprite(this);
- delete _decoder;
- _decoder = nullptr;
+ _actor->getPage()->getGame()->getDirector()->removeSprite(this);
+ delete _decoder;
+ _decoder = nullptr;
}
uint32 ActionCEL::getZ() {
- return _z;
+ return _z;
}
CelDecoder *ActionCEL::getDecoder() {
- return _decoder;
+ return _decoder;
}
bool ActionCEL::initPalette(Director *director) {
- _decoder = _actor->getPage()->loadCel(_fileName);
- _decoder->decodeNextFrame();
- _decoder->rewind();
- director->setPallette(_decoder->getPalette());
+ _decoder = _actor->getPage()->loadCel(_fileName);
+ _decoder->decodeNextFrame();
+ _decoder->rewind();
+ director->setPallette(_decoder->getPalette());
- return 1;
+ return 1;
}
void ActionCEL::update() {
- if (_decoder->endOfVideo()){
- _decoder->stop();
- _actor->endAction();
- }
+ if (_decoder->endOfVideo()){
+ _decoder->stop();
+ _actor->endAction();
+ }
}
ActionCEL::~ActionCEL() {
- end();
+ end();
}
void ActionCEL::pause() {
- _decoder->pauseVideo(1);
+ _decoder->pauseVideo(1);
}
void ActionCEL::unpause() {
- _decoder->pauseVideo(0);
+ _decoder->pauseVideo(0);
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_cel.h b/engines/pink/objects/actions/action_cel.h
index 937c23b..765fe8d 100644
--- a/engines/pink/objects/actions/action_cel.h
+++ b/engines/pink/objects/actions/action_cel.h
@@ -31,28 +31,28 @@ class CelDecoder;
class ActionCEL : public Action {
public:
- ~ActionCEL() override;
+ ~ActionCEL() override;
- ActionCEL();
- virtual void deserialize(Archive &archive);
- virtual void start(bool unk);
- virtual void end();
- virtual void update();
+ ActionCEL();
+ virtual void deserialize(Archive &archive);
+ virtual void start(bool unk);
+ virtual void end();
+ virtual void update();
- uint32 getZ();
- CelDecoder *getDecoder();
+ uint32 getZ();
+ CelDecoder *getDecoder();
- virtual bool initPalette(Director *director);
+ virtual bool initPalette(Director *director);
- void pause() override;
+ void pause() override;
- void unpause() override;
+ void unpause() override;
protected:
- virtual void onStart() {} ;
- CelDecoder *_decoder;
- Common::String _fileName;
- uint32 _z;
+ virtual void onStart() {} ;
+ CelDecoder *_decoder;
+ Common::String _fileName;
+ uint32 _z;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_hide.cpp b/engines/pink/objects/actions/action_hide.cpp
index a8a9a3a..1732d2d 100644
--- a/engines/pink/objects/actions/action_hide.cpp
+++ b/engines/pink/objects/actions/action_hide.cpp
@@ -27,20 +27,20 @@
namespace Pink {
void Pink::ActionHide::deserialize(Archive &archive) {
- Action::deserialize(archive);
+ Action::deserialize(archive);
}
void ActionHide::start(bool unk_startNow) {
- debug("Actor %s has now ActionHide %s", _actor->getName().c_str(), _name.c_str());
- _actor->endAction();
+ debug("Actor %s has now ActionHide %s", _actor->getName().c_str(), _name.c_str());
+ _actor->endAction();
}
void ActionHide::end() {
- debug("ActionHide %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
+ debug("ActionHide %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
}
void ActionHide::toConsole() {
- debug("\tActionHide: _name = %s", _name.c_str());
+ debug("\tActionHide: _name = %s", _name.c_str());
}
ActionHide::~ActionHide() {}
diff --git a/engines/pink/objects/actions/action_hide.h b/engines/pink/objects/actions/action_hide.h
index a7c23a4..eb2b8da 100644
--- a/engines/pink/objects/actions/action_hide.h
+++ b/engines/pink/objects/actions/action_hide.h
@@ -29,13 +29,13 @@ namespace Pink {
class ActionHide : public Action {
public:
- ~ActionHide() override;
+ ~ActionHide() override;
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
- virtual void start(bool unk);
- virtual void end();
+ virtual void start(bool unk);
+ virtual void end();
};
} //End of namespace Pink
diff --git a/engines/pink/objects/actions/action_loop.cpp b/engines/pink/objects/actions/action_loop.cpp
index 77a1763..f32a3a4 100644
--- a/engines/pink/objects/actions/action_loop.cpp
+++ b/engines/pink/objects/actions/action_loop.cpp
@@ -28,42 +28,42 @@
namespace Pink {
void ActionLoop::deserialize(Archive &archive) {
- ActionPlay::deserialize(archive);
- uint16 style;
- _intro = archive.readDWORD();
- style = archive.readWORD();
- switch (style) {
- case kPingPong:
- _style = kPingPong;
- break;
- case kRandom:
- _style = kRandom;
- break;
- default:
- _style = kForward;
- break;
- }
+ ActionPlay::deserialize(archive);
+ uint16 style;
+ _intro = archive.readDWORD();
+ style = archive.readWORD();
+ switch (style) {
+ case kPingPong:
+ _style = kPingPong;
+ break;
+ case kRandom:
+ _style = kRandom;
+ break;
+ default:
+ _style = kForward;
+ break;
+ }
}
void ActionLoop::toConsole() {
- debug("\tActionLoop: _name = %s, _fileName = %s, z = %u, _startFrame = %u,"
- " _endFrame = %d, _intro = %u, _style = %u",
- _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame, _intro, _style);
+ debug("\tActionLoop: _name = %s, _fileName = %s, z = %u, _startFrame = %u,"
+ " _endFrame = %d, _intro = %u, _style = %u",
+ _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame, _intro, _style);
}
void ActionLoop::update() {
- // for now it supports only forward loop animation
- if (_style == kForward) {
- if (_decoder->endOfVideo() || _decoder->getCurFrame() == _stopFrame){
- //debug("ACTION LOOP : NEXT ITERATION");
- _decoder->rewind();
- }
- }
+ // for now it supports only forward loop animation
+ if (_style == kForward) {
+ if (_decoder->endOfVideo() || _decoder->getCurFrame() == _stopFrame){
+ //debug("ACTION LOOP : NEXT ITERATION");
+ _decoder->rewind();
+ }
+ }
}
void ActionLoop::onStart() {
- ActionPlay::onStart();
- _actor->endAction();
+ ActionPlay::onStart();
+ _actor->endAction();
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_loop.h b/engines/pink/objects/actions/action_loop.h
index 12c9e2d..0b8132a 100644
--- a/engines/pink/objects/actions/action_loop.h
+++ b/engines/pink/objects/actions/action_loop.h
@@ -29,19 +29,19 @@ namespace Pink {
class ActionLoop : public ActionPlay {
public:
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
- virtual void update();
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
+ virtual void update();
protected:
- virtual void onStart();
+ virtual void onStart();
- enum Style {
- kPingPong = 2,
- kRandom = 3,
- kForward = 4
- };
- uint _intro;
- Style _style;
+ enum Style {
+ kPingPong = 2,
+ kRandom = 3,
+ kForward = 4
+ };
+ uint _intro;
+ Style _style;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_play.cpp b/engines/pink/objects/actions/action_play.cpp
index 6ab21db..6ae56df 100644
--- a/engines/pink/objects/actions/action_play.cpp
+++ b/engines/pink/objects/actions/action_play.cpp
@@ -30,34 +30,34 @@
namespace Pink {
void ActionPlay::deserialize(Archive &archive) {
- ActionStill::deserialize(archive);
- _stopFrame = archive.readDWORD();
+ ActionStill::deserialize(archive);
+ _stopFrame = archive.readDWORD();
}
void ActionPlay::toConsole() {
- debug("\tActionPlay: _name = %s, _fileName = %s, z = %u, _startFrame = %u,"
- " _endFrame = %d", _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame);
+ debug("\tActionPlay: _name = %s, _fileName = %s, z = %u, _startFrame = %u,"
+ " _endFrame = %d", _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame);
}
void ActionPlay::end() {
- ActionCEL::end();
- debug("ActionPlay %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
+ ActionCEL::end();
+ debug("ActionPlay %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
}
void ActionPlay::onStart() {
- debug("Actor %s has now ActionPlay %s", _actor->getName().c_str(), _name.c_str());
- _decoder->start();
- for (uint i = 0; i < _startFrame; ++i) {
- _decoder->skipFrame();
- }
- _decoder->decodeNextFrame();
+ debug("Actor %s has now ActionPlay %s", _actor->getName().c_str(), _name.c_str());
+ _decoder->start();
+ for (uint i = 0; i < _startFrame; ++i) {
+ _decoder->skipFrame();
+ }
+ _decoder->decodeNextFrame();
}
void ActionPlay::update() {
- if (_decoder->endOfVideo() || _decoder->getCurFrame() == _stopFrame){
- _decoder->stop();
- _actor->endAction();
- }
+ if (_decoder->endOfVideo() || _decoder->getCurFrame() == _stopFrame){
+ _decoder->stop();
+ _actor->endAction();
+ }
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_play.h b/engines/pink/objects/actions/action_play.h
index 319d059..6553bb1 100644
--- a/engines/pink/objects/actions/action_play.h
+++ b/engines/pink/objects/actions/action_play.h
@@ -29,17 +29,17 @@ namespace Pink {
class ActionPlay : public ActionStill {
public:
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
- virtual void end();
+ virtual void end();
- void update() override;
+ void update() override;
protected:
- virtual void onStart();
+ virtual void onStart();
- int32 _stopFrame;
+ int32 _stopFrame;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_play_with_sfx.cpp b/engines/pink/objects/actions/action_play_with_sfx.cpp
index e6f5570..9cb8503 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.cpp
+++ b/engines/pink/objects/actions/action_play_with_sfx.cpp
@@ -29,90 +29,90 @@
namespace Pink {
void ActionPlayWithSfx::deserialize(Pink::Archive &archive) {
- ActionPlay::deserialize(archive);
- _isLoop = archive.readDWORD();
- _sfxArray.deserialize(archive);
+ ActionPlay::deserialize(archive);
+ _isLoop = archive.readDWORD();
+ _sfxArray.deserialize(archive);
}
void ActionPlayWithSfx::toConsole() {
- debug("\tActionPlayWithSfx: _name = %s, _fileName = %s, z = %u, _startFrame = %u,"
- " _endFrame = %d, _isLoop = %u", _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame, _isLoop);
- for (uint i = 0; i < _sfxArray.size(); ++i) {
- _sfxArray[i]->toConsole();
- }
+ debug("\tActionPlayWithSfx: _name = %s, _fileName = %s, z = %u, _startFrame = %u,"
+ " _endFrame = %d, _isLoop = %u", _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame, _isLoop);
+ for (uint i = 0; i < _sfxArray.size(); ++i) {
+ _sfxArray[i]->toConsole();
+ }
}
void ActionPlayWithSfx::update() {
- if ((_decoder->endOfVideo() || _decoder->getCurFrame() == _stopFrame) && _isLoop) {
- _decoder->rewind();
- } else if (_decoder->endOfVideo() || _decoder->getCurFrame() == _stopFrame) {
- _decoder->stop();
- _actor->endAction();
- }
-
- updateSound();
+ if ((_decoder->endOfVideo() || _decoder->getCurFrame() == _stopFrame) && _isLoop) {
+ _decoder->rewind();
+ } else if (_decoder->endOfVideo() || _decoder->getCurFrame() == _stopFrame) {
+ _decoder->stop();
+ _actor->endAction();
+ }
+
+ updateSound();
}
void ActionPlayWithSfx::onStart() {
- ActionPlay::onStart();
- if (_isLoop) {
- _actor->endAction();
- }
- updateSound();
+ ActionPlay::onStart();
+ if (_isLoop) {
+ _actor->endAction();
+ }
+ updateSound();
}
void ActionPlayWithSfx::updateSound() {
- if (!_actor->isPlaying() && !_isLoop)
- return;
-
- for (uint i = 0; i < _sfxArray.size(); ++i) {
- if (_sfxArray[i]->getFrame() == _decoder->getCurFrame()) {
- _sfxArray[i]->play(_actor->getPage());
- }
- }
+ if (!_actor->isPlaying() && !_isLoop)
+ return;
+
+ for (uint i = 0; i < _sfxArray.size(); ++i) {
+ if (_sfxArray[i]->getFrame() == _decoder->getCurFrame()) {
+ _sfxArray[i]->play(_actor->getPage());
+ }
+ }
}
ActionPlayWithSfx::~ActionPlayWithSfx() {
- ActionPlay::end();
- for (uint i = 0; i < _sfxArray.size(); ++i) {
- delete _sfxArray[i];
- }
+ ActionPlay::end();
+ for (uint i = 0; i < _sfxArray.size(); ++i) {
+ delete _sfxArray[i];
+ }
}
void ActionSfx::deserialize(Pink::Archive &archive) {
- _frame = archive.readDWORD();
+ _frame = archive.readDWORD();
_volume = archive.readDWORD();
- _sfxName = archive.readString();
- archive.readObject(); // pointer of ActionPlayWithSfx
+ _sfxName = archive.readString();
+ archive.readObject(); // pointer of ActionPlayWithSfx
}
void ActionSfx::toConsole() {
- debug("\t\tActionSfx: _sfx = %s, _volume = %u, _frame = %u", _sfxName.c_str(), _volume, _frame);
+ debug("\t\tActionSfx: _sfx = %s, _volume = %u, _frame = %u", _sfxName.c_str(), _volume, _frame);
}
void ActionSfx::play(GamePage *page) {
- if (!_sound)
- _sound = page->loadSound(_sfxName);
+ if (!_sound)
+ _sound = page->loadSound(_sfxName);
- if (!_sound->isPlaying())
- _sound->play(Audio::Mixer::SoundType::kSFXSoundType, _volume, 0);
+ if (!_sound->isPlaying())
+ _sound->play(Audio::Mixer::SoundType::kSFXSoundType, _volume, 0);
}
ActionSfx::~ActionSfx() {
- end();
+ end();
}
uint32 ActionSfx::getFrame() {
- return _frame;
+ return _frame;
}
ActionSfx::ActionSfx()
- : _sound(nullptr)
+ : _sound(nullptr)
{}
void ActionSfx::end() {
- delete _sound;
- _sound = nullptr;
+ delete _sound;
+ _sound = nullptr;
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_play_with_sfx.h b/engines/pink/objects/actions/action_play_with_sfx.h
index 865f368..89b2ec6 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.h
+++ b/engines/pink/objects/actions/action_play_with_sfx.h
@@ -31,18 +31,18 @@ class ActionSfx;
class ActionPlayWithSfx : public ActionPlay {
public:
- virtual ~ActionPlayWithSfx();
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
- virtual void update();
+ virtual ~ActionPlayWithSfx();
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
+ virtual void update();
protected:
- virtual void onStart();
+ virtual void onStart();
private:
- void updateSound();
- uint32 _isLoop;
- Array<ActionSfx*> _sfxArray;
+ void updateSound();
+ uint32 _isLoop;
+ Array<ActionSfx*> _sfxArray;
};
class Sound;
@@ -50,20 +50,20 @@ class GamePage;
class ActionSfx : public Object {
public:
- ActionSfx();
- virtual ~ActionSfx();
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ ActionSfx();
+ virtual ~ActionSfx();
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
- void play(GamePage *page);
- uint32 getFrame();
- void end();
+ void play(GamePage *page);
+ uint32 getFrame();
+ void end();
private:
- Sound *_sound;
- Common::String _sfxName;
- uint32 _volume;
- uint32 _frame;
+ Sound *_sound;
+ Common::String _sfxName;
+ uint32 _volume;
+ uint32 _frame;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_sound.cpp b/engines/pink/objects/actions/action_sound.cpp
index 45d74be..e94251d 100644
--- a/engines/pink/objects/actions/action_sound.cpp
+++ b/engines/pink/objects/actions/action_sound.cpp
@@ -32,68 +32,68 @@
namespace Pink {
ActionSound::ActionSound()
- : _sound(nullptr)
+ : _sound(nullptr)
{}
ActionSound::~ActionSound(){
- end();
+ end();
}
void ActionSound::deserialize(Archive &archive) {
- Action::deserialize(archive);
- _fileName = archive.readString();
- _volume = archive.readDWORD();
- _isLoop = (bool) archive.readDWORD();
- _isBackground = (bool) archive.readDWORD();
+ Action::deserialize(archive);
+ _fileName = archive.readString();
+ _volume = archive.readDWORD();
+ _isLoop = (bool) archive.readDWORD();
+ _isBackground = (bool) archive.readDWORD();
}
void ActionSound::toConsole() {
- debug("\tActionSound: _name = %s, _fileName = %s, _volume = %u, _isLoop = %u,"
- " _isBackground = %u", _name.c_str(), _fileName.c_str(), _volume, _isLoop, _isBackground);
+ debug("\tActionSound: _name = %s, _fileName = %s, _volume = %u, _isLoop = %u,"
+ " _isBackground = %u", _name.c_str(), _fileName.c_str(), _volume, _isLoop, _isBackground);
}
void ActionSound::start(bool unk) {
- assert(!_sound);
- _sound = _actor->getPage()->loadSound(_fileName);
+ assert(!_sound);
+ _sound = _actor->getPage()->loadSound(_fileName);
- Audio::Mixer::SoundType soundType = _isBackground ? Audio::Mixer::SoundType::kMusicSoundType
- : Audio::Mixer::SoundType::kSpeechSoundType;
+ Audio::Mixer::SoundType soundType = _isBackground ? Audio::Mixer::SoundType::kMusicSoundType
+ : Audio::Mixer::SoundType::kSpeechSoundType;
- Director *director = _actor->getPage()->getGame()->getDirector();
- director->addSound(this);
+ Director *director = _actor->getPage()->getGame()->getDirector();
+ director->addSound(this);
- _sound->play(soundType, _volume, _isLoop);
- if (_isLoop)
- _actor->endAction();
+ _sound->play(soundType, _volume, _isLoop);
+ if (_isLoop)
+ _actor->endAction();
- debug("Actor %s has now ActionSound %s", _actor->getName().c_str(), _name.c_str());
+ debug("Actor %s has now ActionSound %s", _actor->getName().c_str(), _name.c_str());
}
void ActionSound::end() {
- if (_sound) {
- debug("ActionSound %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
+ if (_sound) {
+ debug("ActionSound %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
- Director *director = _actor->getPage()->getGame()->getDirector();
- director->removeSound(this);
+ Director *director = _actor->getPage()->getGame()->getDirector();
+ director->removeSound(this);
- delete _sound;
- _sound = nullptr;
- }
+ delete _sound;
+ _sound = nullptr;
+ }
}
void ActionSound::update() {
- if (!_sound->isPlaying())
- _actor->endAction();
+ if (!_sound->isPlaying())
+ _actor->endAction();
}
void ActionSound::pause() {
- if (_sound)
- _sound->pause();
+ if (_sound)
+ _sound->pause();
}
void ActionSound::unpause() {
- if (_sound)
- _sound->resume();
+ if (_sound)
+ _sound->resume();
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_sound.h b/engines/pink/objects/actions/action_sound.h
index 0fb39bb..6e18f97 100644
--- a/engines/pink/objects/actions/action_sound.h
+++ b/engines/pink/objects/actions/action_sound.h
@@ -31,26 +31,26 @@ class Sound;
class ActionSound : public Action {
public:
- ActionSound();
- ~ActionSound();
+ ActionSound();
+ ~ActionSound();
- virtual void deserialize(Archive &archive);
+ virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ virtual void toConsole();
- virtual void start(bool unk_startNow);
- virtual void end();
- virtual void update();
+ virtual void start(bool unk_startNow);
+ virtual void end();
+ virtual void update();
- void pause() override;
- void unpause() override;
+ void pause() override;
+ void unpause() override;
private:
- Sound *_sound;
- Common::String _fileName;
- uint32 _volume;
- bool _isLoop;
- bool _isBackground;
+ Sound *_sound;
+ Common::String _fileName;
+ uint32 _volume;
+ bool _isLoop;
+ bool _isBackground;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_still.cpp b/engines/pink/objects/actions/action_still.cpp
index c72e634..ebdde4e 100644
--- a/engines/pink/objects/actions/action_still.cpp
+++ b/engines/pink/objects/actions/action_still.cpp
@@ -30,28 +30,28 @@
namespace Pink {
void ActionStill::deserialize(Archive &archive) {
- ActionCEL::deserialize(archive);
- _startFrame = archive.readDWORD();
+ ActionCEL::deserialize(archive);
+ _startFrame = archive.readDWORD();
}
void ActionStill::toConsole() {
- debug("\tActionStill: _name = %s, _fileName = %s, _z =%u _startFrame = %u",
- _name.c_str(), _fileName.c_str(), _z, _startFrame);
+ debug("\tActionStill: _name = %s, _fileName = %s, _z =%u _startFrame = %u",
+ _name.c_str(), _fileName.c_str(), _z, _startFrame);
}
void ActionStill::end() {
- ActionCEL::end();
- debug("ActionStill %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
+ ActionCEL::end();
+ debug("ActionStill %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
}
void ActionStill::onStart() {
- debug("Actor %s has now ActionStill %s", _actor->getName().c_str(), _name.c_str());
- for (uint i = 0; i < _startFrame; ++i) {
- _decoder->skipFrame();
- }
- _decoder->decodeNextFrame();
- _decoder->stop();
- _actor->endAction();
+ debug("Actor %s has now ActionStill %s", _actor->getName().c_str(), _name.c_str());
+ for (uint i = 0; i < _startFrame; ++i) {
+ _decoder->skipFrame();
+ }
+ _decoder->decodeNextFrame();
+ _decoder->stop();
+ _actor->endAction();
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_still.h b/engines/pink/objects/actions/action_still.h
index cef3967..a62b201 100644
--- a/engines/pink/objects/actions/action_still.h
+++ b/engines/pink/objects/actions/action_still.h
@@ -29,15 +29,15 @@ namespace Pink {
class ActionStill : public ActionCEL {
public:
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
- virtual void end();
+ virtual void end();
protected:
- virtual void onStart();
+ virtual void onStart();
- uint32 _startFrame;
+ uint32 _startFrame;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_talk.cpp b/engines/pink/objects/actions/action_talk.cpp
index fad3f19..1f55de1 100644
--- a/engines/pink/objects/actions/action_talk.cpp
+++ b/engines/pink/objects/actions/action_talk.cpp
@@ -30,46 +30,46 @@
namespace Pink {
void ActionTalk::deserialize(Archive &archive) {
- ActionLoop::deserialize(archive);
- _vox = archive.readString();
+ ActionLoop::deserialize(archive);
+ _vox = archive.readString();
}
void ActionTalk::toConsole() {
- debug("\tActionTalk: _name = %s, _fileName = %s, z = %u, _startFrame = %u,"
- " _endFrame = %d, _intro = %u, _style = %u, _vox = %s",
- _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame, _intro, _style, _vox.c_str());
+ debug("\tActionTalk: _name = %s, _fileName = %s, z = %u, _startFrame = %u,"
+ " _endFrame = %d, _intro = %u, _style = %u, _vox = %s",
+ _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame, _intro, _style, _vox.c_str());
}
void ActionTalk::onStart() {
- ActionPlay::onStart();
- _sound = _actor->getPage()->loadSound(_vox);
- _sound->play(Audio::Mixer::SoundType::kSpeechSoundType, 100, 0);
+ ActionPlay::onStart();
+ _sound = _actor->getPage()->loadSound(_vox);
+ _sound->play(Audio::Mixer::SoundType::kSpeechSoundType, 100, 0);
}
void ActionTalk::update() {
- ActionLoop::update();
- if (!_sound->isPlaying()) {
- _decoder->stop();
- _actor->endAction();
- }
+ ActionLoop::update();
+ if (!_sound->isPlaying()) {
+ _decoder->stop();
+ _actor->endAction();
+ }
}
void ActionTalk::end() {
- ActionPlay::end();
- delete _sound;
- _sound = nullptr;
+ ActionPlay::end();
+ delete _sound;
+ _sound = nullptr;
}
void ActionTalk::pause() {
- ActionCEL::pause();
- if (_sound)
- _sound->pause();
+ ActionCEL::pause();
+ if (_sound)
+ _sound->pause();
}
void ActionTalk::unpause() {
- ActionCEL::unpause();
- if (_sound)
- _sound->resume();
+ ActionCEL::unpause();
+ if (_sound)
+ _sound->resume();
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_talk.h b/engines/pink/objects/actions/action_talk.h
index 77e8d90..61ef1a4 100644
--- a/engines/pink/objects/actions/action_talk.h
+++ b/engines/pink/objects/actions/action_talk.h
@@ -31,21 +31,21 @@ class Sound;
class ActionTalk : public ActionLoop {
public:
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
- virtual void update();
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
+ virtual void update();
- virtual void end();
+ virtual void end();
- void pause() override;
- void unpause() override;
+ void pause() override;
+ void unpause() override;
protected:
- virtual void onStart();
+ virtual void onStart();
private:
- Sound *_sound;
- Common::String _vox;
+ Sound *_sound;
+ Common::String _vox;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_text.cpp b/engines/pink/objects/actions/action_text.cpp
index 12e2809..3e05346 100644
--- a/engines/pink/objects/actions/action_text.cpp
+++ b/engines/pink/objects/actions/action_text.cpp
@@ -28,19 +28,19 @@
namespace Pink {
void ActionText::deserialize(Archive &archive) {
- for (int i = 0; i < 4 ; ++i) {
- _bounds[i] = archive.readDWORD();
- }
- _centered = archive.readDWORD();
- _scrollBar = archive.readDWORD();
- _textColor = archive.readDWORD();
- _backgroundColor = archive.readDWORD();
+ for (int i = 0; i < 4 ; ++i) {
+ _bounds[i] = archive.readDWORD();
+ }
+ _centered = archive.readDWORD();
+ _scrollBar = archive.readDWORD();
+ _textColor = archive.readDWORD();
+ _backgroundColor = archive.readDWORD();
}
void ActionText::toConsole() {
- debug("\tActionText: _name = %s, _text = %s, "
- "_bound0 = %u, _bound1 = %u, _bound2 = %u, _bound3 = %u _centered = %u, _scrollBar = %u, _textColor = %u _backgroundColor = %u",
- _name.c_str(), _text.c_str(), _bounds[0], _bounds[1], _bounds[2], _bounds[3], _centered, _scrollBar, _textColor, _backgroundColor);
+ debug("\tActionText: _name = %s, _text = %s, "
+ "_bound0 = %u, _bound1 = %u, _bound2 = %u, _bound3 = %u _centered = %u, _scrollBar = %u, _textColor = %u _backgroundColor = %u",
+ _name.c_str(), _text.c_str(), _bounds[0], _bounds[1], _bounds[2], _bounds[3], _centered, _scrollBar, _textColor, _backgroundColor);
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_text.h b/engines/pink/objects/actions/action_text.h
index 2215949..c881610 100644
--- a/engines/pink/objects/actions/action_text.h
+++ b/engines/pink/objects/actions/action_text.h
@@ -29,17 +29,17 @@ namespace Pink {
class ActionText : public Action {
public:
- void deserialize(Archive &archive) override;
+ void deserialize(Archive &archive) override;
- void toConsole() override;
+ void toConsole() override;
private:
- Common::String _text;
- uint32 _bounds[4];
- uint32 _centered;
- uint32 _scrollBar;
- uint32 _textColor;
- uint32 _backgroundColor;
+ Common::String _text;
+ uint32 _bounds[4];
+ uint32 _centered;
+ uint32 _scrollBar;
+ uint32 _textColor;
+ uint32 _backgroundColor;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/walk_action.cpp b/engines/pink/objects/actions/walk_action.cpp
index d05e94e..e4e3518 100644
--- a/engines/pink/objects/actions/walk_action.cpp
+++ b/engines/pink/objects/actions/walk_action.cpp
@@ -27,18 +27,18 @@
namespace Pink {
void WalkAction::deserialize(Archive &archive) {
- ActionCEL::deserialize(archive);
- uint32 calcFramePositions = archive.readDWORD();
- _toCalcFramePositions = calcFramePositions;
+ ActionCEL::deserialize(archive);
+ uint32 calcFramePositions = archive.readDWORD();
+ _toCalcFramePositions = calcFramePositions;
}
void WalkAction::toConsole() {
- debug("\tWalkAction: _name = %s, _fileName = %s, _calcFramePositions = %u",
- _name.c_str(), _fileName.c_str(), _toCalcFramePositions);
+ debug("\tWalkAction: _name = %s, _fileName = %s, _calcFramePositions = %u",
+ _name.c_str(), _fileName.c_str(), _toCalcFramePositions);
}
void WalkAction::onStart() {
- _decoder->start();
+ _decoder->start();
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/walk_action.h b/engines/pink/objects/actions/walk_action.h
index 21926ab..d53c8c2 100644
--- a/engines/pink/objects/actions/walk_action.h
+++ b/engines/pink/objects/actions/walk_action.h
@@ -29,15 +29,15 @@ namespace Pink {
class WalkAction : public ActionCEL {
public:
- virtual void deserialize(Archive &archive);
+ virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ virtual void toConsole();
protected:
- void onStart() override;
+ void onStart() override;
private:
- bool _toCalcFramePositions;
+ bool _toCalcFramePositions;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index 4853f8d..e6545f3 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -30,20 +30,20 @@
namespace Pink {
void Actor::deserialize(Archive &archive) {
- NamedObject::deserialize(archive);
- _page = static_cast<GamePage*>(archive.readObject());
- _actions.deserialize(archive);
+ NamedObject::deserialize(archive);
+ _page = static_cast<GamePage*>(archive.readObject());
+ _actions.deserialize(archive);
}
void Actor::toConsole() {
- debug("Actor: _name = %s", _name.c_str());
- for (uint i = 0; i < _actions.size(); ++i) {
- _actions[i]->toConsole();
- }
+ debug("Actor: _name = %s", _name.c_str());
+ for (uint i = 0; i < _actions.size(); ++i) {
+ _actions[i]->toConsole();
+ }
}
Sequencer *Actor::getSequencer() const {
- return _page->getSequencer();
+ return _page->getSequencer();
}
Action *Actor::findAction(const Common::String &name) {
@@ -56,112 +56,112 @@ Action *Actor::findAction(const Common::String &name) {
}
GamePage *Actor::getPage() const {
- return _page;
+ return _page;
}
void Actor::init(bool unk) {
- if (!_action) {
- _action = findAction(kIdleAction);
- }
+ if (!_action) {
+ _action = findAction(kIdleAction);
+ }
- if (!_action) {
- _isActionEnded = 1;
- }
- else {
- _isActionEnded = 0;
- _action->start(unk);
- }
+ if (!_action) {
+ _isActionEnded = 1;
+ }
+ else {
+ _isActionEnded = 0;
+ _action->start(unk);
+ }
}
void Actor::hide() {
- setAction(kHideAction);
+ setAction(kHideAction);
}
void Actor::endAction() {
- _isActionEnded = 1;
+ _isActionEnded = 1;
}
void Actor::setAction(const Common::String &name) {
- Action *newAction = findAction(name);
- setAction(newAction);
+ Action *newAction = findAction(name);
+ setAction(newAction);
}
void Actor::setAction(Action *newAction) {
- if (_action) {
- _isActionEnded = 1;
- _action->end();
- }
- _action = newAction;
- if (newAction) {
- _isActionEnded = 0;
- _action->start(0);
- }
+ if (_action) {
+ _isActionEnded = 1;
+ _action->end();
+ }
+ _action = newAction;
+ if (newAction) {
+ _isActionEnded = 0;
+ _action->start(0);
+ }
}
void Actor::setAction(Action *newAction, bool unk) {
- if (unk) {
- assert(0); // want to see this
- _isActionEnded = 1;
- _action = newAction;
- }
- else {
+ if (unk) {
+ assert(0); // want to see this
+ _isActionEnded = 1;
+ _action = newAction;
+ }
+ else {
setAction(newAction);
}
}
Action *Actor::getAction() const {
- return _action;
+ return _action;
}
bool Actor::isPlaying() {
- return !_isActionEnded;
+ return !_isActionEnded;
}
bool Actor::initPallete(Director *director) {
- for (uint i = 0; i < _actions.size(); ++i) {
- if (_actions[i]->initPalette(director))
- return true;
- }
- return false;
+ for (uint i = 0; i < _actions.size(); ++i) {
+ if (_actions[i]->initPalette(director))
+ return true;
+ }
+ return false;
}
void Actor::onMouseOver(Common::Point point, CursorMgr *mgr) {
- mgr->setCursor(kDefaultCursor, point, Common::String());
+ mgr->setCursor(kDefaultCursor, point, Common::String());
}
Actor::~Actor() {
- for (uint i = 0; i < _actions.size(); ++i) {
- delete _actions[i];
- }
+ for (uint i = 0; i < _actions.size(); ++i) {
+ delete _actions[i];
+ }
}
void Actor::loadState(Archive &archive) {
- Common::String actionName;
- actionName = archive.readString();
- _action = findAction(actionName);
+ Common::String actionName;
+ actionName = archive.readString();
+ _action = findAction(actionName);
}
void Actor::saveState(Archive &archive) {
- Common::String actionName;
+ Common::String actionName;
- if (_action)
- actionName = _action->getName();
+ if (_action)
+ actionName = _action->getName();
- archive.writeString(actionName);
+ archive.writeString(actionName);
}
void Actor::pause() {
- if (_action)
- _action->pause();
+ if (_action)
+ _action->pause();
}
void Actor::unpause() {
- if (_action)
- _action->unpause();
+ if (_action)
+ _action->unpause();
}
void Actor::onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) {
- cursorMgr->setCursor(kHoldingItemCursor, point, itemName);
+ cursorMgr->setCursor(kHoldingItemCursor, point, itemName);
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/actor.h b/engines/pink/objects/actors/actor.h
index b7650a2..cfbc358 100644
--- a/engines/pink/objects/actors/actor.h
+++ b/engines/pink/objects/actors/actor.h
@@ -39,49 +39,49 @@ class InventoryMgr;
class Actor : public NamedObject {
public:
- Actor()
- : _page(nullptr), _action(nullptr),
- _isActionEnded(1)
- {};
- ~Actor();
- virtual void deserialize(Archive &archive);
+ Actor()
+ : _page(nullptr), _action(nullptr),
+ _isActionEnded(1)
+ {};
+ ~Actor();
+ virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ virtual void toConsole();
- Sequencer *getSequencer() const;
- GamePage *getPage() const;
- Action *getAction() const;
+ Sequencer *getSequencer() const;
+ GamePage *getPage() const;
+ Action *getAction() const;
- bool isPlaying();
- virtual void init(bool unk);
- void hide();
- void endAction();
+ bool isPlaying();
+ virtual void init(bool unk);
+ void hide();
+ void endAction();
- Action *findAction(const Common::String &name);
- void setAction(const Common::String &name);
- void setAction(Action *newAction);
- void setAction(Action *newAction, bool unk);
+ Action *findAction(const Common::String &name);
+ void setAction(const Common::String &name);
+ void setAction(Action *newAction);
+ void setAction(Action *newAction, bool unk);
- void loadState(Archive &archive);
- void saveState(Archive &archive);
+ void loadState(Archive &archive);
+ void saveState(Archive &archive);
- bool initPallete(Director *director);
+ bool initPallete(Director *director);
- virtual void update() {};
+ virtual void update() {};
- virtual void onMouseOver(Common::Point point, CursorMgr *mgr);
- virtual void onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr);
+ virtual void onMouseOver(Common::Point point, CursorMgr *mgr);
+ virtual void onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr);
- virtual bool isClickable() { return 0;}
+ virtual bool isClickable() { return 0;}
- virtual void pause();
- virtual void unpause();
+ virtual void pause();
+ virtual void unpause();
protected:
- GamePage *_page;
- Action *_action;
- Array<Action*> _actions;
- bool _isActionEnded;
+ GamePage *_page;
+ Action *_action;
+ Array<Action*> _actions;
+ bool _isActionEnded;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/audio_info_pda_button.h b/engines/pink/objects/actors/audio_info_pda_button.h
index 63badfd..05c8408 100644
--- a/engines/pink/objects/actors/audio_info_pda_button.h
+++ b/engines/pink/objects/actors/audio_info_pda_button.h
@@ -34,20 +34,20 @@ namespace Pink {
class AudioInfoPDAButton : public Actor {
public:
- void toConsole() {
- debug("CursorActor: _name = %s", _name.c_str());
- for (uint i = 0; i < _actions.size(); ++i) {
- _actions[i]->toConsole();
- }
- }
-
- void onMouseOver(Common::Point point, CursorMgr *mgr) override {
- mgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
- }
-
- void onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) override {
- onMouseOver(point, cursorMgr);
- }
+ void toConsole() {
+ debug("CursorActor: _name = %s", _name.c_str());
+ for (uint i = 0; i < _actions.size(); ++i) {
+ _actions[i]->toConsole();
+ }
+ }
+
+ void onMouseOver(Common::Point point, CursorMgr *mgr) override {
+ mgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
+ }
+
+ void onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) override {
+ onMouseOver(point, cursorMgr);
+ }
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/cursor_actor.h b/engines/pink/objects/actors/cursor_actor.h
index 7c83a6b..897728c 100644
--- a/engines/pink/objects/actors/cursor_actor.h
+++ b/engines/pink/objects/actors/cursor_actor.h
@@ -33,12 +33,12 @@ namespace Pink {
//same as actor
class CursorActor : public Actor {
public:
- void toConsole() {
- debug("CursorActor: _name = %s", _name.c_str());
- for (uint i = 0; i < _actions.size(); ++i) {
- _actions[i]->toConsole();
- }
- }
+ void toConsole() {
+ debug("CursorActor: _name = %s", _name.c_str());
+ for (uint i = 0; i < _actions.size(); ++i) {
+ _actions[i]->toConsole();
+ }
+ }
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/inventory_actor.h b/engines/pink/objects/actors/inventory_actor.h
index 61ebbc4..4e6edef 100644
--- a/engines/pink/objects/actors/inventory_actor.h
+++ b/engines/pink/objects/actors/inventory_actor.h
@@ -32,14 +32,14 @@ namespace Pink {
class InventoryActor : public Actor {
public:
- void toConsole() {
- debug("CursorActor: _name = %s", _name.c_str());
- for (uint i = 0; i < _actions.size(); ++i) {
- _actions[i]->toConsole();
- }
- }
-
- void pause() {}
+ void toConsole() {
+ debug("CursorActor: _name = %s", _name.c_str());
+ for (uint i = 0; i < _actions.size(); ++i) {
+ _actions[i]->toConsole();
+ }
+ }
+
+ void pause() {}
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 05d9a76..f414cd6 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -34,382 +34,382 @@
namespace Pink {
void LeadActor::deserialize(Archive &archive) {
- _state = kReady;
- Actor::deserialize(archive);
- _cursorMgr = static_cast<CursorMgr*>(archive.readObject());
- _walkMgr = static_cast<WalkMgr*>(archive.readObject());
- _sequencer = static_cast<Sequencer*>(archive.readObject());
+ _state = kReady;
+ Actor::deserialize(archive);
+ _cursorMgr = static_cast<CursorMgr*>(archive.readObject());
+ _walkMgr = static_cast<WalkMgr*>(archive.readObject());
+ _sequencer = static_cast<Sequencer*>(archive.readObject());
}
void LeadActor::setNextExecutors(Common::String &nextModule, Common::String &nextPage) {
- if (_state == kReady || _state == kMoving || _state == kInDialog1 || _state == kInventory || _state == kPDA) {
- _state = kPlayingVideo;
- _page->getGame()->setNextExecutors(nextModule, nextPage);
- }
+ if (_state == kReady || _state == kMoving || _state == kInDialog1 || _state == kInventory || _state == kPDA) {
+ _state = kPlayingVideo;
+ _page->getGame()->setNextExecutors(nextModule, nextPage);
+ }
}
void LeadActor::init(bool unk) {
- if (_state == kUnk_Loading){
- _state = kReady;
- }
- _page->getModule()->getInventoryMgr()->setLeadActor(this);
- _page->getGame()->setLeadActor(this);
- Actor::init(unk);
+ if (_state == kUnk_Loading){
+ _state = kReady;
+ }
+ _page->getModule()->getInventoryMgr()->setLeadActor(this);
+ _page->getGame()->setLeadActor(this);
+ Actor::init(unk);
}
void LeadActor::toConsole() {
- debug("LeadActor: _name = %s", _name.c_str());
- for (uint i = 0; i < _actions.size(); ++i) {
- _actions[i]->toConsole();
- }
+ debug("LeadActor: _name = %s", _name.c_str());
+ for (uint i = 0; i < _actions.size(); ++i) {
+ _actions[i]->toConsole();
+ }
}
LeadActor::State LeadActor::getState() const {
- return _state;
+ return _state;
}
void LeadActor::update() {
- switch (_state) {
- case kReady:
- _sequencer->update();
- _cursorMgr->update();
- break;
- case kMoving:
- _walkMgr->update();
- _cursorMgr->update();
- break;
- case kInDialog1:
- case kInDialog2:
- _sequencer->update();
- if (!_sequencer->_context){
- _state = _nextState;
- _nextState = kUnk_Loading;
- }
- break;
-
- case kInventory:
- getPage()->getModule()->getInventoryMgr()->update();
- break;
- case kPDA:
- break;
-
- case kPlayingVideo:
- _sequencer->update();
- if (!_sequencer->_context){
- _state = kUnk_Loading;
- _page->getGame()->changeScene(_page);
- }
- break;
- case kUnk_Loading:
- break;
- }
+ switch (_state) {
+ case kReady:
+ _sequencer->update();
+ _cursorMgr->update();
+ break;
+ case kMoving:
+ _walkMgr->update();
+ _cursorMgr->update();
+ break;
+ case kInDialog1:
+ case kInDialog2:
+ _sequencer->update();
+ if (!_sequencer->_context){
+ _state = _nextState;
+ _nextState = kUnk_Loading;
+ }
+ break;
+
+ case kInventory:
+ getPage()->getModule()->getInventoryMgr()->update();
+ break;
+ case kPDA:
+ break;
+
+ case kPlayingVideo:
+ _sequencer->update();
+ if (!_sequencer->_context){
+ _state = kUnk_Loading;
+ _page->getGame()->changeScene(_page);
+ }
+ break;
+ case kUnk_Loading:
+ break;
+ }
}
void LeadActor::onKeyboardButtonClick(Common::KeyCode code) {
- switch(_state) {
- case kMoving:
- switch (code){
- case Common::KEYCODE_ESCAPE:
- // set unk variables
- // Fall Through intended
- case Common::KEYCODE_SPACE:
- //skip walking animation
- default:
- break;
- }
- break;
- case kInDialog1:
- case kInDialog2:
- case kPlayingVideo:
- switch (code) {
- case Common::KEYCODE_SPACE:
- case Common::KEYCODE_RIGHT:
- _sequencer->skipSubSequence();
- break;
- case Common::KEYCODE_ESCAPE:
- _sequencer->skipToLastSubSequence();
- break;
- case Common::KEYCODE_LEFT:
- _sequencer->restartSequence();
- break;
- default:
- break;
- }
- break;
- default:
- break;
- }
+ switch(_state) {
+ case kMoving:
+ switch (code){
+ case Common::KEYCODE_ESCAPE:
+ // set unk variables
+ // Fall Through intended
+ case Common::KEYCODE_SPACE:
+ //skip walking animation
+ default:
+ break;
+ }
+ break;
+ case kInDialog1:
+ case kInDialog2:
+ case kPlayingVideo:
+ switch (code) {
+ case Common::KEYCODE_SPACE:
+ case Common::KEYCODE_RIGHT:
+ _sequencer->skipSubSequence();
+ break;
+ case Common::KEYCODE_ESCAPE:
+ _sequencer->skipToLastSubSequence();
+ break;
+ case Common::KEYCODE_LEFT:
+ _sequencer->restartSequence();
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
}
void LeadActor::start(bool isHandler) {
- if (isHandler && _state != kPlayingVideo){
- _state = kInDialog1;
- _nextState = kReady;
- }
- forceUpdateCursor();
+ if (isHandler && _state != kPlayingVideo){
+ _state = kInDialog1;
+ _nextState = kReady;
+ }
+ forceUpdateCursor();
}
void LeadActor::onMouseMove(Common::Point point) {
- if (_state != kPDA)
- updateCursor(point);
- else error("pda is not supported");
+ if (_state != kPDA)
+ updateCursor(point);
+ else error("pda is not supported");
}
void LeadActor::updateCursor(Common::Point point) {
- switch (_state) {
- case kReady:
- case kMoving: {
- Director *director = _page->getGame()->getDirector();
- Actor *actor = director->getActorByPoint(point);
- InventoryItem *item = _page->getModule()->getInventoryMgr()->getCurrentItem();
- if (_isHaveItem) {
- if (actor) {
- actor->onHover(point, item->getName(), _cursorMgr);
- }
- else _cursorMgr->setCursor(kHoldingItemCursor, point, item->getName());
- }
- else if (actor)
- actor->onMouseOver(point, _cursorMgr);
- else _cursorMgr->setCursor(kDefaultCursor, point, Common::String());
- break;
- }
- case kInDialog1:
- case kInDialog2:
- case kPlayingVideo:
- _cursorMgr->setCursor(kNotClickableCursor, point, Common::String());
- break;
- case kPDA:
- case kInventory:
- _cursorMgr->setCursor(kDefaultCursor, point, Common::String());
- break;
- default:
- break;
- }
+ switch (_state) {
+ case kReady:
+ case kMoving: {
+ Director *director = _page->getGame()->getDirector();
+ Actor *actor = director->getActorByPoint(point);
+ InventoryItem *item = _page->getModule()->getInventoryMgr()->getCurrentItem();
+ if (_isHaveItem) {
+ if (actor) {
+ actor->onHover(point, item->getName(), _cursorMgr);
+ }
+ else _cursorMgr->setCursor(kHoldingItemCursor, point, item->getName());
+ }
+ else if (actor)
+ actor->onMouseOver(point, _cursorMgr);
+ else _cursorMgr->setCursor(kDefaultCursor, point, Common::String());
+ break;
+ }
+ case kInDialog1:
+ case kInDialog2:
+ case kPlayingVideo:
+ _cursorMgr->setCursor(kNotClickableCursor, point, Common::String());
+ break;
+ case kPDA:
+ case kInventory:
+ _cursorMgr->setCursor(kDefaultCursor, point, Common::String());
+ break;
+ default:
+ break;
+ }
}
void LeadActor::onLeftButtonClick(Common::Point point) {
- InventoryMgr *invMgr = _page->getModule()->getInventoryMgr();
-
- switch (_state) {
- case kReady:
- case kMoving: {
- Actor *actor = _page->getGame()->getDirector()->getActorByPoint(point);
-
- if (this == actor) {
- onClick();
- return;
- }
-
- _recipient = dynamic_cast<SupportingActor*>(actor);
- if (actor->isClickable() && isInteractingWith(_recipient)) {
- WalkLocation *location = getWalkDestination();
- if (location) {
- _state = kMoving;
- _nextState = kInDialog1;
- _walkMgr->start(location);
- }
- else if (_state == kReady){
- if (_isHaveItem)
- sendUseClickMessage(_recipient);
- else sendLeftClickMessage(_recipient);
- }
- }
-
- break;
- }
- case kPDA:
-
- break;
- case kInventory:
- invMgr->onClick(point);
- break;
- default:
- break;
- }
+ InventoryMgr *invMgr = _page->getModule()->getInventoryMgr();
+
+ switch (_state) {
+ case kReady:
+ case kMoving: {
+ Actor *actor = _page->getGame()->getDirector()->getActorByPoint(point);
+
+ if (this == actor) {
+ onClick();
+ return;
+ }
+
+ _recipient = dynamic_cast<SupportingActor*>(actor);
+ if (actor->isClickable() && isInteractingWith(_recipient)) {
+ WalkLocation *location = getWalkDestination();
+ if (location) {
+ _state = kMoving;
+ _nextState = kInDialog1;
+ _walkMgr->start(location);
+ }
+ else if (_state == kReady){
+ if (_isHaveItem)
+ sendUseClickMessage(_recipient);
+ else sendLeftClickMessage(_recipient);
+ }
+ }
+
+ break;
+ }
+ case kPDA:
+
+ break;
+ case kInventory:
+ invMgr->onClick(point);
+ break;
+ default:
+ break;
+ }
}
void LeadActor::onMouseOver(Common::Point point, CursorMgr *mgr) {
- if (_page->getModule()->getInventoryMgr()->isPinkOwnsAnyItems())
- _cursorMgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
- else Actor::onMouseOver(point, mgr);
+ if (_page->getModule()->getInventoryMgr()->isPinkOwnsAnyItems())
+ _cursorMgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
+ else Actor::onMouseOver(point, mgr);
}
void LeadActor::onWalkEnd() {
- State oldNextState = _nextState;
- _state = kReady;
- _nextState = kUnk_Loading;
- if (_recipient && oldNextState == kInDialog1){
- if (_isHaveItem)
- sendUseClickMessage(_recipient);
- else sendLeftClickMessage(_recipient);
- }
+ State oldNextState = _nextState;
+ _state = kReady;
+ _nextState = kUnk_Loading;
+ if (_recipient && oldNextState == kInDialog1){
+ if (_isHaveItem)
+ sendUseClickMessage(_recipient);
+ else sendLeftClickMessage(_recipient);
+ }
}
bool LeadActor::sendUseClickMessage(SupportingActor *actor) {
- InventoryMgr *mgr = _page->getModule()->getInventoryMgr();
- _nextState = _state != kPlayingVideo ? kReady : kPlayingVideo;
- _state = kInDialog1;
- InventoryItem *item = mgr->getCurrentItem();
- actor->onUseClickMessage(mgr->getCurrentItem(), mgr);
- if (item->getCurrentOwner() != this->_name)
- _isHaveItem = false;
- return true;
+ InventoryMgr *mgr = _page->getModule()->getInventoryMgr();
+ _nextState = _state != kPlayingVideo ? kReady : kPlayingVideo;
+ _state = kInDialog1;
+ InventoryItem *item = mgr->getCurrentItem();
+ actor->onUseClickMessage(mgr->getCurrentItem(), mgr);
+ if (item->getCurrentOwner() != this->_name)
+ _isHaveItem = false;
+ return true;
}
bool LeadActor::sendLeftClickMessage(SupportingActor *actor) {
- _nextState = _state != kPlayingVideo ? kReady : kPlayingVideo;
- _state = kInDialog1;
- return actor->onLeftClickMessage();
+ _nextState = _state != kPlayingVideo ? kReady : kPlayingVideo;
+ _state = kInDialog1;
+ return actor->onLeftClickMessage();
}
void LeadActor::onClick() {
- if (_isHaveItem) {
- _isHaveItem = false;
- _nextState = (_state != kMoving) ?
- kUnk_Loading : kReady;
- }
- else {
- if (_state == kMoving) {
- _recipient = nullptr;
- _nextState = kReady;
- }
- if (_page->getModule()->getInventoryMgr()->start(1)){
- _stateCopy = _state;
- _state = kInventory;
- _page->pause();
- }
- }
+ if (_isHaveItem) {
+ _isHaveItem = false;
+ _nextState = (_state != kMoving) ?
+ kUnk_Loading : kReady;
+ }
+ else {
+ if (_state == kMoving) {
+ _recipient = nullptr;
+ _nextState = kReady;
+ }
+ if (_page->getModule()->getInventoryMgr()->start(1)){
+ _stateCopy = _state;
+ _state = kInventory;
+ _page->pause();
+ }
+ }
}
LeadActor::LeadActor()
- : _state(kReady), _nextState(kReady),
- _isHaveItem(false), _recipient(nullptr),
- _cursorMgr(nullptr), _walkMgr(nullptr),
- _sequencer(nullptr)
+ : _state(kReady), _nextState(kReady),
+ _isHaveItem(false), _recipient(nullptr),
+ _cursorMgr(nullptr), _walkMgr(nullptr),
+ _sequencer(nullptr)
{}
void LeadActor::onInventoryClosed(bool isItemClicked) {
- _isHaveItem = isItemClicked;
- _state = _stateCopy;
- _stateCopy = kUnk_Loading;
- _page->unpause();
- forceUpdateCursor();
+ _isHaveItem = isItemClicked;
+ _state = _stateCopy;
+ _stateCopy = kUnk_Loading;
+ _page->unpause();
+ forceUpdateCursor();
}
void LeadActor::forceUpdateCursor() {
- Common::Point point = _page->getGame()->getEventManager()->getMousePos();
- updateCursor(point);
+ Common::Point point = _page->getGame()->getEventManager()->getMousePos();
+ updateCursor(point);
}
WalkLocation *LeadActor::getWalkDestination() {
- return _walkMgr->findLocation(_recipient->getLocation());
+ return _walkMgr->findLocation(_recipient->getLocation());
}
bool LeadActor::isInteractingWith(SupportingActor *actor) {
- if (!_isHaveItem)
- return actor->isLeftClickHandlers();
+ if (!_isHaveItem)
+ return actor->isLeftClickHandlers();
- return actor->isUseClickHandlers(_page->getModule()->getInventoryMgr()->getCurrentItem());
+ return actor->isUseClickHandlers(_page->getModule()->getInventoryMgr()->getCurrentItem());
}
void ParlSqPink::toConsole() {
- debug("ParlSqPink: _name = %s", _name.c_str());
- for (uint i = 0; i < _actions.size(); ++i) {
- _actions[i]->toConsole();
- }
+ debug("ParlSqPink: _name = %s", _name.c_str());
+ for (uint i = 0; i < _actions.size(); ++i) {
+ _actions[i]->toConsole();
+ }
}
WalkLocation *ParlSqPink::getWalkDestination() {
- if (_recipient->getName() == kBoy &&
- _page->checkValueOfVariable(kBoyBlocked, kUndefined))
- {
- return _walkMgr->findLocation(kSirBaldley);
- }
- return LeadActor::getWalkDestination();
+ if (_recipient->getName() == kBoy &&
+ _page->checkValueOfVariable(kBoyBlocked, kUndefined))
+ {
+ return _walkMgr->findLocation(kSirBaldley);
+ }
+ return LeadActor::getWalkDestination();
}
PubPink::PubPink() :
- LeadActor(), _round(0)
+ LeadActor(), _round(0)
{}
void PubPink::toConsole() {
- debug("PubPink: _name = %s", _name.c_str());
- for (uint i = 0; i < _actions.size(); ++i) {
- _actions[i]->toConsole();
- }
+ debug("PubPink: _name = %s", _name.c_str());
+ for (uint i = 0; i < _actions.size(); ++i) {
+ _actions[i]->toConsole();
+ }
}
bool PubPink::playingMiniGame() {
- return !(_page->checkValueOfVariable(kFoodPuzzle, "TRUE") ||
- _page->checkValueOfVariable(kFoodPuzzle, kUndefined));
+ return !(_page->checkValueOfVariable(kFoodPuzzle, "TRUE") ||
+ _page->checkValueOfVariable(kFoodPuzzle, kUndefined));
}
void PubPink::onClick() {
- if (!playingMiniGame())
- LeadActor::onClick();
+ if (!playingMiniGame())
+ LeadActor::onClick();
}
void PubPink::updateCursor(Common::Point point) {
- if (playingMiniGame()) {
- SupportingActor *actor = dynamic_cast<SupportingActor*>(_page->getGame()->getDirector()->getActorByPoint(point));
- if (_state == kReady &&
- actor &&
- actor->isUseClickHandlers(_page->getModule()->getInventoryMgr()->getCurrentItem()))
- {
- _cursorMgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
- }
- else _cursorMgr->setCursor(kDefaultCursor, point, Common::String());
- }
- else LeadActor::updateCursor(point);
+ if (playingMiniGame()) {
+ SupportingActor *actor = dynamic_cast<SupportingActor*>(_page->getGame()->getDirector()->getActorByPoint(point));
+ if (_state == kReady &&
+ actor &&
+ actor->isUseClickHandlers(_page->getModule()->getInventoryMgr()->getCurrentItem()))
+ {
+ _cursorMgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
+ }
+ else _cursorMgr->setCursor(kDefaultCursor, point, Common::String());
+ }
+ else LeadActor::updateCursor(point);
}
WalkLocation *PubPink::getWalkDestination() {
- if (playingMiniGame())
- return nullptr;
+ if (playingMiniGame())
+ return nullptr;
- if (_recipient->getName() == kJackson &&
- !_page->checkValueOfVariable(kDrunkLocation, kBolted))
- {
- return _walkMgr->findLocation(_page->findActor(kDrunk)->getName());
- }
+ if (_recipient->getName() == kJackson &&
+ !_page->checkValueOfVariable(kDrunkLocation, kBolted))
+ {
+ return _walkMgr->findLocation(_page->findActor(kDrunk)->getName());
+ }
- return LeadActor::getWalkDestination();
+ return LeadActor::getWalkDestination();
}
bool PubPink::sendUseClickMessage(SupportingActor *actor) {
if (!LeadActor::sendUseClickMessage(actor) &&
- playingMiniGame()) {
- _nextState = _state;
- _state = kInDialog1;
-
- const char *roundName;
- switch (_round++ % 3) {
- case 0:
- roundName = kFirstRound;
- break;
- case 1:
- roundName = kSecondRound;
- break;
- case 2:
- roundName = kThirdRound;
- break;
- default:
- roundName = nullptr;
- assert(0);
- break;
- }
- _sequencer->authorSequence(_sequencer->findSequence(roundName), 0);
+ playingMiniGame()) {
+ _nextState = _state;
+ _state = kInDialog1;
+
+ const char *roundName;
+ switch (_round++ % 3) {
+ case 0:
+ roundName = kFirstRound;
+ break;
+ case 1:
+ roundName = kSecondRound;
+ break;
+ case 2:
+ roundName = kThirdRound;
+ break;
+ default:
+ roundName = nullptr;
+ assert(0);
+ break;
+ }
+ _sequencer->authorSequence(_sequencer->findSequence(roundName), 0);
}
if (playingMiniGame())
- _isHaveItem = true;
+ _isHaveItem = true;
return true;
}
void PubPink::onVariableSet() {
- if (playingMiniGame())
- _isHaveItem = true;
+ if (playingMiniGame())
+ _isHaveItem = true;
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index b6f91ac..7dff2e8 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -40,89 +40,89 @@ class InventoryItem;
class LeadActor : public Actor {
public:
- LeadActor();
- enum State {
- kReady = 0,
- kMoving = 1,
- kInDialog1 = 2, //???
- kInventory = 3,
- kPDA = 4,
- kInDialog2 = 5,//???
- kPlayingVideo = 6, // ???
- kUnk_Loading = 7// ????
- };
+ LeadActor();
+ enum State {
+ kReady = 0,
+ kMoving = 1,
+ kInDialog1 = 2, //???
+ kInventory = 3,
+ kPDA = 4,
+ kInDialog2 = 5,//???
+ kPlayingVideo = 6, // ???
+ kUnk_Loading = 7// ????
+ };
- virtual void deserialize(Archive &archive);
+ virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ virtual void toConsole();
- void setNextExecutors (Common::String &nextModule, Common::String &nextPage);
- virtual void init(bool unk);
+ void setNextExecutors (Common::String &nextModule, Common::String &nextPage);
+ virtual void init(bool unk);
- State getState() const;
+ State getState() const;
- void start(bool isHandler);
- void update();
+ void start(bool isHandler);
+ void update();
- void onKeyboardButtonClick(Common::KeyCode code);
- void onLeftButtonClick(Common::Point point);
- void onMouseMove(Common::Point point);
- void onWalkEnd();
- virtual void onClick();
- void onInventoryClosed(bool isItemClicked);
- virtual void onVariableSet() {};
+ void onKeyboardButtonClick(Common::KeyCode code);
+ void onLeftButtonClick(Common::Point point);
+ void onMouseMove(Common::Point point);
+ void onWalkEnd();
+ virtual void onClick();
+ void onInventoryClosed(bool isItemClicked);
+ virtual void onVariableSet() {};
- virtual void onMouseOver(Common::Point point, CursorMgr *mgr);
+ virtual void onMouseOver(Common::Point point, CursorMgr *mgr);
- bool isInteractingWith(SupportingActor *actor);
+ bool isInteractingWith(SupportingActor *actor);
protected:
- virtual void updateCursor(Common::Point point);
- void forceUpdateCursor();
+ virtual void updateCursor(Common::Point point);
+ void forceUpdateCursor();
- virtual bool sendUseClickMessage(SupportingActor *actor);
- bool sendLeftClickMessage(SupportingActor *actor);
+ virtual bool sendUseClickMessage(SupportingActor *actor);
+ bool sendLeftClickMessage(SupportingActor *actor);
- virtual WalkLocation *getWalkDestination();
+ virtual WalkLocation *getWalkDestination();
- State _state;
- State _nextState;
- State _stateCopy;
+ State _state;
+ State _nextState;
+ State _stateCopy;
- bool _isHaveItem;
+ bool _isHaveItem;
- SupportingActor *_recipient;
+ SupportingActor *_recipient;
- CursorMgr *_cursorMgr;
- WalkMgr *_walkMgr;
- Sequencer *_sequencer;
+ CursorMgr *_cursorMgr;
+ WalkMgr *_walkMgr;
+ Sequencer *_sequencer;
};
class ParlSqPink : public LeadActor {
public:
- virtual WalkLocation *getWalkDestination();
- void toConsole();
+ virtual WalkLocation *getWalkDestination();
+ void toConsole();
};
class PubPink : public LeadActor {
public:
- PubPink();
+ PubPink();
- void toConsole();
+ void toConsole();
- virtual void onClick();
- virtual void onVariableSet();
+ virtual void onClick();
+ virtual void onVariableSet();
private:
- int _round;
+ int _round;
- virtual bool sendUseClickMessage(SupportingActor *actor);
- virtual void updateCursor(Common::Point point);
- virtual WalkLocation *getWalkDestination();
+ virtual bool sendUseClickMessage(SupportingActor *actor);
+ virtual void updateCursor(Common::Point point);
+ virtual WalkLocation *getWalkDestination();
- bool playingMiniGame();
+ bool playingMiniGame();
};
diff --git a/engines/pink/objects/actors/pda_button_actor.cpp b/engines/pink/objects/actors/pda_button_actor.cpp
index 1057a06..65e3f7b 100644
--- a/engines/pink/objects/actors/pda_button_actor.cpp
+++ b/engines/pink/objects/actors/pda_button_actor.cpp
@@ -25,18 +25,18 @@
namespace Pink {
void PDAButtonActor::deserialize(Archive &archive) {
- Actor::deserialize(archive);
- _hideOnStop = (bool) archive.readDWORD();
- _opaque = (bool) archive.readDWORD();
+ Actor::deserialize(archive);
+ _hideOnStop = (bool) archive.readDWORD();
+ _opaque = (bool) archive.readDWORD();
- int comm = archive.readDWORD();
- assert(comm <= 4);
- _command = (Command) comm;
+ int comm = archive.readDWORD();
+ assert(comm <= 4);
+ _command = (Command) comm;
}
void PDAButtonActor::toConsole() {
- debug("PDAButtonActor: _name = %s, _x = %u _y = %u _hideOnStop = %u, _opaque = %u, _command = %u",
- _name.c_str(), _x, _y, _hideOnStop, _opaque, (int) _command);
+ debug("PDAButtonActor: _name = %s, _x = %u _y = %u _hideOnStop = %u, _opaque = %u, _command = %u",
+ _name.c_str(), _x, _y, _hideOnStop, _opaque, (int) _command);
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/pda_button_actor.h b/engines/pink/objects/actors/pda_button_actor.h
index c3cd845..5e7d53b 100644
--- a/engines/pink/objects/actors/pda_button_actor.h
+++ b/engines/pink/objects/actors/pda_button_actor.h
@@ -29,19 +29,19 @@ namespace Pink {
class PDAButtonActor : public Actor {
public:
- enum Command {Null = 0, GoToPage = 1, Close = 2, Unk = 4};
+ enum Command {Null = 0, GoToPage = 1, Close = 2, Unk = 4};
- void deserialize(Archive &archive) override;
- void toConsole() override;
+ void deserialize(Archive &archive) override;
+ void toConsole() override;
private:
- int _x;
- int _y;
+ int _x;
+ int _y;
- bool _hideOnStop;
- bool _opaque;
+ bool _hideOnStop;
+ bool _opaque;
- Command _command;
+ Command _command;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/supporting_actor.cpp b/engines/pink/objects/actors/supporting_actor.cpp
index 9c06dee..3ba1036 100644
--- a/engines/pink/objects/actors/supporting_actor.cpp
+++ b/engines/pink/objects/actors/supporting_actor.cpp
@@ -30,64 +30,64 @@
namespace Pink {
void SupportingActor::deserialize(Archive &archive) {
- Actor::deserialize(archive);
- _location = archive.readString();
- _pdaLink = archive.readString();
- _cursor = archive.readString();
- _handlerMgr.deserialize(archive);
+ Actor::deserialize(archive);
+ _location = archive.readString();
+ _pdaLink = archive.readString();
+ _cursor = archive.readString();
+ _handlerMgr.deserialize(archive);
}
void SupportingActor::toConsole() {
- debug("SupportingActor: _name = %s, _location=%s, _pdaLink=%s, _cursor=%s",
- _name.c_str(), _location.c_str(), _pdaLink.c_str(), _cursor.c_str());
- for (uint i = 0; i < _actions.size(); ++i) {
- _actions[i]->toConsole();
- }
- _handlerMgr.toConsole();
+ debug("SupportingActor: _name = %s, _location=%s, _pdaLink=%s, _cursor=%s",
+ _name.c_str(), _location.c_str(), _pdaLink.c_str(), _cursor.c_str());
+ for (uint i = 0; i < _actions.size(); ++i) {
+ _actions[i]->toConsole();
+ }
+ _handlerMgr.toConsole();
}
void SupportingActor::onMouseOver(Common::Point point, CursorMgr *mgr) {
- if (isLeftClickHandlers()){
- if (!_cursor.empty()){
- mgr->setCursor(_cursor, point);
- }
- else mgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
- }
- else Actor::onMouseOver(point, mgr);
+ if (isLeftClickHandlers()){
+ if (!_cursor.empty()){
+ mgr->setCursor(_cursor, point);
+ }
+ else mgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
+ }
+ else Actor::onMouseOver(point, mgr);
}
bool SupportingActor::isLeftClickHandlers() {
- return _handlerMgr.isLeftClickHandler(this);
+ return _handlerMgr.isLeftClickHandler(this);
}
bool SupportingActor::isUseClickHandlers(InventoryItem *item) {
- return _handlerMgr.isUseClickHandler(this, item->getName());
+ return _handlerMgr.isUseClickHandler(this, item->getName());
}
void SupportingActor::onTimerMessage() {
- _handlerMgr.onTimerMessage(this);
+ _handlerMgr.onTimerMessage(this);
}
bool SupportingActor::onLeftClickMessage() {
- return _handlerMgr.onLeftClickMessage(this);
+ return _handlerMgr.onLeftClickMessage(this);
}
bool SupportingActor::onUseClickMessage(InventoryItem *item, InventoryMgr *mgr) {
- return _handlerMgr.onUseClickMessage(this, item, mgr);
+ return _handlerMgr.onUseClickMessage(this, item, mgr);
}
const Common::String &SupportingActor::getLocation() const {
- return _location;
+ return _location;
}
SupportingActor::~SupportingActor() {}
void SupportingActor::onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) {
- Common::String item = itemName;
- if (_handlerMgr.isUseClickHandler(this, itemName)) {
- item += kClickable;
- }
- Actor::onHover(point, item, cursorMgr);
+ Common::String item = itemName;
+ if (_handlerMgr.isUseClickHandler(this, itemName)) {
+ item += kClickable;
+ }
+ Actor::onHover(point, item, cursorMgr);
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/supporting_actor.h b/engines/pink/objects/actors/supporting_actor.h
index eecee3a..d47959d 100644
--- a/engines/pink/objects/actors/supporting_actor.h
+++ b/engines/pink/objects/actors/supporting_actor.h
@@ -33,30 +33,30 @@ class InventoryMgr;
class SupportingActor : public Actor {
public:
- virtual ~SupportingActor();
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ virtual ~SupportingActor();
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
- virtual void onMouseOver(Common::Point point, CursorMgr *mgr);
+ virtual void onMouseOver(Common::Point point, CursorMgr *mgr);
- virtual bool isClickable() { return 1; }
- bool isLeftClickHandlers();
- bool isUseClickHandlers(InventoryItem *item);
+ virtual bool isClickable() { return 1; }
+ bool isLeftClickHandlers();
+ bool isUseClickHandlers(InventoryItem *item);
- void onTimerMessage();
- bool onLeftClickMessage();
- bool onUseClickMessage(InventoryItem *item, InventoryMgr *mgr);
+ void onTimerMessage();
+ bool onLeftClickMessage();
+ bool onUseClickMessage(InventoryItem *item, InventoryMgr *mgr);
- virtual void onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr);
+ virtual void onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr);
- const Common::String &getLocation() const;
+ const Common::String &getLocation() const;
private:
- HandlerMgr _handlerMgr;
- Common::String _location;
- Common::String _pdaLink;
- Common::String _cursor;
+ HandlerMgr _handlerMgr;
+ Common::String _location;
+ Common::String _pdaLink;
+ Common::String _cursor;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/condition.cpp b/engines/pink/objects/condition.cpp
index 4e0b376..abb9550 100644
--- a/engines/pink/objects/condition.cpp
+++ b/engines/pink/objects/condition.cpp
@@ -29,71 +29,71 @@
namespace Pink {
void Pink::ConditionVariable::deserialize(Archive &archive) {
- _name = archive.readString();
- _value = archive.readString();
+ _name = archive.readString();
+ _value = archive.readString();
}
bool Pink::ConditionGameVariable::evaluate(Actor *actor) {
- return actor->getPage()->getModule()->getGame()->checkValueOfVariable(_name, _value);
+ return actor->getPage()->getModule()->getGame()->checkValueOfVariable(_name, _value);
}
void ConditionGameVariable::toConsole() {
- debug("\t\tConditionGameVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
+ debug("\t\tConditionGameVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
}
bool Pink::ConditionModuleVariable::evaluate(Actor *actor) {
- return actor->getPage()->getModule()->checkValueOfVariable(_name, _value);
+ return actor->getPage()->getModule()->checkValueOfVariable(_name, _value);
}
void ConditionModuleVariable::toConsole() {
- debug("\t\tConditionModuleVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
+ debug("\t\tConditionModuleVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
}
bool Pink::ConditionNotModuleVariable::evaluate(Actor *actor) {
- return !ConditionModuleVariable::evaluate(actor);
+ return !ConditionModuleVariable::evaluate(actor);
}
void ConditionNotModuleVariable::toConsole() {
- debug("\t\tConditionNotModuleVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
+ debug("\t\tConditionNotModuleVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
}
bool ConditionPageVariable::evaluate(Actor *actor) {
- return actor->getPage()->checkValueOfVariable(_name, _value);
+ return actor->getPage()->checkValueOfVariable(_name, _value);
}
void ConditionPageVariable::toConsole() {
- debug("\t\tConditionPageVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
+ debug("\t\tConditionPageVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
}
bool ConditionNotPageVariable::evaluate(Actor *actor) {
- return !ConditionPageVariable::evaluate(actor);
+ return !ConditionPageVariable::evaluate(actor);
}
void ConditionNotPageVariable::toConsole() {
- debug("\t\tConditionNotPageVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
+ debug("\t\tConditionNotPageVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
}
void ConditionInventoryItemOwner::deserialize(Archive &archive) {
- _item = archive.readString();
- _owner = archive.readString();
+ _item = archive.readString();
+ _owner = archive.readString();
}
bool ConditionInventoryItemOwner::evaluate(Actor *actor) {
- InventoryMgr *mgr = actor->getPage()->getModule()->getInventoryMgr();
- InventoryItem *item = mgr->findInventoryItem(_item);
- return item->getCurrentOwner() == _owner;
+ InventoryMgr *mgr = actor->getPage()->getModule()->getInventoryMgr();
+ InventoryItem *item = mgr->findInventoryItem(_item);
+ return item->getCurrentOwner() == _owner;
}
void ConditionInventoryItemOwner::toConsole() {
- debug("\t\tConditionInventoryItemOwner: _item=%s, _owner=%s", _item.c_str(), _owner.c_str());
+ debug("\t\tConditionInventoryItemOwner: _item=%s, _owner=%s", _item.c_str(), _owner.c_str());
}
bool ConditionNotInventoryItemOwner::evaluate(Actor *actor) {
- return !ConditionInventoryItemOwner::evaluate(actor);
+ return !ConditionInventoryItemOwner::evaluate(actor);
}
void ConditionNotInventoryItemOwner::toConsole() {
- debug("\t\tConditionNotInventoryItemOwner: _item=%s, _owner=%s", _item.c_str(), _owner.c_str());
+ debug("\t\tConditionNotInventoryItemOwner: _item=%s, _owner=%s", _item.c_str(), _owner.c_str());
}
} // End of namespace Pink
diff --git a/engines/pink/objects/condition.h b/engines/pink/objects/condition.h
index 505ed2d..ff5a6fb 100644
--- a/engines/pink/objects/condition.h
+++ b/engines/pink/objects/condition.h
@@ -31,73 +31,73 @@ class Actor;
class Condition : public Object {
public:
- virtual void deserialize(Archive &archive) = 0;
- virtual bool evaluate(Actor *actor) = 0;
+ virtual void deserialize(Archive &archive) = 0;
+ virtual bool evaluate(Actor *actor) = 0;
};
class ConditionVariable : public Condition {
public:
- virtual void deserialize(Archive &archive);
- virtual bool evaluate(Actor *actor) = 0;
+ virtual void deserialize(Archive &archive);
+ virtual bool evaluate(Actor *actor) = 0;
protected:
- Common::String _name;
- Common::String _value;
+ Common::String _name;
+ Common::String _value;
};
class ConditionGameVariable : public ConditionVariable {
public:
- virtual void toConsole();
- virtual bool evaluate(Actor *actor);
+ virtual void toConsole();
+ virtual bool evaluate(Actor *actor);
};
/*
* It is not used in games and has evaluate method with infinity recursion
class ConditionNotGameVariable : public ConditionGameVariable {
- virtual bool evaluate(LeadActor *leadActor);
+ virtual bool evaluate(LeadActor *leadActor);
};
*/
class ConditionModuleVariable : public ConditionVariable {
public:
- virtual void toConsole();
- virtual bool evaluate(Actor *actor);
+ virtual void toConsole();
+ virtual bool evaluate(Actor *actor);
};
class ConditionNotModuleVariable : public ConditionModuleVariable {
public:
- virtual void toConsole();
- virtual bool evaluate(Actor *actor);
+ virtual void toConsole();
+ virtual bool evaluate(Actor *actor);
};
class ConditionPageVariable : public ConditionVariable {
public:
- virtual void toConsole();
- virtual bool evaluate(Actor *actor);
+ virtual void toConsole();
+ virtual bool evaluate(Actor *actor);
};
class ConditionNotPageVariable : public ConditionPageVariable {
public:
- virtual void toConsole();
- virtual bool evaluate(Actor *actor);
+ virtual void toConsole();
+ virtual bool evaluate(Actor *actor);
};
class ConditionInventoryItemOwner : public Condition {
public:
- virtual void toConsole();
- virtual void deserialize(Archive &archive);
- virtual bool evaluate(Actor *actor);
+ virtual void toConsole();
+ virtual void deserialize(Archive &archive);
+ virtual bool evaluate(Actor *actor);
protected:
- Common::String _item;
- Common::String _owner;
+ Common::String _item;
+ Common::String _owner;
};
class ConditionNotInventoryItemOwner : public ConditionInventoryItemOwner {
public:
- virtual void toConsole();
- virtual bool evaluate(Actor *actor);
+ virtual void toConsole();
+ virtual bool evaluate(Actor *actor);
};
} // End of namespace Pink
diff --git a/engines/pink/objects/handlers/handler.cpp b/engines/pink/objects/handlers/handler.cpp
index 8833153..2f73553 100644
--- a/engines/pink/objects/handlers/handler.cpp
+++ b/engines/pink/objects/handlers/handler.cpp
@@ -34,123 +34,123 @@ namespace Pink {
void Handler::deserialize(Archive &archive) {
_conditions.deserialize(archive);
- _sideEffects.deserialize(archive);
+ _sideEffects.deserialize(archive);
}
bool Handler::isSuitable(Actor *actor) {
- for (uint i = 0; i < _conditions.size(); ++i) {
- if (!_conditions[i]->evaluate(actor)){
- return false;
- }
- }
- return true;
+ for (uint i = 0; i < _conditions.size(); ++i) {
+ if (!_conditions[i]->evaluate(actor)){
+ return false;
+ }
+ }
+ return true;
}
void Handler::executeSideEffects(Actor *actor) {
- for (uint i = 0; i < _sideEffects.size(); ++i) {
- _sideEffects[i]->execute(actor);
- }
+ for (uint i = 0; i < _sideEffects.size(); ++i) {
+ _sideEffects[i]->execute(actor);
+ }
}
void Handler::handle(Actor *actor) {
- executeSideEffects(actor);
+ executeSideEffects(actor);
}
Handler::~Handler() {
- for (uint i = 0; i < _sideEffects.size(); ++i) {
- delete _sideEffects[i];
- }
- for (uint i = 0; i < _conditions.size(); ++i) {
- delete _conditions[i];
- }
+ for (uint i = 0; i < _sideEffects.size(); ++i) {
+ delete _sideEffects[i];
+ }
+ for (uint i = 0; i < _conditions.size(); ++i) {
+ delete _conditions[i];
+ }
}
void HandlerSequences::deserialize(Archive &archive) {
- Handler::deserialize(archive);
- _sequences.deserialize(archive);
+ Handler::deserialize(archive);
+ _sequences.deserialize(archive);
}
void HandlerSequences::handle(Actor *actor) {
- Handler::handle(actor);
- Sequencer *sequencer = actor->getSequencer();
+ Handler::handle(actor);
+ Sequencer *sequencer = actor->getSequencer();
- assert(!_sequences.empty());
+ assert(!_sequences.empty());
- Common::RandomSource &rnd = actor->getPage()->getGame()->getRnd();
- uint index = rnd.getRandomNumber(_sequences.size() - 1);
+ Common::RandomSource &rnd = actor->getPage()->getGame()->getRnd();
+ uint index = rnd.getRandomNumber(_sequences.size() - 1);
- Sequence *sequence = sequencer->findSequence(_sequences[index]);
+ Sequence *sequence = sequencer->findSequence(_sequences[index]);
- assert(sequence);
- sequencer->authorSequence(sequence, 0);
+ assert(sequence);
+ sequencer->authorSequence(sequence, 0);
- execute(sequence);
+ execute(sequence);
}
void HandlerStartPage::execute(Sequence *sequence) {
- sequence->_unk = 1;
+ sequence->_unk = 1;
}
void HandlerStartPage::toConsole() {
- debug("HandlerStartPage:");
-
- debug("\tSideEffects:");
- for (uint i = 0; i < _sideEffects.size(); ++i) {
- _sideEffects[i]->toConsole();
- }
-
- debug("\tConditions:");
- for (uint i = 0; i < _conditions.size(); ++i) {
- _conditions[i]->toConsole();
- }
-
- debug("\tSequences:");
- for (uint i = 0; i < _sequences.size(); ++i) {
- debug("\t\t%s", _sequences[i].c_str());
- }
+ debug("HandlerStartPage:");
+
+ debug("\tSideEffects:");
+ for (uint i = 0; i < _sideEffects.size(); ++i) {
+ _sideEffects[i]->toConsole();
+ }
+
+ debug("\tConditions:");
+ for (uint i = 0; i < _conditions.size(); ++i) {
+ _conditions[i]->toConsole();
+ }
+
+ debug("\tSequences:");
+ for (uint i = 0; i < _sequences.size(); ++i) {
+ debug("\t\t%s", _sequences[i].c_str());
+ }
}
void HandlerLeftClick::toConsole() {
- debug("HandlerLeftClick:");
-
- debug("\tSideEffects:");
- for (uint i = 0; i < _sideEffects.size(); ++i) {
- _sideEffects[i]->toConsole();
- }
-
- debug("\tConditions:");
- for (uint i = 0; i < _conditions.size(); ++i) {
- _conditions[i]->toConsole();
- }
-
- debug("\tSequences:");
- for (uint i = 0; i < _sequences.size(); ++i) {
- debug("\t\t%s", _sequences[i].c_str());
- }
+ debug("HandlerLeftClick:");
+
+ debug("\tSideEffects:");
+ for (uint i = 0; i < _sideEffects.size(); ++i) {
+ _sideEffects[i]->toConsole();
+ }
+
+ debug("\tConditions:");
+ for (uint i = 0; i < _conditions.size(); ++i) {
+ _conditions[i]->toConsole();
+ }
+
+ debug("\tSequences:");
+ for (uint i = 0; i < _sequences.size(); ++i) {
+ debug("\t\t%s", _sequences[i].c_str());
+ }
}
void HandlerUseClick::deserialize(Archive &archive) {
- HandlerSequences::deserialize(archive);
- _inventoryItem = archive.readString();
- _recepient = archive.readString();
+ HandlerSequences::deserialize(archive);
+ _inventoryItem = archive.readString();
+ _recepient = archive.readString();
}
void HandlerUseClick::toConsole() {
- debug("HandlerUseClick: _inventoryItem=%s, _recepient=%s", _inventoryItem.c_str(), _recepient.c_str());
- debug("\tSideEffects:");
- for (uint i = 0; i < _sideEffects.size(); ++i) {
- _sideEffects[i]->toConsole();
- }
-
- debug("\tConditions:");
- for (uint i = 0; i < _conditions.size(); ++i) {
- _conditions[i]->toConsole();
- }
-
- debug("\tSequences:");
- for (uint i = 0; i < _sequences.size(); ++i) {
- debug("\t\t%s", _sequences[i].c_str());
- }
+ debug("HandlerUseClick: _inventoryItem=%s, _recepient=%s", _inventoryItem.c_str(), _recepient.c_str());
+ debug("\tSideEffects:");
+ for (uint i = 0; i < _sideEffects.size(); ++i) {
+ _sideEffects[i]->toConsole();
+ }
+
+ debug("\tConditions:");
+ for (uint i = 0; i < _conditions.size(); ++i) {
+ _conditions[i]->toConsole();
+ }
+
+ debug("\tSequences:");
+ for (uint i = 0; i < _sequences.size(); ++i) {
+ debug("\t\t%s", _sequences[i].c_str());
+ }
}
} // End of namespace Pink
diff --git a/engines/pink/objects/handlers/handler.h b/engines/pink/objects/handlers/handler.h
index 9d0d298..98d2662 100644
--- a/engines/pink/objects/handlers/handler.h
+++ b/engines/pink/objects/handlers/handler.h
@@ -36,60 +36,60 @@ class Actor;
class Handler : public Object {
public:
- ~Handler();
- virtual void deserialize(Archive &archive);
- virtual void handle(Actor *actor);
- bool isSuitable(Actor *actor);
+ ~Handler();
+ virtual void deserialize(Archive &archive);
+ virtual void handle(Actor *actor);
+ bool isSuitable(Actor *actor);
protected:
- void executeSideEffects(Actor *actor);
+ void executeSideEffects(Actor *actor);
- Array<Condition*> _conditions;
- Array<SideEffect*> _sideEffects;
+ Array<Condition*> _conditions;
+ Array<SideEffect*> _sideEffects;
};
class Sequence;
class HandlerSequences : public Handler {
public:
- virtual void deserialize(Archive &archive);
- virtual void handle(Actor *actor);
+ virtual void deserialize(Archive &archive);
+ virtual void handle(Actor *actor);
protected:
- virtual void execute(Sequence *sequence) = 0;
+ virtual void execute(Sequence *sequence) = 0;
- StringArray _sequences;
+ StringArray _sequences;
};
class HandlerStartPage : public HandlerSequences {
public:
- virtual void toConsole();
+ virtual void toConsole();
private:
- virtual void execute(Sequence *sequence);
+ virtual void execute(Sequence *sequence);
};
class HandlerLeftClick : public HandlerSequences {
public:
- virtual void toConsole();
+ virtual void toConsole();
private:
- virtual void execute(Sequence *sequence) {}
+ virtual void execute(Sequence *sequence) {}
};
class HandlerUseClick : public HandlerSequences {
public:
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
- const Common::String &getInventoryItem() const { return _inventoryItem; }
- const Common::String &getRecepient() const { return _recepient; }
+ const Common::String &getInventoryItem() const { return _inventoryItem; }
+ const Common::String &getRecepient() const { return _recepient; }
private:
- virtual void execute(Sequence *sequence) {};
+ virtual void execute(Sequence *sequence) {};
- Common::String _inventoryItem;
- Common::String _recepient;
+ Common::String _inventoryItem;
+ Common::String _recepient;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/handlers/handler_mgr.cpp b/engines/pink/objects/handlers/handler_mgr.cpp
index 695030f..cf5b6ca 100644
--- a/engines/pink/objects/handlers/handler_mgr.cpp
+++ b/engines/pink/objects/handlers/handler_mgr.cpp
@@ -28,107 +28,107 @@
namespace Pink {
void HandlerMgr::deserialize(Archive &archive) {
- _leftClickHandlers.deserialize(archive);
- _useClickHandlers.deserialize(archive);
- _timerHandlers.deserialize(archive);
+ _leftClickHandlers.deserialize(archive);
+ _useClickHandlers.deserialize(archive);
+ _timerHandlers.deserialize(archive);
}
void HandlerMgr::toConsole() {
- debug("HandlerMgr:");
- for (uint i = 0; i < _leftClickHandlers.size(); ++i) {
- _leftClickHandlers[i]->toConsole();
- }
- for (uint i = 0; i < _useClickHandlers.size(); ++i) {
- _useClickHandlers[i]->toConsole();
- }
- for (uint i = 0; i < _timerHandlers.size(); ++i) {
- _timerHandlers[i]->toConsole();
- }
+ debug("HandlerMgr:");
+ for (uint i = 0; i < _leftClickHandlers.size(); ++i) {
+ _leftClickHandlers[i]->toConsole();
+ }
+ for (uint i = 0; i < _useClickHandlers.size(); ++i) {
+ _useClickHandlers[i]->toConsole();
+ }
+ for (uint i = 0; i < _timerHandlers.size(); ++i) {
+ _timerHandlers[i]->toConsole();
+ }
}
bool HandlerMgr::isLeftClickHandler(Actor *actor) {
- for (uint i = 0; i < _leftClickHandlers.size(); ++i) {
- if (_leftClickHandlers[i]->isSuitable(actor))
- return true;
- }
+ for (uint i = 0; i < _leftClickHandlers.size(); ++i) {
+ if (_leftClickHandlers[i]->isSuitable(actor))
+ return true;
+ }
- return false;
+ return false;
}
bool HandlerMgr::isUseClickHandler(Actor *actor, const Common::String &itemName){
- for (uint i = 0; i < _useClickHandlers.size(); ++i) {
- if (itemName == _useClickHandlers[i]->getInventoryItem() &&
- _useClickHandlers[i]->isSuitable(actor))
- return true;
- }
+ for (uint i = 0; i < _useClickHandlers.size(); ++i) {
+ if (itemName == _useClickHandlers[i]->getInventoryItem() &&
+ _useClickHandlers[i]->isSuitable(actor))
+ return true;
+ }
- return false;
+ return false;
}
void HandlerMgr::onTimerMessage(Actor *actor) {
- Handler *handler = findSuitableHandlerTimer(actor);
- if (handler)
- handler->handle(actor);
+ Handler *handler = findSuitableHandlerTimer(actor);
+ if (handler)
+ handler->handle(actor);
}
bool HandlerMgr::onLeftClickMessage(Actor *actor) {
- Handler *handler = findSuitableHandlerLeftClick(actor);
- if (handler) {
- handler->handle(actor);
- return true;
- }
- return false;
+ Handler *handler = findSuitableHandlerLeftClick(actor);
+ if (handler) {
+ handler->handle(actor);
+ return true;
+ }
+ return false;
}
bool HandlerMgr::onUseClickMessage(Actor *actor, InventoryItem *item, InventoryMgr *mgr) {
- HandlerUseClick *handler = findSuitableHandlerUseClick(actor, item);
- if (handler) {
- if (!handler->getRecepient().empty())
- mgr->setItemOwner(handler->getRecepient(), item);
- handler->handle(actor);
- return true;
- }
- return false;
+ HandlerUseClick *handler = findSuitableHandlerUseClick(actor, item);
+ if (handler) {
+ if (!handler->getRecepient().empty())
+ mgr->setItemOwner(handler->getRecepient(), item);
+ handler->handle(actor);
+ return true;
+ }
+ return false;
}
Handler *HandlerMgr::findSuitableHandlerTimer(Actor *actor) {
- for (uint i = 0; i < _timerHandlers.size(); ++i) {
- if (_timerHandlers[i]->isSuitable(actor))
- return _timerHandlers[i];
- }
+ for (uint i = 0; i < _timerHandlers.size(); ++i) {
+ if (_timerHandlers[i]->isSuitable(actor))
+ return _timerHandlers[i];
+ }
- return nullptr;
+ return nullptr;
}
HandlerLeftClick *HandlerMgr::findSuitableHandlerLeftClick(Actor *actor) {
- for (uint i = 0; i < _leftClickHandlers.size(); ++i) {
- if (_leftClickHandlers[i]->isSuitable(actor))
- return _leftClickHandlers[i];
- }
+ for (uint i = 0; i < _leftClickHandlers.size(); ++i) {
+ if (_leftClickHandlers[i]->isSuitable(actor))
+ return _leftClickHandlers[i];
+ }
- return nullptr;
+ return nullptr;
}
HandlerUseClick *HandlerMgr::findSuitableHandlerUseClick(Actor *actor, InventoryItem *item) {
- for (uint i = 0; i < _useClickHandlers.size(); ++i) {
- if (item->getName() == _useClickHandlers[i]->getInventoryItem() && _useClickHandlers[i]->isSuitable(actor))
- return _useClickHandlers[i];
- }
+ for (uint i = 0; i < _useClickHandlers.size(); ++i) {
+ if (item->getName() == _useClickHandlers[i]->getInventoryItem() && _useClickHandlers[i]->isSuitable(actor))
+ return _useClickHandlers[i];
+ }
- return nullptr;
+ return nullptr;
}
HandlerMgr::~HandlerMgr() {
- for (uint i = 0; i < _leftClickHandlers.size(); ++i) {
- delete _leftClickHandlers[i];
- }
- for (uint j = 0; j < _useClickHandlers.size(); ++j) {
- delete _useClickHandlers[j];
- }
- for (uint k = 0; k < _timerHandlers.size(); ++k) {
- delete _timerHandlers[k];
- }
+ for (uint i = 0; i < _leftClickHandlers.size(); ++i) {
+ delete _leftClickHandlers[i];
+ }
+ for (uint j = 0; j < _useClickHandlers.size(); ++j) {
+ delete _useClickHandlers[j];
+ }
+ for (uint k = 0; k < _timerHandlers.size(); ++k) {
+ delete _timerHandlers[k];
+ }
}
} // End of namespace Pink
diff --git a/engines/pink/objects/handlers/handler_mgr.h b/engines/pink/objects/handlers/handler_mgr.h
index 36e2b05..dabb329 100644
--- a/engines/pink/objects/handlers/handler_mgr.h
+++ b/engines/pink/objects/handlers/handler_mgr.h
@@ -39,26 +39,26 @@ class Actor;
class HandlerMgr : public Object {
public:
- virtual ~HandlerMgr();
- virtual void deserialize(Archive &archive);
+ virtual ~HandlerMgr();
+ virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ virtual void toConsole();
- bool isLeftClickHandler(Actor *actor);
- bool isUseClickHandler(Actor *actor, const Common::String &itemName);
+ bool isLeftClickHandler(Actor *actor);
+ bool isUseClickHandler(Actor *actor, const Common::String &itemName);
- void onTimerMessage(Actor *actor);
- bool onLeftClickMessage(Actor *actor);
- bool onUseClickMessage(Actor *actor, InventoryItem *item, InventoryMgr *mgr);
+ void onTimerMessage(Actor *actor);
+ bool onLeftClickMessage(Actor *actor);
+ bool onUseClickMessage(Actor *actor, InventoryItem *item, InventoryMgr *mgr);
private:
- Handler *findSuitableHandlerTimer(Actor *actor);
- HandlerLeftClick *findSuitableHandlerLeftClick(Actor *actor);
- HandlerUseClick *findSuitableHandlerUseClick(Actor *actor, InventoryItem *item);
+ Handler *findSuitableHandlerTimer(Actor *actor);
+ HandlerLeftClick *findSuitableHandlerLeftClick(Actor *actor);
+ HandlerUseClick *findSuitableHandlerUseClick(Actor *actor, InventoryItem *item);
- Array<HandlerLeftClick*> _leftClickHandlers;
- Array<HandlerUseClick*> _useClickHandlers;
- Array<Handler*> _timerHandlers;
+ Array<HandlerLeftClick*> _leftClickHandlers;
+ Array<HandlerUseClick*> _useClickHandlers;
+ Array<Handler*> _timerHandlers;
};
}
diff --git a/engines/pink/objects/handlers/handler_timer.cpp b/engines/pink/objects/handlers/handler_timer.cpp
index d9f75f6..e27d4bb 100644
--- a/engines/pink/objects/handlers/handler_timer.cpp
+++ b/engines/pink/objects/handlers/handler_timer.cpp
@@ -36,76 +36,76 @@ namespace Pink {
void HandlerTimerActions::deserialize(Archive &archive) {
- Handler::deserialize(archive);
- _actions.deserialize(archive);
+ Handler::deserialize(archive);
+ _actions.deserialize(archive);
}
void HandlerTimerActions::toConsole() {
- debug("HandlerTimerActions:");
-
- debug("\tSideEffects:");
- for (uint i = 0; i < _sideEffects.size(); ++i) {
- _sideEffects[i]->toConsole();
- }
-
- debug("\tConditions:");
- for (uint i = 0; i < _conditions.size(); ++i) {
- _conditions[i]->toConsole();
- }
-
- debug("\tActions:");
- for (uint i = 0; i < _actions.size(); ++i) {
- debug("\t\t%s", _actions[i].c_str());
- }
+ debug("HandlerTimerActions:");
+
+ debug("\tSideEffects:");
+ for (uint i = 0; i < _sideEffects.size(); ++i) {
+ _sideEffects[i]->toConsole();
+ }
+
+ debug("\tConditions:");
+ for (uint i = 0; i < _conditions.size(); ++i) {
+ _conditions[i]->toConsole();
+ }
+
+ debug("\tActions:");
+ for (uint i = 0; i < _actions.size(); ++i) {
+ debug("\t\t%s", _actions[i].c_str());
+ }
}
void HandlerTimerActions::handle(Actor *actor) {
- Handler::handle(actor);
- if (!actor->isPlaying() && !_actions.empty()) {
- Common::RandomSource &rnd = actor->getPage()->getGame()->getRnd();
- uint index = rnd.getRandomNumber(_actions.size() - 1);
- Action *action = actor->findAction(_actions[index]);
- assert(action);
- actor->setAction(action, 0);
- }
+ Handler::handle(actor);
+ if (!actor->isPlaying() && !_actions.empty()) {
+ Common::RandomSource &rnd = actor->getPage()->getGame()->getRnd();
+ uint index = rnd.getRandomNumber(_actions.size() - 1);
+ Action *action = actor->findAction(_actions[index]);
+ assert(action);
+ actor->setAction(action, 0);
+ }
}
void HandlerTimerSequences::execute(Sequence *sequence) {
- error("HandlerTimerSequences function is not implemented");
+ error("HandlerTimerSequences function is not implemented");
}
void HandlerTimerSequences::toConsole() {
- debug("HandlerTimerSequences:");
-
- debug("\tSideEffects:");
- for (uint i = 0; i < _sideEffects.size(); ++i) {
- _sideEffects[i]->toConsole();
- }
-
- debug("\tConditions:");
- for (uint i = 0; i < _conditions.size(); ++i) {
- _conditions[i]->toConsole();
- }
-
- debug("\tSequences:");
- for (uint i = 0; i < _sequences.size(); ++i) {
- debug("\t\t%s", _sequences[i].c_str());
- }
+ debug("HandlerTimerSequences:");
+
+ debug("\tSideEffects:");
+ for (uint i = 0; i < _sideEffects.size(); ++i) {
+ _sideEffects[i]->toConsole();
+ }
+
+ debug("\tConditions:");
+ for (uint i = 0; i < _conditions.size(); ++i) {
+ _conditions[i]->toConsole();
+ }
+
+ debug("\tSequences:");
+ for (uint i = 0; i < _sequences.size(); ++i) {
+ debug("\t\t%s", _sequences[i].c_str());
+ }
}
void HandlerTimerSequences::handle(Actor *actor) {
- Handler::handle(actor);
- Sequencer *sequencer = actor->getSequencer();
+ Handler::handle(actor);
+ Sequencer *sequencer = actor->getSequencer();
- assert(!_sequences.empty());
+ assert(!_sequences.empty());
- Common::RandomSource &rnd = actor->getPage()->getGame()->getRnd();
- uint index = rnd.getRandomNumber(_sequences.size() - 1);
+ Common::RandomSource &rnd = actor->getPage()->getGame()->getRnd();
+ uint index = rnd.getRandomNumber(_sequences.size() - 1);
- Sequence *sequence = sequencer->findSequence(_sequences[index]);
+ Sequence *sequence = sequencer->findSequence(_sequences[index]);
- assert(sequence);
+ assert(sequence);
}
} // End of namespace Pink
diff --git a/engines/pink/objects/handlers/handler_timer.h b/engines/pink/objects/handlers/handler_timer.h
index cbe6824..b420272 100644
--- a/engines/pink/objects/handlers/handler_timer.h
+++ b/engines/pink/objects/handlers/handler_timer.h
@@ -39,23 +39,23 @@ class HandlerTimer : public Handler {
//in Peril this is HandlerTimer
class HandlerTimerActions : public Handler {
public:
- virtual void toConsole();
- virtual void deserialize(Archive &archive);
- virtual void handle(Actor *actor);
+ virtual void toConsole();
+ virtual void deserialize(Archive &archive);
+ virtual void handle(Actor *actor);
private:
- StringArray _actions;
+ StringArray _actions;
};
//appear in HokusPokus
class HandlerTimerSequences : public HandlerSequences { //originally it was inherited from HandlerTimer
public:
- virtual void toConsole();
+ virtual void toConsole();
- virtual void handle(Actor *actor);
+ virtual void handle(Actor *actor);
protected:
- virtual void execute(Sequence *sequence);
+ virtual void execute(Sequence *sequence);
};
} // End of namespace Pink
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
index a7a483f..c2ad3bb 100644
--- a/engines/pink/objects/inventory.cpp
+++ b/engines/pink/objects/inventory.cpp
@@ -33,32 +33,32 @@
namespace Pink {
InventoryMgr::InventoryMgr()
- : _lead(nullptr), _item(nullptr), _isClickedOnItem(false)
+ : _lead(nullptr), _item(nullptr), _isClickedOnItem(false)
{
}
void Pink::InventoryItem::deserialize(Archive &archive) {
- NamedObject::deserialize(archive);
- _initialOwner = archive.readString();
- _currentOwner = _initialOwner;
+ NamedObject::deserialize(archive);
+ _initialOwner = archive.readString();
+ _currentOwner = _initialOwner;
}
Common::String &InventoryItem::getCurrentOwner() {
- return _currentOwner;
+ return _currentOwner;
}
void InventoryItem::toConsole() {
- debug("\tInventoryItem: _initialOwner=%s _currentOwner=%s", _initialOwner.c_str(), _currentOwner.c_str());
+ debug("\tInventoryItem: _initialOwner=%s _currentOwner=%s", _initialOwner.c_str(), _currentOwner.c_str());
}
InventoryMgr::~InventoryMgr() {
- for (uint i = 0; i < _items.size(); ++i) {
- delete _items[i];
- }
+ for (uint i = 0; i < _items.size(); ++i) {
+ delete _items[i];
+ }
}
void InventoryMgr::deserialize(Archive &archive) {
- _items.deserialize(archive);
+ _items.deserialize(archive);
}
InventoryItem *InventoryMgr::findInventoryItem(const Common::String &name) {
@@ -71,133 +71,133 @@ InventoryItem *InventoryMgr::findInventoryItem(const Common::String &name) {
}
void InventoryMgr::setLeadActor(LeadActor *lead) {
- _lead = lead;
+ _lead = lead;
}
void InventoryMgr::toConsole() {
- debug("InventoryMgr:");
- for (uint i = 0; i < _items.size(); ++i) {
- _items[i]->toConsole();
- }
+ debug("InventoryMgr:");
+ for (uint i = 0; i < _items.size(); ++i) {
+ _items[i]->toConsole();
+ }
}
bool InventoryMgr::isPinkOwnsAnyItems() {
- if (_item)
- return true;
+ if (_item)
+ return true;
- for (uint i = 0; i < _items.size(); ++i) {
- if (_items[i]->getCurrentOwner() == _lead->getName()){
- _item = _items[i];
- return true;
- }
- }
+ for (uint i = 0; i < _items.size(); ++i) {
+ if (_items[i]->getCurrentOwner() == _lead->getName()){
+ _item = _items[i];
+ return true;
+ }
+ }
- return false;
+ return false;
}
void InventoryMgr::setItemOwner(const Common::String &owner, InventoryItem *item) {
- if (owner == item->getCurrentOwner())
- return;
+ if (owner == item->getCurrentOwner())
+ return;
- if (item == _item && _lead->getName() != owner)
- _item = nullptr;
+ if (item == _item && _lead->getName() != owner)
+ _item = nullptr;
- item->_currentOwner = owner;
+ item->_currentOwner = owner;
- if (_lead->getName() == owner)
- _item = item;
+ if (_lead->getName() == owner)
+ _item = item;
}
bool InventoryMgr::start(bool playOpening) {
- if (!_item) {
- _item = findInventoryItem(_lead->getName());
- if (!_item)
- return false;
- }
+ if (!_item) {
+ _item = findInventoryItem(_lead->getName());
+ if (!_item)
+ return false;
+ }
- _window = _lead->getPage()->findActor(kInventoryWindowActor);
- _itemActor = _lead->getPage()->findActor(kInventoryItemActor);
- _rightArrow = _lead->getPage()->findActor(kInventoryRightArrowActor);
- _leftArrow = _lead->getPage()->findActor(kInventoryLeftArrowActor);
+ _window = _lead->getPage()->findActor(kInventoryWindowActor);
+ _itemActor = _lead->getPage()->findActor(kInventoryItemActor);
+ _rightArrow = _lead->getPage()->findActor(kInventoryRightArrowActor);
+ _leftArrow = _lead->getPage()->findActor(kInventoryLeftArrowActor);
- if (playOpening){
- _window->setAction(kOpenAction);
- _state = kOpening;
- }
+ if (playOpening){
+ _window->setAction(kOpenAction);
+ _state = kOpening;
+ }
- return true;
+ return true;
}
void InventoryMgr::update() {
- if (_state == kOpening && !_window->isPlaying()){
- _state = kReady;
- _itemActor->setAction(_item->getName());
- _window->setAction(kShowAction);
- _leftArrow->setAction(kShowAction);
- _rightArrow->setAction(kShowAction);
- }
- else if (_state == kClosing && !_window->isPlaying()){
- _window->setAction(kIdleAction);
+ if (_state == kOpening && !_window->isPlaying()){
+ _state = kReady;
+ _itemActor->setAction(_item->getName());
+ _window->setAction(kShowAction);
+ _leftArrow->setAction(kShowAction);
+ _rightArrow->setAction(kShowAction);
+ }
+ else if (_state == kClosing && !_window->isPlaying()){
+ _window->setAction(kIdleAction);
- _lead->onInventoryClosed(_isClickedOnItem);
+ _lead->onInventoryClosed(_isClickedOnItem);
- _state = kIdle;
+ _state = kIdle;
- _window = nullptr;
- _itemActor = nullptr;
- _isClickedOnItem = false;
- }
+ _window = nullptr;
+ _itemActor = nullptr;
+ _isClickedOnItem = false;
+ }
}
void InventoryMgr::onClick(Common::Point point) {
- if (_state != kReady)
- return;
-
- Actor *actor = _lead->getPage()->getGame()->getDirector()->getActorByPoint(point);
- if (actor == _itemActor || actor == _window) {
- _isClickedOnItem = true;
- close();
- }
- else if (actor == _leftArrow) {
- showNextItem(kLeft);
- }
- else if (actor == _rightArrow) {
- showNextItem(kRight);
- }
- else close();
+ if (_state != kReady)
+ return;
+
+ Actor *actor = _lead->getPage()->getGame()->getDirector()->getActorByPoint(point);
+ if (actor == _itemActor || actor == _window) {
+ _isClickedOnItem = true;
+ close();
+ }
+ else if (actor == _leftArrow) {
+ showNextItem(kLeft);
+ }
+ else if (actor == _rightArrow) {
+ showNextItem(kRight);
+ }
+ else close();
}
void InventoryMgr::close() {
- _state = kClosing;
+ _state = kClosing;
- _window->setAction(kCloseAction);
- _itemActor->setAction(kIdleAction);
- _leftArrow->setAction(kIdleAction);
- _rightArrow->setAction(kIdleAction);
+ _window->setAction(kCloseAction);
+ _itemActor->setAction(kIdleAction);
+ _leftArrow->setAction(kIdleAction);
+ _rightArrow->setAction(kIdleAction);
}
void InventoryMgr::showNextItem(bool direction) {
- int index = 0;
- for (uint i = 0; i < _items.size(); ++i) {
- if (_item == _items[i]) {
- index = i + _items.size();
- break;
- }
- }
+ int index = 0;
+ for (uint i = 0; i < _items.size(); ++i) {
+ if (_item == _items[i]) {
+ index = i + _items.size();
+ break;
+ }
+ }
- uint i = 0;
- do {
- index = (direction == kLeft) ? --index : ++index;
- } while(_items[index % _items.size()]->getCurrentOwner() != _item->getCurrentOwner() && ++i < _items.size());
+ uint i = 0;
+ do {
+ index = (direction == kLeft) ? --index : ++index;
+ } while(_items[index % _items.size()]->getCurrentOwner() != _item->getCurrentOwner() && ++i < _items.size());
- if (i != _items.size()) {
- _item = _items[index % _items.size()];
- _itemActor->setAction(_item->getName());
- }
+ if (i != _items.size()) {
+ _item = _items[index % _items.size()];
+ _itemActor->setAction(_item->getName());
+ }
}
InventoryItem *InventoryMgr::getCurrentItem() {
- return _item;
+ return _item;
}
} // End of namespace Pink
diff --git a/engines/pink/objects/inventory.h b/engines/pink/objects/inventory.h
index b8de36b..02bf9d6 100644
--- a/engines/pink/objects/inventory.h
+++ b/engines/pink/objects/inventory.h
@@ -31,16 +31,16 @@ namespace Pink {
class InventoryItem : public NamedObject {
public:
- virtual void deserialize(Archive &archive);
+ virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ virtual void toConsole();
- Common::String &getCurrentOwner();
+ Common::String &getCurrentOwner();
- friend class InventoryMgr;
+ friend class InventoryMgr;
private:
- Common::String _initialOwner;
- Common::String _currentOwner;
+ Common::String _initialOwner;
+ Common::String _currentOwner;
};
class LeadActor;
@@ -48,51 +48,51 @@ class Actor;
class InventoryMgr : public Object {
public:
- InventoryMgr();
- virtual ~InventoryMgr();
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ InventoryMgr();
+ virtual ~InventoryMgr();
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
- void update();
- void onClick(Common::Point point);
+ void update();
+ void onClick(Common::Point point);
- bool start(bool playOpening);
+ bool start(bool playOpening);
- void setLeadActor(LeadActor *lead);
- InventoryItem* findInventoryItem(const Common::String &name);
+ void setLeadActor(LeadActor *lead);
+ InventoryItem* findInventoryItem(const Common::String &name);
- bool isPinkOwnsAnyItems();
- void setItemOwner(const Common::String &owner, InventoryItem *item);
+ bool isPinkOwnsAnyItems();
+ void setItemOwner(const Common::String &owner, InventoryItem *item);
- InventoryItem *getCurrentItem();
+ InventoryItem *getCurrentItem();
private:
- void close();
- enum Direction {
- kLeft = 0,
- kRight = 1,
- };
- void showNextItem(bool direction);
+ void close();
+ enum Direction {
+ kLeft = 0,
+ kRight = 1,
+ };
+ void showNextItem(bool direction);
- LeadActor *_lead;
- Actor *_window;
- Actor *_itemActor;
- Actor *_rightArrow;
- Actor *_leftArrow;
+ LeadActor *_lead;
+ Actor *_window;
+ Actor *_itemActor;
+ Actor *_rightArrow;
+ Actor *_leftArrow;
- InventoryItem *_item;
- Array<InventoryItem*> _items;
+ InventoryItem *_item;
+ Array<InventoryItem*> _items;
- enum State {
- kIdle = 0,
- kOpening = 1,
- kReady = 2,
- kClosing = 3,
- } _state;
- bool _isClickedOnItem;
+ enum State {
+ kIdle = 0,
+ kOpening = 1,
+ kReady = 2,
+ kClosing = 3,
+ } _state;
+ bool _isClickedOnItem;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/module.cpp b/engines/pink/objects/module.cpp
index 019f71b..5a7dd6b 100644
--- a/engines/pink/objects/module.cpp
+++ b/engines/pink/objects/module.cpp
@@ -27,52 +27,52 @@
namespace Pink {
ModuleProxy::ModuleProxy(const Common::String &name)
- : NamedObject(name)
+ : NamedObject(name)
{}
ModuleProxy::ModuleProxy() {}
Module::Module(PinkEngine *game, const Common::String &name)
- : NamedObject(name), _game(game), _page(nullptr)
+ : NamedObject(name), _game(game), _page(nullptr)
{}
Module::~Module() {
- for (uint i = 0; i < _pages.size(); ++i) {
- delete _pages[i];
- }
+ for (uint i = 0; i < _pages.size(); ++i) {
+ delete _pages[i];
+ }
}
void Module::load(Archive &archive){
- archive.mapObject(this);
- NamedObject::deserialize(archive);
+ archive.mapObject(this);
+ NamedObject::deserialize(archive);
- archive.readString(); // skip directory
+ archive.readString(); // skip directory
- _invMgr.deserialize(archive);
- _pages.deserialize(archive);
+ _invMgr.deserialize(archive);
+ _pages.deserialize(archive);
}
void Module::init(bool isLoadingSave, const Common::String &pageName) {
- // 0 0 - new game
- // 0 1 - module changed
- // 1 0 - from save
- if (!pageName.empty())
- _page = findPage(pageName);
- else if (!_page)
- _page = _pages[0];
-
- _page->init(isLoadingSave);
+ // 0 0 - new game
+ // 0 1 - module changed
+ // 1 0 - from save
+ if (!pageName.empty())
+ _page = findPage(pageName);
+ else if (!_page)
+ _page = _pages[0];
+
+ _page->init(isLoadingSave);
}
void Module::changePage(const Common::String &pageName) {
- GamePage *page = nullptr;
- page = findPage(pageName);
- assert(_page != page);
+ GamePage *page = nullptr;
+ page = findPage(pageName);
+ assert(_page != page);
- _page->unload();
+ _page->unload();
- _page = page;
- _page->init(kLoadingNewGame);
+ _page = page;
+ _page->init(kLoadingNewGame);
}
GamePage *Module::findPage(const Common::String &pageName) const {
@@ -84,21 +84,21 @@ GamePage *Module::findPage(const Common::String &pageName) const {
}
PinkEngine *Module::getGame() const {
- return _game;
+ return _game;
}
bool Module::checkValueOfVariable(Common::String &variable, Common::String &value) {
- if (!_variables.contains(variable))
- return value == kUndefined;
- return _variables[variable] == value;
+ if (!_variables.contains(variable))
+ return value == kUndefined;
+ return _variables[variable] == value;
}
void Module::setVariable(Common::String &variable, Common::String &value) {
- _variables[variable] = value;
+ _variables[variable] = value;
}
InventoryMgr *Module::getInventoryMgr() {
- return &_invMgr;
+ return &_invMgr;
}
} // End of namespace Pink
diff --git a/engines/pink/objects/module.h b/engines/pink/objects/module.h
index 622381d..5c253eb 100644
--- a/engines/pink/objects/module.h
+++ b/engines/pink/objects/module.h
@@ -34,8 +34,8 @@ namespace Pink {
class ModuleProxy : public NamedObject {
public:
- ModuleProxy();
- ModuleProxy(const Common::String &name);
+ ModuleProxy();
+ ModuleProxy(const Common::String &name);
};
class PinkEngine;
@@ -43,31 +43,31 @@ class GamePage;
class Module : public NamedObject {
public:
- Module(PinkEngine *game, const Common::String &name);
- ~Module();
+ Module(PinkEngine *game, const Common::String &name);
+ ~Module();
- void load(Archive &archive);
- void init(bool isLoadingSave, const Common::String &pageName);
- void changePage(const Common::String &pageName);
+ void load(Archive &archive);
+ void init(bool isLoadingSave, const Common::String &pageName);
+ void changePage(const Common::String &pageName);
- void OnLeftButtonDown();
- void OnMouseMove();
- void OnKeyboardButtonClick();
+ void OnLeftButtonDown();
+ void OnMouseMove();
+ void OnKeyboardButtonClick();
- PinkEngine *getGame() const;
- InventoryMgr *getInventoryMgr();
+ PinkEngine *getGame() const;
+ InventoryMgr *getInventoryMgr();
- bool checkValueOfVariable(Common::String &variable, Common::String &value);
- void setVariable(Common::String &variable, Common::String &value);
+ bool checkValueOfVariable(Common::String &variable, Common::String &value);
+ void setVariable(Common::String &variable, Common::String &value);
private:
- GamePage *findPage(const Common::String &pageName) const;
+ GamePage *findPage(const Common::String &pageName) const;
- PinkEngine *_game;
- GamePage *_page;
- Array<GamePage*> _pages;
- InventoryMgr _invMgr;
- Common::StringMap _variables;
+ PinkEngine *_game;
+ GamePage *_page;
+ Array<GamePage*> _pages;
+ InventoryMgr _invMgr;
+ Common::StringMap _variables;
};
diff --git a/engines/pink/objects/object.cpp b/engines/pink/objects/object.cpp
index 6e50053..4d9041f 100644
--- a/engines/pink/objects/object.cpp
+++ b/engines/pink/objects/object.cpp
@@ -27,15 +27,15 @@
namespace Pink {
Pink::NamedObject::NamedObject(const Common::String &name)
- : _name(name)
+ : _name(name)
{}
void Pink::NamedObject::deserialize(Archive &archive) {
- _name = archive.readString();
+ _name = archive.readString();
}
const Common::String &Pink::NamedObject::getName() const {
- return _name;
+ return _name;
}
void NamedObject::store(Archive &archive) {
diff --git a/engines/pink/objects/object.h b/engines/pink/objects/object.h
index 88ce35b..62ca9f7 100644
--- a/engines/pink/objects/object.h
+++ b/engines/pink/objects/object.h
@@ -31,26 +31,26 @@ class Archive;
class Object {
public:
- virtual ~Object() {};
- virtual void load(Archive &){};
- virtual void store(Archive &){};
- virtual void deserialize(Archive &){};
- virtual void init() {}
- virtual void toConsole() {};
+ virtual ~Object() {};
+ virtual void load(Archive &){};
+ virtual void store(Archive &){};
+ virtual void deserialize(Archive &){};
+ virtual void init() {}
+ virtual void toConsole() {};
};
class NamedObject : public Object {
public:
- NamedObject(){};
- NamedObject(const Common::String &name);
+ NamedObject(){};
+ NamedObject(const Common::String &name);
- void deserialize(Archive &archive);
- void store(Archive &archive);
+ void deserialize(Archive &archive);
+ void store(Archive &archive);
- const Common::String &getName() const;
+ const Common::String &getName() const;
protected:
- Common::String _name;
+ Common::String _name;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index 952ea42..83df359 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -31,128 +31,128 @@
namespace Pink {
GamePage::GamePage()
- : _cursorMgr(nullptr), _walkMgr(nullptr), _sequencer(nullptr),
- _isLoaded(false), _memFile(nullptr)
+ : _cursorMgr(nullptr), _walkMgr(nullptr), _sequencer(nullptr),
+ _isLoaded(false), _memFile(nullptr)
{}
GamePage::~GamePage() {
- clear();
+ clear();
}
void GamePage::toConsole() {
- Page::toConsole();
- _walkMgr->toConsole();
- _sequencer->toConsole();
- for (uint i = 0; i < _handlers.size(); ++i) {
- _handlers[i]->toConsole();
- }
+ Page::toConsole();
+ _walkMgr->toConsole();
+ _sequencer->toConsole();
+ for (uint i = 0; i < _handlers.size(); ++i) {
+ _handlers[i]->toConsole();
+ }
}
void GamePage::deserialize(Archive &archive) {
- Page::deserialize(archive);
- _module = static_cast<Module*>(archive.readObject());
- assert(dynamic_cast<Module*>(_module) != 0);
+ Page::deserialize(archive);
+ _module = static_cast<Module*>(archive.readObject());
+ assert(dynamic_cast<Module*>(_module) != 0);
}
void GamePage::load(Archive &archive) {
- archive.mapObject(_cursorMgr);
- archive.mapObject(_walkMgr);
- archive.mapObject(_sequencer);
+ archive.mapObject(_cursorMgr);
+ archive.mapObject(_walkMgr);
+ archive.mapObject(_sequencer);
- Page::load(archive);
+ Page::load(archive);
- _leadActor = static_cast<LeadActor*>(archive.readObject());
+ _leadActor = static_cast<LeadActor*>(archive.readObject());
- _walkMgr->deserialize(archive);
- _sequencer->deserialize(archive);
- _handlers.deserialize(archive);
+ _walkMgr->deserialize(archive);
+ _sequencer->deserialize(archive);
+ _handlers.deserialize(archive);
}
void GamePage::init(bool isLoadingSave) {
- if (!_isLoaded)
- loadManagers();
+ if (!_isLoaded)
+ loadManagers();
- toConsole();
+ toConsole();
- for (uint j = 0; j < _actors.size(); ++j) {
- if (_actors[j]->initPallete(_module->getGame()->getDirector()))
- break;
- }
+ for (uint j = 0; j < _actors.size(); ++j) {
+ if (_actors[j]->initPallete(_module->getGame()->getDirector()))
+ break;
+ }
- LeadActor::State state = _leadActor->getState();
- bool startNow = !(state == LeadActor::kInventory || state == LeadActor::kPDA);
+ LeadActor::State state = _leadActor->getState();
+ bool startNow = !(state == LeadActor::kInventory || state == LeadActor::kPDA);
- for (uint i = 0; i < _actors.size(); ++i) {
- _actors[i]->init(startNow);
- }
+ for (uint i = 0; i < _actors.size(); ++i) {
+ _actors[i]->init(startNow);
+ }
- bool isHandler = false;
- if (!isLoadingSave) {
- isHandler = initHandler();
- }
+ bool isHandler = false;
+ if (!isLoadingSave) {
+ isHandler = initHandler();
+ }
- _leadActor->start(isHandler);
+ _leadActor->start(isHandler);
}
bool GamePage::initHandler() {
- for (uint i = 0; i < _handlers.size(); ++i) {
- if (_handlers[i]->isSuitable(_leadActor)){
- _handlers[i]->handle(_leadActor);
- return true;
- }
- }
- return false;
+ for (uint i = 0; i < _handlers.size(); ++i) {
+ if (_handlers[i]->isSuitable(_leadActor)){
+ _handlers[i]->handle(_leadActor);
+ return true;
+ }
+ }
+ return false;
}
void GamePage::loadManagers() {
- _isLoaded = true;
+ _isLoaded = true;
- _cursorMgr = new CursorMgr(_module->getGame(), this);
- _walkMgr = new WalkMgr;
- _sequencer = new Sequencer(this);
+ _cursorMgr = new CursorMgr(_module->getGame(), this);
+ _walkMgr = new WalkMgr;
+ _sequencer = new Sequencer(this);
- _resMgr.init(_module->getGame(), this);
+ _resMgr.init(_module->getGame(), this);
- if (_memFile != nullptr) {
- loadState();
+ if (_memFile != nullptr) {
+ loadState();
- delete _memFile;
- _memFile = nullptr;
- }
+ delete _memFile;
+ _memFile = nullptr;
+ }
}
PinkEngine *GamePage::getGame() {
- return _resMgr.getGame();
+ return _resMgr.getGame();
}
Sequencer *GamePage::getSequencer() {
- return _sequencer;
+ return _sequencer;
}
Module *GamePage::getModule() const {
- return _module;
+ return _module;
}
bool GamePage::checkValueOfVariable(const Common::String &variable, const Common::String &value) {
- if (!_variables.contains(variable))
- return value == kUndefined;
- return _variables[variable] == value;
+ if (!_variables.contains(variable))
+ return value == kUndefined;
+ return _variables[variable] == value;
}
void GamePage::setVariable(Common::String &variable, Common::String &value) {
- _variables[variable] = value;
- _leadActor->onVariableSet();
+ _variables[variable] = value;
+ _leadActor->onVariableSet();
}
WalkMgr *GamePage::getWalkMgr() {
- return _walkMgr;
+ return _walkMgr;
}
void GamePage::loadState() {
- Archive archive(static_cast<Common::SeekableReadStream*>(_memFile));
- //_variables.clear(1);
- Common::StringMap mapTest; // HACK. Without it isn't working
- //archive >> _variables;
+ Archive archive(static_cast<Common::SeekableReadStream*>(_memFile));
+ //_variables.clear(1);
+ Common::StringMap mapTest; // HACK. Without it isn't working
+ //archive >> _variables;
uint size = archive.readCount();
for (uint i = 0; i < size; ++i) {
@@ -161,56 +161,56 @@ void GamePage::loadState() {
mapTest.setVal(key, val);
}
- _variables = mapTest;
+ _variables = mapTest;
- uint16 actorCount = archive.readWORD();
+ uint16 actorCount = archive.readWORD();
- Common::String actorName;
- for (int i = 0; i < actorCount; ++i) {
- actorName = archive.readString();
- findActor(actorName)->loadState(archive);
- }
+ Common::String actorName;
+ for (int i = 0; i < actorCount; ++i) {
+ actorName = archive.readString();
+ findActor(actorName)->loadState(archive);
+ }
}
void GamePage::saveState() {
- _memFile = new Common::MemoryReadWriteStream(DisposeAfterUse::YES);
- Archive archive(static_cast<Common::WriteStream*>(_memFile));
+ _memFile = new Common::MemoryReadWriteStream(DisposeAfterUse::YES);
+ Archive archive(static_cast<Common::WriteStream*>(_memFile));
- for (Common::StringMap::const_iterator it = _variables.begin(); it != _variables.end(); ++it) {
- archive.writeString(it->_key);
- archive.writeString(it->_value);
- }
+ for (Common::StringMap::const_iterator it = _variables.begin(); it != _variables.end(); ++it) {
+ archive.writeString(it->_key);
+ archive.writeString(it->_value);
+ }
- archive.writeWORD(_actors.size());
- for (uint i = 0; i < _actors.size(); ++i) {
- archive.writeString(_actors[i]->getName());
- _actors[i]->saveState(archive);
- }
+ archive.writeWORD(_actors.size());
+ for (uint i = 0; i < _actors.size(); ++i) {
+ archive.writeString(_actors[i]->getName());
+ _actors[i]->saveState(archive);
+ }
}
void GamePage::unload() {
- _leadActor->setAction(_leadActor->findAction(kIdleAction));
+ _leadActor->setAction(_leadActor->findAction(kIdleAction));
- saveState();
- clear();
+ saveState();
+ clear();
- _isLoaded = false;
+ _isLoaded = false;
}
void GamePage::clear() {
- Page::clear();
- //_variables.clear(1);
+ Page::clear();
+ //_variables.clear(1);
- for (uint i = 0; i < _handlers.size(); ++i) {
- delete _handlers[i];
- }
+ for (uint i = 0; i < _handlers.size(); ++i) {
+ delete _handlers[i];
+ }
- _handlers.clear();
+ _handlers.clear();
- delete _cursorMgr; _cursorMgr = nullptr;
- delete _sequencer; _sequencer = nullptr;
- delete _walkMgr; _walkMgr = nullptr;
+ delete _cursorMgr; _cursorMgr = nullptr;
+ delete _sequencer; _sequencer = nullptr;
+ delete _walkMgr; _walkMgr = nullptr;
}
} // End of namespace Pink
diff --git a/engines/pink/objects/pages/game_page.h b/engines/pink/objects/pages/game_page.h
index 5aad7ac..1bae58d 100644
--- a/engines/pink/objects/pages/game_page.h
+++ b/engines/pink/objects/pages/game_page.h
@@ -36,39 +36,39 @@ class HandlerStartPage;
class GamePage : public Page {
public:
- GamePage();
- ~GamePage();
- virtual void toConsole();
- virtual void deserialize(Archive &archive);
+ GamePage();
+ ~GamePage();
+ virtual void toConsole();
+ virtual void deserialize(Archive &archive);
- virtual void load(Archive &archive);
- void unload();
- void loadManagers();
- void init(bool isLoadingSave);
+ virtual void load(Archive &archive);
+ void unload();
+ void loadManagers();
+ void init(bool isLoadingSave);
- PinkEngine *getGame();
- Sequencer *getSequencer();
- WalkMgr *getWalkMgr();
- Module *getModule() const;
+ PinkEngine *getGame();
+ Sequencer *getSequencer();
+ WalkMgr *getWalkMgr();
+ Module *getModule() const;
- bool checkValueOfVariable(const Common::String &variable, const Common::String &value);
- void setVariable(Common::String &variable, Common::String &value);
+ bool checkValueOfVariable(const Common::String &variable, const Common::String &value);
+ void setVariable(Common::String &variable, Common::String &value);
- virtual void clear();
+ virtual void clear();
private:
- bool initHandler();
- void loadState();
- void saveState();
+ bool initHandler();
+ void loadState();
+ void saveState();
- bool _isLoaded;
- Common::MemoryReadWriteStream *_memFile;
- Module *_module;
- CursorMgr *_cursorMgr;
- WalkMgr *_walkMgr;
- Sequencer *_sequencer;
- Array<HandlerStartPage*> _handlers;
- Common::StringMap _variables;
+ bool _isLoaded;
+ Common::MemoryReadWriteStream *_memFile;
+ Module *_module;
+ CursorMgr *_cursorMgr;
+ WalkMgr *_walkMgr;
+ Sequencer *_sequencer;
+ Array<HandlerStartPage*> _handlers;
+ Common::StringMap _variables;
};
}
diff --git a/engines/pink/objects/pages/page.cpp b/engines/pink/objects/pages/page.cpp
index 4b2f5f1..1465e17 100644
--- a/engines/pink/objects/pages/page.cpp
+++ b/engines/pink/objects/pages/page.cpp
@@ -27,14 +27,14 @@
namespace Pink {
Page::~Page() {
- clear();
+ clear();
}
void Page::load(Archive &archive) {
- archive.mapObject(this);
- NamedObject::deserialize(archive);
- archive.readString(); //skip directory
- _actors.deserialize(archive);
+ archive.mapObject(this);
+ NamedObject::deserialize(archive);
+ archive.readString(); //skip directory
+ _actors.deserialize(archive);
}
Actor *Page::findActor(const Common::String &name) {
@@ -47,52 +47,52 @@ Actor *Page::findActor(const Common::String &name) {
}
Sound *Page::loadSound(Common::String &fileName) {
- return _resMgr.loadSound(fileName);
+ return _resMgr.loadSound(fileName);
}
CelDecoder *Page::loadCel(Common::String &fileName) {
- return _resMgr.loadCEL(fileName);
+ return _resMgr.loadCEL(fileName);
}
void Page::toConsole() {
- for (uint i = 0; i < _actors.size(); ++i) {
- _actors[i]->toConsole();
- }
+ for (uint i = 0; i < _actors.size(); ++i) {
+ _actors[i]->toConsole();
+ }
}
void Page::init() {
- LeadActor::State state = _leadActor->getState();
- bool unk = (state == LeadActor::kInventory || state == LeadActor::kPDA);
+ LeadActor::State state = _leadActor->getState();
+ bool unk = (state == LeadActor::kInventory || state == LeadActor::kPDA);
- for (uint i = 0; i < _actors.size(); ++i) {
- _actors[i]->init(unk);
- }
+ for (uint i = 0; i < _actors.size(); ++i) {
+ _actors[i]->init(unk);
+ }
}
LeadActor *Page::getLeadActor() {
- return _leadActor;
+ return _leadActor;
}
void Page::clear() {
- for (uint i = 0; i < _actors.size(); ++i) {
- delete _actors[i];
- }
- _actors.clear();
- _resMgr.clear();
+ for (uint i = 0; i < _actors.size(); ++i) {
+ delete _actors[i];
+ }
+ _actors.clear();
+ _resMgr.clear();
}
void Page::pause() {
- for (uint i = 0; i < _actors.size(); ++i) {
- _actors[i]->pause();
- }
+ for (uint i = 0; i < _actors.size(); ++i) {
+ _actors[i]->pause();
+ }
}
void Page::unpause() {
- for (uint i = 0; i < _actors.size(); ++i) {
- _actors[i]->unpause();
- }
+ for (uint i = 0; i < _actors.size(); ++i) {
+ _actors[i]->unpause();
+ }
}
} // End of namespace Pink
diff --git a/engines/pink/objects/pages/page.h b/engines/pink/objects/pages/page.h
index 1d96a93..3b5708f 100644
--- a/engines/pink/objects/pages/page.h
+++ b/engines/pink/objects/pages/page.h
@@ -34,26 +34,26 @@ class LeadActor;
class Page : public NamedObject {
public:
- ~Page();
- virtual void toConsole();
+ ~Page();
+ virtual void toConsole();
- void load(Archive &archive);
- Actor *findActor(const Common::String &name);
- LeadActor *getLeadActor();
+ void load(Archive &archive);
+ Actor *findActor(const Common::String &name);
+ LeadActor *getLeadActor();
- Sound *loadSound(Common::String &fileName);
- CelDecoder *loadCel(Common::String &fileName);
+ Sound *loadSound(Common::String &fileName);
+ CelDecoder *loadCel(Common::String &fileName);
- virtual void clear();
- void pause();
- void unpause();
+ virtual void clear();
+ void pause();
+ void unpause();
protected:
- void init();
+ void init();
- Array<Actor*> _actors;
- ResourceMgr _resMgr;
- LeadActor *_leadActor;
+ Array<Actor*> _actors;
+ ResourceMgr _resMgr;
+ LeadActor *_leadActor;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/sequences/seq_timer.cpp b/engines/pink/objects/sequences/seq_timer.cpp
index 974056a..9f8ee31 100644
--- a/engines/pink/objects/sequences/seq_timer.cpp
+++ b/engines/pink/objects/sequences/seq_timer.cpp
@@ -32,30 +32,30 @@
namespace Pink {
SeqTimer::SeqTimer()
- : _updatesToMessage(0) {}
+ : _updatesToMessage(0) {}
void SeqTimer::deserialize(Archive &archive) {
- _actor = archive.readString();
- _period = archive.readDWORD();
- _range = archive.readDWORD();
- _sequencer = static_cast<Sequencer*>(archive.readObject());
+ _actor = archive.readString();
+ _period = archive.readDWORD();
+ _range = archive.readDWORD();
+ _sequencer = static_cast<Sequencer*>(archive.readObject());
}
void SeqTimer::toConsole() {
- debug("\tSeqTimer: _actor=%s _period=%u _range=%u", _actor.c_str(), _period, _range);
+ debug("\tSeqTimer: _actor=%s _period=%u _range=%u", _actor.c_str(), _period, _range);
}
void SeqTimer::update() {
- Common::RandomSource &rnd =_sequencer->_page->getGame()->getRnd();
- if (_updatesToMessage--)
- return;
+ Common::RandomSource &rnd =_sequencer->_page->getGame()->getRnd();
+ if (_updatesToMessage--)
+ return;
_updatesToMessage = _range ? _period + rnd.getRandomNumber(_range) : _period;
SupportingActor *actor = static_cast<SupportingActor*>(_sequencer->_page->findActor(_actor));
- if (actor && !_sequencer->findSequenceActorState(actor->getName())){
- actor->onTimerMessage();
- }
+ if (actor && !_sequencer->findSequenceActorState(actor->getName())){
+ actor->onTimerMessage();
+ }
}
} // End of namespace Pink
diff --git a/engines/pink/objects/sequences/seq_timer.h b/engines/pink/objects/sequences/seq_timer.h
index bfd6295..9af706f 100644
--- a/engines/pink/objects/sequences/seq_timer.h
+++ b/engines/pink/objects/sequences/seq_timer.h
@@ -31,17 +31,17 @@ class Sequencer;
class SeqTimer : public Object {
public:
- SeqTimer();
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
- virtual void update();
+ SeqTimer();
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
+ virtual void update();
private:
- Common::String _actor;
- Sequencer *_sequencer;
- int _period;
- int _range;
- int _updatesToMessage;
+ Common::String _actor;
+ Sequencer *_sequencer;
+ int _period;
+ int _range;
+ int _updatesToMessage;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp
index 1e08bb5..5eeae68 100644
--- a/engines/pink/objects/sequences/sequence.cpp
+++ b/engines/pink/objects/sequences/sequence.cpp
@@ -34,158 +34,158 @@
namespace Pink {
Sequence::Sequence()
- : _unk(0), _context(nullptr),
- _sequencer(nullptr) {}
+ : _unk(0), _context(nullptr),
+ _sequencer(nullptr) {}
Sequence::~Sequence() {
- for (uint i = 0; i < _items.size(); ++i) {
- delete _items[i];
- }
+ for (uint i = 0; i < _items.size(); ++i) {
+ delete _items[i];
+ }
}
void Sequence::deserialize(Archive &archive) {
- NamedObject::deserialize(archive);
- _sequencer = static_cast<Sequencer*>(archive.readObject());
- _items.deserialize(archive);
+ NamedObject::deserialize(archive);
+ _sequencer = static_cast<Sequencer*>(archive.readObject());
+ _items.deserialize(archive);
}
void Sequence::toConsole() {
- debug("\t\tSequence %s", _name.c_str());
- debug("\t\t\tItems:");
- for (uint i = 0; i < _items.size(); ++i) {
- _items[i]->toConsole();
- }
+ debug("\t\tSequence %s", _name.c_str());
+ debug("\t\t\tItems:");
+ for (uint i = 0; i < _items.size(); ++i) {
+ _items[i]->toConsole();
+ }
}
Common::Array<SequenceItem*> &Sequence::getItems() {
- return _items;
+ return _items;
}
void Sequence::setContext(SequenceContext *context) {
- _context = context;
+ _context = context;
}
void Sequence::init(int unk) {
- assert(_items.size());
- assert(dynamic_cast<SequenceItemLeader*>(_items[0])); // first item must always be a leader
- start(unk);
+ assert(_items.size());
+ assert(dynamic_cast<SequenceItemLeader*>(_items[0])); // first item must always be a leader
+ start(unk);
}
void Sequence::start(int unk) {
- if (_context->_nextItemIndex >= _items.size() || !_items[_context->_nextItemIndex]->execute(_context->_index, this, unk)){
- debug("Sequence %s ended", _name.c_str());
- end();
- return;
- }
+ if (_context->_nextItemIndex >= _items.size() || !_items[_context->_nextItemIndex]->execute(_context->_index, this, unk)){
+ debug("Sequence %s ended", _name.c_str());
+ end();
+ return;
+ }
- uint i;
- for (i = _context->_nextItemIndex + 1; i <_items.size(); ++i){
- if (_items[i]->isLeader())
- break;
- _items[i]->execute(_context->_index, this, unk);
- }
- _context->_nextItemIndex = i;
+ uint i;
+ for (i = _context->_nextItemIndex + 1; i <_items.size(); ++i){
+ if (_items[i]->isLeader())
+ break;
+ _items[i]->execute(_context->_index, this, unk);
+ }
+ _context->_nextItemIndex = i;
- Common::Array<SequenceActorState> &states = _context->_states;
- for (uint j = 0; j < states.size(); ++j) {
- states[j].check(_context->_index, this, unk);
- }
- _context->_index++;
+ Common::Array<SequenceActorState> &states = _context->_states;
+ for (uint j = 0; j < states.size(); ++j) {
+ states[j].check(_context->_index, this, unk);
+ }
+ _context->_index++;
}
void Sequence::update() {
- if (!_context->_actor->isPlaying()){
- debug("Sequence step ended");
- start(0);
- }
+ if (!_context->_actor->isPlaying()){
+ debug("Sequence step ended");
+ start(0);
+ }
}
void Sequence::end() {
- _context->_actor = 0;
- _unk = 1;
- _sequencer->removeContext(_context);
+ _context->_actor = 0;
+ _unk = 1;
+ _sequencer->removeContext(_context);
}
void Sequence::restart() {
- _context->setNextItemIndex(0);
- _context->clearActionsFromActorStates();
- start(0);
+ _context->setNextItemIndex(0);
+ _context->clearActionsFromActorStates();
+ start(0);
}
void Sequence::skipToLastSubSequence() {
- if (_unk && _context->getNextItemIndex() < _items.size()){
- int i = _items.size() - 1;
- while(i >= 0 && !_items[--i]->isLeader());
- assert(i >= 0);
- _context->setNextItemIndex(i);
- _context->clearActionsFromActorStates();
- skipItemsTo(i);
- start(0);
- }
+ if (_unk && _context->getNextItemIndex() < _items.size()){
+ int i = _items.size() - 1;
+ while(i >= 0 && !_items[--i]->isLeader());
+ assert(i >= 0);
+ _context->setNextItemIndex(i);
+ _context->clearActionsFromActorStates();
+ skipItemsTo(i);
+ start(0);
+ }
}
void Sequence::skipItemsTo(int index) {
- for(int i = 0; i < index; ++i){
- _items[i]->skip(this);
- }
+ for(int i = 0; i < index; ++i){
+ _items[i]->skip(this);
+ }
}
void Sequence::skipSubSequence() {
- if (_context->getNextItemIndex() < _context->getSequence()->getItems().size())
- _context->getSequence()->start(0);
+ if (_context->getNextItemIndex() < _context->getSequence()->getItems().size())
+ _context->getSequence()->start(0);
}
void SequenceAudio::deserialize(Archive &archive) {
- Sequence::deserialize(archive);
- _soundName = archive.readString();
+ Sequence::deserialize(archive);
+ _soundName = archive.readString();
}
void SequenceAudio::toConsole() {
- debug("\t\tSequenceAudio %s : _sound = %s", _name.c_str(), _soundName.c_str());
- debug("\t\t\tItems:");
- for (uint i = 0; i < _items.size(); ++i) {
- _items[i]->toConsole();
- }
+ debug("\t\tSequenceAudio %s : _sound = %s", _name.c_str(), _soundName.c_str());
+ debug("\t\t\tItems:");
+ for (uint i = 0; i < _items.size(); ++i) {
+ _items[i]->toConsole();
+ }
}
void SequenceAudio::start(int unk) {
- Sequence::start(unk);
- uint index = _context->getNextItemIndex();
- if (index < _items.size()) {
- SequenceItemLeaderAudio* leaderAudio = (SequenceItemLeaderAudio*) _items[index];
- _sample = leaderAudio->getSample();
- }
+ Sequence::start(unk);
+ uint index = _context->getNextItemIndex();
+ if (index < _items.size()) {
+ SequenceItemLeaderAudio* leaderAudio = (SequenceItemLeaderAudio*) _items[index];
+ _sample = leaderAudio->getSample();
+ }
}
void SequenceAudio::end() {
- delete _sound;
- _sound = nullptr;
- Sequence::end();
+ delete _sound;
+ _sound = nullptr;
+ Sequence::end();
}
void SequenceAudio::update() {
- if (!_sound->isPlaying())
- end();
- else if (_sample <= _sound->getCurrentSample()){
- start(0);
- }
+ if (!_sound->isPlaying())
+ end();
+ else if (_sample <= _sound->getCurrentSample()){
+ start(0);
+ }
}
void SequenceAudio::init(int unk) {
- _sample = 0;
- _sound = _sequencer->_page->loadSound(_soundName);
- _sound->play(Audio::Mixer::SoundType::kMusicSoundType, 100, 0);
- Sequence::init(unk);
+ _sample = 0;
+ _sound = _sequencer->_page->loadSound(_soundName);
+ _sound->play(Audio::Mixer::SoundType::kMusicSoundType, 100, 0);
+ Sequence::init(unk);
}
void SequenceAudio::restart() {
- _sound->play(Audio::Mixer::SoundType::kMusicSoundType, 100, 0);
- Sequence::restart();
+ _sound->play(Audio::Mixer::SoundType::kMusicSoundType, 100, 0);
+ Sequence::restart();
}
void SequenceAudio::skipToLastSubSequence() {
- end();
+ end();
}
} // End of namespace Pink
diff --git a/engines/pink/objects/sequences/sequence.h b/engines/pink/objects/sequences/sequence.h
index e40b016..f4c6c5a 100644
--- a/engines/pink/objects/sequences/sequence.h
+++ b/engines/pink/objects/sequences/sequence.h
@@ -33,54 +33,54 @@ class SequenceContext;
class Sequence : public NamedObject {
public:
- Sequence();
- virtual ~Sequence();
- virtual void deserialize(Archive &archive);
+ Sequence();
+ virtual ~Sequence();
+ virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ virtual void toConsole();
- Common::Array<SequenceItem*> &getItems();
+ Common::Array<SequenceItem*> &getItems();
- void setContext(SequenceContext *context);
- virtual void init(int unk);
- virtual void start(int unk);
- virtual void end();
+ void setContext(SequenceContext *context);
+ virtual void init(int unk);
+ virtual void start(int unk);
+ virtual void end();
- virtual void update();
- virtual void restart();
- virtual void skipSubSequence();
- virtual void skipToLastSubSequence();
- void skipItemsTo(int index);
+ virtual void update();
+ virtual void restart();
+ virtual void skipSubSequence();
+ virtual void skipToLastSubSequence();
+ void skipItemsTo(int index);
public:
- SequenceContext *_context;
- Sequencer *_sequencer;
- Array<SequenceItem*> _items;
- int _unk;
+ SequenceContext *_context;
+ Sequencer *_sequencer;
+ Array<SequenceItem*> _items;
+ int _unk;
};
class Sound;
class SequenceAudio : public Sequence {
public:
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
- virtual void init(int unk);
- virtual void start(int unk);
- virtual void end();
+ virtual void init(int unk);
+ virtual void start(int unk);
+ virtual void end();
- virtual void update();
- virtual void restart();
+ virtual void update();
+ virtual void restart();
- virtual void skipSubSequence() {};
- virtual void skipToLastSubSequence();
+ virtual void skipSubSequence() {};
+ virtual void skipToLastSubSequence();
private:
- Common::String _soundName;
- Sound *_sound;
- uint _sample;
+ Common::String _soundName;
+ Sound *_sound;
+ uint _sample;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/sequences/sequence_context.cpp b/engines/pink/objects/sequences/sequence_context.cpp
index 8ce85b7..48cbfed 100644
--- a/engines/pink/objects/sequences/sequence_context.cpp
+++ b/engines/pink/objects/sequences/sequence_context.cpp
@@ -32,62 +32,62 @@
namespace Pink {
SequenceActorState::SequenceActorState(const Common::String &name)
- :_actorName(name), _index(0)
+ :_actorName(name), _index(0)
{}
const Common::String &SequenceActorState::getActor() const {
- return _actorName;
+ return _actorName;
}
void SequenceActorState::check(int index, Sequence *sequence, bool unk) {
- Actor *actor = sequence->_sequencer->_page->findActor(_actorName);
- debug("%s %s", _actorName.c_str(), _actionName.c_str());
- if (_index != index && !_actionName.empty()){
- Action *action = actor->findAction(_actionName);
- if (actor->getAction() != action)
- actor->setAction(action, unk);
- }
+ Actor *actor = sequence->_sequencer->_page->findActor(_actorName);
+ debug("%s %s", _actorName.c_str(), _actionName.c_str());
+ if (_index != index && !_actionName.empty()){
+ Action *action = actor->findAction(_actionName);
+ if (actor->getAction() != action)
+ actor->setAction(action, unk);
+ }
}
SequenceContext::SequenceContext(Sequence *sequence, Sequencer *sequencer)
- : _sequence(sequence), _sequencer(sequencer),
- _nextItemIndex(0), _index(1), _actor(nullptr)
+ : _sequence(sequence), _sequencer(sequencer),
+ _nextItemIndex(0), _index(1), _actor(nullptr)
{
- sequence->setContext(this);
- Common::Array<SequenceItem*> &items = sequence->getItems();
- debug("SequenceContext for %s", _sequence->getName().c_str());
+ sequence->setContext(this);
+ Common::Array<SequenceItem*> &items = sequence->getItems();
+ debug("SequenceContext for %s", _sequence->getName().c_str());
- for (uint i = 0; i < items.size(); ++i) {
- bool found = 0;
- for (uint j = 0; j < _states.size(); ++j) {
- if (items[i]->getActor() == _states[j].getActor()){
- found = 1;
- break;
- }
- }
- if (!found) {
- debug(items[i]->getActor().c_str());
- _states.push_back({items[i]->getActor()});
- }
- }
+ for (uint i = 0; i < items.size(); ++i) {
+ bool found = 0;
+ for (uint j = 0; j < _states.size(); ++j) {
+ if (items[i]->getActor() == _states[j].getActor()){
+ found = 1;
+ break;
+ }
+ }
+ if (!found) {
+ debug(items[i]->getActor().c_str());
+ _states.push_back({items[i]->getActor()});
+ }
+ }
}
uint SequenceContext::getNextItemIndex() const {
- return _nextItemIndex;
+ return _nextItemIndex;
}
Sequence *SequenceContext::getSequence() const {
- return _sequence;
+ return _sequence;
}
void SequenceContext::clearActionsFromActorStates() {
- for (uint i = 0; i < _states.size(); ++i) {
- _states[i]._actionName.clear();
- }
+ for (uint i = 0; i < _states.size(); ++i) {
+ _states[i]._actionName.clear();
+ }
}
void SequenceContext::setNextItemIndex(int index) {
- _nextItemIndex = index;
+ _nextItemIndex = index;
}
} // End of namespace Pink
diff --git a/engines/pink/objects/sequences/sequence_context.h b/engines/pink/objects/sequences/sequence_context.h
index 334553c..e7acf09 100644
--- a/engines/pink/objects/sequences/sequence_context.h
+++ b/engines/pink/objects/sequences/sequence_context.h
@@ -32,37 +32,37 @@ class Sequencer;
class SequenceActorState {
public:
- SequenceActorState(const Common::String &name);
+ SequenceActorState(const Common::String &name);
- const Common::String &getActor() const;
- void check(int index, Sequence *sequence, bool unk);
+ const Common::String &getActor() const;
+ void check(int index, Sequence *sequence, bool unk);
public:
- Common::String _actorName;
- Common::String _actionName;
- int _index;
+ Common::String _actorName;
+ Common::String _actionName;
+ int _index;
};
class Actor;
class SequenceContext {
public:
- SequenceContext(Sequence *sequence, Sequencer* sequencer);
+ SequenceContext(Sequence *sequence, Sequencer* sequencer);
- uint getNextItemIndex() const;
- Sequence *getSequence() const;
+ uint getNextItemIndex() const;
+ Sequence *getSequence() const;
- void setNextItemIndex(int index);
+ void setNextItemIndex(int index);
- void clearActionsFromActorStates();
+ void clearActionsFromActorStates();
public:
- Sequence *_sequence;
- Sequencer *_sequencer;
- uint _nextItemIndex;
- Actor *_actor;
- Common::Array<SequenceActorState> _states;
- int _index;
+ Sequence *_sequence;
+ Sequencer *_sequencer;
+ uint _nextItemIndex;
+ Actor *_actor;
+ Common::Array<SequenceActorState> _states;
+ int _index;
};
}
diff --git a/engines/pink/objects/sequences/sequence_item.cpp b/engines/pink/objects/sequences/sequence_item.cpp
index a530390..7cc3f1b 100644
--- a/engines/pink/objects/sequences/sequence_item.cpp
+++ b/engines/pink/objects/sequences/sequence_item.cpp
@@ -34,77 +34,77 @@
namespace Pink {
void SequenceItem::deserialize(Archive &archive) {
- _actor = archive.readString();
- _action = archive.readString();
+ _actor = archive.readString();
+ _action = archive.readString();
}
void SequenceItem::toConsole() {
- debug("\t\t\t\tSequenceItem: _actor=%s, _action=%s", _actor.c_str(), _action.c_str());
+ debug("\t\t\t\tSequenceItem: _actor=%s, _action=%s", _actor.c_str(), _action.c_str());
}
const Common::String &SequenceItem::getActor() const {
- return _actor;
+ return _actor;
}
const Common::String &SequenceItem::getAction() const {
- return _action;
+ return _action;
}
bool SequenceItem::execute(int index, Sequence *sequence, bool unk2) {
- Actor *actor;
- Action *action;
- if (!(actor = sequence->_sequencer->_page->findActor(_actor)) ||
- !(action = actor->findAction(_action))) {
- return false;
- }
+ Actor *actor;
+ Action *action;
+ if (!(actor = sequence->_sequencer->_page->findActor(_actor)) ||
+ !(action = actor->findAction(_action))) {
+ return false;
+ }
- actor->setAction(action, unk2);
+ actor->setAction(action, unk2);
- SequenceActorState *state = sequence->_sequencer->findSequenceActorState(_actor);
- state->_index = index;
- sequence->_context->_actor = isLeader() ? actor : sequence->_context->_actor;
+ SequenceActorState *state = sequence->_sequencer->findSequenceActorState(_actor);
+ state->_index = index;
+ sequence->_context->_actor = isLeader() ? actor : sequence->_context->_actor;
- return true;
+ return true;
}
bool SequenceItem::isLeader() {
- return false;
+ return false;
}
bool SequenceItemLeader::isLeader() {
- return true;
+ return true;
}
void SequenceItemLeader::toConsole() {
- debug("\t\t\t\tSequenceItemLeader: _actor=%s, _action=%s", _actor.c_str(), _action.c_str());
+ debug("\t\t\t\tSequenceItemLeader: _actor=%s, _action=%s", _actor.c_str(), _action.c_str());
}
void SequenceItemLeaderAudio::deserialize(Archive &archive) {
- SequenceItem::deserialize(archive);
- _sample = archive.readDWORD();
+ SequenceItem::deserialize(archive);
+ _sample = archive.readDWORD();
}
void SequenceItemLeaderAudio::toConsole() {
- debug("\t\t\t\tSequenceItemLeaderAudio: _actor=%s, _action=%s _sample=%d", _actor.c_str(), _action.c_str(), _sample);
+ debug("\t\t\t\tSequenceItemLeaderAudio: _actor=%s, _action=%s _sample=%d", _actor.c_str(), _action.c_str(), _sample);
}
uint32 SequenceItemLeaderAudio::getSample() {
- return _sample;
+ return _sample;
}
bool SequenceItemDefaultAction::execute(int index, Sequence *sequence, bool unk2) {
- SequenceActorState *state = sequence->_sequencer->findSequenceActorState(_actor);
- state->_actionName = _action;
- return true;
+ SequenceActorState *state = sequence->_sequencer->findSequenceActorState(_actor);
+ state->_actionName = _action;
+ return true;
}
void SequenceItemDefaultAction::toConsole() {
- debug("\t\t\t\tSequenceItemDefaultAction: _actor=%s, _action=%s", _actor.c_str(), _action.c_str());
+ debug("\t\t\t\tSequenceItemDefaultAction: _actor=%s, _action=%s", _actor.c_str(), _action.c_str());
}
void SequenceItemDefaultAction::skip(Sequence *sequence) {
- execute(0, sequence, 1);
+ execute(0, sequence, 1);
}
} // End of namespace Pink
diff --git a/engines/pink/objects/sequences/sequence_item.h b/engines/pink/objects/sequences/sequence_item.h
index dd026a8..df22f86 100644
--- a/engines/pink/objects/sequences/sequence_item.h
+++ b/engines/pink/objects/sequences/sequence_item.h
@@ -31,53 +31,53 @@ class Sequence;
class SequenceItem : public Object {
public:
- virtual void deserialize(Archive &archive);
+ virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ virtual void toConsole();
- const Common::String &getActor() const;
- const Common::String &getAction() const;
+ const Common::String &getActor() const;
+ const Common::String &getAction() const;
- virtual bool execute(int index, Sequence *sequence, bool unk2);
- virtual bool isLeader();
- virtual void skip(Sequence *sequence) {};
+ virtual bool execute(int index, Sequence *sequence, bool unk2);
+ virtual bool isLeader();
+ virtual void skip(Sequence *sequence) {};
protected:
- Common::String _actor;
- Common::String _action;
+ Common::String _actor;
+ Common::String _action;
};
class SequenceItemLeader : public SequenceItem {
public:
- virtual void toConsole();
- virtual bool isLeader();
+ virtual void toConsole();
+ virtual bool isLeader();
};
class SequenceItemLeaderAudio : public SequenceItemLeader {
public:
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
- uint32 getSample();
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
+ uint32 getSample();
private:
- uint32 _sample;
+ uint32 _sample;
};
class SequenceItemDefaultAction : public SequenceItem {
public:
- virtual bool execute(int index, Sequence *sequence, bool unk2);
- virtual void skip(Sequence *sequence);
+ virtual bool execute(int index, Sequence *sequence, bool unk2);
+ virtual void skip(Sequence *sequence);
- virtual void toConsole();
+ virtual void toConsole();
};
/* not used in games but is implemented in engine
class SequenceItemSideEffects : public SequenceItemDefaultAction {
public:
- virtual void deserialize(Archive &archive);
- virtual bool execute(int unk, Sequence *sequence, bool unk2);
+ virtual void deserialize(Archive &archive);
+ virtual bool execute(int unk, Sequence *sequence, bool unk2);
private
- Common::Array<SideEffect*> _sideEffects
+ Common::Array<SideEffect*> _sideEffects
};
*/
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index 5644aa8..430c8c2 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -34,18 +34,18 @@
namespace Pink {
Sequencer::Sequencer(GamePage *page)
- : _context(nullptr), _page(page), _time(0)
+ : _context(nullptr), _page(page), _time(0)
{}
Sequencer::~Sequencer() {
- for (uint i = 0; i < _sequences.size(); ++i) {
- delete _sequences[i];
- }
+ for (uint i = 0; i < _sequences.size(); ++i) {
+ delete _sequences[i];
+ }
}
void Sequencer::deserialize(Archive &archive) {
- _sequences.deserialize(archive);
- _timers.deserialize(archive);
+ _sequences.deserialize(archive);
+ _timers.deserialize(archive);
}
Sequence *Sequencer::findSequence(const Common::String &name) {
@@ -57,75 +57,75 @@ Sequence *Sequencer::findSequence(const Common::String &name) {
}
void Sequencer::authorSequence(Sequence *sequence, bool unk) {
- if (_context){
+ if (_context){
- }
+ }
- if (sequence){
- _context = new SequenceContext(sequence, this);
- //unload array of unknown objects
- _currentSequenceName = sequence->getName();
- sequence->init(unk);
- }
- else _currentSequenceName.clear();
+ if (sequence){
+ _context = new SequenceContext(sequence, this);
+ //unload array of unknown objects
+ _currentSequenceName = sequence->getName();
+ sequence->init(unk);
+ }
+ else _currentSequenceName.clear();
}
void Sequencer::toConsole() {
- debug("Sequencer:");
- for (uint i = 0; i < _sequences.size(); ++i) {
- _sequences[i]->toConsole();
- }
- for (uint i = 0; i < _timers.size(); ++i) {
- _timers[i]->toConsole();
- }
+ debug("Sequencer:");
+ for (uint i = 0; i < _sequences.size(); ++i) {
+ _sequences[i]->toConsole();
+ }
+ for (uint i = 0; i < _timers.size(); ++i) {
+ _timers[i]->toConsole();
+ }
}
void Sequencer::update() {
- if (_context)
- _context->_sequence->update();
- updateTimers();
+ if (_context)
+ _context->_sequence->update();
+ updateTimers();
}
void Sequencer::removeContext(SequenceContext *context) {
- delete _context;
- _context = nullptr;
+ delete _context;
+ _context = nullptr;
}
void Sequencer::skipSubSequence() {
- if (_context)
- _context->getSequence()->skipSubSequence();
+ if (_context)
+ _context->getSequence()->skipSubSequence();
}
void Sequencer::restartSequence() {
- _context->getSequence()->restart();
+ _context->getSequence()->restart();
}
void Sequencer::skipToLastSubSequence() {
- _context->getSequence()->skipToLastSubSequence();
+ _context->getSequence()->skipToLastSubSequence();
}
void Sequencer::updateTimers() {
- uint time = _page->getGame()->getTotalPlayTime();
- if (time - _time <= kTimersUpdateTime) {
- return;
- }
-
- _time = time;
- for (uint i = 0; i < _timers.size(); ++i) {
- _timers[i]->update();
- }
+ uint time = _page->getGame()->getTotalPlayTime();
+ if (time - _time <= kTimersUpdateTime) {
+ return;
+ }
+
+ _time = time;
+ for (uint i = 0; i < _timers.size(); ++i) {
+ _timers[i]->update();
+ }
}
SequenceActorState *Sequencer::findSequenceActorState(const Common::String &name) {
- if (!_context)
- return nullptr;
+ if (!_context)
+ return nullptr;
- for (uint i = 0; i < _context->_states.size(); ++i) {
- if (_context->_states[i].getActor() == name)
- return &_context->_states[i];
- }
+ for (uint i = 0; i < _context->_states.size(); ++i) {
+ if (_context->_states[i].getActor() == name)
+ return &_context->_states[i];
+ }
- return nullptr;
+ return nullptr;
}
} // End of namespace Pink
diff --git a/engines/pink/objects/sequences/sequencer.h b/engines/pink/objects/sequences/sequencer.h
index 0213728..c1b957b 100644
--- a/engines/pink/objects/sequences/sequencer.h
+++ b/engines/pink/objects/sequences/sequencer.h
@@ -35,36 +35,36 @@ class SequenceActorState;
class Sequencer : public Object {
public:
- Sequencer(GamePage *page);
- ~Sequencer();
+ Sequencer(GamePage *page);
+ ~Sequencer();
- virtual void toConsole();
+ virtual void toConsole();
- virtual void deserialize(Archive &archive);
- Sequence* findSequence(const Common::String &name);
- SequenceActorState *findSequenceActorState(const Common::String &name);
+ virtual void deserialize(Archive &archive);
+ Sequence* findSequence(const Common::String &name);
+ SequenceActorState *findSequenceActorState(const Common::String &name);
- void authorSequence(Sequence *sequence, bool unk);
+ void authorSequence(Sequence *sequence, bool unk);
- void removeContext(SequenceContext *context);
+ void removeContext(SequenceContext *context);
- void update();
+ void update();
- void skipSubSequence();
- void restartSequence();
- void skipToLastSubSequence();
+ void skipSubSequence();
+ void restartSequence();
+ void skipToLastSubSequence();
public:
- void updateTimers();
+ void updateTimers();
- SequenceContext *_context;
- // context array
- Array<Sequence*> _sequences;
- Array<SeqTimer*> _timers;
+ SequenceContext *_context;
+ // context array
+ Array<Sequence*> _sequences;
+ Array<SeqTimer*> _timers;
Common::String _currentSequenceName;
GamePage *_page;
- uint _time;
+ uint _time;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/side_effect.cpp b/engines/pink/objects/side_effect.cpp
index 228b8d5..3bf67e1 100644
--- a/engines/pink/objects/side_effect.cpp
+++ b/engines/pink/objects/side_effect.cpp
@@ -33,59 +33,59 @@
namespace Pink {
void SideEffectExit::deserialize(Archive &archive) {
- _nextModule = archive.readString();
- _nextPage = archive.readString();
+ _nextModule = archive.readString();
+ _nextPage = archive.readString();
}
void SideEffectExit::execute(Actor *actor) {
- actor->getPage()->getLeadActor()->setNextExecutors(_nextModule, _nextPage);
+ actor->getPage()->getLeadActor()->setNextExecutors(_nextModule, _nextPage);
}
void SideEffectExit::toConsole() {
- debug("\t\tSideEffectExit: _nextModule=%s, _nextPage=%s", _nextModule.c_str(), _nextPage.c_str());
+ debug("\t\tSideEffectExit: _nextModule=%s, _nextPage=%s", _nextModule.c_str(), _nextPage.c_str());
}
void SideEffectLocation::deserialize(Archive &archive) {
- _location = archive.readString();
+ _location = archive.readString();
}
void SideEffectLocation::execute(Actor *actor) {
- WalkMgr *mgr = actor->getPage()->getWalkMgr();
- WalkLocation *location = mgr->findLocation(_location);
- if (location)
- mgr->setCurrentWayPoint(location);
+ WalkMgr *mgr = actor->getPage()->getWalkMgr();
+ WalkLocation *location = mgr->findLocation(_location);
+ if (location)
+ mgr->setCurrentWayPoint(location);
}
void SideEffectLocation::toConsole() {
- debug("\t\tSideEffectLocation: _location=%s", _location.c_str());
+ debug("\t\tSideEffectLocation: _location=%s", _location.c_str());
}
void SideEffectInventoryItemOwner::deserialize(Archive &archive) {
- _item = archive.readString();
- _owner = archive.readString();
+ _item = archive.readString();
+ _owner = archive.readString();
}
void SideEffectInventoryItemOwner::execute(Actor *actor) {
- InventoryMgr *mgr = actor->getPage()->getModule()->getInventoryMgr();
- InventoryItem *item = mgr->findInventoryItem(_item);
- mgr->setItemOwner(_owner, item);
+ InventoryMgr *mgr = actor->getPage()->getModule()->getInventoryMgr();
+ InventoryItem *item = mgr->findInventoryItem(_item);
+ mgr->setItemOwner(_owner, item);
}
void SideEffectInventoryItemOwner::toConsole() {
- debug("\t\tSideEffectInventoryItemOwner: _item=%s, _owner=%s", _item.c_str(), _owner.c_str());
+ debug("\t\tSideEffectInventoryItemOwner: _item=%s, _owner=%s", _item.c_str(), _owner.c_str());
}
void SideEffectVariable::deserialize(Pink::Archive &archive) {
- _name = archive.readString();
- _value = archive.readString();
+ _name = archive.readString();
+ _value = archive.readString();
}
void SideEffectGameVariable::execute(Actor *actor) {
- actor->getPage()->getGame()->setVariable(_name, _value);
+ actor->getPage()->getGame()->setVariable(_name, _value);
}
void SideEffectGameVariable::toConsole() {
- debug("\t\tSideEffectGameVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
+ debug("\t\tSideEffectGameVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
}
void SideEffectModuleVariable::execute(Actor *actor) {
@@ -93,39 +93,39 @@ void SideEffectModuleVariable::execute(Actor *actor) {
}
void SideEffectModuleVariable::toConsole() {
- debug("\t\tSideEffectModuleVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
+ debug("\t\tSideEffectModuleVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
}
void SideEffectPageVariable::execute(Actor *actor) {
- actor->getPage()->setVariable(_name, _value);
+ actor->getPage()->setVariable(_name, _value);
}
void SideEffectPageVariable::toConsole() {
- debug("\t\tSideEffectPageVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
+ debug("\t\tSideEffectPageVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
}
void SideEffectRandomPageVariable::deserialize(Archive &archive) {
- _name = archive.readString();
+ _name = archive.readString();
_values.deserialize(archive);
}
void SideEffectRandomPageVariable::execute(Actor *actor) {
- assert(!_values.empty());
+ assert(!_values.empty());
- Common::RandomSource &rnd = actor->getPage()->getGame()->getRnd();
- uint index = rnd.getRandomNumber(_values.size() - 1);
+ Common::RandomSource &rnd = actor->getPage()->getGame()->getRnd();
+ uint index = rnd.getRandomNumber(_values.size() - 1);
- actor->getPage()->setVariable(_name, _values[index]);
+ actor->getPage()->setVariable(_name, _values[index]);
}
void SideEffectRandomPageVariable::toConsole() {
- Common::String values("{");
- for (uint i = 0; i < _values.size(); ++i) {
- values += _values[i];
- values += ',';
- }
- values += '}';
- debug("\t\tSideEffectRandomPageVariable: _name=%s, _values=%s", _name.c_str(), values.c_str());
+ Common::String values("{");
+ for (uint i = 0; i < _values.size(); ++i) {
+ values += _values[i];
+ values += ',';
+ }
+ values += '}';
+ debug("\t\tSideEffectRandomPageVariable: _name=%s, _values=%s", _name.c_str(), values.c_str());
}
} // End of namespace Pink
diff --git a/engines/pink/objects/side_effect.h b/engines/pink/objects/side_effect.h
index 1a08d85..c917615 100644
--- a/engines/pink/objects/side_effect.h
+++ b/engines/pink/objects/side_effect.h
@@ -32,81 +32,81 @@ class Actor;
class SideEffect : public Object {
public:
- virtual void deserialize(Archive &archive) = 0;
- virtual void execute(Actor *actor) = 0;
+ virtual void deserialize(Archive &archive) = 0;
+ virtual void execute(Actor *actor) = 0;
};
class SideEffectExit : public SideEffect {
public:
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
- virtual void execute(Actor *actor);
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
+ virtual void execute(Actor *actor);
private:
- Common::String _nextModule;
- Common::String _nextPage;
- Common::StringMap map;
+ Common::String _nextModule;
+ Common::String _nextPage;
+ Common::StringMap map;
};
class SideEffectLocation : public SideEffect {
public:
- virtual void deserialize(Archive &archive);
- virtual void execute(Actor *actor);
- virtual void toConsole();
+ virtual void deserialize(Archive &archive);
+ virtual void execute(Actor *actor);
+ virtual void toConsole();
private:
- Common::String _location;
+ Common::String _location;
};
class SideEffectInventoryItemOwner : public SideEffect {
public:
- virtual void deserialize(Archive &archive);
- virtual void execute(Actor *actor);
- virtual void toConsole();
+ virtual void deserialize(Archive &archive);
+ virtual void execute(Actor *actor);
+ virtual void toConsole();
private:
- Common::String _item;
- Common::String _owner;
+ Common::String _item;
+ Common::String _owner;
};
class SideEffectVariable : public SideEffect {
public:
- virtual void deserialize(Archive &archive);
- virtual void execute(Actor *actor) = 0;
+ virtual void deserialize(Archive &archive);
+ virtual void execute(Actor *actor) = 0;
protected:
- Common::String _name;
- Common::String _value;
+ Common::String _name;
+ Common::String _value;
};
class SideEffectGameVariable : public SideEffectVariable {
public:
- virtual void toConsole();
- virtual void execute(Actor *actor);
+ virtual void toConsole();
+ virtual void execute(Actor *actor);
};
class SideEffectModuleVariable : public SideEffectVariable {
public:
- virtual void toConsole();
- virtual void execute(Actor *actor);
+ virtual void toConsole();
+ virtual void execute(Actor *actor);
};
class SideEffectPageVariable : public SideEffectVariable {
public:
- virtual void toConsole();
- virtual void execute(Actor *actor);
+ virtual void toConsole();
+ virtual void execute(Actor *actor);
};
class SideEffectRandomPageVariable : public SideEffect
{
public:
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
- virtual void execute(Actor *actor);
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
+ virtual void execute(Actor *actor);
private:
- Common::String _name;
- StringArray _values;
+ Common::String _name;
+ StringArray _values;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/walk/walk_location.cpp b/engines/pink/objects/walk/walk_location.cpp
index ec2dbc9..dd16882 100644
--- a/engines/pink/objects/walk/walk_location.cpp
+++ b/engines/pink/objects/walk/walk_location.cpp
@@ -28,16 +28,16 @@
namespace Pink {
void WalkLocation::deserialize(Pink::Archive &archive) {
- NamedObject::deserialize(archive);
- _neighbors.deserialize(archive);
+ NamedObject::deserialize(archive);
+ _neighbors.deserialize(archive);
}
void WalkLocation::toConsole() {
- debug("\tWalkLocation: _name =%s", _name.c_str());
- debug("\tNeighbors:");
- for (uint i = 0; i < _neighbors.size(); ++i) {
- debug("\t\t%s", _neighbors[i].c_str());
- }
+ debug("\tWalkLocation: _name =%s", _name.c_str());
+ debug("\tNeighbors:");
+ for (uint i = 0; i < _neighbors.size(); ++i) {
+ debug("\t\t%s", _neighbors[i].c_str());
+ }
}
} // End of namespace Pink
diff --git a/engines/pink/objects/walk/walk_location.h b/engines/pink/objects/walk/walk_location.h
index ef1cbab..1f77584 100644
--- a/engines/pink/objects/walk/walk_location.h
+++ b/engines/pink/objects/walk/walk_location.h
@@ -28,12 +28,12 @@ namespace Pink {
class WalkLocation : public NamedObject {
public:
- virtual void deserialize(Archive &archive);
- void toConsole() override;
- Common::StringArray &getNeigbors() { return _neighbors;}
+ virtual void deserialize(Archive &archive);
+ void toConsole() override;
+ Common::StringArray &getNeigbors() { return _neighbors;}
private:
- StringArray _neighbors;
+ StringArray _neighbors;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/walk/walk_mgr.cpp b/engines/pink/objects/walk/walk_mgr.cpp
index 989f69e..c9c28f0 100644
--- a/engines/pink/objects/walk/walk_mgr.cpp
+++ b/engines/pink/objects/walk/walk_mgr.cpp
@@ -30,14 +30,14 @@
namespace Pink {
WalkMgr::WalkMgr()
- : _isWalking(false), _leadActor(nullptr)
+ : _isWalking(false), _leadActor(nullptr)
{
}
void WalkMgr::deserialize(Pink::Archive &archive) {
- _leadActor = static_cast<LeadActor *>(archive.readObject());
- _locations.deserialize(archive);
+ _leadActor = static_cast<LeadActor *>(archive.readObject());
+ _locations.deserialize(archive);
}
WalkLocation *WalkMgr::findLocation(const Common::String &name) {
@@ -50,103 +50,103 @@ WalkLocation *WalkMgr::findLocation(const Common::String &name) {
}
void WalkMgr::toConsole() {
- debug("WalkMgr:");
- for (uint i = 0; i < _locations.size(); ++i) {
- _locations[i]->toConsole();
- }
+ debug("WalkMgr:");
+ for (uint i = 0; i < _locations.size(); ++i) {
+ _locations[i]->toConsole();
+ }
}
void WalkMgr::start(WalkLocation *destination) {
- if (_isWalking)
- return;
-
- if (_current.name.empty()) {
- _current.name = _locations[0]->getName();
- _current.coord = getLocationCoordinates(_locations[0]->getName());
- }
-
- _destination = destination;
-
- if (_current.name == _destination->getName()) {
- end();
- }
- else {
- _isWalking = true;
- WalkLocation *currentLocation = findLocation(_current.name);
- WalkShortestPath path(this);
- WalkLocation *nextLocation = path.next(currentLocation, _destination);
- initNextWayPoint(nextLocation);
- _leadActor->setAction(getWalkAction(), 0);
- }
+ if (_isWalking)
+ return;
+
+ if (_current.name.empty()) {
+ _current.name = _locations[0]->getName();
+ _current.coord = getLocationCoordinates(_locations[0]->getName());
+ }
+
+ _destination = destination;
+
+ if (_current.name == _destination->getName()) {
+ end();
+ }
+ else {
+ _isWalking = true;
+ WalkLocation *currentLocation = findLocation(_current.name);
+ WalkShortestPath path(this);
+ WalkLocation *nextLocation = path.next(currentLocation, _destination);
+ initNextWayPoint(nextLocation);
+ _leadActor->setAction(getWalkAction(), 0);
+ }
}
void WalkMgr::initNextWayPoint(WalkLocation *location) {
- _next.name = location->getName();
- _next.coord = getLocationCoordinates(location->getName());
+ _next.name = location->getName();
+ _next.coord = getLocationCoordinates(location->getName());
}
WalkAction *WalkMgr::getWalkAction() {
- Common::String walkActionName;
- if (_current.coord.z == _next.coord.z){
- if (_next.coord.x > _current.coord.x){
- walkActionName = Common::String::format("%dRight", _current.coord.z);
- }
- else walkActionName = Common::String::format("%dLeft", _next.coord.z);
- }
- else walkActionName = Common::String::format("%dTo%d", _current.coord.z, _next.coord.z);
+ Common::String walkActionName;
+ if (_current.coord.z == _next.coord.z){
+ if (_next.coord.x > _current.coord.x){
+ walkActionName = Common::String::format("%dRight", _current.coord.z);
+ }
+ else walkActionName = Common::String::format("%dLeft", _next.coord.z);
+ }
+ else walkActionName = Common::String::format("%dTo%d", _current.coord.z, _next.coord.z);
- Action *action = _leadActor->findAction(walkActionName);
+ Action *action = _leadActor->findAction(walkActionName);
- return static_cast<WalkAction*>(action);
+ return static_cast<WalkAction*>(action);
}
double WalkMgr::getLengthBetweenLocations(WalkLocation *first, WalkLocation *second) {
- Coordinates firstCoord = getLocationCoordinates(first->getName());
- Coordinates secondCoord = getLocationCoordinates(second->getName());
- return sqrt((secondCoord.x - firstCoord.x) * (secondCoord.x - firstCoord.x) +
- (secondCoord.y - firstCoord.y) * (secondCoord.y - firstCoord.y));
+ Coordinates firstCoord = getLocationCoordinates(first->getName());
+ Coordinates secondCoord = getLocationCoordinates(second->getName());
+ return sqrt((secondCoord.x - firstCoord.x) * (secondCoord.x - firstCoord.x) +
+ (secondCoord.y - firstCoord.y) * (secondCoord.y - firstCoord.y));
}
WalkMgr::Coordinates WalkMgr::getLocationCoordinates(const Common::String &locationName) {
- Coordinates coords;
- ActionCEL *action = static_cast<ActionCEL*>(_leadActor->findAction(locationName));
+ Coordinates coords;
+ ActionCEL *action = static_cast<ActionCEL*>(_leadActor->findAction(locationName));
- action->start(0);
- CelDecoder *decoder = action->getDecoder();
+ action->start(0);
+ CelDecoder *decoder = action->getDecoder();
- coords.x = decoder->getX() + decoder->getWidth() / 2;
- coords.y = decoder->getY() + decoder->getHeight() / 2;
- coords.z = action->getZ();
+ coords.x = decoder->getX() + decoder->getWidth() / 2;
+ coords.y = decoder->getY() + decoder->getHeight() / 2;
+ coords.z = action->getZ();
- action->end();
+ action->end();
- return coords;
+ return coords;
}
void WalkMgr::setCurrentWayPoint(WalkLocation *location) {
- _current.name = location->getName();
- _current.coord = getLocationCoordinates(_current.name);
+ _current.name = location->getName();
+ _current.coord = getLocationCoordinates(_current.name);
}
void WalkMgr::update() {
- if (_leadActor->isPlaying())
- return;
-
- WalkShortestPath path(this);
- _current = _next;
- WalkLocation *next = path.next(findLocation(_current.name), _destination);
- if (next){
- initNextWayPoint(next);
- _leadActor->setAction(getWalkAction(), 0);
- }
- else end();
+ if (_leadActor->isPlaying())
+ return;
+
+ WalkShortestPath path(this);
+ _current = _next;
+ WalkLocation *next = path.next(findLocation(_current.name), _destination);
+ if (next){
+ initNextWayPoint(next);
+ _leadActor->setAction(getWalkAction(), 0);
+ }
+ else end();
}
void WalkMgr::end() {
- _isWalking = false;
- _leadActor->onWalkEnd();
+ _isWalking = false;
+ _leadActor->onWalkEnd();
}
} // End of namespace Pink
diff --git a/engines/pink/objects/walk/walk_mgr.h b/engines/pink/objects/walk/walk_mgr.h
index 9947969..64bd16e 100644
--- a/engines/pink/objects/walk/walk_mgr.h
+++ b/engines/pink/objects/walk/walk_mgr.h
@@ -34,39 +34,39 @@ class WalkAction;
class WalkMgr : public Object {
public:
- WalkMgr();
- virtual void deserialize(Archive &archive);
- void toConsole() override;
+ WalkMgr();
+ virtual void deserialize(Archive &archive);
+ void toConsole() override;
- WalkLocation *findLocation(const Common::String &name);
- void start(WalkLocation *destination);
- void update();
+ WalkLocation *findLocation(const Common::String &name);
+ void start(WalkLocation *destination);
+ void update();
- double getLengthBetweenLocations(WalkLocation *first, WalkLocation *second);
- void setCurrentWayPoint(WalkLocation *location);
+ double getLengthBetweenLocations(WalkLocation *first, WalkLocation *second);
+ void setCurrentWayPoint(WalkLocation *location);
private:
- struct Coordinates {
- int x;
- int y;
- int z;
- };
- struct WayPoint {
- Common::String name;
- Coordinates coord;
- };
+ struct Coordinates {
+ int x;
+ int y;
+ int z;
+ };
+ struct WayPoint {
+ Common::String name;
+ Coordinates coord;
+ };
- Coordinates getLocationCoordinates(const Common::String &locationName);
- void end();
- void initNextWayPoint(WalkLocation *location);
- WalkAction *getWalkAction();
+ Coordinates getLocationCoordinates(const Common::String &locationName);
+ void end();
+ void initNextWayPoint(WalkLocation *location);
+ WalkAction *getWalkAction();
- LeadActor *_leadActor;
- WalkLocation *_destination;
- Array<WalkLocation*> _locations;
- WayPoint _current;
- WayPoint _next;
- bool _isWalking;
+ LeadActor *_leadActor;
+ WalkLocation *_destination;
+ Array<WalkLocation*> _locations;
+ WayPoint _current;
+ WayPoint _next;
+ bool _isWalking;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/walk/walk_shortest_path.cpp b/engines/pink/objects/walk/walk_shortest_path.cpp
index 2625323..376e638 100644
--- a/engines/pink/objects/walk/walk_shortest_path.cpp
+++ b/engines/pink/objects/walk/walk_shortest_path.cpp
@@ -27,134 +27,134 @@
namespace Pink {
WalkShortestPath::WalkShortestPath(WalkMgr *manager)
- : _manager(manager)
+ : _manager(manager)
{}
WalkLocation *WalkShortestPath::next(WalkLocation *start, WalkLocation *destination) {
- if (start == destination)
- return nullptr;
- add(start, 0.0, 0);
- while (build() != destination);
- return getNearestNeighbor(destination);
+ if (start == destination)
+ return nullptr;
+ add(start, 0.0, 0);
+ while (build() != destination);
+ return getNearestNeighbor(destination);
}
void WalkShortestPath::add(WalkLocation *wl, double val, WalkLocation *nearest) {
- _locations.push_back(wl);
- _visited.push_back(wl);
- _weight.push_back(val);
- _nearestNeigbor.push_back(nearest);
+ _locations.push_back(wl);
+ _visited.push_back(wl);
+ _weight.push_back(val);
+ _nearestNeigbor.push_back(nearest);
}
WalkLocation *WalkShortestPath::build() {
- WalkLocation *nearest = nullptr;
- WalkLocation *location = nullptr;
- double len = -1.0;
- addLocationsToVisit();
- for (uint i = 0; i < _toVisit.size(); ++i) {
- double curLen = getLengthToNearestNeigbor(_toVisit[i]);
- if (curLen < 0) {
- remove(_toVisit[i]);
- continue;
- }
- curLen += getWeight(_toVisit[i]);
- if (len < 0.0 || len > curLen) {
- len = curLen;
- location = _toVisit[i];
- nearest = getNearestNeighbor(_toVisit[i]);
- if (!nearest)
- nearest = findNearestNeighbor(_toVisit[i]);
- }
- }
-
- WalkLocation *neighbor = findNearestNeighbor(location);
- if (neighbor)
- add(neighbor, len, nearest);
-
- return neighbor;
+ WalkLocation *nearest = nullptr;
+ WalkLocation *location = nullptr;
+ double len = -1.0;
+ addLocationsToVisit();
+ for (uint i = 0; i < _toVisit.size(); ++i) {
+ double curLen = getLengthToNearestNeigbor(_toVisit[i]);
+ if (curLen < 0) {
+ remove(_toVisit[i]);
+ continue;
+ }
+ curLen += getWeight(_toVisit[i]);
+ if (len < 0.0 || len > curLen) {
+ len = curLen;
+ location = _toVisit[i];
+ nearest = getNearestNeighbor(_toVisit[i]);
+ if (!nearest)
+ nearest = findNearestNeighbor(_toVisit[i]);
+ }
+ }
+
+ WalkLocation *neighbor = findNearestNeighbor(location);
+ if (neighbor)
+ add(neighbor, len, nearest);
+
+ return neighbor;
}
WalkLocation *WalkShortestPath::getNearestNeighbor(WalkLocation *location) {
- for(uint i = 0; i < _visited.size(); ++i){
- if (_visited[i] == location)
- return _nearestNeigbor[i];
- }
+ for(uint i = 0; i < _visited.size(); ++i){
+ if (_visited[i] == location)
+ return _nearestNeigbor[i];
+ }
- return nullptr;
+ return nullptr;
}
void WalkShortestPath::addLocationsToVisit() {
- _toVisit.resize(_locations.size());
- for (uint i = 0; i < _locations.size(); ++i) {
- _toVisit[i] = _locations[i];
- }
+ _toVisit.resize(_locations.size());
+ for (uint i = 0; i < _locations.size(); ++i) {
+ _toVisit[i] = _locations[i];
+ }
}
double WalkShortestPath::getLengthToNearestNeigbor(WalkLocation *location) {
- double minLength = -1.0;
+ double minLength = -1.0;
Common::StringArray &neighbors = location->getNeigbors();
- for (uint i = 0; i < neighbors.size(); ++i) {
- WalkLocation *neighbor = _manager->findLocation(neighbors[i]);
- if (!isLocationVisited(neighbor)){
- double length = _manager->getLengthBetweenLocations(location, neighbor);
- if (minLength >= 0.0) {
- if (length < minLength)
- minLength = length;
- }
- else minLength = length;
- }
- }
-
- return minLength;
+ for (uint i = 0; i < neighbors.size(); ++i) {
+ WalkLocation *neighbor = _manager->findLocation(neighbors[i]);
+ if (!isLocationVisited(neighbor)){
+ double length = _manager->getLengthBetweenLocations(location, neighbor);
+ if (minLength >= 0.0) {
+ if (length < minLength)
+ minLength = length;
+ }
+ else minLength = length;
+ }
+ }
+
+ return minLength;
}
WalkLocation *WalkShortestPath::findNearestNeighbor(WalkLocation *location) {
- double minLength = -1.0;
- WalkLocation *nearest = nullptr;
- Common::StringArray &neighbors = location->getNeigbors();
- for (uint i = 0; i < neighbors.size(); ++i) {
- WalkLocation *neighbor = _manager->findLocation(neighbors[i]);
- if (!isLocationVisited(neighbor)){
- double length = _manager->getLengthBetweenLocations(location, neighbor);
- if (minLength >= 0.0) {
- if (length < minLength) {
- nearest = neighbor;
- minLength = length;
- }
- }
- else {
- nearest = neighbor;
- minLength = length;
- }
- }
- }
-
- return nearest;
+ double minLength = -1.0;
+ WalkLocation *nearest = nullptr;
+ Common::StringArray &neighbors = location->getNeigbors();
+ for (uint i = 0; i < neighbors.size(); ++i) {
+ WalkLocation *neighbor = _manager->findLocation(neighbors[i]);
+ if (!isLocationVisited(neighbor)){
+ double length = _manager->getLengthBetweenLocations(location, neighbor);
+ if (minLength >= 0.0) {
+ if (length < minLength) {
+ nearest = neighbor;
+ minLength = length;
+ }
+ }
+ else {
+ nearest = neighbor;
+ minLength = length;
+ }
+ }
+ }
+
+ return nearest;
}
double WalkShortestPath::getWeight(WalkLocation *location) {
- for (uint i = 0; i < _locations.size(); ++i) {
- if (_locations[i] == location)
- return _weight[i];
- }
- return 0.0;
+ for (uint i = 0; i < _locations.size(); ++i) {
+ if (_locations[i] == location)
+ return _weight[i];
+ }
+ return 0.0;
}
bool WalkShortestPath::isLocationVisited(WalkLocation *location) {
- for (uint i = 0; i < _visited.size(); ++i) {
- if (_visited[i] == location)
- return true;
- }
- return false;
+ for (uint i = 0; i < _visited.size(); ++i) {
+ if (_visited[i] == location)
+ return true;
+ }
+ return false;
}
void WalkShortestPath::remove(WalkLocation *location) {
- for (uint i = 0; i < _locations.size(); ++i) {
- if (_locations[i] == location){
- _locations.remove_at(i);
- _weight.remove_at(i);
- break;
- }
- }
+ for (uint i = 0; i < _locations.size(); ++i) {
+ if (_locations[i] == location){
+ _locations.remove_at(i);
+ _weight.remove_at(i);
+ break;
+ }
+ }
}
} // End of namespace Pink
diff --git a/engines/pink/objects/walk/walk_shortest_path.h b/engines/pink/objects/walk/walk_shortest_path.h
index deb7770..a3ec85d 100644
--- a/engines/pink/objects/walk/walk_shortest_path.h
+++ b/engines/pink/objects/walk/walk_shortest_path.h
@@ -32,27 +32,27 @@ class WalkMgr;
class WalkShortestPath {
public:
- WalkShortestPath(WalkMgr *manager);
- WalkLocation *next(WalkLocation *start, WalkLocation *destination);
+ WalkShortestPath(WalkMgr *manager);
+ WalkLocation *next(WalkLocation *start, WalkLocation *destination);
private:
- void add(WalkLocation *wl, double val, WalkLocation *nearest);
- void remove(WalkLocation *location);
- WalkLocation *build();
- WalkLocation *getNearestNeighbor(WalkLocation *location);
- WalkLocation *findNearestNeighbor(WalkLocation *location);
- double getLengthToNearestNeigbor(WalkLocation *location);
- double getWeight(WalkLocation *location);
- void addLocationsToVisit();
- bool isLocationVisited(WalkLocation *location);
-
-
- WalkMgr *_manager;
- Common::Array<WalkLocation*> _locations;
- Common::Array<WalkLocation*> _toVisit;
- Common::Array<double> _weight;
- Common::Array<WalkLocation*> _visited;
- Common::Array<WalkLocation*> _nearestNeigbor;
+ void add(WalkLocation *wl, double val, WalkLocation *nearest);
+ void remove(WalkLocation *location);
+ WalkLocation *build();
+ WalkLocation *getNearestNeighbor(WalkLocation *location);
+ WalkLocation *findNearestNeighbor(WalkLocation *location);
+ double getLengthToNearestNeigbor(WalkLocation *location);
+ double getWeight(WalkLocation *location);
+ void addLocationsToVisit();
+ bool isLocationVisited(WalkLocation *location);
+
+
+ WalkMgr *_manager;
+ Common::Array<WalkLocation*> _locations;
+ Common::Array<WalkLocation*> _toVisit;
+ Common::Array<double> _weight;
+ Common::Array<WalkLocation*> _visited;
+ Common::Array<WalkLocation*> _nearestNeigbor;
};
} // End of namespace Pink
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index f2b18aa..26de1cf 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -37,213 +37,213 @@
namespace Pink {
Pink::PinkEngine::PinkEngine(OSystem *system, const ADGameDescription *desc)
- : Engine(system), _console(nullptr), _rnd("pink"),
- _desc(*desc), _bro(nullptr), _module(nullptr), _director(_system)
+ : Engine(system), _console(nullptr), _rnd("pink"),
+ _desc(*desc), _bro(nullptr), _module(nullptr), _director(_system)
{
- debug("PinkEngine constructed");
+ debug("PinkEngine constructed");
- DebugMan.addDebugChannel(kPinkDebugGeneral, "general", "General issues");
- DebugMan.addDebugChannel(kPinkDebugLoadingObjects, "loading_objects", "Serializing objects from Orb");
- DebugMan.addDebugChannel(kPinkDebugLoadingResources, "loading_resources", "Loading resources data");
- DebugMan.addDebugChannel(kPinkDebugGraphics, "graphics", "Graphics handling");
- DebugMan.addDebugChannel(kPinkDebugSound, "sound", "Sound processing");
+ DebugMan.addDebugChannel(kPinkDebugGeneral, "general", "General issues");
+ DebugMan.addDebugChannel(kPinkDebugLoadingObjects, "loading_objects", "Serializing objects from Orb");
+ DebugMan.addDebugChannel(kPinkDebugLoadingResources, "loading_resources", "Loading resources data");
+ DebugMan.addDebugChannel(kPinkDebugGraphics, "graphics", "Graphics handling");
+ DebugMan.addDebugChannel(kPinkDebugSound, "sound", "Sound processing");
}
Pink::PinkEngine::~PinkEngine() {
- delete _console;
- delete _bro;
- for (uint i = 0; i < _modules.size(); ++i) {
- delete _modules[i];
- }
- for (uint j = 0; j < _cursors.size(); ++j) {
- delete _cursors[j];
- }
-
- DebugMan.clearAllDebugChannels();
+ delete _console;
+ delete _bro;
+ for (uint i = 0; i < _modules.size(); ++i) {
+ delete _modules[i];
+ }
+ for (uint j = 0; j < _cursors.size(); ++j) {
+ delete _cursors[j];
+ }
+
+ DebugMan.clearAllDebugChannels();
}
Common::Error PinkEngine::init() {
- debug("PinkEngine init");
+ debug("PinkEngine init");
- initGraphics(640, 480);
+ initGraphics(640, 480);
- _console = new Console(this);
+ _console = new Console(this);
- const Common::String orbName{_desc.filesDescriptions[0].fileName};
- const Common::String broName{_desc.filesDescriptions[1].fileName};
+ const Common::String orbName{_desc.filesDescriptions[0].fileName};
+ const Common::String broName{_desc.filesDescriptions[1].fileName};
- if (strcmp(_desc.gameId, kPeril) == 0){
- _bro = new BroFile();
- }
- else debug("This game doesn't need to use bro");
+ if (strcmp(_desc.gameId, kPeril) == 0){
+ _bro = new BroFile();
+ }
+ else debug("This game doesn't need to use bro");
- if (!_orb.open(orbName) || (_bro && !_bro->open(broName, _orb.getTimestamp()))){
- return Common::kNoGameDataFoundError;
- }
+ if (!_orb.open(orbName) || (_bro && !_bro->open(broName, _orb.getTimestamp()))){
+ return Common::kNoGameDataFoundError;
+ }
- if (!loadCursors())
- return Common::kNoGameDataFoundError;
+ if (!loadCursors())
+ return Common::kNoGameDataFoundError;
- setCursor(kLoadingCursor);
- _system->showMouse(1);
+ setCursor(kLoadingCursor);
+ _system->showMouse(1);
- _orb.loadGame(this);
+ _orb.loadGame(this);
- initModule(_modules[0]->getName(), kLoadingNewGame, "");
+ initModule(_modules[0]->getName(), kLoadingNewGame, "");
- return Common::kNoError;
+ return Common::kNoError;
}
Common::Error Pink::PinkEngine::run() {
- Common::Error error = init();
- if (error.getCode() != Common::kNoError)
- return error;
-
- while(!shouldQuit()){
- Common::Event event;
- while(_eventMan->pollEvent(event)){
- switch (event.type){
- case Common::EVENT_QUIT:
- case Common::EVENT_RTL:
- return Common::kNoError;
- case Common::EVENT_MOUSEMOVE:
- _actor->onMouseMove(event.mouse);
- break;
- case Common::EVENT_LBUTTONDOWN:
- _actor->onLeftButtonClick(event.mouse);
- break;
- case Common::EVENT_KEYDOWN:
- if (event.kbd.keycode == Common::KEYCODE_d)
- _director.showBounds = !_director.showBounds;
- else _actor->onKeyboardButtonClick(event.kbd.keycode);
- break;
-
- // don't know why it is used in original
- case Common::EVENT_LBUTTONUP:
- case Common::EVENT_RBUTTONDOWN:
- default:
- break;
- }
- }
-
-
- _actor->update();
- _director.update();
- _director.draw();
- _system->delayMillis(5);
- }
-
- return Common::kNoError;
+ Common::Error error = init();
+ if (error.getCode() != Common::kNoError)
+ return error;
+
+ while(!shouldQuit()){
+ Common::Event event;
+ while(_eventMan->pollEvent(event)){
+ switch (event.type){
+ case Common::EVENT_QUIT:
+ case Common::EVENT_RTL:
+ return Common::kNoError;
+ case Common::EVENT_MOUSEMOVE:
+ _actor->onMouseMove(event.mouse);
+ break;
+ case Common::EVENT_LBUTTONDOWN:
+ _actor->onLeftButtonClick(event.mouse);
+ break;
+ case Common::EVENT_KEYDOWN:
+ if (event.kbd.keycode == Common::KEYCODE_d)
+ _director.showBounds = !_director.showBounds;
+ else _actor->onKeyboardButtonClick(event.kbd.keycode);
+ break;
+
+ // don't know why it is used in original
+ case Common::EVENT_LBUTTONUP:
+ case Common::EVENT_RBUTTONDOWN:
+ default:
+ break;
+ }
+ }
+
+
+ _actor->update();
+ _director.update();
+ _director.draw();
+ _system->delayMillis(5);
+ }
+
+ return Common::kNoError;
}
void PinkEngine::load(Archive &archive) {
- archive.readString();
- archive.readString();
- _modules.deserialize(archive);
+ archive.readString();
+ archive.readString();
+ _modules.deserialize(archive);
}
void PinkEngine::initModule(const Common::String &moduleName, bool isLoadingFromSave, const Common::String &pageName) {
- if (_module) {
- for (uint i = 0; i < _modules.size(); ++i) {
- if (_module == _modules[i]){
- _modules[i] = new ModuleProxy(_module->getName());
-
- delete _module;
- _module = nullptr;
-
- break;
- }
- }
- }
-
- for (uint i = 0; i < _modules.size(); ++i) {
- if (_modules[i]->getName() == moduleName) {
- loadModule(i);
- _module = static_cast<Module*>(_modules[i]);
- _module->init(isLoadingFromSave, pageName);
- break;
- }
- }
+ if (_module) {
+ for (uint i = 0; i < _modules.size(); ++i) {
+ if (_module == _modules[i]){
+ _modules[i] = new ModuleProxy(_module->getName());
+
+ delete _module;
+ _module = nullptr;
+
+ break;
+ }
+ }
+ }
+
+ for (uint i = 0; i < _modules.size(); ++i) {
+ if (_modules[i]->getName() == moduleName) {
+ loadModule(i);
+ _module = static_cast<Module*>(_modules[i]);
+ _module->init(isLoadingFromSave, pageName);
+ break;
+ }
+ }
}
void PinkEngine::changeScene(GamePage *page) {
- setCursor(kLoadingCursor);
- if (!_nextModule.empty() && _nextModule.compareTo(_module->getName())) {
- initModule(_nextModule, kLoadingNewGame, _nextPage);
- }
- else {
- assert(!_nextPage.empty());
- _module->changePage(_nextPage);
- }
+ setCursor(kLoadingCursor);
+ if (!_nextModule.empty() && _nextModule.compareTo(_module->getName())) {
+ initModule(_nextModule, kLoadingNewGame, _nextPage);
+ }
+ else {
+ assert(!_nextPage.empty());
+ _module->changePage(_nextPage);
+ }
}
void PinkEngine::setNextExecutors(const Common::String &nextModule, const Common::String &nextPage) {
- _nextModule = nextModule;
- _nextPage = nextPage;
+ _nextModule = nextModule;
+ _nextPage = nextPage;
}
void PinkEngine::loadModule(int index) {
- Module *module = new Module(this, _modules[index]->getName());
+ Module *module = new Module(this, _modules[index]->getName());
- _orb.loadObject(module, module->getName());
+ _orb.loadObject(module, module->getName());
- delete _modules[index];
- _modules[index] = module;
+ delete _modules[index];
+ _modules[index] = module;
}
bool PinkEngine::checkValueOfVariable(Common::String &variable, Common::String &value) {
- if (!_variables.contains(variable))
- return value == kUndefined;
- return _variables[variable] == value;
+ if (!_variables.contains(variable))
+ return value == kUndefined;
+ return _variables[variable] == value;
}
void PinkEngine::setVariable(Common::String &variable, Common::String &value) {
- _variables[variable] = value;
+ _variables[variable] = value;
}
bool PinkEngine::loadCursors() {
- Common::PEResources exeResources;
- bool isPokus = !strcmp(_desc.gameId, kPokus);
- Common::String fileName = isPokus ? _desc.filesDescriptions[1].fileName : _desc.filesDescriptions[2].fileName;
- if (!exeResources.loadFromEXE(fileName))
- return false;
-
- _cursors.reserve(kCursorsCount);
-
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusLoadingCursorID));
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusExitForwardCursorID));
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusExitLeftCursorID));
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusExitRightCursorID));
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusClickableFirstCursorID));
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusClickableSecondCursorID));
-
- if (isPokus) {
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusClickableThirdCursorID));
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusNotClickableCursorID));
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusHoldingItemCursorID));
- }
- else {
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPerilClickableThirdCursorID));
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPerilNotClickableCursorID));
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPerilHoldingItemCursorID));
- }
-
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusPDAFirstCursorID));
-
- if (isPokus)
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusPDASecondCursorID));
- else
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPerilPDASecondCursorID));
-
- return true;
+ Common::PEResources exeResources;
+ bool isPokus = !strcmp(_desc.gameId, kPokus);
+ Common::String fileName = isPokus ? _desc.filesDescriptions[1].fileName : _desc.filesDescriptions[2].fileName;
+ if (!exeResources.loadFromEXE(fileName))
+ return false;
+
+ _cursors.reserve(kCursorsCount);
+
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusLoadingCursorID));
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusExitForwardCursorID));
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusExitLeftCursorID));
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusExitRightCursorID));
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusClickableFirstCursorID));
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusClickableSecondCursorID));
+
+ if (isPokus) {
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusClickableThirdCursorID));
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusNotClickableCursorID));
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusHoldingItemCursorID));
+ }
+ else {
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPerilClickableThirdCursorID));
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPerilNotClickableCursorID));
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPerilHoldingItemCursorID));
+ }
+
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusPDAFirstCursorID));
+
+ if (isPokus)
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusPDASecondCursorID));
+ else
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPerilPDASecondCursorID));
+
+ return true;
}
void PinkEngine::setCursor(uint cursorIndex) {
- Graphics::Cursor *cursor = _cursors[cursorIndex]->cursors[0].cursor;
- _system->setCursorPalette(cursor->getPalette(), cursor->getPaletteStartIndex(), cursor->getPaletteCount());
- _system->setMouseCursor(cursor->getSurface(), cursor->getWidth(), cursor->getHeight(),
- cursor->getHotspotX(), cursor->getHotspotY(), cursor->getKeyColor());
+ Graphics::Cursor *cursor = _cursors[cursorIndex]->cursors[0].cursor;
+ _system->setCursorPalette(cursor->getPalette(), cursor->getPaletteStartIndex(), cursor->getPaletteCount());
+ _system->setMouseCursor(cursor->getSurface(), cursor->getWidth(), cursor->getHeight(),
+ cursor->getHotspotX(), cursor->getHotspotY(), cursor->getKeyColor());
}
}
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index 710f590..98d962e 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -73,61 +73,61 @@ class GamePage;
class LeadActor;
enum {
- kPinkDebugGeneral = 1 << 0,
- kPinkDebugLoadingResources = 1 << 1,
- kPinkDebugLoadingObjects = 1 << 2,
- kPinkDebugGraphics = 1 << 3,
- kPinkDebugSound = 1 << 4
+ kPinkDebugGeneral = 1 << 0,
+ kPinkDebugLoadingResources = 1 << 1,
+ kPinkDebugLoadingObjects = 1 << 2,
+ kPinkDebugGraphics = 1 << 3,
+ kPinkDebugSound = 1 << 4
};
class PinkEngine : public Engine {
public:
- PinkEngine(OSystem *system, const ADGameDescription *desc);
- ~PinkEngine();
+ PinkEngine(OSystem *system, const ADGameDescription *desc);
+ ~PinkEngine();
- virtual Common::Error run();
+ virtual Common::Error run();
- void load(Archive &archive);
- void initModule(const Common::String &moduleName, bool isLoadingFromSave, const Common::String &pageName);
- void changeScene(GamePage *page);
+ void load(Archive &archive);
+ void initModule(const Common::String &moduleName, bool isLoadingFromSave, const Common::String &pageName);
+ void changeScene(GamePage *page);
- OrbFile *getOrb() { return &_orb; }
- BroFile *getBro() { return _bro; }
- Common::RandomSource &getRnd() { return _rnd; };
- Director *getDirector() { return &_director; }
+ OrbFile *getOrb() { return &_orb; }
+ BroFile *getBro() { return _bro; }
+ Common::RandomSource &getRnd() { return _rnd; };
+ Director *getDirector() { return &_director; }
- void setNextExecutors(const Common::String &nextModule, const Common::String &nextPage);
- void setLeadActor(LeadActor *actor) { _actor = actor; };
- void setCursor(uint cursorIndex);
+ void setNextExecutors(const Common::String &nextModule, const Common::String &nextPage);
+ void setLeadActor(LeadActor *actor) { _actor = actor; };
+ void setCursor(uint cursorIndex);
- void setVariable(Common::String &variable, Common::String &value);
- bool checkValueOfVariable(Common::String &variable, Common::String &value);
+ void setVariable(Common::String &variable, Common::String &value);
+ bool checkValueOfVariable(Common::String &variable, Common::String &value);
private:
- Common::Error init();
- bool loadCursors();
+ Common::Error init();
+ bool loadCursors();
- void loadModule(int index);
+ void loadModule(int index);
- Console *_console;
- Common::RandomSource _rnd;
- Common::Array<Graphics::WinCursorGroup*> _cursors;
+ Console *_console;
+ Common::RandomSource _rnd;
+ Common::Array<Graphics::WinCursorGroup*> _cursors;
- Common::String _nextModule;
- Common::String _nextPage;
+ Common::String _nextModule;
+ Common::String _nextPage;
- OrbFile _orb;
- BroFile *_bro;
+ OrbFile _orb;
+ BroFile *_bro;
- Director _director;
- LeadActor *_actor;
+ Director _director;
+ LeadActor *_actor;
- Module *_module;
- Array<NamedObject*> _modules;
+ Module *_module;
+ Array<NamedObject*> _modules;
- Common::StringMap _variables;
+ Common::StringMap _variables;
- const ADGameDescription _desc;
+ const ADGameDescription _desc;
};
} // End of namespace Pink
diff --git a/engines/pink/resource_mgr.cpp b/engines/pink/resource_mgr.cpp
index 9c72fc7..fbba382 100644
--- a/engines/pink/resource_mgr.cpp
+++ b/engines/pink/resource_mgr.cpp
@@ -32,59 +32,59 @@
namespace Pink {
ResourceMgr::ResourceMgr()
- : _game(nullptr), _resDescTable(nullptr),
- _resCount(0) {}
+ : _game(nullptr), _resDescTable(nullptr),
+ _resCount(0) {}
ResourceMgr::~ResourceMgr() {
- clear();
+ clear();
}
void ResourceMgr::init(PinkEngine *game, GamePage *page) {
- OrbFile *orb = game->getOrb();
- _game = game;
+ OrbFile *orb = game->getOrb();
+ _game = game;
- ObjectDescription *objDesc = orb->getObjDesc(page->getName().c_str());
- _resCount = objDesc->resourcesCount;
- orb->loadObject(page, objDesc);
- _resDescTable = orb->getResDescTable(objDesc);
+ ObjectDescription *objDesc = orb->getObjDesc(page->getName().c_str());
+ _resCount = objDesc->resourcesCount;
+ orb->loadObject(page, objDesc);
+ _resDescTable = orb->getResDescTable(objDesc);
}
Sound *ResourceMgr::loadSound(Common::String &name) {
- return new Sound(_game->_mixer, getResourceStream(name));
+ return new Sound(_game->_mixer, getResourceStream(name));
}
Common::SafeSeekableSubReadStream *ResourceMgr::getResourceStream(Common::String &name) {
- Common::SeekableReadStream *stream;
+ Common::SeekableReadStream *stream;
- ResourceDescription &desc = _resDescTable[0];
+ ResourceDescription &desc = _resDescTable[0];
for (uint i = 0; i < _resCount; ++i) {
if (name.compareToIgnoreCase(_resDescTable[i].name) == 0)
desc = _resDescTable[i];
}
- if (desc.inBro)
- stream = _game->getBro();
- else stream = _game->getOrb();
+ if (desc.inBro)
+ stream = _game->getBro();
+ else stream = _game->getOrb();
- stream->seek(desc.offset);
+ stream->seek(desc.offset);
- return new Common::SafeSeekableSubReadStream(stream, desc.offset,
- desc.offset + desc.size);
+ return new Common::SafeSeekableSubReadStream(stream, desc.offset,
+ desc.offset + desc.size);
}
PinkEngine *ResourceMgr::getGame() const {
- return _game;
+ return _game;
}
CelDecoder *ResourceMgr::loadCEL(Common::String &name) {
- CelDecoder *decoder = new CelDecoder();
- decoder->loadStream(getResourceStream(name));
- return decoder;
+ CelDecoder *decoder = new CelDecoder();
+ decoder->loadStream(getResourceStream(name));
+ return decoder;
}
void ResourceMgr::clear() {
- delete[] _resDescTable;
- _resDescTable = nullptr;
+ delete[] _resDescTable;
+ _resDescTable = nullptr;
}
} // End of namespace Pink
diff --git a/engines/pink/resource_mgr.h b/engines/pink/resource_mgr.h
index 4cef651..0b06e99 100644
--- a/engines/pink/resource_mgr.h
+++ b/engines/pink/resource_mgr.h
@@ -25,7 +25,7 @@
namespace Common {
class SafeSeekableSubReadStream;
- class String;
+ class String;
}
namespace Pink {
@@ -41,23 +41,23 @@ struct ResourceDescription;
class ResourceMgr {
public:
- ResourceMgr();
- ~ResourceMgr();
+ ResourceMgr();
+ ~ResourceMgr();
- void init(PinkEngine *game, GamePage *page);
- void clear();
+ void init(PinkEngine *game, GamePage *page);
+ void clear();
- //Common::String loadText(Common::String &name);
- Sound *loadSound(Common::String &name);
- CelDecoder *loadCEL(Common::String &name);
- PinkEngine *getGame() const;
+ //Common::String loadText(Common::String &name);
+ Sound *loadSound(Common::String &name);
+ CelDecoder *loadCEL(Common::String &name);
+ PinkEngine *getGame() const;
private:
- Common::SafeSeekableSubReadStream *getResourceStream(Common::String &name);
+ Common::SafeSeekableSubReadStream *getResourceStream(Common::String &name);
- PinkEngine *_game;
- ResourceDescription *_resDescTable;
- uint32 _resCount;
+ PinkEngine *_game;
+ ResourceDescription *_resDescTable;
+ uint32 _resCount;
};
} // End of namespace Pink
diff --git a/engines/pink/sound.cpp b/engines/pink/sound.cpp
index b4b8f2a..db6ff8c 100644
--- a/engines/pink/sound.cpp
+++ b/engines/pink/sound.cpp
@@ -31,54 +31,54 @@
namespace Pink {
Sound::Sound(Audio::Mixer *mixer, Common::SafeSeekableSubReadStream *stream)
- : _mixer(mixer), _fileStream(stream)
+ : _mixer(mixer), _fileStream(stream)
{
}
Sound::~Sound() {
- stop();
- delete _fileStream;
+ stop();
+ delete _fileStream;
}
bool Sound::isPlaying() {
- return _mixer->isSoundHandleActive(_handle);
+ return _mixer->isSoundHandleActive(_handle);
}
void Sound::pause() {
- _mixer->pauseHandle(_handle, true);
+ _mixer->pauseHandle(_handle, true);
}
void Sound::resume() {
- _mixer->pauseHandle(_handle, false);
+ _mixer->pauseHandle(_handle, false);
}
void Sound::stop() {
- _mixer->stopHandle(_handle);
+ _mixer->stopHandle(_handle);
}
void Sound::play(Audio::Mixer::SoundType type, int volume, bool isLoop) {
- // Vox files in pink have wave format.
- // RIFF (little-endian) data, WAVE audio, Microsoft PCM, 8 bit, mono 22050 Hz
- _mixer->stopHandle(_handle);
-
- _fileStream->seek(0);
- Audio::AudioStream *audioStream ;
- Audio::SeekableAudioStream *wavStream = Audio::makeWAVStream(_fileStream, DisposeAfterUse::NO);
- if (isLoop) {
- audioStream = Audio::makeLoopingAudioStream(wavStream, 0, 0, 0);
- }
- else audioStream = wavStream;
-
- _mixer->playStream(type, &_handle , audioStream, -1 , 50, 0, DisposeAfterUse::YES);
+ // Vox files in pink have wave format.
+ // RIFF (little-endian) data, WAVE audio, Microsoft PCM, 8 bit, mono 22050 Hz
+ _mixer->stopHandle(_handle);
+
+ _fileStream->seek(0);
+ Audio::AudioStream *audioStream ;
+ Audio::SeekableAudioStream *wavStream = Audio::makeWAVStream(_fileStream, DisposeAfterUse::NO);
+ if (isLoop) {
+ audioStream = Audio::makeLoopingAudioStream(wavStream, 0, 0, 0);
+ }
+ else audioStream = wavStream;
+
+ _mixer->playStream(type, &_handle , audioStream, -1 , 50, 0, DisposeAfterUse::YES);
}
void Sound::setBalance(int8 balance) {
- _mixer->setChannelBalance(_handle, balance);
+ _mixer->setChannelBalance(_handle, balance);
}
uint32 Sound::getCurrentSample() {
- return _mixer->getSoundElapsedTime(_handle) * kSampleRate / 1000;
+ return _mixer->getSoundElapsedTime(_handle) * kSampleRate / 1000;
}
} // End of namespace Pink
diff --git a/engines/pink/sound.h b/engines/pink/sound.h
index f6207f4..9d70074 100644
--- a/engines/pink/sound.h
+++ b/engines/pink/sound.h
@@ -38,24 +38,24 @@ namespace Pink {
class Sound {
public:
- Sound(Audio::Mixer *mixer, Common::SafeSeekableSubReadStream *stream);
- ~Sound();
+ Sound(Audio::Mixer *mixer, Common::SafeSeekableSubReadStream *stream);
+ ~Sound();
- void play(Audio::Mixer::SoundType type, int volume, bool isLoop);
+ void play(Audio::Mixer::SoundType type, int volume, bool isLoop);
- bool isPlaying();
+ bool isPlaying();
- void pause();
- void resume();
- void stop();
+ void pause();
+ void resume();
+ void stop();
- uint32 getCurrentSample();
- void setBalance(int8 balance);
+ uint32 getCurrentSample();
+ void setBalance(int8 balance);
private:
- Audio::Mixer *_mixer;
- Audio::SoundHandle _handle;
- Common::SafeSeekableSubReadStream *_fileStream;
+ Audio::Mixer *_mixer;
+ Audio::SoundHandle _handle;
+ Common::SafeSeekableSubReadStream *_fileStream;
};
} // End of namespace Pink
Commit: 22e25ed890bc4dd843939d580f42f71db64a9352
https://github.com/scummvm/scummvm/commit/22e25ed890bc4dd843939d580f42f71db64a9352
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix module.mk
Changed paths:
engines/pink/module.mk
diff --git a/engines/pink/module.mk b/engines/pink/module.mk
index 94ba205..7bd7589 100644
--- a/engines/pink/module.mk
+++ b/engines/pink/module.mk
@@ -3,7 +3,6 @@ MODULE := engines/pink
MODULE_OBJS = \
archive.o \
cel_decoder.o \
- console.o \
cursor_mgr.o \
detection.o \
director.o \
@@ -29,6 +28,7 @@ MODULE_OBJS = \
objects/actions/walk_action.o \
objects/actors/actor.o \
objects/actors/lead_actor.o \
+ objects/actors/pda_button_actor.o \
objects/actors/supporting_actor.o \
objects/handlers/handler.o \
objects/handlers/handler_mgr.o \
@@ -42,7 +42,7 @@ MODULE_OBJS = \
objects/sequences/sequencer.o \
objects/walk/walk_mgr.o \
objects/walk/walk_location.o \
- objects/walk/walk_shortest_path.o \
+ objects/walk/walk_shortest_path.o
# This module can be built as a plugin
ifeq ($(ENABLE_PINK), DYNAMIC_PLUGIN)
Commit: f6dd0f2f49c1a33ab5563ae1c3a7f7cf272cc8eb
https://github.com/scummvm/scummvm/commit/f6dd0f2f49c1a33ab5563ae1c3a7f7cf272cc8eb
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: remove commas at the end of enumerator lists
Changed paths:
engines/pink/constants.h
engines/pink/objects/inventory.h
diff --git a/engines/pink/constants.h b/engines/pink/constants.h
index 9cc624c..7e945f8 100644
--- a/engines/pink/constants.h
+++ b/engines/pink/constants.h
@@ -136,7 +136,7 @@ enum {
kOrbMajorVersion = 2,
kOrbMinorVersion = 0,
kBroMajorVersion = 1,
- kBroMinorVersion = 0,
+ kBroMinorVersion = 0
};
enum {
diff --git a/engines/pink/objects/inventory.h b/engines/pink/objects/inventory.h
index 02bf9d6..a6f67c6 100644
--- a/engines/pink/objects/inventory.h
+++ b/engines/pink/objects/inventory.h
@@ -70,7 +70,7 @@ private:
void close();
enum Direction {
kLeft = 0,
- kRight = 1,
+ kRight = 1
};
void showNextItem(bool direction);
@@ -90,7 +90,7 @@ private:
kIdle = 0,
kOpening = 1,
kReady = 2,
- kClosing = 3,
+ kClosing = 3
} _state;
bool _isClickedOnItem;
};
Commit: d3d7a9280081ad6711b8f5ae09100b4368768faf
https://github.com/scummvm/scummvm/commit/d3d7a9280081ad6711b8f5ae09100b4368768faf
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix compilation error
Changed paths:
engines/pink/objects/actions/action_play_with_sfx.cpp
engines/pink/objects/actions/action_sound.cpp
engines/pink/objects/actions/action_talk.cpp
engines/pink/objects/sequences/sequence.cpp
engines/pink/pink.cpp
diff --git a/engines/pink/objects/actions/action_play_with_sfx.cpp b/engines/pink/objects/actions/action_play_with_sfx.cpp
index 9cb8503..62488ac 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.cpp
+++ b/engines/pink/objects/actions/action_play_with_sfx.cpp
@@ -95,7 +95,7 @@ void ActionSfx::play(GamePage *page) {
_sound = page->loadSound(_sfxName);
if (!_sound->isPlaying())
- _sound->play(Audio::Mixer::SoundType::kSFXSoundType, _volume, 0);
+ _sound->play(Audio::Mixer::kSFXSoundType, _volume, 0);
}
ActionSfx::~ActionSfx() {
diff --git a/engines/pink/objects/actions/action_sound.cpp b/engines/pink/objects/actions/action_sound.cpp
index e94251d..2e69228 100644
--- a/engines/pink/objects/actions/action_sound.cpp
+++ b/engines/pink/objects/actions/action_sound.cpp
@@ -56,8 +56,8 @@ void ActionSound::start(bool unk) {
assert(!_sound);
_sound = _actor->getPage()->loadSound(_fileName);
- Audio::Mixer::SoundType soundType = _isBackground ? Audio::Mixer::SoundType::kMusicSoundType
- : Audio::Mixer::SoundType::kSpeechSoundType;
+ Audio::Mixer::SoundType soundType = _isBackground ? Audio::Mixer::kMusicSoundType
+ : Audio::Mixer::kSpeechSoundType;
Director *director = _actor->getPage()->getGame()->getDirector();
director->addSound(this);
diff --git a/engines/pink/objects/actions/action_talk.cpp b/engines/pink/objects/actions/action_talk.cpp
index 1f55de1..555e6fe 100644
--- a/engines/pink/objects/actions/action_talk.cpp
+++ b/engines/pink/objects/actions/action_talk.cpp
@@ -43,7 +43,7 @@ void ActionTalk::toConsole() {
void ActionTalk::onStart() {
ActionPlay::onStart();
_sound = _actor->getPage()->loadSound(_vox);
- _sound->play(Audio::Mixer::SoundType::kSpeechSoundType, 100, 0);
+ _sound->play(Audio::Mixer::kSpeechSoundType, 100, 0);
}
void ActionTalk::update() {
diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp
index 5eeae68..f388b7c 100644
--- a/engines/pink/objects/sequences/sequence.cpp
+++ b/engines/pink/objects/sequences/sequence.cpp
@@ -175,12 +175,12 @@ void SequenceAudio::update() {
void SequenceAudio::init(int unk) {
_sample = 0;
_sound = _sequencer->_page->loadSound(_soundName);
- _sound->play(Audio::Mixer::SoundType::kMusicSoundType, 100, 0);
+ _sound->play(Audio::Mixer::kMusicSoundType, 100, 0);
Sequence::init(unk);
}
void SequenceAudio::restart() {
- _sound->play(Audio::Mixer::SoundType::kMusicSoundType, 100, 0);
+ _sound->play(Audio::Mixer::kMusicSoundType, 100, 0);
Sequence::restart();
}
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index 26de1cf..74b38cf 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -69,8 +69,8 @@ Common::Error PinkEngine::init() {
_console = new Console(this);
- const Common::String orbName{_desc.filesDescriptions[0].fileName};
- const Common::String broName{_desc.filesDescriptions[1].fileName};
+ const Common::String orbName = _desc.filesDescriptions[0].fileName;
+ const Common::String broName = _desc.filesDescriptions[1].fileName;
if (strcmp(_desc.gameId, kPeril) == 0){
_bro = new BroFile();
Commit: 2bb2834782142dbece2be2f5cb3416d3ee5395ae
https://github.com/scummvm/scummvm/commit/2bb2834782142dbece2be2f5cb3416d3ee5395ae
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix compiler warning about UB
Changed paths:
engines/pink/objects/inventory.cpp
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
index c2ad3bb..677b18f 100644
--- a/engines/pink/objects/inventory.cpp
+++ b/engines/pink/objects/inventory.cpp
@@ -187,7 +187,7 @@ void InventoryMgr::showNextItem(bool direction) {
uint i = 0;
do {
- index = (direction == kLeft) ? --index : ++index;
+ index = (direction == kLeft) ? index - 1 : index + 1;
} while(_items[index % _items.size()]->getCurrentOwner() != _item->getCurrentOwner() && ++i < _items.size());
if (i != _items.size()) {
Commit: d7f09d4c3cbfca7472856ca5a3e14a8e55255451
https://github.com/scummvm/scummvm/commit/d7f09d4c3cbfca7472856ca5a3e14a8e55255451
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: remove extended initializer lists
Changed paths:
engines/pink/cel_decoder.cpp
engines/pink/objects/sequences/sequence_context.cpp
diff --git a/engines/pink/cel_decoder.cpp b/engines/pink/cel_decoder.cpp
index 0387873..7a2a91e 100644
--- a/engines/pink/cel_decoder.cpp
+++ b/engines/pink/cel_decoder.cpp
@@ -85,7 +85,7 @@ const Graphics::Surface *CelDecoder::getCurrentFrame() {
Common::Point CelDecoder::getCenter() {
CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
if (!track)
- return {0,0};
+ return Common::Point(0, 0);
return track->getCenter();
}
diff --git a/engines/pink/objects/sequences/sequence_context.cpp b/engines/pink/objects/sequences/sequence_context.cpp
index 48cbfed..65911ec 100644
--- a/engines/pink/objects/sequences/sequence_context.cpp
+++ b/engines/pink/objects/sequences/sequence_context.cpp
@@ -67,7 +67,7 @@ SequenceContext::SequenceContext(Sequence *sequence, Sequencer *sequencer)
}
if (!found) {
debug(items[i]->getActor().c_str());
- _states.push_back({items[i]->getActor()});
+ _states.push_back(SequenceActorState(items[i]->getActor()));
}
}
}
Commit: e98c14c3d7d790f6ba77ab4d4925b608c55e2e22
https://github.com/scummvm/scummvm/commit/e98c14c3d7d790f6ba77ab4d4925b608c55e2e22
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix formatting
Changed paths:
engines/pink/archive.cpp
engines/pink/cel_decoder.cpp
engines/pink/cursor_mgr.cpp
engines/pink/detection.cpp
engines/pink/detection_tables.h
engines/pink/director.cpp
engines/pink/director.h
engines/pink/file.cpp
engines/pink/objects/actions/action.h
engines/pink/objects/actions/action_cel.cpp
engines/pink/objects/actions/action_cel.h
engines/pink/objects/actions/action_loop.cpp
engines/pink/objects/actions/action_play.cpp
engines/pink/objects/actions/action_play_with_sfx.cpp
engines/pink/objects/actions/action_play_with_sfx.h
engines/pink/objects/actions/action_sound.cpp
engines/pink/objects/actors/actor.cpp
engines/pink/objects/actors/actor.h
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/actors/supporting_actor.cpp
engines/pink/objects/actors/supporting_actor.h
engines/pink/objects/handlers/handler.cpp
engines/pink/objects/handlers/handler.h
engines/pink/objects/handlers/handler_mgr.h
engines/pink/objects/handlers/handler_timer.cpp
engines/pink/objects/inventory.cpp
engines/pink/objects/inventory.h
engines/pink/objects/module.cpp
engines/pink/objects/module.h
engines/pink/objects/object.cpp
engines/pink/objects/object.h
engines/pink/objects/pages/game_page.cpp
engines/pink/objects/pages/game_page.h
engines/pink/objects/pages/page.h
engines/pink/objects/sequences/seq_timer.cpp
engines/pink/objects/sequences/sequence.cpp
engines/pink/objects/sequences/sequence.h
engines/pink/objects/sequences/sequence_context.cpp
engines/pink/objects/sequences/sequence_item.cpp
engines/pink/objects/sequences/sequencer.cpp
engines/pink/objects/sequences/sequencer.h
engines/pink/objects/side_effect.h
engines/pink/objects/walk/walk_mgr.cpp
engines/pink/objects/walk/walk_mgr.h
engines/pink/objects/walk/walk_shortest_path.cpp
engines/pink/objects/walk/walk_shortest_path.h
engines/pink/pink.cpp
engines/pink/pink.h
engines/pink/resource_mgr.cpp
engines/pink/sound.cpp
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp
index 36eda11..beec60b 100644
--- a/engines/pink/archive.cpp
+++ b/engines/pink/archive.cpp
@@ -212,22 +212,17 @@ static Object* createObject(int objectId){
}
Archive::Archive(Common::SeekableReadStream *stream)
- : _readStream(stream), _writeStream(nullptr)
-{
+ : _readStream(stream), _writeStream(nullptr) {
_objectMap.push_back(0);
_objectIdMap.push_back(kNullObject);
}
Archive::Archive(Common::WriteStream *stream)
- : _writeStream(stream), _readStream(nullptr)
-{
+ : _writeStream(stream), _readStream(nullptr) {
_objectMap.push_back(0);
_objectIdMap.push_back(kNullObject);
}
-Archive::~Archive()
-{}
-
void Archive::mapObject(Object *obj) {
_objectMap.push_back(obj);
_objectIdMap.push_back(0);
@@ -246,9 +241,8 @@ Object *Archive::readObject() {
bool isCopyReturned;
Object *res = parseObject(isCopyReturned);
- if (res && !isCopyReturned) {
+ if (res && !isCopyReturned)
res->deserialize(*this);
- }
return res;
}
diff --git a/engines/pink/cel_decoder.cpp b/engines/pink/cel_decoder.cpp
index 7a2a91e..0bdba49 100644
--- a/engines/pink/cel_decoder.cpp
+++ b/engines/pink/cel_decoder.cpp
@@ -129,15 +129,15 @@ void CelDecoder::CelVideoTrack::readPrefixChunk() {
uint16 subchunkType = _fileStream->readUint16LE();
switch (subchunkType) {
- case CEL_DATA:
- _fileStream->readUint16LE();
- _center.x = _fileStream->readUint16LE();
- _center.y = _fileStream->readUint16LE();
- break;
- default:
- error("Unknown subchunk type");
- _fileStream->skip(subchunkSize - 6);
- break;
+ case CEL_DATA:
+ _fileStream->readUint16LE();
+ _center.x = _fileStream->readUint16LE();
+ _center.y = _fileStream->readUint16LE();
+ break;
+ default:
+ error("Unknown subchunk type");
+ _fileStream->skip(subchunkSize - 6);
+ break;
}
_rect = Common::Rect::center(_center.x, _center.y, _surface->w, _surface->h);
}
@@ -151,9 +151,8 @@ void CelDecoder::CelVideoTrack::readHeader() {
_offsetFrame1 = _fileStream->readUint32LE();
_offsetFrame2 = _fileStream->readUint32LE();
- if (_offsetFrame1 > 0x80) {
+ if (_offsetFrame1 > 0x80)
readPrefixChunk();
- }
_fileStream->seek(_offsetFrame1);
}
@@ -190,12 +189,12 @@ void CelDecoder::CelVideoTrack::skipFrame() {
uint16 frameType = _fileStream->readUint16LE();
switch (frameType) {
- case FRAME_TYPE:
- handleFrame();
- break;
- default:
- error("FlicDecoder::decodeFrame(): unknown main chunk type (type = 0x%02X)", frameType);
- break;
+ case FRAME_TYPE:
+ handleFrame();
+ break;
+ default:
+ error("FlicDecoder::decodeFrame(): unknown main chunk type (type = 0x%02X)", frameType);
+ break;
}
_curFrame++;
@@ -218,12 +217,12 @@ const Graphics::Surface *CelDecoder::CelVideoTrack::decodeNextFrame() {
uint16 frameType = _fileStream->readUint16LE();
switch (frameType) {
- case FRAME_TYPE:
- handleFrame();
- break;
- default:
- error("FlicDecoder::decodeFrame(): unknown main chunk type (type = 0x%02X)", frameType);
- break;
+ case FRAME_TYPE:
+ handleFrame();
+ break;
+ default:
+ error("FlicDecoder::decodeFrame(): unknown main chunk type (type = 0x%02X)", frameType);
+ break;
}
_curFrame++;
diff --git a/engines/pink/cursor_mgr.cpp b/engines/pink/cursor_mgr.cpp
index 81fb61a..d15f695 100644
--- a/engines/pink/cursor_mgr.cpp
+++ b/engines/pink/cursor_mgr.cpp
@@ -31,8 +31,7 @@ namespace Pink {
CursorMgr::CursorMgr(PinkEngine *game, GamePage *page)
: _actor(nullptr), _page(page), _game(game),
- _isPlayingAnimation(0), _firstFrameIndex(0)
-{}
+ _isPlayingAnimation(0), _firstFrameIndex(0) {}
CursorMgr::~CursorMgr() {}
@@ -40,8 +39,7 @@ void CursorMgr::setCursor(uint index, Common::Point point, const Common::String
if (index == kClickableFirstFrameCursor) {
startAnimation(index);
return hideItem();
- }
- else if (index != kHoldingItemCursor){
+ } else if (index != kHoldingItemCursor){
if (index != kPDASecondCursor) {
_game->setCursor(index);
@@ -67,8 +65,7 @@ void CursorMgr::setCursor(uint index, Common::Point point, const Common::String
CelDecoder *decoder = static_cast<ActionCEL*>(action)->getDecoder();
decoder->setX(point.x);
decoder->setY(point.y);
- }
- else {
+ } else {
CelDecoder *decoder = static_cast<ActionCEL*>(action)->getDecoder();
decoder->setX(point.x);
decoder->setY(point.y);
@@ -90,22 +87,21 @@ void CursorMgr::update() {
void CursorMgr::setCursor(Common::String &cursorName, Common::Point point) {
uint index;
- if (cursorName == kCursorNameExitLeft) {
+ if (cursorName == kCursorNameExitLeft)
index = kExitLeftCursor;
- }
- else if (cursorName == kCursorNameExitRight){
+ else if (cursorName == kCursorNameExitRight)
index = kExitRightCursor;
- }
else //if (cursorName == kCursorNameExitForward || cursorName == kCursorNameExitUp)
index = kExitForwardCursor;
- //else assert(0);
-
+ //else
+ //assert(0);
setCursor(index, point, Common::String());
}
void CursorMgr::hideItem() {
- if (_actor) _actor->hide();
+ if (_actor)
+ _actor->hide();
}
void CursorMgr::startAnimation(int index) {
diff --git a/engines/pink/detection.cpp b/engines/pink/detection.cpp
index f0a0901..771db19 100644
--- a/engines/pink/detection.cpp
+++ b/engines/pink/detection.cpp
@@ -55,9 +55,8 @@ public:
};
bool PinkMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
- if (desc) {
+ if (desc)
*engine = new Pink::PinkEngine(syst, desc);
- }
return desc != 0;
}
diff --git a/engines/pink/detection_tables.h b/engines/pink/detection_tables.h
index e14e889..5a9f27a 100644
--- a/engines/pink/detection_tables.h
+++ b/engines/pink/detection_tables.h
@@ -29,27 +29,31 @@ namespace Pink {
static const ADGameDescription gameDescriptions[] = {
{
- "peril",
- 0,{
- {"PPTP.ORB", NULL, NULL, -1},
- {"PPTP.BRO", NULL, NULL, -1},
- {"PPTP.EXE", NULL, NULL, -1},
- AD_LISTEND},
- Common::EN_ANY,
- Common::kPlatformWindows,
- ADGF_UNSTABLE,
- GUIO1(GUIO_NONE)
+ "peril",
+ 0,
+ {
+ {"PPTP.ORB", NULL, NULL, -1},
+ {"PPTP.BRO", NULL, NULL, -1},
+ {"PPTP.EXE", NULL, NULL, -1},
+ AD_LISTEND
+ },
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NONE)
},
{
- "pokus",
- 0, {
- {"HPP.orb", NULL, NULL, -1},
- {"hpp.exe", NULL, NULL, -1},
- AD_LISTEND},
- Common::EN_ANY,
- Common::kPlatformWindows,
- ADGF_UNSTABLE,
- GUIO1(GUIO_NONE)
+ "pokus",
+ 0,
+ {
+ {"HPP.orb", NULL, NULL, -1},
+ {"hpp.exe", NULL, NULL, -1},
+ AD_LISTEND
+ },
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NONE)
},
AD_TABLE_END_MARKER
};
diff --git a/engines/pink/director.cpp b/engines/pink/director.cpp
index 4ac5c94..14aa40d 100644
--- a/engines/pink/director.cpp
+++ b/engines/pink/director.cpp
@@ -43,11 +43,10 @@ void Director::draw() {
void Director::drawSprite(ActionCEL *sprite) {
CelDecoder *decoder = sprite->getDecoder();
const Graphics::Surface *surface;
- if (decoder->needsUpdate()) {
-
+ if (decoder->needsUpdate())
surface = decoder->decodeNextFrame();
- }
- else surface = decoder->getCurrentFrame();
+ else
+ surface = decoder->getCurrentFrame();
int h = surface->h;
if (surface->h + decoder->getY() > 480)
@@ -69,7 +68,8 @@ void Director::drawSprite(ActionCEL *sprite) {
}
_system->unlockScreen();
}
- else _system->copyRectToScreen(surface->getPixels(), surface->pitch,
+ else
+ _system->copyRectToScreen(surface->getPixels(), surface->pitch,
decoder->getX(), decoder->getY(),
w, h);
@@ -80,9 +80,10 @@ void Director::addSprite(ActionCEL *sprite) {
_sprites.push_back(sprite);
int i;
for (i = _sprites.size() - 1; i > 0 ; --i) {
- if (sprite->getZ() < _sprites[i - 1]->getZ()){
+ if (sprite->getZ() < _sprites[i - 1]->getZ())
_sprites[i] = _sprites[i - 1];
- } else break;
+ else
+ break;
}
_sprites[i] = sprite;
}
diff --git a/engines/pink/director.h b/engines/pink/director.h
index b1566e7..99622e3 100644
--- a/engines/pink/director.h
+++ b/engines/pink/director.h
@@ -56,8 +56,8 @@ public:
private:
void drawSprite(ActionCEL *sprite);
OSystem *_system;
- Common::Array<ActionCEL*> _sprites;
- Common::Array<ActionSound*> _sounds;
+ Common::Array<ActionCEL *> _sprites;
+ Common::Array<ActionSound *> _sounds;
};
} // End of namespace Pink
diff --git a/engines/pink/file.cpp b/engines/pink/file.cpp
index 68fc53c..77c1873 100644
--- a/engines/pink/file.cpp
+++ b/engines/pink/file.cpp
@@ -41,22 +41,19 @@ bool OrbFile::open(const Common::String &name) {
if (!File::open(name))
return false;
- if (readUint32BE() != 'ORB\0'){
+ if (readUint32BE() != 'ORB\0')
return false;
- }
uint16 minor = readUint16LE();
uint16 major = readUint16LE();
debug("Orb v%hu.%hu loaded", major, minor);
- if (major != kOrbMajorVersion || minor != kOrbMinorVersion){
+ if (major != kOrbMajorVersion || minor != kOrbMinorVersion)
return false;
- }
- if (!(_timestamp = readUint32LE())){
+ if (!(_timestamp = readUint32LE()))
return false;
- }
_tableOffset = readUint32LE();
_tableSize = readUint32LE();
@@ -120,7 +117,6 @@ ResourceDescription *OrbFile::getResDescTable(ObjectDescription *objDesc){
return table;
}
-
bool BroFile::open(const Common::String &name, uint32 orbTimestamp) {
if (!File::open(name) || readUint32BE() != 'BRO\0')
return false;
@@ -130,9 +126,8 @@ bool BroFile::open(const Common::String &name, uint32 orbTimestamp) {
debug("Bro v%hu.%hu loaded", major, minor);
- if (major != kBroMajorVersion || minor != kBroMinorVersion){
+ if (major != kBroMajorVersion || minor != kBroMinorVersion)
return false;
- }
uint32 timestamp = readUint32LE();
diff --git a/engines/pink/objects/actions/action.h b/engines/pink/objects/actions/action.h
index 241aee8..7dd0d2a 100644
--- a/engines/pink/objects/actions/action.h
+++ b/engines/pink/objects/actions/action.h
@@ -38,9 +38,9 @@ public:
virtual void update() {};
virtual void toConsole() {};
- virtual bool initPalette(Director *director) { return 0;}
+ virtual bool initPalette(Director *director) { return 0; }
- Actor *getActor() { return _actor;}
+ Actor *getActor() { return _actor; }
virtual void pause() {};
virtual void unpause() {};
diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp
index f38c127..8e868a1 100644
--- a/engines/pink/objects/actions/action_cel.cpp
+++ b/engines/pink/objects/actions/action_cel.cpp
@@ -32,9 +32,7 @@
namespace Pink {
ActionCEL::ActionCEL()
- : _decoder(nullptr) {
-
-}
+ : _decoder(nullptr) {}
void ActionCEL::deserialize(Archive &archive) {
Action::deserialize(archive);
@@ -74,7 +72,7 @@ bool ActionCEL::initPalette(Director *director) {
}
void ActionCEL::update() {
- if (_decoder->endOfVideo()){
+ if (_decoder->endOfVideo()) {
_decoder->stop();
_actor->endAction();
}
diff --git a/engines/pink/objects/actions/action_cel.h b/engines/pink/objects/actions/action_cel.h
index 765fe8d..bf1ae29 100644
--- a/engines/pink/objects/actions/action_cel.h
+++ b/engines/pink/objects/actions/action_cel.h
@@ -49,7 +49,7 @@ public:
void unpause() override;
protected:
- virtual void onStart() {} ;
+ virtual void onStart() {};
CelDecoder *_decoder;
Common::String _fileName;
uint32 _z;
diff --git a/engines/pink/objects/actions/action_loop.cpp b/engines/pink/objects/actions/action_loop.cpp
index f32a3a4..f61ed5d 100644
--- a/engines/pink/objects/actions/action_loop.cpp
+++ b/engines/pink/objects/actions/action_loop.cpp
@@ -33,15 +33,14 @@ void ActionLoop::deserialize(Archive &archive) {
_intro = archive.readDWORD();
style = archive.readWORD();
switch (style) {
- case kPingPong:
- _style = kPingPong;
- break;
- case kRandom:
- _style = kRandom;
- break;
- default:
- _style = kForward;
- break;
+ case kPingPong:
+ _style = kPingPong;
+ break;
+ case kRandom:
+ _style = kRandom;
+ break;
+ default:
+ _style = kForward;
}
}
@@ -54,7 +53,7 @@ void ActionLoop::toConsole() {
void ActionLoop::update() {
// for now it supports only forward loop animation
if (_style == kForward) {
- if (_decoder->endOfVideo() || _decoder->getCurFrame() == _stopFrame){
+ if (_decoder->endOfVideo() || _decoder->getCurFrame() == _stopFrame) {
//debug("ACTION LOOP : NEXT ITERATION");
_decoder->rewind();
}
diff --git a/engines/pink/objects/actions/action_play.cpp b/engines/pink/objects/actions/action_play.cpp
index 6ae56df..a2b8b0a 100644
--- a/engines/pink/objects/actions/action_play.cpp
+++ b/engines/pink/objects/actions/action_play.cpp
@@ -54,7 +54,7 @@ void ActionPlay::onStart() {
}
void ActionPlay::update() {
- if (_decoder->endOfVideo() || _decoder->getCurFrame() == _stopFrame){
+ if (_decoder->endOfVideo() || _decoder->getCurFrame() == _stopFrame) {
_decoder->stop();
_actor->endAction();
}
diff --git a/engines/pink/objects/actions/action_play_with_sfx.cpp b/engines/pink/objects/actions/action_play_with_sfx.cpp
index 62488ac..6ab8fa6 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.cpp
+++ b/engines/pink/objects/actions/action_play_with_sfx.cpp
@@ -66,9 +66,8 @@ void ActionPlayWithSfx::updateSound() {
return;
for (uint i = 0; i < _sfxArray.size(); ++i) {
- if (_sfxArray[i]->getFrame() == _decoder->getCurFrame()) {
+ if (_sfxArray[i]->getFrame() == _decoder->getCurFrame())
_sfxArray[i]->play(_actor->getPage());
- }
}
}
@@ -107,8 +106,7 @@ uint32 ActionSfx::getFrame() {
}
ActionSfx::ActionSfx()
- : _sound(nullptr)
-{}
+ : _sound(nullptr) {}
void ActionSfx::end() {
delete _sound;
diff --git a/engines/pink/objects/actions/action_play_with_sfx.h b/engines/pink/objects/actions/action_play_with_sfx.h
index 89b2ec6..c9fd348 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.h
+++ b/engines/pink/objects/actions/action_play_with_sfx.h
@@ -42,7 +42,7 @@ protected:
private:
void updateSound();
uint32 _isLoop;
- Array<ActionSfx*> _sfxArray;
+ Array<ActionSfx *> _sfxArray;
};
class Sound;
diff --git a/engines/pink/objects/actions/action_sound.cpp b/engines/pink/objects/actions/action_sound.cpp
index 2e69228..ffbd293 100644
--- a/engines/pink/objects/actions/action_sound.cpp
+++ b/engines/pink/objects/actions/action_sound.cpp
@@ -32,8 +32,7 @@
namespace Pink {
ActionSound::ActionSound()
- : _sound(nullptr)
-{}
+ : _sound(nullptr) {}
ActionSound::~ActionSound(){
end();
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index e6545f3..abcb665 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -48,9 +48,8 @@ Sequencer *Actor::getSequencer() const {
Action *Actor::findAction(const Common::String &name) {
for (uint i = 0; i < _actions.size(); ++i) {
- if (_actions[i]->getName() == name) {
+ if (_actions[i]->getName() == name)
return _actions[i];
- }
}
return nullptr;
}
@@ -60,14 +59,12 @@ GamePage *Actor::getPage() const {
}
void Actor::init(bool unk) {
- if (!_action) {
+ if (!_action)
_action = findAction(kIdleAction);
- }
if (!_action) {
_isActionEnded = 1;
- }
- else {
+ } else {
_isActionEnded = 0;
_action->start(unk);
}
@@ -103,8 +100,7 @@ void Actor::setAction(Action *newAction, bool unk) {
assert(0); // want to see this
_isActionEnded = 1;
_action = newAction;
- }
- else {
+ } else {
setAction(newAction);
}
}
diff --git a/engines/pink/objects/actors/actor.h b/engines/pink/objects/actors/actor.h
index cfbc358..b4fe437 100644
--- a/engines/pink/objects/actors/actor.h
+++ b/engines/pink/objects/actors/actor.h
@@ -41,8 +41,7 @@ class Actor : public NamedObject {
public:
Actor()
: _page(nullptr), _action(nullptr),
- _isActionEnded(1)
- {};
+ _isActionEnded(1) {};
~Actor();
virtual void deserialize(Archive &archive);
@@ -72,7 +71,7 @@ public:
virtual void onMouseOver(Common::Point point, CursorMgr *mgr);
virtual void onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr);
- virtual bool isClickable() { return 0;}
+ virtual bool isClickable() { return 0; }
virtual void pause();
virtual void unpause();
@@ -80,7 +79,7 @@ public:
protected:
GamePage *_page;
Action *_action;
- Array<Action*> _actions;
+ Array<Action *> _actions;
bool _isActionEnded;
};
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index f414cd6..484871a 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -49,9 +49,9 @@ void LeadActor::setNextExecutors(Common::String &nextModule, Common::String &nex
}
void LeadActor::init(bool unk) {
- if (_state == kUnk_Loading){
+ if (_state == kUnk_Loading)
_state = kReady;
- }
+
_page->getModule()->getInventoryMgr()->setLeadActor(this);
_page->getGame()->setLeadActor(this);
Actor::init(unk);
@@ -70,79 +70,79 @@ LeadActor::State LeadActor::getState() const {
void LeadActor::update() {
switch (_state) {
- case kReady:
- _sequencer->update();
- _cursorMgr->update();
- break;
- case kMoving:
- _walkMgr->update();
- _cursorMgr->update();
- break;
- case kInDialog1:
- case kInDialog2:
- _sequencer->update();
- if (!_sequencer->_context){
- _state = _nextState;
- _nextState = kUnk_Loading;
- }
- break;
-
- case kInventory:
- getPage()->getModule()->getInventoryMgr()->update();
- break;
- case kPDA:
- break;
-
- case kPlayingVideo:
- _sequencer->update();
- if (!_sequencer->_context){
- _state = kUnk_Loading;
- _page->getGame()->changeScene(_page);
- }
- break;
- case kUnk_Loading:
- break;
+ case kReady:
+ _sequencer->update();
+ _cursorMgr->update();
+ break;
+ case kMoving:
+ _walkMgr->update();
+ _cursorMgr->update();
+ break;
+ case kInDialog1:
+ case kInDialog2:
+ _sequencer->update();
+ if (!_sequencer->_context) {
+ _state = _nextState;
+ _nextState = kUnk_Loading;
+ }
+ break;
+ case kInventory:
+ getPage()->getModule()->getInventoryMgr()->update();
+ break;
+ case kPDA:
+ break;
+ case kPlayingVideo:
+ _sequencer->update();
+ if (!_sequencer->_context) {
+ _state = kUnk_Loading;
+ _page->getGame()->changeScene(_page);
+ }
+ break;
+ case kUnk_Loading:
+ break;
+ default:
+ break;
}
}
void LeadActor::onKeyboardButtonClick(Common::KeyCode code) {
- switch(_state) {
- case kMoving:
- switch (code){
- case Common::KEYCODE_ESCAPE:
- // set unk variables
- // Fall Through intended
- case Common::KEYCODE_SPACE:
- //skip walking animation
- default:
- break;
- }
+ switch (_state) {
+ case kMoving:
+ switch (code) {
+ case Common::KEYCODE_ESCAPE:
+ // set unk variables
+ // Fall Through intended
+ case Common::KEYCODE_SPACE:
+ //skip walking animation
+ default:
break;
- case kInDialog1:
- case kInDialog2:
- case kPlayingVideo:
- switch (code) {
- case Common::KEYCODE_SPACE:
- case Common::KEYCODE_RIGHT:
- _sequencer->skipSubSequence();
- break;
- case Common::KEYCODE_ESCAPE:
- _sequencer->skipToLastSubSequence();
- break;
- case Common::KEYCODE_LEFT:
- _sequencer->restartSequence();
- break;
- default:
- break;
- }
+ }
+ break;
+ case kInDialog1:
+ case kInDialog2:
+ case kPlayingVideo:
+ switch (code) {
+ case Common::KEYCODE_SPACE:
+ case Common::KEYCODE_RIGHT:
+ _sequencer->skipSubSequence();
+ break;
+ case Common::KEYCODE_ESCAPE:
+ _sequencer->skipToLastSubSequence();
+ break;
+ case Common::KEYCODE_LEFT:
+ _sequencer->restartSequence();
break;
default:
break;
+ }
+ break;
+ default:
+ break;
}
}
void LeadActor::start(bool isHandler) {
- if (isHandler && _state != kPlayingVideo){
+ if (isHandler && _state != kPlayingVideo) {
_state = kInDialog1;
_nextState = kReady;
}
@@ -152,38 +152,39 @@ void LeadActor::start(bool isHandler) {
void LeadActor::onMouseMove(Common::Point point) {
if (_state != kPDA)
updateCursor(point);
- else error("pda is not supported");
+ else
+ error("pda is not supported");
}
void LeadActor::updateCursor(Common::Point point) {
switch (_state) {
- case kReady:
- case kMoving: {
- Director *director = _page->getGame()->getDirector();
- Actor *actor = director->getActorByPoint(point);
- InventoryItem *item = _page->getModule()->getInventoryMgr()->getCurrentItem();
- if (_isHaveItem) {
- if (actor) {
- actor->onHover(point, item->getName(), _cursorMgr);
- }
- else _cursorMgr->setCursor(kHoldingItemCursor, point, item->getName());
- }
- else if (actor)
- actor->onMouseOver(point, _cursorMgr);
- else _cursorMgr->setCursor(kDefaultCursor, point, Common::String());
- break;
- }
- case kInDialog1:
- case kInDialog2:
- case kPlayingVideo:
- _cursorMgr->setCursor(kNotClickableCursor, point, Common::String());
- break;
- case kPDA:
- case kInventory:
+ case kReady:
+ case kMoving: {
+ Director *director = _page->getGame()->getDirector();
+ Actor *actor = director->getActorByPoint(point);
+ InventoryItem *item = _page->getModule()->getInventoryMgr()->getCurrentItem();
+ if (_isHaveItem) {
+ if (actor) {
+ actor->onHover(point, item->getName(), _cursorMgr);
+ } else
+ _cursorMgr->setCursor(kHoldingItemCursor, point, item->getName());
+ } else if (actor)
+ actor->onMouseOver(point, _cursorMgr);
+ else
_cursorMgr->setCursor(kDefaultCursor, point, Common::String());
- break;
- default:
- break;
+ break;
+ }
+ case kInDialog1:
+ case kInDialog2:
+ case kPlayingVideo:
+ _cursorMgr->setCursor(kNotClickableCursor, point, Common::String());
+ break;
+ case kPDA:
+ case kInventory:
+ _cursorMgr->setCursor(kDefaultCursor, point, Common::String());
+ break;
+ default:
+ break;
}
}
@@ -191,8 +192,8 @@ void LeadActor::onLeftButtonClick(Common::Point point) {
InventoryMgr *invMgr = _page->getModule()->getInventoryMgr();
switch (_state) {
- case kReady:
- case kMoving: {
+ case kReady:
+ case kMoving: {
Actor *actor = _page->getGame()->getDirector()->getActorByPoint(point);
if (this == actor) {
@@ -200,48 +201,50 @@ void LeadActor::onLeftButtonClick(Common::Point point) {
return;
}
- _recipient = dynamic_cast<SupportingActor*>(actor);
+ _recipient = dynamic_cast<SupportingActor *>(actor);
if (actor->isClickable() && isInteractingWith(_recipient)) {
WalkLocation *location = getWalkDestination();
if (location) {
_state = kMoving;
_nextState = kInDialog1;
_walkMgr->start(location);
- }
- else if (_state == kReady){
+ } else if (_state == kReady) {
if (_isHaveItem)
sendUseClickMessage(_recipient);
- else sendLeftClickMessage(_recipient);
+ else
+ sendLeftClickMessage(_recipient);
}
}
break;
- }
- case kPDA:
+ }
+ case kPDA:
- break;
- case kInventory:
- invMgr->onClick(point);
- break;
- default:
- break;
+ break;
+ case kInventory:
+ invMgr->onClick(point);
+ break;
+ default:
+ break;
}
}
void LeadActor::onMouseOver(Common::Point point, CursorMgr *mgr) {
if (_page->getModule()->getInventoryMgr()->isPinkOwnsAnyItems())
_cursorMgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
- else Actor::onMouseOver(point, mgr);
+ else
+ Actor::onMouseOver(point, mgr);
}
void LeadActor::onWalkEnd() {
State oldNextState = _nextState;
_state = kReady;
_nextState = kUnk_Loading;
- if (_recipient && oldNextState == kInDialog1){
+ if (_recipient && oldNextState == kInDialog1) {
if (_isHaveItem)
sendUseClickMessage(_recipient);
- else sendLeftClickMessage(_recipient);
+ else
+ sendLeftClickMessage(_recipient);
}
}
@@ -267,13 +270,12 @@ void LeadActor::onClick() {
_isHaveItem = false;
_nextState = (_state != kMoving) ?
kUnk_Loading : kReady;
- }
- else {
+ } else {
if (_state == kMoving) {
_recipient = nullptr;
_nextState = kReady;
}
- if (_page->getModule()->getInventoryMgr()->start(1)){
+ if (_page->getModule()->getInventoryMgr()->start(1)) {
_stateCopy = _state;
_state = kInventory;
_page->pause();
@@ -282,11 +284,9 @@ void LeadActor::onClick() {
}
LeadActor::LeadActor()
- : _state(kReady), _nextState(kReady),
- _isHaveItem(false), _recipient(nullptr),
- _cursorMgr(nullptr), _walkMgr(nullptr),
- _sequencer(nullptr)
-{}
+ : _state(kReady), _nextState(kReady), _isHaveItem(false),
+ _recipient(nullptr), _cursorMgr(nullptr), _walkMgr(nullptr),
+ _sequencer(nullptr) {}
void LeadActor::onInventoryClosed(bool isItemClicked) {
_isHaveItem = isItemClicked;
@@ -320,17 +320,14 @@ void ParlSqPink::toConsole() {
}
WalkLocation *ParlSqPink::getWalkDestination() {
- if (_recipient->getName() == kBoy &&
- _page->checkValueOfVariable(kBoyBlocked, kUndefined))
- {
+ if (_recipient->getName() == kBoy && _page->checkValueOfVariable(kBoyBlocked, kUndefined))
return _walkMgr->findLocation(kSirBaldley);
- }
+
return LeadActor::getWalkDestination();
}
PubPink::PubPink() :
- LeadActor(), _round(0)
-{}
+ LeadActor(), _round(0) {}
void PubPink::toConsole() {
debug("PubPink: _name = %s", _name.c_str());
@@ -352,13 +349,11 @@ void PubPink::onClick() {
void PubPink::updateCursor(Common::Point point) {
if (playingMiniGame()) {
SupportingActor *actor = dynamic_cast<SupportingActor*>(_page->getGame()->getDirector()->getActorByPoint(point));
- if (_state == kReady &&
- actor &&
- actor->isUseClickHandlers(_page->getModule()->getInventoryMgr()->getCurrentItem()))
- {
- _cursorMgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
- }
- else _cursorMgr->setCursor(kDefaultCursor, point, Common::String());
+ if (_state == kReady && actor &&
+ actor->isUseClickHandlers(_page->getModule()->getInventoryMgr()->getCurrentItem())) {
+ _cursorMgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
+ } else
+ _cursorMgr->setCursor(kDefaultCursor, point, Common::String());
}
else LeadActor::updateCursor(point);
}
@@ -367,36 +362,31 @@ WalkLocation *PubPink::getWalkDestination() {
if (playingMiniGame())
return nullptr;
- if (_recipient->getName() == kJackson &&
- !_page->checkValueOfVariable(kDrunkLocation, kBolted))
- {
+ if (_recipient->getName() == kJackson && !_page->checkValueOfVariable(kDrunkLocation, kBolted))
return _walkMgr->findLocation(_page->findActor(kDrunk)->getName());
- }
return LeadActor::getWalkDestination();
}
bool PubPink::sendUseClickMessage(SupportingActor *actor) {
- if (!LeadActor::sendUseClickMessage(actor) &&
- playingMiniGame()) {
+ if (!LeadActor::sendUseClickMessage(actor) && playingMiniGame()) {
_nextState = _state;
_state = kInDialog1;
const char *roundName;
switch (_round++ % 3) {
- case 0:
- roundName = kFirstRound;
- break;
- case 1:
- roundName = kSecondRound;
- break;
- case 2:
- roundName = kThirdRound;
- break;
- default:
- roundName = nullptr;
- assert(0);
- break;
+ case 0:
+ roundName = kFirstRound;
+ break;
+ case 1:
+ roundName = kSecondRound;
+ break;
+ case 2:
+ roundName = kThirdRound;
+ break;
+ default:
+ roundName = nullptr;
+ assert(0);
}
_sequencer->authorSequence(_sequencer->findSequence(roundName), 0);
}
diff --git a/engines/pink/objects/actors/supporting_actor.cpp b/engines/pink/objects/actors/supporting_actor.cpp
index 3ba1036..9e5eaa6 100644
--- a/engines/pink/objects/actors/supporting_actor.cpp
+++ b/engines/pink/objects/actors/supporting_actor.cpp
@@ -48,12 +48,13 @@ void SupportingActor::toConsole() {
void SupportingActor::onMouseOver(Common::Point point, CursorMgr *mgr) {
if (isLeftClickHandlers()){
- if (!_cursor.empty()){
+ if (!_cursor.empty())
mgr->setCursor(_cursor, point);
- }
- else mgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
+ else
+ mgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
}
- else Actor::onMouseOver(point, mgr);
+ else
+ Actor::onMouseOver(point, mgr);
}
bool SupportingActor::isLeftClickHandlers() {
@@ -80,13 +81,10 @@ const Common::String &SupportingActor::getLocation() const {
return _location;
}
-SupportingActor::~SupportingActor() {}
-
void SupportingActor::onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) {
Common::String item = itemName;
- if (_handlerMgr.isUseClickHandler(this, itemName)) {
+ if (_handlerMgr.isUseClickHandler(this, itemName))
item += kClickable;
- }
Actor::onHover(point, item, cursorMgr);
}
diff --git a/engines/pink/objects/actors/supporting_actor.h b/engines/pink/objects/actors/supporting_actor.h
index d47959d..d9b77f7 100644
--- a/engines/pink/objects/actors/supporting_actor.h
+++ b/engines/pink/objects/actors/supporting_actor.h
@@ -33,7 +33,6 @@ class InventoryMgr;
class SupportingActor : public Actor {
public:
- virtual ~SupportingActor();
virtual void deserialize(Archive &archive);
virtual void toConsole();
diff --git a/engines/pink/objects/handlers/handler.cpp b/engines/pink/objects/handlers/handler.cpp
index 2f73553..f27b79a 100644
--- a/engines/pink/objects/handlers/handler.cpp
+++ b/engines/pink/objects/handlers/handler.cpp
@@ -39,9 +39,8 @@ void Handler::deserialize(Archive &archive) {
bool Handler::isSuitable(Actor *actor) {
for (uint i = 0; i < _conditions.size(); ++i) {
- if (!_conditions[i]->evaluate(actor)){
+ if (!_conditions[i]->evaluate(actor))
return false;
- }
}
return true;
}
diff --git a/engines/pink/objects/handlers/handler.h b/engines/pink/objects/handlers/handler.h
index 98d2662..3d795f8 100644
--- a/engines/pink/objects/handlers/handler.h
+++ b/engines/pink/objects/handlers/handler.h
@@ -44,8 +44,8 @@ public:
protected:
void executeSideEffects(Actor *actor);
- Array<Condition*> _conditions;
- Array<SideEffect*> _sideEffects;
+ Array<Condition *> _conditions;
+ Array<SideEffect *> _sideEffects;
};
class Sequence;
diff --git a/engines/pink/objects/handlers/handler_mgr.h b/engines/pink/objects/handlers/handler_mgr.h
index dabb329..75ba40c 100644
--- a/engines/pink/objects/handlers/handler_mgr.h
+++ b/engines/pink/objects/handlers/handler_mgr.h
@@ -56,9 +56,9 @@ private:
HandlerLeftClick *findSuitableHandlerLeftClick(Actor *actor);
HandlerUseClick *findSuitableHandlerUseClick(Actor *actor, InventoryItem *item);
- Array<HandlerLeftClick*> _leftClickHandlers;
- Array<HandlerUseClick*> _useClickHandlers;
- Array<Handler*> _timerHandlers;
+ Array<HandlerLeftClick *> _leftClickHandlers;
+ Array<HandlerUseClick *> _useClickHandlers;
+ Array<Handler *> _timerHandlers;
};
}
diff --git a/engines/pink/objects/handlers/handler_timer.cpp b/engines/pink/objects/handlers/handler_timer.cpp
index e27d4bb..8f6e3a2 100644
--- a/engines/pink/objects/handlers/handler_timer.cpp
+++ b/engines/pink/objects/handlers/handler_timer.cpp
@@ -34,7 +34,6 @@
namespace Pink {
-
void HandlerTimerActions::deserialize(Archive &archive) {
Handler::deserialize(archive);
_actions.deserialize(archive);
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
index 677b18f..13d0dfd 100644
--- a/engines/pink/objects/inventory.cpp
+++ b/engines/pink/objects/inventory.cpp
@@ -33,9 +33,7 @@
namespace Pink {
InventoryMgr::InventoryMgr()
- : _lead(nullptr), _item(nullptr), _isClickedOnItem(false)
-{
-}
+ : _lead(nullptr), _item(nullptr), _isClickedOnItem(false) {}
void Pink::InventoryItem::deserialize(Archive &archive) {
NamedObject::deserialize(archive);
@@ -129,14 +127,13 @@ bool InventoryMgr::start(bool playOpening) {
}
void InventoryMgr::update() {
- if (_state == kOpening && !_window->isPlaying()){
+ if (_state == kOpening && !_window->isPlaying()) {
_state = kReady;
_itemActor->setAction(_item->getName());
_window->setAction(kShowAction);
_leftArrow->setAction(kShowAction);
_rightArrow->setAction(kShowAction);
- }
- else if (_state == kClosing && !_window->isPlaying()){
+ } else if (_state == kClosing && !_window->isPlaying()) {
_window->setAction(kIdleAction);
_lead->onInventoryClosed(_isClickedOnItem);
@@ -157,14 +154,12 @@ void InventoryMgr::onClick(Common::Point point) {
if (actor == _itemActor || actor == _window) {
_isClickedOnItem = true;
close();
- }
- else if (actor == _leftArrow) {
+ } else if (actor == _leftArrow) {
showNextItem(kLeft);
- }
- else if (actor == _rightArrow) {
+ } else if (actor == _rightArrow) {
showNextItem(kRight);
- }
- else close();
+ } else
+ close();
}
void InventoryMgr::close() {
@@ -188,7 +183,7 @@ void InventoryMgr::showNextItem(bool direction) {
uint i = 0;
do {
index = (direction == kLeft) ? index - 1 : index + 1;
- } while(_items[index % _items.size()]->getCurrentOwner() != _item->getCurrentOwner() && ++i < _items.size());
+ } while (_items[index % _items.size()]->getCurrentOwner() != _item->getCurrentOwner() && ++i < _items.size());
if (i != _items.size()) {
_item = _items[index % _items.size()];
diff --git a/engines/pink/objects/inventory.h b/engines/pink/objects/inventory.h
index a6f67c6..f09e1e8 100644
--- a/engines/pink/objects/inventory.h
+++ b/engines/pink/objects/inventory.h
@@ -84,7 +84,7 @@ private:
Actor *_leftArrow;
InventoryItem *_item;
- Array<InventoryItem*> _items;
+ Array<InventoryItem *> _items;
enum State {
kIdle = 0,
diff --git a/engines/pink/objects/module.cpp b/engines/pink/objects/module.cpp
index 5a7dd6b..cdb3746 100644
--- a/engines/pink/objects/module.cpp
+++ b/engines/pink/objects/module.cpp
@@ -27,14 +27,12 @@
namespace Pink {
ModuleProxy::ModuleProxy(const Common::String &name)
- : NamedObject(name)
-{}
+ : NamedObject(name) {}
ModuleProxy::ModuleProxy() {}
Module::Module(PinkEngine *game, const Common::String &name)
- : NamedObject(name), _game(game), _page(nullptr)
-{}
+ : NamedObject(name), _game(game), _page(nullptr) {}
Module::~Module() {
for (uint i = 0; i < _pages.size(); ++i) {
diff --git a/engines/pink/objects/module.h b/engines/pink/objects/module.h
index 5c253eb..a0735bf 100644
--- a/engines/pink/objects/module.h
+++ b/engines/pink/objects/module.h
@@ -65,7 +65,7 @@ private:
PinkEngine *_game;
GamePage *_page;
- Array<GamePage*> _pages;
+ Array<GamePage *> _pages;
InventoryMgr _invMgr;
Common::StringMap _variables;
};
diff --git a/engines/pink/objects/object.cpp b/engines/pink/objects/object.cpp
index 4d9041f..02249a3 100644
--- a/engines/pink/objects/object.cpp
+++ b/engines/pink/objects/object.cpp
@@ -27,8 +27,7 @@
namespace Pink {
Pink::NamedObject::NamedObject(const Common::String &name)
- : _name(name)
-{}
+ : _name(name) {}
void Pink::NamedObject::deserialize(Archive &archive) {
_name = archive.readString();
@@ -38,8 +37,6 @@ const Common::String &Pink::NamedObject::getName() const {
return _name;
}
-void NamedObject::store(Archive &archive) {
-
-}
+void NamedObject::store(Archive &archive) {}
} // End of namespace Pink
diff --git a/engines/pink/objects/object.h b/engines/pink/objects/object.h
index 62ca9f7..e69fa4b 100644
--- a/engines/pink/objects/object.h
+++ b/engines/pink/objects/object.h
@@ -32,16 +32,16 @@ class Archive;
class Object {
public:
virtual ~Object() {};
- virtual void load(Archive &){};
- virtual void store(Archive &){};
- virtual void deserialize(Archive &){};
+ virtual void load(Archive &) {};
+ virtual void store(Archive &) {};
+ virtual void deserialize(Archive &) {};
virtual void init() {}
virtual void toConsole() {};
};
class NamedObject : public Object {
public:
- NamedObject(){};
+ NamedObject() {};
NamedObject(const Common::String &name);
void deserialize(Archive &archive);
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index 83df359..8e53444 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -32,8 +32,7 @@ namespace Pink {
GamePage::GamePage()
: _cursorMgr(nullptr), _walkMgr(nullptr), _sequencer(nullptr),
- _isLoaded(false), _memFile(nullptr)
-{}
+ _isLoaded(false), _memFile(nullptr) {}
GamePage::~GamePage() {
clear();
@@ -87,16 +86,15 @@ void GamePage::init(bool isLoadingSave) {
}
bool isHandler = false;
- if (!isLoadingSave) {
+ if (!isLoadingSave)
isHandler = initHandler();
- }
_leadActor->start(isHandler);
}
bool GamePage::initHandler() {
for (uint i = 0; i < _handlers.size(); ++i) {
- if (_handlers[i]->isSuitable(_leadActor)){
+ if (_handlers[i]->isSuitable(_leadActor)) {
_handlers[i]->handle(_leadActor);
return true;
}
diff --git a/engines/pink/objects/pages/game_page.h b/engines/pink/objects/pages/game_page.h
index 1bae58d..1c7e5cf 100644
--- a/engines/pink/objects/pages/game_page.h
+++ b/engines/pink/objects/pages/game_page.h
@@ -67,7 +67,7 @@ private:
CursorMgr *_cursorMgr;
WalkMgr *_walkMgr;
Sequencer *_sequencer;
- Array<HandlerStartPage*> _handlers;
+ Array<HandlerStartPage *> _handlers;
Common::StringMap _variables;
};
diff --git a/engines/pink/objects/pages/page.h b/engines/pink/objects/pages/page.h
index 3b5708f..f8b582a 100644
--- a/engines/pink/objects/pages/page.h
+++ b/engines/pink/objects/pages/page.h
@@ -51,7 +51,7 @@ public:
protected:
void init();
- Array<Actor*> _actors;
+ Array<Actor *> _actors;
ResourceMgr _resMgr;
LeadActor *_leadActor;
};
diff --git a/engines/pink/objects/sequences/seq_timer.cpp b/engines/pink/objects/sequences/seq_timer.cpp
index 9f8ee31..5026051 100644
--- a/engines/pink/objects/sequences/seq_timer.cpp
+++ b/engines/pink/objects/sequences/seq_timer.cpp
@@ -53,7 +53,7 @@ void SeqTimer::update() {
_updatesToMessage = _range ? _period + rnd.getRandomNumber(_range) : _period;
SupportingActor *actor = static_cast<SupportingActor*>(_sequencer->_page->findActor(_actor));
- if (actor && !_sequencer->findSequenceActorState(actor->getName())){
+ if (actor && !_sequencer->findSequenceActorState(actor->getName())) {
actor->onTimerMessage();
}
}
diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp
index f388b7c..8e2f38c 100644
--- a/engines/pink/objects/sequences/sequence.cpp
+++ b/engines/pink/objects/sequences/sequence.cpp
@@ -34,8 +34,8 @@
namespace Pink {
Sequence::Sequence()
- : _unk(0), _context(nullptr),
- _sequencer(nullptr) {}
+ : _unk(0), _context(nullptr),
+ _sequencer(nullptr) {}
Sequence::~Sequence() {
for (uint i = 0; i < _items.size(); ++i) {
@@ -72,7 +72,8 @@ void Sequence::init(int unk) {
}
void Sequence::start(int unk) {
- if (_context->_nextItemIndex >= _items.size() || !_items[_context->_nextItemIndex]->execute(_context->_index, this, unk)){
+ if (_context->_nextItemIndex >= _items.size() ||
+ !_items[_context->_nextItemIndex]->execute(_context->_index, this, unk)) {
debug("Sequence %s ended", _name.c_str());
end();
return;
@@ -95,7 +96,7 @@ void Sequence::start(int unk) {
}
void Sequence::update() {
- if (!_context->_actor->isPlaying()){
+ if (!_context->_actor->isPlaying()) {
debug("Sequence step ended");
start(0);
}
@@ -114,9 +115,9 @@ void Sequence::restart() {
}
void Sequence::skipToLastSubSequence() {
- if (_unk && _context->getNextItemIndex() < _items.size()){
+ if (_unk && _context->getNextItemIndex() < _items.size()) {
int i = _items.size() - 1;
- while(i >= 0 && !_items[--i]->isLeader());
+ while (i >= 0 && !_items[--i]->isLeader()) {};
assert(i >= 0);
_context->setNextItemIndex(i);
_context->clearActionsFromActorStates();
@@ -126,7 +127,7 @@ void Sequence::skipToLastSubSequence() {
}
void Sequence::skipItemsTo(int index) {
- for(int i = 0; i < index; ++i){
+ for (int i = 0; i < index; ++i) {
_items[i]->skip(this);
}
}
@@ -167,9 +168,8 @@ void SequenceAudio::end() {
void SequenceAudio::update() {
if (!_sound->isPlaying())
end();
- else if (_sample <= _sound->getCurrentSample()){
+ else if (_sample <= _sound->getCurrentSample())
start(0);
- }
}
void SequenceAudio::init(int unk) {
diff --git a/engines/pink/objects/sequences/sequence.h b/engines/pink/objects/sequences/sequence.h
index f4c6c5a..3486325 100644
--- a/engines/pink/objects/sequences/sequence.h
+++ b/engines/pink/objects/sequences/sequence.h
@@ -39,7 +39,7 @@ public:
virtual void toConsole();
- Common::Array<SequenceItem*> &getItems();
+ Common::Array<SequenceItem *> &getItems();
void setContext(SequenceContext *context);
virtual void init(int unk);
@@ -56,7 +56,7 @@ public:
public:
SequenceContext *_context;
Sequencer *_sequencer;
- Array<SequenceItem*> _items;
+ Array<SequenceItem *> _items;
int _unk;
};
diff --git a/engines/pink/objects/sequences/sequence_context.cpp b/engines/pink/objects/sequences/sequence_context.cpp
index 65911ec..200fcb4 100644
--- a/engines/pink/objects/sequences/sequence_context.cpp
+++ b/engines/pink/objects/sequences/sequence_context.cpp
@@ -32,8 +32,7 @@
namespace Pink {
SequenceActorState::SequenceActorState(const Common::String &name)
- :_actorName(name), _index(0)
-{}
+ :_actorName(name), _index(0) {}
const Common::String &SequenceActorState::getActor() const {
return _actorName;
@@ -42,7 +41,7 @@ const Common::String &SequenceActorState::getActor() const {
void SequenceActorState::check(int index, Sequence *sequence, bool unk) {
Actor *actor = sequence->_sequencer->_page->findActor(_actorName);
debug("%s %s", _actorName.c_str(), _actionName.c_str());
- if (_index != index && !_actionName.empty()){
+ if (_index != index && !_actionName.empty()) {
Action *action = actor->findAction(_actionName);
if (actor->getAction() != action)
actor->setAction(action, unk);
@@ -60,7 +59,7 @@ SequenceContext::SequenceContext(Sequence *sequence, Sequencer *sequencer)
for (uint i = 0; i < items.size(); ++i) {
bool found = 0;
for (uint j = 0; j < _states.size(); ++j) {
- if (items[i]->getActor() == _states[j].getActor()){
+ if (items[i]->getActor() == _states[j].getActor()) {
found = 1;
break;
}
diff --git a/engines/pink/objects/sequences/sequence_item.cpp b/engines/pink/objects/sequences/sequence_item.cpp
index 7cc3f1b..2d048b0 100644
--- a/engines/pink/objects/sequences/sequence_item.cpp
+++ b/engines/pink/objects/sequences/sequence_item.cpp
@@ -54,9 +54,8 @@ bool SequenceItem::execute(int index, Sequence *sequence, bool unk2) {
Actor *actor;
Action *action;
if (!(actor = sequence->_sequencer->_page->findActor(_actor)) ||
- !(action = actor->findAction(_action))) {
+ !(action = actor->findAction(_action)))
return false;
- }
actor->setAction(action, unk2);
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index 430c8c2..37947d6 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -34,8 +34,7 @@
namespace Pink {
Sequencer::Sequencer(GamePage *page)
- : _context(nullptr), _page(page), _time(0)
-{}
+ : _context(nullptr), _page(page), _time(0) {}
Sequencer::~Sequencer() {
for (uint i = 0; i < _sequences.size(); ++i) {
@@ -57,17 +56,17 @@ Sequence *Sequencer::findSequence(const Common::String &name) {
}
void Sequencer::authorSequence(Sequence *sequence, bool unk) {
- if (_context){
+ if (_context) {
}
- if (sequence){
+ if (sequence) {
_context = new SequenceContext(sequence, this);
//unload array of unknown objects
_currentSequenceName = sequence->getName();
sequence->init(unk);
- }
- else _currentSequenceName.clear();
+ } else
+ _currentSequenceName.clear();
}
void Sequencer::toConsole() {
diff --git a/engines/pink/objects/sequences/sequencer.h b/engines/pink/objects/sequences/sequencer.h
index c1b957b..5f4bebd 100644
--- a/engines/pink/objects/sequences/sequencer.h
+++ b/engines/pink/objects/sequences/sequencer.h
@@ -41,7 +41,7 @@ public:
virtual void toConsole();
virtual void deserialize(Archive &archive);
- Sequence* findSequence(const Common::String &name);
+ Sequence *findSequence(const Common::String &name);
SequenceActorState *findSequenceActorState(const Common::String &name);
void authorSequence(Sequence *sequence, bool unk);
@@ -60,8 +60,8 @@ public:
SequenceContext *_context;
// context array
- Array<Sequence*> _sequences;
- Array<SeqTimer*> _timers;
+ Array<Sequence *> _sequences;
+ Array<SeqTimer *> _timers;
Common::String _currentSequenceName;
GamePage *_page;
uint _time;
diff --git a/engines/pink/objects/side_effect.h b/engines/pink/objects/side_effect.h
index c917615..71146a7 100644
--- a/engines/pink/objects/side_effect.h
+++ b/engines/pink/objects/side_effect.h
@@ -97,8 +97,7 @@ public:
virtual void execute(Actor *actor);
};
-class SideEffectRandomPageVariable : public SideEffect
-{
+class SideEffectRandomPageVariable : public SideEffect {
public:
virtual void deserialize(Archive &archive);
virtual void toConsole();
diff --git a/engines/pink/objects/walk/walk_mgr.cpp b/engines/pink/objects/walk/walk_mgr.cpp
index c9c28f0..5b57107 100644
--- a/engines/pink/objects/walk/walk_mgr.cpp
+++ b/engines/pink/objects/walk/walk_mgr.cpp
@@ -30,10 +30,7 @@
namespace Pink {
WalkMgr::WalkMgr()
- : _isWalking(false), _leadActor(nullptr)
-{
-
-}
+ : _isWalking(false), _leadActor(nullptr) {}
void WalkMgr::deserialize(Pink::Archive &archive) {
_leadActor = static_cast<LeadActor *>(archive.readObject());
@@ -42,9 +39,8 @@ void WalkMgr::deserialize(Pink::Archive &archive) {
WalkLocation *WalkMgr::findLocation(const Common::String &name) {
for (uint i = 0; i < _locations.size(); ++i) {
- if (_locations[i]->getName() == name) {
+ if (_locations[i]->getName() == name)
return _locations[i];
- }
}
return nullptr;
}
@@ -69,8 +65,7 @@ void WalkMgr::start(WalkLocation *destination) {
if (_current.name == _destination->getName()) {
end();
- }
- else {
+ } else {
_isWalking = true;
WalkLocation *currentLocation = findLocation(_current.name);
WalkShortestPath path(this);
@@ -87,17 +82,16 @@ void WalkMgr::initNextWayPoint(WalkLocation *location) {
WalkAction *WalkMgr::getWalkAction() {
Common::String walkActionName;
- if (_current.coord.z == _next.coord.z){
- if (_next.coord.x > _current.coord.x){
+ if (_current.coord.z == _next.coord.z) {
+ if (_next.coord.x > _current.coord.x) {
walkActionName = Common::String::format("%dRight", _current.coord.z);
- }
- else walkActionName = Common::String::format("%dLeft", _next.coord.z);
- }
- else walkActionName = Common::String::format("%dTo%d", _current.coord.z, _next.coord.z);
+ } else
+ walkActionName = Common::String::format("%dLeft", _next.coord.z);
+ } else
+ walkActionName = Common::String::format("%dTo%d", _current.coord.z, _next.coord.z);
Action *action = _leadActor->findAction(walkActionName);
-
return static_cast<WalkAction*>(action);
}
@@ -136,11 +130,11 @@ void WalkMgr::update() {
WalkShortestPath path(this);
_current = _next;
WalkLocation *next = path.next(findLocation(_current.name), _destination);
- if (next){
+ if (next) {
initNextWayPoint(next);
_leadActor->setAction(getWalkAction(), 0);
- }
- else end();
+ } else
+ end();
}
diff --git a/engines/pink/objects/walk/walk_mgr.h b/engines/pink/objects/walk/walk_mgr.h
index 64bd16e..9060f08 100644
--- a/engines/pink/objects/walk/walk_mgr.h
+++ b/engines/pink/objects/walk/walk_mgr.h
@@ -63,7 +63,7 @@ private:
LeadActor *_leadActor;
WalkLocation *_destination;
- Array<WalkLocation*> _locations;
+ Array<WalkLocation *> _locations;
WayPoint _current;
WayPoint _next;
bool _isWalking;
diff --git a/engines/pink/objects/walk/walk_shortest_path.cpp b/engines/pink/objects/walk/walk_shortest_path.cpp
index 376e638..4f16f54 100644
--- a/engines/pink/objects/walk/walk_shortest_path.cpp
+++ b/engines/pink/objects/walk/walk_shortest_path.cpp
@@ -34,7 +34,7 @@ WalkLocation *WalkShortestPath::next(WalkLocation *start, WalkLocation *destinat
if (start == destination)
return nullptr;
add(start, 0.0, 0);
- while (build() != destination);
+ while (build() != destination) {}
return getNearestNeighbor(destination);
}
@@ -94,13 +94,13 @@ double WalkShortestPath::getLengthToNearestNeigbor(WalkLocation *location) {
Common::StringArray &neighbors = location->getNeigbors();
for (uint i = 0; i < neighbors.size(); ++i) {
WalkLocation *neighbor = _manager->findLocation(neighbors[i]);
- if (!isLocationVisited(neighbor)){
+ if (!isLocationVisited(neighbor)) {
double length = _manager->getLengthBetweenLocations(location, neighbor);
if (minLength >= 0.0) {
if (length < minLength)
minLength = length;
- }
- else minLength = length;
+ } else
+ minLength = length;
}
}
@@ -113,15 +113,14 @@ WalkLocation *WalkShortestPath::findNearestNeighbor(WalkLocation *location) {
Common::StringArray &neighbors = location->getNeigbors();
for (uint i = 0; i < neighbors.size(); ++i) {
WalkLocation *neighbor = _manager->findLocation(neighbors[i]);
- if (!isLocationVisited(neighbor)){
+ if (!isLocationVisited(neighbor)) {
double length = _manager->getLengthBetweenLocations(location, neighbor);
if (minLength >= 0.0) {
if (length < minLength) {
nearest = neighbor;
minLength = length;
}
- }
- else {
+ } else {
nearest = neighbor;
minLength = length;
}
@@ -149,7 +148,7 @@ bool WalkShortestPath::isLocationVisited(WalkLocation *location) {
void WalkShortestPath::remove(WalkLocation *location) {
for (uint i = 0; i < _locations.size(); ++i) {
- if (_locations[i] == location){
+ if (_locations[i] == location) {
_locations.remove_at(i);
_weight.remove_at(i);
break;
diff --git a/engines/pink/objects/walk/walk_shortest_path.h b/engines/pink/objects/walk/walk_shortest_path.h
index a3ec85d..441b6e6 100644
--- a/engines/pink/objects/walk/walk_shortest_path.h
+++ b/engines/pink/objects/walk/walk_shortest_path.h
@@ -48,11 +48,11 @@ private:
WalkMgr *_manager;
- Common::Array<WalkLocation*> _locations;
- Common::Array<WalkLocation*> _toVisit;
+ Common::Array<WalkLocation *> _locations;
+ Common::Array<WalkLocation *> _toVisit;
Common::Array<double> _weight;
- Common::Array<WalkLocation*> _visited;
- Common::Array<WalkLocation*> _nearestNeigbor;
+ Common::Array<WalkLocation *> _visited;
+ Common::Array<WalkLocation *> _nearestNeigbor;
};
} // End of namespace Pink
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index 74b38cf..0e5952b 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -38,8 +38,8 @@ namespace Pink {
Pink::PinkEngine::PinkEngine(OSystem *system, const ADGameDescription *desc)
: Engine(system), _console(nullptr), _rnd("pink"),
- _desc(*desc), _bro(nullptr), _module(nullptr), _director(_system)
-{
+ _desc(*desc), _bro(nullptr), _module(nullptr),
+ _director(_system) {
debug("PinkEngine constructed");
DebugMan.addDebugChannel(kPinkDebugGeneral, "general", "General issues");
@@ -72,14 +72,13 @@ Common::Error PinkEngine::init() {
const Common::String orbName = _desc.filesDescriptions[0].fileName;
const Common::String broName = _desc.filesDescriptions[1].fileName;
- if (strcmp(_desc.gameId, kPeril) == 0){
+ if (strcmp(_desc.gameId, kPeril) == 0)
_bro = new BroFile();
- }
- else debug("This game doesn't need to use bro");
+ else
+ debug("This game doesn't need to use bro");
- if (!_orb.open(orbName) || (_bro && !_bro->open(broName, _orb.getTimestamp()))){
+ if (!_orb.open(orbName) || (_bro && !_bro->open(broName, _orb.getTimestamp())))
return Common::kNoGameDataFoundError;
- }
if (!loadCursors())
return Common::kNoGameDataFoundError;
@@ -99,34 +98,33 @@ Common::Error Pink::PinkEngine::run() {
if (error.getCode() != Common::kNoError)
return error;
- while(!shouldQuit()){
+ while (!shouldQuit()) {
Common::Event event;
- while(_eventMan->pollEvent(event)){
- switch (event.type){
- case Common::EVENT_QUIT:
- case Common::EVENT_RTL:
- return Common::kNoError;
- case Common::EVENT_MOUSEMOVE:
- _actor->onMouseMove(event.mouse);
- break;
- case Common::EVENT_LBUTTONDOWN:
- _actor->onLeftButtonClick(event.mouse);
- break;
- case Common::EVENT_KEYDOWN:
- if (event.kbd.keycode == Common::KEYCODE_d)
- _director.showBounds = !_director.showBounds;
- else _actor->onKeyboardButtonClick(event.kbd.keycode);
- break;
-
- // don't know why it is used in original
- case Common::EVENT_LBUTTONUP:
- case Common::EVENT_RBUTTONDOWN:
- default:
- break;
+ while (_eventMan->pollEvent(event)) {
+ switch (event.type) {
+ case Common::EVENT_QUIT:
+ case Common::EVENT_RTL:
+ return Common::kNoError;
+ case Common::EVENT_MOUSEMOVE:
+ _actor->onMouseMove(event.mouse);
+ break;
+ case Common::EVENT_LBUTTONDOWN:
+ _actor->onLeftButtonClick(event.mouse);
+ break;
+ case Common::EVENT_KEYDOWN:
+ if (event.kbd.keycode == Common::KEYCODE_d)
+ _director.showBounds = !_director.showBounds;
+ else
+ _actor->onKeyboardButtonClick(event.kbd.keycode);
+ break;
+ // don't know why it is used in original
+ case Common::EVENT_LBUTTONUP:
+ case Common::EVENT_RBUTTONDOWN:
+ default:
+ break;
}
}
-
_actor->update();
_director.update();
_director.draw();
@@ -145,7 +143,7 @@ void PinkEngine::load(Archive &archive) {
void PinkEngine::initModule(const Common::String &moduleName, bool isLoadingFromSave, const Common::String &pageName) {
if (_module) {
for (uint i = 0; i < _modules.size(); ++i) {
- if (_module == _modules[i]){
+ if (_module == _modules[i]) {
_modules[i] = new ModuleProxy(_module->getName());
delete _module;
@@ -170,12 +168,10 @@ void PinkEngine::changeScene(GamePage *page) {
setCursor(kLoadingCursor);
if (!_nextModule.empty() && _nextModule.compareTo(_module->getName())) {
initModule(_nextModule, kLoadingNewGame, _nextPage);
- }
- else {
+ } else {
assert(!_nextPage.empty());
_module->changePage(_nextPage);
}
-
}
void PinkEngine::setNextExecutors(const Common::String &nextModule, const Common::String &nextPage) {
@@ -222,8 +218,7 @@ bool PinkEngine::loadCursors() {
_cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusClickableThirdCursorID));
_cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusNotClickableCursorID));
_cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusHoldingItemCursorID));
- }
- else {
+ } else {
_cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPerilClickableThirdCursorID));
_cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPerilNotClickableCursorID));
_cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPerilHoldingItemCursorID));
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index 98d962e..0faf4d5 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -111,7 +111,7 @@ private:
Console *_console;
Common::RandomSource _rnd;
- Common::Array<Graphics::WinCursorGroup*> _cursors;
+ Common::Array<Graphics::WinCursorGroup *> _cursors;
Common::String _nextModule;
Common::String _nextPage;
@@ -123,7 +123,7 @@ private:
LeadActor *_actor;
Module *_module;
- Array<NamedObject*> _modules;
+ Array<NamedObject *> _modules;
Common::StringMap _variables;
diff --git a/engines/pink/resource_mgr.cpp b/engines/pink/resource_mgr.cpp
index fbba382..810f412 100644
--- a/engines/pink/resource_mgr.cpp
+++ b/engines/pink/resource_mgr.cpp
@@ -32,8 +32,7 @@
namespace Pink {
ResourceMgr::ResourceMgr()
- : _game(nullptr), _resDescTable(nullptr),
- _resCount(0) {}
+ : _game(nullptr), _resDescTable(nullptr), _resCount(0) {}
ResourceMgr::~ResourceMgr() {
clear();
@@ -64,7 +63,8 @@ Common::SafeSeekableSubReadStream *ResourceMgr::getResourceStream(Common::String
if (desc.inBro)
stream = _game->getBro();
- else stream = _game->getOrb();
+ else
+ stream = _game->getOrb();
stream->seek(desc.offset);
diff --git a/engines/pink/sound.cpp b/engines/pink/sound.cpp
index db6ff8c..10fb049 100644
--- a/engines/pink/sound.cpp
+++ b/engines/pink/sound.cpp
@@ -31,10 +31,7 @@
namespace Pink {
Sound::Sound(Audio::Mixer *mixer, Common::SafeSeekableSubReadStream *stream)
- : _mixer(mixer), _fileStream(stream)
-{
-
-}
+ : _mixer(mixer), _fileStream(stream) {}
Sound::~Sound() {
stop();
@@ -67,8 +64,8 @@ void Sound::play(Audio::Mixer::SoundType type, int volume, bool isLoop) {
Audio::SeekableAudioStream *wavStream = Audio::makeWAVStream(_fileStream, DisposeAfterUse::NO);
if (isLoop) {
audioStream = Audio::makeLoopingAudioStream(wavStream, 0, 0, 0);
- }
- else audioStream = wavStream;
+ } else
+ audioStream = wavStream;
_mixer->playStream(type, &_handle , audioStream, -1 , 50, 0, DisposeAfterUse::YES);
}
Commit: 174b317facdf127967841b5de5b2226734d184bf
https://github.com/scummvm/scummvm/commit/174b317facdf127967841b5de5b2226734d184bf
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix formatting
Changed paths:
engines/pink/cursor_mgr.cpp
diff --git a/engines/pink/cursor_mgr.cpp b/engines/pink/cursor_mgr.cpp
index d15f695..0154a33 100644
--- a/engines/pink/cursor_mgr.cpp
+++ b/engines/pink/cursor_mgr.cpp
@@ -39,7 +39,7 @@ void CursorMgr::setCursor(uint index, Common::Point point, const Common::String
if (index == kClickableFirstFrameCursor) {
startAnimation(index);
return hideItem();
- } else if (index != kHoldingItemCursor){
+ } else if (index != kHoldingItemCursor) {
if (index != kPDASecondCursor) {
_game->setCursor(index);
@@ -78,7 +78,7 @@ void CursorMgr::update() {
return;
uint newTime = _game->getTotalPlayTime();
- if (newTime - _time > kCursorsUpdateTime){
+ if (newTime - _time > kCursorsUpdateTime) {
_time = newTime;
_isSecondFrame = !_isSecondFrame;
_game->setCursor(_firstFrameIndex + _isSecondFrame);
Commit: 65e899e723b6f8258d1aa63f7cd50805293862a3
https://github.com/scummvm/scummvm/commit/65e899e723b6f8258d1aa63f7cd50805293862a3
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix finding of resource description
Changed paths:
engines/pink/resource_mgr.cpp
diff --git a/engines/pink/resource_mgr.cpp b/engines/pink/resource_mgr.cpp
index 810f412..0981d8e 100644
--- a/engines/pink/resource_mgr.cpp
+++ b/engines/pink/resource_mgr.cpp
@@ -55,21 +55,21 @@ Sound *ResourceMgr::loadSound(Common::String &name) {
Common::SafeSeekableSubReadStream *ResourceMgr::getResourceStream(Common::String &name) {
Common::SeekableReadStream *stream;
- ResourceDescription &desc = _resDescTable[0];
+ ResourceDescription *desc;
for (uint i = 0; i < _resCount; ++i) {
if (name.compareToIgnoreCase(_resDescTable[i].name) == 0)
- desc = _resDescTable[i];
+ desc = &_resDescTable[i];
}
- if (desc.inBro)
+ if (desc->inBro)
stream = _game->getBro();
else
stream = _game->getOrb();
- stream->seek(desc.offset);
+ stream->seek(desc->offset);
- return new Common::SafeSeekableSubReadStream(stream, desc.offset,
- desc.offset + desc.size);
+ return new Common::SafeSeekableSubReadStream(stream, desc->offset,
+ desc->offset + desc->size);
}
PinkEngine *ResourceMgr::getGame() const {
Commit: b82c0eee57c97a716a943ac55a8a6e3404be0f71
https://github.com/scummvm/scummvm/commit/b82c0eee57c97a716a943ac55a8a6e3404be0f71
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: remove redundant Archive destructor
Changed paths:
engines/pink/archive.h
diff --git a/engines/pink/archive.h b/engines/pink/archive.h
index 552b2bc..843ace6 100644
--- a/engines/pink/archive.h
+++ b/engines/pink/archive.h
@@ -41,7 +41,6 @@ class Archive {
public:
Archive(Common::SeekableReadStream *stream);
Archive(Common::WriteStream *stream);
- ~Archive();
void mapObject(Object *obj);
Commit: a8baeda59e7b4ddff74d8dbe9739db6b22294978
https://github.com/scummvm/scummvm/commit/a8baeda59e7b4ddff74d8dbe9739db6b22294978
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: change linear search to binary
Changed paths:
engines/pink/resource_mgr.cpp
diff --git a/engines/pink/resource_mgr.cpp b/engines/pink/resource_mgr.cpp
index 0981d8e..8f807c2 100644
--- a/engines/pink/resource_mgr.cpp
+++ b/engines/pink/resource_mgr.cpp
@@ -52,14 +52,14 @@ Sound *ResourceMgr::loadSound(Common::String &name) {
return new Sound(_game->_mixer, getResourceStream(name));
}
+static int resDescComp(const void *a, const void *b) {
+ return scumm_stricmp((char *) a, (char *) b);
+}
+
Common::SafeSeekableSubReadStream *ResourceMgr::getResourceStream(Common::String &name) {
Common::SeekableReadStream *stream;
- ResourceDescription *desc;
- for (uint i = 0; i < _resCount; ++i) {
- if (name.compareToIgnoreCase(_resDescTable[i].name) == 0)
- desc = &_resDescTable[i];
- }
+ ResourceDescription *desc = (ResourceDescription*) bsearch(name.c_str(), _resDescTable, _resCount, sizeof(ResourceDescription), resDescComp);
if (desc->inBro)
stream = _game->getBro();
Commit: de6932f771cd9e530df52103799005dc4d3d6027
https://github.com/scummvm/scummvm/commit/de6932f771cd9e530df52103799005dc4d3d6027
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix letter case
Changed paths:
engines/pink/objects/module.h
diff --git a/engines/pink/objects/module.h b/engines/pink/objects/module.h
index a0735bf..16bda6c 100644
--- a/engines/pink/objects/module.h
+++ b/engines/pink/objects/module.h
@@ -50,9 +50,9 @@ public:
void init(bool isLoadingSave, const Common::String &pageName);
void changePage(const Common::String &pageName);
- void OnLeftButtonDown();
- void OnMouseMove();
- void OnKeyboardButtonClick();
+ void onLeftButtonDown();
+ void onMouseMove();
+ void onKeyboardButtonClick();
PinkEngine *getGame() const;
InventoryMgr *getInventoryMgr();
Commit: 120298840371bd3e13380a10203bd96eff062cb8
https://github.com/scummvm/scummvm/commit/120298840371bd3e13380a10203bd96eff062cb8
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added streams getters to archive
Changed paths:
engines/pink/archive.h
diff --git a/engines/pink/archive.h b/engines/pink/archive.h
index 843ace6..ce9ac0b 100644
--- a/engines/pink/archive.h
+++ b/engines/pink/archive.h
@@ -42,6 +42,9 @@ public:
Archive(Common::SeekableReadStream *stream);
Archive(Common::WriteStream *stream);
+ Common::SeekableReadStream *getReadStream() { return _readStream; }
+ Common::WriteStream *getWriteStream() { return _writeStream; };
+
void mapObject(Object *obj);
int readCount();
Commit: ed3f9dcaa849f52395466d3d2660476a3579c1cb
https://github.com/scummvm/scummvm/commit/ed3f9dcaa849f52395466d3d2660476a3579c1cb
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added methods to read/write Byte in archive
Changed paths:
engines/pink/archive.cpp
engines/pink/archive.h
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp
index beec60b..58dc584 100644
--- a/engines/pink/archive.cpp
+++ b/engines/pink/archive.cpp
@@ -317,6 +317,10 @@ Common::String Archive::readString() {
return Common::String(buffer, len);
}
+byte Archive::readByte() {
+ return _readStream->readByte();
+}
+
uint32 Archive::readDWORD() {
return _readStream->readUint32LE();
}
@@ -325,6 +329,10 @@ uint16 Archive::readWORD() {
return _readStream->readUint16LE();
}
+void Archive::writeByte(byte val) {
+ return _writeStream->writeByte(val);
+}
+
void Archive::writeDWORD(uint32 val) {
_writeStream->writeUint32LE(val);
}
diff --git a/engines/pink/archive.h b/engines/pink/archive.h
index ce9ac0b..d0665ea 100644
--- a/engines/pink/archive.h
+++ b/engines/pink/archive.h
@@ -48,9 +48,11 @@ public:
void mapObject(Object *obj);
int readCount();
+ byte readByte();
uint32 readDWORD();
uint16 readWORD();
+ void writeByte(byte val);
void writeDWORD(uint32 val);
void writeWORD(uint16 val);
Commit: 147904f53a99a974eacadfec94efc8f7e7b6a3b9
https://github.com/scummvm/scummvm/commit/147904f53a99a974eacadfec94efc8f7e7b6a3b9
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: add StringMap serialization
Changed paths:
engines/pink/utils.h
diff --git a/engines/pink/utils.h b/engines/pink/utils.h
index d5ef9a4..2a01ba9 100644
--- a/engines/pink/utils.h
+++ b/engines/pink/utils.h
@@ -30,7 +30,7 @@ namespace Pink {
template <typename T>
class Array : public Common::Array<T>, public Object {
public:
- virtual void deserialize(Archive &archive) {
+ void deserialize(Archive &archive) {
uint size = archive.readCount();
this->resize(size);
for (uint i = 0; i < size; ++i) {
@@ -41,7 +41,7 @@ public:
class StringArray : public Common::StringArray {
public:
- inline void deserialize(Archive &archive) {
+ void deserialize(Archive &archive) {
uint32 size = archive.readCount();
this->resize(size);
for (uint i = 0; i < size; ++i) {
@@ -50,6 +50,26 @@ public:
}
};
+class StringMap : public Common::StringMap {
+public:
+ void serialize(Archive &archive) {
+ archive.writeWORD(size());
+ for (Common::StringMap::const_iterator it = begin(); it != end(); ++it) {
+ archive.writeString(it->_key);
+ archive.writeString(it->_value);
+ }
+ }
+
+ void deserialize(Archive &archive) {
+ uint size = archive.readWORD();
+ for (uint i = 0; i < size; ++i) {
+ Common::String key = archive.readString();
+ Common::String val = archive.readString();
+ setVal(key, val);
+ }
+ }
+};
+
} // End of namespace Pink
#endif
Commit: 0b4c0b2bee299d2ea46dcb795f8fa19fa2bc4837
https://github.com/scummvm/scummvm/commit/0b4c0b2bee299d2ea46dcb795f8fa19fa2bc4837
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: add saving and loading state of sequencer
Changed paths:
engines/pink/objects/sequences/sequencer.cpp
engines/pink/objects/sequences/sequencer.h
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index 37947d6..8facfe3 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -127,4 +127,17 @@ SequenceActorState *Sequencer::findSequenceActorState(const Common::String &name
return nullptr;
}
+void Sequencer::loadState(Archive &archive) {
+ Sequence *sequence = findSequence(archive.readString());
+ authorSequence(sequence, 1);
+}
+
+void Sequencer::saveState(Archive &archive) {
+ Common::String sequenceName;
+ if (_context)
+ sequenceName = _context->_sequence->getName();
+ archive.writeString(sequenceName);
+ // add pokus specific
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/sequences/sequencer.h b/engines/pink/objects/sequences/sequencer.h
index 5f4bebd..d34775a 100644
--- a/engines/pink/objects/sequences/sequencer.h
+++ b/engines/pink/objects/sequences/sequencer.h
@@ -54,7 +54,8 @@ public:
void restartSequence();
void skipToLastSubSequence();
-
+ void loadState(Archive &archive);
+ void saveState(Archive &archive);
public:
void updateTimers();
Commit: 04a0c4ead6e76f4eb4dcef8faa1d8d3138465289
https://github.com/scummvm/scummvm/commit/04a0c4ead6e76f4eb4dcef8faa1d8d3138465289
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: add saving/loading state of WalkMgr
Changed paths:
engines/pink/objects/walk/walk_mgr.cpp
engines/pink/objects/walk/walk_mgr.h
diff --git a/engines/pink/objects/walk/walk_mgr.cpp b/engines/pink/objects/walk/walk_mgr.cpp
index 5b57107..0df4a54 100644
--- a/engines/pink/objects/walk/walk_mgr.cpp
+++ b/engines/pink/objects/walk/walk_mgr.cpp
@@ -143,4 +143,26 @@ void WalkMgr::end() {
_leadActor->onWalkEnd();
}
+void WalkMgr::loadState(Archive &archive) {
+ _isWalking = archive.readByte();
+ _current.name = archive.readString();
+ if (!_current.name.empty()) {
+ _current.coord = getLocationCoordinates(_current.name);
+ }
+ if (_isWalking) {
+ _next.name = archive.readString();
+ _destination = findLocation(archive.readString());
+ _next.coord = getLocationCoordinates(_next.name);
+ }
+}
+
+void WalkMgr::saveState(Archive &archive) {
+ archive.writeByte(_isWalking);
+ archive.writeString(_current.name);
+ if (_isWalking) {
+ archive.writeString(_next.name);
+ archive.writeString(_destination->getName());
+ }
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/walk/walk_mgr.h b/engines/pink/objects/walk/walk_mgr.h
index 9060f08..2decdd8 100644
--- a/engines/pink/objects/walk/walk_mgr.h
+++ b/engines/pink/objects/walk/walk_mgr.h
@@ -45,6 +45,9 @@ public:
double getLengthBetweenLocations(WalkLocation *first, WalkLocation *second);
void setCurrentWayPoint(WalkLocation *location);
+ void loadState(Archive &archive);
+ void saveState(Archive &archive);
+
private:
struct Coordinates {
int x;
Commit: 9b5dac452df50deb9b01b8c49b911c7c91a41643
https://github.com/scummvm/scummvm/commit/9b5dac452df50deb9b01b8c49b911c7c91a41643
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: add state saving/loading of Inventory
Changed paths:
engines/pink/objects/inventory.cpp
engines/pink/objects/inventory.h
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
index 13d0dfd..4a7d02d 100644
--- a/engines/pink/objects/inventory.cpp
+++ b/engines/pink/objects/inventory.cpp
@@ -118,7 +118,7 @@ bool InventoryMgr::start(bool playOpening) {
_rightArrow = _lead->getPage()->findActor(kInventoryRightArrowActor);
_leftArrow = _lead->getPage()->findActor(kInventoryLeftArrowActor);
- if (playOpening){
+ if (playOpening) {
_window->setAction(kOpenAction);
_state = kOpening;
}
@@ -195,4 +195,35 @@ InventoryItem *InventoryMgr::getCurrentItem() {
return _item;
}
+void InventoryMgr::loadState(Archive &archive) {
+ _state = (State) archive.readByte();
+ _isClickedOnItem = archive.readByte();
+
+ for (uint i = 0; i < _items.size(); ++i) {
+ _items[i]->_currentOwner = archive.readString();
+ }
+
+ const Common::String currItemName = archive.readString();
+ if (!currItemName.empty()) {
+ _item = nullptr;
+ _isClickedOnItem = 0;
+ } else {
+ _item = findInventoryItem(currItemName);
+ }
+}
+
+void InventoryMgr::saveState(Archive &archive) {
+ archive.writeByte(_state);
+ archive.writeByte(_isClickedOnItem);
+
+ for (uint i = 0; i < _items.size(); ++i) {
+ archive.writeString(_items[i]->_currentOwner);
+ }
+
+ if (_item)
+ archive.writeString(_item->_currentOwner);
+ else
+ archive.writeString(Common::String());
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/inventory.h b/engines/pink/objects/inventory.h
index f09e1e8..104a8e8 100644
--- a/engines/pink/objects/inventory.h
+++ b/engines/pink/objects/inventory.h
@@ -53,6 +53,9 @@ public:
virtual void deserialize(Archive &archive);
virtual void toConsole();
+ void loadState(Archive &archive);
+ void saveState(Archive &archive);
+
void update();
void onClick(Common::Point point);
Commit: 578b93af203272e9913adcc4ff793d25ac337e1a
https://github.com/scummvm/scummvm/commit/578b93af203272e9913adcc4ff793d25ac337e1a
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: add state saving/loading of LeadActor
Changed paths:
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/actors/lead_actor.h
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 484871a..9279871 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -312,6 +312,35 @@ bool LeadActor::isInteractingWith(SupportingActor *actor) {
return actor->isUseClickHandlers(_page->getModule()->getInventoryMgr()->getCurrentItem());
}
+void LeadActor::loadState(Archive &archive) {
+ _state = (State) archive.readByte();
+ _nextState = (State) archive.readByte();
+ _stateCopy = (State) archive.readByte();
+ _isHaveItem = archive.readByte();
+ Common::String recepient = archive.readString();
+ if (!recepient.empty())
+ _recipient = (SupportingActor*) _page->findActor(recepient);
+ else
+ _recipient = nullptr;
+ _sequencer->loadState(archive);
+ _walkMgr->loadState(archive);
+
+ // load audioInfoMgr, PDAMgr
+}
+
+void LeadActor::saveState(Archive &archive) {
+ archive.writeByte(_state);
+ archive.writeByte(_nextState);
+ archive.writeByte(_stateCopy);
+ archive.writeByte(_isHaveItem);
+ if (_recipient)
+ archive.writeString(_recipient->getName());
+ else
+ archive.writeString(Common::String());
+ _sequencer->saveState(archive);
+ _walkMgr->saveState(archive);
+}
+
void ParlSqPink::toConsole() {
debug("ParlSqPink: _name = %s", _name.c_str());
for (uint i = 0; i < _actions.size(); ++i) {
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index 7dff2e8..d058ec6 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -77,6 +77,10 @@ public:
bool isInteractingWith(SupportingActor *actor);
+ virtual void loadState(Archive &archive);
+
+ virtual void saveState(Archive &archive);
+
protected:
virtual void updateCursor(Common::Point point);
void forceUpdateCursor();
Commit: d6b1b9396e54f78fb49c6c0b123e9463f91be676
https://github.com/scummvm/scummvm/commit/d6b1b9396e54f78fb49c6c0b123e9463f91be676
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: add state saving/loading of Module and GamePage
Changed paths:
engines/pink/objects/module.cpp
engines/pink/objects/module.h
engines/pink/objects/pages/game_page.cpp
engines/pink/objects/pages/game_page.h
diff --git a/engines/pink/objects/module.cpp b/engines/pink/objects/module.cpp
index cdb3746..a09e202 100644
--- a/engines/pink/objects/module.cpp
+++ b/engines/pink/objects/module.cpp
@@ -23,6 +23,7 @@
#include "pink/pink.h"
#include "pink/objects/module.h"
#include "pink/objects/pages/game_page.h"
+#include "pink/objects/actors/lead_actor.h"
namespace Pink {
@@ -99,4 +100,29 @@ InventoryMgr *Module::getInventoryMgr() {
return &_invMgr;
}
+void Module::loadState(Archive &archive) {
+ _invMgr.loadState(archive);
+ _variables.deserialize(archive);
+
+ for (uint i = 0; i < _pages.size(); ++i) {
+ _pages[i]->loadState(archive);
+ }
+
+ _page = findPage(archive.readString());
+ _page->loadManagers();
+ _page->getLeadActor()->loadState(archive);
+}
+
+void Module::saveState(Archive &archive) {
+ _invMgr.saveState(archive);
+ _variables.serialize(archive);
+
+ for (uint i = 0; i < _pages.size(); ++i) {
+ _pages[i]->saveState(archive);
+ }
+
+ archive.writeString(_page->getName());
+ _page->getLeadActor()->saveState(archive);
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/module.h b/engines/pink/objects/module.h
index 16bda6c..084fb19 100644
--- a/engines/pink/objects/module.h
+++ b/engines/pink/objects/module.h
@@ -46,6 +46,9 @@ public:
Module(PinkEngine *game, const Common::String &name);
~Module();
+ void loadState(Archive &archive);
+ void saveState(Archive &archive);
+
void load(Archive &archive);
void init(bool isLoadingSave, const Common::String &pageName);
void changePage(const Common::String &pageName);
@@ -60,6 +63,8 @@ public:
bool checkValueOfVariable(Common::String &variable, Common::String &value);
void setVariable(Common::String &variable, Common::String &value);
+ GamePage *getPage() { return _page; };
+
private:
GamePage *findPage(const Common::String &pageName) const;
@@ -67,7 +72,7 @@ private:
GamePage *_page;
Array<GamePage *> _pages;
InventoryMgr _invMgr;
- Common::StringMap _variables;
+ StringMap _variables;
};
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index 8e53444..883e129 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -112,7 +112,7 @@ void GamePage::loadManagers() {
_resMgr.init(_module->getGame(), this);
if (_memFile != nullptr) {
- loadState();
+ loadStateFromMem();
delete _memFile;
_memFile = nullptr;
@@ -146,51 +146,50 @@ WalkMgr *GamePage::getWalkMgr() {
return _walkMgr;
}
-void GamePage::loadState() {
+void GamePage::loadStateFromMem() {
Archive archive(static_cast<Common::SeekableReadStream*>(_memFile));
- //_variables.clear(1);
- Common::StringMap mapTest; // HACK. Without it isn't working
- //archive >> _variables;
+ _variables.deserialize(archive);
- uint size = archive.readCount();
- for (uint i = 0; i < size; ++i) {
- Common::String key = archive.readString();
- Common::String val = archive.readString();
- mapTest.setVal(key, val);
- }
-
- _variables = mapTest;
-
- uint16 actorCount = archive.readWORD();
-
- Common::String actorName;
- for (int i = 0; i < actorCount; ++i) {
- actorName = archive.readString();
- findActor(actorName)->loadState(archive);
+ for (uint i = 0; i < _actors.size(); ++i) {
+ _actors[i]->loadState(archive);
}
}
-void GamePage::saveState() {
+void GamePage::saveStateToMem() {
_memFile = new Common::MemoryReadWriteStream(DisposeAfterUse::YES);
Archive archive(static_cast<Common::WriteStream*>(_memFile));
+ _variables.serialize(archive);
- for (Common::StringMap::const_iterator it = _variables.begin(); it != _variables.end(); ++it) {
- archive.writeString(it->_key);
- archive.writeString(it->_value);
- }
-
- archive.writeWORD(_actors.size());
for (uint i = 0; i < _actors.size(); ++i) {
- archive.writeString(_actors[i]->getName());
_actors[i]->saveState(archive);
}
+}
+void GamePage::loadState(Archive &archive) {
+ uint size = archive.readDWORD();
+ _memFile = new Common::MemoryReadWriteStream(DisposeAfterUse::YES);
+ for (uint i = 0; i < size; ++i) {
+ _memFile->writeByte(_memFile->readByte());
+ }
+}
+
+void GamePage::saveState(Archive &archive) {
+ if (this == _module->getPage()) {
+ saveStateToMem();
+ archive.writeDWORD(_memFile->size());
+ } else {
+ if (_memFile != nullptr) {
+ archive.writeDWORD(_memFile->size());
+ archive.getWriteStream()->write(_memFile->getData(), _memFile->size());
+ } else
+ archive.writeDWORD(0);
+ }
}
void GamePage::unload() {
_leadActor->setAction(_leadActor->findAction(kIdleAction));
- saveState();
+ saveStateToMem();
clear();
_isLoaded = false;
@@ -198,7 +197,7 @@ void GamePage::unload() {
void GamePage::clear() {
Page::clear();
- //_variables.clear(1);
+ _variables.clear(1);
for (uint i = 0; i < _handlers.size(); ++i) {
delete _handlers[i];
diff --git a/engines/pink/objects/pages/game_page.h b/engines/pink/objects/pages/game_page.h
index 1c7e5cf..7b4f25f 100644
--- a/engines/pink/objects/pages/game_page.h
+++ b/engines/pink/objects/pages/game_page.h
@@ -41,6 +41,9 @@ public:
virtual void toConsole();
virtual void deserialize(Archive &archive);
+ void loadState(Archive &archive);
+ void saveState(Archive &archive);
+
virtual void load(Archive &archive);
void unload();
void loadManagers();
@@ -58,8 +61,9 @@ public:
private:
bool initHandler();
- void loadState();
- void saveState();
+
+ void loadStateFromMem();
+ void saveStateToMem();
bool _isLoaded;
Common::MemoryReadWriteStream *_memFile;
@@ -68,7 +72,7 @@ private:
WalkMgr *_walkMgr;
Sequencer *_sequencer;
Array<HandlerStartPage *> _handlers;
- Common::StringMap _variables;
+ StringMap _variables;
};
}
Commit: 4f13df48280c5d0a5c3701be557fdf486d2ae70b
https://github.com/scummvm/scummvm/commit/4f13df48280c5d0a5c3701be557fdf486d2ae70b
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: add saving/loading of game.
It's bugged, but playable
Changed paths:
engines/pink/detection.cpp
engines/pink/detection_tables.h
engines/pink/pink.cpp
engines/pink/pink.h
diff --git a/engines/pink/detection.cpp b/engines/pink/detection.cpp
index 771db19..619bf5d 100644
--- a/engines/pink/detection.cpp
+++ b/engines/pink/detection.cpp
@@ -46,14 +46,50 @@ public:
return "Pink Panther Engine (C) Wanderlust Interactive";
}
- //virtual bool hasFeature(MetaEngineFeature f) const;
- //virtual int getMaximumSaveSlot() const { return 0; }
- //virtual SaveStateList listSaves(const char *target) const;
- //virtual void removeSaveState(const char *target, int slot) const;
+ virtual bool hasFeature(MetaEngineFeature f) const;
+ virtual int getMaximumSaveSlot() const { return 99; }
+ virtual SaveStateList listSaves(const char *target) const;
+ virtual void removeSaveState(const char *target, int slot) const;
//virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const;
virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
};
+bool PinkMetaEngine::hasFeature(MetaEngineFeature f) const {
+ return
+ (f == kSupportsListSaves) ||
+ (f == kSupportsDeleteSave) ||
+ (f == kSupportsLoadingDuringStartup) ||
+ (f == kSimpleSavesNames);
+}
+
+SaveStateList PinkMetaEngine::listSaves(const char *target) const {
+ Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
+ Common::String pattern = Common::String::format("%s.s##", target);
+ Common::StringArray filenames = saveFileMan->listSavefiles(pattern);
+
+ SaveStateList saveList;
+ for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
+ // Obtain the last 2 digits of the filename, since they correspond to the save slot
+ int slotNum = atoi(file->c_str() + file->size() - 2);
+ if (slotNum >= 0 && slotNum <= getMaximumSaveSlot()) {
+ Common::ScopedPtr<Common::InSaveFile> in(saveFileMan->openForLoading(*file));
+ if (in) {
+ SaveStateDescriptor desc;
+ desc.setSaveSlot(slotNum);
+ saveList.push_back(desc);
+ }
+ }
+ }
+
+ // Sort saves based on slot number.
+ Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
+ return saveList;
+}
+
+void PinkMetaEngine::removeSaveState(const char *target, int slot) const {
+ g_system->getSavefileManager()->removeSavefile(Pink::generateSaveName(slot, target));
+}
+
bool PinkMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
if (desc)
*engine = new Pink::PinkEngine(syst, desc);
diff --git a/engines/pink/detection_tables.h b/engines/pink/detection_tables.h
index 5a9f27a..a0062d7 100644
--- a/engines/pink/detection_tables.h
+++ b/engines/pink/detection_tables.h
@@ -39,7 +39,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::EN_ANY,
Common::kPlatformWindows,
- ADGF_UNSTABLE,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE)
},
{
@@ -52,7 +52,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::EN_ANY,
Common::kPlatformWindows,
- ADGF_UNSTABLE,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE)
},
AD_TABLE_END_MARKER
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index 0e5952b..62bb4f4 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -88,7 +88,10 @@ Common::Error PinkEngine::init() {
_orb.loadGame(this);
- initModule(_modules[0]->getName(), kLoadingNewGame, "");
+ if (ConfMan.hasKey("save_slot")) {
+ loadGameState(ConfMan.getInt("save_slot"));
+ }
+ else initModule(_modules[0]->getName(), "", nullptr);
return Common::kNoError;
}
@@ -140,7 +143,7 @@ void PinkEngine::load(Archive &archive) {
_modules.deserialize(archive);
}
-void PinkEngine::initModule(const Common::String &moduleName, bool isLoadingFromSave, const Common::String &pageName) {
+void PinkEngine::initModule(const Common::String &moduleName, const Common::String &pageName, Archive *saveFile) {
if (_module) {
for (uint i = 0; i < _modules.size(); ++i) {
if (_module == _modules[i]) {
@@ -158,7 +161,9 @@ void PinkEngine::initModule(const Common::String &moduleName, bool isLoadingFrom
if (_modules[i]->getName() == moduleName) {
loadModule(i);
_module = static_cast<Module*>(_modules[i]);
- _module->init(isLoadingFromSave, pageName);
+ if (saveFile)
+ _module->loadState(*saveFile);
+ _module->init( saveFile ? kLoadingSave : kLoadingNewGame, pageName);
break;
}
}
@@ -167,7 +172,7 @@ void PinkEngine::initModule(const Common::String &moduleName, bool isLoadingFrom
void PinkEngine::changeScene(GamePage *page) {
setCursor(kLoadingCursor);
if (!_nextModule.empty() && _nextModule.compareTo(_module->getName())) {
- initModule(_nextModule, kLoadingNewGame, _nextPage);
+ initModule(_nextModule, _nextPage, nullptr);
} else {
assert(!_nextPage.empty());
_module->changePage(_nextPage);
@@ -241,4 +246,53 @@ void PinkEngine::setCursor(uint cursorIndex) {
cursor->getHotspotX(), cursor->getHotspotY(), cursor->getKeyColor());
}
+Common::Error PinkEngine::loadGameState(int slot) {
+ Common::SeekableReadStream *stream = _saveFileMan->openForLoading(generateSaveName(slot, _desc.gameId));
+ if (!stream)
+ return Common::kNoGameDataFoundError;
+
+ Archive archive(stream);
+ _variables.deserialize(archive);
+ _nextModule = archive.readString();
+ _nextPage = archive.readString();
+ initModule(archive.readString(), "", &archive);
+
+ return Common::kNoError;
+}
+
+bool PinkEngine::canLoadGameStateCurrently() {
+ return true;
+}
+
+Common::Error PinkEngine::saveGameState(int slot, const Common::String &desc) {
+ Common::WriteStream *stream = _saveFileMan->openForSaving(generateSaveName(slot, _desc.gameId));
+ if (!stream)
+ return Common::kUnknownError;
+
+ Archive archive(stream);
+ _variables.serialize(archive);
+ archive.writeString(_nextModule);
+ archive.writeString(_nextPage);
+
+ archive.writeString(_module->getName());
+ _module->saveState(archive);
+
+ delete stream;
+
+ return Common::kNoError;
+}
+
+bool PinkEngine::canSaveGameStateCurrently() {
+ return true;
+}
+
+bool PinkEngine::hasFeature(Engine::EngineFeature f) const {
+ return f == kSupportsLoadingDuringRuntime ||
+ f == kSupportsSavingDuringRuntime;
+}
+
+Common::String generateSaveName(int slot, const char *gameId) {
+ return Common::String::format("%s.s%02d", gameId, slot);
+}
+
}
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index 0faf4d5..caa5b02 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -87,8 +87,16 @@ public:
virtual Common::Error run();
+ virtual bool hasFeature(EngineFeature f) const;
+
+ virtual Common::Error loadGameState(int slot);
+ virtual bool canLoadGameStateCurrently();
+
+ virtual Common::Error saveGameState(int slot, const Common::String &desc);
+ virtual bool canSaveGameStateCurrently();
+
void load(Archive &archive);
- void initModule(const Common::String &moduleName, bool isLoadingFromSave, const Common::String &pageName);
+ void initModule(const Common::String &moduleName, const Common::String &pageName, Archive *saveFile);
void changeScene(GamePage *page);
OrbFile *getOrb() { return &_orb; }
@@ -125,11 +133,13 @@ private:
Module *_module;
Array<NamedObject *> _modules;
- Common::StringMap _variables;
+ StringMap _variables;
const ADGameDescription _desc;
};
+Common::String generateSaveName(int slot, const char *gameId);
+
} // End of namespace Pink
#endif
Commit: 1df85834a80a96150fca43aa764dc670d3d71162
https://github.com/scummvm/scummvm/commit/1df85834a80a96150fca43aa764dc670d3d71162
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: add improved pause support
Changed paths:
engines/pink/director.cpp
engines/pink/director.h
engines/pink/pink.cpp
engines/pink/pink.h
diff --git a/engines/pink/director.cpp b/engines/pink/director.cpp
index 14aa40d..b6f1614 100644
--- a/engines/pink/director.cpp
+++ b/engines/pink/director.cpp
@@ -139,4 +139,10 @@ Actor *Director::getActorByPoint(Common::Point point) {
return nullptr;
}
+void Director::pause(bool pause) {
+ for (uint i = 0; i < _sprites.size() ; ++i) {
+ _sprites[i]->getDecoder()->pauseVideo(pause);
+ }
+}
+
}
diff --git a/engines/pink/director.h b/engines/pink/director.h
index 99622e3..053a01a 100644
--- a/engines/pink/director.h
+++ b/engines/pink/director.h
@@ -51,6 +51,8 @@ public:
void clear();
+ void pause(bool pause);
+
bool showBounds;
private:
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index 62bb4f4..edbf8d9 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -291,6 +291,11 @@ bool PinkEngine::hasFeature(Engine::EngineFeature f) const {
f == kSupportsSavingDuringRuntime;
}
+void PinkEngine::pauseEngineIntern(bool pause) {
+ Engine::pauseEngineIntern(pause);
+ _director.pause(pause);
+}
+
Common::String generateSaveName(int slot, const char *gameId) {
return Common::String::format("%s.s%02d", gameId, slot);
}
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index caa5b02..1e0f703 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -111,6 +111,9 @@ public:
void setVariable(Common::String &variable, Common::String &value);
bool checkValueOfVariable(Common::String &variable, Common::String &value);
+protected:
+ virtual void pauseEngineIntern(bool pause);
+
private:
Common::Error init();
bool loadCursors();
Commit: fa96cc41f8e2c78364ff58d29dd1a5f60c9d7fdb
https://github.com/scummvm/scummvm/commit/fa96cc41f8e2c78364ff58d29dd1a5f60c9d7fdb
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: add RTL feature
Changed paths:
engines/pink/pink.cpp
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index edbf8d9..df630f1 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -88,10 +88,10 @@ Common::Error PinkEngine::init() {
_orb.loadGame(this);
- if (ConfMan.hasKey("save_slot")) {
+ if (ConfMan.hasKey("save_slot"))
loadGameState(ConfMan.getInt("save_slot"));
- }
- else initModule(_modules[0]->getName(), "", nullptr);
+ else
+ initModule(_modules[0]->getName(), "", nullptr);
return Common::kNoError;
}
@@ -287,8 +287,10 @@ bool PinkEngine::canSaveGameStateCurrently() {
}
bool PinkEngine::hasFeature(Engine::EngineFeature f) const {
- return f == kSupportsLoadingDuringRuntime ||
- f == kSupportsSavingDuringRuntime;
+ return
+ f == kSupportsRTL ||
+ f == kSupportsLoadingDuringRuntime ||
+ f == kSupportsSavingDuringRuntime;
}
void PinkEngine::pauseEngineIntern(bool pause) {
Commit: 6ba76faa33fcc6f11dd21e49aadea32343476c86
https://github.com/scummvm/scummvm/commit/6ba76faa33fcc6f11dd21e49aadea32343476c86
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix disappearing cursor after exiting from GMM
Changed paths:
engines/pink/pink.cpp
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index df630f1..d886c77 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -296,6 +296,7 @@ bool PinkEngine::hasFeature(Engine::EngineFeature f) const {
void PinkEngine::pauseEngineIntern(bool pause) {
Engine::pauseEngineIntern(pause);
_director.pause(pause);
+ _system->showMouse(!pause);
}
Common::String generateSaveName(int slot, const char *gameId) {
Commit: 90864279f4a0761ff43fc9c412b6c76d98a0a019
https://github.com/scummvm/scummvm/commit/90864279f4a0761ff43fc9c412b6c76d98a0a019
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fixes to save system
Changed paths:
engines/pink/objects/actors/actor.cpp
engines/pink/objects/inventory.cpp
engines/pink/objects/pages/game_page.cpp
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index abcb665..a1d179b 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -132,9 +132,7 @@ Actor::~Actor() {
}
void Actor::loadState(Archive &archive) {
- Common::String actionName;
- actionName = archive.readString();
- _action = findAction(actionName);
+ _action = findAction(archive.readString());
}
void Actor::saveState(Archive &archive) {
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
index 4a7d02d..3ae4eff 100644
--- a/engines/pink/objects/inventory.cpp
+++ b/engines/pink/objects/inventory.cpp
@@ -204,7 +204,7 @@ void InventoryMgr::loadState(Archive &archive) {
}
const Common::String currItemName = archive.readString();
- if (!currItemName.empty()) {
+ if (currItemName.empty()) {
_item = nullptr;
_isClickedOnItem = 0;
} else {
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index 883e129..f6b843f 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -169,7 +169,7 @@ void GamePage::loadState(Archive &archive) {
uint size = archive.readDWORD();
_memFile = new Common::MemoryReadWriteStream(DisposeAfterUse::YES);
for (uint i = 0; i < size; ++i) {
- _memFile->writeByte(_memFile->readByte());
+ _memFile->writeByte(archive.readByte());
}
}
@@ -177,12 +177,15 @@ void GamePage::saveState(Archive &archive) {
if (this == _module->getPage()) {
saveStateToMem();
archive.writeDWORD(_memFile->size());
+ archive.getWriteStream()->write(_memFile->getData(), _memFile->size());
+ delete _memFile;
} else {
if (_memFile != nullptr) {
archive.writeDWORD(_memFile->size());
archive.getWriteStream()->write(_memFile->getData(), _memFile->size());
- } else
+ } else {
archive.writeDWORD(0);
+ }
}
}
Commit: e7a7d6960d605b668da0332ee75605d52d0c7543
https://github.com/scummvm/scummvm/commit/e7a7d6960d605b668da0332ee75605d52d0c7543
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: add savestate metadata support
Changed paths:
engines/pink/detection.cpp
engines/pink/pink.cpp
engines/pink/pink.h
diff --git a/engines/pink/detection.cpp b/engines/pink/detection.cpp
index 619bf5d..71b3535 100644
--- a/engines/pink/detection.cpp
+++ b/engines/pink/detection.cpp
@@ -50,7 +50,7 @@ public:
virtual int getMaximumSaveSlot() const { return 99; }
virtual SaveStateList listSaves(const char *target) const;
virtual void removeSaveState(const char *target, int slot) const;
- //virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const;
+ virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const;
virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
};
@@ -58,6 +58,10 @@ bool PinkMetaEngine::hasFeature(MetaEngineFeature f) const {
return
(f == kSupportsListSaves) ||
(f == kSupportsDeleteSave) ||
+ (f == kSavesSupportMetaInfo) ||
+ (f == kSavesSupportThumbnail) ||
+ (f == kSavesSupportCreationDate) ||
+ (f == kSavesSupportPlayTime) ||
(f == kSupportsLoadingDuringStartup) ||
(f == kSimpleSavesNames);
}
@@ -90,6 +94,20 @@ void PinkMetaEngine::removeSaveState(const char *target, int slot) const {
g_system->getSavefileManager()->removeSavefile(Pink::generateSaveName(slot, target));
}
+SaveStateDescriptor PinkMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
+ Common::ScopedPtr<Common::InSaveFile> f(g_system->getSavefileManager()->openForLoading(Pink::generateSaveName(slot, target)));
+
+ if (f) {
+ SaveStateDescriptor desc;
+ if (!Pink::readSaveHeader(*f.get(), desc))
+ return SaveStateDescriptor();
+
+ return desc;
+ }
+
+ return SaveStateDescriptor();
+}
+
bool PinkMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
if (desc)
*engine = new Pink::PinkEngine(syst, desc);
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index d886c77..01f9ad1 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -20,6 +20,8 @@
*
*/
+#include <graphics/thumbnail.h>
+#include <graphics/surface.h>
#include "common/debug-channels.h"
#include "common/winexe_pe.h"
#include "common/config-manager.h"
@@ -247,11 +249,15 @@ void PinkEngine::setCursor(uint cursorIndex) {
}
Common::Error PinkEngine::loadGameState(int slot) {
- Common::SeekableReadStream *stream = _saveFileMan->openForLoading(generateSaveName(slot, _desc.gameId));
- if (!stream)
+ Common::SeekableReadStream *in = _saveFileMan->openForLoading(generateSaveName(slot, _desc.gameId));
+ if (!in)
return Common::kNoGameDataFoundError;
- Archive archive(stream);
+ SaveStateDescriptor desc;
+ if (!readSaveHeader(*in, desc))
+ return Common::kUnknownError;
+
+ Archive archive(in);
_variables.deserialize(archive);
_nextModule = archive.readString();
_nextPage = archive.readString();
@@ -265,11 +271,26 @@ bool PinkEngine::canLoadGameStateCurrently() {
}
Common::Error PinkEngine::saveGameState(int slot, const Common::String &desc) {
- Common::WriteStream *stream = _saveFileMan->openForSaving(generateSaveName(slot, _desc.gameId));
- if (!stream)
+ Common::OutSaveFile *out = _saveFileMan->openForSaving(generateSaveName(slot, _desc.gameId));
+ if (!out)
+ return Common::kUnknownError;
+
+ Archive archive(out);
+
+ out->write("pink", 4);
+ archive.writeString(desc);
+
+ TimeDate curTime;
+ _system->getTimeAndDate(curTime);
+
+ out->writeUint32LE(((curTime.tm_mday & 0xFF) << 24) | (((curTime.tm_mon + 1) & 0xFF) << 16) | ((curTime.tm_year + 1900) & 0xFFFF));
+ out->writeUint16LE(((curTime.tm_hour & 0xFF) << 8) | ((curTime.tm_min) & 0xFF));
+
+ out->writeUint32LE(getTotalPlayTime() / 1000);
+
+ if (!Graphics::saveThumbnail(*out))
return Common::kUnknownError;
- Archive archive(stream);
_variables.serialize(archive);
archive.writeString(_nextModule);
archive.writeString(_nextPage);
@@ -277,7 +298,7 @@ Common::Error PinkEngine::saveGameState(int slot, const Common::String &desc) {
archive.writeString(_module->getName());
_module->saveState(archive);
- delete stream;
+ delete out;
return Common::kNoError;
}
@@ -303,4 +324,37 @@ Common::String generateSaveName(int slot, const char *gameId) {
return Common::String::format("%s.s%02d", gameId, slot);
}
+bool readSaveHeader(Common::InSaveFile &in, SaveStateDescriptor &desc) {
+ char pink[4];
+ in.read(&pink, 4);
+ if (strcmp(pink, "pink"))
+ return false;
+
+ const Common::String description = in.readPascalString();
+ uint32 date = in.readUint32LE();
+ uint16 time = in.readUint16LE();
+ uint32 playTime = in.readUint32LE();
+ if (!Graphics::checkThumbnailHeader(in))
+ return false;
+
+ Graphics::Surface *thumbnail;
+ if (!Graphics::loadThumbnail(in, thumbnail))
+ return false;
+
+ int day = (date >> 24) & 0xFF;
+ int month = (date >> 16) & 0xFF;
+ int year = date & 0xFFFF;
+
+ int hour = (time >> 8) & 0xFF;
+ int minutes = time & 0xFF;
+
+ desc.setSaveDate(year, month, day);
+ desc.setSaveTime(hour, minutes);
+ desc.setPlayTime(playTime * 1000);
+ desc.setDescription(description);
+ desc.setThumbnail(thumbnail);
+
+ return true;
+}
+
}
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index 1e0f703..e6e698e 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -141,6 +141,7 @@ private:
const ADGameDescription _desc;
};
+bool readSaveHeader(Common::InSaveFile &in, SaveStateDescriptor &desc);
Common::String generateSaveName(int slot, const char *gameId);
} // End of namespace Pink
Commit: 11b5865b48996f3ff9a16c719059f25b7119b173
https://github.com/scummvm/scummvm/commit/11b5865b48996f3ff9a16c719059f25b7119b173
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix loading inventory save
Changed paths:
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/inventory.cpp
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 9279871..90de9a1 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -146,7 +146,17 @@ void LeadActor::start(bool isHandler) {
_state = kInDialog1;
_nextState = kReady;
}
- forceUpdateCursor();
+
+ switch (_state) {
+ case kInventory:
+ _page->getModule()->getInventoryMgr()->start(0);
+ _page->pause();
+ break;
+ case kPDA:
+
+ default:
+ forceUpdateCursor();
+ }
}
void LeadActor::onMouseMove(Common::Point point) {
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
index 3ae4eff..1b74f4d 100644
--- a/engines/pink/objects/inventory.cpp
+++ b/engines/pink/objects/inventory.cpp
@@ -221,7 +221,7 @@ void InventoryMgr::saveState(Archive &archive) {
}
if (_item)
- archive.writeString(_item->_currentOwner);
+ archive.writeString(_item->getName());
else
archive.writeString(Common::String());
}
Commit: 80622943e49d299f5f79040df167fa662b684f88
https://github.com/scummvm/scummvm/commit/80622943e49d299f5f79040df167fa662b684f88
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: prepare page interface to add PDAPage
Changed paths:
engines/pink/objects/actions/action_play_with_sfx.cpp
engines/pink/objects/actions/action_play_with_sfx.h
engines/pink/objects/actors/actor.cpp
engines/pink/objects/actors/actor.h
engines/pink/objects/pages/game_page.cpp
engines/pink/objects/pages/game_page.h
engines/pink/objects/pages/page.cpp
engines/pink/objects/pages/page.h
engines/pink/pink.cpp
engines/pink/pink.h
engines/pink/resource_mgr.cpp
engines/pink/resource_mgr.h
diff --git a/engines/pink/objects/actions/action_play_with_sfx.cpp b/engines/pink/objects/actions/action_play_with_sfx.cpp
index 6ab8fa6..c4ab139 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.cpp
+++ b/engines/pink/objects/actions/action_play_with_sfx.cpp
@@ -89,7 +89,7 @@ void ActionSfx::toConsole() {
debug("\t\tActionSfx: _sfx = %s, _volume = %u, _frame = %u", _sfxName.c_str(), _volume, _frame);
}
-void ActionSfx::play(GamePage *page) {
+void ActionSfx::play(Page *page) {
if (!_sound)
_sound = page->loadSound(_sfxName);
diff --git a/engines/pink/objects/actions/action_play_with_sfx.h b/engines/pink/objects/actions/action_play_with_sfx.h
index c9fd348..8945572 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.h
+++ b/engines/pink/objects/actions/action_play_with_sfx.h
@@ -46,7 +46,7 @@ private:
};
class Sound;
-class GamePage;
+class Page;
class ActionSfx : public Object {
public:
@@ -55,7 +55,7 @@ public:
virtual void deserialize(Archive &archive);
virtual void toConsole();
- void play(GamePage *page);
+ void play(Page *page);
uint32 getFrame();
void end();
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index a1d179b..cf87b57 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -31,7 +31,7 @@ namespace Pink {
void Actor::deserialize(Archive &archive) {
NamedObject::deserialize(archive);
- _page = static_cast<GamePage*>(archive.readObject());
+ _page = static_cast<Page*>(archive.readObject());
_actions.deserialize(archive);
}
@@ -54,7 +54,7 @@ Action *Actor::findAction(const Common::String &name) {
return nullptr;
}
-GamePage *Actor::getPage() const {
+Page *Actor::getPage() const {
return _page;
}
@@ -97,7 +97,7 @@ void Actor::setAction(Action *newAction) {
void Actor::setAction(Action *newAction, bool unk) {
if (unk) {
- assert(0); // want to see this
+ //assert(0); // want to see this
_isActionEnded = 1;
_action = newAction;
} else {
@@ -158,4 +158,8 @@ void Actor::onHover(Common::Point point, const Common::String &itemName, CursorM
cursorMgr->setCursor(kHoldingItemCursor, point, itemName);
}
+void Actor::setPage(Page *page) {
+ _page = page;
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/actor.h b/engines/pink/objects/actors/actor.h
index b4fe437..037b8b5 100644
--- a/engines/pink/objects/actors/actor.h
+++ b/engines/pink/objects/actors/actor.h
@@ -29,7 +29,7 @@
namespace Pink {
-class GamePage;
+class Page;
class Action;
class Sequencer;
class Director;
@@ -48,7 +48,7 @@ public:
virtual void toConsole();
Sequencer *getSequencer() const;
- GamePage *getPage() const;
+ Page *getPage() const;
Action *getAction() const;
bool isPlaying();
@@ -61,6 +61,8 @@ public:
void setAction(Action *newAction);
void setAction(Action *newAction, bool unk);
+ void setPage(Page *page);
+
void loadState(Archive &archive);
void saveState(Archive &archive);
@@ -77,7 +79,7 @@ public:
virtual void unpause();
protected:
- GamePage *_page;
+ Page *_page;
Action *_action;
Array<Action *> _actions;
bool _isActionEnded;
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index f6b843f..4aa77cb 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -119,10 +119,6 @@ void GamePage::loadManagers() {
}
}
-PinkEngine *GamePage::getGame() {
- return _resMgr.getGame();
-}
-
Sequencer *GamePage::getSequencer() {
return _sequencer;
}
diff --git a/engines/pink/objects/pages/game_page.h b/engines/pink/objects/pages/game_page.h
index 7b4f25f..3cd537d 100644
--- a/engines/pink/objects/pages/game_page.h
+++ b/engines/pink/objects/pages/game_page.h
@@ -30,8 +30,6 @@
namespace Pink {
class CursorMgr;
-class WalkMgr;
-class Sequencer;
class HandlerStartPage;
class GamePage : public Page {
@@ -49,7 +47,6 @@ public:
void loadManagers();
void init(bool isLoadingSave);
- PinkEngine *getGame();
Sequencer *getSequencer();
WalkMgr *getWalkMgr();
Module *getModule() const;
diff --git a/engines/pink/objects/pages/page.cpp b/engines/pink/objects/pages/page.cpp
index 1465e17..5f5b99a 100644
--- a/engines/pink/objects/pages/page.cpp
+++ b/engines/pink/objects/pages/page.cpp
@@ -95,4 +95,8 @@ void Page::unpause() {
}
}
+PinkEngine *Page::getGame() {
+ return _resMgr.getGame();
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/pages/page.h b/engines/pink/objects/pages/page.h
index f8b582a..08be3a2 100644
--- a/engines/pink/objects/pages/page.h
+++ b/engines/pink/objects/pages/page.h
@@ -31,6 +31,8 @@ namespace Pink {
class Archive;
class Actor;
class LeadActor;
+class WalkMgr;
+class Sequencer;
class Page : public NamedObject {
public:
@@ -48,6 +50,15 @@ public:
void pause();
void unpause();
+ PinkEngine *getGame();
+
+ virtual Sequencer *getSequencer() { return nullptr; };
+ virtual WalkMgr *getWalkMgr() { return nullptr;};
+ virtual Module *getModule() const { return nullptr; };
+
+ virtual bool checkValueOfVariable(const Common::String &variable, const Common::String &value) { return 0; };
+ virtual void setVariable(Common::String &variable, Common::String &value) {};
+
protected:
void init();
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index 01f9ad1..3931db8 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -171,7 +171,7 @@ void PinkEngine::initModule(const Common::String &moduleName, const Common::Stri
}
}
-void PinkEngine::changeScene(GamePage *page) {
+void PinkEngine::changeScene(Page *page) {
setCursor(kLoadingCursor);
if (!_nextModule.empty() && _nextModule.compareTo(_module->getName())) {
initModule(_nextModule, _nextPage, nullptr);
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index e6e698e..642a4d1 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -69,7 +69,7 @@ class Console;
class Archive;
class NamedObject;
class Module;
-class GamePage;
+class Page;
class LeadActor;
enum {
@@ -97,7 +97,7 @@ public:
void load(Archive &archive);
void initModule(const Common::String &moduleName, const Common::String &pageName, Archive *saveFile);
- void changeScene(GamePage *page);
+ void changeScene(Page *page);
OrbFile *getOrb() { return &_orb; }
BroFile *getBro() { return _bro; }
diff --git a/engines/pink/resource_mgr.cpp b/engines/pink/resource_mgr.cpp
index 8f807c2..d81c98b 100644
--- a/engines/pink/resource_mgr.cpp
+++ b/engines/pink/resource_mgr.cpp
@@ -38,7 +38,7 @@ ResourceMgr::~ResourceMgr() {
clear();
}
-void ResourceMgr::init(PinkEngine *game, GamePage *page) {
+void ResourceMgr::init(PinkEngine *game, Page *page) {
OrbFile *orb = game->getOrb();
_game = game;
diff --git a/engines/pink/resource_mgr.h b/engines/pink/resource_mgr.h
index 0b06e99..7cd3dc3 100644
--- a/engines/pink/resource_mgr.h
+++ b/engines/pink/resource_mgr.h
@@ -23,6 +23,8 @@
#ifndef PINK_RESOURCE_MGR_H
#define PINK_RESOURCE_MGR_H
+#include "common/scummsys.h"
+
namespace Common {
class SafeSeekableSubReadStream;
class String;
@@ -30,7 +32,7 @@ namespace Common {
namespace Pink {
-class GamePage;
+class Page;
class PinkEngine;
class OrbFile;
class BroFile;
@@ -44,7 +46,7 @@ public:
ResourceMgr();
~ResourceMgr();
- void init(PinkEngine *game, GamePage *page);
+ void init(PinkEngine *game, Page *page);
void clear();
//Common::String loadText(Common::String &name);
Commit: 001a08c91c8e598400f101710c6216261774cc93
https://github.com/scummvm/scummvm/commit/001a08c91c8e598400f101710c6216261774cc93
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix deserializing of ActionText
Changed paths:
engines/pink/objects/actions/action_text.cpp
engines/pink/objects/actions/action_text.h
diff --git a/engines/pink/objects/actions/action_text.cpp b/engines/pink/objects/actions/action_text.cpp
index 3e05346..f9ef86a 100644
--- a/engines/pink/objects/actions/action_text.cpp
+++ b/engines/pink/objects/actions/action_text.cpp
@@ -28,9 +28,14 @@
namespace Pink {
void ActionText::deserialize(Archive &archive) {
- for (int i = 0; i < 4 ; ++i) {
- _bounds[i] = archive.readDWORD();
- }
+ Action::deserialize(archive);
+ _fileName = archive.readString();
+
+ _xLeft = archive.readDWORD();
+ _yTop = archive.readDWORD();
+ _xRight = archive.readDWORD();
+ _yBottom = archive.readDWORD();
+
_centered = archive.readDWORD();
_scrollBar = archive.readDWORD();
_textColor = archive.readDWORD();
@@ -38,9 +43,9 @@ void ActionText::deserialize(Archive &archive) {
}
void ActionText::toConsole() {
- debug("\tActionText: _name = %s, _text = %s, "
- "_bound0 = %u, _bound1 = %u, _bound2 = %u, _bound3 = %u _centered = %u, _scrollBar = %u, _textColor = %u _backgroundColor = %u",
- _name.c_str(), _text.c_str(), _bounds[0], _bounds[1], _bounds[2], _bounds[3], _centered, _scrollBar, _textColor, _backgroundColor);
+ debug("\tActionText: _name = %s, _fileName = %s, "
+ "_xLeft = %u, _yTop = %u, _xRight = %u, _yBottom = %u _centered = %u, _scrollBar = %u, _textColor = %u _backgroundColor = %u",
+ _name.c_str(), _fileName.c_str(), _xLeft, _yTop, _xRight, _yBottom, _centered, _scrollBar, _textColor, _backgroundColor);
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_text.h b/engines/pink/objects/actions/action_text.h
index c881610..e0cc752 100644
--- a/engines/pink/objects/actions/action_text.h
+++ b/engines/pink/objects/actions/action_text.h
@@ -34,8 +34,13 @@ public:
void toConsole() override;
private:
- Common::String _text;
- uint32 _bounds[4];
+ Common::String _fileName;
+
+ uint32 _xLeft;
+ uint32 _yTop;
+ uint32 _xRight;
+ uint32 _yBottom;
+
uint32 _centered;
uint32 _scrollBar;
uint32 _textColor;
Commit: 11d2c1aa5232148d530713b93d95efff4d322ceb
https://github.com/scummvm/scummvm/commit/11d2c1aa5232148d530713b93d95efff4d322ceb
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: add missing cursor
Changed paths:
engines/pink/constants.h
engines/pink/cursor_mgr.cpp
engines/pink/pink.cpp
diff --git a/engines/pink/constants.h b/engines/pink/constants.h
index 7e945f8..a641231 100644
--- a/engines/pink/constants.h
+++ b/engines/pink/constants.h
@@ -85,7 +85,7 @@ enum {
};
enum {
- kCursorsCount = 11
+ kCursorsCount = 12
};
enum {
@@ -98,8 +98,9 @@ enum {
kClickableSecondFrameCursor = 6,
kNotClickableCursor = 7,
kHoldingItemCursor = 8,
- kPDAFirstCursor = 9,
- kPDASecondCursor = 10
+ kPDADefaultCursor = 9,
+ kPDAClickableFirstFrameCursor = 10,
+ kPDAClickableSecondFrameCursor = 11
};
@@ -114,8 +115,9 @@ enum {
kPokusClickableThirdCursorID = 145,
kPokusNotClickableCursorID = 140,
kPokusHoldingItemCursorID = 147,
- kPokusPDAFirstCursorID = 141,
- kPokusPDASecondCursorID = 144
+ kPokusPDADefaultCursorID = 141,
+ kPokusPDAClickableFirstFrameCursorID = 144,
+ kPokusPDAClickableSecondFrameCursorID = 146
};
// from Peril
@@ -124,7 +126,8 @@ enum {
kPerilClickableThirdCursorID = 140,
kPerilNotClickableCursorID = 139,
kPerilHoldingItemCursorID = 101,
- kPerilPDASecondCursorID = 142
+ kPerilPDAClickableFirstFrameCursorID = 142,
+ kPerilPDAClickableSecondFrameCursorID = 143
};
enum {
diff --git a/engines/pink/cursor_mgr.cpp b/engines/pink/cursor_mgr.cpp
index 0154a33..391e45d 100644
--- a/engines/pink/cursor_mgr.cpp
+++ b/engines/pink/cursor_mgr.cpp
@@ -41,7 +41,7 @@ void CursorMgr::setCursor(uint index, Common::Point point, const Common::String
return hideItem();
} else if (index != kHoldingItemCursor) {
- if (index != kPDASecondCursor) {
+ if (index != kPDAClickableFirstFrameCursor) {
_game->setCursor(index);
_isPlayingAnimation = 0;
return hideItem();
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index 3931db8..a0aa9ef 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -231,13 +231,15 @@ bool PinkEngine::loadCursors() {
_cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPerilHoldingItemCursorID));
}
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusPDAFirstCursorID));
-
- if (isPokus)
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusPDASecondCursorID));
- else
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPerilPDASecondCursorID));
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusPDADefaultCursorID));
+ if (isPokus) {
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusPDAClickableFirstFrameCursorID));
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusPDAClickableSecondFrameCursorID));
+ } else {
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPerilPDAClickableFirstFrameCursorID));
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPerilPDAClickableSecondFrameCursorID));
+ }
return true;
}
Commit: 9f23b4238c0643e6e9fa5af52be2747219f0bfe0
https://github.com/scummvm/scummvm/commit/9f23b4238c0643e6e9fa5af52be2747219f0bfe0
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: add Pokus World Book implementation
Changed paths:
A engines/pink/objects/pages/pda_page.cpp
A engines/pink/objects/pages/pda_page.h
A engines/pink/pda_mgr.cpp
A engines/pink/pda_mgr.h
engines/pink/objects/actors/actor.h
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/actors/lead_actor.h
engines/pink/objects/inventory.cpp
engines/pink/pink.cpp
engines/pink/pink.h
diff --git a/engines/pink/objects/actors/actor.h b/engines/pink/objects/actors/actor.h
index 037b8b5..e39ce84 100644
--- a/engines/pink/objects/actors/actor.h
+++ b/engines/pink/objects/actors/actor.h
@@ -72,6 +72,7 @@ public:
virtual void onMouseOver(Common::Point point, CursorMgr *mgr);
virtual void onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr);
+ virtual void onClick() {};
virtual bool isClickable() { return 0; }
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 90de9a1..17ec0ee 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -90,6 +90,7 @@ void LeadActor::update() {
getPage()->getModule()->getInventoryMgr()->update();
break;
case kPDA:
+ getPage()->getGame()->getPdaMgr().update();
break;
case kPlayingVideo:
_sequencer->update();
@@ -162,8 +163,7 @@ void LeadActor::start(bool isHandler) {
void LeadActor::onMouseMove(Common::Point point) {
if (_state != kPDA)
updateCursor(point);
- else
- error("pda is not supported");
+ else _page->getGame()->getPdaMgr().onMouseMove(point);
}
void LeadActor::updateCursor(Common::Point point) {
@@ -229,7 +229,7 @@ void LeadActor::onLeftButtonClick(Common::Point point) {
break;
}
case kPDA:
-
+ _page->getGame()->getPdaMgr().onLeftButtonClick(point);
break;
case kInventory:
invMgr->onClick(point);
@@ -351,6 +351,21 @@ void LeadActor::saveState(Archive &archive) {
_walkMgr->saveState(archive);
}
+void LeadActor::loadPDA(const Common::String &pageName) {
+ if (_state != kPDA) {
+ if (_state == kMoving) {
+ _recipient = nullptr;
+ _nextState = kReady;
+ }
+ _state = kPDA;
+ if (_state != kInventory)
+ _page->pause();
+ _page->getGame()->getDirector()->clear();
+ }
+ _page->getGame()->getPdaMgr().setLead(this);
+ _page->getGame()->getPdaMgr().goToPage(pageName);
+}
+
void ParlSqPink::toConsole() {
debug("ParlSqPink: _name = %s", _name.c_str());
for (uint i = 0; i < _actions.size(); ++i) {
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index d058ec6..0e48035 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -81,6 +81,8 @@ public:
virtual void saveState(Archive &archive);
+ void loadPDA(const Common::String &pageName);
+
protected:
virtual void updateCursor(Common::Point point);
void forceUpdateCursor();
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
index 1b74f4d..4836880 100644
--- a/engines/pink/objects/inventory.cpp
+++ b/engines/pink/objects/inventory.cpp
@@ -152,6 +152,10 @@ void InventoryMgr::onClick(Common::Point point) {
Actor *actor = _lead->getPage()->getGame()->getDirector()->getActorByPoint(point);
if (actor == _itemActor || actor == _window) {
+ if (actor->getAction()->getName() == "WBook") {
+ _lead->loadPDA("TOC");
+ return;
+ }
_isClickedOnItem = true;
close();
} else if (actor == _leftArrow) {
diff --git a/engines/pink/objects/pages/pda_page.cpp b/engines/pink/objects/pages/pda_page.cpp
new file mode 100644
index 0000000..1b13c2a
--- /dev/null
+++ b/engines/pink/objects/pages/pda_page.cpp
@@ -0,0 +1,60 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "pink/pda_mgr.h"
+#include "pink/objects/actors/actor.h"
+#include "pink/objects/pages/pda_page.h"
+#include "pink/pink.h"
+
+namespace Pink {
+
+
+PDAPage PDAPage::create(const Common::String &pageName, PDAMgr &pdaMgr) {
+ PDAPage page(pageName, pdaMgr);
+ page._name = pageName;
+ page._resMgr.init(pdaMgr.getGame(), &page);
+ return page;
+}
+
+Array<Actor *> PDAPage::takeActors() {
+ Array<Actor *> actorsCopy = _actors;
+ _actors.clear();
+ return actorsCopy;
+}
+
+void PDAPage::init() {
+ for (uint i = 0; i < _actors.size(); ++i) {
+ if (_actors[i]->initPallete(_pdaMgr.getGame()->getDirector()))
+ break;
+ }
+
+ for (uint i = 0; i < _actors.size(); ++i) {
+ _actors[i]->init(0);
+ }
+}
+
+PDAPage::PDAPage(const Common::String &name, PDAMgr &pdaMgr)
+ : _pdaMgr(pdaMgr) {
+ _name = name;
+}
+
+} // End of namespace Pink
diff --git a/engines/pink/objects/pages/pda_page.h b/engines/pink/objects/pages/pda_page.h
new file mode 100644
index 0000000..f6cf2a5
--- /dev/null
+++ b/engines/pink/objects/pages/pda_page.h
@@ -0,0 +1,45 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_PDA_PAGE_H
+#define PINK_PDA_PAGE_H
+
+#include "page.h"
+
+namespace Pink {
+
+class PDAMgr;
+
+class PDAPage : public Page {
+public:
+ static PDAPage create(const Common::String &pageName, PDAMgr &pdaMgr);
+
+ Array<Actor *> takeActors();
+ void init();
+private:
+ PDAPage(const Common::String &name, PDAMgr &pdaMgr);
+ PDAMgr &_pdaMgr;
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/pda_mgr.cpp b/engines/pink/pda_mgr.cpp
new file mode 100644
index 0000000..a931f30
--- /dev/null
+++ b/engines/pink/pda_mgr.cpp
@@ -0,0 +1,113 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "pink/pda_mgr.h"
+#include "pink/pink.h"
+#include "pink/objects/actors/pda_button_actor.h"
+#include "pink/objects/pages/pda_page.h"
+
+
+namespace Pink {
+
+PDAMgr::PDAMgr(Pink::PinkEngine *game)
+ : _game(game), _page(nullptr), _cursorMgr(game, nullptr) {}
+
+void PDAMgr::update() {
+ _cursorMgr.update();
+}
+
+void PDAMgr::execute(const Command &command) {
+ switch (command.type) {
+ case Command::GoToPage:
+ goToPage(command.arg);
+ break;
+ case Command::Close:
+ close();
+ break;
+ default:
+ break;
+ }
+}
+
+PinkEngine *PDAMgr::getGame() const {
+ return _game;
+}
+
+void PDAMgr::goToPage(const Common::String &pageName) {
+ if (_page && _page->getName() == pageName)
+ return;
+
+ loadGlobal();
+
+ delete _page;
+ _page = new PDAPage(PDAPage::create(pageName, *this));
+
+ _page->init();
+
+ for (uint i = 0; i < _globalActors.size(); ++i) {
+ _globalActors[i]->setPage(_page);
+ }
+
+ _cursorMgr.setPage(_page);
+}
+
+void PDAMgr::close() {
+ for (uint i = 0; i < _globalActors.size(); ++i) {
+ delete _globalActors[i];
+ }
+ _globalActors.clear();
+
+ delete _page;
+ _page = nullptr;
+
+ //_lead->onPDAClose();
+}
+
+void PDAMgr::loadGlobal() {
+ if (!_globalActors.empty())
+ return;
+
+ PDAPage globalPage = PDAPage::create("GLOBAL", *this);
+ _globalActors = globalPage.takeActors();
+ for (uint i = 0; i < _globalActors.size(); ++i) {
+ _globalActors[i]->init(0);
+ }
+}
+
+void PDAMgr::setLead(LeadActor *lead) {
+ _lead = lead;
+}
+
+void PDAMgr::onLeftButtonClick(Common::Point point) {
+ Actor *actor = _game->getDirector()->getActorByPoint(point);
+ if (actor)
+ actor->onClick();
+}
+
+void PDAMgr::onMouseMove(Common::Point point) {
+ Actor *actor = _game->getDirector()->getActorByPoint(point);
+ if (actor && dynamic_cast<PDAButtonActor*>(actor))
+ actor->onMouseOver(point, &_cursorMgr);
+ else _cursorMgr.setCursor(kPDADefaultCursor, point,Common::String());
+}
+
+} // End of namespace Pink
diff --git a/engines/pink/pda_mgr.h b/engines/pink/pda_mgr.h
new file mode 100644
index 0000000..75f28a7
--- /dev/null
+++ b/engines/pink/pda_mgr.h
@@ -0,0 +1,63 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_PDA_MGR_H
+#define PINK_PDA_MGR_H
+
+#include "pink/cursor_mgr.h"
+#include "utils.h"
+
+namespace Pink {
+
+class PinkEngine;
+class LeadActor;
+class Command;
+class PDAPage;
+
+class PDAMgr {
+public:
+ PDAMgr(PinkEngine *game);
+ void update();
+ void execute(const Command &command);
+ void goToPage(const Common::String &pageName);
+
+ void onLeftButtonClick(Common::Point point);
+ void onMouseMove(Common::Point point);
+
+ PinkEngine *getGame() const;
+
+ void setLead(LeadActor *lead);
+
+private:
+ void close();
+ void loadGlobal();
+
+ PinkEngine *_game;
+ LeadActor *_lead;
+ PDAPage *_page;
+ CursorMgr _cursorMgr;
+ Array<Actor *> _globalActors;
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index a0aa9ef..53407e6 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -41,7 +41,7 @@ namespace Pink {
Pink::PinkEngine::PinkEngine(OSystem *system, const ADGameDescription *desc)
: Engine(system), _console(nullptr), _rnd("pink"),
_desc(*desc), _bro(nullptr), _module(nullptr),
- _director(_system) {
+ _director(_system), _pdaMgr(this) {
debug("PinkEngine constructed");
DebugMan.addDebugChannel(kPinkDebugGeneral, "general", "General issues");
@@ -322,6 +322,10 @@ void PinkEngine::pauseEngineIntern(bool pause) {
_system->showMouse(!pause);
}
+PDAMgr &PinkEngine::getPdaMgr() {
+ return _pdaMgr;
+}
+
Common::String generateSaveName(int slot, const char *gameId) {
return Common::String::format("%s.s%02d", gameId, slot);
}
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index 642a4d1..f4d0ad3 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -36,6 +36,7 @@
#include "pink/director.h"
#include "pink/file.h"
#include "pink/utils.h"
+#include "pink/pda_mgr.h"
/*
* This is the namespace of the Pink engine.
@@ -111,6 +112,8 @@ public:
void setVariable(Common::String &variable, Common::String &value);
bool checkValueOfVariable(Common::String &variable, Common::String &value);
+ PDAMgr &getPdaMgr();
+
protected:
virtual void pauseEngineIntern(bool pause);
@@ -137,6 +140,7 @@ private:
Array<NamedObject *> _modules;
StringMap _variables;
+ PDAMgr _pdaMgr;
const ADGameDescription _desc;
};
Commit: 127e2fdf55117777198926cc1a809ea9f71ea1c2
https://github.com/scummvm/scummvm/commit/127e2fdf55117777198926cc1a809ea9f71ea1c2
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: add PDAButtonActor(Pokus) implementation
Peril's pda actor is different
Changed paths:
engines/pink/objects/actors/pda_button_actor.cpp
engines/pink/objects/actors/pda_button_actor.h
diff --git a/engines/pink/objects/actors/pda_button_actor.cpp b/engines/pink/objects/actors/pda_button_actor.cpp
index 65e3f7b..a54e04b 100644
--- a/engines/pink/objects/actors/pda_button_actor.cpp
+++ b/engines/pink/objects/actors/pda_button_actor.cpp
@@ -20,23 +20,47 @@
*
*/
+#include "pink/constants.h"
+#include "pink/cursor_mgr.h"
+#include "pink/pink.h"
+#include "pink/objects/pages/page.h"
#include "pink/objects/actors/pda_button_actor.h"
namespace Pink {
void PDAButtonActor::deserialize(Archive &archive) {
Actor::deserialize(archive);
+ _x = archive.readDWORD();
+ _y = archive.readDWORD();
_hideOnStop = (bool) archive.readDWORD();
_opaque = (bool) archive.readDWORD();
- int comm = archive.readDWORD();
- assert(comm <= 4);
- _command = (Command) comm;
+ int type = archive.readDWORD();
+ assert(type != 0);
+ _command.type = (Command::CommandType) type;
+ _command.arg = archive.readString();
}
void PDAButtonActor::toConsole() {
- debug("PDAButtonActor: _name = %s, _x = %u _y = %u _hideOnStop = %u, _opaque = %u, _command = %u",
- _name.c_str(), _x, _y, _hideOnStop, _opaque, (int) _command);
+ debug("PDAButtonActor: _name = %s, _x = %u _y = %u _hideOnStop = %u, _opaque = %u, _commandType = %u, _arg = %s",
+ _name.c_str(), _x, _y, _hideOnStop, _opaque, (int) _command.type, _command.arg.c_str());
+}
+
+void PDAButtonActor::onClick() {
+ if (isActive()) {
+ _page->getGame()->getPdaMgr().execute(_command);
+ }
+}
+
+void PDAButtonActor::onMouseOver(Common::Point point, CursorMgr *mgr) {
+ if (_command.type == Command::Unk || !isActive())
+ mgr->setCursor(kPDADefaultCursor, point, Common::String());
+ else
+ mgr->setCursor(kPDAClickableFirstFrameCursor, point, Common::String());
+}
+
+bool PDAButtonActor::isActive() {
+ return _name != "Inactive";
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/pda_button_actor.h b/engines/pink/objects/actors/pda_button_actor.h
index 5e7d53b..87db1c2 100644
--- a/engines/pink/objects/actors/pda_button_actor.h
+++ b/engines/pink/objects/actors/pda_button_actor.h
@@ -27,21 +27,35 @@
namespace Pink {
+struct Command {
+ // commands in peril are different
+ /*enum PerilCommandType {Null, GoToPage, GoToPreviousPage, GoToDomain, GoToHelp,
+ NavigateToDomain, IncrementCountry, DecrementCountry, IncrementDomain,
+ DecrementDomain, Close, IncrementFrame, DecrementFrame};*/
+ enum CommandType {Null = 0, GoToPage = 1, Close = 2, Unk = 3};
+
+ CommandType type;
+ Common::String arg;
+};
+
class PDAButtonActor : public Actor {
public:
- enum Command {Null = 0, GoToPage = 1, Close = 2, Unk = 4};
-
void deserialize(Archive &archive) override;
void toConsole() override;
+ void onClick();
+ void onMouseOver(Common::Point point, CursorMgr *mgr);
+
private:
+ bool isActive();
+
+ Command _command;
+
int _x;
int _y;
bool _hideOnStop;
bool _opaque;
-
- Command _command;
};
} // End of namespace Pink
Commit: a531381f2b80aa8f0bf8c10610eaad6a3256415f
https://github.com/scummvm/scummvm/commit/a531381f2b80aa8f0bf8c10610eaad6a3256415f
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: change pause/unpause to pause method with parameter
Changed paths:
engines/pink/objects/actions/action.h
engines/pink/objects/actions/action_cel.cpp
engines/pink/objects/actions/action_cel.h
engines/pink/objects/actions/action_sound.cpp
engines/pink/objects/actions/action_sound.h
engines/pink/objects/actions/action_still.h
engines/pink/objects/actions/action_talk.cpp
engines/pink/objects/actions/action_talk.h
engines/pink/objects/actors/inventory_actor.h
engines/pink/objects/pages/page.cpp
engines/pink/objects/pages/page.h
engines/pink/sound.cpp
engines/pink/sound.h
diff --git a/engines/pink/objects/actions/action.h b/engines/pink/objects/actions/action.h
index 7dd0d2a..9c4e902 100644
--- a/engines/pink/objects/actions/action.h
+++ b/engines/pink/objects/actions/action.h
@@ -42,8 +42,7 @@ public:
Actor *getActor() { return _actor; }
- virtual void pause() {};
- virtual void unpause() {};
+ virtual void pause(bool paused) {};
protected:
Actor *_actor;
diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp
index 8e868a1..0881542 100644
--- a/engines/pink/objects/actions/action_cel.cpp
+++ b/engines/pink/objects/actions/action_cel.cpp
@@ -82,12 +82,8 @@ ActionCEL::~ActionCEL() {
end();
}
-void ActionCEL::pause() {
- _decoder->pauseVideo(1);
-}
-
-void ActionCEL::unpause() {
- _decoder->pauseVideo(0);
+void ActionCEL::pause(bool paused) {
+ _decoder->pauseVideo(paused);
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_cel.h b/engines/pink/objects/actions/action_cel.h
index bf1ae29..60b85e0 100644
--- a/engines/pink/objects/actions/action_cel.h
+++ b/engines/pink/objects/actions/action_cel.h
@@ -44,9 +44,7 @@ public:
virtual bool initPalette(Director *director);
- void pause() override;
-
- void unpause() override;
+ void pause(bool paused) override;
protected:
virtual void onStart() {};
diff --git a/engines/pink/objects/actions/action_sound.cpp b/engines/pink/objects/actions/action_sound.cpp
index ffbd293..a80130b 100644
--- a/engines/pink/objects/actions/action_sound.cpp
+++ b/engines/pink/objects/actions/action_sound.cpp
@@ -85,14 +85,9 @@ void ActionSound::update() {
_actor->endAction();
}
-void ActionSound::pause() {
+void ActionSound::pause(bool paused) {
if (_sound)
- _sound->pause();
-}
-
-void ActionSound::unpause() {
- if (_sound)
- _sound->resume();
+ _sound->pause(paused);
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_sound.h b/engines/pink/objects/actions/action_sound.h
index 6e18f97..f5d1401 100644
--- a/engines/pink/objects/actions/action_sound.h
+++ b/engines/pink/objects/actions/action_sound.h
@@ -42,8 +42,7 @@ public:
virtual void end();
virtual void update();
- void pause() override;
- void unpause() override;
+ void pause(bool paused) override;
private:
Sound *_sound;
diff --git a/engines/pink/objects/actions/action_still.h b/engines/pink/objects/actions/action_still.h
index a62b201..90c5c7d 100644
--- a/engines/pink/objects/actions/action_still.h
+++ b/engines/pink/objects/actions/action_still.h
@@ -33,6 +33,7 @@ public:
virtual void toConsole();
virtual void end();
+ virtual void pause(bool paused) {}
protected:
virtual void onStart();
diff --git a/engines/pink/objects/actions/action_talk.cpp b/engines/pink/objects/actions/action_talk.cpp
index 555e6fe..7ecd40d 100644
--- a/engines/pink/objects/actions/action_talk.cpp
+++ b/engines/pink/objects/actions/action_talk.cpp
@@ -60,16 +60,10 @@ void ActionTalk::end() {
_sound = nullptr;
}
-void ActionTalk::pause() {
- ActionCEL::pause();
+void ActionTalk::pause(bool paused) {
+ ActionCEL::pause(paused);
if (_sound)
- _sound->pause();
-}
-
-void ActionTalk::unpause() {
- ActionCEL::unpause();
- if (_sound)
- _sound->resume();
+ _sound->pause(paused);
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_talk.h b/engines/pink/objects/actions/action_talk.h
index 61ef1a4..e14e6bc 100644
--- a/engines/pink/objects/actions/action_talk.h
+++ b/engines/pink/objects/actions/action_talk.h
@@ -37,8 +37,7 @@ public:
virtual void end();
- void pause() override;
- void unpause() override;
+ void pause(bool paused) override;
protected:
virtual void onStart();
diff --git a/engines/pink/objects/actors/inventory_actor.h b/engines/pink/objects/actors/inventory_actor.h
index 4e6edef..9fad7f6 100644
--- a/engines/pink/objects/actors/inventory_actor.h
+++ b/engines/pink/objects/actors/inventory_actor.h
@@ -39,7 +39,7 @@ public:
}
}
- void pause() {}
+ void pause(bool paused) override {}
};
} // End of namespace Pink
diff --git a/engines/pink/objects/pages/page.cpp b/engines/pink/objects/pages/page.cpp
index 5f5b99a..844bd94 100644
--- a/engines/pink/objects/pages/page.cpp
+++ b/engines/pink/objects/pages/page.cpp
@@ -83,15 +83,9 @@ void Page::clear() {
_resMgr.clear();
}
-void Page::pause() {
+void Page::pause(bool paused) {
for (uint i = 0; i < _actors.size(); ++i) {
- _actors[i]->pause();
- }
-}
-
-void Page::unpause() {
- for (uint i = 0; i < _actors.size(); ++i) {
- _actors[i]->unpause();
+ _actors[i]->pause(paused);
}
}
diff --git a/engines/pink/objects/pages/page.h b/engines/pink/objects/pages/page.h
index 08be3a2..2927f07 100644
--- a/engines/pink/objects/pages/page.h
+++ b/engines/pink/objects/pages/page.h
@@ -47,8 +47,7 @@ public:
CelDecoder *loadCel(Common::String &fileName);
virtual void clear();
- void pause();
- void unpause();
+ void pause(bool paused);
PinkEngine *getGame();
diff --git a/engines/pink/sound.cpp b/engines/pink/sound.cpp
index 10fb049..333093e 100644
--- a/engines/pink/sound.cpp
+++ b/engines/pink/sound.cpp
@@ -34,7 +34,7 @@ Sound::Sound(Audio::Mixer *mixer, Common::SafeSeekableSubReadStream *stream)
: _mixer(mixer), _fileStream(stream) {}
Sound::~Sound() {
- stop();
+ _mixer->stopHandle(_handle);
delete _fileStream;
}
@@ -42,16 +42,8 @@ bool Sound::isPlaying() {
return _mixer->isSoundHandleActive(_handle);
}
-void Sound::pause() {
- _mixer->pauseHandle(_handle, true);
-}
-
-void Sound::resume() {
- _mixer->pauseHandle(_handle, false);
-}
-
-void Sound::stop() {
- _mixer->stopHandle(_handle);
+void Sound::pause(bool paused) {
+ _mixer->pauseHandle(_handle, paused);
}
void Sound::play(Audio::Mixer::SoundType type, int volume, bool isLoop) {
diff --git a/engines/pink/sound.h b/engines/pink/sound.h
index 9d70074..a5e7cca 100644
--- a/engines/pink/sound.h
+++ b/engines/pink/sound.h
@@ -45,9 +45,7 @@ public:
bool isPlaying();
- void pause();
- void resume();
- void stop();
+ void pause(bool paused);
uint32 getCurrentSample();
void setBalance(int8 balance);
Commit: b682ecb0ea63906b0ad1f735031a9f800d535eb8
https://github.com/scummvm/scummvm/commit/b682ecb0ea63906b0ad1f735031a9f800d535eb8
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: refactor Actors to remove casts and improve readability
Changed paths:
engines/pink/objects/actors/actor.cpp
engines/pink/objects/actors/actor.h
engines/pink/objects/actors/audio_info_pda_button.h
engines/pink/objects/actors/cursor_actor.h
engines/pink/objects/actors/inventory_actor.h
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/actors/lead_actor.h
engines/pink/objects/actors/pda_button_actor.cpp
engines/pink/objects/actors/pda_button_actor.h
engines/pink/objects/actors/supporting_actor.cpp
engines/pink/objects/actors/supporting_actor.h
engines/pink/objects/object.cpp
engines/pink/objects/object.h
engines/pink/objects/sequences/seq_timer.cpp
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index cf87b57..3fb2c4a 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -29,33 +29,33 @@
namespace Pink {
+Actor::Actor()
+ : _page(nullptr), _action(nullptr),
+ _isActionEnded(1) {}
+
+Actor::~Actor() {
+ for (uint i = 0; i < _actions.size(); ++i) {
+ delete _actions[i];
+ }
+}
+
void Actor::deserialize(Archive &archive) {
NamedObject::deserialize(archive);
_page = static_cast<Page*>(archive.readObject());
_actions.deserialize(archive);
}
-void Actor::toConsole() {
- debug("Actor: _name = %s", _name.c_str());
- for (uint i = 0; i < _actions.size(); ++i) {
- _actions[i]->toConsole();
- }
+void Actor::loadState(Archive &archive) {
+ _action = findAction(archive.readString());
}
-Sequencer *Actor::getSequencer() const {
- return _page->getSequencer();
-}
+void Actor::saveState(Archive &archive) {
+ Common::String actionName;
-Action *Actor::findAction(const Common::String &name) {
- for (uint i = 0; i < _actions.size(); ++i) {
- if (_actions[i]->getName() == name)
- return _actions[i];
- }
- return nullptr;
-}
+ if (_action)
+ actionName = _action->getName();
-Page *Actor::getPage() const {
- return _page;
+ archive.writeString(actionName);
}
void Actor::init(bool unk) {
@@ -70,6 +70,30 @@ void Actor::init(bool unk) {
}
}
+bool Actor::initPallete(Director *director) {
+ for (uint i = 0; i < _actions.size(); ++i) {
+ if (_actions[i]->initPalette(director))
+ return true;
+ }
+ return false;
+}
+
+void Actor::toConsole() {
+ debug("Actor: _name = %s", _name.c_str());
+ for (uint i = 0; i < _actions.size(); ++i) {
+ _actions[i]->toConsole();
+ }
+}
+
+bool Actor::isPlaying() {
+ return !_isActionEnded;
+}
+
+void Actor::pause(bool paused) {
+ if (_action)
+ _action->pause(paused);
+}
+
void Actor::hide() {
setAction(kHideAction);
}
@@ -78,84 +102,84 @@ void Actor::endAction() {
_isActionEnded = 1;
}
-void Actor::setAction(const Common::String &name) {
- Action *newAction = findAction(name);
- setAction(newAction);
+bool Actor::isLeftClickHandlers() {
+ return false;
}
-void Actor::setAction(Action *newAction) {
- if (_action) {
- _isActionEnded = 1;
- _action->end();
- }
- _action = newAction;
- if (newAction) {
- _isActionEnded = 0;
- _action->start(0);
- }
+bool Actor::isUseClickHandlers(InventoryItem *item) {
+ return false;
}
-void Actor::setAction(Action *newAction, bool unk) {
- if (unk) {
- //assert(0); // want to see this
- _isActionEnded = 1;
- _action = newAction;
- } else {
- setAction(newAction);
- }
+void Actor::onMouseOver(const Common::Point point, CursorMgr *mgr) {
+ mgr->setCursor(kDefaultCursor, point, Common::String());
}
-Action *Actor::getAction() const {
- return _action;
+void Actor::onHover(const Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) {
+ cursorMgr->setCursor(kHoldingItemCursor, point, itemName);
}
-bool Actor::isPlaying() {
- return !_isActionEnded;
-}
+void Actor::onClick() {}
-bool Actor::initPallete(Director *director) {
- for (uint i = 0; i < _actions.size(); ++i) {
- if (_actions[i]->initPalette(director))
- return true;
- }
+void Actor::onTimerMessage() {}
+
+bool Actor::onLeftClickMessage() {
return false;
}
-void Actor::onMouseOver(Common::Point point, CursorMgr *mgr) {
- mgr->setCursor(kDefaultCursor, point, Common::String());
+bool Actor::onUseClickMessage(InventoryItem *item, InventoryMgr *mgr) {
+ return false;
}
-Actor::~Actor() {
+Action *Actor::findAction(const Common::String &name) {
for (uint i = 0; i < _actions.size(); ++i) {
- delete _actions[i];
+ if (_actions[i]->getName() == name)
+ return _actions[i];
}
+ return nullptr;
}
-void Actor::loadState(Archive &archive) {
- _action = findAction(archive.readString());
+Action *Actor::getAction() const {
+ return _action;
}
-void Actor::saveState(Archive &archive) {
- Common::String actionName;
+Page *Actor::getPage() const {
+ return _page;
+}
- if (_action)
- actionName = _action->getName();
+Sequencer *Actor::getSequencer() const {
+ return _page->getSequencer();
+}
- archive.writeString(actionName);
+const Common::String &Actor::getLocation() const {
+ static const Common::String empty;
+ return empty;
}
-void Actor::pause() {
- if (_action)
- _action->pause();
+void Actor::setAction(const Common::String &name) {
+ Action *newAction = findAction(name);
+ setAction(newAction);
}
-void Actor::unpause() {
- if (_action)
- _action->unpause();
+void Actor::setAction(Action *newAction) {
+ if (_action) {
+ _isActionEnded = 1;
+ _action->end();
+ }
+ _action = newAction;
+ if (newAction) {
+ _isActionEnded = 0;
+ _action->start(0);
+ }
}
-void Actor::onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) {
- cursorMgr->setCursor(kHoldingItemCursor, point, itemName);
+void Actor::setAction(Action *newAction, bool unk) {
+ if (unk) {
+ //assert(0); // want to see this
+ _isActionEnded = 1;
+ _action = newAction;
+ } else {
+ setAction(newAction);
+ }
}
void Actor::setPage(Page *page) {
diff --git a/engines/pink/objects/actors/actor.h b/engines/pink/objects/actors/actor.h
index e39ce84..037b42e 100644
--- a/engines/pink/objects/actors/actor.h
+++ b/engines/pink/objects/actors/actor.h
@@ -39,50 +39,57 @@ class InventoryMgr;
class Actor : public NamedObject {
public:
- Actor()
- : _page(nullptr), _action(nullptr),
- _isActionEnded(1) {};
+ Actor();
~Actor();
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ void deserialize(Archive &archive) override;
- Sequencer *getSequencer() const;
- Page *getPage() const;
- Action *getAction() const;
+ void loadState(Archive &archive);
+ void saveState(Archive &archive);
- bool isPlaying();
virtual void init(bool unk);
+ bool initPallete(Director *director);
+
+ void toConsole() override ;
+
+ bool isPlaying();
+ virtual void pause(bool paused);
+
void hide();
void endAction();
- Action *findAction(const Common::String &name);
- void setAction(const Common::String &name);
- void setAction(Action *newAction);
- void setAction(Action *newAction, bool unk);
+ virtual bool isLeftClickHandlers();
+ virtual bool isUseClickHandlers(InventoryItem *item);
- void setPage(Page *page);
+ virtual void onMouseOver(const Common::Point point, CursorMgr *mgr);
+ virtual void onHover(const Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr);
- void loadState(Archive &archive);
- void saveState(Archive &archive);
+ virtual void onClick();
- bool initPallete(Director *director);
+ virtual void onTimerMessage();
+ virtual bool onLeftClickMessage();
+ virtual bool onUseClickMessage(InventoryItem *item, InventoryMgr *mgr);
- virtual void update() {};
+ Action *findAction(const Common::String &name);
- virtual void onMouseOver(Common::Point point, CursorMgr *mgr);
- virtual void onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr);
- virtual void onClick() {};
+ Action *getAction() const;
+ Page *getPage() const;
+ Sequencer *getSequencer() const;
- virtual bool isClickable() { return 0; }
+ virtual const Common::String &getLocation() const;
- virtual void pause();
- virtual void unpause();
+ void setAction(const Common::String &name);
+ void setAction(Action *newAction);
+ void setAction(Action *newAction, bool unk);
+
+ void setPage(Page *page);
protected:
Page *_page;
+
Action *_action;
Array<Action *> _actions;
+
bool _isActionEnded;
};
diff --git a/engines/pink/objects/actors/audio_info_pda_button.h b/engines/pink/objects/actors/audio_info_pda_button.h
index 05c8408..f54edd6 100644
--- a/engines/pink/objects/actors/audio_info_pda_button.h
+++ b/engines/pink/objects/actors/audio_info_pda_button.h
@@ -34,8 +34,8 @@ namespace Pink {
class AudioInfoPDAButton : public Actor {
public:
- void toConsole() {
- debug("CursorActor: _name = %s", _name.c_str());
+ void toConsole() override {
+ debug("AudioInfoPDAButton: _name = %s", _name.c_str());
for (uint i = 0; i < _actions.size(); ++i) {
_actions[i]->toConsole();
}
diff --git a/engines/pink/objects/actors/cursor_actor.h b/engines/pink/objects/actors/cursor_actor.h
index 897728c..8446b76 100644
--- a/engines/pink/objects/actors/cursor_actor.h
+++ b/engines/pink/objects/actors/cursor_actor.h
@@ -33,7 +33,7 @@ namespace Pink {
//same as actor
class CursorActor : public Actor {
public:
- void toConsole() {
+ void toConsole() override {
debug("CursorActor: _name = %s", _name.c_str());
for (uint i = 0; i < _actions.size(); ++i) {
_actions[i]->toConsole();
diff --git a/engines/pink/objects/actors/inventory_actor.h b/engines/pink/objects/actors/inventory_actor.h
index 9fad7f6..d36b5f8 100644
--- a/engines/pink/objects/actors/inventory_actor.h
+++ b/engines/pink/objects/actors/inventory_actor.h
@@ -32,7 +32,7 @@ namespace Pink {
class InventoryActor : public Actor {
public:
- void toConsole() {
+ void toConsole() override {
debug("CursorActor: _name = %s", _name.c_str());
for (uint i = 0; i < _actions.size(); ++i) {
_actions[i]->toConsole();
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 17ec0ee..578f77b 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -33,6 +33,11 @@
namespace Pink {
+LeadActor::LeadActor()
+ : _state(kReady), _nextState(kReady), _isHaveItem(false),
+ _recipient(nullptr), _cursorMgr(nullptr), _walkMgr(nullptr),
+ _sequencer(nullptr) {}
+
void LeadActor::deserialize(Archive &archive) {
_state = kReady;
Actor::deserialize(archive);
@@ -41,13 +46,42 @@ void LeadActor::deserialize(Archive &archive) {
_sequencer = static_cast<Sequencer*>(archive.readObject());
}
-void LeadActor::setNextExecutors(Common::String &nextModule, Common::String &nextPage) {
- if (_state == kReady || _state == kMoving || _state == kInDialog1 || _state == kInventory || _state == kPDA) {
- _state = kPlayingVideo;
- _page->getGame()->setNextExecutors(nextModule, nextPage);
+void LeadActor::toConsole() {
+ debug("LeadActor: _name = %s", _name.c_str());
+ for (uint i = 0; i < _actions.size(); ++i) {
+ _actions[i]->toConsole();
}
}
+void LeadActor::loadState(Archive &archive) {
+ _state = (State) archive.readByte();
+ _nextState = (State) archive.readByte();
+ _stateCopy = (State) archive.readByte();
+ _isHaveItem = archive.readByte();
+ Common::String recepient = archive.readString();
+ if (!recepient.empty())
+ _recipient = _page->findActor(recepient);
+ else
+ _recipient = nullptr;
+ _sequencer->loadState(archive);
+ _walkMgr->loadState(archive);
+
+ // load audioInfoMgr, PDAMgr
+}
+
+void LeadActor::saveState(Archive &archive) {
+ archive.writeByte(_state);
+ archive.writeByte(_nextState);
+ archive.writeByte(_stateCopy);
+ archive.writeByte(_isHaveItem);
+ if (_recipient)
+ archive.writeString(_recipient->getName());
+ else
+ archive.writeString(Common::String());
+ _sequencer->saveState(archive);
+ _walkMgr->saveState(archive);
+}
+
void LeadActor::init(bool unk) {
if (_state == kUnk_Loading)
_state = kReady;
@@ -57,15 +91,22 @@ void LeadActor::init(bool unk) {
Actor::init(unk);
}
-void LeadActor::toConsole() {
- debug("LeadActor: _name = %s", _name.c_str());
- for (uint i = 0; i < _actions.size(); ++i) {
- _actions[i]->toConsole();
+void LeadActor::start(bool isHandler) {
+ if (isHandler && _state != kPlayingVideo) {
+ _state = kInDialog1;
+ _nextState = kReady;
}
-}
-LeadActor::State LeadActor::getState() const {
- return _state;
+ switch (_state) {
+ case kInventory:
+ _page->getModule()->getInventoryMgr()->start(0);
+ _page->pause(true);
+ break;
+ case kPDA:
+
+ default:
+ forceUpdateCursor();
+ }
}
void LeadActor::update() {
@@ -106,7 +147,26 @@ void LeadActor::update() {
}
}
+void LeadActor::loadPDA(const Common::String &pageName) {
+ if (_state != kPDA) {
+ if (_state == kMoving) {
+ _recipient = nullptr;
+ _nextState = kReady;
+ }
+ _state = kPDA;
+ if (_state != kInventory)
+ _page->pause(true);
+ _page->getGame()->getDirector()->clear();
+ }
+ _page->getGame()->getPdaMgr().setLead(this);
+ _page->getGame()->getPdaMgr().goToPage(pageName);
+}
+
void LeadActor::onKeyboardButtonClick(Common::KeyCode code) {
+ if (code == Common::KEYCODE_g) {
+ loadPDA("TOC");
+ return;
+ }
switch (_state) {
case kMoving:
switch (code) {
@@ -142,63 +202,7 @@ void LeadActor::onKeyboardButtonClick(Common::KeyCode code) {
}
}
-void LeadActor::start(bool isHandler) {
- if (isHandler && _state != kPlayingVideo) {
- _state = kInDialog1;
- _nextState = kReady;
- }
-
- switch (_state) {
- case kInventory:
- _page->getModule()->getInventoryMgr()->start(0);
- _page->pause();
- break;
- case kPDA:
-
- default:
- forceUpdateCursor();
- }
-}
-
-void LeadActor::onMouseMove(Common::Point point) {
- if (_state != kPDA)
- updateCursor(point);
- else _page->getGame()->getPdaMgr().onMouseMove(point);
-}
-
-void LeadActor::updateCursor(Common::Point point) {
- switch (_state) {
- case kReady:
- case kMoving: {
- Director *director = _page->getGame()->getDirector();
- Actor *actor = director->getActorByPoint(point);
- InventoryItem *item = _page->getModule()->getInventoryMgr()->getCurrentItem();
- if (_isHaveItem) {
- if (actor) {
- actor->onHover(point, item->getName(), _cursorMgr);
- } else
- _cursorMgr->setCursor(kHoldingItemCursor, point, item->getName());
- } else if (actor)
- actor->onMouseOver(point, _cursorMgr);
- else
- _cursorMgr->setCursor(kDefaultCursor, point, Common::String());
- break;
- }
- case kInDialog1:
- case kInDialog2:
- case kPlayingVideo:
- _cursorMgr->setCursor(kNotClickableCursor, point, Common::String());
- break;
- case kPDA:
- case kInventory:
- _cursorMgr->setCursor(kDefaultCursor, point, Common::String());
- break;
- default:
- break;
- }
-}
-
-void LeadActor::onLeftButtonClick(Common::Point point) {
+void LeadActor::onLeftButtonClick(const Common::Point point) {
InventoryMgr *invMgr = _page->getModule()->getInventoryMgr();
switch (_state) {
@@ -211,8 +215,8 @@ void LeadActor::onLeftButtonClick(Common::Point point) {
return;
}
- _recipient = dynamic_cast<SupportingActor *>(actor);
- if (actor->isClickable() && isInteractingWith(_recipient)) {
+ _recipient = actor;
+ if (isInteractingWith(_recipient)) {
WalkLocation *location = getWalkDestination();
if (location) {
_state = kMoving;
@@ -239,42 +243,19 @@ void LeadActor::onLeftButtonClick(Common::Point point) {
}
}
-void LeadActor::onMouseOver(Common::Point point, CursorMgr *mgr) {
+void LeadActor::onMouseMove(Common::Point point) {
+ if (_state != kPDA)
+ updateCursor(point);
+ else _page->getGame()->getPdaMgr().onMouseMove(point);
+}
+
+void LeadActor::onMouseOver(const Common::Point point, CursorMgr *mgr) {
if (_page->getModule()->getInventoryMgr()->isPinkOwnsAnyItems())
_cursorMgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
else
Actor::onMouseOver(point, mgr);
}
-void LeadActor::onWalkEnd() {
- State oldNextState = _nextState;
- _state = kReady;
- _nextState = kUnk_Loading;
- if (_recipient && oldNextState == kInDialog1) {
- if (_isHaveItem)
- sendUseClickMessage(_recipient);
- else
- sendLeftClickMessage(_recipient);
- }
-}
-
-bool LeadActor::sendUseClickMessage(SupportingActor *actor) {
- InventoryMgr *mgr = _page->getModule()->getInventoryMgr();
- _nextState = _state != kPlayingVideo ? kReady : kPlayingVideo;
- _state = kInDialog1;
- InventoryItem *item = mgr->getCurrentItem();
- actor->onUseClickMessage(mgr->getCurrentItem(), mgr);
- if (item->getCurrentOwner() != this->_name)
- _isHaveItem = false;
- return true;
-}
-
-bool LeadActor::sendLeftClickMessage(SupportingActor *actor) {
- _nextState = _state != kPlayingVideo ? kReady : kPlayingVideo;
- _state = kInDialog1;
- return actor->onLeftClickMessage();
-}
-
void LeadActor::onClick() {
if (_isHaveItem) {
_isHaveItem = false;
@@ -288,82 +269,107 @@ void LeadActor::onClick() {
if (_page->getModule()->getInventoryMgr()->start(1)) {
_stateCopy = _state;
_state = kInventory;
- _page->pause();
+ _page->pause(true);
}
}
}
-LeadActor::LeadActor()
- : _state(kReady), _nextState(kReady), _isHaveItem(false),
- _recipient(nullptr), _cursorMgr(nullptr), _walkMgr(nullptr),
- _sequencer(nullptr) {}
+void LeadActor::onVariableSet() {}
void LeadActor::onInventoryClosed(bool isItemClicked) {
_isHaveItem = isItemClicked;
_state = _stateCopy;
_stateCopy = kUnk_Loading;
- _page->unpause();
+ _page->pause(false);
forceUpdateCursor();
}
-void LeadActor::forceUpdateCursor() {
- Common::Point point = _page->getGame()->getEventManager()->getMousePos();
- updateCursor(point);
-}
-
-WalkLocation *LeadActor::getWalkDestination() {
- return _walkMgr->findLocation(_recipient->getLocation());
+void LeadActor::onWalkEnd() {
+ State oldNextState = _nextState;
+ _state = kReady;
+ _nextState = kUnk_Loading;
+ if (_recipient && oldNextState == kInDialog1) {
+ if (_isHaveItem)
+ sendUseClickMessage(_recipient);
+ else
+ sendLeftClickMessage(_recipient);
+ }
}
-bool LeadActor::isInteractingWith(SupportingActor *actor) {
+bool LeadActor::isInteractingWith(Actor *actor) {
if (!_isHaveItem)
return actor->isLeftClickHandlers();
return actor->isUseClickHandlers(_page->getModule()->getInventoryMgr()->getCurrentItem());
}
-void LeadActor::loadState(Archive &archive) {
- _state = (State) archive.readByte();
- _nextState = (State) archive.readByte();
- _stateCopy = (State) archive.readByte();
- _isHaveItem = archive.readByte();
- Common::String recepient = archive.readString();
- if (!recepient.empty())
- _recipient = (SupportingActor*) _page->findActor(recepient);
- else
- _recipient = nullptr;
- _sequencer->loadState(archive);
- _walkMgr->loadState(archive);
+void LeadActor::setNextExecutors(const Common::String &nextModule, const Common::String &nextPage) {
+ if (_state == kReady || _state == kMoving || _state == kInDialog1 || _state == kInventory || _state == kPDA) {
+ _state = kPlayingVideo;
+ _page->getGame()->setNextExecutors(nextModule, nextPage);
+ }
+}
- // load audioInfoMgr, PDAMgr
+LeadActor::State LeadActor::getState() const {
+ return _state;
}
-void LeadActor::saveState(Archive &archive) {
- archive.writeByte(_state);
- archive.writeByte(_nextState);
- archive.writeByte(_stateCopy);
- archive.writeByte(_isHaveItem);
- if (_recipient)
- archive.writeString(_recipient->getName());
- else
- archive.writeString(Common::String());
- _sequencer->saveState(archive);
- _walkMgr->saveState(archive);
+void LeadActor::forceUpdateCursor() {
+ const Common::Point point = _page->getGame()->getEventManager()->getMousePos();
+ updateCursor(point);
}
-void LeadActor::loadPDA(const Common::String &pageName) {
- if (_state != kPDA) {
- if (_state == kMoving) {
- _recipient = nullptr;
- _nextState = kReady;
- }
- _state = kPDA;
- if (_state != kInventory)
- _page->pause();
- _page->getGame()->getDirector()->clear();
+void LeadActor::updateCursor(const Common::Point point) {
+ switch (_state) {
+ case kReady:
+ case kMoving: {
+ Director *director = _page->getGame()->getDirector();
+ Actor *actor = director->getActorByPoint(point);
+ InventoryItem *item = _page->getModule()->getInventoryMgr()->getCurrentItem();
+ if (_isHaveItem) {
+ if (actor) {
+ actor->onHover(point, item->getName(), _cursorMgr);
+ } else
+ _cursorMgr->setCursor(kHoldingItemCursor, point, item->getName());
+ } else if (actor)
+ actor->onMouseOver(point, _cursorMgr);
+ else
+ _cursorMgr->setCursor(kDefaultCursor, point, Common::String());
+ break;
}
- _page->getGame()->getPdaMgr().setLead(this);
- _page->getGame()->getPdaMgr().goToPage(pageName);
+ case kInDialog1:
+ case kInDialog2:
+ case kPlayingVideo:
+ _cursorMgr->setCursor(kNotClickableCursor, point, Common::String());
+ break;
+ case kPDA:
+ case kInventory:
+ _cursorMgr->setCursor(kDefaultCursor, point, Common::String());
+ break;
+ default:
+ break;
+ }
+}
+
+bool LeadActor::sendUseClickMessage(Actor *actor) {
+ InventoryMgr *mgr = _page->getModule()->getInventoryMgr();
+ _nextState = _state != kPlayingVideo ? kReady : kPlayingVideo;
+ _state = kInDialog1;
+ InventoryItem *item = mgr->getCurrentItem();
+ actor->onUseClickMessage(mgr->getCurrentItem(), mgr);
+ if (item->getCurrentOwner() != this->_name)
+ _isHaveItem = false;
+ return true;
+}
+
+bool LeadActor::sendLeftClickMessage(Actor *actor) {
+ _nextState = _state != kPlayingVideo ? kReady : kPlayingVideo;
+ _state = kInDialog1;
+ return actor->onLeftClickMessage();
+}
+
+WalkLocation *LeadActor::getWalkDestination() {
+ return _walkMgr->findLocation(_recipient->getLocation());
}
void ParlSqPink::toConsole() {
@@ -390,21 +396,21 @@ void PubPink::toConsole() {
}
}
-bool PubPink::playingMiniGame() {
- return !(_page->checkValueOfVariable(kFoodPuzzle, "TRUE") ||
- _page->checkValueOfVariable(kFoodPuzzle, kUndefined));
-}
-
void PubPink::onClick() {
if (!playingMiniGame())
LeadActor::onClick();
}
-void PubPink::updateCursor(Common::Point point) {
+void PubPink::onVariableSet() {
+ if (playingMiniGame())
+ _isHaveItem = true;
+}
+
+void PubPink::updateCursor(const Common::Point point) {
if (playingMiniGame()) {
- SupportingActor *actor = dynamic_cast<SupportingActor*>(_page->getGame()->getDirector()->getActorByPoint(point));
- if (_state == kReady && actor &&
- actor->isUseClickHandlers(_page->getModule()->getInventoryMgr()->getCurrentItem())) {
+ Actor *actor = _page->getGame()->getDirector()->getActorByPoint(point);
+ assert(actor);
+ if (_state == kReady && actor->isUseClickHandlers(_page->getModule()->getInventoryMgr()->getCurrentItem())) {
_cursorMgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
} else
_cursorMgr->setCursor(kDefaultCursor, point, Common::String());
@@ -412,17 +418,7 @@ void PubPink::updateCursor(Common::Point point) {
else LeadActor::updateCursor(point);
}
-WalkLocation *PubPink::getWalkDestination() {
- if (playingMiniGame())
- return nullptr;
-
- if (_recipient->getName() == kJackson && !_page->checkValueOfVariable(kDrunkLocation, kBolted))
- return _walkMgr->findLocation(_page->findActor(kDrunk)->getName());
-
- return LeadActor::getWalkDestination();
-}
-
-bool PubPink::sendUseClickMessage(SupportingActor *actor) {
+bool PubPink::sendUseClickMessage(Actor *actor) {
if (!LeadActor::sendUseClickMessage(actor) && playingMiniGame()) {
_nextState = _state;
_state = kInDialog1;
@@ -451,9 +447,19 @@ bool PubPink::sendUseClickMessage(SupportingActor *actor) {
return true;
}
-void PubPink::onVariableSet() {
+WalkLocation *PubPink::getWalkDestination() {
if (playingMiniGame())
- _isHaveItem = true;
+ return nullptr;
+
+ if (_recipient->getName() == kJackson && !_page->checkValueOfVariable(kDrunkLocation, kBolted))
+ return _walkMgr->findLocation(_page->findActor(kDrunk)->getName());
+
+ return LeadActor::getWalkDestination();
+}
+
+bool PubPink::playingMiniGame() {
+ return !_page->checkValueOfVariable(kFoodPuzzle, "TRUE") ||
+ _page->checkValueOfVariable(kFoodPuzzle, kUndefined);
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index 0e48035..65eb89b 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -41,6 +41,7 @@ class InventoryItem;
class LeadActor : public Actor {
public:
LeadActor();
+
enum State {
kReady = 0,
kMoving = 1,
@@ -52,83 +53,91 @@ public:
kUnk_Loading = 7// ????
};
+ void deserialize(Archive &archive) override;
- virtual void deserialize(Archive &archive);
+ void toConsole() override;
- virtual void toConsole();
+ void loadState(Archive &archive);
+ void saveState(Archive &archive);
- void setNextExecutors (Common::String &nextModule, Common::String &nextPage);
virtual void init(bool unk);
- State getState() const;
-
void start(bool isHandler);
+
void update();
+ void loadPDA(const Common::String &pageName);
+
void onKeyboardButtonClick(Common::KeyCode code);
- void onLeftButtonClick(Common::Point point);
- void onMouseMove(Common::Point point);
- void onWalkEnd();
- virtual void onClick();
- void onInventoryClosed(bool isItemClicked);
- virtual void onVariableSet() {};
+ void onLeftButtonClick(const Common::Point point);
+
+ void onMouseMove(const Common::Point point);
- virtual void onMouseOver(Common::Point point, CursorMgr *mgr);
+ void onMouseOver(const Common::Point point, CursorMgr *mgr) override;
- bool isInteractingWith(SupportingActor *actor);
+ virtual void onClick();
+ virtual void onVariableSet();
+ void onInventoryClosed(bool isItemClicked);
+ void onWalkEnd();
- virtual void loadState(Archive &archive);
+ bool isInteractingWith(Actor *actor);
- virtual void saveState(Archive &archive);
+ void setNextExecutors (const Common::String &nextModule, const Common::String &nextPage);
- void loadPDA(const Common::String &pageName);
+ State getState() const;
protected:
- virtual void updateCursor(Common::Point point);
void forceUpdateCursor();
- virtual bool sendUseClickMessage(SupportingActor *actor);
- bool sendLeftClickMessage(SupportingActor *actor);
+ virtual void updateCursor(const Common::Point point);
+
+ virtual bool sendUseClickMessage(Actor *actor);
+ bool sendLeftClickMessage(Actor *actor);
virtual WalkLocation *getWalkDestination();
+ Actor *_recipient;
+
+ CursorMgr *_cursorMgr;
+ WalkMgr *_walkMgr;
+ Sequencer *_sequencer;
+
State _state;
State _nextState;
State _stateCopy;
bool _isHaveItem;
-
- SupportingActor *_recipient;
-
- CursorMgr *_cursorMgr;
- WalkMgr *_walkMgr;
- Sequencer *_sequencer;
};
class ParlSqPink : public LeadActor {
public:
- virtual WalkLocation *getWalkDestination();
- void toConsole();
+ void toConsole() override;
+
+protected:
+ WalkLocation *getWalkDestination() override;
};
class PubPink : public LeadActor {
public:
PubPink();
- void toConsole();
+ void toConsole() override;
- virtual void onClick();
- virtual void onVariableSet();
+ void onClick() override;
+ void onVariableSet() override;
-private:
- int _round;
+protected:
+ void updateCursor(Common::Point point) override;
- virtual bool sendUseClickMessage(SupportingActor *actor);
- virtual void updateCursor(Common::Point point);
- virtual WalkLocation *getWalkDestination();
+ bool sendUseClickMessage(Actor *actor) override;
+
+ WalkLocation *getWalkDestination() override;
+private:
bool playingMiniGame();
+
+ int _round;
};
diff --git a/engines/pink/objects/actors/pda_button_actor.cpp b/engines/pink/objects/actors/pda_button_actor.cpp
index a54e04b..6369394 100644
--- a/engines/pink/objects/actors/pda_button_actor.cpp
+++ b/engines/pink/objects/actors/pda_button_actor.cpp
@@ -52,7 +52,7 @@ void PDAButtonActor::onClick() {
}
}
-void PDAButtonActor::onMouseOver(Common::Point point, CursorMgr *mgr) {
+void PDAButtonActor::onMouseOver(const Common::Point point, CursorMgr *mgr) {
if (_command.type == Command::Unk || !isActive())
mgr->setCursor(kPDADefaultCursor, point, Common::String());
else
diff --git a/engines/pink/objects/actors/pda_button_actor.h b/engines/pink/objects/actors/pda_button_actor.h
index 87db1c2..c7bfdd1 100644
--- a/engines/pink/objects/actors/pda_button_actor.h
+++ b/engines/pink/objects/actors/pda_button_actor.h
@@ -41,10 +41,12 @@ struct Command {
class PDAButtonActor : public Actor {
public:
void deserialize(Archive &archive) override;
+
void toConsole() override;
- void onClick();
- void onMouseOver(Common::Point point, CursorMgr *mgr);
+ void onMouseOver(const Common::Point point, CursorMgr *mgr) override;
+
+ void onClick() override;
private:
bool isActive();
diff --git a/engines/pink/objects/actors/supporting_actor.cpp b/engines/pink/objects/actors/supporting_actor.cpp
index 9e5eaa6..ea2a49e 100644
--- a/engines/pink/objects/actors/supporting_actor.cpp
+++ b/engines/pink/objects/actors/supporting_actor.cpp
@@ -46,6 +46,14 @@ void SupportingActor::toConsole() {
_handlerMgr.toConsole();
}
+bool SupportingActor::isLeftClickHandlers() {
+ return _handlerMgr.isLeftClickHandler(this);
+}
+
+bool SupportingActor::isUseClickHandlers(InventoryItem *item) {
+ return _handlerMgr.isUseClickHandler(this, item->getName());
+}
+
void SupportingActor::onMouseOver(Common::Point point, CursorMgr *mgr) {
if (isLeftClickHandlers()){
if (!_cursor.empty())
@@ -57,12 +65,11 @@ void SupportingActor::onMouseOver(Common::Point point, CursorMgr *mgr) {
Actor::onMouseOver(point, mgr);
}
-bool SupportingActor::isLeftClickHandlers() {
- return _handlerMgr.isLeftClickHandler(this);
-}
-
-bool SupportingActor::isUseClickHandlers(InventoryItem *item) {
- return _handlerMgr.isUseClickHandler(this, item->getName());
+void SupportingActor::onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) {
+ Common::String item = itemName;
+ if (_handlerMgr.isUseClickHandler(this, itemName))
+ item += kClickable;
+ Actor::onHover(point, item, cursorMgr);
}
void SupportingActor::onTimerMessage() {
@@ -81,11 +88,4 @@ const Common::String &SupportingActor::getLocation() const {
return _location;
}
-void SupportingActor::onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) {
- Common::String item = itemName;
- if (_handlerMgr.isUseClickHandler(this, itemName))
- item += kClickable;
- Actor::onHover(point, item, cursorMgr);
-}
-
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/supporting_actor.h b/engines/pink/objects/actors/supporting_actor.h
index d9b77f7..1d200d2 100644
--- a/engines/pink/objects/actors/supporting_actor.h
+++ b/engines/pink/objects/actors/supporting_actor.h
@@ -33,26 +33,25 @@ class InventoryMgr;
class SupportingActor : public Actor {
public:
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ virtual void deserialize(Archive &archive) override;
- virtual void onMouseOver(Common::Point point, CursorMgr *mgr);
+ virtual void toConsole() override;
- virtual bool isClickable() { return 1; }
- bool isLeftClickHandlers();
- bool isUseClickHandlers(InventoryItem *item);
+ bool isLeftClickHandlers() override;
+ bool isUseClickHandlers(InventoryItem *item) override;
- void onTimerMessage();
- bool onLeftClickMessage();
- bool onUseClickMessage(InventoryItem *item, InventoryMgr *mgr);
+ void onMouseOver(Common::Point point, CursorMgr *mgr) override;
+ void onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) override;
- virtual void onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr);
-
- const Common::String &getLocation() const;
+ void onTimerMessage() override;
+ bool onLeftClickMessage() override;
+ bool onUseClickMessage(InventoryItem *item, InventoryMgr *mgr) override;
+ const Common::String &getLocation() const override;
private:
HandlerMgr _handlerMgr;
+
Common::String _location;
Common::String _pdaLink;
Common::String _cursor;
diff --git a/engines/pink/objects/object.cpp b/engines/pink/objects/object.cpp
index 02249a3..0218cb7 100644
--- a/engines/pink/objects/object.cpp
+++ b/engines/pink/objects/object.cpp
@@ -26,17 +26,27 @@
namespace Pink {
-Pink::NamedObject::NamedObject(const Common::String &name)
+Object::~Object() {}
+
+void Object::load(Archive &) {}
+
+void Object::deserialize(Archive &) {}
+
+void Object::init() {}
+
+void Object::toConsole() {}
+
+NamedObject::NamedObject() {}
+
+NamedObject::NamedObject(const Common::String &name)
: _name(name) {}
-void Pink::NamedObject::deserialize(Archive &archive) {
+void NamedObject::deserialize(Archive &archive) {
_name = archive.readString();
}
-const Common::String &Pink::NamedObject::getName() const {
+const Common::String &NamedObject::getName() const {
return _name;
}
-void NamedObject::store(Archive &archive) {}
-
} // End of namespace Pink
diff --git a/engines/pink/objects/object.h b/engines/pink/objects/object.h
index e69fa4b..3f331f2 100644
--- a/engines/pink/objects/object.h
+++ b/engines/pink/objects/object.h
@@ -31,21 +31,22 @@ class Archive;
class Object {
public:
- virtual ~Object() {};
- virtual void load(Archive &) {};
- virtual void store(Archive &) {};
- virtual void deserialize(Archive &) {};
- virtual void init() {}
- virtual void toConsole() {};
+ virtual ~Object();
+
+ virtual void load(Archive &);
+ virtual void deserialize(Archive &);
+
+ virtual void init();
+
+ virtual void toConsole();
};
class NamedObject : public Object {
public:
- NamedObject() {};
+ NamedObject();
NamedObject(const Common::String &name);
void deserialize(Archive &archive);
- void store(Archive &archive);
const Common::String &getName() const;
diff --git a/engines/pink/objects/sequences/seq_timer.cpp b/engines/pink/objects/sequences/seq_timer.cpp
index 5026051..95fe53b 100644
--- a/engines/pink/objects/sequences/seq_timer.cpp
+++ b/engines/pink/objects/sequences/seq_timer.cpp
@@ -46,14 +46,15 @@ void SeqTimer::toConsole() {
}
void SeqTimer::update() {
- Common::RandomSource &rnd =_sequencer->_page->getGame()->getRnd();
+ Common::RandomSource &rnd = _sequencer->_page->getGame()->getRnd();
if (_updatesToMessage--)
return;
_updatesToMessage = _range ? _period + rnd.getRandomNumber(_range) : _period;
- SupportingActor *actor = static_cast<SupportingActor*>(_sequencer->_page->findActor(_actor));
- if (actor && !_sequencer->findSequenceActorState(actor->getName())) {
+ Actor *actor = _sequencer->_page->findActor(_actor);
+ assert(actor);
+ if (!_sequencer->findSequenceActorState(actor->getName())) {
actor->onTimerMessage();
}
}
Commit: 442f725a5d2d36183fdc41d7b050beb4aa4fd8fa
https://github.com/scummvm/scummvm/commit/442f725a5d2d36183fdc41d7b050beb4aa4fd8fa
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: add loadTxt to ResourceMgr
Changed paths:
engines/pink/resource_mgr.cpp
engines/pink/resource_mgr.h
diff --git a/engines/pink/resource_mgr.cpp b/engines/pink/resource_mgr.cpp
index d81c98b..98792d2 100644
--- a/engines/pink/resource_mgr.cpp
+++ b/engines/pink/resource_mgr.cpp
@@ -48,14 +48,37 @@ void ResourceMgr::init(PinkEngine *game, Page *page) {
_resDescTable = orb->getResDescTable(objDesc);
}
+void ResourceMgr::clear() {
+ delete[] _resDescTable;
+ _resDescTable = nullptr;
+}
+
+CelDecoder *ResourceMgr::loadCEL(Common::String &name) {
+ CelDecoder *decoder = new CelDecoder();
+ decoder->loadStream(getResourceStream(name));
+ return decoder;
+}
+
Sound *ResourceMgr::loadSound(Common::String &name) {
return new Sound(_game->_mixer, getResourceStream(name));
}
+Common::String ResourceMgr::loadText(Common::String &name) {
+ Common::SeekableReadStream *stream = getResourceStream(name);
+ char *txt = new char[stream->size()];
+ Common::String str(txt, stream->size());
+ delete txt;
+ return str;
+}
+
static int resDescComp(const void *a, const void *b) {
return scumm_stricmp((char *) a, (char *) b);
}
+PinkEngine *ResourceMgr::getGame() const {
+ return _game;
+}
+
Common::SafeSeekableSubReadStream *ResourceMgr::getResourceStream(Common::String &name) {
Common::SeekableReadStream *stream;
@@ -69,22 +92,7 @@ Common::SafeSeekableSubReadStream *ResourceMgr::getResourceStream(Common::String
stream->seek(desc->offset);
return new Common::SafeSeekableSubReadStream(stream, desc->offset,
- desc->offset + desc->size);
-}
-
-PinkEngine *ResourceMgr::getGame() const {
- return _game;
-}
-
-CelDecoder *ResourceMgr::loadCEL(Common::String &name) {
- CelDecoder *decoder = new CelDecoder();
- decoder->loadStream(getResourceStream(name));
- return decoder;
-}
-
-void ResourceMgr::clear() {
- delete[] _resDescTable;
- _resDescTable = nullptr;
+ desc->offset + desc->size);
}
} // End of namespace Pink
diff --git a/engines/pink/resource_mgr.h b/engines/pink/resource_mgr.h
index 7cd3dc3..4b050eb 100644
--- a/engines/pink/resource_mgr.h
+++ b/engines/pink/resource_mgr.h
@@ -47,11 +47,13 @@ public:
~ResourceMgr();
void init(PinkEngine *game, Page *page);
+
void clear();
- //Common::String loadText(Common::String &name);
- Sound *loadSound(Common::String &name);
CelDecoder *loadCEL(Common::String &name);
+ Sound *loadSound(Common::String &name);
+ Common::String loadText(Common::String &name);
+
PinkEngine *getGame() const;
private:
Commit: da0adc92a2cc1af0da78a4e612f382e1e5b42bd0
https://github.com/scummvm/scummvm/commit/da0adc92a2cc1af0da78a4e612f382e1e5b42bd0
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: reformat Action's code
Changed paths:
engines/pink/objects/actions/action.cpp
engines/pink/objects/actions/action.h
engines/pink/objects/actions/action_cel.cpp
engines/pink/objects/actions/action_cel.h
engines/pink/objects/actions/action_hide.cpp
engines/pink/objects/actions/action_hide.h
engines/pink/objects/actions/action_loop.h
engines/pink/objects/actions/action_play.cpp
engines/pink/objects/actions/action_play.h
engines/pink/objects/actions/action_play_with_sfx.cpp
engines/pink/objects/actions/action_play_with_sfx.h
engines/pink/objects/actions/action_sound.cpp
engines/pink/objects/actions/action_sound.h
engines/pink/objects/actions/action_still.cpp
engines/pink/objects/actions/action_still.h
engines/pink/objects/actions/action_talk.cpp
engines/pink/objects/actions/action_talk.h
engines/pink/objects/actions/action_text.cpp
engines/pink/objects/actions/action_text.h
engines/pink/objects/actions/walk_action.h
diff --git a/engines/pink/objects/actions/action.cpp b/engines/pink/objects/actions/action.cpp
index 934d6fc..34106f7 100644
--- a/engines/pink/objects/actions/action.cpp
+++ b/engines/pink/objects/actions/action.cpp
@@ -31,4 +31,14 @@ void Action::deserialize(Archive &archive) {
_actor = static_cast<Actor*>(archive.readObject());
}
+bool Action::initPalette(Director *director) {
+ return false;
+}
+
+void Action::pause(bool paused) {}
+
+Actor *Action::getActor() const {
+ return _actor;
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action.h b/engines/pink/objects/actions/action.h
index 9c4e902..4028702 100644
--- a/engines/pink/objects/actions/action.h
+++ b/engines/pink/objects/actions/action.h
@@ -32,17 +32,16 @@ class Director;
class Action : public NamedObject {
public:
- virtual void deserialize(Archive &archive);
- virtual void start(bool unk) {};
- virtual void end() {};
- virtual void update() {};
- virtual void toConsole() {};
+ virtual void deserialize(Archive &archive) override;
- virtual bool initPalette(Director *director) { return 0; }
+ virtual bool initPalette(Director *director);
- Actor *getActor() { return _actor; }
+ virtual void start() = 0;
+ virtual void end() = 0;
- virtual void pause(bool paused) {};
+ virtual void pause(bool paused);
+
+ Actor *getActor() const;
protected:
Actor *_actor;
diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp
index 0881542..e6f262f 100644
--- a/engines/pink/objects/actions/action_cel.cpp
+++ b/engines/pink/objects/actions/action_cel.cpp
@@ -34,13 +34,29 @@ namespace Pink {
ActionCEL::ActionCEL()
: _decoder(nullptr) {}
+ActionCEL::~ActionCEL() {
+ end();
+}
+
void ActionCEL::deserialize(Archive &archive) {
Action::deserialize(archive);
_fileName = archive.readString();
_z = archive.readDWORD();
}
-void ActionCEL::start(bool unk) {
+bool ActionCEL::initPalette(Director *director) {
+ if (!_decoder)
+ _decoder = _actor->getPage()->loadCel(_fileName);
+ if (_decoder->getCurFrame() == -1) {
+ _decoder->decodeNextFrame();
+ _decoder->rewind();
+ }
+ debug("%u", _decoder->isPaused());
+ director->setPallette(_decoder->getPalette());
+ return true;
+}
+
+void ActionCEL::start() {
if (!_decoder)
_decoder = _actor->getPage()->loadCel(_fileName);
_actor->getPage()->getGame()->getDirector()->addSprite(this);
@@ -54,23 +70,6 @@ void ActionCEL::end() {
_decoder = nullptr;
}
-uint32 ActionCEL::getZ() {
- return _z;
-}
-
-CelDecoder *ActionCEL::getDecoder() {
- return _decoder;
-}
-
-bool ActionCEL::initPalette(Director *director) {
- _decoder = _actor->getPage()->loadCel(_fileName);
- _decoder->decodeNextFrame();
- _decoder->rewind();
- director->setPallette(_decoder->getPalette());
-
- return 1;
-}
-
void ActionCEL::update() {
if (_decoder->endOfVideo()) {
_decoder->stop();
@@ -78,12 +77,16 @@ void ActionCEL::update() {
}
}
-ActionCEL::~ActionCEL() {
- end();
-}
-
void ActionCEL::pause(bool paused) {
_decoder->pauseVideo(paused);
}
+uint32 ActionCEL::getZ() {
+ return _z;
+}
+
+CelDecoder *ActionCEL::getDecoder() {
+ return _decoder;
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_cel.h b/engines/pink/objects/actions/action_cel.h
index 60b85e0..2623c55 100644
--- a/engines/pink/objects/actions/action_cel.h
+++ b/engines/pink/objects/actions/action_cel.h
@@ -31,23 +31,26 @@ class CelDecoder;
class ActionCEL : public Action {
public:
+ ActionCEL();
~ActionCEL() override;
- ActionCEL();
- virtual void deserialize(Archive &archive);
- virtual void start(bool unk);
- virtual void end();
- virtual void update();
+ void deserialize(Archive &archive) override;
- uint32 getZ();
- CelDecoder *getDecoder();
+ bool initPalette(Director *director) override;
- virtual bool initPalette(Director *director);
+ void start() override;
+ void end() override;
+
+ virtual void update();
void pause(bool paused) override;
+ uint32 getZ();
+ CelDecoder *getDecoder();
+
protected:
- virtual void onStart() {};
+ virtual void onStart() = 0;
+
CelDecoder *_decoder;
Common::String _fileName;
uint32 _z;
diff --git a/engines/pink/objects/actions/action_hide.cpp b/engines/pink/objects/actions/action_hide.cpp
index 1732d2d..a2435c4 100644
--- a/engines/pink/objects/actions/action_hide.cpp
+++ b/engines/pink/objects/actions/action_hide.cpp
@@ -26,11 +26,11 @@
namespace Pink {
-void Pink::ActionHide::deserialize(Archive &archive) {
- Action::deserialize(archive);
+void ActionHide::toConsole() {
+ debug("\tActionHide: _name = %s", _name.c_str());
}
-void ActionHide::start(bool unk_startNow) {
+void ActionHide::start() {
debug("Actor %s has now ActionHide %s", _actor->getName().c_str(), _name.c_str());
_actor->endAction();
}
@@ -39,10 +39,4 @@ void ActionHide::end() {
debug("ActionHide %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
}
-void ActionHide::toConsole() {
- debug("\tActionHide: _name = %s", _name.c_str());
-}
-
-ActionHide::~ActionHide() {}
-
} //End of namespace Pink
diff --git a/engines/pink/objects/actions/action_hide.h b/engines/pink/objects/actions/action_hide.h
index eb2b8da..7db4be1 100644
--- a/engines/pink/objects/actions/action_hide.h
+++ b/engines/pink/objects/actions/action_hide.h
@@ -29,13 +29,10 @@ namespace Pink {
class ActionHide : public Action {
public:
- ~ActionHide() override;
+ void toConsole() override;
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
-
- virtual void start(bool unk);
- virtual void end();
+ void start() override;
+ void end() override;
};
} //End of namespace Pink
diff --git a/engines/pink/objects/actions/action_loop.h b/engines/pink/objects/actions/action_loop.h
index 0b8132a..db02544 100644
--- a/engines/pink/objects/actions/action_loop.h
+++ b/engines/pink/objects/actions/action_loop.h
@@ -29,11 +29,14 @@ namespace Pink {
class ActionLoop : public ActionPlay {
public:
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
- virtual void update();
+ void deserialize(Archive &archive) override;
+
+ void toConsole() override;
+
+ void update() override;
+
protected:
- virtual void onStart();
+ void onStart() override;
enum Style {
kPingPong = 2,
diff --git a/engines/pink/objects/actions/action_play.cpp b/engines/pink/objects/actions/action_play.cpp
index a2b8b0a..9e9c856 100644
--- a/engines/pink/objects/actions/action_play.cpp
+++ b/engines/pink/objects/actions/action_play.cpp
@@ -44,6 +44,17 @@ void ActionPlay::end() {
debug("ActionPlay %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
}
+void ActionPlay::update() {
+ if (_decoder->endOfVideo() || _decoder->getCurFrame() == _stopFrame) {
+ _decoder->stop();
+ _actor->endAction();
+ }
+}
+
+void ActionPlay::pause(bool paused) {
+ ActionCEL::pause(paused);
+}
+
void ActionPlay::onStart() {
debug("Actor %s has now ActionPlay %s", _actor->getName().c_str(), _name.c_str());
_decoder->start();
@@ -53,11 +64,4 @@ void ActionPlay::onStart() {
_decoder->decodeNextFrame();
}
-void ActionPlay::update() {
- if (_decoder->endOfVideo() || _decoder->getCurFrame() == _stopFrame) {
- _decoder->stop();
- _actor->endAction();
- }
-}
-
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_play.h b/engines/pink/objects/actions/action_play.h
index 6553bb1..cdefc88 100644
--- a/engines/pink/objects/actions/action_play.h
+++ b/engines/pink/objects/actions/action_play.h
@@ -29,15 +29,18 @@ namespace Pink {
class ActionPlay : public ActionStill {
public:
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ void deserialize(Archive &archive) override;
- virtual void end();
+ void toConsole() override;
+
+ void end() override;
void update() override;
+ void pause(bool paused) override;
+
protected:
- virtual void onStart();
+ void onStart() override;
int32 _stopFrame;
};
diff --git a/engines/pink/objects/actions/action_play_with_sfx.cpp b/engines/pink/objects/actions/action_play_with_sfx.cpp
index c4ab139..056ce6e 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.cpp
+++ b/engines/pink/objects/actions/action_play_with_sfx.cpp
@@ -28,6 +28,13 @@
namespace Pink {
+ActionPlayWithSfx::~ActionPlayWithSfx() {
+ ActionPlay::end();
+ for (uint i = 0; i < _sfxArray.size(); ++i) {
+ delete _sfxArray[i];
+ }
+}
+
void ActionPlayWithSfx::deserialize(Pink::Archive &archive) {
ActionPlay::deserialize(archive);
_isLoop = archive.readDWORD();
@@ -71,11 +78,11 @@ void ActionPlayWithSfx::updateSound() {
}
}
-ActionPlayWithSfx::~ActionPlayWithSfx() {
- ActionPlay::end();
- for (uint i = 0; i < _sfxArray.size(); ++i) {
- delete _sfxArray[i];
- }
+ActionSfx::ActionSfx()
+ : _sound(nullptr) {}
+
+ActionSfx::~ActionSfx() {
+ end();
}
void ActionSfx::deserialize(Pink::Archive &archive) {
@@ -97,20 +104,13 @@ void ActionSfx::play(Page *page) {
_sound->play(Audio::Mixer::kSFXSoundType, _volume, 0);
}
-ActionSfx::~ActionSfx() {
- end();
+void ActionSfx::end() {
+ delete _sound;
+ _sound = nullptr;
}
uint32 ActionSfx::getFrame() {
return _frame;
}
-ActionSfx::ActionSfx()
- : _sound(nullptr) {}
-
-void ActionSfx::end() {
- delete _sound;
- _sound = nullptr;
-}
-
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_play_with_sfx.h b/engines/pink/objects/actions/action_play_with_sfx.h
index 8945572..7e8b0c8 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.h
+++ b/engines/pink/objects/actions/action_play_with_sfx.h
@@ -31,18 +31,22 @@ class ActionSfx;
class ActionPlayWithSfx : public ActionPlay {
public:
- virtual ~ActionPlayWithSfx();
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
- virtual void update();
+ ~ActionPlayWithSfx() override;
+
+ void deserialize(Archive &archive) override;
+
+ void toConsole() override;
+
+ void update() override;
protected:
- virtual void onStart();
+ void onStart() override;
private:
void updateSound();
- uint32 _isLoop;
+
Array<ActionSfx *> _sfxArray;
+ uint32 _isLoop;
};
class Sound;
@@ -51,14 +55,17 @@ class Page;
class ActionSfx : public Object {
public:
ActionSfx();
- virtual ~ActionSfx();
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ ~ActionSfx() override;
+
+ void deserialize(Archive &archive) override;
+
+ void toConsole() override;
void play(Page *page);
- uint32 getFrame();
void end();
+ uint32 getFrame();
+
private:
Sound *_sound;
Common::String _sfxName;
diff --git a/engines/pink/objects/actions/action_sound.cpp b/engines/pink/objects/actions/action_sound.cpp
index a80130b..d63d57c 100644
--- a/engines/pink/objects/actions/action_sound.cpp
+++ b/engines/pink/objects/actions/action_sound.cpp
@@ -51,7 +51,7 @@ void ActionSound::toConsole() {
" _isBackground = %u", _name.c_str(), _fileName.c_str(), _volume, _isLoop, _isBackground);
}
-void ActionSound::start(bool unk) {
+void ActionSound::start() {
assert(!_sound);
_sound = _actor->getPage()->loadSound(_fileName);
diff --git a/engines/pink/objects/actions/action_sound.h b/engines/pink/objects/actions/action_sound.h
index f5d1401..c614951 100644
--- a/engines/pink/objects/actions/action_sound.h
+++ b/engines/pink/objects/actions/action_sound.h
@@ -34,13 +34,14 @@ public:
ActionSound();
~ActionSound();
- virtual void deserialize(Archive &archive);
+ void deserialize(Archive &archive) override;
- virtual void toConsole();
+ void toConsole() override;
- virtual void start(bool unk_startNow);
- virtual void end();
- virtual void update();
+ void start() override;
+ void end() override;
+
+ void update();
void pause(bool paused) override;
diff --git a/engines/pink/objects/actions/action_still.cpp b/engines/pink/objects/actions/action_still.cpp
index ebdde4e..693d130 100644
--- a/engines/pink/objects/actions/action_still.cpp
+++ b/engines/pink/objects/actions/action_still.cpp
@@ -44,6 +44,8 @@ void ActionStill::end() {
debug("ActionStill %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
}
+void ActionStill::pause(bool paused) {}
+
void ActionStill::onStart() {
debug("Actor %s has now ActionStill %s", _actor->getName().c_str(), _name.c_str());
for (uint i = 0; i < _startFrame; ++i) {
diff --git a/engines/pink/objects/actions/action_still.h b/engines/pink/objects/actions/action_still.h
index 90c5c7d..a9b2d52 100644
--- a/engines/pink/objects/actions/action_still.h
+++ b/engines/pink/objects/actions/action_still.h
@@ -29,14 +29,16 @@ namespace Pink {
class ActionStill : public ActionCEL {
public:
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ void deserialize(Archive &archive) override;
- virtual void end();
- virtual void pause(bool paused) {}
+ void toConsole() override;
+
+ void end() override;
+
+ void pause(bool paused) override;
protected:
- virtual void onStart();
+ void onStart() override;
uint32 _startFrame;
};
diff --git a/engines/pink/objects/actions/action_talk.cpp b/engines/pink/objects/actions/action_talk.cpp
index 7ecd40d..c142dca 100644
--- a/engines/pink/objects/actions/action_talk.cpp
+++ b/engines/pink/objects/actions/action_talk.cpp
@@ -40,12 +40,6 @@ void ActionTalk::toConsole() {
_name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame, _intro, _style, _vox.c_str());
}
-void ActionTalk::onStart() {
- ActionPlay::onStart();
- _sound = _actor->getPage()->loadSound(_vox);
- _sound->play(Audio::Mixer::kSpeechSoundType, 100, 0);
-}
-
void ActionTalk::update() {
ActionLoop::update();
if (!_sound->isPlaying()) {
@@ -66,4 +60,10 @@ void ActionTalk::pause(bool paused) {
_sound->pause(paused);
}
+void ActionTalk::onStart() {
+ ActionPlay::onStart();
+ _sound = _actor->getPage()->loadSound(_vox);
+ _sound->play(Audio::Mixer::kSpeechSoundType, 100, 0);
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_talk.h b/engines/pink/objects/actions/action_talk.h
index e14e6bc..672e024 100644
--- a/engines/pink/objects/actions/action_talk.h
+++ b/engines/pink/objects/actions/action_talk.h
@@ -31,16 +31,18 @@ class Sound;
class ActionTalk : public ActionLoop {
public:
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
- virtual void update();
+ void deserialize(Archive &archive) override;
- virtual void end();
+ void toConsole() override;
+
+ void update() override;
+
+ void end() override;
void pause(bool paused) override;
protected:
- virtual void onStart();
+ void onStart() override;
private:
Sound *_sound;
diff --git a/engines/pink/objects/actions/action_text.cpp b/engines/pink/objects/actions/action_text.cpp
index f9ef86a..bf08071 100644
--- a/engines/pink/objects/actions/action_text.cpp
+++ b/engines/pink/objects/actions/action_text.cpp
@@ -48,4 +48,12 @@ void ActionText::toConsole() {
_name.c_str(), _fileName.c_str(), _xLeft, _yTop, _xRight, _yBottom, _centered, _scrollBar, _textColor, _backgroundColor);
}
+void ActionText::start() {
+
+}
+
+void ActionText::end() {
+
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_text.h b/engines/pink/objects/actions/action_text.h
index e0cc752..bcf0a35 100644
--- a/engines/pink/objects/actions/action_text.h
+++ b/engines/pink/objects/actions/action_text.h
@@ -33,6 +33,9 @@ public:
void toConsole() override;
+ void start() override;
+ void end() override;
+
private:
Common::String _fileName;
diff --git a/engines/pink/objects/actions/walk_action.h b/engines/pink/objects/actions/walk_action.h
index d53c8c2..ac41bcb 100644
--- a/engines/pink/objects/actions/walk_action.h
+++ b/engines/pink/objects/actions/walk_action.h
@@ -29,9 +29,9 @@ namespace Pink {
class WalkAction : public ActionCEL {
public:
- virtual void deserialize(Archive &archive);
+ void deserialize(Archive &archive) override;
- virtual void toConsole();
+ void toConsole() override;
protected:
void onStart() override;
Commit: 4874ed50d268c42d5c22876abe6c8d9049c3f0fa
https://github.com/scummvm/scummvm/commit/4874ed50d268c42d5c22876abe6c8d9049c3f0fa
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: implement exit from PDA
Changed paths:
engines/pink/cursor_mgr.cpp
engines/pink/cursor_mgr.h
engines/pink/director.cpp
engines/pink/director.h
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/actors/lead_actor.h
engines/pink/pda_mgr.cpp
diff --git a/engines/pink/cursor_mgr.cpp b/engines/pink/cursor_mgr.cpp
index 391e45d..379d469 100644
--- a/engines/pink/cursor_mgr.cpp
+++ b/engines/pink/cursor_mgr.cpp
@@ -29,13 +29,11 @@
namespace Pink {
-CursorMgr::CursorMgr(PinkEngine *game, GamePage *page)
+CursorMgr::CursorMgr(PinkEngine *game, Page *page)
: _actor(nullptr), _page(page), _game(game),
_isPlayingAnimation(0), _firstFrameIndex(0) {}
-CursorMgr::~CursorMgr() {}
-
-void CursorMgr::setCursor(uint index, Common::Point point, const Common::String &itemName) {
+void CursorMgr::setCursor(uint index, const Common::Point point, const Common::String &itemName) {
if (index == kClickableFirstFrameCursor) {
startAnimation(index);
return hideItem();
@@ -61,7 +59,7 @@ void CursorMgr::setCursor(uint index, Common::Point point, const Common::String
assert(dynamic_cast<ActionCEL*>(action));
if (action != _actor->getAction()) {
- _actor->setAction(action, 0);
+ _actor->setAction(action);
CelDecoder *decoder = static_cast<ActionCEL*>(action)->getDecoder();
decoder->setX(point.x);
decoder->setY(point.y);
@@ -85,7 +83,7 @@ void CursorMgr::update() {
}
}
-void CursorMgr::setCursor(Common::String &cursorName, Common::Point point) {
+void CursorMgr::setCursor(const Common::String &cursorName, const Common::Point point) {
uint index;
if (cursorName == kCursorNameExitLeft)
index = kExitLeftCursor;
@@ -114,4 +112,8 @@ void CursorMgr::startAnimation(int index) {
}
}
+void CursorMgr::setPage(Page *page) {
+ _page = page;
+}
+
} // End of namespace Pink
diff --git a/engines/pink/cursor_mgr.h b/engines/pink/cursor_mgr.h
index 4f10d22..391fcd3 100644
--- a/engines/pink/cursor_mgr.h
+++ b/engines/pink/cursor_mgr.h
@@ -33,24 +33,25 @@ namespace Pink {
class Actor;
class Action;
-class GamePage;
+class Page;
class PinkEngine;
class CursorMgr : public Object {
public:
- CursorMgr(PinkEngine *game, GamePage *page);
- ~CursorMgr();
+ CursorMgr(PinkEngine *game, Page *page);
void update();
- void setCursor(uint index, Common::Point point, const Common::String &itemName);
- void setCursor(Common::String &cursorName, Common::Point point);
+ void setCursor(uint index, const Common::Point point, const Common::String &itemName);
+ void setCursor(const Common::String &cursorName, const Common::Point point);
+
+ void setPage(Page *page);
private:
void hideItem();
void startAnimation(int index);
Actor *_actor;
- GamePage *_page;
+ Page *_page;
PinkEngine *_game;
uint _time;
diff --git a/engines/pink/director.cpp b/engines/pink/director.cpp
index b6f1614..0f208c6 100644
--- a/engines/pink/director.cpp
+++ b/engines/pink/director.cpp
@@ -145,4 +145,15 @@ void Director::pause(bool pause) {
}
}
+void Director::saveStage() {
+ _savedSprites = _sprites;
+ _sprites.clear();
+}
+
+void Director::loadStage() {
+ assert(_sprites.empty());
+ _sprites = _savedSprites;
+ _savedSprites.clear();
+}
+
}
diff --git a/engines/pink/director.h b/engines/pink/director.h
index 053a01a..4574305 100644
--- a/engines/pink/director.h
+++ b/engines/pink/director.h
@@ -53,12 +53,16 @@ public:
void pause(bool pause);
+ void saveStage();
+ void loadStage();
+
bool showBounds;
private:
void drawSprite(ActionCEL *sprite);
OSystem *_system;
Common::Array<ActionCEL *> _sprites;
+ Common::Array<ActionCEL *> _savedSprites;
Common::Array<ActionSound *> _sounds;
};
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 578f77b..cf59405 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -153,10 +153,13 @@ void LeadActor::loadPDA(const Common::String &pageName) {
_recipient = nullptr;
_nextState = kReady;
}
- _state = kPDA;
if (_state != kInventory)
_page->pause(true);
- _page->getGame()->getDirector()->clear();
+
+ _stateBeforePDA = _state;
+ _state = kPDA;
+
+ _page->getGame()->getDirector()->saveStage();
}
_page->getGame()->getPdaMgr().setLead(this);
_page->getGame()->getPdaMgr().goToPage(pageName);
@@ -296,6 +299,15 @@ void LeadActor::onWalkEnd() {
}
}
+void LeadActor::onPDAClose() {
+ _page->initPallete();
+ _page->getGame()->getDirector()->loadStage();
+
+ _state = _stateBeforePDA;
+ if (_state != kInventory)
+ _page->pause(0);
+}
+
bool LeadActor::isInteractingWith(Actor *actor) {
if (!_isHaveItem)
return actor->isLeftClickHandlers();
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index 65eb89b..5428d48 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -79,6 +79,7 @@ public:
virtual void onVariableSet();
void onInventoryClosed(bool isItemClicked);
void onWalkEnd();
+ void onPDAClose();
bool isInteractingWith(Actor *actor);
@@ -105,6 +106,7 @@ protected:
State _state;
State _nextState;
State _stateCopy;
+ State _stateBeforePDA;
bool _isHaveItem;
};
diff --git a/engines/pink/pda_mgr.cpp b/engines/pink/pda_mgr.cpp
index a931f30..9cce204 100644
--- a/engines/pink/pda_mgr.cpp
+++ b/engines/pink/pda_mgr.cpp
@@ -23,6 +23,7 @@
#include "pink/pda_mgr.h"
#include "pink/pink.h"
#include "pink/objects/actors/pda_button_actor.h"
+#include "pink/objects/actors/lead_actor.h"
#include "pink/objects/pages/pda_page.h"
@@ -79,7 +80,7 @@ void PDAMgr::close() {
delete _page;
_page = nullptr;
- //_lead->onPDAClose();
+ _lead->onPDAClose();
}
void PDAMgr::loadGlobal() {
Commit: 83799edcba86d1f6dc553fb727072c3305f4cbd4
https://github.com/scummvm/scummvm/commit/83799edcba86d1f6dc553fb727072c3305f4cbd4
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: reformat file's code
Changed paths:
engines/pink/file.cpp
engines/pink/file.h
diff --git a/engines/pink/file.cpp b/engines/pink/file.cpp
index 77c1873..9646961 100644
--- a/engines/pink/file.cpp
+++ b/engines/pink/file.cpp
@@ -27,6 +27,24 @@
namespace Pink {
+void ObjectDescription::load(Common::File &file) {
+ file.read(name, sizeof(name));
+
+ objectsOffset = file.readUint32LE();
+ objectsCount = file.readUint32LE();
+ resourcesOffset = file.readUint32LE();
+ resourcesCount = file.readUint32LE();
+}
+
+void ResourceDescription::load(Common::File &file) {
+ file.read(name, sizeof(name));
+
+ offset = file.readUint32LE();
+ size = file.readUint32LE();
+ inBro = (bool) file.readUint16LE();
+}
+
+
OrbFile::OrbFile()
: File(), _timestamp(0),
_tableOffset(0),
@@ -87,15 +105,6 @@ void OrbFile::loadObject(Object *obj, ObjectDescription *objDesc) {
obj->load(archive);
}
-uint32 OrbFile::getTimestamp() {
- return _timestamp;
-}
-
-void OrbFile::seekToObject(const char *name) {
- ObjectDescription *desc = getObjDesc(name);
- seek(desc->objectsOffset);
-}
-
static int objDescComp(const void *a, const void *b) {
return scumm_stricmp((char *) a, (char *) b);
}
@@ -117,6 +126,16 @@ ResourceDescription *OrbFile::getResDescTable(ObjectDescription *objDesc){
return table;
}
+uint32 OrbFile::getTimestamp() {
+ return _timestamp;
+}
+
+void OrbFile::seekToObject(const char *name) {
+ ObjectDescription *desc = getObjDesc(name);
+ seek(desc->objectsOffset);
+}
+
+
bool BroFile::open(const Common::String &name, uint32 orbTimestamp) {
if (!File::open(name) || readUint32BE() != 'BRO\0')
return false;
@@ -134,21 +153,4 @@ bool BroFile::open(const Common::String &name, uint32 orbTimestamp) {
return timestamp == orbTimestamp;
}
-void ObjectDescription::load(Common::File &file) {
- file.read(name, sizeof(name));
-
- objectsOffset = file.readUint32LE();
- objectsCount = file.readUint32LE();
- resourcesOffset = file.readUint32LE();
- resourcesCount = file.readUint32LE();
-}
-
-void ResourceDescription::load(Common::File &file) {
- file.read(name, sizeof(name));
-
- offset = file.readUint32LE();
- size = file.readUint32LE();
- inBro = (bool) file.readUint16LE();
-}
-
} // End of namespace Pink
diff --git a/engines/pink/file.h b/engines/pink/file.h
index 094a332..d124eb2 100644
--- a/engines/pink/file.h
+++ b/engines/pink/file.h
@@ -61,12 +61,14 @@ public:
void loadObject(Object *obj, ObjectDescription *objDesc);
ObjectDescription *getObjDesc(const char *name);
+
ResourceDescription *getResDescTable(ObjectDescription *objDesc);
uint32 getTimestamp();
private:
void seekToObject(const char *name);
+
ObjectDescription *_table;
uint32 _timestamp;
uint32 _tableOffset;
Commit: 44efa90377afaf7131fab50ede322f95c7626e9f
https://github.com/scummvm/scummvm/commit/44efa90377afaf7131fab50ede322f95c7626e9f
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: revised page initialization
Changed paths:
engines/pink/objects/pages/game_page.cpp
engines/pink/objects/pages/page.cpp
engines/pink/objects/pages/page.h
engines/pink/objects/pages/pda_page.cpp
engines/pink/objects/pages/pda_page.h
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index 4aa77cb..5bd420c 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -73,16 +73,12 @@ void GamePage::init(bool isLoadingSave) {
toConsole();
- for (uint j = 0; j < _actors.size(); ++j) {
- if (_actors[j]->initPallete(_module->getGame()->getDirector()))
- break;
- }
+ initPallete();
LeadActor::State state = _leadActor->getState();
- bool startNow = !(state == LeadActor::kInventory || state == LeadActor::kPDA);
-
+ bool paused = (state == LeadActor::kInventory || state == LeadActor::kPDA);
for (uint i = 0; i < _actors.size(); ++i) {
- _actors[i]->init(startNow);
+ _actors[i]->init(paused);
}
bool isHandler = false;
diff --git a/engines/pink/objects/pages/page.cpp b/engines/pink/objects/pages/page.cpp
index 844bd94..b7a210b 100644
--- a/engines/pink/objects/pages/page.cpp
+++ b/engines/pink/objects/pages/page.cpp
@@ -21,6 +21,7 @@
*/
#include "pink/director.h"
+#include "pink/pink.h"
#include "pink/objects/actors/lead_actor.h"
#include "pink/objects/pages/page.h"
@@ -63,11 +64,16 @@ void Page::toConsole() {
}
void Page::init() {
- LeadActor::State state = _leadActor->getState();
- bool unk = (state == LeadActor::kInventory || state == LeadActor::kPDA);
+ initPallete();
+ for (uint i = 0; i < _actors.size(); ++i) {
+ _actors[i]->init(0);
+ }
+}
+void Page::initPallete() {
for (uint i = 0; i < _actors.size(); ++i) {
- _actors[i]->init(unk);
+ if (_actors[i]->initPallete(getGame()->getDirector()))
+ break;
}
}
diff --git a/engines/pink/objects/pages/page.h b/engines/pink/objects/pages/page.h
index 2927f07..0ed16db 100644
--- a/engines/pink/objects/pages/page.h
+++ b/engines/pink/objects/pages/page.h
@@ -40,6 +40,9 @@ public:
virtual void toConsole();
void load(Archive &archive);
+ void init();
+ void initPallete();
+
Actor *findActor(const Common::String &name);
LeadActor *getLeadActor();
@@ -51,15 +54,14 @@ public:
PinkEngine *getGame();
- virtual Sequencer *getSequencer() { return nullptr; };
- virtual WalkMgr *getWalkMgr() { return nullptr;};
- virtual Module *getModule() const { return nullptr; };
+ virtual Sequencer *getSequencer() { return nullptr; }
+ virtual WalkMgr *getWalkMgr() { return nullptr; }
+ virtual Module *getModule() const { return nullptr; }
- virtual bool checkValueOfVariable(const Common::String &variable, const Common::String &value) { return 0; };
- virtual void setVariable(Common::String &variable, Common::String &value) {};
+ virtual bool checkValueOfVariable(const Common::String &variable, const Common::String &value) { return 0; }
+ virtual void setVariable(Common::String &variable, Common::String &value) {}
protected:
- void init();
Array<Actor *> _actors;
ResourceMgr _resMgr;
diff --git a/engines/pink/objects/pages/pda_page.cpp b/engines/pink/objects/pages/pda_page.cpp
index 1b13c2a..f8d7e17 100644
--- a/engines/pink/objects/pages/pda_page.cpp
+++ b/engines/pink/objects/pages/pda_page.cpp
@@ -41,17 +41,6 @@ Array<Actor *> PDAPage::takeActors() {
return actorsCopy;
}
-void PDAPage::init() {
- for (uint i = 0; i < _actors.size(); ++i) {
- if (_actors[i]->initPallete(_pdaMgr.getGame()->getDirector()))
- break;
- }
-
- for (uint i = 0; i < _actors.size(); ++i) {
- _actors[i]->init(0);
- }
-}
-
PDAPage::PDAPage(const Common::String &name, PDAMgr &pdaMgr)
: _pdaMgr(pdaMgr) {
_name = name;
diff --git a/engines/pink/objects/pages/pda_page.h b/engines/pink/objects/pages/pda_page.h
index f6cf2a5..51b7a5e 100644
--- a/engines/pink/objects/pages/pda_page.h
+++ b/engines/pink/objects/pages/pda_page.h
@@ -32,9 +32,8 @@ class PDAMgr;
class PDAPage : public Page {
public:
static PDAPage create(const Common::String &pageName, PDAMgr &pdaMgr);
-
Array<Actor *> takeActors();
- void init();
+
private:
PDAPage(const Common::String &name, PDAMgr &pdaMgr);
PDAMgr &_pdaMgr;
Commit: f7693d397185f7eb1257a4191c6fb7faf01663e1
https://github.com/scummvm/scummvm/commit/f7693d397185f7eb1257a4191c6fb7faf01663e1
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: add proper implementation of Actor init function
Changed paths:
engines/pink/objects/actors/actor.cpp
engines/pink/objects/actors/actor.h
engines/pink/objects/handlers/handler_timer.cpp
engines/pink/objects/walk/walk_mgr.cpp
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index 3fb2c4a..fe44728 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -58,7 +58,7 @@ void Actor::saveState(Archive &archive) {
archive.writeString(actionName);
}
-void Actor::init(bool unk) {
+void Actor::init(bool paused) {
if (!_action)
_action = findAction(kIdleAction);
@@ -66,7 +66,8 @@ void Actor::init(bool unk) {
_isActionEnded = 1;
} else {
_isActionEnded = 0;
- _action->start(unk);
+ _action->start();
+ _action->pause(paused);
}
}
@@ -168,7 +169,7 @@ void Actor::setAction(Action *newAction) {
_action = newAction;
if (newAction) {
_isActionEnded = 0;
- _action->start(0);
+ _action->start();
}
}
diff --git a/engines/pink/objects/actors/actor.h b/engines/pink/objects/actors/actor.h
index 037b42e..6a4d19c 100644
--- a/engines/pink/objects/actors/actor.h
+++ b/engines/pink/objects/actors/actor.h
@@ -47,7 +47,7 @@ public:
void loadState(Archive &archive);
void saveState(Archive &archive);
- virtual void init(bool unk);
+ virtual void init(bool paused);
bool initPallete(Director *director);
void toConsole() override ;
diff --git a/engines/pink/objects/handlers/handler_timer.cpp b/engines/pink/objects/handlers/handler_timer.cpp
index 8f6e3a2..57d2179 100644
--- a/engines/pink/objects/handlers/handler_timer.cpp
+++ b/engines/pink/objects/handlers/handler_timer.cpp
@@ -65,7 +65,7 @@ void HandlerTimerActions::handle(Actor *actor) {
uint index = rnd.getRandomNumber(_actions.size() - 1);
Action *action = actor->findAction(_actions[index]);
assert(action);
- actor->setAction(action, 0);
+ actor->setAction(action);
}
}
diff --git a/engines/pink/objects/walk/walk_mgr.cpp b/engines/pink/objects/walk/walk_mgr.cpp
index 0df4a54..e1c787d 100644
--- a/engines/pink/objects/walk/walk_mgr.cpp
+++ b/engines/pink/objects/walk/walk_mgr.cpp
@@ -71,7 +71,7 @@ void WalkMgr::start(WalkLocation *destination) {
WalkShortestPath path(this);
WalkLocation *nextLocation = path.next(currentLocation, _destination);
initNextWayPoint(nextLocation);
- _leadActor->setAction(getWalkAction(), 0);
+ _leadActor->setAction(getWalkAction());
}
}
@@ -106,7 +106,7 @@ WalkMgr::Coordinates WalkMgr::getLocationCoordinates(const Common::String &locat
Coordinates coords;
ActionCEL *action = static_cast<ActionCEL*>(_leadActor->findAction(locationName));
- action->start(0);
+ action->start();
CelDecoder *decoder = action->getDecoder();
coords.x = decoder->getX() + decoder->getWidth() / 2;
@@ -132,7 +132,7 @@ void WalkMgr::update() {
WalkLocation *next = path.next(findLocation(_current.name), _destination);
if (next) {
initNextWayPoint(next);
- _leadActor->setAction(getWalkAction(), 0);
+ _leadActor->setAction(getWalkAction());
} else
end();
Commit: 4dd40b0f7b8fdf27b59fc7e330b624cd844348da
https://github.com/scummvm/scummvm/commit/4dd40b0f7b8fdf27b59fc7e330b624cd844348da
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: add saving/loading for PDA
Changed paths:
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/pages/page.cpp
engines/pink/pda_mgr.cpp
engines/pink/pda_mgr.h
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index cf59405..0032d78 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -57,6 +57,7 @@ void LeadActor::loadState(Archive &archive) {
_state = (State) archive.readByte();
_nextState = (State) archive.readByte();
_stateCopy = (State) archive.readByte();
+ _stateBeforePDA = (State) archive.readByte();
_isHaveItem = archive.readByte();
Common::String recepient = archive.readString();
if (!recepient.empty())
@@ -65,14 +66,15 @@ void LeadActor::loadState(Archive &archive) {
_recipient = nullptr;
_sequencer->loadState(archive);
_walkMgr->loadState(archive);
-
- // load audioInfoMgr, PDAMgr
+ _page->getGame()->getPdaMgr().loadState(archive);
+ // load audioInfoMgr
}
void LeadActor::saveState(Archive &archive) {
archive.writeByte(_state);
archive.writeByte(_nextState);
archive.writeByte(_stateCopy);
+ archive.writeByte(_stateBeforePDA);
archive.writeByte(_isHaveItem);
if (_recipient)
archive.writeString(_recipient->getName());
@@ -80,6 +82,7 @@ void LeadActor::saveState(Archive &archive) {
archive.writeString(Common::String());
_sequencer->saveState(archive);
_walkMgr->saveState(archive);
+ _page->getGame()->getPdaMgr().saveState(archive);
}
void LeadActor::init(bool unk) {
@@ -103,7 +106,12 @@ void LeadActor::start(bool isHandler) {
_page->pause(true);
break;
case kPDA:
-
+ if (_stateBeforePDA == kInventory) {
+ _page->getModule()->getInventoryMgr()->start(0);
+ _page->pause(true);
+ }
+ loadPDA(_page->getGame()->getPdaMgr().getSavedPageName());
+ break;
default:
forceUpdateCursor();
}
@@ -158,9 +166,8 @@ void LeadActor::loadPDA(const Common::String &pageName) {
_stateBeforePDA = _state;
_state = kPDA;
-
- _page->getGame()->getDirector()->saveStage();
}
+ _page->getGame()->getDirector()->saveStage();
_page->getGame()->getPdaMgr().setLead(this);
_page->getGame()->getPdaMgr().goToPage(pageName);
}
diff --git a/engines/pink/objects/pages/page.cpp b/engines/pink/objects/pages/page.cpp
index b7a210b..2266cd5 100644
--- a/engines/pink/objects/pages/page.cpp
+++ b/engines/pink/objects/pages/page.cpp
@@ -56,7 +56,6 @@ CelDecoder *Page::loadCel(Common::String &fileName) {
return _resMgr.loadCEL(fileName);
}
-
void Page::toConsole() {
for (uint i = 0; i < _actors.size(); ++i) {
_actors[i]->toConsole();
diff --git a/engines/pink/pda_mgr.cpp b/engines/pink/pda_mgr.cpp
index 9cce204..a2cfb5d 100644
--- a/engines/pink/pda_mgr.cpp
+++ b/engines/pink/pda_mgr.cpp
@@ -32,8 +32,15 @@ namespace Pink {
PDAMgr::PDAMgr(Pink::PinkEngine *game)
: _game(game), _page(nullptr), _cursorMgr(game, nullptr) {}
-void PDAMgr::update() {
- _cursorMgr.update();
+void PDAMgr::loadState(Archive &archive) {
+ _savedPage = archive.readString();
+}
+
+void PDAMgr::saveState(Archive &archive) {
+ if (_page)
+ archive.writeString(_page->getName());
+ else
+ archive.writeString("");
}
void PDAMgr::execute(const Command &command) {
@@ -49,10 +56,6 @@ void PDAMgr::execute(const Command &command) {
}
}
-PinkEngine *PDAMgr::getGame() const {
- return _game;
-}
-
void PDAMgr::goToPage(const Common::String &pageName) {
if (_page && _page->getName() == pageName)
return;
@@ -71,6 +74,37 @@ void PDAMgr::goToPage(const Common::String &pageName) {
_cursorMgr.setPage(_page);
}
+void PDAMgr::update() {
+ _cursorMgr.update();
+}
+
+void PDAMgr::onLeftButtonClick(Common::Point point) {
+ Actor *actor = _game->getDirector()->getActorByPoint(point);
+ if (actor)
+ actor->onClick();
+}
+
+void PDAMgr::onMouseMove(Common::Point point) {
+ Actor *actor = _game->getDirector()->getActorByPoint(point);
+ if (actor && dynamic_cast<PDAButtonActor*>(actor))
+ actor->onMouseOver(point, &_cursorMgr);
+ else _cursorMgr.setCursor(kPDADefaultCursor, point,Common::String());
+}
+
+
+PinkEngine *PDAMgr::getGame() const {
+ return _game;
+}
+
+const Common::String &PDAMgr::getSavedPageName() {
+ return _savedPage;
+}
+
+
+void PDAMgr::setLead(LeadActor *lead) {
+ _lead = lead;
+}
+
void PDAMgr::close() {
for (uint i = 0; i < _globalActors.size(); ++i) {
delete _globalActors[i];
@@ -94,21 +128,4 @@ void PDAMgr::loadGlobal() {
}
}
-void PDAMgr::setLead(LeadActor *lead) {
- _lead = lead;
-}
-
-void PDAMgr::onLeftButtonClick(Common::Point point) {
- Actor *actor = _game->getDirector()->getActorByPoint(point);
- if (actor)
- actor->onClick();
-}
-
-void PDAMgr::onMouseMove(Common::Point point) {
- Actor *actor = _game->getDirector()->getActorByPoint(point);
- if (actor && dynamic_cast<PDAButtonActor*>(actor))
- actor->onMouseOver(point, &_cursorMgr);
- else _cursorMgr.setCursor(kPDADefaultCursor, point,Common::String());
-}
-
} // End of namespace Pink
diff --git a/engines/pink/pda_mgr.h b/engines/pink/pda_mgr.h
index 75f28a7..fd35674 100644
--- a/engines/pink/pda_mgr.h
+++ b/engines/pink/pda_mgr.h
@@ -36,14 +36,20 @@ class PDAPage;
class PDAMgr {
public:
PDAMgr(PinkEngine *game);
- void update();
+
+ void loadState(Archive &archive);
+ void saveState(Archive &archive);
+
void execute(const Command &command);
void goToPage(const Common::String &pageName);
+ void update();
+
void onLeftButtonClick(Common::Point point);
void onMouseMove(Common::Point point);
PinkEngine *getGame() const;
+ const Common::String &getSavedPageName();
void setLead(LeadActor *lead);
@@ -56,6 +62,7 @@ private:
PDAPage *_page;
CursorMgr _cursorMgr;
Array<Actor *> _globalActors;
+ Common::String _savedPage;
};
} // End of namespace Pink
Commit: bfd1b62063040c970894fbf81d9dca9c3d4088d0
https://github.com/scummvm/scummvm/commit/bfd1b62063040c970894fbf81d9dca9c3d4088d0
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: change drawing method
Changed paths:
engines/pink/director.cpp
engines/pink/director.h
engines/pink/objects/actions/action_cel.cpp
engines/pink/pink.cpp
diff --git a/engines/pink/director.cpp b/engines/pink/director.cpp
index 0f208c6..dd8e870 100644
--- a/engines/pink/director.cpp
+++ b/engines/pink/director.cpp
@@ -29,53 +29,34 @@
#include "pink/objects/actions/action_cel.h"
namespace Pink {
-Director::Director(OSystem *system)
- : _system(system), showBounds(1) {}
+Director::Director()
+ : _surface(640, 480) {
+ _wndManager.setScreen(&_surface);
+}
-void Director::draw() {
- _system->fillScreen(0);
+void Director::update() {
+ static uint32 time = g_system->getMillis();
+ static uint32 times = 0;
+
+ for (uint i = 0; i < _sounds.size(); ++i) {
+ _sounds[i]->update();
+ }
for (uint i = 0; i < _sprites.size(); ++i) {
- drawSprite(_sprites[i]);
+ _sprites[i]->update();
}
- _system->updateScreen();
-}
-void Director::drawSprite(ActionCEL *sprite) {
- CelDecoder *decoder = sprite->getDecoder();
- const Graphics::Surface *surface;
- if (decoder->needsUpdate())
- surface = decoder->decodeNextFrame();
- else
- surface = decoder->getCurrentFrame();
-
- int h = surface->h;
- if (surface->h + decoder->getY() > 480)
- h = 480 - decoder->getY();
- int w = surface->w;
- if (surface->w + decoder->getX() > 640)
- w = 640 - decoder->getX();
-
- if (!showBounds) {
- Graphics::Surface *screen = _system->lockScreen();
-
- for (int y = 0; y < h; ++y) {
- for (int x = 0; x < w; ++x) {
- uint16 spritePixelColourIndex = *(byte*)surface->getBasePtr(x, y);
- if (spritePixelColourIndex != decoder->getTransparentColourIndex()) {
- *(byte *) screen->getBasePtr(decoder->getX() + x, decoder->getY() + y) = spritePixelColourIndex;
- }
- }
- }
- _system->unlockScreen();
- }
- else
- _system->copyRectToScreen(surface->getPixels(), surface->pitch,
- decoder->getX(), decoder->getY(),
- w, h);
+ draw();
+ times++;
+ if (g_system->getMillis() - time >= 1000) {
+ debug("FPS: %u ", times);
+ sum += times;
+ count++;
+ time = g_system->getMillis();
+ times = 0;
+ }
}
-
void Director::addSprite(ActionCEL *sprite) {
_sprites.push_back(sprite);
int i;
@@ -86,6 +67,7 @@ void Director::addSprite(ActionCEL *sprite) {
break;
}
_sprites[i] = sprite;
+ _dirtyRects.push_back(sprite->getDecoder()->getRectangle());
}
void Director::removeSprite(ActionCEL *sprite) {
@@ -95,65 +77,120 @@ void Director::removeSprite(ActionCEL *sprite) {
break;
}
}
+ _dirtyRects.push_back(sprite->getDecoder()->getRectangle());
}
-void Director::setPallette(const byte *pallete) {
- _system->getPaletteManager()->setPalette(pallete, 0, 256);
-}
-
-void Director::update() {
+void Director::removeSound(ActionSound *sound) {
for (uint i = 0; i < _sounds.size(); ++i) {
- _sounds[i]->update();
- }
- for (uint i = 0; i < _sprites.size(); ++i) {
- _sprites[i]->update();
+ if (_sounds[i] == sound)
+ _sounds.remove_at(i);
}
}
-void Director::addSound(ActionSound *sound) {
- _sounds.push_back(sound);
+void Director::clear() {
+ _dirtyRects.push_back(Common::Rect(0, 0, 640, 480));
+ _sprites.resize(0);
}
-void Director::removeSound(ActionSound *sound) {
- for (uint i = 0; i < _sounds.size(); ++i) {
- if (_sounds[i] == sound)
- _sounds.remove_at(i);
+void Director::pause(bool pause) {
+ for (uint i = 0; i < _sprites.size() ; ++i) {
+ _sprites[i]->pause(pause);
}
}
-void Director::clear() {
+void Director::saveStage() {
+ _savedSprites = _sprites;
_sprites.clear();
}
-Actor *Director::getActorByPoint(Common::Point point) {
+void Director::loadStage() {
+ assert(_sprites.empty());
+ _sprites = _savedSprites;
+ _savedSprites.clear();
+}
+
+Actor *Director::getActorByPoint(const Common::Point point) {
for (int i = _sprites.size() - 1; i >= 0; --i) {
CelDecoder *decoder = _sprites[i]->getDecoder();
const Graphics::Surface *frame = decoder->getCurrentFrame();
- Common::Rect &rect = decoder->getRectangle();
- if (rect.contains(point) &&
- *(byte*)frame->getBasePtr(point.x - rect.left, point.y - rect.top)
- != decoder->getTransparentColourIndex())
+ const Common::Rect &rect = decoder->getRectangle();
+ byte spritePixel = *(const byte*) frame->getBasePtr(point.x - rect.left, point.y - rect.top);
+ if (rect.contains(point) && spritePixel != decoder->getTransparentColourIndex()) {
return _sprites[i]->getActor();
+ }
}
return nullptr;
}
-void Director::pause(bool pause) {
- for (uint i = 0; i < _sprites.size() ; ++i) {
- _sprites[i]->getDecoder()->pauseVideo(pause);
+void Director::draw() {
+ for (uint i = 0; i < _sprites.size(); ++i) {
+ if (_sprites[i]->getDecoder()->needsUpdate()) {
+ _sprites[i]->getDecoder()->decodeNextFrame();
+ addDirtyRects(_sprites[i]);
+ }
+ }
+
+ if (!_dirtyRects.empty()) {
+ mergeDirtyRects();
+
+ for (uint i = 0; i < _dirtyRects.size(); ++i) {
+ drawRect(_dirtyRects[i]);
+ }
+
+ _dirtyRects.resize(0);
+ _surface.update();
+ }
+ else
+ g_system->updateScreen();
+}
+
+void Director::mergeDirtyRects() {
+ Common::Array<Common::Rect>::iterator rOuter, rInner;
+ for (rOuter = _dirtyRects.begin(); rOuter != _dirtyRects.end(); ++rOuter) {
+ rInner = rOuter;
+ while (++rInner != _dirtyRects.end()) {
+ if ((*rOuter).intersects(*rInner)) {
+ // These two rectangles overlap, so merge them
+ rOuter->extend(*rInner);
+
+ // remove the inner rect from the list
+ _dirtyRects.erase(rInner);
+
+ // move back to beginning of list
+ rInner = rOuter;
+ }
+ }
}
}
-void Director::saveStage() {
- _savedSprites = _sprites;
- _sprites.clear();
+void Director::addDirtyRects(ActionCEL *sprite) {
+ const Common::Rect spriteRect = sprite->getDecoder()->getRectangle();
+ const Common::List<Common::Rect> *dirtyRects = sprite->getDecoder()->getDirtyRects();
+ if (dirtyRects->size() > 100) {
+ _dirtyRects.push_back(spriteRect);
+ } else {
+ for (Common::List<Common::Rect>::const_iterator it = dirtyRects->begin(); it != dirtyRects->end(); ++it) {
+ Common::Rect dirtyRect = *it;
+ dirtyRect.translate(spriteRect.left, spriteRect.top);
+ _dirtyRects.push_back(dirtyRect);
+ }
+ }
+ sprite->getDecoder()->clearDirtyRects();
}
-void Director::loadStage() {
- assert(_sprites.empty());
- _sprites = _savedSprites;
- _savedSprites.clear();
+void Director::drawRect(const Common::Rect &rect) {
+ _surface.fillRect(rect, 0);
+ for (uint i = 0; i < _sprites.size(); ++i) {
+ const Common::Rect &spriteRect = _sprites[i]->getDecoder()->getRectangle();
+ Common::Rect interRect = rect.findIntersectingRect(spriteRect);
+ if (interRect.isEmpty())
+ continue;
+
+ Common::Rect srcRect(interRect);
+ srcRect.translate(-spriteRect.left, -spriteRect.top);
+ _surface.transBlitFrom(*_sprites[i]->getDecoder()->getCurrentFrame(), srcRect, interRect, _sprites[i]->getDecoder()->getTransparentColourIndex());
+ }
}
}
diff --git a/engines/pink/director.h b/engines/pink/director.h
index 4574305..4902c543 100644
--- a/engines/pink/director.h
+++ b/engines/pink/director.h
@@ -27,26 +27,27 @@
#include "common/rect.h"
#include "common/system.h"
+#include "graphics/macgui/macwindowmanager.h"
+#include "graphics/screen.h"
+
namespace Pink {
class Actor;
class ActionCEL;
class ActionSound;
-class CelDecoder;
class Director {
public:
- Director(OSystem *system);
- Actor *getActorByPoint(Common::Point point);
+ Director();
- void draw();
void update();
+ void setPallette(const byte *pallete) { g_system->getPaletteManager()->setPalette(pallete, 0, 256); }
+
void addSprite(ActionCEL *sprite);
void removeSprite(ActionCEL *sprite);
- void setPallette(const byte *pallete);
- void addSound(ActionSound* sound);
+ void addSound(ActionSound* sound) { _sounds.push_back(sound); };
void removeSound(ActionSound* sound);
void clear();
@@ -56,11 +57,22 @@ public:
void saveStage();
void loadStage();
- bool showBounds;
+ Actor *getActorByPoint(const Common::Point point);
+
+ Graphics::MacWindowManager &getWndManager() { return _wndManager; };
+
+ uint32 count = 0;
+ uint32 sum = 0;
private:
- void drawSprite(ActionCEL *sprite);
- OSystem *_system;
+ void draw();
+ void addDirtyRects(ActionCEL *sprite);
+ void mergeDirtyRects();
+ void drawRect(const Common::Rect &rect);
+
+ Graphics::Screen _surface;
+ Graphics::MacWindowManager _wndManager;
+ Common::Array<Common::Rect> _dirtyRects;
Common::Array<ActionCEL *> _sprites;
Common::Array<ActionCEL *> _savedSprites;
Common::Array<ActionSound *> _sounds;
diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp
index e6f262f..a5f0e1f 100644
--- a/engines/pink/objects/actions/action_cel.cpp
+++ b/engines/pink/objects/actions/action_cel.cpp
@@ -59,9 +59,8 @@ bool ActionCEL::initPalette(Director *director) {
void ActionCEL::start() {
if (!_decoder)
_decoder = _actor->getPage()->loadCel(_fileName);
- _actor->getPage()->getGame()->getDirector()->addSprite(this);
-
this->onStart();
+ _actor->getPage()->getGame()->getDirector()->addSprite(this);
}
void ActionCEL::end() {
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index 53407e6..eaeadbc 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -41,7 +41,7 @@ namespace Pink {
Pink::PinkEngine::PinkEngine(OSystem *system, const ADGameDescription *desc)
: Engine(system), _console(nullptr), _rnd("pink"),
_desc(*desc), _bro(nullptr), _module(nullptr),
- _director(_system), _pdaMgr(this) {
+ _director(), _pdaMgr(this) {
debug("PinkEngine constructed");
DebugMan.addDebugChannel(kPinkDebugGeneral, "general", "General issues");
@@ -117,9 +117,6 @@ Common::Error Pink::PinkEngine::run() {
_actor->onLeftButtonClick(event.mouse);
break;
case Common::EVENT_KEYDOWN:
- if (event.kbd.keycode == Common::KEYCODE_d)
- _director.showBounds = !_director.showBounds;
- else
_actor->onKeyboardButtonClick(event.kbd.keycode);
break;
// don't know why it is used in original
@@ -132,8 +129,7 @@ Common::Error Pink::PinkEngine::run() {
_actor->update();
_director.update();
- _director.draw();
- _system->delayMillis(5);
+ _system->delayMillis(10);
}
return Common::kNoError;
Commit: fb8d8c1f570b9e6da55cf21eb6d176335a65f25c
https://github.com/scummvm/scummvm/commit/fb8d8c1f570b9e6da55cf21eb6d176335a65f25c
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: remove redundant adding sprite to scene, which doesn't need to be drawn
Changed paths:
engines/pink/objects/actions/action.cpp
engines/pink/objects/actions/action.h
engines/pink/objects/actions/action_cel.cpp
engines/pink/objects/actions/action_cel.h
engines/pink/objects/walk/walk_mgr.cpp
engines/pink/objects/walk/walk_mgr.h
diff --git a/engines/pink/objects/actions/action.cpp b/engines/pink/objects/actions/action.cpp
index 34106f7..107cff5 100644
--- a/engines/pink/objects/actions/action.cpp
+++ b/engines/pink/objects/actions/action.cpp
@@ -37,6 +37,10 @@ bool Action::initPalette(Director *director) {
void Action::pause(bool paused) {}
+Coordinates Action::getCoordinates() {
+ return Coordinates();
+}
+
Actor *Action::getActor() const {
return _actor;
}
diff --git a/engines/pink/objects/actions/action.h b/engines/pink/objects/actions/action.h
index 4028702..a6e36db 100644
--- a/engines/pink/objects/actions/action.h
+++ b/engines/pink/objects/actions/action.h
@@ -24,6 +24,7 @@
#define PINK_ACTION_H
#include "pink/objects/object.h"
+#include "pink/objects/walk/walk_mgr.h"
namespace Pink {
@@ -41,6 +42,7 @@ public:
virtual void pause(bool paused);
+ virtual Coordinates getCoordinates();
Actor *getActor() const;
protected:
diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp
index a5f0e1f..4596d5d 100644
--- a/engines/pink/objects/actions/action_cel.cpp
+++ b/engines/pink/objects/actions/action_cel.cpp
@@ -88,4 +88,16 @@ CelDecoder *ActionCEL::getDecoder() {
return _decoder;
}
+Coordinates ActionCEL::getCoordinates() {
+ if (!_decoder)
+ _decoder = _actor->getPage()->loadCel(_fileName);
+
+ Coordinates coords;
+ coords.x = _decoder->getX() + _decoder->getWidth() / 2;
+ coords.y = _decoder->getY() + _decoder->getHeight() / 2;
+ coords.z = getZ();
+
+ return coords;
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_cel.h b/engines/pink/objects/actions/action_cel.h
index 2623c55..355323d 100644
--- a/engines/pink/objects/actions/action_cel.h
+++ b/engines/pink/objects/actions/action_cel.h
@@ -45,6 +45,8 @@ public:
void pause(bool paused) override;
+ Coordinates getCoordinates() override;
+
uint32 getZ();
CelDecoder *getDecoder();
diff --git a/engines/pink/objects/walk/walk_mgr.cpp b/engines/pink/objects/walk/walk_mgr.cpp
index e1c787d..c7c06ec 100644
--- a/engines/pink/objects/walk/walk_mgr.cpp
+++ b/engines/pink/objects/walk/walk_mgr.cpp
@@ -102,20 +102,9 @@ double WalkMgr::getLengthBetweenLocations(WalkLocation *first, WalkLocation *sec
(secondCoord.y - firstCoord.y) * (secondCoord.y - firstCoord.y));
}
-WalkMgr::Coordinates WalkMgr::getLocationCoordinates(const Common::String &locationName) {
- Coordinates coords;
- ActionCEL *action = static_cast<ActionCEL*>(_leadActor->findAction(locationName));
-
- action->start();
- CelDecoder *decoder = action->getDecoder();
-
- coords.x = decoder->getX() + decoder->getWidth() / 2;
- coords.y = decoder->getY() + decoder->getHeight() / 2;
- coords.z = action->getZ();
-
- action->end();
-
- return coords;
+Coordinates WalkMgr::getLocationCoordinates(const Common::String &locationName) {
+ Action *action = _leadActor->findAction(locationName);
+ return action->getCoordinates();
}
void WalkMgr::setCurrentWayPoint(WalkLocation *location) {
diff --git a/engines/pink/objects/walk/walk_mgr.h b/engines/pink/objects/walk/walk_mgr.h
index 2decdd8..cb6b68c 100644
--- a/engines/pink/objects/walk/walk_mgr.h
+++ b/engines/pink/objects/walk/walk_mgr.h
@@ -25,6 +25,7 @@
#include "pink/objects/object.h"
#include "pink/objects/walk/walk_shortest_path.h"
+#include "pink/utils.h"
namespace Pink {
@@ -32,6 +33,12 @@ class WalkLocation;
class LeadActor;
class WalkAction;
+struct Coordinates {
+ int x;
+ int y;
+ int z;
+};
+
class WalkMgr : public Object {
public:
WalkMgr();
@@ -49,11 +56,6 @@ public:
void saveState(Archive &archive);
private:
- struct Coordinates {
- int x;
- int y;
- int z;
- };
struct WayPoint {
Common::String name;
Coordinates coord;
Commit: a76d86a3429c0203efe7932207bb48322eb92548
https://github.com/scummvm/scummvm/commit/a76d86a3429c0203efe7932207bb48322eb92548
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: add check to startFrame because it can be greater than sprite's frames number
Changed paths:
engines/pink/objects/actions/action_play.cpp
engines/pink/objects/actions/action_still.cpp
diff --git a/engines/pink/objects/actions/action_play.cpp b/engines/pink/objects/actions/action_play.cpp
index 9e9c856..9af1900 100644
--- a/engines/pink/objects/actions/action_play.cpp
+++ b/engines/pink/objects/actions/action_play.cpp
@@ -58,6 +58,7 @@ void ActionPlay::pause(bool paused) {
void ActionPlay::onStart() {
debug("Actor %s has now ActionPlay %s", _actor->getName().c_str(), _name.c_str());
_decoder->start();
+ assert(_startFrame <= _decoder->getFrameCount());
for (uint i = 0; i < _startFrame; ++i) {
_decoder->skipFrame();
}
diff --git a/engines/pink/objects/actions/action_still.cpp b/engines/pink/objects/actions/action_still.cpp
index 693d130..78f0949 100644
--- a/engines/pink/objects/actions/action_still.cpp
+++ b/engines/pink/objects/actions/action_still.cpp
@@ -48,6 +48,8 @@ void ActionStill::pause(bool paused) {}
void ActionStill::onStart() {
debug("Actor %s has now ActionStill %s", _actor->getName().c_str(), _name.c_str());
+ if (_startFrame >= _decoder->getFrameCount())
+ _startFrame = 0;
for (uint i = 0; i < _startFrame; ++i) {
_decoder->skipFrame();
}
Commit: 4fd0ec3ff71614ecbf66ec7f8b414d99c74b1e32
https://github.com/scummvm/scummvm/commit/4fd0ec3ff71614ecbf66ec7f8b414d99c74b1e32
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix ending of ActionCEL
Changed paths:
engines/pink/objects/actions/action_cel.cpp
diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp
index 4596d5d..4b03f68 100644
--- a/engines/pink/objects/actions/action_cel.cpp
+++ b/engines/pink/objects/actions/action_cel.cpp
@@ -64,6 +64,8 @@ void ActionCEL::start() {
}
void ActionCEL::end() {
+ if (!_decoder)
+ return;
_actor->getPage()->getGame()->getDirector()->removeSprite(this);
delete _decoder;
_decoder = nullptr;
Commit: cf04fb20c76f4c0ce52939e074cb79c40367f93a
https://github.com/scummvm/scummvm/commit/cf04fb20c76f4c0ce52939e074cb79c40367f93a
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: rework sound system
Changed paths:
engines/pink/objects/actions/action_play_with_sfx.cpp
engines/pink/objects/actions/action_play_with_sfx.h
engines/pink/objects/actions/action_sound.cpp
engines/pink/objects/actions/action_sound.h
engines/pink/objects/actions/action_talk.cpp
engines/pink/objects/actions/action_talk.h
engines/pink/objects/pages/page.cpp
engines/pink/objects/pages/page.h
engines/pink/objects/sequences/sequence.cpp
engines/pink/objects/sequences/sequence.h
engines/pink/resource_mgr.cpp
engines/pink/resource_mgr.h
engines/pink/sound.cpp
engines/pink/sound.h
diff --git a/engines/pink/objects/actions/action_play_with_sfx.cpp b/engines/pink/objects/actions/action_play_with_sfx.cpp
index 056ce6e..3805b8f 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.cpp
+++ b/engines/pink/objects/actions/action_play_with_sfx.cpp
@@ -78,13 +78,6 @@ void ActionPlayWithSfx::updateSound() {
}
}
-ActionSfx::ActionSfx()
- : _sound(nullptr) {}
-
-ActionSfx::~ActionSfx() {
- end();
-}
-
void ActionSfx::deserialize(Pink::Archive &archive) {
_frame = archive.readDWORD();
_volume = archive.readDWORD();
@@ -97,20 +90,8 @@ void ActionSfx::toConsole() {
}
void ActionSfx::play(Page *page) {
- if (!_sound)
- _sound = page->loadSound(_sfxName);
-
- if (!_sound->isPlaying())
- _sound->play(Audio::Mixer::kSFXSoundType, _volume, 0);
-}
-
-void ActionSfx::end() {
- delete _sound;
- _sound = nullptr;
-}
-
-uint32 ActionSfx::getFrame() {
- return _frame;
+ if (!_sound.isPlaying())
+ _sound.play(page->getResourceStream(_sfxName), Audio::Mixer::kSFXSoundType, _volume);
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_play_with_sfx.h b/engines/pink/objects/actions/action_play_with_sfx.h
index 7e8b0c8..16a3cad 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.h
+++ b/engines/pink/objects/actions/action_play_with_sfx.h
@@ -24,6 +24,7 @@
#define PINK_ACTION_PLAY_WITH_SFX_H
#include "pink/objects/actions/action_play.h"
+#include "pink/sound.h"
namespace Pink {
@@ -49,26 +50,21 @@ private:
uint32 _isLoop;
};
-class Sound;
class Page;
class ActionSfx : public Object {
public:
- ActionSfx();
- ~ActionSfx() override;
-
void deserialize(Archive &archive) override;
void toConsole() override;
void play(Page *page);
- void end();
- uint32 getFrame();
+ uint32 getFrame() { return _frame; }
private:
- Sound *_sound;
Common::String _sfxName;
+ Sound _sound;
uint32 _volume;
uint32 _frame;
};
diff --git a/engines/pink/objects/actions/action_sound.cpp b/engines/pink/objects/actions/action_sound.cpp
index d63d57c..e67717f 100644
--- a/engines/pink/objects/actions/action_sound.cpp
+++ b/engines/pink/objects/actions/action_sound.cpp
@@ -31,10 +31,7 @@
namespace Pink {
-ActionSound::ActionSound()
- : _sound(nullptr) {}
-
-ActionSound::~ActionSound(){
+ActionSound::~ActionSound() {
end();
}
@@ -52,16 +49,12 @@ void ActionSound::toConsole() {
}
void ActionSound::start() {
- assert(!_sound);
- _sound = _actor->getPage()->loadSound(_fileName);
-
- Audio::Mixer::SoundType soundType = _isBackground ? Audio::Mixer::kMusicSoundType
- : Audio::Mixer::kSpeechSoundType;
+ Audio::Mixer::SoundType soundType = _isBackground ? Audio::Mixer::kMusicSoundType : Audio::Mixer::kSFXSoundType;
Director *director = _actor->getPage()->getGame()->getDirector();
director->addSound(this);
- _sound->play(soundType, _volume, _isLoop);
+ _sound.play(_actor->getPage()->getResourceStream(_fileName), soundType, _volume, _isLoop);
if (_isLoop)
_actor->endAction();
@@ -69,25 +62,21 @@ void ActionSound::start() {
}
void ActionSound::end() {
- if (_sound) {
- debug("ActionSound %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
+ _sound.stop();
+ debug("ActionSound %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
- Director *director = _actor->getPage()->getGame()->getDirector();
- director->removeSound(this);
+ Director *director = _actor->getPage()->getGame()->getDirector();
+ director->removeSound(this);
- delete _sound;
- _sound = nullptr;
- }
}
void ActionSound::update() {
- if (!_sound->isPlaying())
+ if (!_sound.isPlaying())
_actor->endAction();
}
void ActionSound::pause(bool paused) {
- if (_sound)
- _sound->pause(paused);
+ _sound.pause(paused);
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_sound.h b/engines/pink/objects/actions/action_sound.h
index c614951..e502f34 100644
--- a/engines/pink/objects/actions/action_sound.h
+++ b/engines/pink/objects/actions/action_sound.h
@@ -24,16 +24,13 @@
#define PINK_ACTION_SOUND_H
#include "pink/objects/actions/action.h"
+#include "pink/sound.h"
namespace Pink {
-class Sound;
-
class ActionSound : public Action {
public:
- ActionSound();
- ~ActionSound();
-
+ ~ActionSound() override;
void deserialize(Archive &archive) override;
void toConsole() override;
@@ -46,8 +43,8 @@ public:
void pause(bool paused) override;
private:
- Sound *_sound;
Common::String _fileName;
+ Sound _sound;
uint32 _volume;
bool _isLoop;
bool _isBackground;
diff --git a/engines/pink/objects/actions/action_talk.cpp b/engines/pink/objects/actions/action_talk.cpp
index c142dca..f46afb3 100644
--- a/engines/pink/objects/actions/action_talk.cpp
+++ b/engines/pink/objects/actions/action_talk.cpp
@@ -42,7 +42,7 @@ void ActionTalk::toConsole() {
void ActionTalk::update() {
ActionLoop::update();
- if (!_sound->isPlaying()) {
+ if (!_sound.isPlaying()) {
_decoder->stop();
_actor->endAction();
}
@@ -50,20 +50,17 @@ void ActionTalk::update() {
void ActionTalk::end() {
ActionPlay::end();
- delete _sound;
- _sound = nullptr;
+ _sound.stop();
}
void ActionTalk::pause(bool paused) {
ActionCEL::pause(paused);
- if (_sound)
- _sound->pause(paused);
+ _sound.pause(paused);
}
void ActionTalk::onStart() {
ActionPlay::onStart();
- _sound = _actor->getPage()->loadSound(_vox);
- _sound->play(Audio::Mixer::kSpeechSoundType, 100, 0);
+ _sound.play(_actor->getPage()->getResourceStream(_vox), Audio::Mixer::kSpeechSoundType);
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_talk.h b/engines/pink/objects/actions/action_talk.h
index 672e024..f29dc0f 100644
--- a/engines/pink/objects/actions/action_talk.h
+++ b/engines/pink/objects/actions/action_talk.h
@@ -45,7 +45,7 @@ protected:
void onStart() override;
private:
- Sound *_sound;
+ Sound _sound;
Common::String _vox;
};
diff --git a/engines/pink/objects/pages/page.cpp b/engines/pink/objects/pages/page.cpp
index 2266cd5..bb93d17 100644
--- a/engines/pink/objects/pages/page.cpp
+++ b/engines/pink/objects/pages/page.cpp
@@ -47,10 +47,6 @@ Actor *Page::findActor(const Common::String &name) {
return nullptr;
}
-Sound *Page::loadSound(Common::String &fileName) {
- return _resMgr.loadSound(fileName);
-}
-
CelDecoder *Page::loadCel(Common::String &fileName) {
return _resMgr.loadCEL(fileName);
diff --git a/engines/pink/objects/pages/page.h b/engines/pink/objects/pages/page.h
index 0ed16db..9ccfe20 100644
--- a/engines/pink/objects/pages/page.h
+++ b/engines/pink/objects/pages/page.h
@@ -46,7 +46,7 @@ public:
Actor *findActor(const Common::String &name);
LeadActor *getLeadActor();
- Sound *loadSound(Common::String &fileName);
+ Common::SafeSeekableSubReadStream *getResourceStream(const Common::String &fileName) { return _resMgr.getResourceStream(fileName); }
CelDecoder *loadCel(Common::String &fileName);
virtual void clear();
diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp
index 8e2f38c..e7d5783 100644
--- a/engines/pink/objects/sequences/sequence.cpp
+++ b/engines/pink/objects/sequences/sequence.cpp
@@ -160,27 +160,25 @@ void SequenceAudio::start(int unk) {
}
void SequenceAudio::end() {
- delete _sound;
- _sound = nullptr;
+ _sound.stop();
Sequence::end();
}
void SequenceAudio::update() {
- if (!_sound->isPlaying())
+ if (!_sound.isPlaying())
end();
- else if (_sample <= _sound->getCurrentSample())
+ else if (_sample <= _sound.getCurrentSample())
start(0);
}
void SequenceAudio::init(int unk) {
_sample = 0;
- _sound = _sequencer->_page->loadSound(_soundName);
- _sound->play(Audio::Mixer::kMusicSoundType, 100, 0);
+ _sound.play(_sequencer->_page->getResourceStream(_soundName), Audio::Mixer::kMusicSoundType);
Sequence::init(unk);
}
void SequenceAudio::restart() {
- _sound->play(Audio::Mixer::kMusicSoundType, 100, 0);
+ _sound.play(_sequencer->_page->getResourceStream(_soundName), Audio::Mixer::kMusicSoundType);
Sequence::restart();
}
diff --git a/engines/pink/objects/sequences/sequence.h b/engines/pink/objects/sequences/sequence.h
index 3486325..93dcb25 100644
--- a/engines/pink/objects/sequences/sequence.h
+++ b/engines/pink/objects/sequences/sequence.h
@@ -23,6 +23,7 @@
#ifndef PINK_SEQUENCE_H
#define PINK_SEQUENCE_H
+#include "pink/sound.h"
#include "pink/objects/object.h"
namespace Pink {
@@ -79,7 +80,7 @@ public:
private:
Common::String _soundName;
- Sound *_sound;
+ Sound _sound;
uint _sample;
};
diff --git a/engines/pink/resource_mgr.cpp b/engines/pink/resource_mgr.cpp
index 98792d2..ebaf219 100644
--- a/engines/pink/resource_mgr.cpp
+++ b/engines/pink/resource_mgr.cpp
@@ -59,10 +59,6 @@ CelDecoder *ResourceMgr::loadCEL(Common::String &name) {
return decoder;
}
-Sound *ResourceMgr::loadSound(Common::String &name) {
- return new Sound(_game->_mixer, getResourceStream(name));
-}
-
Common::String ResourceMgr::loadText(Common::String &name) {
Common::SeekableReadStream *stream = getResourceStream(name);
char *txt = new char[stream->size()];
@@ -79,7 +75,7 @@ PinkEngine *ResourceMgr::getGame() const {
return _game;
}
-Common::SafeSeekableSubReadStream *ResourceMgr::getResourceStream(Common::String &name) {
+Common::SafeSeekableSubReadStream *ResourceMgr::getResourceStream(const Common::String &name) {
Common::SeekableReadStream *stream;
ResourceDescription *desc = (ResourceDescription*) bsearch(name.c_str(), _resDescTable, _resCount, sizeof(ResourceDescription), resDescComp);
diff --git a/engines/pink/resource_mgr.h b/engines/pink/resource_mgr.h
index 4b050eb..0cdf2ae 100644
--- a/engines/pink/resource_mgr.h
+++ b/engines/pink/resource_mgr.h
@@ -50,15 +50,14 @@ public:
void clear();
+ Common::SafeSeekableSubReadStream *getResourceStream(const Common::String &name);
+
CelDecoder *loadCEL(Common::String &name);
- Sound *loadSound(Common::String &name);
Common::String loadText(Common::String &name);
PinkEngine *getGame() const;
private:
- Common::SafeSeekableSubReadStream *getResourceStream(Common::String &name);
-
PinkEngine *_game;
ResourceDescription *_resDescTable;
uint32 _resCount;
diff --git a/engines/pink/sound.cpp b/engines/pink/sound.cpp
index 333093e..81463b2 100644
--- a/engines/pink/sound.cpp
+++ b/engines/pink/sound.cpp
@@ -30,44 +30,22 @@
namespace Pink {
-Sound::Sound(Audio::Mixer *mixer, Common::SafeSeekableSubReadStream *stream)
- : _mixer(mixer), _fileStream(stream) {}
-
-Sound::~Sound() {
- _mixer->stopHandle(_handle);
- delete _fileStream;
-}
-
-bool Sound::isPlaying() {
- return _mixer->isSoundHandleActive(_handle);
-}
-
-void Sound::pause(bool paused) {
- _mixer->pauseHandle(_handle, paused);
-}
-
-void Sound::play(Audio::Mixer::SoundType type, int volume, bool isLoop) {
+void Sound::play(Common::SafeSeekableSubReadStream *stream, Audio::Mixer::SoundType type, byte volume, int8 balance, bool isLoop) {
// Vox files in pink have wave format.
// RIFF (little-endian) data, WAVE audio, Microsoft PCM, 8 bit, mono 22050 Hz
- _mixer->stopHandle(_handle);
- _fileStream->seek(0);
- Audio::AudioStream *audioStream ;
- Audio::SeekableAudioStream *wavStream = Audio::makeWAVStream(_fileStream, DisposeAfterUse::NO);
- if (isLoop) {
+ volume = ((int) volume * 255) / 100;
+ Audio::Mixer *mixer = g_system->getMixer();
+ mixer->stopHandle(_handle);
+
+ Audio::AudioStream *audioStream;
+ Audio::SeekableAudioStream *wavStream = Audio::makeWAVStream(stream, DisposeAfterUse::NO);
+ if (isLoop)
audioStream = Audio::makeLoopingAudioStream(wavStream, 0, 0, 0);
- } else
+ else
audioStream = wavStream;
- _mixer->playStream(type, &_handle , audioStream, -1 , 50, 0, DisposeAfterUse::YES);
-}
-
-void Sound::setBalance(int8 balance) {
- _mixer->setChannelBalance(_handle, balance);
-}
-
-uint32 Sound::getCurrentSample() {
- return _mixer->getSoundElapsedTime(_handle) * kSampleRate / 1000;
+ mixer->playStream(type, &_handle , audioStream, -1, volume, balance, DisposeAfterUse::YES);
}
} // End of namespace Pink
diff --git a/engines/pink/sound.h b/engines/pink/sound.h
index a5e7cca..f18fb9f 100644
--- a/engines/pink/sound.h
+++ b/engines/pink/sound.h
@@ -25,35 +25,30 @@
#include "audio/mixer.h"
-#include "common/stream.h"
-#include "common/substream.h"
+#include "common/system.h"
-namespace Pink {
+namespace Common {
+ class SafeSeekableSubReadStream;
+}
-/*TODO
- from disasm foreground 100 %, background 80 %
- dont know how to properly do it
- may be use ConfMan
-*/
+namespace Pink {
class Sound {
public:
- Sound(Audio::Mixer *mixer, Common::SafeSeekableSubReadStream *stream);
- ~Sound();
+ ~Sound() { stop(); }
+
+ void play(Common::SafeSeekableSubReadStream *stream, Audio::Mixer::SoundType type, byte volume = 100, int8 balance = 0, bool isLoop = false);
- void play(Audio::Mixer::SoundType type, int volume, bool isLoop);
+ bool isPlaying() { return g_system->getMixer()->isSoundHandleActive(_handle); }
- bool isPlaying();
+ void stop() { g_system->getMixer()->stopHandle(_handle); }
- void pause(bool paused);
+ void pause(bool paused) { g_system->getMixer()->pauseHandle(_handle, paused); }
- uint32 getCurrentSample();
- void setBalance(int8 balance);
+ uint32 getCurrentSample() { return g_system->getMixer()->getSoundElapsedTime(_handle) * 22050 / 1000; }
private:
- Audio::Mixer *_mixer;
Audio::SoundHandle _handle;
- Common::SafeSeekableSubReadStream *_fileStream;
};
} // End of namespace Pink
Commit: 30b5c30ab238270835c8673bf7c91e8f0b3e6403
https://github.com/scummvm/scummvm/commit/30b5c30ab238270835c8673bf7c91e8f0b3e6403
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix accessing non-existent pixels
Changed paths:
engines/pink/director.cpp
diff --git a/engines/pink/director.cpp b/engines/pink/director.cpp
index dd8e870..1208800 100644
--- a/engines/pink/director.cpp
+++ b/engines/pink/director.cpp
@@ -114,9 +114,10 @@ Actor *Director::getActorByPoint(const Common::Point point) {
CelDecoder *decoder = _sprites[i]->getDecoder();
const Graphics::Surface *frame = decoder->getCurrentFrame();
const Common::Rect &rect = decoder->getRectangle();
- byte spritePixel = *(const byte*) frame->getBasePtr(point.x - rect.left, point.y - rect.top);
- if (rect.contains(point) && spritePixel != decoder->getTransparentColourIndex()) {
- return _sprites[i]->getActor();
+ if (rect.contains(point)) {
+ byte spritePixel = *(const byte*) frame->getBasePtr(point.x - rect.left, point.y - rect.top);
+ if (spritePixel != decoder->getTransparentColourIndex())
+ return _sprites[i]->getActor();
}
}
Commit: f11d3311296aa3afd8f54e4458cb900fdf417782
https://github.com/scummvm/scummvm/commit/f11d3311296aa3afd8f54e4458cb900fdf417782
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: implement sound balance
Changed paths:
engines/pink/objects/actions/action_play_with_sfx.cpp
engines/pink/objects/actions/action_play_with_sfx.h
engines/pink/objects/actions/action_sound.cpp
engines/pink/objects/actions/action_talk.cpp
engines/pink/objects/actions/action_talk.h
diff --git a/engines/pink/objects/actions/action_play_with_sfx.cpp b/engines/pink/objects/actions/action_play_with_sfx.cpp
index 3805b8f..c4f07e8 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.cpp
+++ b/engines/pink/objects/actions/action_play_with_sfx.cpp
@@ -74,24 +74,28 @@ void ActionPlayWithSfx::updateSound() {
for (uint i = 0; i < _sfxArray.size(); ++i) {
if (_sfxArray[i]->getFrame() == _decoder->getCurFrame())
- _sfxArray[i]->play(_actor->getPage());
+ _sfxArray[i]->play();
}
}
void ActionSfx::deserialize(Pink::Archive &archive) {
_frame = archive.readDWORD();
_volume = archive.readDWORD();
+ assert(_volume <= 100);
_sfxName = archive.readString();
- archive.readObject(); // pointer of ActionPlayWithSfx
+ _sprite = (ActionPlayWithSfx*) archive.readObject();
}
void ActionSfx::toConsole() {
debug("\t\tActionSfx: _sfx = %s, _volume = %u, _frame = %u", _sfxName.c_str(), _volume, _frame);
}
-void ActionSfx::play(Page *page) {
- if (!_sound.isPlaying())
- _sound.play(page->getResourceStream(_sfxName), Audio::Mixer::kSFXSoundType, _volume);
+void ActionSfx::play() {
+ Page *page = _sprite->getActor()->getPage();
+ if (!_sound.isPlaying()) {
+ int8 balance = (_sprite->getDecoder()->getX() * 396875 / 1000000) - 127;
+ _sound.play(page->getResourceStream(_sfxName), Audio::Mixer::kSFXSoundType, _volume, balance);
+ }
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_play_with_sfx.h b/engines/pink/objects/actions/action_play_with_sfx.h
index 16a3cad..fdcb9c9 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.h
+++ b/engines/pink/objects/actions/action_play_with_sfx.h
@@ -58,11 +58,12 @@ public:
void toConsole() override;
- void play(Page *page);
+ void play();
uint32 getFrame() { return _frame; }
private:
+ ActionPlayWithSfx *_sprite;
Common::String _sfxName;
Sound _sound;
uint32 _volume;
diff --git a/engines/pink/objects/actions/action_sound.cpp b/engines/pink/objects/actions/action_sound.cpp
index e67717f..b795726 100644
--- a/engines/pink/objects/actions/action_sound.cpp
+++ b/engines/pink/objects/actions/action_sound.cpp
@@ -39,6 +39,7 @@ void ActionSound::deserialize(Archive &archive) {
Action::deserialize(archive);
_fileName = archive.readString();
_volume = archive.readDWORD();
+ assert(_volume <= 100);
_isLoop = (bool) archive.readDWORD();
_isBackground = (bool) archive.readDWORD();
}
diff --git a/engines/pink/objects/actions/action_talk.cpp b/engines/pink/objects/actions/action_talk.cpp
index f46afb3..be64f0b 100644
--- a/engines/pink/objects/actions/action_talk.cpp
+++ b/engines/pink/objects/actions/action_talk.cpp
@@ -60,7 +60,10 @@ void ActionTalk::pause(bool paused) {
void ActionTalk::onStart() {
ActionPlay::onStart();
- _sound.play(_actor->getPage()->getResourceStream(_vox), Audio::Mixer::kSpeechSoundType);
+ //sound balance is calculated different than in ActionSfx(probably a bug in original)
+ // 30.0 - x * -0.0625 disasm (0 - 100)
+ int8 balance = (_decoder->getX() * 396875 / 1000000) - 127;
+ _sound.play(_actor->getPage()->getResourceStream(_vox), Audio::Mixer::kSpeechSoundType, 100, balance);
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_talk.h b/engines/pink/objects/actions/action_talk.h
index f29dc0f..1b8b60e 100644
--- a/engines/pink/objects/actions/action_talk.h
+++ b/engines/pink/objects/actions/action_talk.h
@@ -45,8 +45,8 @@ protected:
void onStart() override;
private:
- Sound _sound;
Common::String _vox;
+ Sound _sound;
};
} // End of namespace Pink
Commit: 0659ca4846d6b7eade11628e35c6dad6bf876e49
https://github.com/scummvm/scummvm/commit/0659ca4846d6b7eade11628e35c6dad6bf876e49
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix mem leaks
Changed paths:
engines/pink/objects/pages/game_page.cpp
engines/pink/objects/sequences/sequencer.cpp
engines/pink/objects/walk/walk_mgr.cpp
engines/pink/objects/walk/walk_mgr.h
engines/pink/pink.cpp
engines/pink/sound.cpp
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index 5bd420c..e0d5de1 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -36,6 +36,7 @@ GamePage::GamePage()
GamePage::~GamePage() {
clear();
+ delete _memFile;
}
void GamePage::toConsole() {
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index 8facfe3..3004881 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -40,6 +40,10 @@ Sequencer::~Sequencer() {
for (uint i = 0; i < _sequences.size(); ++i) {
delete _sequences[i];
}
+ for (uint i = 0; i < _timers.size(); ++i) {
+ delete _timers[i];
+ }
+ removeContext(_context);
}
void Sequencer::deserialize(Archive &archive) {
diff --git a/engines/pink/objects/walk/walk_mgr.cpp b/engines/pink/objects/walk/walk_mgr.cpp
index c7c06ec..1336991 100644
--- a/engines/pink/objects/walk/walk_mgr.cpp
+++ b/engines/pink/objects/walk/walk_mgr.cpp
@@ -32,6 +32,12 @@ namespace Pink {
WalkMgr::WalkMgr()
: _isWalking(false), _leadActor(nullptr) {}
+WalkMgr::~WalkMgr() {
+ for (uint i = 0; i < _locations.size(); ++i) {
+ delete _locations[i];
+ }
+}
+
void WalkMgr::deserialize(Pink::Archive &archive) {
_leadActor = static_cast<LeadActor *>(archive.readObject());
_locations.deserialize(archive);
diff --git a/engines/pink/objects/walk/walk_mgr.h b/engines/pink/objects/walk/walk_mgr.h
index cb6b68c..a836bfc 100644
--- a/engines/pink/objects/walk/walk_mgr.h
+++ b/engines/pink/objects/walk/walk_mgr.h
@@ -42,6 +42,7 @@ struct Coordinates {
class WalkMgr : public Object {
public:
WalkMgr();
+ ~WalkMgr() override;
virtual void deserialize(Archive &archive);
void toConsole() override;
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index eaeadbc..d28b058 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -261,6 +261,7 @@ Common::Error PinkEngine::loadGameState(int slot) {
_nextPage = archive.readString();
initModule(archive.readString(), "", &archive);
+ delete in;
return Common::kNoError;
}
diff --git a/engines/pink/sound.cpp b/engines/pink/sound.cpp
index 81463b2..5771951 100644
--- a/engines/pink/sound.cpp
+++ b/engines/pink/sound.cpp
@@ -39,7 +39,7 @@ void Sound::play(Common::SafeSeekableSubReadStream *stream, Audio::Mixer::SoundT
mixer->stopHandle(_handle);
Audio::AudioStream *audioStream;
- Audio::SeekableAudioStream *wavStream = Audio::makeWAVStream(stream, DisposeAfterUse::NO);
+ Audio::SeekableAudioStream *wavStream = Audio::makeWAVStream(stream, DisposeAfterUse::YES);
if (isLoop)
audioStream = Audio::makeLoopingAudioStream(wavStream, 0, 0, 0);
else
Commit: 10f6e0a6b39a4ad9dc9463c9d1ca08b883c99dd0
https://github.com/scummvm/scummvm/commit/10f6e0a6b39a4ad9dc9463c9d1ca08b883c99dd0
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix loading empty page from save
Changed paths:
engines/pink/objects/pages/game_page.cpp
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index e0d5de1..b2b7345 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -160,9 +160,11 @@ void GamePage::saveStateToMem() {
void GamePage::loadState(Archive &archive) {
uint size = archive.readDWORD();
- _memFile = new Common::MemoryReadWriteStream(DisposeAfterUse::YES);
- for (uint i = 0; i < size; ++i) {
- _memFile->writeByte(archive.readByte());
+ if (size) {
+ _memFile = new Common::MemoryReadWriteStream(DisposeAfterUse::YES);
+ for (uint i = 0; i < size; ++i) {
+ _memFile->writeByte(archive.readByte());
+ }
}
}
Commit: b9a5f84515f2d492b67e1c91b252b157b24804dc
https://github.com/scummvm/scummvm/commit/b9a5f84515f2d492b67e1c91b252b157b24804dc
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix game page destruction after saving
Changed paths:
engines/pink/objects/pages/game_page.cpp
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index b2b7345..9ddcffd 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -174,6 +174,7 @@ void GamePage::saveState(Archive &archive) {
archive.writeDWORD(_memFile->size());
archive.getWriteStream()->write(_memFile->getData(), _memFile->size());
delete _memFile;
+ _memFile = nullptr;
} else {
if (_memFile != nullptr) {
archive.writeDWORD(_memFile->size());
Commit: 5babed5790660ec7006cae5bb823340f618df4f9
https://github.com/scummvm/scummvm/commit/5babed5790660ec7006cae5bb823340f618df4f9
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix playing looped sounds
Changed paths:
engines/pink/objects/actions/action_sound.cpp
diff --git a/engines/pink/objects/actions/action_sound.cpp b/engines/pink/objects/actions/action_sound.cpp
index b795726..cb5ce0b 100644
--- a/engines/pink/objects/actions/action_sound.cpp
+++ b/engines/pink/objects/actions/action_sound.cpp
@@ -55,7 +55,7 @@ void ActionSound::start() {
Director *director = _actor->getPage()->getGame()->getDirector();
director->addSound(this);
- _sound.play(_actor->getPage()->getResourceStream(_fileName), soundType, _volume, _isLoop);
+ _sound.play(_actor->getPage()->getResourceStream(_fileName), soundType, _volume, 0, _isLoop);
if (_isLoop)
_actor->endAction();
Commit: 078557a1ada1c6e1b0507b5101457a756a92c7d8
https://github.com/scummvm/scummvm/commit/078557a1ada1c6e1b0507b5101457a756a92c7d8
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix condition of miniGame
Changed paths:
engines/pink/objects/actors/lead_actor.cpp
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 0032d78..96f6226 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -477,8 +477,8 @@ WalkLocation *PubPink::getWalkDestination() {
}
bool PubPink::playingMiniGame() {
- return !_page->checkValueOfVariable(kFoodPuzzle, "TRUE") ||
- _page->checkValueOfVariable(kFoodPuzzle, kUndefined);
+ return !(_page->checkValueOfVariable(kFoodPuzzle, "TRUE") ||
+ _page->checkValueOfVariable(kFoodPuzzle, kUndefined));
}
} // End of namespace Pink
Commit: ccd0ec7ffb87a17dda58a00a2f6440cca2641997
https://github.com/scummvm/scummvm/commit/ccd0ec7ffb87a17dda58a00a2f6440cca2641997
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: inline one line archive functions; remove stream getters
Changed paths:
engines/pink/archive.cpp
engines/pink/archive.h
engines/pink/objects/pages/game_page.cpp
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp
index 58dc584..13b2008 100644
--- a/engines/pink/archive.cpp
+++ b/engines/pink/archive.cpp
@@ -317,30 +317,6 @@ Common::String Archive::readString() {
return Common::String(buffer, len);
}
-byte Archive::readByte() {
- return _readStream->readByte();
-}
-
-uint32 Archive::readDWORD() {
- return _readStream->readUint32LE();
-}
-
-uint16 Archive::readWORD() {
- return _readStream->readUint16LE();
-}
-
-void Archive::writeByte(byte val) {
- return _writeStream->writeByte(val);
-}
-
-void Archive::writeDWORD(uint32 val) {
- _writeStream->writeUint32LE(val);
-}
-
-void Archive::writeWORD(uint16 val) {
- _writeStream->writeUint16LE(val);
-}
-
void Archive::writeString(const Common::String &string) {
_writeStream->writeByte(string.size());
_writeStream->write(string.c_str(), string.size());
diff --git a/engines/pink/archive.h b/engines/pink/archive.h
index d0665ea..2f32388 100644
--- a/engines/pink/archive.h
+++ b/engines/pink/archive.h
@@ -42,22 +42,22 @@ public:
Archive(Common::SeekableReadStream *stream);
Archive(Common::WriteStream *stream);
- Common::SeekableReadStream *getReadStream() { return _readStream; }
- Common::WriteStream *getWriteStream() { return _writeStream; };
-
void mapObject(Object *obj);
int readCount();
- byte readByte();
- uint32 readDWORD();
- uint16 readWORD();
+ byte readByte() { return _readStream->readByte(); }
+ uint32 readDWORD() { return _readStream->readUint32LE(); }
+ uint16 readWORD() { return _readStream->readUint16LE(); }
- void writeByte(byte val);
- void writeDWORD(uint32 val);
- void writeWORD(uint16 val);
+ Common::String readString();
Object *readObject();
- Common::String readString();
+
+ void write(const void *dataPtr, uint32 dataSize) { _writeStream->write(dataPtr, dataSize); }
+ void writeByte(byte val) { _writeStream->writeByte(val); }
+ void writeDWORD(uint32 val) { _writeStream->writeUint32LE(val); }
+ void writeWORD(uint16 val) { _writeStream->writeUint16LE(val); }
+
void writeString(const Common::String &string);
private:
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index 9ddcffd..8ab1b0a 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -172,13 +172,13 @@ void GamePage::saveState(Archive &archive) {
if (this == _module->getPage()) {
saveStateToMem();
archive.writeDWORD(_memFile->size());
- archive.getWriteStream()->write(_memFile->getData(), _memFile->size());
+ archive.write(_memFile->getData(), _memFile->size());
delete _memFile;
_memFile = nullptr;
} else {
if (_memFile != nullptr) {
archive.writeDWORD(_memFile->size());
- archive.getWriteStream()->write(_memFile->getData(), _memFile->size());
+ archive.write(_memFile->getData(), _memFile->size());
} else {
archive.writeDWORD(0);
}
Commit: 58e7d560eefa6e7cd86109f1d4b8227856cc01c8
https://github.com/scummvm/scummvm/commit/58e7d560eefa6e7cd86109f1d4b8227856cc01c8
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: inline small functions
Changed paths:
engines/pink/archive.cpp
engines/pink/archive.h
engines/pink/cursor_mgr.cpp
engines/pink/cursor_mgr.h
engines/pink/file.cpp
engines/pink/file.h
engines/pink/objects/actions/action.cpp
engines/pink/objects/actions/action.h
engines/pink/objects/actions/action_cel.cpp
engines/pink/objects/actions/action_cel.h
engines/pink/objects/actors/actor.cpp
engines/pink/objects/actors/actor.h
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/actors/lead_actor.h
engines/pink/objects/handlers/handler.cpp
engines/pink/objects/handlers/handler_timer.cpp
engines/pink/objects/inventory.cpp
engines/pink/objects/inventory.h
engines/pink/objects/module.cpp
engines/pink/objects/module.h
engines/pink/objects/object.cpp
engines/pink/objects/object.h
engines/pink/objects/pages/game_page.cpp
engines/pink/objects/pages/game_page.h
engines/pink/objects/pages/page.cpp
engines/pink/objects/pages/page.h
engines/pink/objects/sequences/sequence.cpp
engines/pink/objects/sequences/sequence.h
engines/pink/objects/sequences/sequence_context.cpp
engines/pink/objects/sequences/sequence_context.h
engines/pink/objects/sequences/sequence_item.cpp
engines/pink/objects/sequences/sequence_item.h
engines/pink/pda_mgr.cpp
engines/pink/pda_mgr.h
engines/pink/pink.cpp
engines/pink/pink.h
engines/pink/resource_mgr.cpp
engines/pink/resource_mgr.h
engines/pink/utils.h
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp
index 13b2008..c5737ba 100644
--- a/engines/pink/archive.cpp
+++ b/engines/pink/archive.cpp
@@ -231,8 +231,10 @@ void Archive::mapObject(Object *obj) {
int Archive::readCount() {
int count = _readStream->readUint16LE();
- if (count == 0xffff)
+ if (count == 0xffff) {
+ assert(0);
count = _readStream->readUint32LE();
+ }
return count;
}
diff --git a/engines/pink/archive.h b/engines/pink/archive.h
index 2f32388..ad51819 100644
--- a/engines/pink/archive.h
+++ b/engines/pink/archive.h
@@ -27,8 +27,6 @@
#include "common/str-array.h"
#include "common/stream.h"
-#include "pink/objects/object.h"
-
namespace Common {
class File;
@@ -37,6 +35,8 @@ class File;
namespace Pink {
+class Object;
+
class Archive {
public:
Archive(Common::SeekableReadStream *stream);
diff --git a/engines/pink/cursor_mgr.cpp b/engines/pink/cursor_mgr.cpp
index 379d469..99febcd 100644
--- a/engines/pink/cursor_mgr.cpp
+++ b/engines/pink/cursor_mgr.cpp
@@ -99,7 +99,7 @@ void CursorMgr::setCursor(const Common::String &cursorName, const Common::Point
void CursorMgr::hideItem() {
if (_actor)
- _actor->hide();
+ _actor->setAction(kHideAction);
}
void CursorMgr::startAnimation(int index) {
@@ -112,8 +112,4 @@ void CursorMgr::startAnimation(int index) {
}
}
-void CursorMgr::setPage(Page *page) {
- _page = page;
-}
-
} // End of namespace Pink
diff --git a/engines/pink/cursor_mgr.h b/engines/pink/cursor_mgr.h
index 391fcd3..d7f17bb 100644
--- a/engines/pink/cursor_mgr.h
+++ b/engines/pink/cursor_mgr.h
@@ -44,7 +44,7 @@ public:
void setCursor(uint index, const Common::Point point, const Common::String &itemName);
void setCursor(const Common::String &cursorName, const Common::Point point);
- void setPage(Page *page);
+ void setPage(Page *page) { _page = page; }
private:
void hideItem();
diff --git a/engines/pink/file.cpp b/engines/pink/file.cpp
index 9646961..861ffc4 100644
--- a/engines/pink/file.cpp
+++ b/engines/pink/file.cpp
@@ -126,10 +126,6 @@ ResourceDescription *OrbFile::getResDescTable(ObjectDescription *objDesc){
return table;
}
-uint32 OrbFile::getTimestamp() {
- return _timestamp;
-}
-
void OrbFile::seekToObject(const char *name) {
ObjectDescription *desc = getObjDesc(name);
seek(desc->objectsOffset);
diff --git a/engines/pink/file.h b/engines/pink/file.h
index d124eb2..80b7ec6 100644
--- a/engines/pink/file.h
+++ b/engines/pink/file.h
@@ -64,7 +64,7 @@ public:
ResourceDescription *getResDescTable(ObjectDescription *objDesc);
- uint32 getTimestamp();
+ uint32 getTimestamp() { return _timestamp; }
private:
void seekToObject(const char *name);
diff --git a/engines/pink/objects/actions/action.cpp b/engines/pink/objects/actions/action.cpp
index 107cff5..24233ad 100644
--- a/engines/pink/objects/actions/action.cpp
+++ b/engines/pink/objects/actions/action.cpp
@@ -41,8 +41,5 @@ Coordinates Action::getCoordinates() {
return Coordinates();
}
-Actor *Action::getActor() const {
- return _actor;
-}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action.h b/engines/pink/objects/actions/action.h
index a6e36db..e3b4416 100644
--- a/engines/pink/objects/actions/action.h
+++ b/engines/pink/objects/actions/action.h
@@ -43,7 +43,7 @@ public:
virtual void pause(bool paused);
virtual Coordinates getCoordinates();
- Actor *getActor() const;
+ Actor *getActor() const { return _actor; }
protected:
Actor *_actor;
diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp
index 4b03f68..7efd077 100644
--- a/engines/pink/objects/actions/action_cel.cpp
+++ b/engines/pink/objects/actions/action_cel.cpp
@@ -82,14 +82,6 @@ void ActionCEL::pause(bool paused) {
_decoder->pauseVideo(paused);
}
-uint32 ActionCEL::getZ() {
- return _z;
-}
-
-CelDecoder *ActionCEL::getDecoder() {
- return _decoder;
-}
-
Coordinates ActionCEL::getCoordinates() {
if (!_decoder)
_decoder = _actor->getPage()->loadCel(_fileName);
diff --git a/engines/pink/objects/actions/action_cel.h b/engines/pink/objects/actions/action_cel.h
index 355323d..c67623a 100644
--- a/engines/pink/objects/actions/action_cel.h
+++ b/engines/pink/objects/actions/action_cel.h
@@ -47,8 +47,8 @@ public:
Coordinates getCoordinates() override;
- uint32 getZ();
- CelDecoder *getDecoder();
+ uint32 getZ() { return _z; }
+ CelDecoder *getDecoder() { return _decoder; }
protected:
virtual void onStart() = 0;
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index fe44728..25e2a85 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -86,31 +86,11 @@ void Actor::toConsole() {
}
}
-bool Actor::isPlaying() {
- return !_isActionEnded;
-}
-
void Actor::pause(bool paused) {
if (_action)
_action->pause(paused);
}
-void Actor::hide() {
- setAction(kHideAction);
-}
-
-void Actor::endAction() {
- _isActionEnded = 1;
-}
-
-bool Actor::isLeftClickHandlers() {
- return false;
-}
-
-bool Actor::isUseClickHandlers(InventoryItem *item) {
- return false;
-}
-
void Actor::onMouseOver(const Common::Point point, CursorMgr *mgr) {
mgr->setCursor(kDefaultCursor, point, Common::String());
}
@@ -119,18 +99,6 @@ void Actor::onHover(const Common::Point point, const Common::String &itemName, C
cursorMgr->setCursor(kHoldingItemCursor, point, itemName);
}
-void Actor::onClick() {}
-
-void Actor::onTimerMessage() {}
-
-bool Actor::onLeftClickMessage() {
- return false;
-}
-
-bool Actor::onUseClickMessage(InventoryItem *item, InventoryMgr *mgr) {
- return false;
-}
-
Action *Actor::findAction(const Common::String &name) {
for (uint i = 0; i < _actions.size(); ++i) {
if (_actions[i]->getName() == name)
@@ -139,28 +107,11 @@ Action *Actor::findAction(const Common::String &name) {
return nullptr;
}
-Action *Actor::getAction() const {
- return _action;
-}
-
-Page *Actor::getPage() const {
- return _page;
-}
-
-Sequencer *Actor::getSequencer() const {
- return _page->getSequencer();
-}
-
const Common::String &Actor::getLocation() const {
static const Common::String empty;
return empty;
}
-void Actor::setAction(const Common::String &name) {
- Action *newAction = findAction(name);
- setAction(newAction);
-}
-
void Actor::setAction(Action *newAction) {
if (_action) {
_isActionEnded = 1;
@@ -183,8 +134,4 @@ void Actor::setAction(Action *newAction, bool unk) {
}
}
-void Actor::setPage(Page *page) {
- _page = page;
-}
-
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/actor.h b/engines/pink/objects/actors/actor.h
index 6a4d19c..2d42f37 100644
--- a/engines/pink/objects/actors/actor.h
+++ b/engines/pink/objects/actors/actor.h
@@ -52,37 +52,35 @@ public:
void toConsole() override ;
- bool isPlaying();
+ bool isPlaying() { return !_isActionEnded; }
virtual void pause(bool paused);
- void hide();
- void endAction();
+ void endAction() { _isActionEnded = true; }
- virtual bool isLeftClickHandlers();
- virtual bool isUseClickHandlers(InventoryItem *item);
+ virtual bool isLeftClickHandlers() { return false; }
+ virtual bool isUseClickHandlers(InventoryItem *item) { return false; }
virtual void onMouseOver(const Common::Point point, CursorMgr *mgr);
virtual void onHover(const Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr);
- virtual void onClick();
+ virtual void onClick() {}
- virtual void onTimerMessage();
- virtual bool onLeftClickMessage();
- virtual bool onUseClickMessage(InventoryItem *item, InventoryMgr *mgr);
+ virtual void onTimerMessage() {}
+ virtual bool onLeftClickMessage() { return false; }
+ virtual bool onUseClickMessage(InventoryItem *item, InventoryMgr *mgr) { return false; }
Action *findAction(const Common::String &name);
- Action *getAction() const;
- Page *getPage() const;
- Sequencer *getSequencer() const;
+ Action *getAction() const { return _action; }
+ Page *getPage() const { return _page; }
virtual const Common::String &getLocation() const;
- void setAction(const Common::String &name);
+ void setAction(const Common::String &name) { setAction(findAction(name)); }
void setAction(Action *newAction);
void setAction(Action *newAction, bool unk);
- void setPage(Page *page);
+ void setPage(Page *page) { _page = page;}
protected:
Page *_page;
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 96f6226..c4e41b1 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -284,8 +284,6 @@ void LeadActor::onClick() {
}
}
-void LeadActor::onVariableSet() {}
-
void LeadActor::onInventoryClosed(bool isItemClicked) {
_isHaveItem = isItemClicked;
_state = _stateCopy;
@@ -329,10 +327,6 @@ void LeadActor::setNextExecutors(const Common::String &nextModule, const Common:
}
}
-LeadActor::State LeadActor::getState() const {
- return _state;
-}
-
void LeadActor::forceUpdateCursor() {
const Common::Point point = _page->getGame()->getEventManager()->getMousePos();
updateCursor(point);
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index 5428d48..5b2ea70 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -76,7 +76,7 @@ public:
void onMouseOver(const Common::Point point, CursorMgr *mgr) override;
virtual void onClick();
- virtual void onVariableSet();
+ virtual void onVariableSet() {}
void onInventoryClosed(bool isItemClicked);
void onWalkEnd();
void onPDAClose();
@@ -85,7 +85,7 @@ public:
void setNextExecutors (const Common::String &nextModule, const Common::String &nextPage);
- State getState() const;
+ State getState() const { return _state; }
protected:
void forceUpdateCursor();
diff --git a/engines/pink/objects/handlers/handler.cpp b/engines/pink/objects/handlers/handler.cpp
index f27b79a..019d349 100644
--- a/engines/pink/objects/handlers/handler.cpp
+++ b/engines/pink/objects/handlers/handler.cpp
@@ -71,7 +71,7 @@ void HandlerSequences::deserialize(Archive &archive) {
void HandlerSequences::handle(Actor *actor) {
Handler::handle(actor);
- Sequencer *sequencer = actor->getSequencer();
+ Sequencer *sequencer = actor->getPage()->getSequencer();
assert(!_sequences.empty());
diff --git a/engines/pink/objects/handlers/handler_timer.cpp b/engines/pink/objects/handlers/handler_timer.cpp
index 57d2179..46d3d57 100644
--- a/engines/pink/objects/handlers/handler_timer.cpp
+++ b/engines/pink/objects/handlers/handler_timer.cpp
@@ -95,7 +95,7 @@ void HandlerTimerSequences::toConsole() {
void HandlerTimerSequences::handle(Actor *actor) {
Handler::handle(actor);
- Sequencer *sequencer = actor->getSequencer();
+ Sequencer *sequencer = actor->getPage()->getSequencer();
assert(!_sequences.empty());
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
index 4836880..2082869 100644
--- a/engines/pink/objects/inventory.cpp
+++ b/engines/pink/objects/inventory.cpp
@@ -41,10 +41,6 @@ void Pink::InventoryItem::deserialize(Archive &archive) {
_currentOwner = _initialOwner;
}
-Common::String &InventoryItem::getCurrentOwner() {
- return _currentOwner;
-}
-
void InventoryItem::toConsole() {
debug("\tInventoryItem: _initialOwner=%s _currentOwner=%s", _initialOwner.c_str(), _currentOwner.c_str());
}
@@ -68,10 +64,6 @@ InventoryItem *InventoryMgr::findInventoryItem(const Common::String &name) {
return nullptr;
}
-void InventoryMgr::setLeadActor(LeadActor *lead) {
- _lead = lead;
-}
-
void InventoryMgr::toConsole() {
debug("InventoryMgr:");
for (uint i = 0; i < _items.size(); ++i) {
@@ -195,10 +187,6 @@ void InventoryMgr::showNextItem(bool direction) {
}
}
-InventoryItem *InventoryMgr::getCurrentItem() {
- return _item;
-}
-
void InventoryMgr::loadState(Archive &archive) {
_state = (State) archive.readByte();
_isClickedOnItem = archive.readByte();
diff --git a/engines/pink/objects/inventory.h b/engines/pink/objects/inventory.h
index 104a8e8..836aa7f 100644
--- a/engines/pink/objects/inventory.h
+++ b/engines/pink/objects/inventory.h
@@ -35,7 +35,7 @@ public:
virtual void toConsole();
- Common::String &getCurrentOwner();
+ const Common::String &getCurrentOwner() { return _currentOwner; }
friend class InventoryMgr;
private:
@@ -61,13 +61,13 @@ public:
bool start(bool playOpening);
- void setLeadActor(LeadActor *lead);
+ void setLeadActor(LeadActor *lead) { _lead = lead; }
InventoryItem* findInventoryItem(const Common::String &name);
bool isPinkOwnsAnyItems();
void setItemOwner(const Common::String &owner, InventoryItem *item);
- InventoryItem *getCurrentItem();
+ InventoryItem *getCurrentItem() { return _item; }
private:
void close();
@@ -77,9 +77,6 @@ private:
};
void showNextItem(bool direction);
-
-
-
LeadActor *_lead;
Actor *_window;
Actor *_itemActor;
diff --git a/engines/pink/objects/module.cpp b/engines/pink/objects/module.cpp
index a09e202..30a1ae0 100644
--- a/engines/pink/objects/module.cpp
+++ b/engines/pink/objects/module.cpp
@@ -82,24 +82,12 @@ GamePage *Module::findPage(const Common::String &pageName) const {
return nullptr;
}
-PinkEngine *Module::getGame() const {
- return _game;
-}
-
bool Module::checkValueOfVariable(Common::String &variable, Common::String &value) {
if (!_variables.contains(variable))
return value == kUndefined;
return _variables[variable] == value;
}
-void Module::setVariable(Common::String &variable, Common::String &value) {
- _variables[variable] = value;
-}
-
-InventoryMgr *Module::getInventoryMgr() {
- return &_invMgr;
-}
-
void Module::loadState(Archive &archive) {
_invMgr.loadState(archive);
_variables.deserialize(archive);
diff --git a/engines/pink/objects/module.h b/engines/pink/objects/module.h
index 084fb19..819c19d 100644
--- a/engines/pink/objects/module.h
+++ b/engines/pink/objects/module.h
@@ -57,13 +57,13 @@ public:
void onMouseMove();
void onKeyboardButtonClick();
- PinkEngine *getGame() const;
- InventoryMgr *getInventoryMgr();
+ PinkEngine *getGame() const { return _game; }
+ InventoryMgr *getInventoryMgr() { return &_invMgr; }
bool checkValueOfVariable(Common::String &variable, Common::String &value);
- void setVariable(Common::String &variable, Common::String &value);
+ void setVariable(Common::String &variable, Common::String &value) { _variables[variable] = value; }
- GamePage *getPage() { return _page; };
+ GamePage *getPage() { return _page; }
private:
GamePage *findPage(const Common::String &pageName) const;
diff --git a/engines/pink/objects/object.cpp b/engines/pink/objects/object.cpp
index 0218cb7..570587d 100644
--- a/engines/pink/objects/object.cpp
+++ b/engines/pink/objects/object.cpp
@@ -20,33 +20,14 @@
*
*/
-#include "common/debug.h"
-
-#include "pink/archive.h"
+#include "pink/objects/object.h"
namespace Pink {
-Object::~Object() {}
-
void Object::load(Archive &) {}
void Object::deserialize(Archive &) {}
-void Object::init() {}
-
void Object::toConsole() {}
-NamedObject::NamedObject() {}
-
-NamedObject::NamedObject(const Common::String &name)
- : _name(name) {}
-
-void NamedObject::deserialize(Archive &archive) {
- _name = archive.readString();
-}
-
-const Common::String &NamedObject::getName() const {
- return _name;
-}
-
} // End of namespace Pink
diff --git a/engines/pink/objects/object.h b/engines/pink/objects/object.h
index 3f331f2..7e90c05 100644
--- a/engines/pink/objects/object.h
+++ b/engines/pink/objects/object.h
@@ -25,30 +25,28 @@
#include "common/str.h"
-namespace Pink {
+#include "pink/archive.h"
-class Archive;
+namespace Pink {
class Object {
public:
- virtual ~Object();
+ virtual ~Object() {};
virtual void load(Archive &);
virtual void deserialize(Archive &);
-
- virtual void init();
-
virtual void toConsole();
};
class NamedObject : public Object {
public:
- NamedObject();
- NamedObject(const Common::String &name);
+ NamedObject() {}
+ NamedObject(const Common::String &name)
+ : _name(name) {}
- void deserialize(Archive &archive);
+ void deserialize(Archive &archive) { _name = archive.readString(); }
- const Common::String &getName() const;
+ const Common::String &getName() const { return _name; }
protected:
Common::String _name;
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index 8ab1b0a..3596116 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -116,14 +116,6 @@ void GamePage::loadManagers() {
}
}
-Sequencer *GamePage::getSequencer() {
- return _sequencer;
-}
-
-Module *GamePage::getModule() const {
- return _module;
-}
-
bool GamePage::checkValueOfVariable(const Common::String &variable, const Common::String &value) {
if (!_variables.contains(variable))
return value == kUndefined;
@@ -135,10 +127,6 @@ void GamePage::setVariable(Common::String &variable, Common::String &value) {
_leadActor->onVariableSet();
}
-WalkMgr *GamePage::getWalkMgr() {
- return _walkMgr;
-}
-
void GamePage::loadStateFromMem() {
Archive archive(static_cast<Common::SeekableReadStream*>(_memFile));
_variables.deserialize(archive);
diff --git a/engines/pink/objects/pages/game_page.h b/engines/pink/objects/pages/game_page.h
index 3cd537d..81d4686 100644
--- a/engines/pink/objects/pages/game_page.h
+++ b/engines/pink/objects/pages/game_page.h
@@ -47,9 +47,9 @@ public:
void loadManagers();
void init(bool isLoadingSave);
- Sequencer *getSequencer();
- WalkMgr *getWalkMgr();
- Module *getModule() const;
+ Sequencer *getSequencer() { return _sequencer; }
+ WalkMgr *getWalkMgr() { return _walkMgr; }
+ Module *getModule() { return _module; }
bool checkValueOfVariable(const Common::String &variable, const Common::String &value);
void setVariable(Common::String &variable, Common::String &value);
diff --git a/engines/pink/objects/pages/page.cpp b/engines/pink/objects/pages/page.cpp
index bb93d17..c15d3db 100644
--- a/engines/pink/objects/pages/page.cpp
+++ b/engines/pink/objects/pages/page.cpp
@@ -47,11 +47,6 @@ Actor *Page::findActor(const Common::String &name) {
return nullptr;
}
-
-CelDecoder *Page::loadCel(Common::String &fileName) {
- return _resMgr.loadCEL(fileName);
-}
-
void Page::toConsole() {
for (uint i = 0; i < _actors.size(); ++i) {
_actors[i]->toConsole();
@@ -72,10 +67,6 @@ void Page::initPallete() {
}
}
-LeadActor *Page::getLeadActor() {
- return _leadActor;
-}
-
void Page::clear() {
for (uint i = 0; i < _actors.size(); ++i) {
delete _actors[i];
@@ -90,8 +81,4 @@ void Page::pause(bool paused) {
}
}
-PinkEngine *Page::getGame() {
- return _resMgr.getGame();
-}
-
} // End of namespace Pink
diff --git a/engines/pink/objects/pages/page.h b/engines/pink/objects/pages/page.h
index 9ccfe20..bda4c14 100644
--- a/engines/pink/objects/pages/page.h
+++ b/engines/pink/objects/pages/page.h
@@ -44,19 +44,19 @@ public:
void initPallete();
Actor *findActor(const Common::String &name);
- LeadActor *getLeadActor();
+ LeadActor *getLeadActor() { return _leadActor; }
Common::SafeSeekableSubReadStream *getResourceStream(const Common::String &fileName) { return _resMgr.getResourceStream(fileName); }
- CelDecoder *loadCel(Common::String &fileName);
+ CelDecoder *loadCel(Common::String &fileName) { return _resMgr.loadCEL(fileName); }
virtual void clear();
void pause(bool paused);
- PinkEngine *getGame();
+ PinkEngine *getGame() { return _resMgr.getGame(); }
virtual Sequencer *getSequencer() { return nullptr; }
virtual WalkMgr *getWalkMgr() { return nullptr; }
- virtual Module *getModule() const { return nullptr; }
+ virtual Module *getModule() { return nullptr; }
virtual bool checkValueOfVariable(const Common::String &variable, const Common::String &value) { return 0; }
virtual void setVariable(Common::String &variable, Common::String &value) {}
diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp
index e7d5783..35c2ef5 100644
--- a/engines/pink/objects/sequences/sequence.cpp
+++ b/engines/pink/objects/sequences/sequence.cpp
@@ -57,14 +57,6 @@ void Sequence::toConsole() {
}
}
-Common::Array<SequenceItem*> &Sequence::getItems() {
- return _items;
-}
-
-void Sequence::setContext(SequenceContext *context) {
- _context = context;
-}
-
void Sequence::init(int unk) {
assert(_items.size());
assert(dynamic_cast<SequenceItemLeader*>(_items[0])); // first item must always be a leader
diff --git a/engines/pink/objects/sequences/sequence.h b/engines/pink/objects/sequences/sequence.h
index 93dcb25..c3439a1 100644
--- a/engines/pink/objects/sequences/sequence.h
+++ b/engines/pink/objects/sequences/sequence.h
@@ -40,9 +40,9 @@ public:
virtual void toConsole();
- Common::Array<SequenceItem *> &getItems();
+ Common::Array<SequenceItem *> &getItems() { return _items; }
- void setContext(SequenceContext *context);
+ void setContext(SequenceContext *context) { _context = context; }
virtual void init(int unk);
virtual void start(int unk);
virtual void end();
diff --git a/engines/pink/objects/sequences/sequence_context.cpp b/engines/pink/objects/sequences/sequence_context.cpp
index 200fcb4..61ac13c 100644
--- a/engines/pink/objects/sequences/sequence_context.cpp
+++ b/engines/pink/objects/sequences/sequence_context.cpp
@@ -34,10 +34,6 @@ namespace Pink {
SequenceActorState::SequenceActorState(const Common::String &name)
:_actorName(name), _index(0) {}
-const Common::String &SequenceActorState::getActor() const {
- return _actorName;
-}
-
void SequenceActorState::check(int index, Sequence *sequence, bool unk) {
Actor *actor = sequence->_sequencer->_page->findActor(_actorName);
debug("%s %s", _actorName.c_str(), _actionName.c_str());
@@ -71,22 +67,10 @@ SequenceContext::SequenceContext(Sequence *sequence, Sequencer *sequencer)
}
}
-uint SequenceContext::getNextItemIndex() const {
- return _nextItemIndex;
-}
-
-Sequence *SequenceContext::getSequence() const {
- return _sequence;
-}
-
void SequenceContext::clearActionsFromActorStates() {
for (uint i = 0; i < _states.size(); ++i) {
_states[i]._actionName.clear();
}
}
-void SequenceContext::setNextItemIndex(int index) {
- _nextItemIndex = index;
-}
-
} // End of namespace Pink
diff --git a/engines/pink/objects/sequences/sequence_context.h b/engines/pink/objects/sequences/sequence_context.h
index e7acf09..5ba6081 100644
--- a/engines/pink/objects/sequences/sequence_context.h
+++ b/engines/pink/objects/sequences/sequence_context.h
@@ -34,7 +34,7 @@ class SequenceActorState {
public:
SequenceActorState(const Common::String &name);
- const Common::String &getActor() const;
+ const Common::String &getActor() const { return _actorName; }
void check(int index, Sequence *sequence, bool unk);
public:
@@ -49,10 +49,10 @@ class SequenceContext {
public:
SequenceContext(Sequence *sequence, Sequencer* sequencer);
- uint getNextItemIndex() const;
- Sequence *getSequence() const;
+ uint getNextItemIndex() const { return _nextItemIndex; }
+ Sequence *getSequence() const { return _sequence; }
- void setNextItemIndex(int index);
+ void setNextItemIndex(int index) { _nextItemIndex = index; }
void clearActionsFromActorStates();
diff --git a/engines/pink/objects/sequences/sequence_item.cpp b/engines/pink/objects/sequences/sequence_item.cpp
index 2d048b0..cd21a10 100644
--- a/engines/pink/objects/sequences/sequence_item.cpp
+++ b/engines/pink/objects/sequences/sequence_item.cpp
@@ -42,14 +42,6 @@ void SequenceItem::toConsole() {
debug("\t\t\t\tSequenceItem: _actor=%s, _action=%s", _actor.c_str(), _action.c_str());
}
-const Common::String &SequenceItem::getActor() const {
- return _actor;
-}
-
-const Common::String &SequenceItem::getAction() const {
- return _action;
-}
-
bool SequenceItem::execute(int index, Sequence *sequence, bool unk2) {
Actor *actor;
Action *action;
@@ -88,10 +80,6 @@ void SequenceItemLeaderAudio::toConsole() {
debug("\t\t\t\tSequenceItemLeaderAudio: _actor=%s, _action=%s _sample=%d", _actor.c_str(), _action.c_str(), _sample);
}
-uint32 SequenceItemLeaderAudio::getSample() {
- return _sample;
-}
-
bool SequenceItemDefaultAction::execute(int index, Sequence *sequence, bool unk2) {
SequenceActorState *state = sequence->_sequencer->findSequenceActorState(_actor);
state->_actionName = _action;
diff --git a/engines/pink/objects/sequences/sequence_item.h b/engines/pink/objects/sequences/sequence_item.h
index df22f86..d67e0f5 100644
--- a/engines/pink/objects/sequences/sequence_item.h
+++ b/engines/pink/objects/sequences/sequence_item.h
@@ -35,8 +35,8 @@ public:
virtual void toConsole();
- const Common::String &getActor() const;
- const Common::String &getAction() const;
+ const Common::String &getActor() const { return _actor; }
+ const Common::String &getAction() const { return _action; }
virtual bool execute(int index, Sequence *sequence, bool unk2);
virtual bool isLeader();
@@ -57,7 +57,7 @@ class SequenceItemLeaderAudio : public SequenceItemLeader {
public:
virtual void deserialize(Archive &archive);
virtual void toConsole();
- uint32 getSample();
+ uint32 getSample() { return _sample; }
private:
uint32 _sample;
@@ -81,6 +81,6 @@ private
};
*/
-}
+} // End of namespace Pink
#endif
diff --git a/engines/pink/pda_mgr.cpp b/engines/pink/pda_mgr.cpp
index a2cfb5d..1b7b8dd 100644
--- a/engines/pink/pda_mgr.cpp
+++ b/engines/pink/pda_mgr.cpp
@@ -26,16 +26,11 @@
#include "pink/objects/actors/lead_actor.h"
#include "pink/objects/pages/pda_page.h"
-
namespace Pink {
PDAMgr::PDAMgr(Pink::PinkEngine *game)
: _game(game), _page(nullptr), _cursorMgr(game, nullptr) {}
-void PDAMgr::loadState(Archive &archive) {
- _savedPage = archive.readString();
-}
-
void PDAMgr::saveState(Archive &archive) {
if (_page)
archive.writeString(_page->getName());
@@ -74,10 +69,6 @@ void PDAMgr::goToPage(const Common::String &pageName) {
_cursorMgr.setPage(_page);
}
-void PDAMgr::update() {
- _cursorMgr.update();
-}
-
void PDAMgr::onLeftButtonClick(Common::Point point) {
Actor *actor = _game->getDirector()->getActorByPoint(point);
if (actor)
@@ -91,20 +82,6 @@ void PDAMgr::onMouseMove(Common::Point point) {
else _cursorMgr.setCursor(kPDADefaultCursor, point,Common::String());
}
-
-PinkEngine *PDAMgr::getGame() const {
- return _game;
-}
-
-const Common::String &PDAMgr::getSavedPageName() {
- return _savedPage;
-}
-
-
-void PDAMgr::setLead(LeadActor *lead) {
- _lead = lead;
-}
-
void PDAMgr::close() {
for (uint i = 0; i < _globalActors.size(); ++i) {
delete _globalActors[i];
diff --git a/engines/pink/pda_mgr.h b/engines/pink/pda_mgr.h
index fd35674..c2e09ee 100644
--- a/engines/pink/pda_mgr.h
+++ b/engines/pink/pda_mgr.h
@@ -37,21 +37,21 @@ class PDAMgr {
public:
PDAMgr(PinkEngine *game);
- void loadState(Archive &archive);
+ void loadState(Archive &archive) { _savedPage = archive.readString(); }
void saveState(Archive &archive);
void execute(const Command &command);
void goToPage(const Common::String &pageName);
- void update();
+ void update() { _cursorMgr.update(); }
void onLeftButtonClick(Common::Point point);
void onMouseMove(Common::Point point);
- PinkEngine *getGame() const;
- const Common::String &getSavedPageName();
+ PinkEngine *getGame() const { return _game; }
+ const Common::String &getSavedPageName() { return _savedPage; }
- void setLead(LeadActor *lead);
+ void setLead(LeadActor *lead) { _lead = lead; }
private:
void close();
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index d28b058..a940ea9 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -177,11 +177,6 @@ void PinkEngine::changeScene(Page *page) {
}
}
-void PinkEngine::setNextExecutors(const Common::String &nextModule, const Common::String &nextPage) {
- _nextModule = nextModule;
- _nextPage = nextPage;
-}
-
void PinkEngine::loadModule(int index) {
Module *module = new Module(this, _modules[index]->getName());
@@ -197,10 +192,6 @@ bool PinkEngine::checkValueOfVariable(Common::String &variable, Common::String &
return _variables[variable] == value;
}
-void PinkEngine::setVariable(Common::String &variable, Common::String &value) {
- _variables[variable] = value;
-}
-
bool PinkEngine::loadCursors() {
Common::PEResources exeResources;
bool isPokus = !strcmp(_desc.gameId, kPokus);
@@ -319,10 +310,6 @@ void PinkEngine::pauseEngineIntern(bool pause) {
_system->showMouse(!pause);
}
-PDAMgr &PinkEngine::getPdaMgr() {
- return _pdaMgr;
-}
-
Common::String generateSaveName(int slot, const char *gameId) {
return Common::String::format("%s.s%02d", gameId, slot);
}
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index f4d0ad3..299de3f 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -104,16 +104,15 @@ public:
BroFile *getBro() { return _bro; }
Common::RandomSource &getRnd() { return _rnd; };
Director *getDirector() { return &_director; }
+ PDAMgr &getPdaMgr() { return _pdaMgr; }
- void setNextExecutors(const Common::String &nextModule, const Common::String &nextPage);
+ void setNextExecutors(const Common::String &nextModule, const Common::String &nextPage) { _nextModule = nextModule; _nextPage = nextPage; }
void setLeadActor(LeadActor *actor) { _actor = actor; };
void setCursor(uint cursorIndex);
- void setVariable(Common::String &variable, Common::String &value);
+ void setVariable(Common::String &variable, Common::String &value) { _variables[variable] = value; }
bool checkValueOfVariable(Common::String &variable, Common::String &value);
- PDAMgr &getPdaMgr();
-
protected:
virtual void pauseEngineIntern(bool pause);
diff --git a/engines/pink/resource_mgr.cpp b/engines/pink/resource_mgr.cpp
index ebaf219..6d99c69 100644
--- a/engines/pink/resource_mgr.cpp
+++ b/engines/pink/resource_mgr.cpp
@@ -71,10 +71,6 @@ static int resDescComp(const void *a, const void *b) {
return scumm_stricmp((char *) a, (char *) b);
}
-PinkEngine *ResourceMgr::getGame() const {
- return _game;
-}
-
Common::SafeSeekableSubReadStream *ResourceMgr::getResourceStream(const Common::String &name) {
Common::SeekableReadStream *stream;
diff --git a/engines/pink/resource_mgr.h b/engines/pink/resource_mgr.h
index 0cdf2ae..5332953 100644
--- a/engines/pink/resource_mgr.h
+++ b/engines/pink/resource_mgr.h
@@ -55,7 +55,7 @@ public:
CelDecoder *loadCEL(Common::String &name);
Common::String loadText(Common::String &name);
- PinkEngine *getGame() const;
+ PinkEngine *getGame() const { return _game; }
private:
PinkEngine *_game;
diff --git a/engines/pink/utils.h b/engines/pink/utils.h
index 2a01ba9..75a2464 100644
--- a/engines/pink/utils.h
+++ b/engines/pink/utils.h
@@ -23,7 +23,7 @@
#ifndef PINK_UTILS_H
#define PINK_UTILS_H
-#include "pink/archive.h"
+#include "pink/objects/object.h"
namespace Pink {
Commit: 3ca2c13893583bf2578e359faa6ad3bb6892f49b
https://github.com/scummvm/scummvm/commit/3ca2c13893583bf2578e359faa6ad3bb6892f49b
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: remove observing of looped sounds
Changed paths:
engines/pink/objects/actions/action_sound.cpp
diff --git a/engines/pink/objects/actions/action_sound.cpp b/engines/pink/objects/actions/action_sound.cpp
index cb5ce0b..9f12297 100644
--- a/engines/pink/objects/actions/action_sound.cpp
+++ b/engines/pink/objects/actions/action_sound.cpp
@@ -52,23 +52,26 @@ void ActionSound::toConsole() {
void ActionSound::start() {
Audio::Mixer::SoundType soundType = _isBackground ? Audio::Mixer::kMusicSoundType : Audio::Mixer::kSFXSoundType;
- Director *director = _actor->getPage()->getGame()->getDirector();
- director->addSound(this);
-
- _sound.play(_actor->getPage()->getResourceStream(_fileName), soundType, _volume, 0, _isLoop);
- if (_isLoop)
+ Page *page = _actor->getPage();
+ if (!_isLoop) {
+ Director *director = page->getGame()->getDirector();
+ director->addSound(this);
+ } else
_actor->endAction();
+ _sound.play(page->getResourceStream(_fileName), soundType, _volume, 0, _isLoop);
+
debug("Actor %s has now ActionSound %s", _actor->getName().c_str(), _name.c_str());
}
void ActionSound::end() {
_sound.stop();
- debug("ActionSound %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
-
- Director *director = _actor->getPage()->getGame()->getDirector();
- director->removeSound(this);
+ if (!_isLoop) {
+ Director *director = _actor->getPage()->getGame()->getDirector();
+ director->removeSound(this);
+ }
+ debug("ActionSound %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
}
void ActionSound::update() {
Commit: 2fb268b155357c999499460bf98431a4e3761564
https://github.com/scummvm/scummvm/commit/2fb268b155357c999499460bf98431a4e3761564
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: reworked sprite class(ActionCEL) and his inheritors.
Changed paths:
engines/pink/cel_decoder.cpp
engines/pink/cel_decoder.h
engines/pink/director.cpp
engines/pink/director.h
engines/pink/objects/actions/action_cel.cpp
engines/pink/objects/actions/action_cel.h
engines/pink/objects/actions/action_loop.cpp
engines/pink/objects/actions/action_loop.h
engines/pink/objects/actions/action_play.cpp
engines/pink/objects/actions/action_play_with_sfx.cpp
engines/pink/objects/actions/action_play_with_sfx.h
engines/pink/objects/actions/action_still.cpp
engines/pink/objects/actions/action_talk.cpp
engines/pink/objects/actions/action_talk.h
engines/pink/objects/actions/walk_action.cpp
engines/pink/objects/actions/walk_action.h
engines/pink/objects/pages/page.h
engines/pink/resource_mgr.cpp
engines/pink/resource_mgr.h
diff --git a/engines/pink/cel_decoder.cpp b/engines/pink/cel_decoder.cpp
index 0bdba49..fc8918e 100644
--- a/engines/pink/cel_decoder.cpp
+++ b/engines/pink/cel_decoder.cpp
@@ -53,20 +53,6 @@ bool CelDecoder::loadStream(Common::SeekableReadStream *stream) {
return true;
}
-int32 CelDecoder::getX(){
- CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
- if (!track)
- return -1;
- return track->getX();
-}
-
-int32 CelDecoder::getY() {
- CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
- if (!track)
- return -1;
- return track->getY();
-}
-
uint16 CelDecoder::getTransparentColourIndex() {
CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
@@ -89,21 +75,6 @@ Common::Point CelDecoder::getCenter() {
return track->getCenter();
}
-Common::Rect &CelDecoder::getRectangle() {
- CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
- return track->getRect();
-}
-
-void CelDecoder::setX(int32 x) {
- CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
- track->setX(x);
-}
-
-void CelDecoder::setY(int32 y) {
- CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
- track->setY(y);
-}
-
void CelDecoder::skipFrame() {
CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
track->skipFrame();
@@ -139,7 +110,6 @@ void CelDecoder::CelVideoTrack::readPrefixChunk() {
_fileStream->skip(subchunkSize - 6);
break;
}
- _rect = Common::Rect::center(_center.x, _center.y, _surface->w, _surface->h);
}
void CelDecoder::CelVideoTrack::readHeader() {
@@ -157,14 +127,6 @@ void CelDecoder::CelVideoTrack::readHeader() {
_fileStream->seek(_offsetFrame1);
}
-int32 CelDecoder::CelVideoTrack::getX() const {
- return (_center.x - getWidth() / 2) < 0 ? 0 : _center.x - getWidth() / 2;
-}
-
-int32 CelDecoder::CelVideoTrack::getY() const {
- return (_center.y - getHeight() / 2) < 0 ? 0 : _center.y - getHeight() / 2;
-}
-
uint16 CelDecoder::CelVideoTrack::getTransparentColourIndex() {
return _transparentColourIndex;
}
@@ -177,10 +139,6 @@ Common::Point CelDecoder::CelVideoTrack::getCenter() {
return _center;
}
-Common::Rect &CelDecoder::CelVideoTrack::getRect() {
- return _rect;
-}
-
#define FRAME_TYPE 0xF1FA
void CelDecoder::CelVideoTrack::skipFrame() {
@@ -240,12 +198,20 @@ const Graphics::Surface *CelDecoder::CelVideoTrack::decodeNextFrame() {
return _surface;
}
-void CelDecoder::CelVideoTrack::setX(int32 x) {
- _center.x = x ;//+ getWidth() / 2;
-}
+bool CelDecoder::CelVideoTrack::rewind() {
+ // this method is overriden for 2 reasons:
+ // 1) bug in Flic rewind(curFrame)
+ // 2) I changed behaviour of endOfTrack
+ _nextFrameStartTime = 0;
+
+ if (getCurFrame() >= getFrameCount() - 1 && _fileStream->pos() < _fileStream->size())
+ _atRingFrame = true;
+ else
+ _fileStream->seek(_offsetFrame1);
-void CelDecoder::CelVideoTrack::setY(int32 y) {
- _center.y = y;//+ getHeight() / 2;
+ _curFrame = -1;
+ _frameDelay = _startFrameDelay;
+ return true;
}
} // End of namepsace Pink
diff --git a/engines/pink/cel_decoder.h b/engines/pink/cel_decoder.h
index 1e4636b..be67f35 100644
--- a/engines/pink/cel_decoder.h
+++ b/engines/pink/cel_decoder.h
@@ -31,18 +31,12 @@ class CelDecoder : public Video::FlicDecoder {
public:
virtual bool loadStream(Common::SeekableReadStream *stream);
- int32 getX();
- int32 getY();
uint16 getTransparentColourIndex();
Common::Point getCenter();
- Common::Rect &getRectangle();
const Graphics::Surface *getCurrentFrame();
void skipFrame();
- void setX(int32 x);
- void setY(int32 y);
-
protected:
class CelVideoTrack : public FlicVideoTrack {
public:
@@ -53,20 +47,24 @@ protected:
int32 getY() const;
uint16 getTransparentColourIndex();
+ // Hack. Pink needs so that Track needed an update after lastFrame delay ends
+ bool endOfTrack() const override { return getCurFrame() >= getFrameCount(); }
+
Common::Point getCenter();
- Common::Rect &getRect();
const Graphics::Surface *getCurrentFrame();
void setX(int32 x);
void setY(int32 y);
void skipFrame();
+
+ bool rewind() override;
+
private:
const Graphics::Surface *decodeNextFrame();
void readPrefixChunk();
Common::Point _center;
- Common::Rect _rect;
byte _transparentColourIndex;
};
};
diff --git a/engines/pink/director.cpp b/engines/pink/director.cpp
index 1208800..14993ec 100644
--- a/engines/pink/director.cpp
+++ b/engines/pink/director.cpp
@@ -42,7 +42,8 @@ void Director::update() {
_sounds[i]->update();
}
for (uint i = 0; i < _sprites.size(); ++i) {
- _sprites[i]->update();
+ if (_sprites[i]->needsUpdate())
+ _sprites[i]->update();
}
draw();
@@ -67,7 +68,6 @@ void Director::addSprite(ActionCEL *sprite) {
break;
}
_sprites[i] = sprite;
- _dirtyRects.push_back(sprite->getDecoder()->getRectangle());
}
void Director::removeSprite(ActionCEL *sprite) {
@@ -77,7 +77,7 @@ void Director::removeSprite(ActionCEL *sprite) {
break;
}
}
- _dirtyRects.push_back(sprite->getDecoder()->getRectangle());
+ _dirtyRects.push_back(sprite->getBounds());
}
void Director::removeSound(ActionSound *sound) {
@@ -113,7 +113,7 @@ Actor *Director::getActorByPoint(const Common::Point point) {
for (int i = _sprites.size() - 1; i >= 0; --i) {
CelDecoder *decoder = _sprites[i]->getDecoder();
const Graphics::Surface *frame = decoder->getCurrentFrame();
- const Common::Rect &rect = decoder->getRectangle();
+ const Common::Rect &rect = _sprites[i]->getBounds();
if (rect.contains(point)) {
byte spritePixel = *(const byte*) frame->getBasePtr(point.x - rect.left, point.y - rect.top);
if (spritePixel != decoder->getTransparentColourIndex())
@@ -125,13 +125,6 @@ Actor *Director::getActorByPoint(const Common::Point point) {
}
void Director::draw() {
- for (uint i = 0; i < _sprites.size(); ++i) {
- if (_sprites[i]->getDecoder()->needsUpdate()) {
- _sprites[i]->getDecoder()->decodeNextFrame();
- addDirtyRects(_sprites[i]);
- }
- }
-
if (!_dirtyRects.empty()) {
mergeDirtyRects();
@@ -165,8 +158,12 @@ void Director::mergeDirtyRects() {
}
}
+void Director::addDirtyRect(const Common::Rect &rect) {
+ _dirtyRects.push_back(rect);
+}
+
void Director::addDirtyRects(ActionCEL *sprite) {
- const Common::Rect spriteRect = sprite->getDecoder()->getRectangle();
+ const Common::Rect spriteRect = sprite->getBounds();
const Common::List<Common::Rect> *dirtyRects = sprite->getDecoder()->getDirtyRects();
if (dirtyRects->size() > 100) {
_dirtyRects.push_back(spriteRect);
@@ -183,7 +180,7 @@ void Director::addDirtyRects(ActionCEL *sprite) {
void Director::drawRect(const Common::Rect &rect) {
_surface.fillRect(rect, 0);
for (uint i = 0; i < _sprites.size(); ++i) {
- const Common::Rect &spriteRect = _sprites[i]->getDecoder()->getRectangle();
+ const Common::Rect &spriteRect = _sprites[i]->getBounds();
Common::Rect interRect = rect.findIntersectingRect(spriteRect);
if (interRect.isEmpty())
continue;
diff --git a/engines/pink/director.h b/engines/pink/director.h
index 4902c543..0526959 100644
--- a/engines/pink/director.h
+++ b/engines/pink/director.h
@@ -47,6 +47,9 @@ public:
void addSprite(ActionCEL *sprite);
void removeSprite(ActionCEL *sprite);
+ void addDirtyRect(const Common::Rect &rect);
+ void addDirtyRects(ActionCEL *sprite);
+
void addSound(ActionSound* sound) { _sounds.push_back(sound); };
void removeSound(ActionSound* sound);
@@ -66,7 +69,6 @@ public:
private:
void draw();
- void addDirtyRects(ActionCEL *sprite);
void mergeDirtyRects();
void drawRect(const Common::Rect &rect);
diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp
index 7efd077..7100344 100644
--- a/engines/pink/objects/actions/action_cel.cpp
+++ b/engines/pink/objects/actions/action_cel.cpp
@@ -21,6 +21,7 @@
*/
#include "common/debug.h"
+#include "common/substream.h"
#include "pink/archive.h"
#include "pink/cel_decoder.h"
@@ -31,9 +32,6 @@
namespace Pink {
-ActionCEL::ActionCEL()
- : _decoder(nullptr) {}
-
ActionCEL::~ActionCEL() {
end();
}
@@ -45,53 +43,79 @@ void ActionCEL::deserialize(Archive &archive) {
}
bool ActionCEL::initPalette(Director *director) {
- if (!_decoder)
- _decoder = _actor->getPage()->loadCel(_fileName);
- if (_decoder->getCurFrame() == -1) {
- _decoder->decodeNextFrame();
- _decoder->rewind();
+ loadDecoder();
+ if (_decoder.getCurFrame() == -1) {
+ _decoder.decodeNextFrame();
+ _decoder.rewind();
}
- debug("%u", _decoder->isPaused());
- director->setPallette(_decoder->getPalette());
+ director->setPallette(_decoder.getPalette());
return true;
}
void ActionCEL::start() {
- if (!_decoder)
- _decoder = _actor->getPage()->loadCel(_fileName);
+ loadDecoder();
+
+ Common::Point point = _decoder.getCenter();
+ _bounds = Common::Rect::center(point.x, point.y, _decoder.getWidth(), _decoder.getHeight());
+
+ _decoder.start();
this->onStart();
_actor->getPage()->getGame()->getDirector()->addSprite(this);
}
void ActionCEL::end() {
- if (!_decoder)
+ if (!_decoder.isVideoLoaded())
return;
- _actor->getPage()->getGame()->getDirector()->removeSprite(this);
- delete _decoder;
- _decoder = nullptr;
-}
-
-void ActionCEL::update() {
- if (_decoder->endOfVideo()) {
- _decoder->stop();
- _actor->endAction();
- }
+ closeDecoder();
}
void ActionCEL::pause(bool paused) {
- _decoder->pauseVideo(paused);
+ _decoder.pauseVideo(paused);
}
Coordinates ActionCEL::getCoordinates() {
- if (!_decoder)
- _decoder = _actor->getPage()->loadCel(_fileName);
+ loadDecoder();
Coordinates coords;
- coords.x = _decoder->getX() + _decoder->getWidth() / 2;
- coords.y = _decoder->getY() + _decoder->getHeight() / 2;
+ Common::Point point = _decoder.getCenter();
+ coords.x = point.x;
+ coords.y = point.y;
coords.z = getZ();
return coords;
}
+void ActionCEL::loadDecoder() {
+ if (!_decoder.isVideoLoaded())
+ _decoder.loadStream(_actor->getPage()->getResourceStream(_fileName));
+}
+
+void ActionCEL::closeDecoder() {
+ _actor->getPage()->getGame()->getDirector()->removeSprite(this);
+ _decoder.close();
+}
+
+
+void ActionCEL::setFrame(uint frame) {
+ _decoder.rewind();
+
+ for (uint i = 0; i < frame; ++i) {
+ _decoder.skipFrame();
+ }
+
+ _decoder.clearDirtyRects();
+}
+
+void ActionCEL::decodeNext() {
+ _decoder.decodeNextFrame();
+ _actor->getPage()->getGame()->getDirector()->addDirtyRects(this);
+}
+
+
+void ActionCEL::setCenter(const Common::Point ¢er) {
+ _actor->getPage()->getGame()->getDirector()->addDirtyRect(_bounds);
+ _bounds = Common::Rect::center(center.x, center.y, _decoder.getWidth(), _decoder.getHeight());
+ _actor->getPage()->getGame()->getDirector()->addDirtyRect(_bounds);
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_cel.h b/engines/pink/objects/actions/action_cel.h
index c67623a..62a4c45 100644
--- a/engines/pink/objects/actions/action_cel.h
+++ b/engines/pink/objects/actions/action_cel.h
@@ -23,6 +23,7 @@
#ifndef PINK_ACTION_CEL_H
#define PINK_ACTION_CEL_H
+#include "pink/cel_decoder.h"
#include "pink/objects/actions/action.h"
namespace Pink {
@@ -31,7 +32,6 @@ class CelDecoder;
class ActionCEL : public Action {
public:
- ActionCEL();
~ActionCEL() override;
void deserialize(Archive &archive) override;
@@ -41,20 +41,31 @@ public:
void start() override;
void end() override;
- virtual void update();
+ bool needsUpdate() { return _decoder.needsUpdate(); }
+ virtual void update() {};
void pause(bool paused) override;
Coordinates getCoordinates() override;
+ const Common::Rect &getBounds() const { return _bounds; }
uint32 getZ() { return _z; }
- CelDecoder *getDecoder() { return _decoder; }
+ CelDecoder *getDecoder() { return &_decoder; }
+
+ void setCenter(const Common::Point ¢er);
protected:
virtual void onStart() = 0;
- CelDecoder *_decoder;
+ void loadDecoder();
+ void closeDecoder();
+
+ void setFrame(uint frame);
+ void decodeNext();
+
+ CelDecoder _decoder;
Common::String _fileName;
+ Common::Rect _bounds;
uint32 _z;
};
diff --git a/engines/pink/objects/actions/action_loop.cpp b/engines/pink/objects/actions/action_loop.cpp
index f61ed5d..92b14b6 100644
--- a/engines/pink/objects/actions/action_loop.cpp
+++ b/engines/pink/objects/actions/action_loop.cpp
@@ -20,10 +20,13 @@
*
*/
-#include "pink/archive.h"
+#include "common/random.h"
+
+#include "pink/pink.h"
#include "pink/cel_decoder.h"
#include "pink/objects/actions/action_loop.h"
#include "pink/objects/actors/actor.h"
+#include "pink/objects/pages/page.h"
namespace Pink {
@@ -34,10 +37,10 @@ void ActionLoop::deserialize(Archive &archive) {
style = archive.readWORD();
switch (style) {
case kPingPong:
- _style = kPingPong;
+ _style = kPingPong;
break;
case kRandom:
- _style = kRandom;
+ _style = kRandom; // haven't seen
break;
default:
_style = kForward;
@@ -51,18 +54,68 @@ void ActionLoop::toConsole() {
}
void ActionLoop::update() {
- // for now it supports only forward loop animation
- if (_style == kForward) {
- if (_decoder->endOfVideo() || _decoder->getCurFrame() == _stopFrame) {
- //debug("ACTION LOOP : NEXT ITERATION");
- _decoder->rewind();
+ ActionCEL::update();
+ int frame = _decoder.getCurFrame();
+
+ if (!_inLoop) {
+ if (frame < _startFrame) {
+ decodeNext();
+ return;
}
+ else
+ _inLoop = true;
+ }
+
+ switch (_style) {
+ case kPingPong:
+ if (_forward) {
+ if (frame < _stopFrame) {
+ decodeNext();
+ } else {
+ _forward = false;
+ setFrame(_stopFrame - 1);
+ decodeNext();
+ }
+ }
+ else {
+ if (frame > _startFrame) {
+ setFrame(frame - 1);
+ } else {
+ _forward = true;
+ }
+ decodeNext();
+ }
+ break;
+ case kRandom: { // Not tested
+ Common::RandomSource &rnd = _actor->getPage()->getGame()->getRnd();
+ setFrame(rnd.getRandomNumberRng(_startFrame, _stopFrame));
+ break;
+ }
+ case kForward:
+ if (frame == _stopFrame) {
+ setFrame(_startFrame);
+ }
+ decodeNext();
+ break;
}
}
void ActionLoop::onStart() {
- ActionPlay::onStart();
- _actor->endAction();
+ if (_intro) {
+ uint startFrame = _startFrame;
+ _startFrame = 0;
+ ActionPlay::onStart();
+ _startFrame = startFrame;
+ _inLoop = false;
+ } else {
+ ActionPlay::onStart();
+ _inLoop = true;
+ }
+
+ if (!isTalk())
+ _actor->endAction();
+
+ _forward = true;
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_loop.h b/engines/pink/objects/actions/action_loop.h
index db02544..263d5a6 100644
--- a/engines/pink/objects/actions/action_loop.h
+++ b/engines/pink/objects/actions/action_loop.h
@@ -37,14 +37,17 @@ public:
protected:
void onStart() override;
+ virtual bool isTalk() { return false; }
enum Style {
kPingPong = 2,
kRandom = 3,
kForward = 4
};
- uint _intro;
Style _style;
+ bool _intro;
+ bool _inLoop;
+ bool _forward;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_play.cpp b/engines/pink/objects/actions/action_play.cpp
index 9af1900..629e52f 100644
--- a/engines/pink/objects/actions/action_play.cpp
+++ b/engines/pink/objects/actions/action_play.cpp
@@ -45,10 +45,11 @@ void ActionPlay::end() {
}
void ActionPlay::update() {
- if (_decoder->endOfVideo() || _decoder->getCurFrame() == _stopFrame) {
- _decoder->stop();
+ ActionCEL::update();
+ if (_decoder.getCurFrame() >= _stopFrame)
_actor->endAction();
- }
+ else
+ decodeNext();
}
void ActionPlay::pause(bool paused) {
@@ -57,12 +58,11 @@ void ActionPlay::pause(bool paused) {
void ActionPlay::onStart() {
debug("Actor %s has now ActionPlay %s", _actor->getName().c_str(), _name.c_str());
- _decoder->start();
- assert(_startFrame <= _decoder->getFrameCount());
- for (uint i = 0; i < _startFrame; ++i) {
- _decoder->skipFrame();
- }
- _decoder->decodeNextFrame();
+ if (_stopFrame == -1)
+ _stopFrame = _decoder.getFrameCount() - 1;
+ assert(_startFrame < _decoder.getFrameCount());
+ setFrame(_startFrame);
+ // doesn't need to decode startFrame here. Update method will decode
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_play_with_sfx.cpp b/engines/pink/objects/actions/action_play_with_sfx.cpp
index c4f07e8..6d0bb7a 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.cpp
+++ b/engines/pink/objects/actions/action_play_with_sfx.cpp
@@ -50,32 +50,25 @@ void ActionPlayWithSfx::toConsole() {
}
void ActionPlayWithSfx::update() {
- if ((_decoder->endOfVideo() || _decoder->getCurFrame() == _stopFrame) && _isLoop) {
- _decoder->rewind();
- } else if (_decoder->endOfVideo() || _decoder->getCurFrame() == _stopFrame) {
- _decoder->stop();
- _actor->endAction();
- }
+ int currFrame = _decoder.getCurFrame();
+ if (_isLoop && currFrame == _stopFrame) {
+ assert(_stopFrame == _decoder.getFrameCount() - 1); // to use ring frame
+ assert(_startFrame == 0); // same
+ _decoder.rewind();
+ decodeNext();
+ } else
+ ActionPlay::update();
- updateSound();
+ for (uint i = 0; i < _sfxArray.size(); ++i) {
+ if (_sfxArray[i]->getFrame() == currFrame)
+ _sfxArray[i]->play();
+ }
}
void ActionPlayWithSfx::onStart() {
ActionPlay::onStart();
- if (_isLoop) {
+ if (_isLoop)
_actor->endAction();
- }
- updateSound();
-}
-
-void ActionPlayWithSfx::updateSound() {
- if (!_actor->isPlaying() && !_isLoop)
- return;
-
- for (uint i = 0; i < _sfxArray.size(); ++i) {
- if (_sfxArray[i]->getFrame() == _decoder->getCurFrame())
- _sfxArray[i]->play();
- }
}
void ActionSfx::deserialize(Pink::Archive &archive) {
@@ -93,7 +86,7 @@ void ActionSfx::toConsole() {
void ActionSfx::play() {
Page *page = _sprite->getActor()->getPage();
if (!_sound.isPlaying()) {
- int8 balance = (_sprite->getDecoder()->getX() * 396875 / 1000000) - 127;
+ int8 balance = (_sprite->getDecoder()->getCenter().x * 396875 / 1000000) - 127;
_sound.play(page->getResourceStream(_sfxName), Audio::Mixer::kSFXSoundType, _volume, balance);
}
}
diff --git a/engines/pink/objects/actions/action_play_with_sfx.h b/engines/pink/objects/actions/action_play_with_sfx.h
index fdcb9c9..f357c8d 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.h
+++ b/engines/pink/objects/actions/action_play_with_sfx.h
@@ -44,8 +44,6 @@ protected:
void onStart() override;
private:
- void updateSound();
-
Array<ActionSfx *> _sfxArray;
uint32 _isLoop;
};
@@ -60,14 +58,14 @@ public:
void play();
- uint32 getFrame() { return _frame; }
+ int32 getFrame() { return _frame; }
private:
ActionPlayWithSfx *_sprite;
Common::String _sfxName;
Sound _sound;
- uint32 _volume;
- uint32 _frame;
+ int32 _volume;
+ int32 _frame;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_still.cpp b/engines/pink/objects/actions/action_still.cpp
index 78f0949..109ec15 100644
--- a/engines/pink/objects/actions/action_still.cpp
+++ b/engines/pink/objects/actions/action_still.cpp
@@ -48,13 +48,16 @@ void ActionStill::pause(bool paused) {}
void ActionStill::onStart() {
debug("Actor %s has now ActionStill %s", _actor->getName().c_str(), _name.c_str());
- if (_startFrame >= _decoder->getFrameCount())
+
+ if (_startFrame >= _decoder.getFrameCount())
_startFrame = 0;
- for (uint i = 0; i < _startFrame; ++i) {
- _decoder->skipFrame();
- }
- _decoder->decodeNextFrame();
- _decoder->stop();
+
+ setFrame(_startFrame); // seek to frame before startFrame
+ decodeNext(); // decode startFrame
+
+ _decoder.pauseVideo(1); // pause so that decoder doesn't need updates.
+ assert(!_decoder.needsUpdate());
+
_actor->endAction();
}
diff --git a/engines/pink/objects/actions/action_talk.cpp b/engines/pink/objects/actions/action_talk.cpp
index be64f0b..2fe0e0f 100644
--- a/engines/pink/objects/actions/action_talk.cpp
+++ b/engines/pink/objects/actions/action_talk.cpp
@@ -43,7 +43,7 @@ void ActionTalk::toConsole() {
void ActionTalk::update() {
ActionLoop::update();
if (!_sound.isPlaying()) {
- _decoder->stop();
+ _decoder.pauseVideo(1);
_actor->endAction();
}
}
@@ -59,10 +59,10 @@ void ActionTalk::pause(bool paused) {
}
void ActionTalk::onStart() {
- ActionPlay::onStart();
+ ActionLoop::onStart();
//sound balance is calculated different than in ActionSfx(probably a bug in original)
// 30.0 - x * -0.0625 disasm (0 - 100)
- int8 balance = (_decoder->getX() * 396875 / 1000000) - 127;
+ int8 balance = (_decoder.getCenter().x * 396875 / 1000000) - 127;
_sound.play(_actor->getPage()->getResourceStream(_vox), Audio::Mixer::kSpeechSoundType, 100, balance);
}
diff --git a/engines/pink/objects/actions/action_talk.h b/engines/pink/objects/actions/action_talk.h
index 1b8b60e..ec38ff7 100644
--- a/engines/pink/objects/actions/action_talk.h
+++ b/engines/pink/objects/actions/action_talk.h
@@ -43,6 +43,7 @@ public:
protected:
void onStart() override;
+ bool isTalk() override { return true; }
private:
Common::String _vox;
diff --git a/engines/pink/objects/actions/walk_action.cpp b/engines/pink/objects/actions/walk_action.cpp
index e4e3518..f798f9d 100644
--- a/engines/pink/objects/actions/walk_action.cpp
+++ b/engines/pink/objects/actions/walk_action.cpp
@@ -23,6 +23,7 @@
#include "pink/archive.h"
#include "pink/cel_decoder.h"
#include "pink/objects/actions/walk_action.h"
+#include "pink/objects/actors/actor.h"
namespace Pink {
@@ -38,7 +39,15 @@ void WalkAction::toConsole() {
}
void WalkAction::onStart() {
- _decoder->start();
+ // not implemented
+}
+
+void WalkAction::update() {
+ ActionCEL::update();
+ if (_decoder.getCurFrame() < (int)_decoder.getFrameCount() - 1)
+ decodeNext();
+ else
+ _actor->endAction();
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/walk_action.h b/engines/pink/objects/actions/walk_action.h
index ac41bcb..d311b9e 100644
--- a/engines/pink/objects/actions/walk_action.h
+++ b/engines/pink/objects/actions/walk_action.h
@@ -33,6 +33,8 @@ public:
void toConsole() override;
+ void update() override;
+
protected:
void onStart() override;
diff --git a/engines/pink/objects/pages/page.h b/engines/pink/objects/pages/page.h
index bda4c14..b8d0a81 100644
--- a/engines/pink/objects/pages/page.h
+++ b/engines/pink/objects/pages/page.h
@@ -47,7 +47,6 @@ public:
LeadActor *getLeadActor() { return _leadActor; }
Common::SafeSeekableSubReadStream *getResourceStream(const Common::String &fileName) { return _resMgr.getResourceStream(fileName); }
- CelDecoder *loadCel(Common::String &fileName) { return _resMgr.loadCEL(fileName); }
virtual void clear();
void pause(bool paused);
diff --git a/engines/pink/resource_mgr.cpp b/engines/pink/resource_mgr.cpp
index 6d99c69..6b68828 100644
--- a/engines/pink/resource_mgr.cpp
+++ b/engines/pink/resource_mgr.cpp
@@ -53,12 +53,6 @@ void ResourceMgr::clear() {
_resDescTable = nullptr;
}
-CelDecoder *ResourceMgr::loadCEL(Common::String &name) {
- CelDecoder *decoder = new CelDecoder();
- decoder->loadStream(getResourceStream(name));
- return decoder;
-}
-
Common::String ResourceMgr::loadText(Common::String &name) {
Common::SeekableReadStream *stream = getResourceStream(name);
char *txt = new char[stream->size()];
diff --git a/engines/pink/resource_mgr.h b/engines/pink/resource_mgr.h
index 5332953..7cfd2fb 100644
--- a/engines/pink/resource_mgr.h
+++ b/engines/pink/resource_mgr.h
@@ -52,7 +52,6 @@ public:
Common::SafeSeekableSubReadStream *getResourceStream(const Common::String &name);
- CelDecoder *loadCEL(Common::String &name);
Common::String loadText(Common::String &name);
PinkEngine *getGame() const { return _game; }
Commit: 471840514f148a1730dd7a7c281a062bcab5eeed
https://github.com/scummvm/scummvm/commit/471840514f148a1730dd7a7c281a062bcab5eeed
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix determination of Actor by point
Changed paths:
engines/pink/director.cpp
engines/pink/objects/actors/actor.h
engines/pink/objects/actors/cursor_actor.h
diff --git a/engines/pink/director.cpp b/engines/pink/director.cpp
index 14993ec..e5af990 100644
--- a/engines/pink/director.cpp
+++ b/engines/pink/director.cpp
@@ -27,6 +27,7 @@
#include "pink/director.h"
#include "pink/objects/actions/action_sound.h"
#include "pink/objects/actions/action_cel.h"
+#include "pink/objects/actors/actor.h"
namespace Pink {
Director::Director()
@@ -111,6 +112,8 @@ void Director::loadStage() {
Actor *Director::getActorByPoint(const Common::Point point) {
for (int i = _sprites.size() - 1; i >= 0; --i) {
+ if (_sprites[i]->getActor()->isCursor())
+ continue;
CelDecoder *decoder = _sprites[i]->getDecoder();
const Graphics::Surface *frame = decoder->getCurrentFrame();
const Common::Rect &rect = _sprites[i]->getBounds();
diff --git a/engines/pink/objects/actors/actor.h b/engines/pink/objects/actors/actor.h
index 2d42f37..6681862 100644
--- a/engines/pink/objects/actors/actor.h
+++ b/engines/pink/objects/actors/actor.h
@@ -57,6 +57,8 @@ public:
void endAction() { _isActionEnded = true; }
+ virtual bool isCursor() { return false; }
+
virtual bool isLeftClickHandlers() { return false; }
virtual bool isUseClickHandlers(InventoryItem *item) { return false; }
diff --git a/engines/pink/objects/actors/cursor_actor.h b/engines/pink/objects/actors/cursor_actor.h
index 8446b76..2d5eb28 100644
--- a/engines/pink/objects/actors/cursor_actor.h
+++ b/engines/pink/objects/actors/cursor_actor.h
@@ -39,6 +39,10 @@ public:
_actions[i]->toConsole();
}
}
+
+ bool isCursor() override {
+ return true;
+ }
};
} // End of namespace Pink
Commit: a37a7895dbfc3d71307e4e25c883a9eb1929e928
https://github.com/scummvm/scummvm/commit/a37a7895dbfc3d71307e4e25c883a9eb1929e928
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix item moving
Changed paths:
engines/pink/cursor_mgr.cpp
diff --git a/engines/pink/cursor_mgr.cpp b/engines/pink/cursor_mgr.cpp
index 99febcd..a7bfbf3 100644
--- a/engines/pink/cursor_mgr.cpp
+++ b/engines/pink/cursor_mgr.cpp
@@ -60,15 +60,11 @@ void CursorMgr::setCursor(uint index, const Common::Point point, const Common::S
if (action != _actor->getAction()) {
_actor->setAction(action);
- CelDecoder *decoder = static_cast<ActionCEL*>(action)->getDecoder();
- decoder->setX(point.x);
- decoder->setY(point.y);
- } else {
- CelDecoder *decoder = static_cast<ActionCEL*>(action)->getDecoder();
- decoder->setX(point.x);
- decoder->setY(point.y);
}
+ ActionCEL *sprite = static_cast<ActionCEL*>(action);
+ sprite->setCenter(point);
+
}
void CursorMgr::update() {
Commit: e0fa8fe1711efbd52e4148ee6efa7df8e7f45d26
https://github.com/scummvm/scummvm/commit/e0fa8fe1711efbd52e4148ee6efa7df8e7f45d26
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix ActionLoop Random
Changed paths:
engines/pink/objects/actions/action_loop.cpp
diff --git a/engines/pink/objects/actions/action_loop.cpp b/engines/pink/objects/actions/action_loop.cpp
index 92b14b6..79946ad 100644
--- a/engines/pink/objects/actions/action_loop.cpp
+++ b/engines/pink/objects/actions/action_loop.cpp
@@ -89,6 +89,7 @@ void ActionLoop::update() {
case kRandom: { // Not tested
Common::RandomSource &rnd = _actor->getPage()->getGame()->getRnd();
setFrame(rnd.getRandomNumberRng(_startFrame, _stopFrame));
+ decodeNext();
break;
}
case kForward:
Commit: 5282560ba1d1768625a7b5134de7a1e5df59a8b6
https://github.com/scummvm/scummvm/commit/5282560ba1d1768625a7b5134de7a1e5df59a8b6
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix drawing of some sprites after setting frame
Changed paths:
engines/pink/objects/actions/action_cel.cpp
diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp
index 7100344..a2cf192 100644
--- a/engines/pink/objects/actions/action_cel.cpp
+++ b/engines/pink/objects/actions/action_cel.cpp
@@ -95,7 +95,6 @@ void ActionCEL::closeDecoder() {
_decoder.close();
}
-
void ActionCEL::setFrame(uint frame) {
_decoder.rewind();
@@ -104,6 +103,7 @@ void ActionCEL::setFrame(uint frame) {
}
_decoder.clearDirtyRects();
+ _actor->getPage()->getGame()->getDirector()->addDirtyRect(_bounds);
}
void ActionCEL::decodeNext() {
@@ -111,7 +111,6 @@ void ActionCEL::decodeNext() {
_actor->getPage()->getGame()->getDirector()->addDirtyRects(this);
}
-
void ActionCEL::setCenter(const Common::Point ¢er) {
_actor->getPage()->getGame()->getDirector()->addDirtyRect(_bounds);
_bounds = Common::Rect::center(center.x, center.y, _decoder.getWidth(), _decoder.getHeight());
Commit: 02524d81c8727ebcb61100df6b88eb25a77bed41
https://github.com/scummvm/scummvm/commit/02524d81c8727ebcb61100df6b88eb25a77bed41
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: remove sprite unnecessary updating by another hack
Changed paths:
engines/pink/cel_decoder.cpp
engines/pink/cel_decoder.h
engines/pink/objects/actions/action_play.cpp
engines/pink/objects/actions/action_still.cpp
engines/pink/objects/actions/action_talk.cpp
engines/pink/objects/actions/walk_action.cpp
diff --git a/engines/pink/cel_decoder.cpp b/engines/pink/cel_decoder.cpp
index fc8918e..9604037 100644
--- a/engines/pink/cel_decoder.cpp
+++ b/engines/pink/cel_decoder.cpp
@@ -80,6 +80,11 @@ void CelDecoder::skipFrame() {
track->skipFrame();
}
+void CelDecoder::setEndOfTrack() {
+ CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
+ track->setEndOfTrack();
+}
+
CelDecoder::CelVideoTrack::CelVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height, bool skipHeader)
: FlicVideoTrack(stream, frameCount, width, height, 1), _center(0,0), _transparentColourIndex(0){
readHeader();
diff --git a/engines/pink/cel_decoder.h b/engines/pink/cel_decoder.h
index be67f35..1e9cb41 100644
--- a/engines/pink/cel_decoder.h
+++ b/engines/pink/cel_decoder.h
@@ -37,6 +37,8 @@ public:
const Graphics::Surface *getCurrentFrame();
void skipFrame();
+ void setEndOfTrack();
+
protected:
class CelVideoTrack : public FlicVideoTrack {
public:
@@ -48,6 +50,7 @@ protected:
uint16 getTransparentColourIndex();
// Hack. Pink needs so that Track needed an update after lastFrame delay ends
+ void setEndOfTrack() { _curFrame = _frameCount; }
bool endOfTrack() const override { return getCurFrame() >= getFrameCount(); }
Common::Point getCenter();
diff --git a/engines/pink/objects/actions/action_play.cpp b/engines/pink/objects/actions/action_play.cpp
index 629e52f..bc93eba 100644
--- a/engines/pink/objects/actions/action_play.cpp
+++ b/engines/pink/objects/actions/action_play.cpp
@@ -46,8 +46,11 @@ void ActionPlay::end() {
void ActionPlay::update() {
ActionCEL::update();
- if (_decoder.getCurFrame() >= _stopFrame)
+ if (_decoder.getCurFrame() >= _stopFrame) {
+ _decoder.setEndOfTrack();
+ assert(!_decoder.needsUpdate());
_actor->endAction();
+ }
else
decodeNext();
}
diff --git a/engines/pink/objects/actions/action_still.cpp b/engines/pink/objects/actions/action_still.cpp
index 109ec15..5bd645b 100644
--- a/engines/pink/objects/actions/action_still.cpp
+++ b/engines/pink/objects/actions/action_still.cpp
@@ -55,7 +55,7 @@ void ActionStill::onStart() {
setFrame(_startFrame); // seek to frame before startFrame
decodeNext(); // decode startFrame
- _decoder.pauseVideo(1); // pause so that decoder doesn't need updates.
+ _decoder.setEndOfTrack();
assert(!_decoder.needsUpdate());
_actor->endAction();
diff --git a/engines/pink/objects/actions/action_talk.cpp b/engines/pink/objects/actions/action_talk.cpp
index 2fe0e0f..2144d8a 100644
--- a/engines/pink/objects/actions/action_talk.cpp
+++ b/engines/pink/objects/actions/action_talk.cpp
@@ -43,7 +43,8 @@ void ActionTalk::toConsole() {
void ActionTalk::update() {
ActionLoop::update();
if (!_sound.isPlaying()) {
- _decoder.pauseVideo(1);
+ _decoder.setEndOfTrack();
+ assert(!_decoder.needsUpdate());
_actor->endAction();
}
}
diff --git a/engines/pink/objects/actions/walk_action.cpp b/engines/pink/objects/actions/walk_action.cpp
index f798f9d..24b43db 100644
--- a/engines/pink/objects/actions/walk_action.cpp
+++ b/engines/pink/objects/actions/walk_action.cpp
@@ -46,8 +46,10 @@ void WalkAction::update() {
ActionCEL::update();
if (_decoder.getCurFrame() < (int)_decoder.getFrameCount() - 1)
decodeNext();
- else
+ else {
+ _decoder.setEndOfTrack();
_actor->endAction();
+ }
}
} // End of namespace Pink
Commit: a38a02d71ce99901d06905d6d632c45f1c5af80a
https://github.com/scummvm/scummvm/commit/a38a02d71ce99901d06905d6d632c45f1c5af80a
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix CEL rewinding
Changed paths:
engines/pink/cel_decoder.cpp
diff --git a/engines/pink/cel_decoder.cpp b/engines/pink/cel_decoder.cpp
index 9604037..ef46c53 100644
--- a/engines/pink/cel_decoder.cpp
+++ b/engines/pink/cel_decoder.cpp
@@ -209,7 +209,7 @@ bool CelDecoder::CelVideoTrack::rewind() {
// 2) I changed behaviour of endOfTrack
_nextFrameStartTime = 0;
- if (getCurFrame() >= getFrameCount() - 1 && _fileStream->pos() < _fileStream->size())
+ if (_curFrame >= (int) _frameCount - 1 && _fileStream->pos() < _fileStream->size())
_atRingFrame = true;
else
_fileStream->seek(_offsetFrame1);
Commit: 9db2368028373beafedd7b6a7ce8e6c6dcf7126f
https://github.com/scummvm/scummvm/commit/9db2368028373beafedd7b6a7ce8e6c6dcf7126f
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix toConsole method
Changed paths:
engines/pink/objects/actors/inventory_actor.h
diff --git a/engines/pink/objects/actors/inventory_actor.h b/engines/pink/objects/actors/inventory_actor.h
index d36b5f8..660fec5 100644
--- a/engines/pink/objects/actors/inventory_actor.h
+++ b/engines/pink/objects/actors/inventory_actor.h
@@ -33,7 +33,7 @@ namespace Pink {
class InventoryActor : public Actor {
public:
void toConsole() override {
- debug("CursorActor: _name = %s", _name.c_str());
+ debug("InventoryActor: _name = %s", _name.c_str());
for (uint i = 0; i < _actions.size(); ++i) {
_actions[i]->toConsole();
}
Commit: def6698164c5c9e7b790b11908a055fdf0f261b1
https://github.com/scummvm/scummvm/commit/def6698164c5c9e7b790b11908a055fdf0f261b1
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: add init method to InventoryActor
Changed paths:
engines/pink/objects/actors/inventory_actor.h
diff --git a/engines/pink/objects/actors/inventory_actor.h b/engines/pink/objects/actors/inventory_actor.h
index 660fec5..cfd4408 100644
--- a/engines/pink/objects/actors/inventory_actor.h
+++ b/engines/pink/objects/actors/inventory_actor.h
@@ -40,6 +40,10 @@ public:
}
void pause(bool paused) override {}
+
+ void init(bool paused) override {
+ Actor::init(0);
+ }
};
} // End of namespace Pink
Commit: 7b651e41c62c64a63ef012bdc8c0ee61b6448ccf
https://github.com/scummvm/scummvm/commit/7b651e41c62c64a63ef012bdc8c0ee61b6448ccf
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: move the same code to functions(getInventoryMgr and getActorByPoint)
Changed paths:
engines/pink/objects/actors/actor.cpp
engines/pink/objects/actors/actor.h
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/actors/lead_actor.h
engines/pink/objects/condition.cpp
engines/pink/objects/inventory.cpp
engines/pink/objects/side_effect.cpp
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index 25e2a85..8954d6c 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -134,4 +134,8 @@ void Actor::setAction(Action *newAction, bool unk) {
}
}
+InventoryMgr *Actor::getInventoryMgr() const {
+ return _page->getModule()->getInventoryMgr();
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/actor.h b/engines/pink/objects/actors/actor.h
index 6681862..9d00f6a 100644
--- a/engines/pink/objects/actors/actor.h
+++ b/engines/pink/objects/actors/actor.h
@@ -76,6 +76,8 @@ public:
Action *getAction() const { return _action; }
Page *getPage() const { return _page; }
+ InventoryMgr *getInventoryMgr() const;
+
virtual const Common::String &getLocation() const;
void setAction(const Common::String &name) { setAction(findAction(name)); }
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index c4e41b1..2891682 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -89,7 +89,7 @@ void LeadActor::init(bool unk) {
if (_state == kUnk_Loading)
_state = kReady;
- _page->getModule()->getInventoryMgr()->setLeadActor(this);
+ getInventoryMgr()->setLeadActor(this);
_page->getGame()->setLeadActor(this);
Actor::init(unk);
}
@@ -100,14 +100,15 @@ void LeadActor::start(bool isHandler) {
_nextState = kReady;
}
+ InventoryMgr *mgr = getInventoryMgr();
switch (_state) {
case kInventory:
- _page->getModule()->getInventoryMgr()->start(0);
+ mgr->start(0);
_page->pause(true);
break;
case kPDA:
if (_stateBeforePDA == kInventory) {
- _page->getModule()->getInventoryMgr()->start(0);
+ mgr->start(0);
_page->pause(true);
}
loadPDA(_page->getGame()->getPdaMgr().getSavedPageName());
@@ -136,7 +137,7 @@ void LeadActor::update() {
}
break;
case kInventory:
- getPage()->getModule()->getInventoryMgr()->update();
+ getInventoryMgr()->update();
break;
case kPDA:
getPage()->getGame()->getPdaMgr().update();
@@ -213,12 +214,10 @@ void LeadActor::onKeyboardButtonClick(Common::KeyCode code) {
}
void LeadActor::onLeftButtonClick(const Common::Point point) {
- InventoryMgr *invMgr = _page->getModule()->getInventoryMgr();
-
switch (_state) {
case kReady:
case kMoving: {
- Actor *actor = _page->getGame()->getDirector()->getActorByPoint(point);
+ Actor *actor = getActorByPoint(point);
if (this == actor) {
onClick();
@@ -246,7 +245,7 @@ void LeadActor::onLeftButtonClick(const Common::Point point) {
_page->getGame()->getPdaMgr().onLeftButtonClick(point);
break;
case kInventory:
- invMgr->onClick(point);
+ getInventoryMgr()->onClick(point);
break;
default:
break;
@@ -260,7 +259,7 @@ void LeadActor::onMouseMove(Common::Point point) {
}
void LeadActor::onMouseOver(const Common::Point point, CursorMgr *mgr) {
- if (_page->getModule()->getInventoryMgr()->isPinkOwnsAnyItems())
+ if (getInventoryMgr()->isPinkOwnsAnyItems())
_cursorMgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
else
Actor::onMouseOver(point, mgr);
@@ -276,7 +275,7 @@ void LeadActor::onClick() {
_recipient = nullptr;
_nextState = kReady;
}
- if (_page->getModule()->getInventoryMgr()->start(1)) {
+ if (getInventoryMgr()->start(1)) {
_stateCopy = _state;
_state = kInventory;
_page->pause(true);
@@ -317,7 +316,7 @@ bool LeadActor::isInteractingWith(Actor *actor) {
if (!_isHaveItem)
return actor->isLeftClickHandlers();
- return actor->isUseClickHandlers(_page->getModule()->getInventoryMgr()->getCurrentItem());
+ return actor->isUseClickHandlers(getInventoryMgr()->getCurrentItem());
}
void LeadActor::setNextExecutors(const Common::String &nextModule, const Common::String &nextPage) {
@@ -336,9 +335,8 @@ void LeadActor::updateCursor(const Common::Point point) {
switch (_state) {
case kReady:
case kMoving: {
- Director *director = _page->getGame()->getDirector();
- Actor *actor = director->getActorByPoint(point);
- InventoryItem *item = _page->getModule()->getInventoryMgr()->getCurrentItem();
+ Actor *actor = getActorByPoint(point);
+ InventoryItem *item = getInventoryMgr()->getCurrentItem();
if (_isHaveItem) {
if (actor) {
actor->onHover(point, item->getName(), _cursorMgr);
@@ -365,7 +363,7 @@ void LeadActor::updateCursor(const Common::Point point) {
}
bool LeadActor::sendUseClickMessage(Actor *actor) {
- InventoryMgr *mgr = _page->getModule()->getInventoryMgr();
+ InventoryMgr *mgr = getInventoryMgr();
_nextState = _state != kPlayingVideo ? kReady : kPlayingVideo;
_state = kInDialog1;
InventoryItem *item = mgr->getCurrentItem();
@@ -385,6 +383,10 @@ WalkLocation *LeadActor::getWalkDestination() {
return _walkMgr->findLocation(_recipient->getLocation());
}
+Actor *LeadActor::getActorByPoint(const Common::Point point) {
+ return _page->getGame()->getDirector()->getActorByPoint(point);
+}
+
void ParlSqPink::toConsole() {
debug("ParlSqPink: _name = %s", _name.c_str());
for (uint i = 0; i < _actions.size(); ++i) {
@@ -421,9 +423,9 @@ void PubPink::onVariableSet() {
void PubPink::updateCursor(const Common::Point point) {
if (playingMiniGame()) {
- Actor *actor = _page->getGame()->getDirector()->getActorByPoint(point);
+ Actor *actor = getActorByPoint(point);
assert(actor);
- if (_state == kReady && actor->isUseClickHandlers(_page->getModule()->getInventoryMgr()->getCurrentItem())) {
+ if (_state == kReady && actor->isUseClickHandlers(getInventoryMgr()->getCurrentItem())) {
_cursorMgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
} else
_cursorMgr->setCursor(kDefaultCursor, point, Common::String());
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index 5b2ea70..22d783e 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -70,6 +70,7 @@ public:
void onKeyboardButtonClick(Common::KeyCode code);
void onLeftButtonClick(const Common::Point point);
+ void onRightButtonClick(const Common::Point point);
void onMouseMove(const Common::Point point);
@@ -87,6 +88,8 @@ public:
State getState() const { return _state; }
+ Actor *getActorByPoint(const Common::Point point);
+
protected:
void forceUpdateCursor();
diff --git a/engines/pink/objects/condition.cpp b/engines/pink/objects/condition.cpp
index abb9550..1329556 100644
--- a/engines/pink/objects/condition.cpp
+++ b/engines/pink/objects/condition.cpp
@@ -79,7 +79,7 @@ void ConditionInventoryItemOwner::deserialize(Archive &archive) {
}
bool ConditionInventoryItemOwner::evaluate(Actor *actor) {
- InventoryMgr *mgr = actor->getPage()->getModule()->getInventoryMgr();
+ InventoryMgr *mgr = actor->getInventoryMgr();
InventoryItem *item = mgr->findInventoryItem(_item);
return item->getCurrentOwner() == _owner;
}
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
index 2082869..bfbff3e 100644
--- a/engines/pink/objects/inventory.cpp
+++ b/engines/pink/objects/inventory.cpp
@@ -142,7 +142,7 @@ void InventoryMgr::onClick(Common::Point point) {
if (_state != kReady)
return;
- Actor *actor = _lead->getPage()->getGame()->getDirector()->getActorByPoint(point);
+ Actor *actor = _lead->getActorByPoint(point);
if (actor == _itemActor || actor == _window) {
if (actor->getAction()->getName() == "WBook") {
_lead->loadPDA("TOC");
diff --git a/engines/pink/objects/side_effect.cpp b/engines/pink/objects/side_effect.cpp
index 3bf67e1..fe43261 100644
--- a/engines/pink/objects/side_effect.cpp
+++ b/engines/pink/objects/side_effect.cpp
@@ -66,7 +66,7 @@ void SideEffectInventoryItemOwner::deserialize(Archive &archive) {
}
void SideEffectInventoryItemOwner::execute(Actor *actor) {
- InventoryMgr *mgr = actor->getPage()->getModule()->getInventoryMgr();
+ InventoryMgr *mgr = actor->getInventoryMgr();
InventoryItem *item = mgr->findInventoryItem(_item);
mgr->setItemOwner(_owner, item);
}
Commit: 84af69cdf6e91c342090d9c8c9f3c3aaf008043f
https://github.com/scummvm/scummvm/commit/84af69cdf6e91c342090d9c8c9f3c3aaf008043f
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: move same code to startInventory function
Changed paths:
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/actors/lead_actor.h
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 2891682..8f48df5 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -103,14 +103,11 @@ void LeadActor::start(bool isHandler) {
InventoryMgr *mgr = getInventoryMgr();
switch (_state) {
case kInventory:
- mgr->start(0);
- _page->pause(true);
+ startInventory(1);
break;
case kPDA:
- if (_stateBeforePDA == kInventory) {
- mgr->start(0);
- _page->pause(true);
- }
+ if (_stateBeforePDA == kInventory)
+ startInventory(1);
loadPDA(_page->getGame()->getPdaMgr().getSavedPageName());
break;
default:
@@ -275,11 +272,7 @@ void LeadActor::onClick() {
_recipient = nullptr;
_nextState = kReady;
}
- if (getInventoryMgr()->start(1)) {
- _stateCopy = _state;
- _state = kInventory;
- _page->pause(true);
- }
+ startInventory(0);
}
}
@@ -387,6 +380,17 @@ Actor *LeadActor::getActorByPoint(const Common::Point point) {
return _page->getGame()->getDirector()->getActorByPoint(point);
}
+void LeadActor::startInventory(bool fromSave) {
+ getInventoryMgr()->start(fromSave);
+ if (!fromSave) {
+ _isHaveItem = false;
+ _stateCopy = _state;
+ _state = kInventory;
+ forceUpdateCursor();
+ }
+ _page->pause(true);
+}
+
void ParlSqPink::toConsole() {
debug("ParlSqPink: _name = %s", _name.c_str());
for (uint i = 0; i < _actions.size(); ++i) {
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index 22d783e..c4c0748 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -100,6 +100,8 @@ protected:
virtual WalkLocation *getWalkDestination();
+ void startInventory(bool fromSave);
+
Actor *_recipient;
CursorMgr *_cursorMgr;
Commit: 2c4336cd8c21da30fd7204ec3fc6205ad449c4c6
https://github.com/scummvm/scummvm/commit/2c4336cd8c21da30fd7204ec3fc6205ad449c4c6
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: move the same code to function setReadyAfterWalk
Changed paths:
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/actors/lead_actor.h
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 8f48df5..4d09281 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -155,10 +155,8 @@ void LeadActor::update() {
void LeadActor::loadPDA(const Common::String &pageName) {
if (_state != kPDA) {
- if (_state == kMoving) {
- _recipient = nullptr;
- _nextState = kReady;
- }
+ if (_state == kMoving)
+ setReadyAfterWalk();
if (_state != kInventory)
_page->pause(true);
@@ -268,10 +266,8 @@ void LeadActor::onClick() {
_nextState = (_state != kMoving) ?
kUnk_Loading : kReady;
} else {
- if (_state == kMoving) {
- _recipient = nullptr;
- _nextState = kReady;
- }
+ if (_state == kMoving)
+ setReadyAfterWalk();
startInventory(0);
}
}
@@ -391,6 +387,11 @@ void LeadActor::startInventory(bool fromSave) {
_page->pause(true);
}
+void LeadActor::setReadyAfterWalk() {
+ _recipient = nullptr;
+ _nextState = kReady;
+}
+
void ParlSqPink::toConsole() {
debug("ParlSqPink: _name = %s", _name.c_str());
for (uint i = 0; i < _actions.size(); ++i) {
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index c4c0748..9e1f8cb 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -102,6 +102,8 @@ protected:
void startInventory(bool fromSave);
+ void setReadyAfterWalk();
+
Actor *_recipient;
CursorMgr *_cursorMgr;
Commit: cf8971ae453562dcdf2aa0016d1c458e321b8e79
https://github.com/scummvm/scummvm/commit/cf8971ae453562dcdf2aa0016d1c458e321b8e79
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: implemented skipping of walk
Changed paths:
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/actors/lead_actor.h
engines/pink/objects/walk/walk_mgr.cpp
engines/pink/objects/walk/walk_mgr.h
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 4d09281..0c59c2e 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -177,10 +177,10 @@ void LeadActor::onKeyboardButtonClick(Common::KeyCode code) {
case kMoving:
switch (code) {
case Common::KEYCODE_ESCAPE:
- // set unk variables
+ setReadyAfterWalk();
// Fall Through intended
case Common::KEYCODE_SPACE:
- //skip walking animation
+ _walkMgr->skip();
default:
break;
}
@@ -280,7 +280,7 @@ void LeadActor::onInventoryClosed(bool isItemClicked) {
forceUpdateCursor();
}
-void LeadActor::onWalkEnd() {
+void LeadActor::onWalkEnd(const Common::String &stopName) {
State oldNextState = _nextState;
_state = kReady;
_nextState = kUnk_Loading;
@@ -290,6 +290,11 @@ void LeadActor::onWalkEnd() {
else
sendLeftClickMessage(_recipient);
}
+ else {
+ Action *action = findAction(stopName);
+ assert(action);
+ setAction(action);
+ }
}
void LeadActor::onPDAClose() {
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index 9e1f8cb..e632e7b 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -79,7 +79,7 @@ public:
virtual void onClick();
virtual void onVariableSet() {}
void onInventoryClosed(bool isItemClicked);
- void onWalkEnd();
+ void onWalkEnd(const Common::String &stopName);
void onPDAClose();
bool isInteractingWith(Actor *actor);
diff --git a/engines/pink/objects/walk/walk_mgr.cpp b/engines/pink/objects/walk/walk_mgr.cpp
index 1336991..7e88ac9 100644
--- a/engines/pink/objects/walk/walk_mgr.cpp
+++ b/engines/pink/objects/walk/walk_mgr.cpp
@@ -135,7 +135,7 @@ void WalkMgr::update() {
void WalkMgr::end() {
_isWalking = false;
- _leadActor->onWalkEnd();
+ _leadActor->onWalkEnd(_destination->getName());
}
void WalkMgr::loadState(Archive &archive) {
@@ -160,4 +160,10 @@ void WalkMgr::saveState(Archive &archive) {
}
}
+void WalkMgr::skip() {
+ initNextWayPoint(_destination);
+ _current = _next;
+ end();
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/walk/walk_mgr.h b/engines/pink/objects/walk/walk_mgr.h
index a836bfc..dd08e61 100644
--- a/engines/pink/objects/walk/walk_mgr.h
+++ b/engines/pink/objects/walk/walk_mgr.h
@@ -56,6 +56,8 @@ public:
void loadState(Archive &archive);
void saveState(Archive &archive);
+ void skip();
+
private:
struct WayPoint {
Common::String name;
Commit: b6658eb9a8e90cfa3bba494f1934a0f8ca5727cf
https://github.com/scummvm/scummvm/commit/b6658eb9a8e90cfa3bba494f1934a0f8ca5727cf
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: add soundSettings syncing
Changed paths:
engines/pink/pink.cpp
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index a940ea9..d8e2738 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -90,6 +90,8 @@ Common::Error PinkEngine::init() {
_orb.loadGame(this);
+ syncSoundSettings();
+
if (ConfMan.hasKey("save_slot"))
loadGameState(ConfMan.getInt("save_slot"));
else
Commit: 2c6ab1c77581b6486a5e496c0d7a5aa00db144ee
https://github.com/scummvm/scummvm/commit/2c6ab1c77581b6486a5e496c0d7a5aa00db144ee
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix inventory opening
Changed paths:
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/inventory.cpp
engines/pink/objects/inventory.h
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 0c59c2e..e05d50c 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -381,9 +381,9 @@ Actor *LeadActor::getActorByPoint(const Common::Point point) {
return _page->getGame()->getDirector()->getActorByPoint(point);
}
-void LeadActor::startInventory(bool fromSave) {
- getInventoryMgr()->start(fromSave);
- if (!fromSave) {
+void LeadActor::startInventory(bool paused) {
+ getInventoryMgr()->start(paused);
+ if (!paused) {
_isHaveItem = false;
_stateCopy = _state;
_state = kInventory;
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
index bfbff3e..f812759 100644
--- a/engines/pink/objects/inventory.cpp
+++ b/engines/pink/objects/inventory.cpp
@@ -98,7 +98,7 @@ void InventoryMgr::setItemOwner(const Common::String &owner, InventoryItem *item
_item = item;
}
-bool InventoryMgr::start(bool playOpening) {
+bool InventoryMgr::start(bool paused) {
if (!_item) {
_item = findInventoryItem(_lead->getName());
if (!_item)
@@ -110,7 +110,7 @@ bool InventoryMgr::start(bool playOpening) {
_rightArrow = _lead->getPage()->findActor(kInventoryRightArrowActor);
_leftArrow = _lead->getPage()->findActor(kInventoryLeftArrowActor);
- if (playOpening) {
+ if (!paused) {
_window->setAction(kOpenAction);
_state = kOpening;
}
diff --git a/engines/pink/objects/inventory.h b/engines/pink/objects/inventory.h
index 836aa7f..c9357fc 100644
--- a/engines/pink/objects/inventory.h
+++ b/engines/pink/objects/inventory.h
@@ -59,7 +59,7 @@ public:
void update();
void onClick(Common::Point point);
- bool start(bool playOpening);
+ bool start(bool paused);
void setLeadActor(LeadActor *lead) { _lead = lead; }
InventoryItem* findInventoryItem(const Common::String &name);
Commit: ed250751467542f0b8ef63b5e8077a48838ec9a2
https://github.com/scummvm/scummvm/commit/ed250751467542f0b8ef63b5e8077a48838ec9a2
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: rewrite onLeftButtonClick
Changed paths:
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/actors/lead_actor.h
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index e05d50c..33b5bd5 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -212,28 +212,20 @@ void LeadActor::onLeftButtonClick(const Common::Point point) {
switch (_state) {
case kReady:
case kMoving: {
- Actor *actor = getActorByPoint(point);
+ Actor *clickedActor = getActorByPoint(point);
- if (this == actor) {
+ if (this == clickedActor) {
onClick();
return;
}
- _recipient = actor;
- if (isInteractingWith(_recipient)) {
- WalkLocation *location = getWalkDestination();
- if (location) {
- _state = kMoving;
- _nextState = kInDialog1;
- _walkMgr->start(location);
- } else if (_state == kReady) {
- if (_isHaveItem)
- sendUseClickMessage(_recipient);
- else
- sendLeftClickMessage(_recipient);
- }
+ _recipient = clickedActor;
+ if (isInteractingWith(clickedActor) && !startWalk()) {
+ if (_isHaveItem)
+ sendUseClickMessage(clickedActor);
+ else
+ sendLeftClickMessage(clickedActor);
}
-
break;
}
case kPDA:
@@ -392,6 +384,18 @@ void LeadActor::startInventory(bool paused) {
_page->pause(true);
}
+bool LeadActor::startWalk() {
+ WalkLocation *location = getWalkDestination();
+ if (location) {
+ _state = kMoving;
+ _nextState = kInDialog1;
+ _walkMgr->start(location);
+ return true;
+ }
+
+ return false;
+}
+
void LeadActor::setReadyAfterWalk() {
_recipient = nullptr;
_nextState = kReady;
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index e632e7b..43ad2ee 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -100,7 +100,8 @@ protected:
virtual WalkLocation *getWalkDestination();
- void startInventory(bool fromSave);
+ void startInventory(bool paused);
+ bool startWalk();
void setReadyAfterWalk();
Commit: 60d423cabb407c9859f68e34cdc4c5056a414ccd
https://github.com/scummvm/scummvm/commit/60d423cabb407c9859f68e34cdc4c5056a414ccd
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: implement AudioInfoManager
Changed paths:
A engines/pink/audio_info_mgr.cpp
A engines/pink/audio_info_mgr.h
A engines/pink/objects/actors/audio_info_pda_button.cpp
engines/pink/objects/actors/actor.cpp
engines/pink/objects/actors/actor.h
engines/pink/objects/actors/audio_info_pda_button.h
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/actors/lead_actor.h
engines/pink/objects/actors/supporting_actor.cpp
engines/pink/objects/actors/supporting_actor.h
engines/pink/pink.cpp
engines/pink/pink.h
diff --git a/engines/pink/audio_info_mgr.cpp b/engines/pink/audio_info_mgr.cpp
new file mode 100644
index 0000000..6f559fe
--- /dev/null
+++ b/engines/pink/audio_info_mgr.cpp
@@ -0,0 +1,88 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "pink/audio_info_mgr.h"
+#include "pink/archive.h"
+#include "pink/objects/actors/lead_actor.h"
+
+namespace Pink {
+
+AudioInfoMgr::AudioInfoMgr(LeadActor *lead)
+ : _lead(lead) {}
+
+void AudioInfoMgr::loadState(Archive &archive) {
+ _aboutWhom = archive.readString();
+}
+
+void AudioInfoMgr::saveState(Archive &archive) {
+ archive.writeString(_aboutWhom);
+}
+
+void AudioInfoMgr::start(Actor *actor) {
+ if (!actor->getPDALink().empty()) {
+ _aboutWhom = actor->getName();
+ playAudio();
+ showPDAButton();
+ } else
+ stop();
+}
+
+void AudioInfoMgr::stop() {
+ if (!_aboutWhom.empty()) {
+ stopAudio();
+ hidePDAButton();
+ _aboutWhom.clear();
+ }
+}
+
+void AudioInfoMgr::onLeftClick() {
+ Actor *actor = _lead->findActor(_aboutWhom);
+ assert(actor);
+ _lead->loadPDA(actor->getPDALink());
+ stopAudio();
+}
+
+void AudioInfoMgr::playAudio() {
+ Actor *audioInfo = _lead->findActor("AudioInfo");
+ assert(audioInfo);
+ audioInfo->setAction(_aboutWhom);
+}
+
+void AudioInfoMgr::stopAudio() {
+ Actor *audioInfo = _lead->findActor("AudioInfo");
+ assert(audioInfo);
+ audioInfo->setAction("Idle");
+}
+
+void AudioInfoMgr::showPDAButton() {
+ Actor *pdaButton = _lead->findActor("PDAButton");
+ assert(pdaButton);
+ pdaButton->setAction("Show");
+}
+
+void AudioInfoMgr::hidePDAButton() {
+ Actor *pdaButton = _lead->findActor("PDAButton");
+ assert(pdaButton);
+ pdaButton->setAction("Hide");
+}
+
+} // End of namespace Pink
diff --git a/engines/pink/audio_info_mgr.h b/engines/pink/audio_info_mgr.h
new file mode 100644
index 0000000..655f175
--- /dev/null
+++ b/engines/pink/audio_info_mgr.h
@@ -0,0 +1,61 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PINK_AUDIO_INFO_MGR_H
+#define PINK_AUDIO_INFO_MGR_H
+
+#include "common/str.h"
+
+namespace Pink {
+
+class Actor;
+class LeadActor;
+class Archive;
+
+class AudioInfoMgr {
+public:
+ AudioInfoMgr(LeadActor *lead);
+
+ void loadState(Archive &archive);
+ void saveState(Archive &archive);
+
+ void start(Actor *actor);
+ void stop();
+
+ void onLeftClick();
+
+private:
+ void playAudio();
+ void stopAudio();
+
+ void showPDAButton();
+ void hidePDAButton();
+
+private:
+ Common::String _aboutWhom;
+ LeadActor *_lead;
+};
+
+} // End of namespace Pink
+
+
+#endif
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index 8954d6c..42c9e2d 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -138,4 +138,9 @@ InventoryMgr *Actor::getInventoryMgr() const {
return _page->getModule()->getInventoryMgr();
}
+const Common::String &Actor::getPDALink() const {
+ static const Common::String empty;
+ return empty;
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/actor.h b/engines/pink/objects/actors/actor.h
index 9d00f6a..7927c1b 100644
--- a/engines/pink/objects/actors/actor.h
+++ b/engines/pink/objects/actors/actor.h
@@ -78,6 +78,8 @@ public:
InventoryMgr *getInventoryMgr() const;
+ virtual const Common::String &getPDALink() const;
+
virtual const Common::String &getLocation() const;
void setAction(const Common::String &name) { setAction(findAction(name)); }
diff --git a/engines/pink/objects/actors/audio_info_pda_button.cpp b/engines/pink/objects/actors/audio_info_pda_button.cpp
new file mode 100644
index 0000000..a5505de
--- /dev/null
+++ b/engines/pink/objects/actors/audio_info_pda_button.cpp
@@ -0,0 +1,50 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "pink/objects/actors/audio_info_pda_button.h"
+#include "pink/objects/actors/lead_actor.h"
+#include "pink/objects/pages/page.h"
+
+namespace Pink {
+
+void AudioInfoPDAButton::toConsole() {
+ debug("AudioInfoPDAButton: _name = %s", _name.c_str());
+ for (uint i = 0; i < _actions.size(); ++i) {
+ _actions[i]->toConsole();
+ }
+}
+
+void AudioInfoPDAButton::onMouseOver(Common::Point point, CursorMgr *mgr) {
+ mgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
+}
+
+void AudioInfoPDAButton::onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) {
+ onMouseOver(point, cursorMgr);
+}
+
+bool AudioInfoPDAButton::onLeftClickMessage() {
+ AudioInfoMgr *audioInfoMgr = _page->getLeadActor()->getAudioInfoMgr();
+ audioInfoMgr->onLeftClick();
+ return true;
+}
+
+} // End of namespace Pink
diff --git a/engines/pink/objects/actors/audio_info_pda_button.h b/engines/pink/objects/actors/audio_info_pda_button.h
index f54edd6..4631baf 100644
--- a/engines/pink/objects/actors/audio_info_pda_button.h
+++ b/engines/pink/objects/actors/audio_info_pda_button.h
@@ -34,20 +34,12 @@ namespace Pink {
class AudioInfoPDAButton : public Actor {
public:
- void toConsole() override {
- debug("AudioInfoPDAButton: _name = %s", _name.c_str());
- for (uint i = 0; i < _actions.size(); ++i) {
- _actions[i]->toConsole();
- }
- }
-
- void onMouseOver(Common::Point point, CursorMgr *mgr) override {
- mgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
- }
-
- void onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) override {
- onMouseOver(point, cursorMgr);
- }
+ void toConsole();
+
+ void onMouseOver(Common::Point point, CursorMgr *mgr);
+ void onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) override;
+
+ bool onLeftClickMessage() override;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 33b5bd5..1db74d2 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -36,7 +36,7 @@ namespace Pink {
LeadActor::LeadActor()
: _state(kReady), _nextState(kReady), _isHaveItem(false),
_recipient(nullptr), _cursorMgr(nullptr), _walkMgr(nullptr),
- _sequencer(nullptr) {}
+ _sequencer(nullptr), _audioInfoMgr(this) {}
void LeadActor::deserialize(Archive &archive) {
_state = kReady;
@@ -156,7 +156,7 @@ void LeadActor::update() {
void LeadActor::loadPDA(const Common::String &pageName) {
if (_state != kPDA) {
if (_state == kMoving)
- setReadyAfterWalk();
+ setNextStateReady();
if (_state != kInventory)
_page->pause(true);
@@ -177,7 +177,7 @@ void LeadActor::onKeyboardButtonClick(Common::KeyCode code) {
case kMoving:
switch (code) {
case Common::KEYCODE_ESCAPE:
- setReadyAfterWalk();
+ setNextStateReady();
// Fall Through intended
case Common::KEYCODE_SPACE:
_walkMgr->skip();
@@ -215,17 +215,21 @@ void LeadActor::onLeftButtonClick(const Common::Point point) {
Actor *clickedActor = getActorByPoint(point);
if (this == clickedActor) {
+ _audioInfoMgr.stop();
onClick();
- return;
}
+ else if (isInteractingWith(clickedActor)) {
+ _recipient = clickedActor;
+ if (!startWalk()) {
+ _audioInfoMgr.stop();
+ if (_isHaveItem)
+ sendUseClickMessage(clickedActor);
+ else
+ sendLeftClickMessage(clickedActor);
+ }
+ } else
+ clickedActor->onLeftClickMessage();
- _recipient = clickedActor;
- if (isInteractingWith(clickedActor) && !startWalk()) {
- if (_isHaveItem)
- sendUseClickMessage(clickedActor);
- else
- sendLeftClickMessage(clickedActor);
- }
break;
}
case kPDA:
@@ -239,6 +243,19 @@ void LeadActor::onLeftButtonClick(const Common::Point point) {
}
}
+void LeadActor::onRightButtonClick(const Common::Point point) {
+ if (_state == kReady || _state == kMoving) {
+ Actor *clickedActor = getActorByPoint(point);
+ if (isInteractingWith(clickedActor)) {
+ _audioInfoMgr.start(clickedActor);
+ }
+
+ if (_state == kMoving)
+ setNextStateReady();
+ }
+}
+
+
void LeadActor::onMouseMove(Common::Point point) {
if (_state != kPDA)
updateCursor(point);
@@ -259,7 +276,7 @@ void LeadActor::onClick() {
kUnk_Loading : kReady;
} else {
if (_state == kMoving)
- setReadyAfterWalk();
+ setNextStateReady();
startInventory(0);
}
}
@@ -396,11 +413,15 @@ bool LeadActor::startWalk() {
return false;
}
-void LeadActor::setReadyAfterWalk() {
+void LeadActor::setNextStateReady() {
_recipient = nullptr;
_nextState = kReady;
}
+Actor *LeadActor::findActor(const Common::String &name) {
+ return _page->findActor(name);
+}
+
void ParlSqPink::toConsole() {
debug("ParlSqPink: _name = %s", _name.c_str());
for (uint i = 0; i < _actions.size(); ++i) {
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index 43ad2ee..3e585a6 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -27,6 +27,7 @@
#include "common/keyboard.h"
#include "pink/objects/actors/actor.h"
+#include "pink/audio_info_mgr.h"
namespace Pink {
@@ -88,8 +89,12 @@ public:
State getState() const { return _state; }
+ AudioInfoMgr *getAudioInfoMgr() { return &_audioInfoMgr; }
+
Actor *getActorByPoint(const Common::Point point);
+ Actor *findActor(const Common::String &name);
+
protected:
void forceUpdateCursor();
@@ -103,7 +108,7 @@ protected:
void startInventory(bool paused);
bool startWalk();
- void setReadyAfterWalk();
+ void setNextStateReady();
Actor *_recipient;
@@ -111,6 +116,8 @@ protected:
WalkMgr *_walkMgr;
Sequencer *_sequencer;
+ AudioInfoMgr _audioInfoMgr;
+
State _state;
State _nextState;
State _stateCopy;
diff --git a/engines/pink/objects/actors/supporting_actor.cpp b/engines/pink/objects/actors/supporting_actor.cpp
index ea2a49e..8262267 100644
--- a/engines/pink/objects/actors/supporting_actor.cpp
+++ b/engines/pink/objects/actors/supporting_actor.cpp
@@ -88,4 +88,8 @@ const Common::String &SupportingActor::getLocation() const {
return _location;
}
+const Common::String &SupportingActor::getPDALink() const {
+ return _pdaLink;
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/supporting_actor.h b/engines/pink/objects/actors/supporting_actor.h
index 1d200d2..7f53a3e 100644
--- a/engines/pink/objects/actors/supporting_actor.h
+++ b/engines/pink/objects/actors/supporting_actor.h
@@ -47,6 +47,7 @@ public:
bool onLeftClickMessage() override;
bool onUseClickMessage(InventoryItem *item, InventoryMgr *mgr) override;
+ const Common::String &getPDALink() const override;
const Common::String &getLocation() const override;
private:
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index d8e2738..dfa072b 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -74,7 +74,7 @@ Common::Error PinkEngine::init() {
const Common::String orbName = _desc.filesDescriptions[0].fileName;
const Common::String broName = _desc.filesDescriptions[1].fileName;
- if (strcmp(_desc.gameId, kPeril) == 0)
+ if (isPeril())
_bro = new BroFile();
else
debug("This game doesn't need to use bro");
@@ -118,6 +118,10 @@ Common::Error Pink::PinkEngine::run() {
case Common::EVENT_LBUTTONDOWN:
_actor->onLeftButtonClick(event.mouse);
break;
+ case Common::EVENT_RBUTTONDOWN:
+ if (isPeril())
+ _actor->onRightButtonClick(event.mouse);
+ break;
case Common::EVENT_KEYDOWN:
_actor->onKeyboardButtonClick(event.kbd.keycode);
break;
@@ -196,7 +200,7 @@ bool PinkEngine::checkValueOfVariable(Common::String &variable, Common::String &
bool PinkEngine::loadCursors() {
Common::PEResources exeResources;
- bool isPokus = !strcmp(_desc.gameId, kPokus);
+ bool isPokus = !isPeril();
Common::String fileName = isPokus ? _desc.filesDescriptions[1].fileName : _desc.filesDescriptions[2].fileName;
if (!exeResources.loadFromEXE(fileName))
return false;
@@ -312,6 +316,10 @@ void PinkEngine::pauseEngineIntern(bool pause) {
_system->showMouse(!pause);
}
+bool PinkEngine::isPeril() {
+ return !strcmp(_desc.gameId, "peril");
+}
+
Common::String generateSaveName(int slot, const char *gameId) {
return Common::String::format("%s.s%02d", gameId, slot);
}
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index 299de3f..cd05152 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -96,6 +96,8 @@ public:
virtual Common::Error saveGameState(int slot, const Common::String &desc);
virtual bool canSaveGameStateCurrently();
+ bool isPeril();
+
void load(Archive &archive);
void initModule(const Common::String &moduleName, const Common::String &pageName, Archive *saveFile);
void changeScene(Page *page);
Commit: 14cc810cef4c3ae46ffb62768c1cb79295a34720
https://github.com/scummvm/scummvm/commit/14cc810cef4c3ae46ffb62768c1cb79295a34720
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: update engine description
Changed paths:
engines/pink/pink.h
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index cd05152..141f010 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -57,11 +57,8 @@
* sequences by timer are broken (HandlerTimerSequences)
*
* Known bugs:
- * High CPU usage(no dirty rects)
* Walking sprites don't recalculate position
- * Walking can't be skipped
- * PDA doesn't work
- *
+ * PDA is not usable
*/
namespace Pink {
Commit: d2218ad8cd7984871b37e572e464360fb6b5530c
https://github.com/scummvm/scummvm/commit/d2218ad8cd7984871b37e572e464360fb6b5530c
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Engine class code cleanup
Changed paths:
engines/pink/pink.cpp
engines/pink/pink.h
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index dfa072b..177e72c 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -20,8 +20,6 @@
*
*/
-#include <graphics/thumbnail.h>
-#include <graphics/surface.h>
#include "common/debug-channels.h"
#include "common/winexe_pe.h"
#include "common/config-manager.h"
@@ -29,6 +27,8 @@
#include "engines/util.h"
#include "graphics/cursorman.h"
+#include "graphics/thumbnail.h"
+#include "graphics/surface.h"
#include "pink/pink.h"
#include "pink/console.h"
@@ -86,7 +86,6 @@ Common::Error PinkEngine::init() {
return Common::kNoGameDataFoundError;
setCursor(kLoadingCursor);
- _system->showMouse(1);
_orb.loadGame(this);
@@ -123,11 +122,8 @@ Common::Error Pink::PinkEngine::run() {
_actor->onRightButtonClick(event.mouse);
break;
case Common::EVENT_KEYDOWN:
- _actor->onKeyboardButtonClick(event.kbd.keycode);
+ _actor->onKeyboardButtonClick(event.kbd.keycode);
break;
- // don't know why it is used in original
- case Common::EVENT_LBUTTONUP:
- case Common::EVENT_RBUTTONDOWN:
default:
break;
}
@@ -148,48 +144,53 @@ void PinkEngine::load(Archive &archive) {
}
void PinkEngine::initModule(const Common::String &moduleName, const Common::String &pageName, Archive *saveFile) {
- if (_module) {
- for (uint i = 0; i < _modules.size(); ++i) {
- if (_module == _modules[i]) {
- _modules[i] = new ModuleProxy(_module->getName());
+ if (_module)
+ removeModule();
- delete _module;
- _module = nullptr;
+ addModule(moduleName);
+ if (saveFile)
+ _module->loadState(*saveFile);
- break;
- }
- }
- }
+ _module->init(saveFile ? kLoadingSave : kLoadingNewGame, pageName);
+}
+
+void PinkEngine::changeScene() {
+ setCursor(kLoadingCursor);
+ _director.clear();
+
+ if (!_nextModule.empty() && _nextModule != _module->getName())
+ initModule(_nextModule, _nextPage, nullptr);
+ else
+ _module->changePage(_nextPage);
+}
+
+void PinkEngine::addModule(const Common::String &moduleName) {
+ _module = new Module(this, moduleName);
+
+ _orb.loadObject(_module, _module->getName());
for (uint i = 0; i < _modules.size(); ++i) {
if (_modules[i]->getName() == moduleName) {
- loadModule(i);
- _module = static_cast<Module*>(_modules[i]);
- if (saveFile)
- _module->loadState(*saveFile);
- _module->init( saveFile ? kLoadingSave : kLoadingNewGame, pageName);
+ delete _modules[i];
+ _modules[i] = _module;
break;
}
}
}
-void PinkEngine::changeScene(Page *page) {
- setCursor(kLoadingCursor);
- if (!_nextModule.empty() && _nextModule.compareTo(_module->getName())) {
- initModule(_nextModule, _nextPage, nullptr);
- } else {
- assert(!_nextPage.empty());
- _module->changePage(_nextPage);
+void PinkEngine::removeModule() {
+ for (uint i = 0; i < _modules.size(); ++i) {
+ if (_module == _modules[i]) {
+ _modules[i] = new ModuleProxy(_module->getName());
+ delete _module;
+ _module = nullptr;
+ break;
+ }
}
}
-void PinkEngine::loadModule(int index) {
- Module *module = new Module(this, _modules[index]->getName());
-
- _orb.loadObject(module, module->getName());
-
- delete _modules[index];
- _modules[index] = module;
+void PinkEngine::setVariable(Common::String &variable, Common::String &value) {
+ _variables[variable] = value;
}
bool PinkEngine::checkValueOfVariable(Common::String &variable, Common::String &value) {
@@ -313,7 +314,6 @@ bool PinkEngine::hasFeature(Engine::EngineFeature f) const {
void PinkEngine::pauseEngineIntern(bool pause) {
Engine::pauseEngineIntern(pause);
_director.pause(pause);
- _system->showMouse(!pause);
}
bool PinkEngine::isPeril() {
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index 141f010..f022582 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -83,21 +83,26 @@ public:
PinkEngine(OSystem *system, const ADGameDescription *desc);
~PinkEngine();
- virtual Common::Error run();
+ Common::Error run() override;
- virtual bool hasFeature(EngineFeature f) const;
+ bool hasFeature(EngineFeature f) const override;
- virtual Common::Error loadGameState(int slot);
- virtual bool canLoadGameStateCurrently();
+ virtual Common::Error loadGameState(int slot) override;
+ bool canLoadGameStateCurrently() override;
- virtual Common::Error saveGameState(int slot, const Common::String &desc);
- virtual bool canSaveGameStateCurrently();
+ Common::Error saveGameState(int slot, const Common::String &desc) override;
+ bool canSaveGameStateCurrently() override;
- bool isPeril();
+protected:
+ virtual void pauseEngineIntern(bool pause) override;
+public:
void load(Archive &archive);
- void initModule(const Common::String &moduleName, const Common::String &pageName, Archive *saveFile);
- void changeScene(Page *page);
+
+ void changeScene();
+
+ void setVariable(Common::String &variable, Common::String &value);
+ bool checkValueOfVariable(Common::String &variable, Common::String &value);
OrbFile *getOrb() { return &_orb; }
BroFile *getBro() { return _bro; }
@@ -109,18 +114,18 @@ public:
void setLeadActor(LeadActor *actor) { _actor = actor; };
void setCursor(uint cursorIndex);
- void setVariable(Common::String &variable, Common::String &value) { _variables[variable] = value; }
- bool checkValueOfVariable(Common::String &variable, Common::String &value);
-
-protected:
- virtual void pauseEngineIntern(bool pause);
-
private:
Common::Error init();
+
bool loadCursors();
- void loadModule(int index);
+ void initModule(const Common::String &moduleName, const Common::String &pageName, Archive *saveFile);
+ void addModule(const Common::String &moduleName);
+ void removeModule();
+
+ bool isPeril();
+private:
Console *_console;
Common::RandomSource _rnd;
Common::Array<Graphics::WinCursorGroup *> _cursors;
Commit: 1af15bf46bb47b689c9cda2c27a03db0f49d1c22
https://github.com/scummvm/scummvm/commit/1af15bf46bb47b689c9cda2c27a03db0f49d1c22
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: rework changing page routine
Changed paths:
engines/pink/objects/module.cpp
diff --git a/engines/pink/objects/module.cpp b/engines/pink/objects/module.cpp
index 30a1ae0..8743566 100644
--- a/engines/pink/objects/module.cpp
+++ b/engines/pink/objects/module.cpp
@@ -64,13 +64,8 @@ void Module::init(bool isLoadingSave, const Common::String &pageName) {
}
void Module::changePage(const Common::String &pageName) {
- GamePage *page = nullptr;
- page = findPage(pageName);
- assert(_page != page);
-
_page->unload();
-
- _page = page;
+ _page = findPage(pageName);
_page->init(kLoadingNewGame);
}
Commit: 64bb3baab8be289d211317da58637084d9656423
https://github.com/scummvm/scummvm/commit/64bb3baab8be289d211317da58637084d9656423
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix pausing when click on panther with empty inventory
Changed paths:
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/inventory.cpp
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 1db74d2..d5c04c4 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -391,7 +391,9 @@ Actor *LeadActor::getActorByPoint(const Common::Point point) {
}
void LeadActor::startInventory(bool paused) {
- getInventoryMgr()->start(paused);
+ if (!getInventoryMgr()->start(paused))
+ return;
+
if (!paused) {
_isHaveItem = false;
_stateCopy = _state;
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
index f812759..94a3163 100644
--- a/engines/pink/objects/inventory.cpp
+++ b/engines/pink/objects/inventory.cpp
@@ -99,11 +99,8 @@ void InventoryMgr::setItemOwner(const Common::String &owner, InventoryItem *item
}
bool InventoryMgr::start(bool paused) {
- if (!_item) {
- _item = findInventoryItem(_lead->getName());
- if (!_item)
- return false;
- }
+ if (!isPinkOwnsAnyItems())
+ return false;
_window = _lead->getPage()->findActor(kInventoryWindowActor);
_itemActor = _lead->getPage()->findActor(kInventoryItemActor);
Commit: 4701cbd7d5b30a1a00555ef3fd1cf0a16a02262d
https://github.com/scummvm/scummvm/commit/4701cbd7d5b30a1a00555ef3fd1cf0a16a02262d
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix rewinding of CEL files which have 1 frame.
Changed paths:
engines/pink/cel_decoder.cpp
diff --git a/engines/pink/cel_decoder.cpp b/engines/pink/cel_decoder.cpp
index ef46c53..4e5b8a0 100644
--- a/engines/pink/cel_decoder.cpp
+++ b/engines/pink/cel_decoder.cpp
@@ -194,7 +194,10 @@ const Graphics::Surface *CelDecoder::CelVideoTrack::decodeNextFrame() {
if (_atRingFrame) {
// If we decoded the ring frame, seek to the second frame
_atRingFrame = false;
- _fileStream->seek(_offsetFrame2);
+ if (_frameCount == 1) {
+ _fileStream->seek(_offsetFrame1);
+ } else
+ _fileStream->seek(_offsetFrame2);
}
if (_curFrame == 0)
Commit: 4af995079ab49865697102f234951d94cd3f1e74
https://github.com/scummvm/scummvm/commit/4af995079ab49865697102f234951d94cd3f1e74
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix playing looped ActionPlayWithSfx
Changed paths:
engines/pink/objects/actions/action_play_with_sfx.cpp
diff --git a/engines/pink/objects/actions/action_play_with_sfx.cpp b/engines/pink/objects/actions/action_play_with_sfx.cpp
index 6d0bb7a..2e94098 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.cpp
+++ b/engines/pink/objects/actions/action_play_with_sfx.cpp
@@ -52,9 +52,7 @@ void ActionPlayWithSfx::toConsole() {
void ActionPlayWithSfx::update() {
int currFrame = _decoder.getCurFrame();
if (_isLoop && currFrame == _stopFrame) {
- assert(_stopFrame == _decoder.getFrameCount() - 1); // to use ring frame
- assert(_startFrame == 0); // same
- _decoder.rewind();
+ setFrame(_startFrame);
decodeNext();
} else
ActionPlay::update();
Commit: e4402a90ebf15687b656a17bf080c74d9ee9a5b6
https://github.com/scummvm/scummvm/commit/e4402a90ebf15687b656a17bf080c74d9ee9a5b6
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: rework LeadActor states
Changed paths:
engines/pink/constants.h
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/actors/lead_actor.h
engines/pink/objects/module.cpp
engines/pink/objects/pages/game_page.cpp
engines/pink/pink.cpp
diff --git a/engines/pink/constants.h b/engines/pink/constants.h
index a641231..57336b0 100644
--- a/engines/pink/constants.h
+++ b/engines/pink/constants.h
@@ -156,8 +156,6 @@ static const char *kPinkGame = "PinkGame";
static const char *kPokus = "pokus";
static const char *kPeril = "peril";
-static const char *kUndefined = "UNDEFINED";
-
static const char *kCloseAction = "Close";
static const char *kIdleAction = "Idle";
static const char *kOpenAction = "Open";
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index d5c04c4..62dc177 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -56,7 +56,7 @@ void LeadActor::toConsole() {
void LeadActor::loadState(Archive &archive) {
_state = (State) archive.readByte();
_nextState = (State) archive.readByte();
- _stateCopy = (State) archive.readByte();
+ _stateBeforeInventory = (State) archive.readByte();
_stateBeforePDA = (State) archive.readByte();
_isHaveItem = archive.readByte();
Common::String recepient = archive.readString();
@@ -73,7 +73,7 @@ void LeadActor::loadState(Archive &archive) {
void LeadActor::saveState(Archive &archive) {
archive.writeByte(_state);
archive.writeByte(_nextState);
- archive.writeByte(_stateCopy);
+ archive.writeByte(_stateBeforeInventory);
archive.writeByte(_stateBeforePDA);
archive.writeByte(_isHaveItem);
if (_recipient)
@@ -86,7 +86,7 @@ void LeadActor::saveState(Archive &archive) {
}
void LeadActor::init(bool unk) {
- if (_state == kUnk_Loading)
+ if (_state == kUndefined)
_state = kReady;
getInventoryMgr()->setLeadActor(this);
@@ -95,8 +95,8 @@ void LeadActor::init(bool unk) {
}
void LeadActor::start(bool isHandler) {
- if (isHandler && _state != kPlayingVideo) {
- _state = kInDialog1;
+ if (isHandler && _state != kPlayingExitSequence) {
+ _state = kPlayingSequence;
_nextState = kReady;
}
@@ -125,12 +125,11 @@ void LeadActor::update() {
_walkMgr->update();
_cursorMgr->update();
break;
- case kInDialog1:
- case kInDialog2:
+ case kPlayingSequence:
_sequencer->update();
if (!_sequencer->_context) {
_state = _nextState;
- _nextState = kUnk_Loading;
+ _nextState = kUndefined;
}
break;
case kInventory:
@@ -139,15 +138,13 @@ void LeadActor::update() {
case kPDA:
getPage()->getGame()->getPdaMgr().update();
break;
- case kPlayingVideo:
+ case kPlayingExitSequence:
_sequencer->update();
if (!_sequencer->_context) {
- _state = kUnk_Loading;
- _page->getGame()->changeScene(_page);
+ _state = kUndefined;
+ _page->getGame()->changeScene();
}
break;
- case kUnk_Loading:
- break;
default:
break;
}
@@ -156,7 +153,7 @@ void LeadActor::update() {
void LeadActor::loadPDA(const Common::String &pageName) {
if (_state != kPDA) {
if (_state == kMoving)
- setNextStateReady();
+ cancelInteraction();
if (_state != kInventory)
_page->pause(true);
@@ -177,7 +174,7 @@ void LeadActor::onKeyboardButtonClick(Common::KeyCode code) {
case kMoving:
switch (code) {
case Common::KEYCODE_ESCAPE:
- setNextStateReady();
+ cancelInteraction();
// Fall Through intended
case Common::KEYCODE_SPACE:
_walkMgr->skip();
@@ -185,9 +182,8 @@ void LeadActor::onKeyboardButtonClick(Common::KeyCode code) {
break;
}
break;
- case kInDialog1:
- case kInDialog2:
- case kPlayingVideo:
+ case kPlayingSequence:
+ case kPlayingExitSequence:
switch (code) {
case Common::KEYCODE_SPACE:
case Common::KEYCODE_RIGHT:
@@ -217,8 +213,7 @@ void LeadActor::onLeftButtonClick(const Common::Point point) {
if (this == clickedActor) {
_audioInfoMgr.stop();
onClick();
- }
- else if (isInteractingWith(clickedActor)) {
+ } else if (isInteractingWith(clickedActor)) {
_recipient = clickedActor;
if (!startWalk()) {
_audioInfoMgr.stop();
@@ -251,7 +246,7 @@ void LeadActor::onRightButtonClick(const Common::Point point) {
}
if (_state == kMoving)
- setNextStateReady();
+ cancelInteraction();
}
}
@@ -271,20 +266,20 @@ void LeadActor::onMouseOver(const Common::Point point, CursorMgr *mgr) {
void LeadActor::onClick() {
if (_isHaveItem) {
+ assert(_state != kMoving);
_isHaveItem = false;
- _nextState = (_state != kMoving) ?
- kUnk_Loading : kReady;
+ _nextState = kUndefined;
} else {
if (_state == kMoving)
- setNextStateReady();
+ cancelInteraction();
startInventory(0);
}
}
void LeadActor::onInventoryClosed(bool isItemClicked) {
_isHaveItem = isItemClicked;
- _state = _stateCopy;
- _stateCopy = kUnk_Loading;
+ _state = _stateBeforeInventory;
+ _stateBeforeInventory = kUndefined;
_page->pause(false);
forceUpdateCursor();
}
@@ -292,14 +287,13 @@ void LeadActor::onInventoryClosed(bool isItemClicked) {
void LeadActor::onWalkEnd(const Common::String &stopName) {
State oldNextState = _nextState;
_state = kReady;
- _nextState = kUnk_Loading;
- if (_recipient && oldNextState == kInDialog1) {
+ _nextState = kUndefined;
+ if (_recipient && oldNextState == kPlayingSequence) {
if (_isHaveItem)
sendUseClickMessage(_recipient);
else
sendLeftClickMessage(_recipient);
- }
- else {
+ } else { // on ESC button
Action *action = findAction(stopName);
assert(action);
setAction(action);
@@ -323,8 +317,8 @@ bool LeadActor::isInteractingWith(Actor *actor) {
}
void LeadActor::setNextExecutors(const Common::String &nextModule, const Common::String &nextPage) {
- if (_state == kReady || _state == kMoving || _state == kInDialog1 || _state == kInventory || _state == kPDA) {
- _state = kPlayingVideo;
+ if (_state == kReady || _state == kMoving || _state == kPlayingSequence || _state == kInventory || _state == kPDA) {
+ _state = kPlayingExitSequence;
_page->getGame()->setNextExecutors(nextModule, nextPage);
}
}
@@ -351,9 +345,8 @@ void LeadActor::updateCursor(const Common::Point point) {
_cursorMgr->setCursor(kDefaultCursor, point, Common::String());
break;
}
- case kInDialog1:
- case kInDialog2:
- case kPlayingVideo:
+ case kPlayingSequence:
+ case kPlayingExitSequence:
_cursorMgr->setCursor(kNotClickableCursor, point, Common::String());
break;
case kPDA:
@@ -367,8 +360,9 @@ void LeadActor::updateCursor(const Common::Point point) {
bool LeadActor::sendUseClickMessage(Actor *actor) {
InventoryMgr *mgr = getInventoryMgr();
- _nextState = _state != kPlayingVideo ? kReady : kPlayingVideo;
- _state = kInDialog1;
+ assert(_state != kPlayingExitSequence);
+ _nextState = kReady;
+ _state = kPlayingSequence;
InventoryItem *item = mgr->getCurrentItem();
actor->onUseClickMessage(mgr->getCurrentItem(), mgr);
if (item->getCurrentOwner() != this->_name)
@@ -377,8 +371,9 @@ bool LeadActor::sendUseClickMessage(Actor *actor) {
}
bool LeadActor::sendLeftClickMessage(Actor *actor) {
- _nextState = _state != kPlayingVideo ? kReady : kPlayingVideo;
- _state = kInDialog1;
+ assert(_state != kPlayingExitSequence);
+ _nextState = kReady;
+ _state = kPlayingSequence;
return actor->onLeftClickMessage();
}
@@ -396,7 +391,7 @@ void LeadActor::startInventory(bool paused) {
if (!paused) {
_isHaveItem = false;
- _stateCopy = _state;
+ _stateBeforeInventory = _state;
_state = kInventory;
forceUpdateCursor();
}
@@ -407,7 +402,7 @@ bool LeadActor::startWalk() {
WalkLocation *location = getWalkDestination();
if (location) {
_state = kMoving;
- _nextState = kInDialog1;
+ _nextState = kPlayingSequence;
_walkMgr->start(location);
return true;
}
@@ -415,7 +410,7 @@ bool LeadActor::startWalk() {
return false;
}
-void LeadActor::setNextStateReady() {
+void LeadActor::cancelInteraction() {
_recipient = nullptr;
_nextState = kReady;
}
@@ -432,7 +427,7 @@ void ParlSqPink::toConsole() {
}
WalkLocation *ParlSqPink::getWalkDestination() {
- if (_recipient->getName() == kBoy && _page->checkValueOfVariable(kBoyBlocked, kUndefined))
+ if (_recipient->getName() == kBoy && _page->checkValueOfVariable(kBoyBlocked, "UNDEFINED"))
return _walkMgr->findLocation(kSirBaldley);
return LeadActor::getWalkDestination();
@@ -473,7 +468,7 @@ void PubPink::updateCursor(const Common::Point point) {
bool PubPink::sendUseClickMessage(Actor *actor) {
if (!LeadActor::sendUseClickMessage(actor) && playingMiniGame()) {
_nextState = _state;
- _state = kInDialog1;
+ _state = kPlayingSequence;
const char *roundName;
switch (_round++ % 3) {
@@ -511,7 +506,7 @@ WalkLocation *PubPink::getWalkDestination() {
bool PubPink::playingMiniGame() {
return !(_page->checkValueOfVariable(kFoodPuzzle, "TRUE") ||
- _page->checkValueOfVariable(kFoodPuzzle, kUndefined));
+ _page->checkValueOfVariable(kFoodPuzzle, "UNDEFINED"));
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index 3e585a6..e767653 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -46,12 +46,12 @@ public:
enum State {
kReady = 0,
kMoving = 1,
- kInDialog1 = 2, //???
+ kPlayingSequence = 2,
kInventory = 3,
kPDA = 4,
- kInDialog2 = 5,//???
- kPlayingVideo = 6, // ???
- kUnk_Loading = 7// ????
+ kUnknown = 5, // never used
+ kPlayingExitSequence = 6,
+ kUndefined = 7
};
void deserialize(Archive &archive) override;
@@ -108,7 +108,7 @@ protected:
void startInventory(bool paused);
bool startWalk();
- void setNextStateReady();
+ void cancelInteraction();
Actor *_recipient;
@@ -120,7 +120,7 @@ protected:
State _state;
State _nextState;
- State _stateCopy;
+ State _stateBeforeInventory;
State _stateBeforePDA;
bool _isHaveItem;
diff --git a/engines/pink/objects/module.cpp b/engines/pink/objects/module.cpp
index 8743566..ec17105 100644
--- a/engines/pink/objects/module.cpp
+++ b/engines/pink/objects/module.cpp
@@ -79,7 +79,7 @@ GamePage *Module::findPage(const Common::String &pageName) const {
bool Module::checkValueOfVariable(Common::String &variable, Common::String &value) {
if (!_variables.contains(variable))
- return value == kUndefined;
+ return value == "UNDEFINED";
return _variables[variable] == value;
}
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index 3596116..9f1aaed 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -118,7 +118,7 @@ void GamePage::loadManagers() {
bool GamePage::checkValueOfVariable(const Common::String &variable, const Common::String &value) {
if (!_variables.contains(variable))
- return value == kUndefined;
+ return value == "UNDEFINED";
return _variables[variable] == value;
}
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index 177e72c..6ac377b 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -195,7 +195,7 @@ void PinkEngine::setVariable(Common::String &variable, Common::String &value) {
bool PinkEngine::checkValueOfVariable(Common::String &variable, Common::String &value) {
if (!_variables.contains(variable))
- return value == kUndefined;
+ return value == "UNDEFINED";
return _variables[variable] == value;
}
Commit: bc4d32df8bb40b26d1999e08ecfe5d74f0e1e3b6
https://github.com/scummvm/scummvm/commit/bc4d32df8bb40b26d1999e08ecfe5d74f0e1e3b6
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: file code cleanup
Changed paths:
engines/pink/file.cpp
engines/pink/file.h
engines/pink/resource_mgr.cpp
diff --git a/engines/pink/file.cpp b/engines/pink/file.cpp
index 861ffc4..f14d459 100644
--- a/engines/pink/file.cpp
+++ b/engines/pink/file.cpp
@@ -20,10 +20,7 @@
*
*/
-#include "common/str.h"
-
#include "pink/pink.h"
-#include "pink/objects/pages/game_page.h"
namespace Pink {
@@ -31,7 +28,7 @@ void ObjectDescription::load(Common::File &file) {
file.read(name, sizeof(name));
objectsOffset = file.readUint32LE();
- objectsCount = file.readUint32LE();
+ /*objectsCount*/ file.readUint32LE();
resourcesOffset = file.readUint32LE();
resourcesCount = file.readUint32LE();
}
@@ -44,10 +41,8 @@ void ResourceDescription::load(Common::File &file) {
inBro = (bool) file.readUint16LE();
}
-
OrbFile::OrbFile()
: File(), _timestamp(0),
- _tableOffset(0),
_tableSize(0),
_table(nullptr) {}
@@ -56,28 +51,24 @@ OrbFile::~OrbFile() {
}
bool OrbFile::open(const Common::String &name) {
- if (!File::open(name))
- return false;
-
- if (readUint32BE() != 'ORB\0')
+ if (!File::open(name) || readUint32BE() != 'ORB\0')
return false;
uint16 minor = readUint16LE();
uint16 major = readUint16LE();
- debug("Orb v%hu.%hu loaded", major, minor);
-
if (major != kOrbMajorVersion || minor != kOrbMinorVersion)
return false;
if (!(_timestamp = readUint32LE()))
return false;
- _tableOffset = readUint32LE();
+ uint32 tableOffset = readUint32LE();
+
_tableSize = readUint32LE();
_table = new ObjectDescription[_tableSize];
- seek(_tableOffset);
+ seek(tableOffset);
for (uint i = 0; i < _tableSize; ++i) {
_table[i].load(*this);
@@ -115,7 +106,7 @@ ObjectDescription *OrbFile::getObjDesc(const char *name){
return desc;
}
-ResourceDescription *OrbFile::getResDescTable(ObjectDescription *objDesc){
+ResourceDescription *OrbFile::createResDescTable(ObjectDescription *objDesc){
ResourceDescription *table = new ResourceDescription[objDesc->resourcesCount];
seek(objDesc->resourcesOffset);
@@ -131,7 +122,6 @@ void OrbFile::seekToObject(const char *name) {
seek(desc->objectsOffset);
}
-
bool BroFile::open(const Common::String &name, uint32 orbTimestamp) {
if (!File::open(name) || readUint32BE() != 'BRO\0')
return false;
@@ -139,8 +129,6 @@ bool BroFile::open(const Common::String &name, uint32 orbTimestamp) {
uint16 minor = readUint16LE();
uint16 major = readUint16LE();
- debug("Bro v%hu.%hu loaded", major, minor);
-
if (major != kBroMajorVersion || minor != kBroMinorVersion)
return false;
diff --git a/engines/pink/file.h b/engines/pink/file.h
index 80b7ec6..9901a67 100644
--- a/engines/pink/file.h
+++ b/engines/pink/file.h
@@ -32,7 +32,7 @@ struct ObjectDescription {
char name[16];
uint32 objectsOffset;
- uint32 objectsCount;
+ //uint32 objectsCount; never used
uint32 resourcesOffset;
uint32 resourcesCount;
};
@@ -43,8 +43,7 @@ struct ResourceDescription {
char name[16];
uint32 offset;
uint32 size;
- bool inBro; // in original it is short.
- // Don't know what's better to use.(Perhaps no difference because of padding)
+ bool inBro;
};
class PinkEngine;
@@ -56,28 +55,28 @@ public:
virtual ~OrbFile();
virtual bool open(const Common::String &name);
+public:
void loadGame(PinkEngine *game);
void loadObject(Object *obj, const Common::String &name);
void loadObject(Object *obj, ObjectDescription *objDesc);
- ObjectDescription *getObjDesc(const char *name);
-
- ResourceDescription *getResDescTable(ObjectDescription *objDesc);
+ ResourceDescription *createResDescTable(ObjectDescription *objDesc);
+ ObjectDescription *getObjDesc(const char *name);
uint32 getTimestamp() { return _timestamp; }
private:
void seekToObject(const char *name);
+private:
ObjectDescription *_table;
- uint32 _timestamp;
- uint32 _tableOffset;
uint32 _tableSize;
+ uint32 _timestamp;
};
class BroFile : public Common::File {
public:
- virtual bool open(const Common::String &name, uint32 orbTimestamp);
+ bool open(const Common::String &name, uint32 orbTimestamp);
};
} // End of namespace Pink
diff --git a/engines/pink/resource_mgr.cpp b/engines/pink/resource_mgr.cpp
index 6b68828..b2652ff 100644
--- a/engines/pink/resource_mgr.cpp
+++ b/engines/pink/resource_mgr.cpp
@@ -45,7 +45,7 @@ void ResourceMgr::init(PinkEngine *game, Page *page) {
ObjectDescription *objDesc = orb->getObjDesc(page->getName().c_str());
_resCount = objDesc->resourcesCount;
orb->loadObject(page, objDesc);
- _resDescTable = orb->getResDescTable(objDesc);
+ _resDescTable = orb->createResDescTable(objDesc);
}
void ResourceMgr::clear() {
Commit: 861ef3be97eb7efca8d812aab953c8e0aaf32e08
https://github.com/scummvm/scummvm/commit/861ef3be97eb7efca8d812aab953c8e0aaf32e08
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: rework CursorMgr
Changed paths:
engines/pink/cursor_mgr.cpp
engines/pink/cursor_mgr.h
engines/pink/objects/actors/cursor_actor.h
engines/pink/pda_mgr.h
diff --git a/engines/pink/cursor_mgr.cpp b/engines/pink/cursor_mgr.cpp
index a7bfbf3..4686169 100644
--- a/engines/pink/cursor_mgr.cpp
+++ b/engines/pink/cursor_mgr.cpp
@@ -20,12 +20,10 @@
*
*/
-#include "pink/pink.h"
-#include "pink/cel_decoder.h"
#include "pink/cursor_mgr.h"
-#include "pink/objects/actions/action_cel.h"
-#include "pink/objects/actors/actor.h"
-#include "pink/objects/pages/game_page.h"
+#include "pink/pink.h"
+#include "pink/objects/pages/page.h"
+#include "pink/objects/actors/cursor_actor.h"
namespace Pink {
@@ -34,37 +32,23 @@ CursorMgr::CursorMgr(PinkEngine *game, Page *page)
_isPlayingAnimation(0), _firstFrameIndex(0) {}
void CursorMgr::setCursor(uint index, const Common::Point point, const Common::String &itemName) {
- if (index == kClickableFirstFrameCursor) {
+ switch (index) {
+ case kClickableFirstFrameCursor:
+ case kPDAClickableFirstFrameCursor:
startAnimation(index);
- return hideItem();
- } else if (index != kHoldingItemCursor) {
-
- if (index != kPDAClickableFirstFrameCursor) {
- _game->setCursor(index);
- _isPlayingAnimation = 0;
- return hideItem();
- }
-
hideItem();
- return startAnimation(index);
- }
-
- _game->setCursor(index);
- _isPlayingAnimation = 0;
-
- _actor = _actor ? _actor : _page->findActor(kCursor);
- assert(_actor);
-
- Action *action = _actor->findAction(itemName);
- assert(dynamic_cast<ActionCEL*>(action));
-
- if (action != _actor->getAction()) {
- _actor->setAction(action);
+ break;
+ case kHoldingItemCursor:
+ _game->setCursor(index);
+ _isPlayingAnimation = false;
+ showItem(itemName, point);
+ break;
+ default:
+ _game->setCursor(index);
+ _isPlayingAnimation = false;
+ hideItem();
+ break;
}
-
- ActionCEL *sprite = static_cast<ActionCEL*>(action);
- sprite->setCenter(point);
-
}
void CursorMgr::update() {
@@ -90,7 +74,7 @@ void CursorMgr::setCursor(const Common::String &cursorName, const Common::Point
//else
//assert(0);
- setCursor(index, point, Common::String());
+ setCursor(index, point, "");
}
void CursorMgr::hideItem() {
@@ -98,14 +82,21 @@ void CursorMgr::hideItem() {
_actor->setAction(kHideAction);
}
-void CursorMgr::startAnimation(int index) {
- if (!_isPlayingAnimation) {
- _isPlayingAnimation = 1;
- _time = _game->getTotalPlayTime();
- _firstFrameIndex = index;
- _isSecondFrame = 0;
- _game->setCursor(index);
- }
+void CursorMgr::startAnimation(uint index) {
+ if (_isPlayingAnimation)
+ return;
+
+ _game->setCursor(index);
+ _time = _game->getTotalPlayTime();
+ _firstFrameIndex = index;
+ _isPlayingAnimation = true;
+ _isSecondFrame = false;
+}
+
+void CursorMgr::showItem(const Common::String &itemName, const Common::Point point) {
+ if (!_actor)
+ _actor = static_cast<CursorActor*>(_page->findActor(kCursor));
+ _actor->setCursorItem(itemName, point);
}
} // End of namespace Pink
diff --git a/engines/pink/cursor_mgr.h b/engines/pink/cursor_mgr.h
index d7f17bb..231c87a 100644
--- a/engines/pink/cursor_mgr.h
+++ b/engines/pink/cursor_mgr.h
@@ -31,7 +31,7 @@
namespace Pink {
-class Actor;
+class CursorActor;
class Action;
class Page;
class PinkEngine;
@@ -47,16 +47,17 @@ public:
void setPage(Page *page) { _page = page; }
private:
+ void startAnimation(uint index);
+
+ void showItem(const Common::String &itemName, const Common::Point point);
void hideItem();
- void startAnimation(int index);
- Actor *_actor;
+private:
Page *_page;
PinkEngine *_game;
-
+ CursorActor *_actor;
uint _time;
uint _firstFrameIndex;
-
bool _isPlayingAnimation;
bool _isSecondFrame;
};
diff --git a/engines/pink/objects/actors/cursor_actor.h b/engines/pink/objects/actors/cursor_actor.h
index 2d5eb28..ff4c5de 100644
--- a/engines/pink/objects/actors/cursor_actor.h
+++ b/engines/pink/objects/actors/cursor_actor.h
@@ -25,12 +25,11 @@
#include "common/debug.h"
-#include "pink/objects/actions/action.h"
+#include "pink/objects/actions/action_cel.h"
#include "pink/objects/actors/actor.h"
namespace Pink {
-//same as actor
class CursorActor : public Actor {
public:
void toConsole() override {
@@ -43,6 +42,12 @@ public:
bool isCursor() override {
return true;
}
+
+ void setCursorItem(const Common::String &name, const Common::Point point) {
+ if (!_action || _action->getName() != name)
+ setAction(name);
+ static_cast<ActionCEL*>(_action)->setCenter(point);
+ }
};
} // End of namespace Pink
diff --git a/engines/pink/pda_mgr.h b/engines/pink/pda_mgr.h
index c2e09ee..5d84f49 100644
--- a/engines/pink/pda_mgr.h
+++ b/engines/pink/pda_mgr.h
@@ -24,11 +24,12 @@
#define PINK_PDA_MGR_H
#include "pink/cursor_mgr.h"
-#include "utils.h"
+#include "pink/utils.h"
namespace Pink {
class PinkEngine;
+class Actor;
class LeadActor;
class Command;
class PDAPage;
Commit: 9b8d72bfb53ce7b9eacc435f540b2b956f6fb759
https://github.com/scummvm/scummvm/commit/9b8d72bfb53ce7b9eacc435f540b2b956f6fb759
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix naming
Changed paths:
engines/pink/objects/actors/actor.cpp
engines/pink/objects/actors/actor.h
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/pages/game_page.cpp
engines/pink/objects/pages/page.cpp
engines/pink/objects/pages/page.h
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index 42c9e2d..7abab3c 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -71,7 +71,7 @@ void Actor::init(bool paused) {
}
}
-bool Actor::initPallete(Director *director) {
+bool Actor::initPalette(Director *director) {
for (uint i = 0; i < _actions.size(); ++i) {
if (_actions[i]->initPalette(director))
return true;
diff --git a/engines/pink/objects/actors/actor.h b/engines/pink/objects/actors/actor.h
index 7927c1b..cd84fd2 100644
--- a/engines/pink/objects/actors/actor.h
+++ b/engines/pink/objects/actors/actor.h
@@ -48,7 +48,7 @@ public:
void saveState(Archive &archive);
virtual void init(bool paused);
- bool initPallete(Director *director);
+ bool initPalette(Director *director);
void toConsole() override ;
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 62dc177..9f04e74 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -301,7 +301,7 @@ void LeadActor::onWalkEnd(const Common::String &stopName) {
}
void LeadActor::onPDAClose() {
- _page->initPallete();
+ _page->initPalette();
_page->getGame()->getDirector()->loadStage();
_state = _stateBeforePDA;
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index 9f1aaed..d383a9b 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -74,7 +74,7 @@ void GamePage::init(bool isLoadingSave) {
toConsole();
- initPallete();
+ initPalette();
LeadActor::State state = _leadActor->getState();
bool paused = (state == LeadActor::kInventory || state == LeadActor::kPDA);
diff --git a/engines/pink/objects/pages/page.cpp b/engines/pink/objects/pages/page.cpp
index c15d3db..086253d 100644
--- a/engines/pink/objects/pages/page.cpp
+++ b/engines/pink/objects/pages/page.cpp
@@ -54,15 +54,15 @@ void Page::toConsole() {
}
void Page::init() {
- initPallete();
+ initPalette();
for (uint i = 0; i < _actors.size(); ++i) {
_actors[i]->init(0);
}
}
-void Page::initPallete() {
+void Page::initPalette() {
for (uint i = 0; i < _actors.size(); ++i) {
- if (_actors[i]->initPallete(getGame()->getDirector()))
+ if (_actors[i]->initPalette(getGame()->getDirector()))
break;
}
}
diff --git a/engines/pink/objects/pages/page.h b/engines/pink/objects/pages/page.h
index b8d0a81..4fb8772 100644
--- a/engines/pink/objects/pages/page.h
+++ b/engines/pink/objects/pages/page.h
@@ -41,7 +41,7 @@ public:
void load(Archive &archive);
void init();
- void initPallete();
+ void initPalette();
Actor *findActor(const Common::String &name);
LeadActor *getLeadActor() { return _leadActor; }
Commit: 4aa908860b12a4b341937d3fa8a5dce23ba2a396
https://github.com/scummvm/scummvm/commit/4aa908860b12a4b341937d3fa8a5dce23ba2a396
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: add Hokus Pokus scripting system
Changed paths:
engines/pink/objects/handlers/handler_timer.cpp
engines/pink/objects/sequences/seq_timer.cpp
engines/pink/objects/sequences/sequence.h
engines/pink/objects/sequences/sequence_item.cpp
engines/pink/objects/sequences/sequencer.cpp
engines/pink/objects/sequences/sequencer.h
diff --git a/engines/pink/objects/handlers/handler_timer.cpp b/engines/pink/objects/handlers/handler_timer.cpp
index 46d3d57..dc1c9bd 100644
--- a/engines/pink/objects/handlers/handler_timer.cpp
+++ b/engines/pink/objects/handlers/handler_timer.cpp
@@ -105,6 +105,8 @@ void HandlerTimerSequences::handle(Actor *actor) {
Sequence *sequence = sequencer->findSequence(_sequences[index]);
assert(sequence);
+
+ sequencer->authorParallelSequence(sequence, 0);
}
} // End of namespace Pink
diff --git a/engines/pink/objects/sequences/seq_timer.cpp b/engines/pink/objects/sequences/seq_timer.cpp
index 95fe53b..7270c1a 100644
--- a/engines/pink/objects/sequences/seq_timer.cpp
+++ b/engines/pink/objects/sequences/seq_timer.cpp
@@ -54,7 +54,8 @@ void SeqTimer::update() {
Actor *actor = _sequencer->_page->findActor(_actor);
assert(actor);
- if (!_sequencer->findSequenceActorState(actor->getName())) {
+ if (!_sequencer->findMainSequenceActorState(actor->getName()) &&
+ !_sequencer->findParralelSequenceActorState(actor->getName())) {
actor->onTimerMessage();
}
}
diff --git a/engines/pink/objects/sequences/sequence.h b/engines/pink/objects/sequences/sequence.h
index c3439a1..0e92846 100644
--- a/engines/pink/objects/sequences/sequence.h
+++ b/engines/pink/objects/sequences/sequence.h
@@ -55,6 +55,9 @@ public:
public:
+ bool canAddContext(const Common::String name);
+
+
SequenceContext *_context;
Sequencer *_sequencer;
Array<SequenceItem *> _items;
diff --git a/engines/pink/objects/sequences/sequence_item.cpp b/engines/pink/objects/sequences/sequence_item.cpp
index cd21a10..72fb452 100644
--- a/engines/pink/objects/sequences/sequence_item.cpp
+++ b/engines/pink/objects/sequences/sequence_item.cpp
@@ -51,8 +51,9 @@ bool SequenceItem::execute(int index, Sequence *sequence, bool unk2) {
actor->setAction(action, unk2);
- SequenceActorState *state = sequence->_sequencer->findSequenceActorState(_actor);
- state->_index = index;
+ SequenceActorState *state = sequence->_sequencer->findMainSequenceActorState(_actor);
+ if (state)
+ state->_index = index;
sequence->_context->_actor = isLeader() ? actor : sequence->_context->_actor;
return true;
@@ -81,7 +82,7 @@ void SequenceItemLeaderAudio::toConsole() {
}
bool SequenceItemDefaultAction::execute(int index, Sequence *sequence, bool unk2) {
- SequenceActorState *state = sequence->_sequencer->findSequenceActorState(_actor);
+ SequenceActorState *state = sequence->_sequencer->findMainSequenceActorState(_actor);
state->_actionName = _action;
return true;
}
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index 3004881..9c6c7c0 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -24,7 +24,7 @@
#include "pink/archive.h"
#include "pink/pink.h"
-#include "pink/objects/actors/actor.h"
+#include "pink/objects/actors/lead_actor.h"
#include "pink/objects/pages/game_page.h"
#include "pink/objects/sequences/sequencer.h"
#include "pink/objects/sequences/sequence.h"
@@ -60,19 +60,60 @@ Sequence *Sequencer::findSequence(const Common::String &name) {
}
void Sequencer::authorSequence(Sequence *sequence, bool unk) {
- if (_context) {
-
- }
+ assert(!_context);
if (sequence) {
- _context = new SequenceContext(sequence, this);
- //unload array of unknown objects
+ SequenceContext *context = new SequenceContext(sequence, this);
+
+ SequenceContext *confilct;
+ while(confilct = isContextConflicts(context))
+ confilct->_sequence->end();
+
+ _context = context;
_currentSequenceName = sequence->getName();
sequence->init(unk);
- } else
- _currentSequenceName.clear();
+ }
+}
+
+void Sequencer::authorParallelSequence(Sequence *seqeunce, bool unk) {
+ if (_context && _context->_sequence == seqeunce)
+ return;
+
+ for (uint i = 0; i < _parrallelContexts.size(); ++i) {
+ if (_parrallelContexts[i]->_sequence == seqeunce)
+ return;
+ }
+
+ const Common::String leadName = _page->getLeadActor()->getName();
+
+ SequenceContext *context = new SequenceContext(seqeunce, this);
+
+ for (uint i = 0; i < context->_states.size(); ++i) {
+ if (context->_states[i].getActor() == leadName) {
+ delete context;
+ return;
+ }
+ }
+
+ for (uint i = 0; i < context->_states.size(); ++i) {
+ if (findMainSequenceActorState(context->_states[i].getActor())) {
+ delete context;
+ return;
+ }
+ }
+
+ for (uint i = 0; i < context->_states.size(); ++i) {
+ if (findParralelSequenceActorState(context->_states[i].getActor())) {
+ delete context;
+ return;
+ }
+ }
+
+ _parrallelContexts.push_back(context);
+ seqeunce->start(unk);
}
+
void Sequencer::toConsole() {
debug("Sequencer:");
for (uint i = 0; i < _sequences.size(); ++i) {
@@ -86,12 +127,27 @@ void Sequencer::toConsole() {
void Sequencer::update() {
if (_context)
_context->_sequence->update();
+
+ for (uint i = 0; i < _parrallelContexts.size(); ++i) {
+ _parrallelContexts[i]->_sequence->update();
+ }
+
updateTimers();
}
void Sequencer::removeContext(SequenceContext *context) {
- delete _context;
- _context = nullptr;
+ if (context == _context) {
+ delete _context;
+ _context = nullptr;
+ return;
+ }
+
+ for (uint i = 0; i < _parrallelContexts.size(); ++i) {
+ if (context == _parrallelContexts[i]->_sequence->_context) {
+ _parrallelContexts.remove_at(i);
+ break;
+ }
+ }
}
void Sequencer::skipSubSequence() {
@@ -119,7 +175,7 @@ void Sequencer::updateTimers() {
}
}
-SequenceActorState *Sequencer::findSequenceActorState(const Common::String &name) {
+SequenceActorState *Sequencer::findMainSequenceActorState(const Common::String &name) {
if (!_context)
return nullptr;
@@ -131,6 +187,18 @@ SequenceActorState *Sequencer::findSequenceActorState(const Common::String &name
return nullptr;
}
+SequenceActorState *Sequencer::findParralelSequenceActorState(const Common::String &name) {
+ for (uint i = 0; i < _parrallelContexts.size(); ++i) {
+ for (uint j = 0; j < _parrallelContexts[i]->_states.size(); ++j) {
+ if (_parrallelContexts[i]->_states[j].getActor() == name)
+ return &_parrallelContexts[i]->_states[j];
+ }
+ }
+
+ return nullptr;
+}
+
+
void Sequencer::loadState(Archive &archive) {
Sequence *sequence = findSequence(archive.readString());
authorSequence(sequence, 1);
@@ -144,4 +212,16 @@ void Sequencer::saveState(Archive &archive) {
// add pokus specific
}
+SequenceContext * Sequencer::isContextConflicts(SequenceContext *context) {
+ for (uint i = 0; i < _parrallelContexts.size(); ++i) {
+ for (uint j = 0; j < _parrallelContexts[i]->_states.size(); ++j) {
+ for (int k = 0; k < context->_states.size(); ++k) {
+ if (_parrallelContexts[i]->_states[j].getActor() == context->_states[k].getActor())
+ return _parrallelContexts[i];
+ }
+ }
+ }
+ return nullptr;
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/sequences/sequencer.h b/engines/pink/objects/sequences/sequencer.h
index d34775a..d151fc0 100644
--- a/engines/pink/objects/sequences/sequencer.h
+++ b/engines/pink/objects/sequences/sequencer.h
@@ -42,9 +42,11 @@ public:
virtual void deserialize(Archive &archive);
Sequence *findSequence(const Common::String &name);
- SequenceActorState *findSequenceActorState(const Common::String &name);
+ SequenceActorState *findMainSequenceActorState(const Common::String &name);
+ SequenceActorState *findParralelSequenceActorState(const Common::String &name);
void authorSequence(Sequence *sequence, bool unk);
+ void authorParallelSequence(Sequence *seqeunce, bool unk);
void removeContext(SequenceContext *context);
@@ -56,11 +58,14 @@ public:
void loadState(Archive &archive);
void saveState(Archive &archive);
+
public:
void updateTimers();
+ SequenceContext * isContextConflicts(SequenceContext *context);
+
SequenceContext *_context;
- // context array
+ Common::Array<SequenceContext *> _parrallelContexts;
Array<Sequence *> _sequences;
Array<SeqTimer *> _timers;
Common::String _currentSequenceName;
Commit: 07e1621ebc897aa08e724172d2c1882096bc4998
https://github.com/scummvm/scummvm/commit/07e1621ebc897aa08e724172d2c1882096bc4998
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: add missing objs to module.mk. Pointed by Henke37.
Changed paths:
engines/pink/module.mk
diff --git a/engines/pink/module.mk b/engines/pink/module.mk
index 7bd7589..9c2215a 100644
--- a/engines/pink/module.mk
+++ b/engines/pink/module.mk
@@ -2,11 +2,13 @@ MODULE := engines/pink
MODULE_OBJS = \
archive.o \
+ audio_info_mgr.o \
cel_decoder.o \
cursor_mgr.o \
detection.o \
director.o \
file.o \
+ pda_mgr.o \
pink.o \
resource_mgr.o \
sound.o \
@@ -27,14 +29,16 @@ MODULE_OBJS = \
objects/actions/action_text.o \
objects/actions/walk_action.o \
objects/actors/actor.o \
+ objects/actors/audio_info_pda_button.o \
objects/actors/lead_actor.o \
objects/actors/pda_button_actor.o \
objects/actors/supporting_actor.o \
objects/handlers/handler.o \
objects/handlers/handler_mgr.o \
objects/handlers/handler_timer.o \
- objects/pages/page.o \
objects/pages/game_page.o \
+ objects/pages/page.o \
+ objects/pages/pda_page.o \
objects/sequences/seq_timer.o \
objects/sequences/sequence.o \
objects/sequences/sequence_context.o \
Commit: 425e034bee864fbfb47f015073f9aba1cea95cba
https://github.com/scummvm/scummvm/commit/425e034bee864fbfb47f015073f9aba1cea95cba
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: add some debug output to simplify communication with testers
Changed paths:
engines/pink/objects/pages/game_page.cpp
engines/pink/objects/pages/page.cpp
engines/pink/pink.cpp
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index d383a9b..4c05da0 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -55,6 +55,7 @@ void GamePage::deserialize(Archive &archive) {
}
void GamePage::load(Archive &archive) {
+ debug("GamePage load started");
archive.mapObject(_cursorMgr);
archive.mapObject(_walkMgr);
archive.mapObject(_sequencer);
@@ -66,6 +67,7 @@ void GamePage::load(Archive &archive) {
_walkMgr->deserialize(archive);
_sequencer->deserialize(archive);
_handlers.deserialize(archive);
+ debug("GamePage load ended");
}
void GamePage::init(bool isLoadingSave) {
@@ -106,6 +108,7 @@ void GamePage::loadManagers() {
_walkMgr = new WalkMgr;
_sequencer = new Sequencer(this);
+ debug("ResMgr init");
_resMgr.init(_module->getGame(), this);
if (_memFile != nullptr) {
diff --git a/engines/pink/objects/pages/page.cpp b/engines/pink/objects/pages/page.cpp
index 086253d..3816571 100644
--- a/engines/pink/objects/pages/page.cpp
+++ b/engines/pink/objects/pages/page.cpp
@@ -32,6 +32,7 @@ Page::~Page() {
}
void Page::load(Archive &archive) {
+ debug("Page load");
archive.mapObject(this);
NamedObject::deserialize(archive);
archive.readString(); //skip directory
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index 6ac377b..397d0b9 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -88,6 +88,7 @@ Common::Error PinkEngine::init() {
setCursor(kLoadingCursor);
_orb.loadGame(this);
+ debug("Modules are loaded");
syncSoundSettings();
@@ -151,6 +152,8 @@ void PinkEngine::initModule(const Common::String &moduleName, const Common::Stri
if (saveFile)
_module->loadState(*saveFile);
+ debug("Module added");
+
_module->init(saveFile ? kLoadingSave : kLoadingNewGame, pageName);
}
Commit: 4879f7600ca31bbeae4faab1419fb949b4e2e775
https://github.com/scummvm/scummvm/commit/4879f7600ca31bbeae4faab1419fb949b4e2e775
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix ActionTalk sound balance. Thanks Henke37 for bugreport
Changed paths:
engines/pink/objects/actions/action_talk.cpp
diff --git a/engines/pink/objects/actions/action_talk.cpp b/engines/pink/objects/actions/action_talk.cpp
index 2144d8a..1ea2937 100644
--- a/engines/pink/objects/actions/action_talk.cpp
+++ b/engines/pink/objects/actions/action_talk.cpp
@@ -61,9 +61,7 @@ void ActionTalk::pause(bool paused) {
void ActionTalk::onStart() {
ActionLoop::onStart();
- //sound balance is calculated different than in ActionSfx(probably a bug in original)
- // 30.0 - x * -0.0625 disasm (0 - 100)
- int8 balance = (_decoder.getCenter().x * 396875 / 1000000) - 127;
+ int8 balance = (_decoder.getCenter().x * 51 - 16160) / 320;
_sound.play(_actor->getPage()->getResourceStream(_vox), Audio::Mixer::kSpeechSoundType, 100, balance);
}
Commit: c4461cb4c347460fafb3725341ca1a2e712c8f1c
https://github.com/scummvm/scummvm/commit/c4461cb4c347460fafb3725341ca1a2e712c8f1c
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix playing of sprites which have incorrect stopFrame
Changed paths:
engines/pink/objects/actions/action_play.cpp
diff --git a/engines/pink/objects/actions/action_play.cpp b/engines/pink/objects/actions/action_play.cpp
index bc93eba..e86ff55 100644
--- a/engines/pink/objects/actions/action_play.cpp
+++ b/engines/pink/objects/actions/action_play.cpp
@@ -50,8 +50,7 @@ void ActionPlay::update() {
_decoder.setEndOfTrack();
assert(!_decoder.needsUpdate());
_actor->endAction();
- }
- else
+ } else
decodeNext();
}
@@ -61,8 +60,9 @@ void ActionPlay::pause(bool paused) {
void ActionPlay::onStart() {
debug("Actor %s has now ActionPlay %s", _actor->getName().c_str(), _name.c_str());
- if (_stopFrame == -1)
- _stopFrame = _decoder.getFrameCount() - 1;
+ int frameCount = _decoder.getFrameCount();
+ if (_stopFrame == -1 || _stopFrame >= frameCount)
+ _stopFrame = frameCount - 1;
assert(_startFrame < _decoder.getFrameCount());
setFrame(_startFrame);
// doesn't need to decode startFrame here. Update method will decode
Commit: b32af31601da92046902ad6dc9152294537d6272
https://github.com/scummvm/scummvm/commit/b32af31601da92046902ad6dc9152294537d6272
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix updating cursor when mouse isn't moving
Changed paths:
engines/pink/objects/actors/lead_actor.cpp
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 9f04e74..8384fb4 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -130,6 +130,7 @@ void LeadActor::update() {
if (!_sequencer->_context) {
_state = _nextState;
_nextState = kUndefined;
+ forceUpdateCursor();
}
break;
case kInventory:
@@ -367,6 +368,7 @@ bool LeadActor::sendUseClickMessage(Actor *actor) {
actor->onUseClickMessage(mgr->getCurrentItem(), mgr);
if (item->getCurrentOwner() != this->_name)
_isHaveItem = false;
+ forceUpdateCursor();
return true;
}
@@ -374,7 +376,9 @@ bool LeadActor::sendLeftClickMessage(Actor *actor) {
assert(_state != kPlayingExitSequence);
_nextState = kReady;
_state = kPlayingSequence;
- return actor->onLeftClickMessage();
+ actor->onLeftClickMessage();
+ forceUpdateCursor();
+ return true;
}
WalkLocation *LeadActor::getWalkDestination() {
Commit: 5f61d96bae353cdbaba69044772fef524c8070af
https://github.com/scummvm/scummvm/commit/5f61d96bae353cdbaba69044772fef524c8070af
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: rework InventoryMgr updating
Changed paths:
engines/pink/objects/inventory.cpp
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
index 94a3163..3a0dd78 100644
--- a/engines/pink/objects/inventory.cpp
+++ b/engines/pink/objects/inventory.cpp
@@ -35,7 +35,7 @@ namespace Pink {
InventoryMgr::InventoryMgr()
: _lead(nullptr), _item(nullptr), _isClickedOnItem(false) {}
-void Pink::InventoryItem::deserialize(Archive &archive) {
+void InventoryItem::deserialize(Archive &archive) {
NamedObject::deserialize(archive);
_initialOwner = archive.readString();
_currentOwner = _initialOwner;
@@ -116,22 +116,27 @@ bool InventoryMgr::start(bool paused) {
}
void InventoryMgr::update() {
- if (_state == kOpening && !_window->isPlaying()) {
+ if (_window->isPlaying())
+ return;
+
+ switch (_state) {
+ case kOpening:
_state = kReady;
_itemActor->setAction(_item->getName());
_window->setAction(kShowAction);
_leftArrow->setAction(kShowAction);
_rightArrow->setAction(kShowAction);
- } else if (_state == kClosing && !_window->isPlaying()) {
+ break;
+ case kClosing:
_window->setAction(kIdleAction);
-
_lead->onInventoryClosed(_isClickedOnItem);
-
_state = kIdle;
-
_window = nullptr;
_itemActor = nullptr;
_isClickedOnItem = false;
+ break;
+ default:
+ break;
}
}
Commit: 99301a773f7a6511d59f737a54c14c6d72382b3a
https://github.com/scummvm/scummvm/commit/99301a773f7a6511d59f737a54c14c6d72382b3a
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: rework item changing in inventory
Changed paths:
engines/pink/objects/inventory.cpp
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
index 3a0dd78..859b96a 100644
--- a/engines/pink/objects/inventory.cpp
+++ b/engines/pink/objects/inventory.cpp
@@ -178,14 +178,13 @@ void InventoryMgr::showNextItem(bool direction) {
}
}
- uint i = 0;
- do {
+ for (uint i = 0; i < _items.size(); ++i) {
index = (direction == kLeft) ? index - 1 : index + 1;
- } while (_items[index % _items.size()]->getCurrentOwner() != _item->getCurrentOwner() && ++i < _items.size());
-
- if (i != _items.size()) {
- _item = _items[index % _items.size()];
- _itemActor->setAction(_item->getName());
+ if (_items[index % _items.size()]->getCurrentOwner() == _item->getCurrentOwner()) {
+ _item = _items[index % _items.size()];
+ _itemActor->setAction(_item->getName());
+ break;
+ }
}
}
Commit: b1d516276a2443d33f80ce214343e025c7f9a2fa
https://github.com/scummvm/scummvm/commit/b1d516276a2443d33f80ce214343e025c7f9a2fa
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: add missing cursor
Changed paths:
engines/pink/constants.h
engines/pink/cursor_mgr.cpp
engines/pink/pink.cpp
diff --git a/engines/pink/constants.h b/engines/pink/constants.h
index 57336b0..7afb166 100644
--- a/engines/pink/constants.h
+++ b/engines/pink/constants.h
@@ -85,22 +85,23 @@ enum {
};
enum {
- kCursorsCount = 12
+ kCursorsCount = 13
};
enum {
kLoadingCursor = 0,
- kExitForwardCursor = 1,
- kExitLeftCursor = 2,
- kExitRightCursor = 3,
- kDefaultCursor = 4,
- kClickableFirstFrameCursor = 5,
- kClickableSecondFrameCursor = 6,
- kNotClickableCursor = 7,
- kHoldingItemCursor = 8,
- kPDADefaultCursor = 9,
- kPDAClickableFirstFrameCursor = 10,
- kPDAClickableSecondFrameCursor = 11
+ kDefaultCursor = 1,
+ kClickableFirstFrameCursor = 2,
+ kClickableSecondFrameCursor = 3,
+ kNotClickableCursor = 4,
+ kHoldingItemCursor = 5,
+ kPDADefaultCursor = 6,
+ kPDAClickableFirstFrameCursor = 7,
+ kPDAClickableSecondFrameCursor = 8,
+ kExitLeftCursor = 9,
+ kExitRightCursor = 10,
+ kExitForwardCursor = 11,
+ kExitDownCursor = 12 // only in Hokus Pokus
};
@@ -108,6 +109,7 @@ enum {
enum {
kPokusLoadingCursorID = 135,
kPokusExitForwardCursorID = 138,
+ kPokusExitDownCursorID = 139,
kPokusExitLeftCursorID = 133,
kPokusExitRightCursorID = 134,
kPokusClickableFirstCursorID = 137,
@@ -172,6 +174,7 @@ static const char *kCursorNameExitUp = "ExitUp";
static const char *kCursorNameExitLeft = "ExitLeft";
static const char *kCursorNameExitRight = "ExitRight";
static const char *kCursorNameExitForward = "ExitForward";
+static const char *kCursorNameExitBackWards = "ExitBackwards";
static const char *kClickable = "Clickable";
static const char *kCursor = "Cursor";
diff --git a/engines/pink/cursor_mgr.cpp b/engines/pink/cursor_mgr.cpp
index 4686169..084578a 100644
--- a/engines/pink/cursor_mgr.cpp
+++ b/engines/pink/cursor_mgr.cpp
@@ -69,10 +69,12 @@ void CursorMgr::setCursor(const Common::String &cursorName, const Common::Point
index = kExitLeftCursor;
else if (cursorName == kCursorNameExitRight)
index = kExitRightCursor;
- else //if (cursorName == kCursorNameExitForward || cursorName == kCursorNameExitUp)
+ else if (cursorName == kCursorNameExitForward || cursorName == kCursorNameExitUp)
index = kExitForwardCursor;
- //else
- //assert(0);
+ else if (cursorName == kCursorNameExitBackWards)
+ index = kExitDownCursor;
+ else
+ error("%s UNKNOWN CURSOR", cursorName.c_str());
setCursor(index, point, "");
}
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index 397d0b9..1337edc 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -212,9 +212,6 @@ bool PinkEngine::loadCursors() {
_cursors.reserve(kCursorsCount);
_cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusLoadingCursorID));
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusExitForwardCursorID));
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusExitLeftCursorID));
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusExitRightCursorID));
_cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusClickableFirstCursorID));
_cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusClickableSecondCursorID));
@@ -237,6 +234,14 @@ bool PinkEngine::loadCursors() {
_cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPerilPDAClickableFirstFrameCursorID));
_cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPerilPDAClickableSecondFrameCursorID));
}
+
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusExitLeftCursorID));
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusExitRightCursorID));
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusExitForwardCursorID));
+
+ if (isPokus)
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusExitDownCursorID));
+
return true;
}
Commit: 0835b0fee134ae5b687bb2e609d966b0692eb496
https://github.com/scummvm/scummvm/commit/0835b0fee134ae5b687bb2e609d966b0692eb496
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix SeqTimer updating when actor isn't found
Changed paths:
engines/pink/objects/sequences/seq_timer.cpp
diff --git a/engines/pink/objects/sequences/seq_timer.cpp b/engines/pink/objects/sequences/seq_timer.cpp
index 7270c1a..8ac43fb 100644
--- a/engines/pink/objects/sequences/seq_timer.cpp
+++ b/engines/pink/objects/sequences/seq_timer.cpp
@@ -53,8 +53,7 @@ void SeqTimer::update() {
_updatesToMessage = _range ? _period + rnd.getRandomNumber(_range) : _period;
Actor *actor = _sequencer->_page->findActor(_actor);
- assert(actor);
- if (!_sequencer->findMainSequenceActorState(actor->getName()) &&
+ if (actor && !_sequencer->findMainSequenceActorState(actor->getName()) &&
!_sequencer->findParralelSequenceActorState(actor->getName())) {
actor->onTimerMessage();
}
Commit: cfc5538f95f5b642c7037eb142999f67d72ca111
https://github.com/scummvm/scummvm/commit/cfc5538f95f5b642c7037eb142999f67d72ca111
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix skipping sequence
Changed paths:
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/sequences/sequence.cpp
engines/pink/objects/sequences/sequence.h
engines/pink/objects/sequences/sequencer.cpp
engines/pink/objects/sequences/sequencer.h
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 8384fb4..7bc3456 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -191,7 +191,7 @@ void LeadActor::onKeyboardButtonClick(Common::KeyCode code) {
_sequencer->skipSubSequence();
break;
case Common::KEYCODE_ESCAPE:
- _sequencer->skipToLastSubSequence();
+ _sequencer->skipSequence();
break;
case Common::KEYCODE_LEFT:
_sequencer->restartSequence();
diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp
index 35c2ef5..7674cee 100644
--- a/engines/pink/objects/sequences/sequence.cpp
+++ b/engines/pink/objects/sequences/sequence.cpp
@@ -106,15 +106,18 @@ void Sequence::restart() {
start(0);
}
-void Sequence::skipToLastSubSequence() {
- if (_unk && _context->getNextItemIndex() < _items.size()) {
- int i = _items.size() - 1;
- while (i >= 0 && !_items[--i]->isLeader()) {};
- assert(i >= 0);
- _context->setNextItemIndex(i);
- _context->clearActionsFromActorStates();
- skipItemsTo(i);
- start(0);
+void Sequence::skip() {
+ if (_context->getNextItemIndex() >= _items.size())
+ return;
+
+ for (int i = _items.size() - 1; i >= 0; --i) {
+ if (_items[i]->isLeader()) {
+ _context->setNextItemIndex(i);
+ _context->clearActionsFromActorStates();
+ skipItemsTo(i);
+ start(0);
+ break;
+ }
}
}
@@ -174,7 +177,7 @@ void SequenceAudio::restart() {
Sequence::restart();
}
-void SequenceAudio::skipToLastSubSequence() {
+void SequenceAudio::skip() {
end();
}
diff --git a/engines/pink/objects/sequences/sequence.h b/engines/pink/objects/sequences/sequence.h
index 0e92846..a5e19ea 100644
--- a/engines/pink/objects/sequences/sequence.h
+++ b/engines/pink/objects/sequences/sequence.h
@@ -50,7 +50,7 @@ public:
virtual void update();
virtual void restart();
virtual void skipSubSequence();
- virtual void skipToLastSubSequence();
+ virtual void skip();
void skipItemsTo(int index);
@@ -79,7 +79,7 @@ public:
virtual void restart();
virtual void skipSubSequence() {};
- virtual void skipToLastSubSequence();
+ virtual void skip();
private:
Common::String _soundName;
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index 9c6c7c0..a98512e 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -159,8 +159,9 @@ void Sequencer::restartSequence() {
_context->getSequence()->restart();
}
-void Sequencer::skipToLastSubSequence() {
- _context->getSequence()->skipToLastSubSequence();
+void Sequencer::skipSequence() {
+ if (_context->getSequence()->_unk)
+ _context->getSequence()->skip();
}
void Sequencer::updateTimers() {
diff --git a/engines/pink/objects/sequences/sequencer.h b/engines/pink/objects/sequences/sequencer.h
index d151fc0..3a421f7 100644
--- a/engines/pink/objects/sequences/sequencer.h
+++ b/engines/pink/objects/sequences/sequencer.h
@@ -54,7 +54,7 @@ public:
void skipSubSequence();
void restartSequence();
- void skipToLastSubSequence();
+ void skipSequence();
void loadState(Archive &archive);
void saveState(Archive &archive);
Commit: e2ac931ccba6f193fa20cd2febb5f919da1b20b2
https://github.com/scummvm/scummvm/commit/e2ac931ccba6f193fa20cd2febb5f919da1b20b2
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: rework scripting system
Changed paths:
engines/pink/objects/actors/actor.cpp
engines/pink/objects/actors/actor.h
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/handlers/handler.cpp
engines/pink/objects/sequences/seq_timer.cpp
engines/pink/objects/sequences/seq_timer.h
engines/pink/objects/sequences/sequence.cpp
engines/pink/objects/sequences/sequence.h
engines/pink/objects/sequences/sequence_context.cpp
engines/pink/objects/sequences/sequence_context.h
engines/pink/objects/sequences/sequence_item.cpp
engines/pink/objects/sequences/sequence_item.h
engines/pink/objects/sequences/sequencer.cpp
engines/pink/objects/sequences/sequencer.h
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index 7abab3c..0fc6e89 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -124,9 +124,8 @@ void Actor::setAction(Action *newAction) {
}
}
-void Actor::setAction(Action *newAction, bool unk) {
- if (unk) {
- //assert(0); // want to see this
+void Actor::setAction(Action *newAction, bool loadingSave) {
+ if (loadingSave) {
_isActionEnded = 1;
_action = newAction;
} else {
diff --git a/engines/pink/objects/actors/actor.h b/engines/pink/objects/actors/actor.h
index cd84fd2..480aa78 100644
--- a/engines/pink/objects/actors/actor.h
+++ b/engines/pink/objects/actors/actor.h
@@ -50,7 +50,7 @@ public:
virtual void init(bool paused);
bool initPalette(Director *director);
- void toConsole() override ;
+ void toConsole() override;
bool isPlaying() { return !_isActionEnded; }
virtual void pause(bool paused);
@@ -84,7 +84,7 @@ public:
void setAction(const Common::String &name) { setAction(findAction(name)); }
void setAction(Action *newAction);
- void setAction(Action *newAction, bool unk);
+ void setAction(Action *newAction, bool loadingSave);
void setPage(Page *page) { _page = page;}
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 7bc3456..579015d 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -127,7 +127,7 @@ void LeadActor::update() {
break;
case kPlayingSequence:
_sequencer->update();
- if (!_sequencer->_context) {
+ if (!_sequencer->isPlaying()) {
_state = _nextState;
_nextState = kUndefined;
forceUpdateCursor();
@@ -141,7 +141,7 @@ void LeadActor::update() {
break;
case kPlayingExitSequence:
_sequencer->update();
- if (!_sequencer->_context) {
+ if (!_sequencer->isPlaying()) {
_state = kUndefined;
_page->getGame()->changeScene();
}
diff --git a/engines/pink/objects/handlers/handler.cpp b/engines/pink/objects/handlers/handler.cpp
index 019d349..1c9cc4b 100644
--- a/engines/pink/objects/handlers/handler.cpp
+++ b/engines/pink/objects/handlers/handler.cpp
@@ -87,7 +87,7 @@ void HandlerSequences::handle(Actor *actor) {
}
void HandlerStartPage::execute(Sequence *sequence) {
- sequence->_unk = 1;
+ sequence->allowSkipping();
}
void HandlerStartPage::toConsole() {
diff --git a/engines/pink/objects/sequences/seq_timer.cpp b/engines/pink/objects/sequences/seq_timer.cpp
index 8ac43fb..8d639ac 100644
--- a/engines/pink/objects/sequences/seq_timer.cpp
+++ b/engines/pink/objects/sequences/seq_timer.cpp
@@ -46,15 +46,15 @@ void SeqTimer::toConsole() {
}
void SeqTimer::update() {
- Common::RandomSource &rnd = _sequencer->_page->getGame()->getRnd();
+ Page *page = _sequencer->getPage();
+ Common::RandomSource &rnd = page->getGame()->getRnd();
if (_updatesToMessage--)
return;
_updatesToMessage = _range ? _period + rnd.getRandomNumber(_range) : _period;
- Actor *actor = _sequencer->_page->findActor(_actor);
- if (actor && !_sequencer->findMainSequenceActorState(actor->getName()) &&
- !_sequencer->findParralelSequenceActorState(actor->getName())) {
+ Actor *actor = page->findActor(_actor);
+ if (actor && !_sequencer->findState(_actor)) {
actor->onTimerMessage();
}
}
diff --git a/engines/pink/objects/sequences/seq_timer.h b/engines/pink/objects/sequences/seq_timer.h
index 9af706f..d784ae7 100644
--- a/engines/pink/objects/sequences/seq_timer.h
+++ b/engines/pink/objects/sequences/seq_timer.h
@@ -32,9 +32,11 @@ class Sequencer;
class SeqTimer : public Object {
public:
SeqTimer();
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
- virtual void update();
+
+ void deserialize(Archive &archive) override;
+ void toConsole() override;
+
+ void update();
private:
Common::String _actor;
diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp
index 7674cee..a700e99 100644
--- a/engines/pink/objects/sequences/sequence.cpp
+++ b/engines/pink/objects/sequences/sequence.cpp
@@ -34,7 +34,7 @@
namespace Pink {
Sequence::Sequence()
- : _unk(0), _context(nullptr),
+ : _canBeSkipped(0), _context(nullptr),
_sequencer(nullptr) {}
Sequence::~Sequence() {
@@ -57,52 +57,42 @@ void Sequence::toConsole() {
}
}
-void Sequence::init(int unk) {
- assert(_items.size());
- assert(dynamic_cast<SequenceItemLeader*>(_items[0])); // first item must always be a leader
- start(unk);
-}
-
-void Sequence::start(int unk) {
- if (_context->_nextItemIndex >= _items.size() ||
- !_items[_context->_nextItemIndex]->execute(_context->_index, this, unk)) {
+void Sequence::start(bool loadingSave) {
+ uint nextItemIndex = _context->getNextItemIndex();
+ if (nextItemIndex >= _items.size() ||
+ !_items[nextItemIndex]->execute(_context->getSegment(), this, loadingSave)) {
debug("Sequence %s ended", _name.c_str());
end();
return;
}
- uint i;
- for (i = _context->_nextItemIndex + 1; i <_items.size(); ++i){
- if (_items[i]->isLeader())
+ uint i = nextItemIndex + 1;
+ while (i < _items.size()) {
+ if (_items[i]->isLeader()) {
break;
- _items[i]->execute(_context->_index, this, unk);
+ }
+ _items[i++]->execute(_context->getSegment(), this, loadingSave);
}
- _context->_nextItemIndex = i;
-
- Common::Array<SequenceActorState> &states = _context->_states;
- for (uint j = 0; j < states.size(); ++j) {
- states[j].check(_context->_index, this, unk);
- }
- _context->_index++;
+ _context->execute(i, loadingSave);
}
void Sequence::update() {
- if (!_context->_actor->isPlaying()) {
+ if (!_context->getActor()->isPlaying()) {
debug("Sequence step ended");
start(0);
}
}
void Sequence::end() {
- _context->_actor = 0;
- _unk = 1;
+ _context->setActor(nullptr);
+ _canBeSkipped = 1;
_sequencer->removeContext(_context);
}
void Sequence::restart() {
_context->setNextItemIndex(0);
- _context->clearActionsFromActorStates();
+ _context->clearDefaultActions();
start(0);
}
@@ -113,23 +103,28 @@ void Sequence::skip() {
for (int i = _items.size() - 1; i >= 0; --i) {
if (_items[i]->isLeader()) {
_context->setNextItemIndex(i);
- _context->clearActionsFromActorStates();
- skipItemsTo(i);
+ _context->clearDefaultActions();
+ for (int j = 0; j < i; ++j) {
+ _items[j]->skip(this);
+ }
start(0);
break;
}
}
}
-void Sequence::skipItemsTo(int index) {
- for (int i = 0; i < index; ++i) {
- _items[i]->skip(this);
- }
+void Sequence::skipSubSequence() {
+ if (_context->getNextItemIndex() < _items.size())
+ this->start(0);
}
-void Sequence::skipSubSequence() {
- if (_context->getNextItemIndex() < _context->getSequence()->getItems().size())
- _context->getSequence()->start(0);
+void Sequence::forceEnd() {
+ skip();
+ end();
+}
+
+void Sequence::init(bool loadingSave) {
+ start(loadingSave);
}
void SequenceAudio::deserialize(Archive &archive) {
@@ -145,8 +140,8 @@ void SequenceAudio::toConsole() {
}
}
-void SequenceAudio::start(int unk) {
- Sequence::start(unk);
+void SequenceAudio::start(bool loadingSave) {
+ Sequence::start(loadingSave);
uint index = _context->getNextItemIndex();
if (index < _items.size()) {
SequenceItemLeaderAudio* leaderAudio = (SequenceItemLeaderAudio*) _items[index];
@@ -166,14 +161,15 @@ void SequenceAudio::update() {
start(0);
}
-void SequenceAudio::init(int unk) {
+void SequenceAudio::init(bool loadingSave) {
_sample = 0;
- _sound.play(_sequencer->_page->getResourceStream(_soundName), Audio::Mixer::kMusicSoundType);
- Sequence::init(unk);
+ _sound.play(_sequencer->getPage()->getResourceStream(_soundName), Audio::Mixer::kMusicSoundType);
+ start(loadingSave);
}
void SequenceAudio::restart() {
- _sound.play(_sequencer->_page->getResourceStream(_soundName), Audio::Mixer::kMusicSoundType);
+ _sample = 0;
+ _sound.play(_sequencer->getPage()->getResourceStream(_soundName), Audio::Mixer::kMusicSoundType);
Sequence::restart();
}
diff --git a/engines/pink/objects/sequences/sequence.h b/engines/pink/objects/sequences/sequence.h
index a5e19ea..05a3f88 100644
--- a/engines/pink/objects/sequences/sequence.h
+++ b/engines/pink/objects/sequences/sequence.h
@@ -35,51 +35,55 @@ class SequenceContext;
class Sequence : public NamedObject {
public:
Sequence();
- virtual ~Sequence();
- virtual void deserialize(Archive &archive);
+ ~Sequence();
- virtual void toConsole();
+ void deserialize(Archive &archive) override ;
+ void toConsole() override;
- Common::Array<SequenceItem *> &getItems() { return _items; }
+public:
+ virtual void init(bool loadingSave);
- void setContext(SequenceContext *context) { _context = context; }
- virtual void init(int unk);
- virtual void start(int unk);
+ virtual void start(bool loadingSave);
virtual void end();
+ virtual void restart();
+
+ void forceEnd();
virtual void update();
- virtual void restart();
+
virtual void skipSubSequence();
virtual void skip();
- void skipItemsTo(int index);
+ void allowSkipping() { _canBeSkipped = true; }
+ bool isSkippingAllowed() { return _canBeSkipped; }
-public:
- bool canAddContext(const Common::String name);
+ SequenceContext *getContext() const { return _context; }
+ Sequencer *getSequencer() const { return _sequencer; }
+ Common::Array<SequenceItem *> &getItems() { return _items; }
+ void setContext(SequenceContext *context) { _context = context; }
+protected:
SequenceContext *_context;
Sequencer *_sequencer;
Array<SequenceItem *> _items;
- int _unk;
+ bool _canBeSkipped;
};
-class Sound;
-
class SequenceAudio : public Sequence {
public:
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ void deserialize(Archive &archive) override;
+ void toConsole() override;
- virtual void init(int unk);
- virtual void start(int unk);
- virtual void end();
+ void init(bool loadingSave) override;
+ void start(bool loadingSave) override;
+ void end() override;
- virtual void update();
- virtual void restart();
+ void update() override;
+ void restart() override;
- virtual void skipSubSequence() {};
- virtual void skip();
+ void skipSubSequence() override {}
+ void skip() override;
private:
Common::String _soundName;
diff --git a/engines/pink/objects/sequences/sequence_context.cpp b/engines/pink/objects/sequences/sequence_context.cpp
index 61ac13c..143a46c 100644
--- a/engines/pink/objects/sequences/sequence_context.cpp
+++ b/engines/pink/objects/sequences/sequence_context.cpp
@@ -31,22 +31,19 @@
namespace Pink {
-SequenceActorState::SequenceActorState(const Common::String &name)
- :_actorName(name), _index(0) {}
-
-void SequenceActorState::check(int index, Sequence *sequence, bool unk) {
- Actor *actor = sequence->_sequencer->_page->findActor(_actorName);
- debug("%s %s", _actorName.c_str(), _actionName.c_str());
- if (_index != index && !_actionName.empty()) {
- Action *action = actor->findAction(_actionName);
- if (actor->getAction() != action)
- actor->setAction(action, unk);
+void SequenceActorState::execute(uint segment, Sequence *sequence, bool loadingSave) const {
+ Actor *actor = sequence->getSequencer()->getPage()->findActor(this->actor);
+ if (actor && this->segment != segment && !defaultAction.empty()) {
+ Action *action = actor->findAction(defaultAction);
+ if (action && actor->getAction() != action) {
+ actor->setAction(action, loadingSave);
+ }
}
}
-SequenceContext::SequenceContext(Sequence *sequence, Sequencer *sequencer)
- : _sequence(sequence), _sequencer(sequencer),
- _nextItemIndex(0), _index(1), _actor(nullptr)
+SequenceContext::SequenceContext(Sequence *sequence)
+ : _sequence(sequence), _nextItemIndex(0),
+ _segment(1), _actor(nullptr)
{
sequence->setContext(this);
Common::Array<SequenceItem*> &items = sequence->getItems();
@@ -55,7 +52,7 @@ SequenceContext::SequenceContext(Sequence *sequence, Sequencer *sequencer)
for (uint i = 0; i < items.size(); ++i) {
bool found = 0;
for (uint j = 0; j < _states.size(); ++j) {
- if (items[i]->getActor() == _states[j].getActor()) {
+ if (items[i]->getActor() == _states[j].actor) {
found = 1;
break;
}
@@ -67,10 +64,36 @@ SequenceContext::SequenceContext(Sequence *sequence, Sequencer *sequencer)
}
}
-void SequenceContext::clearActionsFromActorStates() {
+void SequenceContext::execute(uint nextItemIndex, bool loadingSave) {
+ for (uint j = 0; j < _states.size(); ++j) {
+ _states[j].execute(_segment, _sequence, loadingSave);
+ }
+
+ _nextItemIndex = nextItemIndex;
+ _segment++;
+}
+
+
+void SequenceContext::clearDefaultActions() {
+ for (uint i = 0; i < _states.size(); ++i) {
+ _states[i].defaultAction.clear();
+ }
+}
+
+SequenceActorState *SequenceContext::findState(const Common::String &actor) {
+ for (uint i = 0; i < _states.size(); ++i) {
+ if (_states[i].actor == actor)
+ return &_states[i];
+ }
+ return nullptr;
+}
+
+bool SequenceContext::isConflictsWith(SequenceContext *context) {
for (uint i = 0; i < _states.size(); ++i) {
- _states[i]._actionName.clear();
+ if (context->findState(_states[i].actor))
+ return true;
}
+ return false;
}
} // End of namespace Pink
diff --git a/engines/pink/objects/sequences/sequence_context.h b/engines/pink/objects/sequences/sequence_context.h
index 5ba6081..931c9462 100644
--- a/engines/pink/objects/sequences/sequence_context.h
+++ b/engines/pink/objects/sequences/sequence_context.h
@@ -30,39 +30,45 @@ namespace Pink {
class Sequence;
class Sequencer;
-class SequenceActorState {
-public:
- SequenceActorState(const Common::String &name);
+struct SequenceActorState {
+ SequenceActorState(const Common::String actorName)
+ : actor(actorName), segment(0) {}
- const Common::String &getActor() const { return _actorName; }
- void check(int index, Sequence *sequence, bool unk);
+ void execute(uint segment, Sequence *sequence, bool loadingSave) const;
-public:
- Common::String _actorName;
- Common::String _actionName;
- int _index;
+ Common::String actor;
+ Common::String defaultAction;
+ uint segment;
};
class Actor;
class SequenceContext {
public:
- SequenceContext(Sequence *sequence, Sequencer* sequencer);
+ SequenceContext(Sequence *sequence);
- uint getNextItemIndex() const { return _nextItemIndex; }
- Sequence *getSequence() const { return _sequence; }
+ void execute(uint nextItemIndex, bool loadingSave);
- void setNextItemIndex(int index) { _nextItemIndex = index; }
+ bool isConflictsWith(SequenceContext *context);
- void clearActionsFromActorStates();
+ void clearDefaultActions();
-public:
+ SequenceActorState *findState(const Common::String &actor);
+
+ Sequence *getSequence() const { return _sequence; }
+ Actor *getActor() const { return _actor; }
+ uint getNextItemIndex() const { return _nextItemIndex; }
+ uint getSegment() const { return _segment; }
+
+ void setActor(Actor *actor) { _actor = actor; }
+ void setNextItemIndex(uint index) { _nextItemIndex = index; }
+
+private:
Sequence *_sequence;
- Sequencer *_sequencer;
- uint _nextItemIndex;
Actor *_actor;
Common::Array<SequenceActorState> _states;
- int _index;
+ uint _nextItemIndex;
+ uint _segment;
};
}
diff --git a/engines/pink/objects/sequences/sequence_item.cpp b/engines/pink/objects/sequences/sequence_item.cpp
index 72fb452..ee40947 100644
--- a/engines/pink/objects/sequences/sequence_item.cpp
+++ b/engines/pink/objects/sequences/sequence_item.cpp
@@ -42,20 +42,20 @@ void SequenceItem::toConsole() {
debug("\t\t\t\tSequenceItem: _actor=%s, _action=%s", _actor.c_str(), _action.c_str());
}
-bool SequenceItem::execute(int index, Sequence *sequence, bool unk2) {
- Actor *actor;
+bool SequenceItem::execute(uint segment, Sequence *sequence, bool loadingSave) {
+ Actor *actor = sequence->getSequencer()->getPage()->findActor(_actor);
Action *action;
- if (!(actor = sequence->_sequencer->_page->findActor(_actor)) ||
- !(action = actor->findAction(_action)))
+ if (!actor || !(action = actor->findAction(_action)))
return false;
- actor->setAction(action, unk2);
+ actor->setAction(action, loadingSave);
- SequenceActorState *state = sequence->_sequencer->findMainSequenceActorState(_actor);
+ SequenceContext *context = sequence->getContext();
+ SequenceActorState *state = context->findState(_actor);
if (state)
- state->_index = index;
- sequence->_context->_actor = isLeader() ? actor : sequence->_context->_actor;
-
+ state->segment = segment;
+ if (isLeader())
+ context->setActor(actor);
return true;
}
@@ -81,9 +81,10 @@ void SequenceItemLeaderAudio::toConsole() {
debug("\t\t\t\tSequenceItemLeaderAudio: _actor=%s, _action=%s _sample=%d", _actor.c_str(), _action.c_str(), _sample);
}
-bool SequenceItemDefaultAction::execute(int index, Sequence *sequence, bool unk2) {
- SequenceActorState *state = sequence->_sequencer->findMainSequenceActorState(_actor);
- state->_actionName = _action;
+bool SequenceItemDefaultAction::execute(uint segment, Sequence *sequence, bool loadingSave) {
+ SequenceActorState *state = sequence->getContext()->findState(_actor);
+ if (state)
+ state->defaultAction = _action;
return true;
}
diff --git a/engines/pink/objects/sequences/sequence_item.h b/engines/pink/objects/sequences/sequence_item.h
index d67e0f5..4005331 100644
--- a/engines/pink/objects/sequences/sequence_item.h
+++ b/engines/pink/objects/sequences/sequence_item.h
@@ -31,17 +31,16 @@ class Sequence;
class SequenceItem : public Object {
public:
- virtual void deserialize(Archive &archive);
+ void deserialize(Archive &archive) override;
- virtual void toConsole();
+ void toConsole() override;
- const Common::String &getActor() const { return _actor; }
- const Common::String &getAction() const { return _action; }
-
- virtual bool execute(int index, Sequence *sequence, bool unk2);
+ virtual bool execute(uint segment, Sequence *sequence, bool loadingSave);
virtual bool isLeader();
virtual void skip(Sequence *sequence) {};
+ const Common::String &getActor() const { return _actor; }
+
protected:
Common::String _actor;
Common::String _action;
@@ -49,14 +48,15 @@ protected:
class SequenceItemLeader : public SequenceItem {
public:
- virtual void toConsole();
- virtual bool isLeader();
+ void toConsole() override;
+ bool isLeader() override;
};
class SequenceItemLeaderAudio : public SequenceItemLeader {
public:
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ void deserialize(Archive &archive) override;
+ void toConsole() override;
+
uint32 getSample() { return _sample; }
private:
@@ -65,22 +65,12 @@ private:
class SequenceItemDefaultAction : public SequenceItem {
public:
- virtual bool execute(int index, Sequence *sequence, bool unk2);
- virtual void skip(Sequence *sequence);
+ void toConsole() override;
- virtual void toConsole();
+ bool execute(uint segment, Sequence *sequence, bool loadingSave) override;
+ void skip(Sequence *sequence) override;
};
-/* not used in games but is implemented in engine
-class SequenceItemSideEffects : public SequenceItemDefaultAction {
-public:
- virtual void deserialize(Archive &archive);
- virtual bool execute(int unk, Sequence *sequence, bool unk2);
-private
- Common::Array<SideEffect*> _sideEffects
-};
- */
-
} // End of namespace Pink
#endif
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index a98512e..b10d414 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -43,7 +43,10 @@ Sequencer::~Sequencer() {
for (uint i = 0; i < _timers.size(); ++i) {
delete _timers[i];
}
- removeContext(_context);
+ delete _context;
+ for (uint i = 0; i < _parrallelContexts.size(); ++i) {
+ delete _parrallelContexts[i];
+ }
}
void Sequencer::deserialize(Archive &archive) {
@@ -59,58 +62,39 @@ Sequence *Sequencer::findSequence(const Common::String &name) {
return nullptr;
}
-void Sequencer::authorSequence(Sequence *sequence, bool unk) {
- assert(!_context);
+void Sequencer::authorSequence(Sequence *sequence, bool loadingSave) {
+ if (_context)
+ _context->getSequence()->forceEnd();
if (sequence) {
- SequenceContext *context = new SequenceContext(sequence, this);
+ SequenceContext *context = new SequenceContext(sequence);
SequenceContext *confilct;
- while(confilct = isContextConflicts(context))
- confilct->_sequence->end();
+ while(confilct = findConfilictingContextWith(context))
+ confilct->getSequence()->forceEnd();
_context = context;
- _currentSequenceName = sequence->getName();
- sequence->init(unk);
+ sequence->init(loadingSave);
}
}
-void Sequencer::authorParallelSequence(Sequence *seqeunce, bool unk) {
- if (_context && _context->_sequence == seqeunce)
+void Sequencer::authorParallelSequence(Sequence *seqeunce, bool loadingSave) {
+ if (_context && _context->getSequence() == seqeunce)
return;
for (uint i = 0; i < _parrallelContexts.size(); ++i) {
- if (_parrallelContexts[i]->_sequence == seqeunce)
+ if (_parrallelContexts[i]->getSequence() == seqeunce)
return;
}
const Common::String leadName = _page->getLeadActor()->getName();
+ SequenceContext *context = new SequenceContext(seqeunce);
- SequenceContext *context = new SequenceContext(seqeunce, this);
-
- for (uint i = 0; i < context->_states.size(); ++i) {
- if (context->_states[i].getActor() == leadName) {
- delete context;
- return;
- }
- }
-
- for (uint i = 0; i < context->_states.size(); ++i) {
- if (findMainSequenceActorState(context->_states[i].getActor())) {
- delete context;
- return;
- }
- }
-
- for (uint i = 0; i < context->_states.size(); ++i) {
- if (findParralelSequenceActorState(context->_states[i].getActor())) {
- delete context;
- return;
- }
- }
-
- _parrallelContexts.push_back(context);
- seqeunce->start(unk);
+ if (!context->findState(leadName) && !findConfilictingContextWith(context)) {
+ _parrallelContexts.push_back(context);
+ seqeunce->init(loadingSave);
+ } else
+ delete context;
}
@@ -126,13 +110,19 @@ void Sequencer::toConsole() {
void Sequencer::update() {
if (_context)
- _context->_sequence->update();
+ _context->getSequence()->update();
for (uint i = 0; i < _parrallelContexts.size(); ++i) {
- _parrallelContexts[i]->_sequence->update();
+ _parrallelContexts[i]->getSequence()->update();
}
- updateTimers();
+ uint time = _page->getGame()->getTotalPlayTime();
+ if (time - _time > kTimersUpdateTime) {
+ _time = time;
+ for (uint i = 0; i < _timers.size(); ++i) {
+ _timers[i]->update();
+ }
+ }
}
void Sequencer::removeContext(SequenceContext *context) {
@@ -143,7 +133,8 @@ void Sequencer::removeContext(SequenceContext *context) {
}
for (uint i = 0; i < _parrallelContexts.size(); ++i) {
- if (context == _parrallelContexts[i]->_sequence->_context) {
+ if (context == _parrallelContexts[i]) {
+ delete _parrallelContexts[i];
_parrallelContexts.remove_at(i);
break;
}
@@ -156,50 +147,15 @@ void Sequencer::skipSubSequence() {
}
void Sequencer::restartSequence() {
- _context->getSequence()->restart();
+ if (_context)
+ _context->getSequence()->restart();
}
void Sequencer::skipSequence() {
- if (_context->getSequence()->_unk)
+ if (_context && _context->getSequence()->isSkippingAllowed())
_context->getSequence()->skip();
}
-void Sequencer::updateTimers() {
- uint time = _page->getGame()->getTotalPlayTime();
- if (time - _time <= kTimersUpdateTime) {
- return;
- }
-
- _time = time;
- for (uint i = 0; i < _timers.size(); ++i) {
- _timers[i]->update();
- }
-}
-
-SequenceActorState *Sequencer::findMainSequenceActorState(const Common::String &name) {
- if (!_context)
- return nullptr;
-
- for (uint i = 0; i < _context->_states.size(); ++i) {
- if (_context->_states[i].getActor() == name)
- return &_context->_states[i];
- }
-
- return nullptr;
-}
-
-SequenceActorState *Sequencer::findParralelSequenceActorState(const Common::String &name) {
- for (uint i = 0; i < _parrallelContexts.size(); ++i) {
- for (uint j = 0; j < _parrallelContexts[i]->_states.size(); ++j) {
- if (_parrallelContexts[i]->_states[j].getActor() == name)
- return &_parrallelContexts[i]->_states[j];
- }
- }
-
- return nullptr;
-}
-
-
void Sequencer::loadState(Archive &archive) {
Sequence *sequence = findSequence(archive.readString());
authorSequence(sequence, 1);
@@ -208,21 +164,33 @@ void Sequencer::loadState(Archive &archive) {
void Sequencer::saveState(Archive &archive) {
Common::String sequenceName;
if (_context)
- sequenceName = _context->_sequence->getName();
+ sequenceName = _context->getSequence()->getName();
archive.writeString(sequenceName);
// add pokus specific
}
-SequenceContext * Sequencer::isContextConflicts(SequenceContext *context) {
+SequenceContext *Sequencer::findConfilictingContextWith(SequenceContext *context) {
+ if (_context && _context->isConflictsWith(context)) {
+ return _context;
+ }
for (uint i = 0; i < _parrallelContexts.size(); ++i) {
- for (uint j = 0; j < _parrallelContexts[i]->_states.size(); ++j) {
- for (int k = 0; k < context->_states.size(); ++k) {
- if (_parrallelContexts[i]->_states[j].getActor() == context->_states[k].getActor())
- return _parrallelContexts[i];
- }
- }
+ if (_parrallelContexts[i]->isConflictsWith(context))
+ return _parrallelContexts[i];
}
return nullptr;
}
+SequenceActorState *Sequencer::findState(const Common::String &name) {
+ SequenceActorState *state = nullptr;
+ if (_context && (state = _context->findState(name)))
+ return state;
+
+ for (uint i = 0; i < _parrallelContexts.size(); ++i) {
+ state = _parrallelContexts[i]->findState(name);
+ if (state)
+ break;
+ }
+ return state;
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/sequences/sequencer.h b/engines/pink/objects/sequences/sequencer.h
index 3a421f7..7bb848b 100644
--- a/engines/pink/objects/sequences/sequencer.h
+++ b/engines/pink/objects/sequences/sequencer.h
@@ -38,38 +38,38 @@ public:
Sequencer(GamePage *page);
~Sequencer();
- virtual void toConsole();
+ void toConsole() override;
+ void deserialize(Archive &archive) override;
- virtual void deserialize(Archive &archive);
- Sequence *findSequence(const Common::String &name);
- SequenceActorState *findMainSequenceActorState(const Common::String &name);
- SequenceActorState *findParralelSequenceActorState(const Common::String &name);
-
- void authorSequence(Sequence *sequence, bool unk);
- void authorParallelSequence(Sequence *seqeunce, bool unk);
-
- void removeContext(SequenceContext *context);
+public:
+ void loadState(Archive &archive);
+ void saveState(Archive &archive);
+ bool isPlaying() { return _context != nullptr; }
void update();
+ void authorSequence(Sequence *sequence, bool loadingSave);
+ void authorParallelSequence(Sequence *seqeunce, bool loadingSave);
+
void skipSubSequence();
void restartSequence();
void skipSequence();
- void loadState(Archive &archive);
- void saveState(Archive &archive);
+ void removeContext(SequenceContext *context);
-public:
- void updateTimers();
- SequenceContext * isContextConflicts(SequenceContext *context);
+ SequenceContext *findConfilictingContextWith(SequenceContext *context);
+ Sequence *findSequence(const Common::String &name);
+ SequenceActorState *findState(const Common::String &name);
+
+ GamePage *getPage() const { return _page; }
+private:
SequenceContext *_context;
+ GamePage *_page;
Common::Array<SequenceContext *> _parrallelContexts;
Array<Sequence *> _sequences;
Array<SeqTimer *> _timers;
- Common::String _currentSequenceName;
- GamePage *_page;
uint _time;
};
Commit: fc57a968187d5b0b50a9ee1d4aa257df676fb23e
https://github.com/scummvm/scummvm/commit/fc57a968187d5b0b50a9ee1d4aa257df676fb23e
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: removed FPS counter
Changed paths:
engines/pink/director.cpp
engines/pink/director.h
diff --git a/engines/pink/director.cpp b/engines/pink/director.cpp
index e5af990..fb298b9 100644
--- a/engines/pink/director.cpp
+++ b/engines/pink/director.cpp
@@ -36,27 +36,16 @@ Director::Director()
}
void Director::update() {
- static uint32 time = g_system->getMillis();
- static uint32 times = 0;
-
for (uint i = 0; i < _sounds.size(); ++i) {
_sounds[i]->update();
}
+
for (uint i = 0; i < _sprites.size(); ++i) {
if (_sprites[i]->needsUpdate())
_sprites[i]->update();
}
draw();
-
- times++;
- if (g_system->getMillis() - time >= 1000) {
- debug("FPS: %u ", times);
- sum += times;
- count++;
- time = g_system->getMillis();
- times = 0;
- }
}
void Director::addSprite(ActionCEL *sprite) {
diff --git a/engines/pink/director.h b/engines/pink/director.h
index 0526959..9c89452 100644
--- a/engines/pink/director.h
+++ b/engines/pink/director.h
@@ -64,14 +64,12 @@ public:
Graphics::MacWindowManager &getWndManager() { return _wndManager; };
- uint32 count = 0;
- uint32 sum = 0;
-
private:
void draw();
void mergeDirtyRects();
void drawRect(const Common::Rect &rect);
+private:
Graphics::Screen _surface;
Graphics::MacWindowManager _wndManager;
Common::Array<Common::Rect> _dirtyRects;
Commit: 48a001648e47c287e7e8229f11c88b6c73d73cbe
https://github.com/scummvm/scummvm/commit/48a001648e47c287e7e8229f11c88b6c73d73cbe
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: remove hidden overloaded virtual function
Changed paths:
engines/pink/file.cpp
engines/pink/file.h
engines/pink/pink.cpp
diff --git a/engines/pink/file.cpp b/engines/pink/file.cpp
index f14d459..17968d3 100644
--- a/engines/pink/file.cpp
+++ b/engines/pink/file.cpp
@@ -122,7 +122,7 @@ void OrbFile::seekToObject(const char *name) {
seek(desc->objectsOffset);
}
-bool BroFile::open(const Common::String &name, uint32 orbTimestamp) {
+bool BroFile::open(const Common::String &name) {
if (!File::open(name) || readUint32BE() != 'BRO\0')
return false;
@@ -132,9 +132,9 @@ bool BroFile::open(const Common::String &name, uint32 orbTimestamp) {
if (major != kBroMajorVersion || minor != kBroMinorVersion)
return false;
- uint32 timestamp = readUint32LE();
+ _timestamp = readUint32LE();
- return timestamp == orbTimestamp;
+ return true;
}
} // End of namespace Pink
diff --git a/engines/pink/file.h b/engines/pink/file.h
index 9901a67..611ef31 100644
--- a/engines/pink/file.h
+++ b/engines/pink/file.h
@@ -52,8 +52,8 @@ class Object;
class OrbFile : public Common::File {
public:
OrbFile();
- virtual ~OrbFile();
- virtual bool open(const Common::String &name);
+ ~OrbFile();
+ bool open(const Common::String &name) override;
public:
void loadGame(PinkEngine *game);
@@ -76,7 +76,11 @@ private:
class BroFile : public Common::File {
public:
- bool open(const Common::String &name, uint32 orbTimestamp);
+ bool open(const Common::String &name);
+ uint32 getTimestamp() { return _timestamp; }
+
+private:
+ uint32 _timestamp;
};
} // End of namespace Pink
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index 1337edc..71b42c3 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -79,7 +79,7 @@ Common::Error PinkEngine::init() {
else
debug("This game doesn't need to use bro");
- if (!_orb.open(orbName) || (_bro && !_bro->open(broName, _orb.getTimestamp())))
+ if (!_orb.open(orbName) || (_bro && !_bro->open(broName) && _orb.getTimestamp() == _bro->getTimestamp()))
return Common::kNoGameDataFoundError;
if (!loadCursors())
Commit: 103052fe15594dc16bd03901b67f096b7babc96c
https://github.com/scummvm/scummvm/commit/103052fe15594dc16bd03901b67f096b7babc96c
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix compiler warning about mismatched declarations
Changed paths:
engines/pink/pda_mgr.h
diff --git a/engines/pink/pda_mgr.h b/engines/pink/pda_mgr.h
index 5d84f49..f1fe645 100644
--- a/engines/pink/pda_mgr.h
+++ b/engines/pink/pda_mgr.h
@@ -34,6 +34,8 @@ class LeadActor;
class Command;
class PDAPage;
+struct Command;
+
class PDAMgr {
public:
PDAMgr(PinkEngine *game);
Commit: 6278ab72b42aab91912d60d4b3719bcbddd06ebd
https://github.com/scummvm/scummvm/commit/6278ab72b42aab91912d60d4b3719bcbddd06ebd
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix compiler warning about string literal
Changed paths:
engines/pink/objects/sequences/sequence_context.cpp
diff --git a/engines/pink/objects/sequences/sequence_context.cpp b/engines/pink/objects/sequences/sequence_context.cpp
index 143a46c..4944bd5 100644
--- a/engines/pink/objects/sequences/sequence_context.cpp
+++ b/engines/pink/objects/sequences/sequence_context.cpp
@@ -58,7 +58,7 @@ SequenceContext::SequenceContext(Sequence *sequence)
}
}
if (!found) {
- debug(items[i]->getActor().c_str());
+ debug("%s", items[i]->getActor().c_str());
_states.push_back(SequenceActorState(items[i]->getActor()));
}
}
Commit: 6a2dc6fa0f4320c1aadc273b5fa17de34c6495f6
https://github.com/scummvm/scummvm/commit/6a2dc6fa0f4320c1aadc273b5fa17de34c6495f6
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: remove unused variable
Changed paths:
engines/pink/objects/actors/lead_actor.cpp
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 579015d..c066c7c 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -100,7 +100,6 @@ void LeadActor::start(bool isHandler) {
_nextState = kReady;
}
- InventoryMgr *mgr = getInventoryMgr();
switch (_state) {
case kInventory:
startInventory(1);
Commit: 3134b2d2308ee122dc23869392133cb560195cb3
https://github.com/scummvm/scummvm/commit/3134b2d2308ee122dc23869392133cb560195cb3
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix wrong deleting of conflicting contexts
Changed paths:
engines/pink/objects/sequences/sequencer.cpp
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index b10d414..9ba10aa 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -70,7 +70,7 @@ void Sequencer::authorSequence(Sequence *sequence, bool loadingSave) {
SequenceContext *context = new SequenceContext(sequence);
SequenceContext *confilct;
- while(confilct = findConfilictingContextWith(context))
+ while((confilct = findConfilictingContextWith(context)) != nullptr)
confilct->getSequence()->forceEnd();
_context = context;
Commit: 3143cc3f29948af537fe12605a2d2d227c307e1d
https://github.com/scummvm/scummvm/commit/3143cc3f29948af537fe12605a2d2d227c307e1d
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: add saving/loading of parallel contexts
Changed paths:
engines/pink/objects/sequences/sequencer.cpp
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index 9ba10aa..a92ed54 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -159,6 +159,12 @@ void Sequencer::skipSequence() {
void Sequencer::loadState(Archive &archive) {
Sequence *sequence = findSequence(archive.readString());
authorSequence(sequence, 1);
+
+ uint size = archive.readWORD();
+ for (uint i = 0; i < size; ++i) {
+ sequence = findSequence(archive.readString());
+ authorParallelSequence(sequence, 1);
+ }
}
void Sequencer::saveState(Archive &archive) {
@@ -166,7 +172,11 @@ void Sequencer::saveState(Archive &archive) {
if (_context)
sequenceName = _context->getSequence()->getName();
archive.writeString(sequenceName);
- // add pokus specific
+
+ archive.writeWORD(_parrallelContexts.size());
+ for (uint i = 0; i < _parrallelContexts.size(); ++i) {
+ archive.writeString(_parrallelContexts[i]->getSequence()->getName());
+ }
}
SequenceContext *Sequencer::findConfilictingContextWith(SequenceContext *context) {
Commit: 25a9e093c246a6a9ef4ca0706ccf0e7e6b740394
https://github.com/scummvm/scummvm/commit/25a9e093c246a6a9ef4ca0706ccf0e7e6b740394
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix include statement
Changed paths:
engines/pink/objects/pages/pda_page.h
diff --git a/engines/pink/objects/pages/pda_page.h b/engines/pink/objects/pages/pda_page.h
index 51b7a5e..fe0443b 100644
--- a/engines/pink/objects/pages/pda_page.h
+++ b/engines/pink/objects/pages/pda_page.h
@@ -23,7 +23,7 @@
#ifndef PINK_PDA_PAGE_H
#define PINK_PDA_PAGE_H
-#include "page.h"
+#include "pink/objects/pages/page.h"
namespace Pink {
Commit: 28a1ff755525bf939e6b6e8a4129ca993673e291
https://github.com/scummvm/scummvm/commit/28a1ff755525bf939e6b6e8a4129ca993673e291
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix shadowing declarations
Changed paths:
engines/pink/objects/sequences/sequence_context.cpp
engines/pink/objects/sequences/sequence_context.h
engines/pink/objects/sequences/sequence_item.cpp
diff --git a/engines/pink/objects/sequences/sequence_context.cpp b/engines/pink/objects/sequences/sequence_context.cpp
index 4944bd5..2e48554 100644
--- a/engines/pink/objects/sequences/sequence_context.cpp
+++ b/engines/pink/objects/sequences/sequence_context.cpp
@@ -32,9 +32,9 @@
namespace Pink {
void SequenceActorState::execute(uint segment, Sequence *sequence, bool loadingSave) const {
- Actor *actor = sequence->getSequencer()->getPage()->findActor(this->actor);
- if (actor && this->segment != segment && !defaultAction.empty()) {
- Action *action = actor->findAction(defaultAction);
+ Actor *actor = sequence->getSequencer()->getPage()->findActor(this->actorName);
+ if (actor && _segment != segment && !defaultActionName.empty()) {
+ Action *action = actor->findAction(defaultActionName);
if (action && actor->getAction() != action) {
actor->setAction(action, loadingSave);
}
@@ -52,7 +52,7 @@ SequenceContext::SequenceContext(Sequence *sequence)
for (uint i = 0; i < items.size(); ++i) {
bool found = 0;
for (uint j = 0; j < _states.size(); ++j) {
- if (items[i]->getActor() == _states[j].actor) {
+ if (items[i]->getActor() == _states[j].actorName) {
found = 1;
break;
}
@@ -76,13 +76,13 @@ void SequenceContext::execute(uint nextItemIndex, bool loadingSave) {
void SequenceContext::clearDefaultActions() {
for (uint i = 0; i < _states.size(); ++i) {
- _states[i].defaultAction.clear();
+ _states[i].defaultActionName.clear();
}
}
SequenceActorState *SequenceContext::findState(const Common::String &actor) {
for (uint i = 0; i < _states.size(); ++i) {
- if (_states[i].actor == actor)
+ if (_states[i].actorName == actor)
return &_states[i];
}
return nullptr;
@@ -90,7 +90,7 @@ SequenceActorState *SequenceContext::findState(const Common::String &actor) {
bool SequenceContext::isConflictsWith(SequenceContext *context) {
for (uint i = 0; i < _states.size(); ++i) {
- if (context->findState(_states[i].actor))
+ if (context->findState(_states[i].actorName))
return true;
}
return false;
diff --git a/engines/pink/objects/sequences/sequence_context.h b/engines/pink/objects/sequences/sequence_context.h
index 931c9462..ccca20e 100644
--- a/engines/pink/objects/sequences/sequence_context.h
+++ b/engines/pink/objects/sequences/sequence_context.h
@@ -31,14 +31,14 @@ class Sequence;
class Sequencer;
struct SequenceActorState {
- SequenceActorState(const Common::String actorName)
- : actor(actorName), segment(0) {}
+ SequenceActorState(const Common::String actor)
+ : actorName(actor), _segment(0) {}
void execute(uint segment, Sequence *sequence, bool loadingSave) const;
- Common::String actor;
- Common::String defaultAction;
- uint segment;
+ Common::String actorName;
+ Common::String defaultActionName;
+ uint _segment;
};
class Actor;
diff --git a/engines/pink/objects/sequences/sequence_item.cpp b/engines/pink/objects/sequences/sequence_item.cpp
index ee40947..15a39f1 100644
--- a/engines/pink/objects/sequences/sequence_item.cpp
+++ b/engines/pink/objects/sequences/sequence_item.cpp
@@ -53,7 +53,7 @@ bool SequenceItem::execute(uint segment, Sequence *sequence, bool loadingSave) {
SequenceContext *context = sequence->getContext();
SequenceActorState *state = context->findState(_actor);
if (state)
- state->segment = segment;
+ state->_segment = segment;
if (isLeader())
context->setActor(actor);
return true;
@@ -84,7 +84,7 @@ void SequenceItemLeaderAudio::toConsole() {
bool SequenceItemDefaultAction::execute(uint segment, Sequence *sequence, bool loadingSave) {
SequenceActorState *state = sequence->getContext()->findState(_actor);
if (state)
- state->defaultAction = _action;
+ state->defaultActionName = _action;
return true;
}
Commit: 99416cb3313a8d3478329b3f35a92e27afd5146f
https://github.com/scummvm/scummvm/commit/99416cb3313a8d3478329b3f35a92e27afd5146f
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix mismatched declarations
Changed paths:
engines/pink/objects/sequences/sequencer.h
engines/pink/pda_mgr.h
diff --git a/engines/pink/objects/sequences/sequencer.h b/engines/pink/objects/sequences/sequencer.h
index 7bb848b..7c74b27 100644
--- a/engines/pink/objects/sequences/sequencer.h
+++ b/engines/pink/objects/sequences/sequencer.h
@@ -31,7 +31,8 @@ class Sequence;
class SequenceContext;
class GamePage;
class SeqTimer;
-class SequenceActorState;
+
+struct SequenceActorState;
class Sequencer : public Object {
public:
diff --git a/engines/pink/pda_mgr.h b/engines/pink/pda_mgr.h
index f1fe645..6521539 100644
--- a/engines/pink/pda_mgr.h
+++ b/engines/pink/pda_mgr.h
@@ -31,7 +31,6 @@ namespace Pink {
class PinkEngine;
class Actor;
class LeadActor;
-class Command;
class PDAPage;
struct Command;
Commit: b670fba4c91c09fa6fd3642e241af5116c46844c
https://github.com/scummvm/scummvm/commit/b670fba4c91c09fa6fd3642e241af5116c46844c
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: remove extra indentation
Changed paths:
engines/pink/objects/actors/lead_actor.cpp
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index c066c7c..4168568 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -367,8 +367,8 @@ bool LeadActor::sendUseClickMessage(Actor *actor) {
actor->onUseClickMessage(mgr->getCurrentItem(), mgr);
if (item->getCurrentOwner() != this->_name)
_isHaveItem = false;
- forceUpdateCursor();
- return true;
+ forceUpdateCursor();
+ return true;
}
bool LeadActor::sendLeftClickMessage(Actor *actor) {
Commit: c139197930090e12a2d1ed3de755cb9753ca5cf3
https://github.com/scummvm/scummvm/commit/c139197930090e12a2d1ed3de755cb9753ca5cf3
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Fix warning
Changed paths:
engines/pink/resource_mgr.cpp
diff --git a/engines/pink/resource_mgr.cpp b/engines/pink/resource_mgr.cpp
index b2652ff..35aecb7 100644
--- a/engines/pink/resource_mgr.cpp
+++ b/engines/pink/resource_mgr.cpp
@@ -57,7 +57,7 @@ Common::String ResourceMgr::loadText(Common::String &name) {
Common::SeekableReadStream *stream = getResourceStream(name);
char *txt = new char[stream->size()];
Common::String str(txt, stream->size());
- delete txt;
+ delete [] txt;
return str;
}
Commit: 5142ed203c241386b620237d7fd8814d9273dac2
https://github.com/scummvm/scummvm/commit/5142ed203c241386b620237d7fd8814d9273dac2
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: JANITORIAL: Indentation fixes
Changed paths:
engines/pink/archive.cpp
engines/pink/cel_decoder.cpp
engines/pink/file.cpp
engines/pink/objects/actors/supporting_actor.cpp
engines/pink/objects/handlers/handler_mgr.cpp
engines/pink/objects/inventory.cpp
engines/pink/objects/module.cpp
engines/pink/objects/walk/walk_shortest_path.cpp
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp
index c5737ba..2c156c2 100644
--- a/engines/pink/archive.cpp
+++ b/engines/pink/archive.cpp
@@ -104,110 +104,110 @@ static const struct RuntimeClass {
{"WalkLocation", kWalkLocation}
};
-static Object* createObject(int objectId){
- switch (objectId){
- case kActionHide:
- return new ActionHide;
- case kActionLoop:
- return new ActionLoop;
- case kActionPlay:
- return new ActionPlay;
- case kActionPlayWithSfx:
- return new ActionPlayWithSfx;
- case kActionSfx:
- return new ActionSfx;
- case kActionSound:
- return new ActionSound;
- case kActionStill:
- return new ActionStill;
- case kActionTalk:
- return new ActionTalk;
- case kActionText:
- return new ActionText;
- case kActor:
- return new Actor;
- case kAudioInfoPDAButton:
- return new AudioInfoPDAButton;
- case kConditionGameVariable:
- return new ConditionGameVariable;
- case kConditionInventoryItemOwner:
- return new ConditionInventoryItemOwner;
- case kConditionModuleVariable:
- return new ConditionModuleVariable;
- case kConditionNotInventoryItemOwner:
- return new ConditionNotInventoryItemOwner;
- case kConditionNotModuleVariable:
- return new ConditionNotModuleVariable;
- case kConditionNotPageVariable:
- return new ConditionNotPageVariable;
- case kConditionPageVariable:
- return new ConditionPageVariable;
- case kCursorActor:
- return new CursorActor;
- case kGamePage:
- return new GamePage;
- case kHandlerLeftClick:
- return new HandlerLeftClick;
- case kHandlerStartPage:
- return new HandlerStartPage;
- case kHandlerTimer:
- case kHandlerTimerActions:
- return new HandlerTimerActions; // hack for Peril, but behavior is correct
- case kHandlerTimerSequences:
- return new HandlerTimerSequences;
- case kHandlerUseClick:
- return new HandlerUseClick;
- case kInventoryActor:
- return new InventoryActor;
- case kInventoryItem:
- return new InventoryItem;
- case kLeadActor:
- return new LeadActor;
- case kModuleProxy:
- return new ModuleProxy;
- case kPDAButtonActor:
- return new PDAButtonActor;
- case kParlSqPink:
- return new ParlSqPink;
- case kPubPink:
- return new PubPink;
- case kSeqTimer:
- return new SeqTimer;
- case kSequence:
- return new Sequence;
- case kSequenceAudio:
- return new SequenceAudio;
- case kSequenceItem:
- return new SequenceItem;
- case kSequenceItemDefaultAction:
- return new SequenceItemDefaultAction;
- case kSequenceItemLeader:
- return new SequenceItemLeader;
- case kSequenceItemLeaderAudio:
- return new SequenceItemLeaderAudio;
- case kSideEffectExit:
- return new SideEffectExit;
- case kSideEffectGameVariable:
- return new SideEffectGameVariable;
- case kSideEffectInventoryItemOwner:
- return new SideEffectInventoryItemOwner;
- case kSideEffectLocation:
- return new SideEffectLocation;
- case kSideEffectModuleVariable:
- return new SideEffectModuleVariable;
- case kSideEffectPageVariable:
- return new SideEffectPageVariable;
- case kSideEffectRandomPageVariable:
- return new SideEffectRandomPageVariable;
- case kSupportingActor:
- return new SupportingActor;
- case kWalkAction:
- return new WalkAction;
- case kWalkLocation:
- return new WalkLocation;
- default:
- error("Unknown object id");
- return nullptr;
+static Object* createObject(int objectId) {
+ switch (objectId) {
+ case kActionHide:
+ return new ActionHide;
+ case kActionLoop:
+ return new ActionLoop;
+ case kActionPlay:
+ return new ActionPlay;
+ case kActionPlayWithSfx:
+ return new ActionPlayWithSfx;
+ case kActionSfx:
+ return new ActionSfx;
+ case kActionSound:
+ return new ActionSound;
+ case kActionStill:
+ return new ActionStill;
+ case kActionTalk:
+ return new ActionTalk;
+ case kActionText:
+ return new ActionText;
+ case kActor:
+ return new Actor;
+ case kAudioInfoPDAButton:
+ return new AudioInfoPDAButton;
+ case kConditionGameVariable:
+ return new ConditionGameVariable;
+ case kConditionInventoryItemOwner:
+ return new ConditionInventoryItemOwner;
+ case kConditionModuleVariable:
+ return new ConditionModuleVariable;
+ case kConditionNotInventoryItemOwner:
+ return new ConditionNotInventoryItemOwner;
+ case kConditionNotModuleVariable:
+ return new ConditionNotModuleVariable;
+ case kConditionNotPageVariable:
+ return new ConditionNotPageVariable;
+ case kConditionPageVariable:
+ return new ConditionPageVariable;
+ case kCursorActor:
+ return new CursorActor;
+ case kGamePage:
+ return new GamePage;
+ case kHandlerLeftClick:
+ return new HandlerLeftClick;
+ case kHandlerStartPage:
+ return new HandlerStartPage;
+ case kHandlerTimer:
+ case kHandlerTimerActions:
+ return new HandlerTimerActions; // hack for Peril, but behavior is correct
+ case kHandlerTimerSequences:
+ return new HandlerTimerSequences;
+ case kHandlerUseClick:
+ return new HandlerUseClick;
+ case kInventoryActor:
+ return new InventoryActor;
+ case kInventoryItem:
+ return new InventoryItem;
+ case kLeadActor:
+ return new LeadActor;
+ case kModuleProxy:
+ return new ModuleProxy;
+ case kPDAButtonActor:
+ return new PDAButtonActor;
+ case kParlSqPink:
+ return new ParlSqPink;
+ case kPubPink:
+ return new PubPink;
+ case kSeqTimer:
+ return new SeqTimer;
+ case kSequence:
+ return new Sequence;
+ case kSequenceAudio:
+ return new SequenceAudio;
+ case kSequenceItem:
+ return new SequenceItem;
+ case kSequenceItemDefaultAction:
+ return new SequenceItemDefaultAction;
+ case kSequenceItemLeader:
+ return new SequenceItemLeader;
+ case kSequenceItemLeaderAudio:
+ return new SequenceItemLeaderAudio;
+ case kSideEffectExit:
+ return new SideEffectExit;
+ case kSideEffectGameVariable:
+ return new SideEffectGameVariable;
+ case kSideEffectInventoryItemOwner:
+ return new SideEffectInventoryItemOwner;
+ case kSideEffectLocation:
+ return new SideEffectLocation;
+ case kSideEffectModuleVariable:
+ return new SideEffectModuleVariable;
+ case kSideEffectPageVariable:
+ return new SideEffectPageVariable;
+ case kSideEffectRandomPageVariable:
+ return new SideEffectRandomPageVariable;
+ case kSupportingActor:
+ return new SupportingActor;
+ case kWalkAction:
+ return new WalkAction;
+ case kWalkLocation:
+ return new WalkLocation;
+ default:
+ error("Unknown object id");
+ return nullptr;
}
}
diff --git a/engines/pink/cel_decoder.cpp b/engines/pink/cel_decoder.cpp
index 4e5b8a0..5dbe943 100644
--- a/engines/pink/cel_decoder.cpp
+++ b/engines/pink/cel_decoder.cpp
@@ -86,7 +86,7 @@ void CelDecoder::setEndOfTrack() {
}
CelDecoder::CelVideoTrack::CelVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height, bool skipHeader)
- : FlicVideoTrack(stream, frameCount, width, height, 1), _center(0,0), _transparentColourIndex(0){
+ : FlicVideoTrack(stream, frameCount, width, height, 1), _center(0,0), _transparentColourIndex(0) {
readHeader();
}
diff --git a/engines/pink/file.cpp b/engines/pink/file.cpp
index 17968d3..34a7218 100644
--- a/engines/pink/file.cpp
+++ b/engines/pink/file.cpp
@@ -100,13 +100,13 @@ static int objDescComp(const void *a, const void *b) {
return scumm_stricmp((char *) a, (char *) b);
}
-ObjectDescription *OrbFile::getObjDesc(const char *name){
+ObjectDescription *OrbFile::getObjDesc(const char *name) {
ObjectDescription *desc = (ObjectDescription*) bsearch(name, _table, _tableSize, sizeof(ObjectDescription), objDescComp);
assert(desc != nullptr);
return desc;
}
-ResourceDescription *OrbFile::createResDescTable(ObjectDescription *objDesc){
+ResourceDescription *OrbFile::createResDescTable(ObjectDescription *objDesc) {
ResourceDescription *table = new ResourceDescription[objDesc->resourcesCount];
seek(objDesc->resourcesOffset);
diff --git a/engines/pink/objects/actors/supporting_actor.cpp b/engines/pink/objects/actors/supporting_actor.cpp
index 8262267..426b358 100644
--- a/engines/pink/objects/actors/supporting_actor.cpp
+++ b/engines/pink/objects/actors/supporting_actor.cpp
@@ -55,7 +55,7 @@ bool SupportingActor::isUseClickHandlers(InventoryItem *item) {
}
void SupportingActor::onMouseOver(Common::Point point, CursorMgr *mgr) {
- if (isLeftClickHandlers()){
+ if (isLeftClickHandlers()) {
if (!_cursor.empty())
mgr->setCursor(_cursor, point);
else
diff --git a/engines/pink/objects/handlers/handler_mgr.cpp b/engines/pink/objects/handlers/handler_mgr.cpp
index cf5b6ca..e68b63e 100644
--- a/engines/pink/objects/handlers/handler_mgr.cpp
+++ b/engines/pink/objects/handlers/handler_mgr.cpp
@@ -55,7 +55,7 @@ bool HandlerMgr::isLeftClickHandler(Actor *actor) {
return false;
}
-bool HandlerMgr::isUseClickHandler(Actor *actor, const Common::String &itemName){
+bool HandlerMgr::isUseClickHandler(Actor *actor, const Common::String &itemName) {
for (uint i = 0; i < _useClickHandlers.size(); ++i) {
if (itemName == _useClickHandlers[i]->getInventoryItem() &&
_useClickHandlers[i]->isSuitable(actor))
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
index 859b96a..ddf124a 100644
--- a/engines/pink/objects/inventory.cpp
+++ b/engines/pink/objects/inventory.cpp
@@ -76,7 +76,7 @@ bool InventoryMgr::isPinkOwnsAnyItems() {
return true;
for (uint i = 0; i < _items.size(); ++i) {
- if (_items[i]->getCurrentOwner() == _lead->getName()){
+ if (_items[i]->getCurrentOwner() == _lead->getName()) {
_item = _items[i];
return true;
}
diff --git a/engines/pink/objects/module.cpp b/engines/pink/objects/module.cpp
index ec17105..b1f1087 100644
--- a/engines/pink/objects/module.cpp
+++ b/engines/pink/objects/module.cpp
@@ -41,7 +41,7 @@ Module::~Module() {
}
}
-void Module::load(Archive &archive){
+void Module::load(Archive &archive) {
archive.mapObject(this);
NamedObject::deserialize(archive);
diff --git a/engines/pink/objects/walk/walk_shortest_path.cpp b/engines/pink/objects/walk/walk_shortest_path.cpp
index 4f16f54..9bc86d1 100644
--- a/engines/pink/objects/walk/walk_shortest_path.cpp
+++ b/engines/pink/objects/walk/walk_shortest_path.cpp
@@ -74,7 +74,7 @@ WalkLocation *WalkShortestPath::build() {
}
WalkLocation *WalkShortestPath::getNearestNeighbor(WalkLocation *location) {
- for(uint i = 0; i < _visited.size(); ++i){
+ for(uint i = 0; i < _visited.size(); ++i) {
if (_visited[i] == location)
return _nearestNeigbor[i];
}
Commit: c3e1157d18022795f23b37a876ae51e31c38adba
https://github.com/scummvm/scummvm/commit/c3e1157d18022795f23b37a876ae51e31c38adba
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: JANITORIAL: More formatting fixes
Changed paths:
engines/pink/archive.cpp
engines/pink/cel_decoder.cpp
engines/pink/cursor_mgr.cpp
engines/pink/director.cpp
engines/pink/director.h
engines/pink/file.cpp
engines/pink/objects/actions/action.cpp
engines/pink/objects/actions/action_play_with_sfx.cpp
engines/pink/objects/actors/actor.cpp
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/inventory.h
engines/pink/objects/pages/game_page.cpp
engines/pink/objects/sequences/seq_timer.cpp
engines/pink/objects/sequences/sequence.cpp
engines/pink/objects/sequences/sequence_context.cpp
engines/pink/objects/walk/walk_mgr.cpp
engines/pink/pda_mgr.cpp
engines/pink/resource_mgr.cpp
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp
index 2c156c2..c96cd8f 100644
--- a/engines/pink/archive.cpp
+++ b/engines/pink/archive.cpp
@@ -104,7 +104,7 @@ static const struct RuntimeClass {
{"WalkLocation", kWalkLocation}
};
-static Object* createObject(int objectId) {
+static Object *createObject(int objectId) {
switch (objectId) {
case kActionHide:
return new ActionHide;
@@ -303,7 +303,7 @@ static int runtimeClassCmp(const void *key, const void *elem) {
}
uint Archive::findObjectId(const char *name) {
- RuntimeClass *found = (RuntimeClass*) bsearch(name, classMap, sizeof(classMap) / sizeof(RuntimeClass) , sizeof(RuntimeClass), runtimeClassCmp);
+ RuntimeClass *found = (RuntimeClass *)bsearch(name, classMap, sizeof(classMap) / sizeof(RuntimeClass) , sizeof(RuntimeClass), runtimeClassCmp);
if (!found)
error("Class %s is not in class Map", name);
diff --git a/engines/pink/cel_decoder.cpp b/engines/pink/cel_decoder.cpp
index 5dbe943..77aedc4 100644
--- a/engines/pink/cel_decoder.cpp
+++ b/engines/pink/cel_decoder.cpp
@@ -55,33 +55,33 @@ bool CelDecoder::loadStream(Common::SeekableReadStream *stream) {
uint16 CelDecoder::getTransparentColourIndex() {
- CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
+ CelVideoTrack *track = (CelVideoTrack *)getTrack(0);
if (!track)
return 0;
return track->getTransparentColourIndex();
}
const Graphics::Surface *CelDecoder::getCurrentFrame() {
- CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
+ CelVideoTrack *track = (CelVideoTrack *)getTrack(0);
if (!track)
return 0;
return track->getCurrentFrame();
}
Common::Point CelDecoder::getCenter() {
- CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
+ CelVideoTrack *track = (CelVideoTrack *)getTrack(0);
if (!track)
return Common::Point(0, 0);
return track->getCenter();
}
void CelDecoder::skipFrame() {
- CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
+ CelVideoTrack *track = (CelVideoTrack *)getTrack(0);
track->skipFrame();
}
void CelDecoder::setEndOfTrack() {
- CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
+ CelVideoTrack *track = (CelVideoTrack *)getTrack(0);
track->setEndOfTrack();
}
@@ -170,7 +170,7 @@ void CelDecoder::CelVideoTrack::skipFrame() {
}
if (_curFrame == 0)
- _transparentColourIndex = *(byte*)_surface->getBasePtr(0,0);
+ _transparentColourIndex = *(byte *)_surface->getBasePtr(0,0);
}
@@ -201,7 +201,7 @@ const Graphics::Surface *CelDecoder::CelVideoTrack::decodeNextFrame() {
}
if (_curFrame == 0)
- _transparentColourIndex = *(byte*)_surface->getBasePtr(0,0);
+ _transparentColourIndex = *(byte *)_surface->getBasePtr(0,0);
return _surface;
}
diff --git a/engines/pink/cursor_mgr.cpp b/engines/pink/cursor_mgr.cpp
index 084578a..fe70c9f 100644
--- a/engines/pink/cursor_mgr.cpp
+++ b/engines/pink/cursor_mgr.cpp
@@ -97,7 +97,7 @@ void CursorMgr::startAnimation(uint index) {
void CursorMgr::showItem(const Common::String &itemName, const Common::Point point) {
if (!_actor)
- _actor = static_cast<CursorActor*>(_page->findActor(kCursor));
+ _actor = static_cast<CursorActor *>(_page->findActor(kCursor));
_actor->setCursorItem(itemName, point);
}
diff --git a/engines/pink/director.cpp b/engines/pink/director.cpp
index fb298b9..2211185 100644
--- a/engines/pink/director.cpp
+++ b/engines/pink/director.cpp
@@ -107,7 +107,7 @@ Actor *Director::getActorByPoint(const Common::Point point) {
const Graphics::Surface *frame = decoder->getCurrentFrame();
const Common::Rect &rect = _sprites[i]->getBounds();
if (rect.contains(point)) {
- byte spritePixel = *(const byte*) frame->getBasePtr(point.x - rect.left, point.y - rect.top);
+ byte spritePixel = *(const byte *)frame->getBasePtr(point.x - rect.left, point.y - rect.top);
if (spritePixel != decoder->getTransparentColourIndex())
return _sprites[i]->getActor();
}
diff --git a/engines/pink/director.h b/engines/pink/director.h
index 9c89452..3fdb753 100644
--- a/engines/pink/director.h
+++ b/engines/pink/director.h
@@ -50,8 +50,8 @@ public:
void addDirtyRect(const Common::Rect &rect);
void addDirtyRects(ActionCEL *sprite);
- void addSound(ActionSound* sound) { _sounds.push_back(sound); };
- void removeSound(ActionSound* sound);
+ void addSound(ActionSound *sound) { _sounds.push_back(sound); };
+ void removeSound(ActionSound *sound);
void clear();
diff --git a/engines/pink/file.cpp b/engines/pink/file.cpp
index 34a7218..c0a24c1 100644
--- a/engines/pink/file.cpp
+++ b/engines/pink/file.cpp
@@ -28,7 +28,7 @@ void ObjectDescription::load(Common::File &file) {
file.read(name, sizeof(name));
objectsOffset = file.readUint32LE();
- /*objectsCount*/ file.readUint32LE();
+ /* objectsCount = */ file.readUint32LE();
resourcesOffset = file.readUint32LE();
resourcesCount = file.readUint32LE();
}
@@ -80,7 +80,7 @@ bool OrbFile::open(const Common::String &name) {
void OrbFile::loadGame(PinkEngine *game) {
seekToObject(kPinkGame);
Archive archive(this);
- archive.mapObject(reinterpret_cast<Object*>(game)); // hack
+ archive.mapObject(reinterpret_cast<Object *>(game)); // hack
game->load(archive);
}
@@ -97,11 +97,11 @@ void OrbFile::loadObject(Object *obj, ObjectDescription *objDesc) {
}
static int objDescComp(const void *a, const void *b) {
- return scumm_stricmp((char *) a, (char *) b);
+ return scumm_stricmp((char *)a, (char *)b);
}
ObjectDescription *OrbFile::getObjDesc(const char *name) {
- ObjectDescription *desc = (ObjectDescription*) bsearch(name, _table, _tableSize, sizeof(ObjectDescription), objDescComp);
+ ObjectDescription *desc = (ObjectDescription *)bsearch(name, _table, _tableSize, sizeof(ObjectDescription), objDescComp);
assert(desc != nullptr);
return desc;
}
diff --git a/engines/pink/objects/actions/action.cpp b/engines/pink/objects/actions/action.cpp
index 24233ad..6a306b9 100644
--- a/engines/pink/objects/actions/action.cpp
+++ b/engines/pink/objects/actions/action.cpp
@@ -28,7 +28,7 @@ namespace Pink {
void Action::deserialize(Archive &archive) {
NamedObject::deserialize(archive);
- _actor = static_cast<Actor*>(archive.readObject());
+ _actor = static_cast<Actor *>(archive.readObject());
}
bool Action::initPalette(Director *director) {
diff --git a/engines/pink/objects/actions/action_play_with_sfx.cpp b/engines/pink/objects/actions/action_play_with_sfx.cpp
index 2e94098..b70cb56 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.cpp
+++ b/engines/pink/objects/actions/action_play_with_sfx.cpp
@@ -74,7 +74,7 @@ void ActionSfx::deserialize(Pink::Archive &archive) {
_volume = archive.readDWORD();
assert(_volume <= 100);
_sfxName = archive.readString();
- _sprite = (ActionPlayWithSfx*) archive.readObject();
+ _sprite = (ActionPlayWithSfx *)archive.readObject();
}
void ActionSfx::toConsole() {
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index 0fc6e89..4a70e1d 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -41,7 +41,7 @@ Actor::~Actor() {
void Actor::deserialize(Archive &archive) {
NamedObject::deserialize(archive);
- _page = static_cast<Page*>(archive.readObject());
+ _page = static_cast<Page *>(archive.readObject());
_actions.deserialize(archive);
}
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 4168568..872428d 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -41,9 +41,9 @@ LeadActor::LeadActor()
void LeadActor::deserialize(Archive &archive) {
_state = kReady;
Actor::deserialize(archive);
- _cursorMgr = static_cast<CursorMgr*>(archive.readObject());
- _walkMgr = static_cast<WalkMgr*>(archive.readObject());
- _sequencer = static_cast<Sequencer*>(archive.readObject());
+ _cursorMgr = static_cast<CursorMgr *>(archive.readObject());
+ _walkMgr = static_cast<WalkMgr *>(archive.readObject());
+ _sequencer = static_cast<Sequencer *>(archive.readObject());
}
void LeadActor::toConsole() {
diff --git a/engines/pink/objects/inventory.h b/engines/pink/objects/inventory.h
index c9357fc..15c21bf 100644
--- a/engines/pink/objects/inventory.h
+++ b/engines/pink/objects/inventory.h
@@ -62,7 +62,7 @@ public:
bool start(bool paused);
void setLeadActor(LeadActor *lead) { _lead = lead; }
- InventoryItem* findInventoryItem(const Common::String &name);
+ InventoryItem *findInventoryItem(const Common::String &name);
bool isPinkOwnsAnyItems();
void setItemOwner(const Common::String &owner, InventoryItem *item);
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index 4c05da0..5b69be1 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -50,8 +50,8 @@ void GamePage::toConsole() {
void GamePage::deserialize(Archive &archive) {
Page::deserialize(archive);
- _module = static_cast<Module*>(archive.readObject());
- assert(dynamic_cast<Module*>(_module) != 0);
+ _module = static_cast<Module *>(archive.readObject());
+ assert(dynamic_cast<Module *>(_module) != 0);
}
void GamePage::load(Archive &archive) {
@@ -62,7 +62,7 @@ void GamePage::load(Archive &archive) {
Page::load(archive);
- _leadActor = static_cast<LeadActor*>(archive.readObject());
+ _leadActor = static_cast<LeadActor *>(archive.readObject());
_walkMgr->deserialize(archive);
_sequencer->deserialize(archive);
@@ -131,7 +131,7 @@ void GamePage::setVariable(Common::String &variable, Common::String &value) {
}
void GamePage::loadStateFromMem() {
- Archive archive(static_cast<Common::SeekableReadStream*>(_memFile));
+ Archive archive(static_cast<Common::SeekableReadStream *>(_memFile));
_variables.deserialize(archive);
for (uint i = 0; i < _actors.size(); ++i) {
@@ -141,7 +141,7 @@ void GamePage::loadStateFromMem() {
void GamePage::saveStateToMem() {
_memFile = new Common::MemoryReadWriteStream(DisposeAfterUse::YES);
- Archive archive(static_cast<Common::WriteStream*>(_memFile));
+ Archive archive(static_cast<Common::WriteStream *>(_memFile));
_variables.serialize(archive);
for (uint i = 0; i < _actors.size(); ++i) {
diff --git a/engines/pink/objects/sequences/seq_timer.cpp b/engines/pink/objects/sequences/seq_timer.cpp
index 8d639ac..c1eff07 100644
--- a/engines/pink/objects/sequences/seq_timer.cpp
+++ b/engines/pink/objects/sequences/seq_timer.cpp
@@ -38,7 +38,7 @@ void SeqTimer::deserialize(Archive &archive) {
_actor = archive.readString();
_period = archive.readDWORD();
_range = archive.readDWORD();
- _sequencer = static_cast<Sequencer*>(archive.readObject());
+ _sequencer = static_cast<Sequencer *>(archive.readObject());
}
void SeqTimer::toConsole() {
diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp
index a700e99..3c0c69d 100644
--- a/engines/pink/objects/sequences/sequence.cpp
+++ b/engines/pink/objects/sequences/sequence.cpp
@@ -45,7 +45,7 @@ Sequence::~Sequence() {
void Sequence::deserialize(Archive &archive) {
NamedObject::deserialize(archive);
- _sequencer = static_cast<Sequencer*>(archive.readObject());
+ _sequencer = static_cast<Sequencer *>(archive.readObject());
_items.deserialize(archive);
}
@@ -144,7 +144,7 @@ void SequenceAudio::start(bool loadingSave) {
Sequence::start(loadingSave);
uint index = _context->getNextItemIndex();
if (index < _items.size()) {
- SequenceItemLeaderAudio* leaderAudio = (SequenceItemLeaderAudio*) _items[index];
+ SequenceItemLeaderAudio *leaderAudio = (SequenceItemLeaderAudio *) _items[index];
_sample = leaderAudio->getSample();
}
}
diff --git a/engines/pink/objects/sequences/sequence_context.cpp b/engines/pink/objects/sequences/sequence_context.cpp
index 2e48554..2c8d10d 100644
--- a/engines/pink/objects/sequences/sequence_context.cpp
+++ b/engines/pink/objects/sequences/sequence_context.cpp
@@ -46,7 +46,7 @@ SequenceContext::SequenceContext(Sequence *sequence)
_segment(1), _actor(nullptr)
{
sequence->setContext(this);
- Common::Array<SequenceItem*> &items = sequence->getItems();
+ Common::Array<SequenceItem *> &items = sequence->getItems();
debug("SequenceContext for %s", _sequence->getName().c_str());
for (uint i = 0; i < items.size(); ++i) {
diff --git a/engines/pink/objects/walk/walk_mgr.cpp b/engines/pink/objects/walk/walk_mgr.cpp
index 7e88ac9..e9d2bb0 100644
--- a/engines/pink/objects/walk/walk_mgr.cpp
+++ b/engines/pink/objects/walk/walk_mgr.cpp
@@ -98,7 +98,7 @@ WalkAction *WalkMgr::getWalkAction() {
Action *action = _leadActor->findAction(walkActionName);
- return static_cast<WalkAction*>(action);
+ return static_cast<WalkAction *>(action);
}
double WalkMgr::getLengthBetweenLocations(WalkLocation *first, WalkLocation *second) {
diff --git a/engines/pink/pda_mgr.cpp b/engines/pink/pda_mgr.cpp
index 1b7b8dd..db6f1e4 100644
--- a/engines/pink/pda_mgr.cpp
+++ b/engines/pink/pda_mgr.cpp
@@ -77,9 +77,10 @@ void PDAMgr::onLeftButtonClick(Common::Point point) {
void PDAMgr::onMouseMove(Common::Point point) {
Actor *actor = _game->getDirector()->getActorByPoint(point);
- if (actor && dynamic_cast<PDAButtonActor*>(actor))
+ if (actor && dynamic_cast<PDAButtonActor *>(actor))
actor->onMouseOver(point, &_cursorMgr);
- else _cursorMgr.setCursor(kPDADefaultCursor, point,Common::String());
+ else
+ _cursorMgr.setCursor(kPDADefaultCursor, point,Common::String());
}
void PDAMgr::close() {
diff --git a/engines/pink/resource_mgr.cpp b/engines/pink/resource_mgr.cpp
index 35aecb7..90cf4aa 100644
--- a/engines/pink/resource_mgr.cpp
+++ b/engines/pink/resource_mgr.cpp
@@ -68,7 +68,7 @@ static int resDescComp(const void *a, const void *b) {
Common::SafeSeekableSubReadStream *ResourceMgr::getResourceStream(const Common::String &name) {
Common::SeekableReadStream *stream;
- ResourceDescription *desc = (ResourceDescription*) bsearch(name.c_str(), _resDescTable, _resCount, sizeof(ResourceDescription), resDescComp);
+ ResourceDescription *desc = (ResourceDescription *)bsearch(name.c_str(), _resDescTable, _resCount, sizeof(ResourceDescription), resDescComp);
if (desc->inBro)
stream = _game->getBro();
Commit: a224e41edcafcb4b58d2ebf1e224649d0f23ac15
https://github.com/scummvm/scummvm/commit/a224e41edcafcb4b58d2ebf1e224649d0f23ac15
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: JANITORIAL: More whitespace fixes
Changed paths:
engines/pink/cel_decoder.cpp
engines/pink/file.cpp
engines/pink/objects/actions/action_sound.cpp
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/actors/pda_button_actor.cpp
engines/pink/objects/inventory.cpp
engines/pink/objects/sequences/sequence.cpp
engines/pink/resource_mgr.cpp
engines/pink/sound.cpp
diff --git a/engines/pink/cel_decoder.cpp b/engines/pink/cel_decoder.cpp
index 77aedc4..a9f1593 100644
--- a/engines/pink/cel_decoder.cpp
+++ b/engines/pink/cel_decoder.cpp
@@ -212,7 +212,7 @@ bool CelDecoder::CelVideoTrack::rewind() {
// 2) I changed behaviour of endOfTrack
_nextFrameStartTime = 0;
- if (_curFrame >= (int) _frameCount - 1 && _fileStream->pos() < _fileStream->size())
+ if (_curFrame >= (int)_frameCount - 1 && _fileStream->pos() < _fileStream->size())
_atRingFrame = true;
else
_fileStream->seek(_offsetFrame1);
diff --git a/engines/pink/file.cpp b/engines/pink/file.cpp
index c0a24c1..f399634 100644
--- a/engines/pink/file.cpp
+++ b/engines/pink/file.cpp
@@ -38,7 +38,7 @@ void ResourceDescription::load(Common::File &file) {
offset = file.readUint32LE();
size = file.readUint32LE();
- inBro = (bool) file.readUint16LE();
+ inBro = (bool)file.readUint16LE();
}
OrbFile::OrbFile()
diff --git a/engines/pink/objects/actions/action_sound.cpp b/engines/pink/objects/actions/action_sound.cpp
index 9f12297..0dcfa85 100644
--- a/engines/pink/objects/actions/action_sound.cpp
+++ b/engines/pink/objects/actions/action_sound.cpp
@@ -40,8 +40,8 @@ void ActionSound::deserialize(Archive &archive) {
_fileName = archive.readString();
_volume = archive.readDWORD();
assert(_volume <= 100);
- _isLoop = (bool) archive.readDWORD();
- _isBackground = (bool) archive.readDWORD();
+ _isLoop = (bool)archive.readDWORD();
+ _isBackground = (bool)archive.readDWORD();
}
void ActionSound::toConsole() {
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 872428d..4d07106 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -54,10 +54,10 @@ void LeadActor::toConsole() {
}
void LeadActor::loadState(Archive &archive) {
- _state = (State) archive.readByte();
- _nextState = (State) archive.readByte();
- _stateBeforeInventory = (State) archive.readByte();
- _stateBeforePDA = (State) archive.readByte();
+ _state = (State)archive.readByte();
+ _nextState = (State)archive.readByte();
+ _stateBeforeInventory = (State)archive.readByte();
+ _stateBeforePDA = (State)archive.readByte();
_isHaveItem = archive.readByte();
Common::String recepient = archive.readString();
if (!recepient.empty())
diff --git a/engines/pink/objects/actors/pda_button_actor.cpp b/engines/pink/objects/actors/pda_button_actor.cpp
index 6369394..240d51a 100644
--- a/engines/pink/objects/actors/pda_button_actor.cpp
+++ b/engines/pink/objects/actors/pda_button_actor.cpp
@@ -32,8 +32,8 @@ void PDAButtonActor::deserialize(Archive &archive) {
Actor::deserialize(archive);
_x = archive.readDWORD();
_y = archive.readDWORD();
- _hideOnStop = (bool) archive.readDWORD();
- _opaque = (bool) archive.readDWORD();
+ _hideOnStop = (bool)archive.readDWORD();
+ _opaque = (bool)archive.readDWORD();
int type = archive.readDWORD();
assert(type != 0);
@@ -43,7 +43,7 @@ void PDAButtonActor::deserialize(Archive &archive) {
void PDAButtonActor::toConsole() {
debug("PDAButtonActor: _name = %s, _x = %u _y = %u _hideOnStop = %u, _opaque = %u, _commandType = %u, _arg = %s",
- _name.c_str(), _x, _y, _hideOnStop, _opaque, (int) _command.type, _command.arg.c_str());
+ _name.c_str(), _x, _y, _hideOnStop, _opaque, (int)_command.type, _command.arg.c_str());
}
void PDAButtonActor::onClick() {
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
index ddf124a..f6682f1 100644
--- a/engines/pink/objects/inventory.cpp
+++ b/engines/pink/objects/inventory.cpp
@@ -189,7 +189,7 @@ void InventoryMgr::showNextItem(bool direction) {
}
void InventoryMgr::loadState(Archive &archive) {
- _state = (State) archive.readByte();
+ _state = (State)archive.readByte();
_isClickedOnItem = archive.readByte();
for (uint i = 0; i < _items.size(); ++i) {
diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp
index 3c0c69d..7e5a3a2 100644
--- a/engines/pink/objects/sequences/sequence.cpp
+++ b/engines/pink/objects/sequences/sequence.cpp
@@ -144,7 +144,7 @@ void SequenceAudio::start(bool loadingSave) {
Sequence::start(loadingSave);
uint index = _context->getNextItemIndex();
if (index < _items.size()) {
- SequenceItemLeaderAudio *leaderAudio = (SequenceItemLeaderAudio *) _items[index];
+ SequenceItemLeaderAudio *leaderAudio = (SequenceItemLeaderAudio *)_items[index];
_sample = leaderAudio->getSample();
}
}
diff --git a/engines/pink/resource_mgr.cpp b/engines/pink/resource_mgr.cpp
index 90cf4aa..65b6c00 100644
--- a/engines/pink/resource_mgr.cpp
+++ b/engines/pink/resource_mgr.cpp
@@ -62,7 +62,7 @@ Common::String ResourceMgr::loadText(Common::String &name) {
}
static int resDescComp(const void *a, const void *b) {
- return scumm_stricmp((char *) a, (char *) b);
+ return scumm_stricmp((char *)a, (char *)b);
}
Common::SafeSeekableSubReadStream *ResourceMgr::getResourceStream(const Common::String &name) {
diff --git a/engines/pink/sound.cpp b/engines/pink/sound.cpp
index 5771951..2580125 100644
--- a/engines/pink/sound.cpp
+++ b/engines/pink/sound.cpp
@@ -34,7 +34,7 @@ void Sound::play(Common::SafeSeekableSubReadStream *stream, Audio::Mixer::SoundT
// Vox files in pink have wave format.
// RIFF (little-endian) data, WAVE audio, Microsoft PCM, 8 bit, mono 22050 Hz
- volume = ((int) volume * 255) / 100;
+ volume = ((int)volume * 255) / 100;
Audio::Mixer *mixer = g_system->getMixer();
mixer->stopHandle(_handle);
Commit: 11df62d6faa9065e4e5ef3bede40d5982a9a11f6
https://github.com/scummvm/scummvm/commit/11df62d6faa9065e4e5ef3bede40d5982a9a11f6
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: JANITORIAL: Minor whitespace fixes
Changed paths:
engines/pink/cel_decoder.cpp
engines/pink/pda_mgr.cpp
diff --git a/engines/pink/cel_decoder.cpp b/engines/pink/cel_decoder.cpp
index a9f1593..40693d2 100644
--- a/engines/pink/cel_decoder.cpp
+++ b/engines/pink/cel_decoder.cpp
@@ -86,7 +86,7 @@ void CelDecoder::setEndOfTrack() {
}
CelDecoder::CelVideoTrack::CelVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height, bool skipHeader)
- : FlicVideoTrack(stream, frameCount, width, height, 1), _center(0,0), _transparentColourIndex(0) {
+ : FlicVideoTrack(stream, frameCount, width, height, 1), _center(0, 0), _transparentColourIndex(0) {
readHeader();
}
@@ -170,7 +170,7 @@ void CelDecoder::CelVideoTrack::skipFrame() {
}
if (_curFrame == 0)
- _transparentColourIndex = *(byte *)_surface->getBasePtr(0,0);
+ _transparentColourIndex = *(byte *)_surface->getBasePtr(0, 0);
}
@@ -201,7 +201,7 @@ const Graphics::Surface *CelDecoder::CelVideoTrack::decodeNextFrame() {
}
if (_curFrame == 0)
- _transparentColourIndex = *(byte *)_surface->getBasePtr(0,0);
+ _transparentColourIndex = *(byte *)_surface->getBasePtr(0, 0);
return _surface;
}
diff --git a/engines/pink/pda_mgr.cpp b/engines/pink/pda_mgr.cpp
index db6f1e4..257a7de 100644
--- a/engines/pink/pda_mgr.cpp
+++ b/engines/pink/pda_mgr.cpp
@@ -80,7 +80,7 @@ void PDAMgr::onMouseMove(Common::Point point) {
if (actor && dynamic_cast<PDAButtonActor *>(actor))
actor->onMouseOver(point, &_cursorMgr);
else
- _cursorMgr.setCursor(kPDADefaultCursor, point,Common::String());
+ _cursorMgr.setCursor(kPDADefaultCursor, point, Common::String());
}
void PDAMgr::close() {
Commit: aa8849f123160429a91083bd4be11005981ff3d2
https://github.com/scummvm/scummvm/commit/aa8849f123160429a91083bd4be11005981ff3d2
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Shut unused variables warnings
Changed paths:
engines/pink/archive.cpp
engines/pink/cel_decoder.cpp
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp
index c96cd8f..acb8b16 100644
--- a/engines/pink/archive.cpp
+++ b/engines/pink/archive.cpp
@@ -259,7 +259,7 @@ Object *Archive::parseObject(bool &isCopyReturned) {
if (obTag == 0x0000) {
return nullptr;
} else if (obTag == 0xffff) {
- int schema = _readStream->readUint16LE();
+ /* int schema = */_readStream->readUint16LE();
int size = _readStream->readUint16LE();
_readStream->read(className, size);
diff --git a/engines/pink/cel_decoder.cpp b/engines/pink/cel_decoder.cpp
index 40693d2..4e66cf7 100644
--- a/engines/pink/cel_decoder.cpp
+++ b/engines/pink/cel_decoder.cpp
@@ -95,11 +95,11 @@ CelDecoder::CelVideoTrack::CelVideoTrack(Common::SeekableReadStream *stream, uin
void CelDecoder::CelVideoTrack::readPrefixChunk() {
_fileStream->seek(0x80);
- uint32 chunkSize = _fileStream->readUint32LE();
+ /* uint32 chunkSize = */_fileStream->readUint32LE();
uint16 chunkType = _fileStream->readUint16LE();
if (chunkType != PREFIX_TYPE)
return;
- uint32 offset = 6;
+ //uint32 offset = 6;
uint32 subchunkSize = _fileStream->readUint32LE();
uint16 subchunkType = _fileStream->readUint16LE();
Commit: 9c176c57023cc77c82a73e533e4ace59d2529f8d
https://github.com/scummvm/scummvm/commit/9c176c57023cc77c82a73e533e4ace59d2529f8d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Format 'else' statement oneliners
Changed paths:
engines/pink/objects/actors/lead_actor.cpp
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 4d07106..847aa00 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -254,7 +254,8 @@ void LeadActor::onRightButtonClick(const Common::Point point) {
void LeadActor::onMouseMove(Common::Point point) {
if (_state != kPDA)
updateCursor(point);
- else _page->getGame()->getPdaMgr().onMouseMove(point);
+ else
+ _page->getGame()->getPdaMgr().onMouseMove(point);
}
void LeadActor::onMouseOver(const Common::Point point, CursorMgr *mgr) {
@@ -464,8 +465,9 @@ void PubPink::updateCursor(const Common::Point point) {
_cursorMgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
} else
_cursorMgr->setCursor(kDefaultCursor, point, Common::String());
+ } else {
+ LeadActor::updateCursor(point);
}
- else LeadActor::updateCursor(point);
}
bool PubPink::sendUseClickMessage(Actor *actor) {
Commit: 85e0c7ccd330b8e59faa7d63a439ddd21c598d6f
https://github.com/scummvm/scummvm/commit/85e0c7ccd330b8e59faa7d63a439ddd21c598d6f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: JANITORIAL: Indentation fixes
Changed paths:
engines/pink/objects/actions/action_loop.cpp
engines/pink/objects/actions/action_play_with_sfx.cpp
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/handlers/handler_timer.cpp
engines/pink/objects/inventory.cpp
engines/pink/objects/sequences/sequencer.cpp
engines/pink/objects/side_effect.cpp
diff --git a/engines/pink/objects/actions/action_loop.cpp b/engines/pink/objects/actions/action_loop.cpp
index 79946ad..ed548ef 100644
--- a/engines/pink/objects/actions/action_loop.cpp
+++ b/engines/pink/objects/actions/action_loop.cpp
@@ -37,7 +37,7 @@ void ActionLoop::deserialize(Archive &archive) {
style = archive.readWORD();
switch (style) {
case kPingPong:
- _style = kPingPong;
+ _style = kPingPong;
break;
case kRandom:
_style = kRandom; // haven't seen
@@ -113,7 +113,7 @@ void ActionLoop::onStart() {
_inLoop = true;
}
- if (!isTalk())
+ if (!isTalk())
_actor->endAction();
_forward = true;
diff --git a/engines/pink/objects/actions/action_play_with_sfx.cpp b/engines/pink/objects/actions/action_play_with_sfx.cpp
index b70cb56..e50c2f8 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.cpp
+++ b/engines/pink/objects/actions/action_play_with_sfx.cpp
@@ -55,7 +55,7 @@ void ActionPlayWithSfx::update() {
setFrame(_startFrame);
decodeNext();
} else
- ActionPlay::update();
+ ActionPlay::update();
for (uint i = 0; i < _sfxArray.size(); ++i) {
if (_sfxArray[i]->getFrame() == currFrame)
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 847aa00..549a8f2 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -471,32 +471,32 @@ void PubPink::updateCursor(const Common::Point point) {
}
bool PubPink::sendUseClickMessage(Actor *actor) {
- if (!LeadActor::sendUseClickMessage(actor) && playingMiniGame()) {
- _nextState = _state;
- _state = kPlayingSequence;
-
- const char *roundName;
- switch (_round++ % 3) {
- case 0:
- roundName = kFirstRound;
- break;
- case 1:
- roundName = kSecondRound;
- break;
- case 2:
- roundName = kThirdRound;
- break;
- default:
- roundName = nullptr;
- assert(0);
- }
- _sequencer->authorSequence(_sequencer->findSequence(roundName), 0);
- }
-
- if (playingMiniGame())
- _isHaveItem = true;
-
- return true;
+ if (!LeadActor::sendUseClickMessage(actor) && playingMiniGame()) {
+ _nextState = _state;
+ _state = kPlayingSequence;
+
+ const char *roundName;
+ switch (_round++ % 3) {
+ case 0:
+ roundName = kFirstRound;
+ break;
+ case 1:
+ roundName = kSecondRound;
+ break;
+ case 2:
+ roundName = kThirdRound;
+ break;
+ default:
+ roundName = nullptr;
+ assert(0);
+ }
+ _sequencer->authorSequence(_sequencer->findSequence(roundName), 0);
+ }
+
+ if (playingMiniGame())
+ _isHaveItem = true;
+
+ return true;
}
WalkLocation *PubPink::getWalkDestination() {
@@ -511,7 +511,7 @@ WalkLocation *PubPink::getWalkDestination() {
bool PubPink::playingMiniGame() {
return !(_page->checkValueOfVariable(kFoodPuzzle, "TRUE") ||
- _page->checkValueOfVariable(kFoodPuzzle, "UNDEFINED"));
+ _page->checkValueOfVariable(kFoodPuzzle, "UNDEFINED"));
}
} // End of namespace Pink
diff --git a/engines/pink/objects/handlers/handler_timer.cpp b/engines/pink/objects/handlers/handler_timer.cpp
index dc1c9bd..3087594 100644
--- a/engines/pink/objects/handlers/handler_timer.cpp
+++ b/engines/pink/objects/handlers/handler_timer.cpp
@@ -106,7 +106,7 @@ void HandlerTimerSequences::handle(Actor *actor) {
assert(sequence);
- sequencer->authorParallelSequence(sequence, 0);
+ sequencer->authorParallelSequence(sequence, 0);
}
} // End of namespace Pink
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
index f6682f1..89df846 100644
--- a/engines/pink/objects/inventory.cpp
+++ b/engines/pink/objects/inventory.cpp
@@ -87,7 +87,7 @@ bool InventoryMgr::isPinkOwnsAnyItems() {
void InventoryMgr::setItemOwner(const Common::String &owner, InventoryItem *item) {
if (owner == item->getCurrentOwner())
- return;
+ return;
if (item == _item && _lead->getName() != owner)
_item = nullptr;
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index a92ed54..6b59788 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -63,7 +63,7 @@ Sequence *Sequencer::findSequence(const Common::String &name) {
}
void Sequencer::authorSequence(Sequence *sequence, bool loadingSave) {
- if (_context)
+ if (_context)
_context->getSequence()->forceEnd();
if (sequence) {
diff --git a/engines/pink/objects/side_effect.cpp b/engines/pink/objects/side_effect.cpp
index fe43261..ff9e14d 100644
--- a/engines/pink/objects/side_effect.cpp
+++ b/engines/pink/objects/side_effect.cpp
@@ -89,7 +89,7 @@ void SideEffectGameVariable::toConsole() {
}
void SideEffectModuleVariable::execute(Actor *actor) {
- actor->getPage()->getModule()->setVariable(_name, _value);
+ actor->getPage()->getModule()->setVariable(_name, _value);
}
void SideEffectModuleVariable::toConsole() {
Commit: bb8a64d22dd8b00fbf028bba6e0258cb7af8dd95
https://github.com/scummvm/scummvm/commit/bb8a64d22dd8b00fbf028bba6e0258cb7af8dd95
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: JANITORIAL: Fix code formatting
Changed paths:
engines/pink/director.cpp
engines/pink/objects/actions/action_loop.cpp
engines/pink/objects/actors/supporting_actor.cpp
diff --git a/engines/pink/director.cpp b/engines/pink/director.cpp
index 2211185..bb781a5 100644
--- a/engines/pink/director.cpp
+++ b/engines/pink/director.cpp
@@ -126,8 +126,7 @@ void Director::draw() {
_dirtyRects.resize(0);
_surface.update();
- }
- else
+ } else
g_system->updateScreen();
}
diff --git a/engines/pink/objects/actions/action_loop.cpp b/engines/pink/objects/actions/action_loop.cpp
index ed548ef..c54d06f 100644
--- a/engines/pink/objects/actions/action_loop.cpp
+++ b/engines/pink/objects/actions/action_loop.cpp
@@ -61,8 +61,7 @@ void ActionLoop::update() {
if (frame < _startFrame) {
decodeNext();
return;
- }
- else
+ } else
_inLoop = true;
}
@@ -76,8 +75,7 @@ void ActionLoop::update() {
setFrame(_stopFrame - 1);
decodeNext();
}
- }
- else {
+ } else {
if (frame > _startFrame) {
setFrame(frame - 1);
} else {
diff --git a/engines/pink/objects/actors/supporting_actor.cpp b/engines/pink/objects/actors/supporting_actor.cpp
index 426b358..7bd7e3a 100644
--- a/engines/pink/objects/actors/supporting_actor.cpp
+++ b/engines/pink/objects/actors/supporting_actor.cpp
@@ -60,8 +60,7 @@ void SupportingActor::onMouseOver(Common::Point point, CursorMgr *mgr) {
mgr->setCursor(_cursor, point);
else
mgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
- }
- else
+ } else
Actor::onMouseOver(point, mgr);
}
Commit: e9d1fa0c617537b23a5b4a863fd9ac048198e4b5
https://github.com/scummvm/scummvm/commit/e9d1fa0c617537b23a5b4a863fd9ac048198e4b5
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Allow running from original media
Changed paths:
engines/pink/detection.cpp
engines/pink/pink.cpp
diff --git a/engines/pink/detection.cpp b/engines/pink/detection.cpp
index 71b3535..d643548 100644
--- a/engines/pink/detection.cpp
+++ b/engines/pink/detection.cpp
@@ -32,10 +32,18 @@ static const PlainGameDescriptor pinkGames[] = {
#include "detection_tables.h"
+static const char *directoryGlobs[] = {
+ "install",
+ nullptr
+};
+
+
class PinkMetaEngine : public AdvancedMetaEngine {
public:
PinkMetaEngine() : AdvancedMetaEngine(Pink::gameDescriptions, sizeof(ADGameDescription), pinkGames) {
_gameIds = pinkGames;
+ _maxScanDepth = 2;
+ _directoryGlobs = directoryGlobs;
}
virtual const char *getName() const {
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index 71b42c3..ffa35a2 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -49,6 +49,9 @@ Pink::PinkEngine::PinkEngine(OSystem *system, const ADGameDescription *desc)
DebugMan.addDebugChannel(kPinkDebugLoadingResources, "loading_resources", "Loading resources data");
DebugMan.addDebugChannel(kPinkDebugGraphics, "graphics", "Graphics handling");
DebugMan.addDebugChannel(kPinkDebugSound, "sound", "Sound processing");
+
+ const Common::FSNode gameDataDir(ConfMan.get("path"));
+ SearchMan.addSubDirectoryMatching(gameDataDir, "install");
}
Pink::PinkEngine::~PinkEngine() {
Commit: 7e344abbd9f5c826d9c0dc280e6f2bd7837e89e8
https://github.com/scummvm/scummvm/commit/7e344abbd9f5c826d9c0dc280e6f2bd7837e89e8
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Added detection for English versions
Changed paths:
engines/pink/detection_tables.h
diff --git a/engines/pink/detection_tables.h b/engines/pink/detection_tables.h
index a0062d7..c2e5f87 100644
--- a/engines/pink/detection_tables.h
+++ b/engines/pink/detection_tables.h
@@ -32,9 +32,9 @@ static const ADGameDescription gameDescriptions[] = {
"peril",
0,
{
- {"PPTP.ORB", NULL, NULL, -1},
- {"PPTP.BRO", NULL, NULL, -1},
- {"PPTP.EXE", NULL, NULL, -1},
+ {"PPTP.ORB", NULL, "223d0114d443904d8949263d512859da", 618203600},
+ {"PPTP.BRO", NULL, "bbbc78c0525694b32157570e2ec29784", 8945466},
+ {"PPTP.EXE", NULL, "82460a604723ed5697fc87cddf9dbeed", 594432},
AD_LISTEND
},
Common::EN_ANY,
@@ -46,8 +46,8 @@ static const ADGameDescription gameDescriptions[] = {
"pokus",
0,
{
- {"HPP.orb", NULL, NULL, -1},
- {"hpp.exe", NULL, NULL, -1},
+ {"HPP.orb", NULL, "f480597a78ab70c2021b4141fe44a512", 503443586},
+ {"hpp.exe", NULL, "05c321e75dd51e40f00c6d85cf9f2b34", 697856},
AD_LISTEND
},
Common::EN_ANY,
Commit: 6b6e38fa1de31afc62fd16a549c71ec86f1d92d5
https://github.com/scummvm/scummvm/commit/6b6e38fa1de31afc62fd16a549c71ec86f1d92d5
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: JANITORIAL: Fix indentation
Changed paths:
engines/pink/detection_tables.h
diff --git a/engines/pink/detection_tables.h b/engines/pink/detection_tables.h
index c2e5f87..eb71dec 100644
--- a/engines/pink/detection_tables.h
+++ b/engines/pink/detection_tables.h
@@ -28,34 +28,36 @@
namespace Pink {
static const ADGameDescription gameDescriptions[] = {
+ // English, Version 1.0
+ {
+ "peril",
+ 0,
{
- "peril",
- 0,
- {
- {"PPTP.ORB", NULL, "223d0114d443904d8949263d512859da", 618203600},
- {"PPTP.BRO", NULL, "bbbc78c0525694b32157570e2ec29784", 8945466},
- {"PPTP.EXE", NULL, "82460a604723ed5697fc87cddf9dbeed", 594432},
- AD_LISTEND
- },
- Common::EN_ANY,
- Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM,
- GUIO1(GUIO_NONE)
+ {"PPTP.ORB", NULL, "223d0114d443904d8949263d512859da", 618203600},
+ {"PPTP.BRO", NULL, "bbbc78c0525694b32157570e2ec29784", 8945466},
+ {"PPTP.EXE", NULL, "82460a604723ed5697fc87cddf9dbeed", 594432},
+ AD_LISTEND
},
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ GUIO1(GUIO_NONE)
+ },
+ // English, Version 1.0
+ {
+ "pokus",
+ 0,
{
- "pokus",
- 0,
- {
- {"HPP.orb", NULL, "f480597a78ab70c2021b4141fe44a512", 503443586},
- {"hpp.exe", NULL, "05c321e75dd51e40f00c6d85cf9f2b34", 697856},
- AD_LISTEND
- },
- Common::EN_ANY,
- Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM,
- GUIO1(GUIO_NONE)
+ {"HPP.orb", NULL, "f480597a78ab70c2021b4141fe44a512", 503443586},
+ {"hpp.exe", NULL, "05c321e75dd51e40f00c6d85cf9f2b34", 697856},
+ AD_LISTEND
},
- AD_TABLE_END_MARKER
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ GUIO1(GUIO_NONE)
+ },
+ AD_TABLE_END_MARKER
};
} // End of namespace Pink
Commit: 0f2654fb0c7fe383814357b84deb89dad99ff34c
https://github.com/scummvm/scummvm/commit/0f2654fb0c7fe383814357b84deb89dad99ff34c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Added detection for Russian versions
Changed paths:
engines/pink/detection_tables.h
diff --git a/engines/pink/detection_tables.h b/engines/pink/detection_tables.h
index eb71dec..40e1ebb 100644
--- a/engines/pink/detection_tables.h
+++ b/engines/pink/detection_tables.h
@@ -43,6 +43,23 @@ static const ADGameDescription gameDescriptions[] = {
ADGF_UNSTABLE | ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE)
},
+
+ // Russian
+ {
+ "peril",
+ 0,
+ {
+ {"PPTP.ORB", NULL, "4802bace9cd89a73eb915a075b230646", 635322616},
+ {"PPTP.BRO", NULL, "87539dbbb34bafbe223c751a60254505", 8945466},
+ {"PPTP.EXE", NULL, "739259d239acdc0304f904016e775fb3", 742912},
+ AD_LISTEND
+ },
+ Common::RU_RUS,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ GUIO1(GUIO_NONE)
+ },
+
// English, Version 1.0
{
"pokus",
@@ -57,6 +74,22 @@ static const ADGameDescription gameDescriptions[] = {
ADGF_UNSTABLE | ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE)
},
+
+ // Russian
+ {
+ "pokus",
+ 0,
+ {
+ {"HPP.orb", NULL, "1e5155c2219b3baea599563e02596ce5", 526369062},
+ {"hpp.exe", NULL, "32a5937f69dfce9f159b7be358cbd008", 699904},
+ AD_LISTEND
+ },
+ Common::RU_RUS,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ GUIO1(GUIO_NONE)
+ },
+
AD_TABLE_END_MARKER
};
Commit: 914ee715ebd3ebabb1f9454daa24c245a1bec023
https://github.com/scummvm/scummvm/commit/914ee715ebd3ebabb1f9454daa24c245a1bec023
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix warning
Changed paths:
engines/pink/objects/actors/audio_info_pda_button.cpp
engines/pink/objects/actors/audio_info_pda_button.h
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/actors/lead_actor.h
engines/pink/objects/actors/supporting_actor.cpp
engines/pink/objects/actors/supporting_actor.h
diff --git a/engines/pink/objects/actors/audio_info_pda_button.cpp b/engines/pink/objects/actors/audio_info_pda_button.cpp
index a5505de..a2adad0 100644
--- a/engines/pink/objects/actors/audio_info_pda_button.cpp
+++ b/engines/pink/objects/actors/audio_info_pda_button.cpp
@@ -33,11 +33,11 @@ void AudioInfoPDAButton::toConsole() {
}
}
-void AudioInfoPDAButton::onMouseOver(Common::Point point, CursorMgr *mgr) {
+void AudioInfoPDAButton::onMouseOver(const Common::Point point, CursorMgr *mgr) {
mgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
}
-void AudioInfoPDAButton::onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) {
+void AudioInfoPDAButton::onHover(const Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) {
onMouseOver(point, cursorMgr);
}
diff --git a/engines/pink/objects/actors/audio_info_pda_button.h b/engines/pink/objects/actors/audio_info_pda_button.h
index 4631baf..fbff88f 100644
--- a/engines/pink/objects/actors/audio_info_pda_button.h
+++ b/engines/pink/objects/actors/audio_info_pda_button.h
@@ -36,8 +36,8 @@ class AudioInfoPDAButton : public Actor {
public:
void toConsole();
- void onMouseOver(Common::Point point, CursorMgr *mgr);
- void onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) override;
+ void onMouseOver(const Common::Point point, CursorMgr *mgr);
+ void onHover(const Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) override;
bool onLeftClickMessage() override;
};
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 549a8f2..1bc49a0 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -251,7 +251,7 @@ void LeadActor::onRightButtonClick(const Common::Point point) {
}
-void LeadActor::onMouseMove(Common::Point point) {
+void LeadActor::onMouseMove(const Common::Point point) {
if (_state != kPDA)
updateCursor(point);
else
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index e767653..8c2cb7a 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -145,7 +145,7 @@ public:
void onVariableSet() override;
protected:
- void updateCursor(Common::Point point) override;
+ void updateCursor(const Common::Point point) override;
bool sendUseClickMessage(Actor *actor) override;
diff --git a/engines/pink/objects/actors/supporting_actor.cpp b/engines/pink/objects/actors/supporting_actor.cpp
index 7bd7e3a..3bca41c 100644
--- a/engines/pink/objects/actors/supporting_actor.cpp
+++ b/engines/pink/objects/actors/supporting_actor.cpp
@@ -54,7 +54,7 @@ bool SupportingActor::isUseClickHandlers(InventoryItem *item) {
return _handlerMgr.isUseClickHandler(this, item->getName());
}
-void SupportingActor::onMouseOver(Common::Point point, CursorMgr *mgr) {
+void SupportingActor::onMouseOver(const Common::Point point, CursorMgr *mgr) {
if (isLeftClickHandlers()) {
if (!_cursor.empty())
mgr->setCursor(_cursor, point);
@@ -64,7 +64,7 @@ void SupportingActor::onMouseOver(Common::Point point, CursorMgr *mgr) {
Actor::onMouseOver(point, mgr);
}
-void SupportingActor::onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) {
+void SupportingActor::onHover(const Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) {
Common::String item = itemName;
if (_handlerMgr.isUseClickHandler(this, itemName))
item += kClickable;
diff --git a/engines/pink/objects/actors/supporting_actor.h b/engines/pink/objects/actors/supporting_actor.h
index 7f53a3e..1205370 100644
--- a/engines/pink/objects/actors/supporting_actor.h
+++ b/engines/pink/objects/actors/supporting_actor.h
@@ -40,8 +40,8 @@ public:
bool isLeftClickHandlers() override;
bool isUseClickHandlers(InventoryItem *item) override;
- void onMouseOver(Common::Point point, CursorMgr *mgr) override;
- void onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) override;
+ void onMouseOver(const Common::Point point, CursorMgr *mgr) override;
+ void onHover(const Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) override;
void onTimerMessage() override;
bool onLeftClickMessage() override;
Commit: 96dbec01843eff9520eb22bd3cb793526f2f7cd2
https://github.com/scummvm/scummvm/commit/96dbec01843eff9520eb22bd3cb793526f2f7cd2
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Added detection for Hebrew version
Changed paths:
engines/pink/detection_tables.h
diff --git a/engines/pink/detection_tables.h b/engines/pink/detection_tables.h
index 40e1ebb..21bbc78 100644
--- a/engines/pink/detection_tables.h
+++ b/engines/pink/detection_tables.h
@@ -60,6 +60,22 @@ static const ADGameDescription gameDescriptions[] = {
GUIO1(GUIO_NONE)
},
+ // Hebrew
+ {
+ "peril",
+ 0,
+ {
+ {"PPTP.ORB", NULL, "52e2aba46d6cc47225bd5345775eeb59", 616292424},
+ {"PPTP.BRO", NULL, "9b890f4707b35feb4436bc69d19a5552", 8945466},
+ {"PPTP.EXE", NULL, "c78b229fa371a0863225f5159b5d28d9", 592384},
+ AD_LISTEND
+ },
+ Common::HE_ISR,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ GUIO1(GUIO_NONE)
+ },
+
// English, Version 1.0
{
"pokus",
@@ -90,6 +106,21 @@ static const ADGameDescription gameDescriptions[] = {
GUIO1(GUIO_NONE)
},
+ // Hebrew
+ {
+ "pokus",
+ 0,
+ {
+ {"HPP.orb", NULL, "518453b73021c31566f084b3e4b8bdbf", 502988485},
+ {"hpp.exe", NULL, "652a797bf4329834dbdd172749d37996", 642048},
+ AD_LISTEND
+ },
+ Common::HE_ISR,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ GUIO1(GUIO_NONE)
+ },
+
AD_TABLE_END_MARKER
};
Commit: 78033492717f32df1f71aa58807dbf4bb14e3296
https://github.com/scummvm/scummvm/commit/78033492717f32df1f71aa58807dbf4bb14e3296
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Added French versions detection
Changed paths:
engines/pink/detection_tables.h
diff --git a/engines/pink/detection_tables.h b/engines/pink/detection_tables.h
index 21bbc78..bee888c 100644
--- a/engines/pink/detection_tables.h
+++ b/engines/pink/detection_tables.h
@@ -44,17 +44,17 @@ static const ADGameDescription gameDescriptions[] = {
GUIO1(GUIO_NONE)
},
- // Russian
+ // French
{
"peril",
0,
{
- {"PPTP.ORB", NULL, "4802bace9cd89a73eb915a075b230646", 635322616},
- {"PPTP.BRO", NULL, "87539dbbb34bafbe223c751a60254505", 8945466},
- {"PPTP.EXE", NULL, "739259d239acdc0304f904016e775fb3", 742912},
+ {"PPTP.ORB", NULL, "fd641b5735fbe41d14db698ece29d2b1", 607185037},
+ {"PPTP.BRO", NULL, "634d344ab9aaf7c919ef2d330327c908", 8945466},
+ {"PPTP.EXE", NULL, "c2f2f717f33a234b257143a9f2baa18d", 598528},
AD_LISTEND
},
- Common::RU_RUS,
+ Common::FR_FRA,
Common::kPlatformWindows,
ADGF_UNSTABLE | ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE)
@@ -76,6 +76,22 @@ static const ADGameDescription gameDescriptions[] = {
GUIO1(GUIO_NONE)
},
+ // Russian
+ {
+ "peril",
+ 0,
+ {
+ {"PPTP.ORB", NULL, "4802bace9cd89a73eb915a075b230646", 635322616},
+ {"PPTP.BRO", NULL, "87539dbbb34bafbe223c751a60254505", 8945466},
+ {"PPTP.EXE", NULL, "739259d239acdc0304f904016e775fb3", 742912},
+ AD_LISTEND
+ },
+ Common::RU_RUS,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ GUIO1(GUIO_NONE)
+ },
+
// English, Version 1.0
{
"pokus",
@@ -91,16 +107,16 @@ static const ADGameDescription gameDescriptions[] = {
GUIO1(GUIO_NONE)
},
- // Russian
+ // French
{
"pokus",
0,
{
- {"HPP.orb", NULL, "1e5155c2219b3baea599563e02596ce5", 526369062},
- {"hpp.exe", NULL, "32a5937f69dfce9f159b7be358cbd008", 699904},
+ {"HPP.orb", NULL, "d5af74262276f0ffef6605ea0db861d2", 492220293},
+ {"hpp.exe", NULL, "418f2f126903c51f9979c76c22d03e53", 707072},
AD_LISTEND
},
- Common::RU_RUS,
+ Common::FR_FRA,
Common::kPlatformWindows,
ADGF_UNSTABLE | ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE)
@@ -121,6 +137,21 @@ static const ADGameDescription gameDescriptions[] = {
GUIO1(GUIO_NONE)
},
+ // Russian
+ {
+ "pokus",
+ 0,
+ {
+ {"HPP.orb", NULL, "1e5155c2219b3baea599563e02596ce5", 526369062},
+ {"hpp.exe", NULL, "32a5937f69dfce9f159b7be358cbd008", 699904},
+ AD_LISTEND
+ },
+ Common::RU_RUS,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ GUIO1(GUIO_NONE)
+ },
+
AD_TABLE_END_MARKER
};
Commit: 3c07f9bf31587923795b5e5f4b6765d7b074c42c
https://github.com/scummvm/scummvm/commit/3c07f9bf31587923795b5e5f4b6765d7b074c42c
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added Swedish vesions detection
Changed paths:
engines/pink/detection_tables.h
diff --git a/engines/pink/detection_tables.h b/engines/pink/detection_tables.h
index bee888c..282faf6 100644
--- a/engines/pink/detection_tables.h
+++ b/engines/pink/detection_tables.h
@@ -92,6 +92,22 @@ static const ADGameDescription gameDescriptions[] = {
GUIO1(GUIO_NONE)
},
+ // Swedish
+ {
+ "peril",
+ 0,
+ {
+ {"PPTP.ORB", NULL, "e44d6d3f28cbf0d93492db60634e5362", 633843917},
+ {"PPTP.BRO", NULL, "06acd9ae0413a0d8538afaf5350422b1", 8945466},
+ {"PPTP.EXE", NULL, "3fdbf4c39b76820ca26224d8bebe00a8", 594944},
+ AD_LISTEND
+ },
+ Common::SE_SWE,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ GUIO1(GUIO_NONE)
+ },
+
// English, Version 1.0
{
"pokus",
@@ -152,6 +168,22 @@ static const ADGameDescription gameDescriptions[] = {
GUIO1(GUIO_NONE)
},
+ // Swedish
+ {
+ "pokus",
+ 0,
+ {
+ {"HPP.orb", NULL, "aa2e58de49c73f66f1d8f1bbbe163a9c", 500103742},
+ {"hpp.exe", NULL, "672a99b8b6788c1c80ad01733a4e6720", 673280},
+ AD_LISTEND
+ },
+ Common::SE_SWE,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ GUIO1(GUIO_NONE)
+ },
+
+
AD_TABLE_END_MARKER
};
Commit: 4d847d83ed09aa3af563b1aeaa3fb7fbd137326b
https://github.com/scummvm/scummvm/commit/4d847d83ed09aa3af563b1aeaa3fb7fbd137326b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
COMMON: Added Finnish language constants
Changed paths:
common/language.cpp
common/language.h
diff --git a/common/language.cpp b/common/language.cpp
index 4d40744..207de00 100644
--- a/common/language.cpp
+++ b/common/language.cpp
@@ -36,6 +36,7 @@ const LanguageDescription g_languages[] = {
{ "gb", "en_GB", "English (GB)", EN_GRB },
{ "us", "en_US", "English (US)", EN_USA },
{ "et", "et_EE", "Estonian", ET_EST },
+ { "fi", "fi_FI", "Finnish", FI_FIN },
{ "fr", "fr_FR", "French", FR_FRA },
{ "de", "de_DE", "German", DE_DEU },
{ "gr", "el_GR", "Greek", GR_GRE },
diff --git a/common/language.h b/common/language.h
index af2c252..b128d91 100644
--- a/common/language.h
+++ b/common/language.h
@@ -42,6 +42,7 @@ enum Language {
EN_GRB,
EN_USA,
ET_EST,
+ FI_FIN,
FR_FRA,
DE_DEU,
GR_GRE,
Commit: 8b43fe75bce27b0cc984d8f78179a6f7f718d200
https://github.com/scummvm/scummvm/commit/8b43fe75bce27b0cc984d8f78179a6f7f718d200
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Added Finnish and Spanish versions detection
Changed paths:
engines/pink/detection_tables.h
diff --git a/engines/pink/detection_tables.h b/engines/pink/detection_tables.h
index 282faf6..145fcca 100644
--- a/engines/pink/detection_tables.h
+++ b/engines/pink/detection_tables.h
@@ -44,6 +44,22 @@ static const ADGameDescription gameDescriptions[] = {
GUIO1(GUIO_NONE)
},
+ // Finnish
+ {
+ "peril",
+ 0,
+ {
+ {"PPTP.ORB", NULL, "32c31829bf7e74a64968dd05f3224ce9", 612549215},
+ {"PPTP.BRO", NULL, "bbbc78c0525694b32157570e2ec29784", 8945466},
+ {"PPTP.EXE", NULL, "03481f57d216d368ef218b80c28dd2a2", 599040},
+ AD_LISTEND
+ },
+ Common::FI_FIN,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ GUIO1(GUIO_NONE)
+ },
+
// French
{
"peril",
@@ -92,6 +108,22 @@ static const ADGameDescription gameDescriptions[] = {
GUIO1(GUIO_NONE)
},
+ // Spanish
+ {
+ "peril",
+ 0,
+ {
+ {"PPTP.ORB", NULL, "1225f76fe3a60d2ed2321ac92e2c1e79", 633626567},
+ {"PPTP.BRO", NULL, "af9e0e58ee9046dceda4f55060ebd34c", 20},
+ {"PPTP.EXE", NULL, "69f0472cda67bc146cbb709da2bc58fe", 595456},
+ AD_LISTEND
+ },
+ Common::ES_ESP,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ GUIO1(GUIO_NONE)
+ },
+
// Swedish
{
"peril",
@@ -168,6 +200,21 @@ static const ADGameDescription gameDescriptions[] = {
GUIO1(GUIO_NONE)
},
+ // Spanish
+ {
+ "pokus",
+ 0,
+ {
+ {"HPP.orb", NULL, "68040543f153e494e42efe9fab47b850", 508716126},
+ {"hpp.exe", NULL, "ce835ddfd7444b2e4a613ca5a82125a4", 699904},
+ AD_LISTEND
+ },
+ Common::ES_ESP,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ GUIO1(GUIO_NONE)
+ },
+
// Swedish
{
"pokus",
@@ -183,7 +230,6 @@ static const ADGameDescription gameDescriptions[] = {
GUIO1(GUIO_NONE)
},
-
AD_TABLE_END_MARKER
};
Commit: 9e08dc653746d17807d217512abb11cb107fd85a
https://github.com/scummvm/scummvm/commit/9e08dc653746d17807d217512abb11cb107fd85a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Added Polish Pokus detection
Changed paths:
engines/pink/detection_tables.h
diff --git a/engines/pink/detection_tables.h b/engines/pink/detection_tables.h
index 145fcca..a2f5d5a 100644
--- a/engines/pink/detection_tables.h
+++ b/engines/pink/detection_tables.h
@@ -185,6 +185,21 @@ static const ADGameDescription gameDescriptions[] = {
GUIO1(GUIO_NONE)
},
+ // Polish
+ {
+ "pokus",
+ 0,
+ {
+ {"HPP.orb", NULL, "51fb70412a6a5a6590dcaee842a940ab", 539274161},
+ {"hpp.exe", NULL, "8ed8d6c53b0792e6d2e55b89bf5cad9a", 697856},
+ AD_LISTEND
+ },
+ Common::PL_POL,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ GUIO1(GUIO_NONE)
+ },
+
// Russian
{
"pokus",
Commit: 9792e8651ff32bd9af59713223d10109c92b1bdb
https://github.com/scummvm/scummvm/commit/9792e8651ff32bd9af59713223d10109c92b1bdb
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Added detection for Portuguese versions of the games
Changed paths:
engines/pink/detection_tables.h
diff --git a/engines/pink/detection_tables.h b/engines/pink/detection_tables.h
index a2f5d5a..64f56c4 100644
--- a/engines/pink/detection_tables.h
+++ b/engines/pink/detection_tables.h
@@ -92,6 +92,22 @@ static const ADGameDescription gameDescriptions[] = {
GUIO1(GUIO_NONE)
},
+ // Portuguese
+ {
+ "peril",
+ 0,
+ {
+ {"PPTP.ORB", NULL, "88a498256c4609550cf59497a372b7a3", 642216577},
+ {"PPTP.BRO", NULL, "083c2fb4a3674c384cbc2884fcf774e2", 8945466},
+ {"PPTP.EXE", NULL, "6cb9fab3f9b7dc25c3717d657056a149", 598528},
+ AD_LISTEND
+ },
+ Common::PT_BRA,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ GUIO1(GUIO_NONE)
+ },
+
// Russian
{
"peril",
@@ -200,6 +216,21 @@ static const ADGameDescription gameDescriptions[] = {
GUIO1(GUIO_NONE)
},
+ // Portuguese
+ {
+ "pokus",
+ 0,
+ {
+ {"HPP.orb", NULL, "149661ec6c35488a300293776a74b460", 526755539},
+ {"hpp.exe", NULL, "57aefed890deeac3227660f75833acc9", 698880},
+ AD_LISTEND
+ },
+ Common::PT_BRA,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ GUIO1(GUIO_NONE)
+ },
+
// Russian
{
"pokus",
Commit: 8477a61d621fb09b7f78e1fbe3122a13522fd85d
https://github.com/scummvm/scummvm/commit/8477a61d621fb09b7f78e1fbe3122a13522fd85d
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: make comparison to character constants endianness independent
Changed paths:
engines/pink/file.cpp
diff --git a/engines/pink/file.cpp b/engines/pink/file.cpp
index f399634..7a760d1 100644
--- a/engines/pink/file.cpp
+++ b/engines/pink/file.cpp
@@ -51,7 +51,7 @@ OrbFile::~OrbFile() {
}
bool OrbFile::open(const Common::String &name) {
- if (!File::open(name) || readUint32BE() != 'ORB\0')
+ if (!File::open(name) || readUint32BE() != MKTAG('O', 'R', 'B', '\0'))
return false;
uint16 minor = readUint16LE();
@@ -123,7 +123,7 @@ void OrbFile::seekToObject(const char *name) {
}
bool BroFile::open(const Common::String &name) {
- if (!File::open(name) || readUint32BE() != 'BRO\0')
+ if (!File::open(name) || readUint32BE() != MKTAG('B', 'R', 'O', '\0'))
return false;
uint16 minor = readUint16LE();
Commit: 3e2c9b6bc2815d1777ff2f93723994c7efbe64aa
https://github.com/scummvm/scummvm/commit/3e2c9b6bc2815d1777ff2f93723994c7efbe64aa
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix updating cursor in some situations
Changed paths:
engines/pink/objects/actors/lead_actor.cpp
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 1bc49a0..bfbbbb0 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -325,7 +325,9 @@ void LeadActor::setNextExecutors(const Common::String &nextModule, const Common:
}
void LeadActor::forceUpdateCursor() {
- const Common::Point point = _page->getGame()->getEventManager()->getMousePos();
+ PinkEngine *vm =_page->getGame();
+ vm->getDirector()->update(); // we have actions, that should be drawn to properly update cursor
+ const Common::Point point = vm->getEventManager()->getMousePos();
updateCursor(point);
}
Commit: a9c3826b0f1c0d9b8c589abc0c451dfc4eea3efa
https://github.com/scummvm/scummvm/commit/a9c3826b0f1c0d9b8c589abc0c451dfc4eea3efa
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added updating screen after setting cursor
Changed paths:
engines/pink/pink.cpp
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index ffa35a2..a91c4f4 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -253,6 +253,7 @@ void PinkEngine::setCursor(uint cursorIndex) {
_system->setCursorPalette(cursor->getPalette(), cursor->getPaletteStartIndex(), cursor->getPaletteCount());
_system->setMouseCursor(cursor->getSurface(), cursor->getWidth(), cursor->getHeight(),
cursor->getHotspotX(), cursor->getHotspotY(), cursor->getKeyColor());
+ _system->updateScreen();
}
Common::Error PinkEngine::loadGameState(int slot) {
Commit: ffcaf74b08feb4ed7a7072a01cdca9104f896592
https://github.com/scummvm/scummvm/commit/ffcaf74b08feb4ed7a7072a01cdca9104f896592
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: implement OnMouseOverWithItem for LeadActor
Changed paths:
engines/pink/objects/actors/actor.cpp
engines/pink/objects/actors/actor.h
engines/pink/objects/actors/audio_info_pda_button.cpp
engines/pink/objects/actors/audio_info_pda_button.h
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/actors/lead_actor.h
engines/pink/objects/actors/supporting_actor.cpp
engines/pink/objects/actors/supporting_actor.h
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index 4a70e1d..2725338 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -95,7 +95,7 @@ void Actor::onMouseOver(const Common::Point point, CursorMgr *mgr) {
mgr->setCursor(kDefaultCursor, point, Common::String());
}
-void Actor::onHover(const Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) {
+void Actor::onMouseOverWithItem(const Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) {
cursorMgr->setCursor(kHoldingItemCursor, point, itemName);
}
diff --git a/engines/pink/objects/actors/actor.h b/engines/pink/objects/actors/actor.h
index 480aa78..87d12cf 100644
--- a/engines/pink/objects/actors/actor.h
+++ b/engines/pink/objects/actors/actor.h
@@ -63,7 +63,7 @@ public:
virtual bool isUseClickHandlers(InventoryItem *item) { return false; }
virtual void onMouseOver(const Common::Point point, CursorMgr *mgr);
- virtual void onHover(const Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr);
+ virtual void onMouseOverWithItem(const Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr);
virtual void onClick() {}
diff --git a/engines/pink/objects/actors/audio_info_pda_button.cpp b/engines/pink/objects/actors/audio_info_pda_button.cpp
index a2adad0..7849b6d 100644
--- a/engines/pink/objects/actors/audio_info_pda_button.cpp
+++ b/engines/pink/objects/actors/audio_info_pda_button.cpp
@@ -37,7 +37,7 @@ void AudioInfoPDAButton::onMouseOver(const Common::Point point, CursorMgr *mgr)
mgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
}
-void AudioInfoPDAButton::onHover(const Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) {
+void AudioInfoPDAButton::onMouseOverWithItem(const Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) {
onMouseOver(point, cursorMgr);
}
diff --git a/engines/pink/objects/actors/audio_info_pda_button.h b/engines/pink/objects/actors/audio_info_pda_button.h
index fbff88f..6eee840 100644
--- a/engines/pink/objects/actors/audio_info_pda_button.h
+++ b/engines/pink/objects/actors/audio_info_pda_button.h
@@ -37,7 +37,7 @@ public:
void toConsole();
void onMouseOver(const Common::Point point, CursorMgr *mgr);
- void onHover(const Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) override;
+ void onMouseOverWithItem(const Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) override;
bool onLeftClickMessage() override;
};
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index bfbbbb0..82cf174 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -250,7 +250,6 @@ void LeadActor::onRightButtonClick(const Common::Point point) {
}
}
-
void LeadActor::onMouseMove(const Common::Point point) {
if (_state != kPDA)
updateCursor(point);
@@ -258,6 +257,10 @@ void LeadActor::onMouseMove(const Common::Point point) {
_page->getGame()->getPdaMgr().onMouseMove(point);
}
+void LeadActor::onMouseOverWithItem(const Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) {
+ _cursorMgr->setCursor(kHoldingItemCursor, point, itemName + kClickable);
+}
+
void LeadActor::onMouseOver(const Common::Point point, CursorMgr *mgr) {
if (getInventoryMgr()->isPinkOwnsAnyItems())
_cursorMgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
@@ -339,7 +342,7 @@ void LeadActor::updateCursor(const Common::Point point) {
InventoryItem *item = getInventoryMgr()->getCurrentItem();
if (_isHaveItem) {
if (actor) {
- actor->onHover(point, item->getName(), _cursorMgr);
+ actor->onMouseOverWithItem(point, item->getName(), _cursorMgr);
} else
_cursorMgr->setCursor(kHoldingItemCursor, point, item->getName());
} else if (actor)
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index 8c2cb7a..d7cafb0 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -75,6 +75,7 @@ public:
void onMouseMove(const Common::Point point);
+ void onMouseOverWithItem(const Common::Point point, const Common::String &itemName, Pink::CursorMgr *cursorMgr) override;
void onMouseOver(const Common::Point point, CursorMgr *mgr) override;
virtual void onClick();
diff --git a/engines/pink/objects/actors/supporting_actor.cpp b/engines/pink/objects/actors/supporting_actor.cpp
index 3bca41c..744fe60 100644
--- a/engines/pink/objects/actors/supporting_actor.cpp
+++ b/engines/pink/objects/actors/supporting_actor.cpp
@@ -64,11 +64,11 @@ void SupportingActor::onMouseOver(const Common::Point point, CursorMgr *mgr) {
Actor::onMouseOver(point, mgr);
}
-void SupportingActor::onHover(const Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) {
+void SupportingActor::onMouseOverWithItem(const Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) {
Common::String item = itemName;
if (_handlerMgr.isUseClickHandler(this, itemName))
item += kClickable;
- Actor::onHover(point, item, cursorMgr);
+ cursorMgr->setCursor(kHoldingItemCursor, point, item);
}
void SupportingActor::onTimerMessage() {
diff --git a/engines/pink/objects/actors/supporting_actor.h b/engines/pink/objects/actors/supporting_actor.h
index 1205370..88c3996 100644
--- a/engines/pink/objects/actors/supporting_actor.h
+++ b/engines/pink/objects/actors/supporting_actor.h
@@ -41,7 +41,7 @@ public:
bool isUseClickHandlers(InventoryItem *item) override;
void onMouseOver(const Common::Point point, CursorMgr *mgr) override;
- void onHover(const Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) override;
+ void onMouseOverWithItem(const Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) override;
void onTimerMessage() override;
bool onLeftClickMessage() override;
Commit: 8516684b4a7e4f01e96305040a87c412110b9b3b
https://github.com/scummvm/scummvm/commit/8516684b4a7e4f01e96305040a87c412110b9b3b
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fixed MD5 of Swedish versions
Changed paths:
engines/pink/detection_tables.h
diff --git a/engines/pink/detection_tables.h b/engines/pink/detection_tables.h
index 64f56c4..7081de1 100644
--- a/engines/pink/detection_tables.h
+++ b/engines/pink/detection_tables.h
@@ -145,9 +145,9 @@ static const ADGameDescription gameDescriptions[] = {
"peril",
0,
{
- {"PPTP.ORB", NULL, "e44d6d3f28cbf0d93492db60634e5362", 633843917},
- {"PPTP.BRO", NULL, "06acd9ae0413a0d8538afaf5350422b1", 8945466},
- {"PPTP.EXE", NULL, "3fdbf4c39b76820ca26224d8bebe00a8", 594944},
+ {"PPTP.ORB", NULL, "eadbc52f4c43b85edb7cc493b4149ba0", 633843917},
+ {"PPTP.BRO", NULL, "e0e479418f7ace8735d824cfdabe851d", 8945466},
+ {"PPTP.EXE", NULL, "52db4fa96604a2d2026140a26a5e69e2", 594944},
AD_LISTEND
},
Common::SE_SWE,
@@ -266,8 +266,8 @@ static const ADGameDescription gameDescriptions[] = {
"pokus",
0,
{
- {"HPP.orb", NULL, "aa2e58de49c73f66f1d8f1bbbe163a9c", 500103742},
- {"hpp.exe", NULL, "672a99b8b6788c1c80ad01733a4e6720", 673280},
+ {"HPP.orb", NULL, "7b7909414d93f847ff0c023a06ae1f7e", 500103742},
+ {"hpp.exe", NULL, "ba40c8ecfa36f2d21fdd8d8c14d4b09c", 673280},
AD_LISTEND
},
Common::SE_SWE,
Commit: 60d2c3e2f216a7a634d716508e159b8a08361417
https://github.com/scummvm/scummvm/commit/60d2c3e2f216a7a634d716508e159b8a08361417
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fixed playing SequenceAudio with long songs
Changed paths:
engines/pink/objects/sequences/sequence.h
engines/pink/sound.h
diff --git a/engines/pink/objects/sequences/sequence.h b/engines/pink/objects/sequences/sequence.h
index 05a3f88..ae446e4 100644
--- a/engines/pink/objects/sequences/sequence.h
+++ b/engines/pink/objects/sequences/sequence.h
@@ -88,7 +88,7 @@ public:
private:
Common::String _soundName;
Sound _sound;
- uint _sample;
+ uint32 _sample;
};
} // End of namespace Pink
diff --git a/engines/pink/sound.h b/engines/pink/sound.h
index f18fb9f..28de99d 100644
--- a/engines/pink/sound.h
+++ b/engines/pink/sound.h
@@ -45,7 +45,7 @@ public:
void pause(bool paused) { g_system->getMixer()->pauseHandle(_handle, paused); }
- uint32 getCurrentSample() { return g_system->getMixer()->getSoundElapsedTime(_handle) * 22050 / 1000; }
+ uint64 getCurrentSample() { return (uint64)g_system->getMixer()->getSoundElapsedTime(_handle) * 22050 / 1000; }
private:
Audio::SoundHandle _handle;
Commit: d0f0f4185746fc2b5020dbf0adc0103ce589f848
https://github.com/scummvm/scummvm/commit/d0f0f4185746fc2b5020dbf0adc0103ce589f848
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fixed clicking on empty part of screen
Changed paths:
engines/pink/objects/actors/lead_actor.cpp
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 82cf174..17f1cac 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -209,6 +209,8 @@ void LeadActor::onLeftButtonClick(const Common::Point point) {
case kReady:
case kMoving: {
Actor *clickedActor = getActorByPoint(point);
+ if (!clickedActor)
+ return;
if (this == clickedActor) {
_audioInfoMgr.stop();
@@ -241,7 +243,7 @@ void LeadActor::onLeftButtonClick(const Common::Point point) {
void LeadActor::onRightButtonClick(const Common::Point point) {
if (_state == kReady || _state == kMoving) {
Actor *clickedActor = getActorByPoint(point);
- if (isInteractingWith(clickedActor)) {
+ if (clickedActor && isInteractingWith(clickedActor)) {
_audioInfoMgr.start(clickedActor);
}
Commit: a8cbdba16f466ba5503f981ebe5d6f079b31dd9b
https://github.com/scummvm/scummvm/commit/a8cbdba16f466ba5503f981ebe5d6f079b31dd9b
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added commands to Console
Changed paths:
A engines/pink/console.cpp
engines/pink/console.h
engines/pink/module.mk
engines/pink/pink.cpp
engines/pink/pink.h
diff --git a/engines/pink/console.cpp b/engines/pink/console.cpp
new file mode 100644
index 0000000..de95b9a
--- /dev/null
+++ b/engines/pink/console.cpp
@@ -0,0 +1,59 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "pink/console.h"
+#include "pink/pink.h"
+
+namespace Pink {
+
+Console::Console(PinkEngine *vm)
+ : _vm(vm) {
+ registerCmd("listModules", WRAP_METHOD(Console, Cmd_ListModules));
+ registerCmd("goToModule", WRAP_METHOD(Console, Cmd_GoToModule));
+}
+
+bool Console::Cmd_ListModules(int argc, const char **argv) {
+ const Array<NamedObject*> modules = _vm->_modules;
+ for (uint i = 0; i < modules.size(); ++i) {
+ debugPrintf("%d.%s\n", i, modules[i]->getName().c_str());
+ }
+ return true;
+}
+
+bool Console::Cmd_GoToModule(int argc, const char **argv) {
+ if (argc != 2) {
+ debugPrintf("Usage: %s moduleName\n", argv[0]);
+ debugPrintf("Module may not work properly because of Game vars");
+ return true;
+ }
+ const Array<NamedObject*> modules = _vm->_modules;
+ for (uint i = 0; i < modules.size(); ++i) {
+ if (modules[i]->getName() == argv[1]) {
+ _vm->initModule(argv[1], "", nullptr);
+ return true;
+ }
+ }
+ debugPrintf("Module %s doesn't exist", argv[1]);
+ return true;
+}
+
+} // End of namespace Pink
diff --git a/engines/pink/console.h b/engines/pink/console.h
index bad3441..9c438a8 100644
--- a/engines/pink/console.h
+++ b/engines/pink/console.h
@@ -31,9 +31,16 @@ class PinkEngine;
class Console : public GUI::Debugger {
public:
- Console(PinkEngine *vm) {}
+ Console(PinkEngine *vm);
virtual ~Console(void) {}
+
+private:
+ bool Cmd_ListModules(int argc, const char **argv);
+ bool Cmd_GoToModule(int argc, const char **argv);
+
+private:
+ PinkEngine *_vm;
};
} // End of namespace Pink
diff --git a/engines/pink/module.mk b/engines/pink/module.mk
index 9c2215a..002159a 100644
--- a/engines/pink/module.mk
+++ b/engines/pink/module.mk
@@ -4,6 +4,7 @@ MODULE_OBJS = \
archive.o \
audio_info_mgr.o \
cel_decoder.o \
+ console.o \
cursor_mgr.o \
detection.o \
director.o \
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index a91c4f4..50e8e53 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -126,7 +126,12 @@ Common::Error Pink::PinkEngine::run() {
_actor->onRightButtonClick(event.mouse);
break;
case Common::EVENT_KEYDOWN:
- _actor->onKeyboardButtonClick(event.kbd.keycode);
+ if (event.kbd.keycode == Common::KEYCODE_d && event.kbd.hasFlags(Common::KBD_CTRL)) {
+ _console->attach();
+ _console->onFrame();
+ } else {
+ _actor->onKeyboardButtonClick(event.kbd.keycode);
+ }
break;
default:
break;
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index f022582..23ae898 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -93,6 +93,8 @@ public:
Common::Error saveGameState(int slot, const Common::String &desc) override;
bool canSaveGameStateCurrently() override;
+ friend class Console;
+
protected:
virtual void pauseEngineIntern(bool pause) override;
Commit: 9e920d9349a6c9fb99f41e3acedd245fbe439e93
https://github.com/scummvm/scummvm/commit/9e920d9349a6c9fb99f41e3acedd245fbe439e93
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: add commands to list and set game variables
Changed paths:
engines/pink/console.cpp
engines/pink/console.h
diff --git a/engines/pink/console.cpp b/engines/pink/console.cpp
index de95b9a..66413db 100644
--- a/engines/pink/console.cpp
+++ b/engines/pink/console.cpp
@@ -29,6 +29,9 @@ Console::Console(PinkEngine *vm)
: _vm(vm) {
registerCmd("listModules", WRAP_METHOD(Console, Cmd_ListModules));
registerCmd("goToModule", WRAP_METHOD(Console, Cmd_GoToModule));
+
+ registerCmd("listGameVars", WRAP_METHOD(Console, Cmd_ListGameVars));
+ registerCmd("setGameVar", WRAP_METHOD(Console, Cmd_SetGameVar));
}
bool Console::Cmd_ListModules(int argc, const char **argv) {
@@ -42,7 +45,7 @@ bool Console::Cmd_ListModules(int argc, const char **argv) {
bool Console::Cmd_GoToModule(int argc, const char **argv) {
if (argc != 2) {
debugPrintf("Usage: %s moduleName\n", argv[0]);
- debugPrintf("Module may not work properly because of Game vars");
+ debugPrintf("Module may not work properly because of Game vars\n");
return true;
}
const Array<NamedObject*> modules = _vm->_modules;
@@ -52,7 +55,24 @@ bool Console::Cmd_GoToModule(int argc, const char **argv) {
return true;
}
}
- debugPrintf("Module %s doesn't exist", argv[1]);
+ debugPrintf("Module %s doesn't exist\n", argv[1]);
+ return true;
+}
+
+bool Console::Cmd_ListGameVars(int argc, const char **argv) {
+ const StringMap &vars = _vm->_variables;
+ for (StringMap::const_iterator it = vars.begin(); it != vars.end() ; ++it) {
+ debugPrintf("%s %s \n", it->_key.c_str(), it->_value.c_str());
+ }
+ return true;
+}
+
+bool Console::Cmd_SetGameVar(int argc, const char **argv) {
+ if (argc != 3) {
+ debugPrintf("Usage: %s varName value\n", argv[0]);
+ return true;
+ }
+ _vm->_variables[argv[1]] = argv[2];
return true;
}
diff --git a/engines/pink/console.h b/engines/pink/console.h
index 9c438a8..73041a5 100644
--- a/engines/pink/console.h
+++ b/engines/pink/console.h
@@ -39,6 +39,9 @@ private:
bool Cmd_ListModules(int argc, const char **argv);
bool Cmd_GoToModule(int argc, const char **argv);
+ bool Cmd_ListGameVars(int argc, const char **argv);
+ bool Cmd_SetGameVar(int argc, const char **argv);
+
private:
PinkEngine *_vm;
};
Commit: ba161a9e2553fc18289a5b0975146ee0379e3b5a
https://github.com/scummvm/scummvm/commit/ba161a9e2553fc18289a5b0975146ee0379e3b5a
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added more debug commands
Changed paths:
engines/pink/console.cpp
engines/pink/console.h
engines/pink/objects/module.h
engines/pink/objects/pages/game_page.h
diff --git a/engines/pink/console.cpp b/engines/pink/console.cpp
index 66413db..ead4cf3 100644
--- a/engines/pink/console.cpp
+++ b/engines/pink/console.cpp
@@ -22,6 +22,8 @@
#include "pink/console.h"
#include "pink/pink.h"
+#include "pink/objects/module.h"
+#include "pink/objects/pages/game_page.h"
namespace Pink {
@@ -30,8 +32,17 @@ Console::Console(PinkEngine *vm)
registerCmd("listModules", WRAP_METHOD(Console, Cmd_ListModules));
registerCmd("goToModule", WRAP_METHOD(Console, Cmd_GoToModule));
+ registerCmd("listPages", WRAP_METHOD(Console, Cmd_ListPages));
+ registerCmd("goToPage", WRAP_METHOD(Console, Cmd_GoToPage));
+
registerCmd("listGameVars", WRAP_METHOD(Console, Cmd_ListGameVars));
registerCmd("setGameVar", WRAP_METHOD(Console, Cmd_SetGameVar));
+
+ registerCmd("listModuleVars", WRAP_METHOD(Console, Cmd_ListModuleVars));
+ registerCmd("setModuleVar", WRAP_METHOD(Console, Cmd_SetModuleVar));
+
+ registerCmd("listPageVars", WRAP_METHOD(Console, Cmd_ListPageVars));
+ registerCmd("setPageVar", WRAP_METHOD(Console, Cmd_SetPageVar));
}
bool Console::Cmd_ListModules(int argc, const char **argv) {
@@ -59,6 +70,33 @@ bool Console::Cmd_GoToModule(int argc, const char **argv) {
return true;
}
+bool Console::Cmd_ListPages(int argc, const char **argv) {
+ const Array<GamePage*> pages = _vm->_module->_pages;
+ for (uint i = 0; i < pages.size(); ++i) {
+ debugPrintf("%d.%s\n", i, pages[i]->getName().c_str());
+ }
+ return true;
+}
+
+bool Console::Cmd_GoToPage(int argc, const char **argv) {
+ if (argc != 2) {
+ debugPrintf("Usage: %s pageName\n", argv[0]);
+ debugPrintf("Page may not work properly because of vars\n");
+ return true;
+ }
+ const Array<GamePage*> pages = _vm->_module->_pages;
+ for (uint i = 0; i < pages.size(); ++i) {
+ if (pages[i]->getName() == argv[1]) {
+ _vm->setNextExecutors("", pages[i]->getName());
+ _vm->changeScene();
+ return true;
+ }
+ }
+ debugPrintf("Page %s doesn't exist\n", argv[1]);
+ return true;
+}
+
+
bool Console::Cmd_ListGameVars(int argc, const char **argv) {
const StringMap &vars = _vm->_variables;
for (StringMap::const_iterator it = vars.begin(); it != vars.end() ; ++it) {
@@ -76,4 +114,38 @@ bool Console::Cmd_SetGameVar(int argc, const char **argv) {
return true;
}
+bool Console::Cmd_ListModuleVars(int argc, const char **argv) {
+ const StringMap &vars = _vm->_module->_variables;
+ for (StringMap::const_iterator it = vars.begin(); it != vars.end() ; ++it) {
+ debugPrintf("%s %s \n", it->_key.c_str(), it->_value.c_str());
+ }
+ return true;
+}
+
+bool Console::Cmd_SetModuleVar(int argc, const char **argv) {
+ if (argc != 3) {
+ debugPrintf("Usage: %s varName value\n", argv[0]);
+ return true;
+ }
+ _vm->_module->_variables[argv[1]] = argv[2];
+ return true;
+}
+
+bool Console::Cmd_ListPageVars(int argc, const char **argv) {
+ const StringMap &vars = _vm->_module->_page->_variables;
+ for (StringMap::const_iterator it = vars.begin(); it != vars.end() ; ++it) {
+ debugPrintf("%s %s \n", it->_key.c_str(), it->_value.c_str());
+ }
+ return true;
+}
+
+bool Console::Cmd_SetPageVar(int argc, const char **argv) {
+ if (argc != 3) {
+ debugPrintf("Usage: %s varName value\n", argv[0]);
+ return true;
+ }
+ _vm->_module->_page->_variables[argv[1]] = argv[2];
+ return true;
+}
+
} // End of namespace Pink
diff --git a/engines/pink/console.h b/engines/pink/console.h
index 73041a5..85e287f 100644
--- a/engines/pink/console.h
+++ b/engines/pink/console.h
@@ -39,9 +39,18 @@ private:
bool Cmd_ListModules(int argc, const char **argv);
bool Cmd_GoToModule(int argc, const char **argv);
+ bool Cmd_ListPages(int argc, const char **argv);
+ bool Cmd_GoToPage(int argc, const char **argv);
+
bool Cmd_ListGameVars(int argc, const char **argv);
bool Cmd_SetGameVar(int argc, const char **argv);
+ bool Cmd_ListModuleVars(int argc, const char **argv);
+ bool Cmd_SetModuleVar(int argc, const char **argv);
+
+ bool Cmd_ListPageVars(int argc, const char **argv);
+ bool Cmd_SetPageVar(int argc, const char **argv);
+
private:
PinkEngine *_vm;
};
diff --git a/engines/pink/objects/module.h b/engines/pink/objects/module.h
index 819c19d..6c1da99 100644
--- a/engines/pink/objects/module.h
+++ b/engines/pink/objects/module.h
@@ -65,6 +65,8 @@ public:
GamePage *getPage() { return _page; }
+ friend class Console;
+
private:
GamePage *findPage(const Common::String &pageName) const;
diff --git a/engines/pink/objects/pages/game_page.h b/engines/pink/objects/pages/game_page.h
index 81d4686..6edba95 100644
--- a/engines/pink/objects/pages/game_page.h
+++ b/engines/pink/objects/pages/game_page.h
@@ -56,6 +56,8 @@ public:
virtual void clear();
+ friend class Console;
+
private:
bool initHandler();
Commit: 278e279e8009b994c0ed00430d89485b8a67ddb2
https://github.com/scummvm/scummvm/commit/278e279e8009b994c0ed00430d89485b8a67ddb2
Author: whiterandrek (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added commands to manipulate inventory
Changed paths:
engines/pink/console.cpp
engines/pink/console.h
engines/pink/objects/inventory.h
diff --git a/engines/pink/console.cpp b/engines/pink/console.cpp
index ead4cf3..43002b8 100644
--- a/engines/pink/console.cpp
+++ b/engines/pink/console.cpp
@@ -24,6 +24,7 @@
#include "pink/pink.h"
#include "pink/objects/module.h"
#include "pink/objects/pages/game_page.h"
+#include "pink/objects/actors/lead_actor.h"
namespace Pink {
@@ -43,6 +44,9 @@ Console::Console(PinkEngine *vm)
registerCmd("listPageVars", WRAP_METHOD(Console, Cmd_ListPageVars));
registerCmd("setPageVar", WRAP_METHOD(Console, Cmd_SetPageVar));
+
+ registerCmd("listItems", WRAP_METHOD(Console, Cmd_ListItems));
+ registerCmd("addItem", WRAP_METHOD(Console, Cmd_addItem));
}
bool Console::Cmd_ListModules(int argc, const char **argv) {
@@ -148,4 +152,23 @@ bool Console::Cmd_SetPageVar(int argc, const char **argv) {
return true;
}
+bool Console::Cmd_ListItems(int argc, const char **argv) {
+ const Common::Array<InventoryItem*> &items = _vm->_module->_invMgr._items;
+ for (uint i = 0; i < items.size(); ++i) {
+ debugPrintf("%s\n", items[i]->getName().c_str());
+ }
+ return true;
+}
+
+bool Console::Cmd_addItem(int argc, const char **argv) {
+ if (argc != 2) {
+ debugPrintf("Usage: %s item\n", argv[0]);
+ return true;
+ }
+ InventoryMgr *inv = &_vm->_module->_invMgr;
+ LeadActor *actor = _vm->_actor;
+ inv->setItemOwner(actor->getName(), inv->findInventoryItem(argv[1]));
+ return true;
+}
+
} // End of namespace Pink
diff --git a/engines/pink/console.h b/engines/pink/console.h
index 85e287f..6b9b335 100644
--- a/engines/pink/console.h
+++ b/engines/pink/console.h
@@ -51,6 +51,9 @@ private:
bool Cmd_ListPageVars(int argc, const char **argv);
bool Cmd_SetPageVar(int argc, const char **argv);
+ bool Cmd_ListItems(int argc, const char **argv);
+ bool Cmd_addItem(int argc, const char **argv);
+
private:
PinkEngine *_vm;
};
diff --git a/engines/pink/objects/inventory.h b/engines/pink/objects/inventory.h
index 15c21bf..ca0e8a7 100644
--- a/engines/pink/objects/inventory.h
+++ b/engines/pink/objects/inventory.h
@@ -69,6 +69,8 @@ public:
InventoryItem *getCurrentItem() { return _item; }
+ friend class Console;
+
private:
void close();
enum Direction {
Commit: b379400e3b8a017e6d409621920b6388cb612ccc
https://github.com/scummvm/scummvm/commit/b379400e3b8a017e6d409621920b6388cb612ccc
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: JANITORIAL: Fix formatting
Changed paths:
engines/pink/console.cpp
diff --git a/engines/pink/console.cpp b/engines/pink/console.cpp
index 43002b8..b2a9ed3 100644
--- a/engines/pink/console.cpp
+++ b/engines/pink/console.cpp
@@ -50,7 +50,7 @@ Console::Console(PinkEngine *vm)
}
bool Console::Cmd_ListModules(int argc, const char **argv) {
- const Array<NamedObject*> modules = _vm->_modules;
+ const Array<NamedObject *> modules = _vm->_modules;
for (uint i = 0; i < modules.size(); ++i) {
debugPrintf("%d.%s\n", i, modules[i]->getName().c_str());
}
@@ -63,7 +63,7 @@ bool Console::Cmd_GoToModule(int argc, const char **argv) {
debugPrintf("Module may not work properly because of Game vars\n");
return true;
}
- const Array<NamedObject*> modules = _vm->_modules;
+ const Array<NamedObject *> modules = _vm->_modules;
for (uint i = 0; i < modules.size(); ++i) {
if (modules[i]->getName() == argv[1]) {
_vm->initModule(argv[1], "", nullptr);
@@ -153,7 +153,7 @@ bool Console::Cmd_SetPageVar(int argc, const char **argv) {
}
bool Console::Cmd_ListItems(int argc, const char **argv) {
- const Common::Array<InventoryItem*> &items = _vm->_module->_invMgr._items;
+ const Common::Array<InventoryItem *> &items = _vm->_module->_invMgr._items;
for (uint i = 0; i < items.size(); ++i) {
debugPrintf("%s\n", items[i]->getName().c_str());
}
Commit: db5f5e7b0d6bafc54d1dd02edbbc7632bf37198c
https://github.com/scummvm/scummvm/commit/db5f5e7b0d6bafc54d1dd02edbbc7632bf37198c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Added Polish Peril detection
Changed paths:
engines/pink/detection_tables.h
diff --git a/engines/pink/detection_tables.h b/engines/pink/detection_tables.h
index 7081de1..81c5800 100644
--- a/engines/pink/detection_tables.h
+++ b/engines/pink/detection_tables.h
@@ -92,6 +92,22 @@ static const ADGameDescription gameDescriptions[] = {
GUIO1(GUIO_NONE)
},
+ // Polish
+ {
+ "peril",
+ 0,
+ {
+ {"PPTP.ORB", NULL, "3b987bb529e131b92c3eb912871dedbd", 644839372},
+ {"PPTP.BRO", NULL, "138a84d0c6ea00066aff488c91cb1973", 8945466},
+ {"PPTP.EXE", NULL, "409d7dbc33c5cbfb3457468755d33691", 594432},
+ AD_LISTEND
+ },
+ Common::PL_POL,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ GUIO1(GUIO_NONE)
+ },
+
// Portuguese
{
"peril",
Commit: 42a649fd808114a4d31099951457f2e4f4b593e6
https://github.com/scummvm/scummvm/commit/42a649fd808114a4d31099951457f2e4f4b593e6
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix saving/loading
Changed paths:
engines/pink/detection.cpp
engines/pink/detection_tables.h
diff --git a/engines/pink/detection.cpp b/engines/pink/detection.cpp
index d643548..28af997 100644
--- a/engines/pink/detection.cpp
+++ b/engines/pink/detection.cpp
@@ -88,7 +88,8 @@ SaveStateList PinkMetaEngine::listSaves(const char *target) const {
if (in) {
SaveStateDescriptor desc;
desc.setSaveSlot(slotNum);
- saveList.push_back(desc);
+ if (Pink::readSaveHeader(*in.get(), desc))
+ saveList.push_back(desc);
}
}
}
diff --git a/engines/pink/detection_tables.h b/engines/pink/detection_tables.h
index 81c5800..e4de563 100644
--- a/engines/pink/detection_tables.h
+++ b/engines/pink/detection_tables.h
@@ -40,7 +40,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::EN_ANY,
Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM | ADGF_DROPLANGUAGE,
GUIO1(GUIO_NONE)
},
@@ -56,7 +56,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::FI_FIN,
Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM | ADGF_DROPLANGUAGE,
GUIO1(GUIO_NONE)
},
@@ -72,7 +72,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::FR_FRA,
Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM | ADGF_DROPLANGUAGE,
GUIO1(GUIO_NONE)
},
@@ -88,7 +88,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::HE_ISR,
Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM | ADGF_DROPLANGUAGE,
GUIO1(GUIO_NONE)
},
@@ -104,7 +104,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::PL_POL,
Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM | ADGF_DROPLANGUAGE,
GUIO1(GUIO_NONE)
},
@@ -120,7 +120,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::PT_BRA,
Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM | ADGF_DROPLANGUAGE,
GUIO1(GUIO_NONE)
},
@@ -136,7 +136,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::RU_RUS,
Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM | ADGF_DROPLANGUAGE,
GUIO1(GUIO_NONE)
},
@@ -152,7 +152,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::ES_ESP,
Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM | ADGF_DROPLANGUAGE,
GUIO1(GUIO_NONE)
},
@@ -168,7 +168,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::SE_SWE,
Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM | ADGF_DROPLANGUAGE,
GUIO1(GUIO_NONE)
},
@@ -183,7 +183,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::EN_ANY,
Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM | ADGF_DROPLANGUAGE,
GUIO1(GUIO_NONE)
},
@@ -198,7 +198,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::FR_FRA,
Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM | ADGF_DROPLANGUAGE,
GUIO1(GUIO_NONE)
},
@@ -213,7 +213,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::HE_ISR,
Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM | ADGF_DROPLANGUAGE,
GUIO1(GUIO_NONE)
},
@@ -228,7 +228,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::PL_POL,
Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM | ADGF_DROPLANGUAGE,
GUIO1(GUIO_NONE)
},
@@ -243,7 +243,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::PT_BRA,
Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM | ADGF_DROPLANGUAGE,
GUIO1(GUIO_NONE)
},
@@ -258,7 +258,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::RU_RUS,
Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM | ADGF_DROPLANGUAGE,
GUIO1(GUIO_NONE)
},
@@ -273,7 +273,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::ES_ESP,
Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM | ADGF_DROPLANGUAGE,
GUIO1(GUIO_NONE)
},
@@ -288,7 +288,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::SE_SWE,
Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM | ADGF_DROPLANGUAGE,
GUIO1(GUIO_NONE)
},
Commit: 81f60be7c827c22e9ae0eab53089ef065a187898
https://github.com/scummvm/scummvm/commit/81f60be7c827c22e9ae0eab53089ef065a187898
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fixed playing last audio subsequence
Changed paths:
engines/pink/objects/sequences/sequence.cpp
engines/pink/objects/sequences/sequence.h
diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp
index 7e5a3a2..5d303fb 100644
--- a/engines/pink/objects/sequences/sequence.cpp
+++ b/engines/pink/objects/sequences/sequence.cpp
@@ -28,7 +28,6 @@
#include "pink/objects/pages/game_page.h"
#include "pink/objects/sequences/sequence.h"
#include "pink/objects/sequences/sequence_context.h"
-#include "pink/objects/sequences/sequence_item.h"
#include "pink/objects/sequences/sequencer.h"
namespace Pink {
@@ -144,8 +143,9 @@ void SequenceAudio::start(bool loadingSave) {
Sequence::start(loadingSave);
uint index = _context->getNextItemIndex();
if (index < _items.size()) {
- SequenceItemLeaderAudio *leaderAudio = (SequenceItemLeaderAudio *)_items[index];
- _sample = leaderAudio->getSample();
+ _leader = (SequenceItemLeaderAudio *)_items[index];
+ } else {
+ _leader = nullptr;
}
}
@@ -157,18 +157,18 @@ void SequenceAudio::end() {
void SequenceAudio::update() {
if (!_sound.isPlaying())
end();
- else if (_sample <= _sound.getCurrentSample())
+ else if (_leader && _leader->getSample() <= _sound.getCurrentSample())
start(0);
}
void SequenceAudio::init(bool loadingSave) {
- _sample = 0;
+ _leader = nullptr;
_sound.play(_sequencer->getPage()->getResourceStream(_soundName), Audio::Mixer::kMusicSoundType);
start(loadingSave);
}
void SequenceAudio::restart() {
- _sample = 0;
+ _leader = nullptr;
_sound.play(_sequencer->getPage()->getResourceStream(_soundName), Audio::Mixer::kMusicSoundType);
Sequence::restart();
}
diff --git a/engines/pink/objects/sequences/sequence.h b/engines/pink/objects/sequences/sequence.h
index ae446e4..7ebb95c 100644
--- a/engines/pink/objects/sequences/sequence.h
+++ b/engines/pink/objects/sequences/sequence.h
@@ -24,7 +24,7 @@
#define PINK_SEQUENCE_H
#include "pink/sound.h"
-#include "pink/objects/object.h"
+#include "pink/objects/sequences/sequence_item.h"
namespace Pink {
@@ -86,9 +86,9 @@ public:
void skip() override;
private:
+ SequenceItemLeaderAudio *_leader;
Common::String _soundName;
Sound _sound;
- uint32 _sample;
};
} // End of namespace Pink
Commit: c75e048d2c1536aeb54bfabc73d2343fc5e410b5
https://github.com/scummvm/scummvm/commit/c75e048d2c1536aeb54bfabc73d2343fc5e410b5
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: changed way of getting sample
Changed paths:
engines/pink/sound.h
diff --git a/engines/pink/sound.h b/engines/pink/sound.h
index 28de99d..b89f0e4 100644
--- a/engines/pink/sound.h
+++ b/engines/pink/sound.h
@@ -24,6 +24,7 @@
#define PINK_SOUND_H
#include "audio/mixer.h"
+#include "audio/timestamp.h"
#include "common/system.h"
@@ -45,7 +46,7 @@ public:
void pause(bool paused) { g_system->getMixer()->pauseHandle(_handle, paused); }
- uint64 getCurrentSample() { return (uint64)g_system->getMixer()->getSoundElapsedTime(_handle) * 22050 / 1000; }
+ uint32 getCurrentSample() { return g_system->getMixer()->getElapsedTime(_handle).totalNumberOfFrames(); }
private:
Audio::SoundHandle _handle;
Commit: e979dda822de6107877e1817a79d5d2c63f36ba1
https://github.com/scummvm/scummvm/commit/e979dda822de6107877e1817a79d5d2c63f36ba1
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: removed readCount function
Changed paths:
engines/pink/archive.cpp
engines/pink/archive.h
engines/pink/utils.h
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp
index acb8b16..91eb5b9 100644
--- a/engines/pink/archive.cpp
+++ b/engines/pink/archive.cpp
@@ -228,17 +228,6 @@ void Archive::mapObject(Object *obj) {
_objectIdMap.push_back(0);
}
-int Archive::readCount() {
- int count = _readStream->readUint16LE();
-
- if (count == 0xffff) {
- assert(0);
- count = _readStream->readUint32LE();
- }
-
- return count;
-}
-
Object *Archive::readObject() {
bool isCopyReturned;
Object *res = parseObject(isCopyReturned);
diff --git a/engines/pink/archive.h b/engines/pink/archive.h
index ad51819..5ce7ff2 100644
--- a/engines/pink/archive.h
+++ b/engines/pink/archive.h
@@ -44,7 +44,6 @@ public:
void mapObject(Object *obj);
- int readCount();
byte readByte() { return _readStream->readByte(); }
uint32 readDWORD() { return _readStream->readUint32LE(); }
uint16 readWORD() { return _readStream->readUint16LE(); }
diff --git a/engines/pink/utils.h b/engines/pink/utils.h
index 75a2464..d55b8d9 100644
--- a/engines/pink/utils.h
+++ b/engines/pink/utils.h
@@ -31,7 +31,7 @@ template <typename T>
class Array : public Common::Array<T>, public Object {
public:
void deserialize(Archive &archive) {
- uint size = archive.readCount();
+ uint size = archive.readWORD();
this->resize(size);
for (uint i = 0; i < size; ++i) {
this->data()[i] = reinterpret_cast<T>(archive.readObject()); // dynamic_cast needs to know complete type
@@ -42,7 +42,7 @@ public:
class StringArray : public Common::StringArray {
public:
void deserialize(Archive &archive) {
- uint32 size = archive.readCount();
+ uint32 size = archive.readWORD();
this->resize(size);
for (uint i = 0; i < size; ++i) {
this->data()[i] = archive.readString();
Commit: 50bed2d544644242cf271397ece12bc6a702a57f
https://github.com/scummvm/scummvm/commit/50bed2d544644242cf271397ece12bc6a702a57f
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: updated engine description
Changed paths:
engines/pink/pink.h
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index 23ae898..693bc4b 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -54,11 +54,11 @@
*
* Pokus game status:
* Fully Playable*
- * sequences by timer are broken (HandlerTimerSequences)
*
* Known bugs:
* Walking sprites don't recalculate position
* PDA is not usable
+ * missing menu
*/
namespace Pink {
Commit: ab44490673e2b8c04ba1ebe0a0ceb476f413a5b9
https://github.com/scummvm/scummvm/commit/ab44490673e2b8c04ba1ebe0a0ceb476f413a5b9
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: remove using Timestamp. It doesn't work as intended.
Changed paths:
engines/pink/sound.h
diff --git a/engines/pink/sound.h b/engines/pink/sound.h
index b89f0e4..74fa1b8 100644
--- a/engines/pink/sound.h
+++ b/engines/pink/sound.h
@@ -46,7 +46,7 @@ public:
void pause(bool paused) { g_system->getMixer()->pauseHandle(_handle, paused); }
- uint32 getCurrentSample() { return g_system->getMixer()->getElapsedTime(_handle).totalNumberOfFrames(); }
+ uint64 getCurrentSample() { return (uint64)g_system->getMixer()->getElapsedTime(_handle).msecs() * 22050 / 1000; }
private:
Audio::SoundHandle _handle;
Commit: 633649398f3901b00bd8de7bc113f52971ccd940
https://github.com/scummvm/scummvm/commit/633649398f3901b00bd8de7bc113f52971ccd940
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added position recalculation of walking sprites
Changed paths:
engines/pink/objects/actions/action_cel.cpp
engines/pink/objects/actions/walk_action.cpp
engines/pink/objects/actions/walk_action.h
engines/pink/objects/walk/walk_mgr.cpp
engines/pink/objects/walk/walk_mgr.h
diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp
index a2cf192..f31db4c 100644
--- a/engines/pink/objects/actions/action_cel.cpp
+++ b/engines/pink/objects/actions/action_cel.cpp
@@ -77,9 +77,7 @@ Coordinates ActionCEL::getCoordinates() {
loadDecoder();
Coordinates coords;
- Common::Point point = _decoder.getCenter();
- coords.x = point.x;
- coords.y = point.y;
+ coords.point = _decoder.getCenter();
coords.z = getZ();
return coords;
diff --git a/engines/pink/objects/actions/walk_action.cpp b/engines/pink/objects/actions/walk_action.cpp
index 24b43db..cc02ef6 100644
--- a/engines/pink/objects/actions/walk_action.cpp
+++ b/engines/pink/objects/actions/walk_action.cpp
@@ -39,16 +39,54 @@ void WalkAction::toConsole() {
}
void WalkAction::onStart() {
- // not implemented
+ if (_toCalcFramePositions) {
+ _start = _mgr->getStartCoords().point;
+ _end = _mgr->getEndCoords().point;
+
+ if (!_horizontal) {
+ _end.y = getCoordinates().point.y;
+ _start.y = _end.y;
+ _frameCount = _decoder.getFrameCount();
+ }
+ else {
+ _frameCount = (uint) abs(3 * (_start.x - _end.x) / (int)_z);
+ if (!_frameCount)
+ _frameCount = 1;
+ }
+ setCenter(_start);
+ _curFrame = 0;
+ }
}
void WalkAction::update() {
- ActionCEL::update();
- if (_decoder.getCurFrame() < (int)_decoder.getFrameCount() - 1)
- decodeNext();
- else {
- _decoder.setEndOfTrack();
- _actor->endAction();
+ if (_toCalcFramePositions) {
+ if (_curFrame < _frameCount)
+ _curFrame++;
+ const double k = _curFrame / (double) _frameCount;
+ Common::Point newCenter;
+ newCenter.x = (_end.x - _start.x) * k + _start.x;
+ if (_horizontal) {
+ newCenter.y = (_end.y - _start.y) * k + _start.y;
+ } else {
+ newCenter.y = getCoordinates().point.y;
+ }
+ if (_decoder.getCurFrame() < (int)_decoder.getFrameCount() - 1)
+ decodeNext();
+ else {
+ setFrame(0);
+ }
+ setCenter(newCenter);
+ if (_curFrame >= _frameCount - 1) {
+ _decoder.setEndOfTrack();
+ _actor->endAction();
+ }
+ } else {
+ if (_decoder.getCurFrame() < (int)_decoder.getFrameCount() - 1)
+ decodeNext();
+ else {
+ _decoder.setEndOfTrack();
+ _actor->endAction();
+ }
}
}
diff --git a/engines/pink/objects/actions/walk_action.h b/engines/pink/objects/actions/walk_action.h
index d311b9e..b49bb45 100644
--- a/engines/pink/objects/actions/walk_action.h
+++ b/engines/pink/objects/actions/walk_action.h
@@ -35,10 +35,19 @@ public:
void update() override;
+ void setWalkMgr(WalkMgr *mgr) { _mgr = mgr; }
+ void setType(bool horizontal) { _horizontal = horizontal; }
+
protected:
void onStart() override;
private:
+ WalkMgr *_mgr;
+ Common::Point _start;
+ Common::Point _end;
+ uint _curFrame;
+ uint _frameCount;
+ bool _horizontal;
bool _toCalcFramePositions;
};
diff --git a/engines/pink/objects/walk/walk_mgr.cpp b/engines/pink/objects/walk/walk_mgr.cpp
index e9d2bb0..9b23f7b 100644
--- a/engines/pink/objects/walk/walk_mgr.cpp
+++ b/engines/pink/objects/walk/walk_mgr.cpp
@@ -64,7 +64,7 @@ void WalkMgr::start(WalkLocation *destination) {
if (_current.name.empty()) {
_current.name = _locations[0]->getName();
- _current.coord = getLocationCoordinates(_locations[0]->getName());
+ _current.coords = getLocationCoordinates(_locations[0]->getName());
}
_destination = destination;
@@ -83,29 +83,34 @@ void WalkMgr::start(WalkLocation *destination) {
void WalkMgr::initNextWayPoint(WalkLocation *location) {
_next.name = location->getName();
- _next.coord = getLocationCoordinates(location->getName());
+ _next.coords = getLocationCoordinates(location->getName());
}
WalkAction *WalkMgr::getWalkAction() {
Common::String walkActionName;
- if (_current.coord.z == _next.coord.z) {
- if (_next.coord.x > _current.coord.x) {
- walkActionName = Common::String::format("%dRight", _current.coord.z);
+ bool horizontal = false;
+ if (_current.coords.z == _next.coords.z) {
+ if (_next.coords.point.x > _current.coords.point.x) {
+ walkActionName = Common::String::format("%dRight", _current.coords.z);
} else
- walkActionName = Common::String::format("%dLeft", _next.coord.z);
+ walkActionName = Common::String::format("%dLeft", _next.coords.z);
+ horizontal = true;
} else
- walkActionName = Common::String::format("%dTo%d", _current.coord.z, _next.coord.z);
+ walkActionName = Common::String::format("%dTo%d", _current.coords.z, _next.coords.z);
- Action *action = _leadActor->findAction(walkActionName);
-
- return static_cast<WalkAction *>(action);
+ WalkAction *action = (WalkAction *) _leadActor->findAction(walkActionName);
+ if (action) {
+ action->setWalkMgr(this);
+ action->setType(horizontal);
+ }
+ return action;
}
double WalkMgr::getLengthBetweenLocations(WalkLocation *first, WalkLocation *second) {
Coordinates firstCoord = getLocationCoordinates(first->getName());
Coordinates secondCoord = getLocationCoordinates(second->getName());
- return sqrt((secondCoord.x - firstCoord.x) * (secondCoord.x - firstCoord.x) +
- (secondCoord.y - firstCoord.y) * (secondCoord.y - firstCoord.y));
+ return sqrt((secondCoord.point.x - firstCoord.point.x) * (secondCoord.point.x - firstCoord.point.x) +
+ (secondCoord.point.y - firstCoord.point.y) * (secondCoord.point.y - firstCoord.point.y));
}
Coordinates WalkMgr::getLocationCoordinates(const Common::String &locationName) {
@@ -115,7 +120,7 @@ Coordinates WalkMgr::getLocationCoordinates(const Common::String &locationName)
void WalkMgr::setCurrentWayPoint(WalkLocation *location) {
_current.name = location->getName();
- _current.coord = getLocationCoordinates(_current.name);
+ _current.coords = getLocationCoordinates(_current.name);
}
void WalkMgr::update() {
@@ -142,12 +147,12 @@ void WalkMgr::loadState(Archive &archive) {
_isWalking = archive.readByte();
_current.name = archive.readString();
if (!_current.name.empty()) {
- _current.coord = getLocationCoordinates(_current.name);
+ _current.coords = getLocationCoordinates(_current.name);
}
if (_isWalking) {
_next.name = archive.readString();
_destination = findLocation(archive.readString());
- _next.coord = getLocationCoordinates(_next.name);
+ _next.coords = getLocationCoordinates(_next.name);
}
}
diff --git a/engines/pink/objects/walk/walk_mgr.h b/engines/pink/objects/walk/walk_mgr.h
index dd08e61..07b0beb 100644
--- a/engines/pink/objects/walk/walk_mgr.h
+++ b/engines/pink/objects/walk/walk_mgr.h
@@ -23,6 +23,8 @@
#ifndef PINK_WALK_MGR_H
#define PINK_WALK_MGR_H
+#include "common/rect.h"
+
#include "pink/objects/object.h"
#include "pink/objects/walk/walk_shortest_path.h"
#include "pink/utils.h"
@@ -34,8 +36,7 @@ class LeadActor;
class WalkAction;
struct Coordinates {
- int x;
- int y;
+ Common::Point point;
int z;
};
@@ -58,10 +59,13 @@ public:
void skip();
+ const Coordinates &getStartCoords() { return _current.coords; }
+ const Coordinates &getEndCoords() { return _next.coords; }
+
private:
struct WayPoint {
Common::String name;
- Coordinates coord;
+ Coordinates coords;
};
Coordinates getLocationCoordinates(const Common::String &locationName);
Commit: 63fc5ad79b27700b882f977af2304733ee622a62
https://github.com/scummvm/scummvm/commit/63fc5ad79b27700b882f977af2304733ee622a62
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fix setting cursor with name which wasn't in disasm
Changed paths:
engines/pink/cursor_mgr.cpp
diff --git a/engines/pink/cursor_mgr.cpp b/engines/pink/cursor_mgr.cpp
index fe70c9f..feb997b 100644
--- a/engines/pink/cursor_mgr.cpp
+++ b/engines/pink/cursor_mgr.cpp
@@ -69,12 +69,14 @@ void CursorMgr::setCursor(const Common::String &cursorName, const Common::Point
index = kExitLeftCursor;
else if (cursorName == kCursorNameExitRight)
index = kExitRightCursor;
- else if (cursorName == kCursorNameExitForward || cursorName == kCursorNameExitUp)
+ else if (cursorName == kCursorNameExitForward || cursorName == kCursorNameExitUp || cursorName == "Exit")
index = kExitForwardCursor;
else if (cursorName == kCursorNameExitBackWards)
index = kExitDownCursor;
- else
- error("%s UNKNOWN CURSOR", cursorName.c_str());
+ else {
+ warning("%s UNKNOWN CURSOR", cursorName.c_str());
+ index = kExitForwardCursor;
+ }
setCursor(index, point, "");
}
Commit: be3e0148df124ae48a64735bb6ea978144a64e86
https://github.com/scummvm/scummvm/commit/be3e0148df124ae48a64735bb6ea978144a64e86
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: removed unused include directives
Changed paths:
engines/pink/archive.cpp
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/sequences/sequence_context.cpp
engines/pink/objects/walk/walk_mgr.cpp
engines/pink/objects/walk/walk_shortest_path.cpp
engines/pink/pink.cpp
engines/pink/sound.cpp
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp
index 91eb5b9..331d3a3 100644
--- a/engines/pink/archive.cpp
+++ b/engines/pink/archive.cpp
@@ -43,7 +43,6 @@
#include "pink/objects/pages/game_page.h"
#include "pink/objects/sequences/seq_timer.h"
#include "pink/objects/sequences/sequence.h"
-#include "pink/objects/sequences/sequence_item.h"
#include "pink/objects/walk/walk_location.h"
namespace Pink {
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 17f1cac..8c8f968 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -29,7 +29,6 @@
#include "pink/objects/pages/game_page.h"
#include "pink/objects/sequences/sequence_context.h"
#include "pink/objects/sequences/sequencer.h"
-#include "pink/objects/walk/walk_mgr.h"
namespace Pink {
diff --git a/engines/pink/objects/sequences/sequence_context.cpp b/engines/pink/objects/sequences/sequence_context.cpp
index 2c8d10d..d10bf23 100644
--- a/engines/pink/objects/sequences/sequence_context.cpp
+++ b/engines/pink/objects/sequences/sequence_context.cpp
@@ -26,7 +26,6 @@
#include "pink/objects/pages/game_page.h"
#include "pink/objects/sequences/sequence.h"
#include "pink/objects/sequences/sequence_context.h"
-#include "pink/objects/sequences/sequence_item.h"
#include "pink/objects/sequences/sequencer.h"
namespace Pink {
diff --git a/engines/pink/objects/walk/walk_mgr.cpp b/engines/pink/objects/walk/walk_mgr.cpp
index 9b23f7b..f89fa05 100644
--- a/engines/pink/objects/walk/walk_mgr.cpp
+++ b/engines/pink/objects/walk/walk_mgr.cpp
@@ -24,7 +24,6 @@
#include "pink/cel_decoder.h"
#include "pink/objects/actions/walk_action.h"
#include "pink/objects/actors/lead_actor.h"
-#include "pink/objects/walk/walk_mgr.h"
#include "pink/objects/walk/walk_location.h"
namespace Pink {
diff --git a/engines/pink/objects/walk/walk_shortest_path.cpp b/engines/pink/objects/walk/walk_shortest_path.cpp
index 9bc86d1..619d13e 100644
--- a/engines/pink/objects/walk/walk_shortest_path.cpp
+++ b/engines/pink/objects/walk/walk_shortest_path.cpp
@@ -22,7 +22,6 @@
#include "pink/objects/walk/walk_location.h"
#include "pink/objects/walk/walk_mgr.h"
-#include "pink/objects/walk/walk_shortest_path.h"
namespace Pink {
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index 50e8e53..bddc850 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -34,7 +34,6 @@
#include "pink/console.h"
#include "pink/objects/module.h"
#include "pink/objects/actors/lead_actor.h"
-#include "pink/objects/sequences/sequencer.h"
namespace Pink {
diff --git a/engines/pink/sound.cpp b/engines/pink/sound.cpp
index 2580125..7caba24 100644
--- a/engines/pink/sound.cpp
+++ b/engines/pink/sound.cpp
@@ -25,7 +25,6 @@
#include "common/substream.h"
-#include "pink/constants.h"
#include "pink/sound.h"
namespace Pink {
Commit: 7a6c8f70e699e982df16bf04c728ef84fb117565
https://github.com/scummvm/scummvm/commit/7a6c8f70e699e982df16bf04c728ef84fb117565
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: removed unused functions
Changed paths:
engines/pink/cel_decoder.h
engines/pink/objects/module.h
diff --git a/engines/pink/cel_decoder.h b/engines/pink/cel_decoder.h
index 1e9cb41..36f8dc2 100644
--- a/engines/pink/cel_decoder.h
+++ b/engines/pink/cel_decoder.h
@@ -45,8 +45,6 @@ protected:
CelVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height, bool skipHeader = false);
virtual void readHeader();
- int32 getX() const;
- int32 getY() const;
uint16 getTransparentColourIndex();
// Hack. Pink needs so that Track needed an update after lastFrame delay ends
@@ -56,9 +54,6 @@ protected:
Common::Point getCenter();
const Graphics::Surface *getCurrentFrame();
- void setX(int32 x);
- void setY(int32 y);
-
void skipFrame();
bool rewind() override;
diff --git a/engines/pink/objects/module.h b/engines/pink/objects/module.h
index 6c1da99..7d3c15b 100644
--- a/engines/pink/objects/module.h
+++ b/engines/pink/objects/module.h
@@ -53,10 +53,6 @@ public:
void init(bool isLoadingSave, const Common::String &pageName);
void changePage(const Common::String &pageName);
- void onLeftButtonDown();
- void onMouseMove();
- void onKeyboardButtonClick();
-
PinkEngine *getGame() const { return _game; }
InventoryMgr *getInventoryMgr() { return &_invMgr; }
Commit: c5062e0f74376ba1d88a126c2995f0f2ccc9ab18
https://github.com/scummvm/scummvm/commit/c5062e0f74376ba1d88a126c2995f0f2ccc9ab18
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: fixed loading WorldBook when clicking on inv window
Changed paths:
engines/pink/objects/inventory.cpp
engines/pink/objects/inventory.h
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
index 89df846..f22925d 100644
--- a/engines/pink/objects/inventory.cpp
+++ b/engines/pink/objects/inventory.cpp
@@ -140,13 +140,13 @@ void InventoryMgr::update() {
}
}
-void InventoryMgr::onClick(Common::Point point) {
+void InventoryMgr::onClick(const Common::Point point) {
if (_state != kReady)
return;
Actor *actor = _lead->getActorByPoint(point);
if (actor == _itemActor || actor == _window) {
- if (actor->getAction()->getName() == "WBook") {
+ if (_itemActor->getAction()->getName() == "WBook") {
_lead->loadPDA("TOC");
return;
}
diff --git a/engines/pink/objects/inventory.h b/engines/pink/objects/inventory.h
index ca0e8a7..a92a837 100644
--- a/engines/pink/objects/inventory.h
+++ b/engines/pink/objects/inventory.h
@@ -57,7 +57,7 @@ public:
void saveState(Archive &archive);
void update();
- void onClick(Common::Point point);
+ void onClick(const Common::Point point);
bool start(bool paused);
Commit: 2d8b2be6c58c42313ecbe63a52d7843093312acc
https://github.com/scummvm/scummvm/commit/2d8b2be6c58c42313ecbe63a52d7843093312acc
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: rework setItemOwner method
Changed paths:
engines/pink/objects/inventory.cpp
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
index f22925d..b4c1f7d 100644
--- a/engines/pink/objects/inventory.cpp
+++ b/engines/pink/objects/inventory.cpp
@@ -91,11 +91,10 @@ void InventoryMgr::setItemOwner(const Common::String &owner, InventoryItem *item
if (item == _item && _lead->getName() != owner)
_item = nullptr;
+ else if (_lead->getName() == owner)
+ _item = item;
item->_currentOwner = owner;
-
- if (_lead->getName() == owner)
- _item = item;
}
bool InventoryMgr::start(bool paused) {
Commit: 0f596eb69a05a3fbff49b4bc01c881c8d6231352
https://github.com/scummvm/scummvm/commit/0f596eb69a05a3fbff49b4bc01c881c8d6231352
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: updated engine description
Changed paths:
engines/pink/pink.h
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index 693bc4b..637a244 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -56,8 +56,7 @@
* Fully Playable*
*
* Known bugs:
- * Walking sprites don't recalculate position
- * PDA is not usable
+ * PDA is not usable(ActionText and Peril Commands are not implemented)
* missing menu
*/
Commit: 8cbdc4b63f45b844014610b9c5eb7dd045bcba61
https://github.com/scummvm/scummvm/commit/8cbdc4b63f45b844014610b9c5eb7dd045bcba61
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: renamed method of SequenceContext
Changed paths:
engines/pink/objects/sequences/sequence_context.cpp
engines/pink/objects/sequences/sequence_context.h
engines/pink/objects/sequences/sequencer.cpp
diff --git a/engines/pink/objects/sequences/sequence_context.cpp b/engines/pink/objects/sequences/sequence_context.cpp
index d10bf23..962aeb2 100644
--- a/engines/pink/objects/sequences/sequence_context.cpp
+++ b/engines/pink/objects/sequences/sequence_context.cpp
@@ -87,7 +87,7 @@ SequenceActorState *SequenceContext::findState(const Common::String &actor) {
return nullptr;
}
-bool SequenceContext::isConflictsWith(SequenceContext *context) {
+bool SequenceContext::isConflictingWith(SequenceContext *context) {
for (uint i = 0; i < _states.size(); ++i) {
if (context->findState(_states[i].actorName))
return true;
diff --git a/engines/pink/objects/sequences/sequence_context.h b/engines/pink/objects/sequences/sequence_context.h
index ccca20e..eea87af 100644
--- a/engines/pink/objects/sequences/sequence_context.h
+++ b/engines/pink/objects/sequences/sequence_context.h
@@ -49,7 +49,7 @@ public:
void execute(uint nextItemIndex, bool loadingSave);
- bool isConflictsWith(SequenceContext *context);
+ bool isConflictingWith(SequenceContext *context);
void clearDefaultActions();
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index 6b59788..f76ed66 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -180,11 +180,11 @@ void Sequencer::saveState(Archive &archive) {
}
SequenceContext *Sequencer::findConfilictingContextWith(SequenceContext *context) {
- if (_context && _context->isConflictsWith(context)) {
+ if (_context && _context->isConflictingWith(context)) {
return _context;
}
for (uint i = 0; i < _parrallelContexts.size(); ++i) {
- if (_parrallelContexts[i]->isConflictsWith(context))
+ if (_parrallelContexts[i]->isConflictingWith(context))
return _parrallelContexts[i];
}
return nullptr;
Commit: f7679c6c9b5e439b48c17ef5e8419b8786c7a4cd
https://github.com/scummvm/scummvm/commit/f7679c6c9b5e439b48c17ef5e8419b8786c7a4cd
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Do not drop language on target generation during autodetection
Changed paths:
engines/pink/detection_tables.h
diff --git a/engines/pink/detection_tables.h b/engines/pink/detection_tables.h
index e4de563..81c5800 100644
--- a/engines/pink/detection_tables.h
+++ b/engines/pink/detection_tables.h
@@ -40,7 +40,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::EN_ANY,
Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM | ADGF_DROPLANGUAGE,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE)
},
@@ -56,7 +56,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::FI_FIN,
Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM | ADGF_DROPLANGUAGE,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE)
},
@@ -72,7 +72,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::FR_FRA,
Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM | ADGF_DROPLANGUAGE,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE)
},
@@ -88,7 +88,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::HE_ISR,
Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM | ADGF_DROPLANGUAGE,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE)
},
@@ -104,7 +104,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::PL_POL,
Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM | ADGF_DROPLANGUAGE,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE)
},
@@ -120,7 +120,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::PT_BRA,
Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM | ADGF_DROPLANGUAGE,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE)
},
@@ -136,7 +136,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::RU_RUS,
Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM | ADGF_DROPLANGUAGE,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE)
},
@@ -152,7 +152,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::ES_ESP,
Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM | ADGF_DROPLANGUAGE,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE)
},
@@ -168,7 +168,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::SE_SWE,
Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM | ADGF_DROPLANGUAGE,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE)
},
@@ -183,7 +183,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::EN_ANY,
Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM | ADGF_DROPLANGUAGE,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE)
},
@@ -198,7 +198,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::FR_FRA,
Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM | ADGF_DROPLANGUAGE,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE)
},
@@ -213,7 +213,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::HE_ISR,
Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM | ADGF_DROPLANGUAGE,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE)
},
@@ -228,7 +228,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::PL_POL,
Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM | ADGF_DROPLANGUAGE,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE)
},
@@ -243,7 +243,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::PT_BRA,
Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM | ADGF_DROPLANGUAGE,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE)
},
@@ -258,7 +258,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::RU_RUS,
Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM | ADGF_DROPLANGUAGE,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE)
},
@@ -273,7 +273,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::ES_ESP,
Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM | ADGF_DROPLANGUAGE,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE)
},
@@ -288,7 +288,7 @@ static const ADGameDescription gameDescriptions[] = {
},
Common::SE_SWE,
Common::kPlatformWindows,
- ADGF_UNSTABLE | ADGF_DROPPLATFORM | ADGF_DROPLANGUAGE,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE)
},
Commit: 8ad0f02b414a8ceb5ad802addb80b3255d88dd35
https://github.com/scummvm/scummvm/commit/8ad0f02b414a8ceb5ad802addb80b3255d88dd35
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Properly generate save names
Changed paths:
engines/pink/pink.cpp
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index bddc850..2d8240c 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -261,7 +261,7 @@ void PinkEngine::setCursor(uint cursorIndex) {
}
Common::Error PinkEngine::loadGameState(int slot) {
- Common::SeekableReadStream *in = _saveFileMan->openForLoading(generateSaveName(slot, _desc.gameId));
+ Common::SeekableReadStream *in = _saveFileMan->openForLoading(generateSaveName(slot, _targetName.c_str()));
if (!in)
return Common::kNoGameDataFoundError;
@@ -284,7 +284,7 @@ bool PinkEngine::canLoadGameStateCurrently() {
}
Common::Error PinkEngine::saveGameState(int slot, const Common::String &desc) {
- Common::OutSaveFile *out = _saveFileMan->openForSaving(generateSaveName(slot, _desc.gameId));
+ Common::OutSaveFile *out = _saveFileMan->openForSaving(generateSaveName(slot, _targetName.c_str()));
if (!out)
return Common::kUnknownError;
Commit: 41d3d1ee7553664ada14a35d3329a77f1c443ffe
https://github.com/scummvm/scummvm/commit/41d3d1ee7553664ada14a35d3329a77f1c443ffe
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Fix compilation
Changed paths:
engines/pink/objects/walk/walk_mgr.cpp
diff --git a/engines/pink/objects/walk/walk_mgr.cpp b/engines/pink/objects/walk/walk_mgr.cpp
index f89fa05..a319f4c 100644
--- a/engines/pink/objects/walk/walk_mgr.cpp
+++ b/engines/pink/objects/walk/walk_mgr.cpp
@@ -108,7 +108,7 @@ WalkAction *WalkMgr::getWalkAction() {
double WalkMgr::getLengthBetweenLocations(WalkLocation *first, WalkLocation *second) {
Coordinates firstCoord = getLocationCoordinates(first->getName());
Coordinates secondCoord = getLocationCoordinates(second->getName());
- return sqrt((secondCoord.point.x - firstCoord.point.x) * (secondCoord.point.x - firstCoord.point.x) +
+ return (double)sqrt((double)(secondCoord.point.x - firstCoord.point.x) * (secondCoord.point.x - firstCoord.point.x) +
(secondCoord.point.y - firstCoord.point.y) * (secondCoord.point.y - firstCoord.point.y));
}
Commit: 8293b97e76f41bfd570b1f80041b73443b2546bd
https://github.com/scummvm/scummvm/commit/8293b97e76f41bfd570b1f80041b73443b2546bd
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: Fix savegame detection
Changed paths:
engines/pink/pink.cpp
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index 2d8240c..358dce6 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -341,9 +341,7 @@ Common::String generateSaveName(int slot, const char *gameId) {
}
bool readSaveHeader(Common::InSaveFile &in, SaveStateDescriptor &desc) {
- char pink[4];
- in.read(&pink, 4);
- if (strcmp(pink, "pink"))
+ if (in.readUint32BE() != MKTAG('p', 'i', 'n', 'k'))
return false;
const Common::String description = in.readPascalString();
Commit: 98e7bdee4b3a3e527d4e5e2a38c3757cc9622ec9
https://github.com/scummvm/scummvm/commit/98e7bdee4b3a3e527d4e5e2a38c3757cc9622ec9
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: move save/load engine functions to separate file
Changed paths:
A engines/pink/saveload.cpp
engines/pink/module.mk
engines/pink/pink.cpp
diff --git a/engines/pink/module.mk b/engines/pink/module.mk
index 002159a..ab9cc89 100644
--- a/engines/pink/module.mk
+++ b/engines/pink/module.mk
@@ -12,6 +12,7 @@ MODULE_OBJS = \
pda_mgr.o \
pink.o \
resource_mgr.o \
+ saveload.o \
sound.o \
objects/object.o \
objects/module.o \
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index 358dce6..dd7b1cf 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -260,62 +260,10 @@ void PinkEngine::setCursor(uint cursorIndex) {
_system->updateScreen();
}
-Common::Error PinkEngine::loadGameState(int slot) {
- Common::SeekableReadStream *in = _saveFileMan->openForLoading(generateSaveName(slot, _targetName.c_str()));
- if (!in)
- return Common::kNoGameDataFoundError;
-
- SaveStateDescriptor desc;
- if (!readSaveHeader(*in, desc))
- return Common::kUnknownError;
-
- Archive archive(in);
- _variables.deserialize(archive);
- _nextModule = archive.readString();
- _nextPage = archive.readString();
- initModule(archive.readString(), "", &archive);
-
- delete in;
- return Common::kNoError;
-}
-
bool PinkEngine::canLoadGameStateCurrently() {
return true;
}
-Common::Error PinkEngine::saveGameState(int slot, const Common::String &desc) {
- Common::OutSaveFile *out = _saveFileMan->openForSaving(generateSaveName(slot, _targetName.c_str()));
- if (!out)
- return Common::kUnknownError;
-
- Archive archive(out);
-
- out->write("pink", 4);
- archive.writeString(desc);
-
- TimeDate curTime;
- _system->getTimeAndDate(curTime);
-
- out->writeUint32LE(((curTime.tm_mday & 0xFF) << 24) | (((curTime.tm_mon + 1) & 0xFF) << 16) | ((curTime.tm_year + 1900) & 0xFFFF));
- out->writeUint16LE(((curTime.tm_hour & 0xFF) << 8) | ((curTime.tm_min) & 0xFF));
-
- out->writeUint32LE(getTotalPlayTime() / 1000);
-
- if (!Graphics::saveThumbnail(*out))
- return Common::kUnknownError;
-
- _variables.serialize(archive);
- archive.writeString(_nextModule);
- archive.writeString(_nextPage);
-
- archive.writeString(_module->getName());
- _module->saveState(archive);
-
- delete out;
-
- return Common::kNoError;
-}
-
bool PinkEngine::canSaveGameStateCurrently() {
return true;
}
@@ -336,39 +284,4 @@ bool PinkEngine::isPeril() {
return !strcmp(_desc.gameId, "peril");
}
-Common::String generateSaveName(int slot, const char *gameId) {
- return Common::String::format("%s.s%02d", gameId, slot);
-}
-
-bool readSaveHeader(Common::InSaveFile &in, SaveStateDescriptor &desc) {
- if (in.readUint32BE() != MKTAG('p', 'i', 'n', 'k'))
- return false;
-
- const Common::String description = in.readPascalString();
- uint32 date = in.readUint32LE();
- uint16 time = in.readUint16LE();
- uint32 playTime = in.readUint32LE();
- if (!Graphics::checkThumbnailHeader(in))
- return false;
-
- Graphics::Surface *thumbnail;
- if (!Graphics::loadThumbnail(in, thumbnail))
- return false;
-
- int day = (date >> 24) & 0xFF;
- int month = (date >> 16) & 0xFF;
- int year = date & 0xFFFF;
-
- int hour = (time >> 8) & 0xFF;
- int minutes = time & 0xFF;
-
- desc.setSaveDate(year, month, day);
- desc.setSaveTime(hour, minutes);
- desc.setPlayTime(playTime * 1000);
- desc.setDescription(description);
- desc.setThumbnail(thumbnail);
-
- return true;
-}
-
}
diff --git a/engines/pink/saveload.cpp b/engines/pink/saveload.cpp
new file mode 100644
index 0000000..506eaca
--- /dev/null
+++ b/engines/pink/saveload.cpp
@@ -0,0 +1,117 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "graphics/thumbnail.h"
+
+#include "pink/pink.h"
+#include "pink/objects/module.h"
+
+namespace Pink {
+
+Common::Error PinkEngine::loadGameState(int slot) {
+ Common::SeekableReadStream *in = _saveFileMan->openForLoading(generateSaveName(slot, _targetName.c_str()));
+ if (!in)
+ return Common::kNoGameDataFoundError;
+
+ SaveStateDescriptor desc;
+ if (!readSaveHeader(*in, desc))
+ return Common::kUnknownError;
+
+ Archive archive(in);
+ _variables.deserialize(archive);
+ _nextModule = archive.readString();
+ _nextPage = archive.readString();
+ initModule(archive.readString(), "", &archive);
+
+ delete in;
+ return Common::kNoError;
+}
+
+Common::Error PinkEngine::saveGameState(int slot, const Common::String &desc) {
+ Common::OutSaveFile *out = _saveFileMan->openForSaving(generateSaveName(slot, _targetName.c_str()));
+ if (!out)
+ return Common::kUnknownError;
+
+ Archive archive(out);
+
+ out->write("pink", 4);
+ archive.writeString(desc);
+
+ TimeDate curTime;
+ _system->getTimeAndDate(curTime);
+
+ out->writeUint32LE(((curTime.tm_mday & 0xFF) << 24) | (((curTime.tm_mon + 1) & 0xFF) << 16) | ((curTime.tm_year + 1900) & 0xFFFF));
+ out->writeUint16LE(((curTime.tm_hour & 0xFF) << 8) | ((curTime.tm_min) & 0xFF));
+
+ out->writeUint32LE(getTotalPlayTime() / 1000);
+
+ if (!Graphics::saveThumbnail(*out))
+ return Common::kUnknownError;
+
+ _variables.serialize(archive);
+ archive.writeString(_nextModule);
+ archive.writeString(_nextPage);
+
+ archive.writeString(_module->getName());
+ _module->saveState(archive);
+
+ delete out;
+
+ return Common::kNoError;
+}
+
+Common::String generateSaveName(int slot, const char *gameId) {
+ return Common::String::format("%s.s%02d", gameId, slot);
+}
+
+bool readSaveHeader(Common::InSaveFile &in, SaveStateDescriptor &desc) {
+ if (in.readUint32BE() != MKTAG('p', 'i', 'n', 'k'))
+ return false;
+
+ const Common::String description = in.readPascalString();
+ uint32 date = in.readUint32LE();
+ uint16 time = in.readUint16LE();
+ uint32 playTime = in.readUint32LE();
+ if (!Graphics::checkThumbnailHeader(in))
+ return false;
+
+ Graphics::Surface *thumbnail;
+ if (!Graphics::loadThumbnail(in, thumbnail))
+ return false;
+
+ int day = (date >> 24) & 0xFF;
+ int month = (date >> 16) & 0xFF;
+ int year = date & 0xFFFF;
+
+ int hour = (time >> 8) & 0xFF;
+ int minutes = time & 0xFF;
+
+ desc.setSaveDate(year, month, day);
+ desc.setSaveTime(hour, minutes);
+ desc.setPlayTime(playTime * 1000);
+ desc.setDescription(description);
+ desc.setThumbnail(thumbnail);
+
+ return true;
+}
+
+}
Commit: 8a606ed8a89cb4ef3d43beffb2b4225afa6ab18b
https://github.com/scummvm/scummvm/commit/8a606ed8a89cb4ef3d43beffb2b4225afa6ab18b
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added undef of macros
Changed paths:
engines/pink/cel_decoder.cpp
diff --git a/engines/pink/cel_decoder.cpp b/engines/pink/cel_decoder.cpp
index 4e66cf7..3f3dc58 100644
--- a/engines/pink/cel_decoder.cpp
+++ b/engines/pink/cel_decoder.cpp
@@ -117,6 +117,9 @@ void CelDecoder::CelVideoTrack::readPrefixChunk() {
}
}
+#undef PREFIX_TYPE
+#undef CEL_DATA
+
void CelDecoder::CelVideoTrack::readHeader() {
_fileStream->readUint16LE();
@@ -206,6 +209,8 @@ const Graphics::Surface *CelDecoder::CelVideoTrack::decodeNextFrame() {
return _surface;
}
+#undef FRAME_TYPE
+
bool CelDecoder::CelVideoTrack::rewind() {
// this method is overriden for 2 reasons:
// 1) bug in Flic rewind(curFrame)
Commit: feb3fde1cf0d026c761cda0ee05a93cfc93a38d7
https://github.com/scummvm/scummvm/commit/feb3fde1cf0d026c761cda0ee05a93cfc93a38d7
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: JANITORIAL: formatting fixes
Changed paths:
engines/pink/archive.cpp
engines/pink/detection.cpp
engines/pink/objects/actions/walk_action.cpp
engines/pink/objects/actors/lead_actor.cpp
engines/pink/objects/actors/lead_actor.h
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp
index 331d3a3..a223c99 100644
--- a/engines/pink/archive.cpp
+++ b/engines/pink/archive.cpp
@@ -51,56 +51,56 @@ static const struct RuntimeClass {
const char *name;
int id;
} classMap[] = {
- {"ActionHide", kActionHide},
- {"ActionLoop", kActionLoop},
- {"ActionPlay", kActionPlay},
- {"ActionPlayWithSfx", kActionPlayWithSfx},
- {"ActionSfx", kActionSfx},
- {"ActionSound", kActionSound},
- {"ActionStill", kActionStill},
- {"ActionTalk", kActionTalk},
- {"ActionText", kActionText},
- {"Actor", kActor},
- {"AudioInfoPDAButton", kAudioInfoPDAButton},
- {"ConditionGameVariable", kConditionGameVariable},
- {"ConditionInventoryItemOwner", kConditionInventoryItemOwner},
- {"ConditionModuleVariable", kConditionModuleVariable},
- {"ConditionNotInventoryItemOwner", kConditionNotInventoryItemOwner},
- {"ConditionNotModuleVariable", kConditionNotModuleVariable},
- {"ConditionNotPageVariable", kConditionNotPageVariable},
- {"ConditionPageVariable", kConditionPageVariable},
- {"CursorActor", kCursorActor},
- {"GamePage", kGamePage},
- {"HandlerLeftClick", kHandlerLeftClick},
- {"HandlerStartPage", kHandlerStartPage},
- {"HandlerTimer", kHandlerTimer},
- {"HandlerTimerActions", kHandlerTimerActions},
- {"HandlerTimerSequences", kHandlerTimerSequences},
- {"HandlerUseClick", kHandlerUseClick},
- {"InventoryActor", kInventoryActor},
- {"InventoryItem", kInventoryItem},
- {"LeadActor", kLeadActor},
- {"ModuleProxy", kModuleProxy},
- {"PDAButtonActor", kPDAButtonActor},
- {"ParlSqPink", kParlSqPink},
- {"PubPink", kPubPink},
- {"SeqTimer", kSeqTimer},
- {"Sequence", kSequence},
- {"SequenceAudio", kSequenceAudio},
- {"SequenceItem", kSequenceItem},
- {"SequenceItemDefaultAction", kSequenceItemDefaultAction},
- {"SequenceItemLeader", kSequenceItemLeader},
- {"SequenceItemLeaderAudio", kSequenceItemLeaderAudio},
- {"SideEffectExit", kSideEffectExit},
- {"SideEffectGameVariable", kSideEffectGameVariable},
- {"SideEffectInventoryItemOwner", kSideEffectInventoryItemOwner},
- {"SideEffectLocation", kSideEffectLocation},
- {"SideEffectModuleVariable", kSideEffectModuleVariable},
- {"SideEffectPageVariable", kSideEffectPageVariable},
- {"SideEffectRandomPageVariable", kSideEffectRandomPageVariable},
- {"SupportingActor", kSupportingActor},
- {"WalkAction", kWalkAction},
- {"WalkLocation", kWalkLocation}
+ {"ActionHide", kActionHide},
+ {"ActionLoop", kActionLoop},
+ {"ActionPlay", kActionPlay},
+ {"ActionPlayWithSfx", kActionPlayWithSfx},
+ {"ActionSfx", kActionSfx},
+ {"ActionSound", kActionSound},
+ {"ActionStill", kActionStill},
+ {"ActionTalk", kActionTalk},
+ {"ActionText", kActionText},
+ {"Actor", kActor},
+ {"AudioInfoPDAButton", kAudioInfoPDAButton},
+ {"ConditionGameVariable", kConditionGameVariable},
+ {"ConditionInventoryItemOwner", kConditionInventoryItemOwner},
+ {"ConditionModuleVariable", kConditionModuleVariable},
+ {"ConditionNotInventoryItemOwner", kConditionNotInventoryItemOwner},
+ {"ConditionNotModuleVariable", kConditionNotModuleVariable},
+ {"ConditionNotPageVariable", kConditionNotPageVariable},
+ {"ConditionPageVariable", kConditionPageVariable},
+ {"CursorActor", kCursorActor},
+ {"GamePage", kGamePage},
+ {"HandlerLeftClick", kHandlerLeftClick},
+ {"HandlerStartPage", kHandlerStartPage},
+ {"HandlerTimer", kHandlerTimer},
+ {"HandlerTimerActions", kHandlerTimerActions},
+ {"HandlerTimerSequences", kHandlerTimerSequences},
+ {"HandlerUseClick", kHandlerUseClick},
+ {"InventoryActor", kInventoryActor},
+ {"InventoryItem", kInventoryItem},
+ {"LeadActor", kLeadActor},
+ {"ModuleProxy", kModuleProxy},
+ {"PDAButtonActor", kPDAButtonActor},
+ {"ParlSqPink", kParlSqPink},
+ {"PubPink", kPubPink},
+ {"SeqTimer", kSeqTimer},
+ {"Sequence", kSequence},
+ {"SequenceAudio", kSequenceAudio},
+ {"SequenceItem", kSequenceItem},
+ {"SequenceItemDefaultAction", kSequenceItemDefaultAction},
+ {"SequenceItemLeader", kSequenceItemLeader},
+ {"SequenceItemLeaderAudio", kSequenceItemLeaderAudio},
+ {"SideEffectExit", kSideEffectExit},
+ {"SideEffectGameVariable", kSideEffectGameVariable},
+ {"SideEffectInventoryItemOwner", kSideEffectInventoryItemOwner},
+ {"SideEffectLocation", kSideEffectLocation},
+ {"SideEffectModuleVariable", kSideEffectModuleVariable},
+ {"SideEffectPageVariable", kSideEffectPageVariable},
+ {"SideEffectRandomPageVariable", kSideEffectRandomPageVariable},
+ {"SupportingActor", kSupportingActor},
+ {"WalkAction", kWalkAction},
+ {"WalkLocation", kWalkLocation}
};
static Object *createObject(int objectId) {
@@ -266,12 +266,10 @@ Object *Archive::parseObject(bool &isCopyReturned) {
isCopyReturned = false;
} else if ((obTag & 0x8000) == 0) {
-
res = _objectMap[obTag];
isCopyReturned = true;
} else {
-
obTag &= ~0x8000;
objectId = _objectIdMap[obTag];
@@ -287,11 +285,11 @@ Object *Archive::parseObject(bool &isCopyReturned) {
}
static int runtimeClassCmp(const void *key, const void *elem) {
- return strcmp((const char *) key, *(const char **) elem);
+ return strcmp((const char *)key, *(const char **)elem);
}
uint Archive::findObjectId(const char *name) {
- RuntimeClass *found = (RuntimeClass *)bsearch(name, classMap, sizeof(classMap) / sizeof(RuntimeClass) , sizeof(RuntimeClass), runtimeClassCmp);
+ RuntimeClass *found = (RuntimeClass *)bsearch(name, classMap, sizeof(classMap) / sizeof(RuntimeClass), sizeof(RuntimeClass), runtimeClassCmp);
if (!found)
error("Class %s is not in class Map", name);
diff --git a/engines/pink/detection.cpp b/engines/pink/detection.cpp
index 28af997..3e3e177 100644
--- a/engines/pink/detection.cpp
+++ b/engines/pink/detection.cpp
@@ -25,9 +25,9 @@
#include "pink/pink.h"
static const PlainGameDescriptor pinkGames[] = {
- {"peril", "The Pink Panther: Passport to Peril"},
- {"pokus", "The Pink Panther: Hokus Pokus Pink"},
- {0, 0}
+ {"peril", "The Pink Panther: Passport to Peril"},
+ {"pokus", "The Pink Panther: Hokus Pokus Pink"},
+ {0, 0}
};
#include "detection_tables.h"
@@ -64,14 +64,14 @@ public:
bool PinkMetaEngine::hasFeature(MetaEngineFeature f) const {
return
- (f == kSupportsListSaves) ||
- (f == kSupportsDeleteSave) ||
- (f == kSavesSupportMetaInfo) ||
- (f == kSavesSupportThumbnail) ||
- (f == kSavesSupportCreationDate) ||
- (f == kSavesSupportPlayTime) ||
- (f == kSupportsLoadingDuringStartup) ||
- (f == kSimpleSavesNames);
+ (f == kSupportsListSaves) ||
+ (f == kSupportsDeleteSave) ||
+ (f == kSavesSupportMetaInfo) ||
+ (f == kSavesSupportThumbnail) ||
+ (f == kSavesSupportCreationDate) ||
+ (f == kSavesSupportPlayTime) ||
+ (f == kSupportsLoadingDuringStartup) ||
+ (f == kSimpleSavesNames);
}
SaveStateList PinkMetaEngine::listSaves(const char *target) const {
diff --git a/engines/pink/objects/actions/walk_action.cpp b/engines/pink/objects/actions/walk_action.cpp
index cc02ef6..167cdec 100644
--- a/engines/pink/objects/actions/walk_action.cpp
+++ b/engines/pink/objects/actions/walk_action.cpp
@@ -49,7 +49,7 @@ void WalkAction::onStart() {
_frameCount = _decoder.getFrameCount();
}
else {
- _frameCount = (uint) abs(3 * (_start.x - _end.x) / (int)_z);
+ _frameCount = (uint)abs(3 * (_start.x - _end.x) / (int)_z);
if (!_frameCount)
_frameCount = 1;
}
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 8c8f968..ce0ceb1 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -483,16 +483,16 @@ bool PubPink::sendUseClickMessage(Actor *actor) {
const char *roundName;
switch (_round++ % 3) {
- case 0:
+ case 0:
roundName = kFirstRound;
break;
- case 1:
+ case 1:
roundName = kSecondRound;
break;
- case 2:
+ case 2:
roundName = kThirdRound;
break;
- default:
+ default:
roundName = nullptr;
assert(0);
}
@@ -500,7 +500,7 @@ bool PubPink::sendUseClickMessage(Actor *actor) {
}
if (playingMiniGame())
- _isHaveItem = true;
+ _isHaveItem = true;
return true;
}
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index d7cafb0..4275578 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -86,7 +86,7 @@ public:
bool isInteractingWith(Actor *actor);
- void setNextExecutors (const Common::String &nextModule, const Common::String &nextPage);
+ void setNextExecutors(const Common::String &nextModule, const Common::String &nextPage);
State getState() const { return _state; }
Commit: 55f011ec899bdc288c883d61ad30671fdfe0bda9
https://github.com/scummvm/scummvm/commit/55f011ec899bdc288c883d61ad30671fdfe0bda9
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added a bit more explanatory commentary
Changed paths:
engines/pink/archive.cpp
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp
index a223c99..c2f88f9 100644
--- a/engines/pink/archive.cpp
+++ b/engines/pink/archive.cpp
@@ -261,7 +261,7 @@ Object *Archive::parseObject(bool &isCopyReturned) {
_objectMap.push_back(res);
_objectIdMap.push_back(objectId);
- _objectMap.push_back(res); // Basically a hack, but behavior is all correct
+ _objectMap.push_back(res); // Basically a hack, but behavior is all correct. MFC uses one array for pointers and ids
_objectIdMap.push_back(objectId);
isCopyReturned = false;
Commit: 40488c8b22ca5ab5b44881045d20ba271afa78a7
https://github.com/scummvm/scummvm/commit/40488c8b22ca5ab5b44881045d20ba271afa78a7
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: JANITORIAL: more formatting fixes
Changed paths:
engines/pink/objects/walk/walk_mgr.cpp
engines/pink/pink.cpp
diff --git a/engines/pink/objects/walk/walk_mgr.cpp b/engines/pink/objects/walk/walk_mgr.cpp
index a319f4c..3343af0 100644
--- a/engines/pink/objects/walk/walk_mgr.cpp
+++ b/engines/pink/objects/walk/walk_mgr.cpp
@@ -97,7 +97,7 @@ WalkAction *WalkMgr::getWalkAction() {
} else
walkActionName = Common::String::format("%dTo%d", _current.coords.z, _next.coords.z);
- WalkAction *action = (WalkAction *) _leadActor->findAction(walkActionName);
+ WalkAction *action = (WalkAction *)_leadActor->findAction(walkActionName);
if (action) {
action->setWalkMgr(this);
action->setType(horizontal);
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index dd7b1cf..6b10285 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -270,9 +270,9 @@ bool PinkEngine::canSaveGameStateCurrently() {
bool PinkEngine::hasFeature(Engine::EngineFeature f) const {
return
- f == kSupportsRTL ||
- f == kSupportsLoadingDuringRuntime ||
- f == kSupportsSavingDuringRuntime;
+ f == kSupportsRTL ||
+ f == kSupportsLoadingDuringRuntime ||
+ f == kSupportsSavingDuringRuntime;
}
void PinkEngine::pauseEngineIntern(bool pause) {
Commit: e25a9cabb40ad877940c866ebfff4ec3983ca352
https://github.com/scummvm/scummvm/commit/e25a9cabb40ad877940c866ebfff4ec3983ca352
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: rework getting length between locations
Changed paths:
engines/pink/objects/walk/walk_mgr.cpp
diff --git a/engines/pink/objects/walk/walk_mgr.cpp b/engines/pink/objects/walk/walk_mgr.cpp
index 3343af0..6bda000 100644
--- a/engines/pink/objects/walk/walk_mgr.cpp
+++ b/engines/pink/objects/walk/walk_mgr.cpp
@@ -108,8 +108,7 @@ WalkAction *WalkMgr::getWalkAction() {
double WalkMgr::getLengthBetweenLocations(WalkLocation *first, WalkLocation *second) {
Coordinates firstCoord = getLocationCoordinates(first->getName());
Coordinates secondCoord = getLocationCoordinates(second->getName());
- return (double)sqrt((double)(secondCoord.point.x - firstCoord.point.x) * (secondCoord.point.x - firstCoord.point.x) +
- (secondCoord.point.y - firstCoord.point.y) * (secondCoord.point.y - firstCoord.point.y));
+ return hypot(secondCoord.point.x - firstCoord.point.x, secondCoord.point.y - firstCoord.point.y);
}
Coordinates WalkMgr::getLocationCoordinates(const Common::String &locationName) {
Commit: 9c80037c8aaa13e3c2d8e3fe157efb836d6aa53c
https://github.com/scummvm/scummvm/commit/9c80037c8aaa13e3c2d8e3fe157efb836d6aa53c
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: rework writing save header
Changed paths:
engines/pink/saveload.cpp
diff --git a/engines/pink/saveload.cpp b/engines/pink/saveload.cpp
index 506eaca..c87ea3c 100644
--- a/engines/pink/saveload.cpp
+++ b/engines/pink/saveload.cpp
@@ -53,7 +53,7 @@ Common::Error PinkEngine::saveGameState(int slot, const Common::String &desc) {
Archive archive(out);
- out->write("pink", 4);
+ out->writeUint32BE(MKTAG('p', 'i', 'n', 'k'));
archive.writeString(desc);
TimeDate curTime;
Commit: 969f7c99a0d06f7fefed99b4a1d2beaaf6e214d8
https://github.com/scummvm/scummvm/commit/969f7c99a0d06f7fefed99b4a1d2beaaf6e214d8
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2018-06-28T23:51:32+02:00
Commit Message:
PINK: added loading/saving of AudioInfoMgr
Changed paths:
engines/pink/objects/actors/lead_actor.cpp
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index ce0ceb1..a08d071 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -66,7 +66,7 @@ void LeadActor::loadState(Archive &archive) {
_sequencer->loadState(archive);
_walkMgr->loadState(archive);
_page->getGame()->getPdaMgr().loadState(archive);
- // load audioInfoMgr
+ _audioInfoMgr.loadState(archive);
}
void LeadActor::saveState(Archive &archive) {
@@ -82,6 +82,7 @@ void LeadActor::saveState(Archive &archive) {
_sequencer->saveState(archive);
_walkMgr->saveState(archive);
_page->getGame()->getPdaMgr().saveState(archive);
+ _audioInfoMgr.saveState(archive);
}
void LeadActor::init(bool unk) {
More information about the Scummvm-git-logs
mailing list