PINK: added more debug output, removed unneeded

This commit is contained in:
Andrei Prykhodko 2018-07-21 19:40:12 +03:00
parent cb3945cf4f
commit cd87d76932
14 changed files with 42 additions and 24 deletions

View File

@ -32,12 +32,12 @@ void ActionHide::toConsole() {
}
void ActionHide::start() {
debugC(6, kPinkDebugGeneral, "Actor %s has now ActionHide %s", _actor->getName().c_str(), _name.c_str());
debugC(6, kPinkDebugActions, "Actor %s has now ActionHide %s", _actor->getName().c_str(), _name.c_str());
_actor->endAction();
}
void ActionHide::end() {
debugC(6, kPinkDebugGeneral, "ActionHide %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
debugC(6, kPinkDebugActions, "ActionHide %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
}
} //End of namespace Pink

View File

@ -116,4 +116,9 @@ void ActionLoop::onStart() {
_forward = true;
}
void ActionLoop::end() {
ActionCEL::end();
debugC(6, kPinkDebugActions, "ActionLoop %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
}
} // End of namespace Pink

View File

@ -35,6 +35,8 @@ public:
void update() override;
void end() override;
protected:
void onStart() override;
virtual bool isTalk() { return false; }

View File

@ -42,7 +42,7 @@ void ActionPlay::toConsole() {
void ActionPlay::end() {
ActionCEL::end();
debugC(6, kPinkDebugGeneral, "ActionPlay %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
debugC(6, kPinkDebugActions, "ActionPlay %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
}
void ActionPlay::update() {
@ -60,7 +60,7 @@ void ActionPlay::pause(bool paused) {
}
void ActionPlay::onStart() {
debugC(6, kPinkDebugGeneral, "Actor %s has now ActionPlay %s", _actor->getName().c_str(), _name.c_str());
debugC(6, kPinkDebugActions, "Actor %s has now ActionPlay %s", _actor->getName().c_str(), _name.c_str());
int frameCount = _decoder.getFrameCount();
if (_stopFrame == -1 || _stopFrame >= frameCount)
_stopFrame = frameCount - 1;

View File

@ -71,6 +71,11 @@ void ActionPlayWithSfx::onStart() {
_actor->endAction();
}
void ActionPlayWithSfx::end() {
ActionCEL::end();
debugC(6, kPinkDebugActions, "ActionPlayWithSfx %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
}
void ActionSfx::deserialize(Pink::Archive &archive) {
_frame = archive.readDWORD();
_volume = archive.readDWORD();
@ -86,6 +91,7 @@ void ActionSfx::toConsole() {
void ActionSfx::play() {
Page *page = _sprite->getActor()->getPage();
if (!_sound.isPlaying()) {
debugC(kPinkDebugActions, "ActionSfx %s of %s is now playing", _sfxName.c_str(), _sprite->getName().c_str());
int8 balance = (_sprite->getDecoder()->getCenter().x * 396875 / 1000000) - 127;
_sound.play(page->getResourceStream(_sfxName), Audio::Mixer::kSFXSoundType, _volume, balance);
}

View File

@ -42,6 +42,8 @@ public:
void update() override;
void end() override;
protected:
void onStart() override;

View File

@ -62,7 +62,7 @@ void ActionSound::start() {
_sound.play(page->getResourceStream(_fileName), soundType, _volume, 0, _isLoop);
debugC(6, kPinkDebugGeneral, "Actor %s has now ActionSound %s", _actor->getName().c_str(), _name.c_str());
debugC(6, kPinkDebugActions, "Actor %s has now ActionSound %s", _actor->getName().c_str(), _name.c_str());
}
void ActionSound::end() {
@ -72,7 +72,7 @@ void ActionSound::end() {
director->removeSound(this);
}
debugC(6, kPinkDebugGeneral, "ActionSound %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
debugC(6, kPinkDebugActions, "ActionSound %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
}
void ActionSound::update() {

View File

@ -42,13 +42,13 @@ void ActionStill::toConsole() {
void ActionStill::end() {
ActionCEL::end();
debugC(6, kPinkDebugGeneral, "ActionStill %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
debugC(6, kPinkDebugActions, "ActionStill %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
}
void ActionStill::pause(bool paused) {}
void ActionStill::onStart() {
debugC(6, kPinkDebugGeneral, "Actor %s has now ActionStill %s", _actor->getName().c_str(), _name.c_str());
debugC(6, kPinkDebugActions, "Actor %s has now ActionStill %s", _actor->getName().c_str(), _name.c_str());
if (_startFrame >= _decoder.getFrameCount())
_startFrame = 0;

View File

@ -61,7 +61,7 @@ void Sequence::start(bool loadingSave) {
uint nextItemIndex = _context->getNextItemIndex();
if (nextItemIndex >= _items.size() ||
!_items[nextItemIndex]->execute(_context->getSegment(), this, loadingSave)) {
debugC(6, kPinkDebugGeneral, "Sequence %s ended", _name.c_str());
debugC(6, kPinkDebugScripts, "Sequence %s ended", _name.c_str());
end();
return;
}
@ -79,7 +79,7 @@ void Sequence::start(bool loadingSave) {
void Sequence::update() {
if (!_context->getActor()->isPlaying()) {
debugC(6, kPinkDebugGeneral, "Sequence step ended");
debugC(6, kPinkDebugScripts, "SubSequence of %s Sequence ended", _name.c_str());
start(0);
}
}

View File

@ -47,7 +47,7 @@ SequenceContext::SequenceContext(Sequence *sequence)
{
sequence->setContext(this);
Common::Array<SequenceItem *> &items = sequence->getItems();
debugC(6, kPinkDebugGeneral, "SequenceContext for %s", _sequence->getName().c_str());
debug(kPinkDebugScripts, "SequenceContext for %s", _sequence->getName().c_str());
for (uint i = 0; i < items.size(); ++i) {
bool found = 0;
@ -58,7 +58,7 @@ SequenceContext::SequenceContext(Sequence *sequence)
}
}
if (!found) {
debug("%s", items[i]->getActor().c_str());
debug(kPinkDebugScripts, "%s", items[i]->getActor().c_str());
_states.push_back(SequenceActorState(items[i]->getActor()));
}
}

View File

@ -68,31 +68,32 @@ void Sequencer::authorSequence(Sequence *sequence, bool loadingSave) {
if (sequence) {
SequenceContext *context = new SequenceContext(sequence);
SequenceContext *confilct;
while((confilct = findConfilictingContextWith(context)) != nullptr)
confilct->getSequence()->forceEnd();
_context = context;
sequence->init(loadingSave);
debugC(5, kPinkDebugScripts, "Main Sequence %s started", sequence->getName().c_str());
}
}
void Sequencer::authorParallelSequence(Sequence *seqeunce, bool loadingSave) {
if (_context && _context->getSequence() == seqeunce)
void Sequencer::authorParallelSequence(Sequence *sequence, bool loadingSave) {
if (_context && _context->getSequence() == sequence)
return;
for (uint i = 0; i < _parrallelContexts.size(); ++i) {
if (_parrallelContexts[i]->getSequence() == seqeunce)
if (_parrallelContexts[i]->getSequence() == sequence)
return;
}
const Common::String leadName = _page->getLeadActor()->getName();
SequenceContext *context = new SequenceContext(seqeunce);
SequenceContext *context = new SequenceContext(sequence);
if (!context->findState(leadName) && !findConfilictingContextWith(context)) {
_parrallelContexts.push_back(context);
seqeunce->init(loadingSave);
sequence->init(loadingSave);
debugC(6, kPinkDebugScripts, "Parallel Sequence %s started", sequence->getName().c_str());
} else
delete context;
}

View File

@ -42,13 +42,12 @@ PinkEngine::PinkEngine(OSystem *system, const ADGameDescription *desc)
: Engine(system), _console(nullptr), _rnd("pink"),
_desc(*desc), _bro(nullptr), _actor(nullptr),
_module(nullptr), _director(nullptr), _pdaMgr(this) {
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(kPinkDebugLoadingObjects, "loading_objects", "Serializing objects from Orb");
DebugMan.addDebugChannel(kPinkDebugScripts, "scripts", "Sequences");
DebugMan.addDebugChannel(kPinkDebugActions, "actions", "Actions");
const Common::FSNode gameDataDir(ConfMan.get("path"));
SearchMan.addSubDirectoryMatching(gameDataDir, "install");

View File

@ -73,8 +73,8 @@ enum {
kPinkDebugGeneral = 1 << 0,
kPinkDebugLoadingResources = 1 << 1,
kPinkDebugLoadingObjects = 1 << 2,
kPinkDebugGraphics = 1 << 3,
kPinkDebugSound = 1 << 4
kPinkDebugScripts = 1 << 3,
kPinkDebugActions = 1 << 4
};
class PinkEngine : public Engine {

View File

@ -46,6 +46,8 @@ void ResourceMgr::init(PinkEngine *game, Page *page) {
_resCount = objDesc->resourcesCount;
orb->loadObject(page, objDesc);
_resDescTable = orb->createResDescTable(objDesc);
debugC(kPinkDebugLoadingResources, "%d Resource descriptions are loaded", _resCount);
}
void ResourceMgr::clear() {
@ -77,6 +79,7 @@ Common::SafeSeekableSubReadStream *ResourceMgr::getResourceStream(const Common::
stream->seek(desc->offset);
debugC(kPinkDebugLoadingResources, "Got stream of %s resource", name.c_str());
return new Common::SafeSeekableSubReadStream(stream, desc->offset,
desc->offset + desc->size);
}