From 59f7e1deeaa15c87adbe073105ea512d1972cde0 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Sat, 24 Sep 2011 14:10:54 -0400 Subject: PEGASUS: Import AI code and relevant items --- engines/pegasus/ai/ai_condition.h | 287 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 287 insertions(+) create mode 100755 engines/pegasus/ai/ai_condition.h (limited to 'engines/pegasus/ai/ai_condition.h') diff --git a/engines/pegasus/ai/ai_condition.h b/engines/pegasus/ai/ai_condition.h new file mode 100755 index 0000000000..559ec55c80 --- /dev/null +++ b/engines/pegasus/ai/ai_condition.h @@ -0,0 +1,287 @@ +/* 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. + * + * Additional copyright for this file: + * Copyright (C) 1995-1997 Presto Studios, Inc. + * + * 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 PEGASUS_AI_AICONDITION_H +#define PEGASUS_AI_AICONDITION_H + +#include "pegasus/timers.h" + +namespace Common { + class ReadStream; + class WriteStream; +} + +namespace Pegasus { + +///////////////////////////////////////////// +// +// AICondition + +class AICondition { +public: + AICondition() {} + virtual ~AICondition() {} + + virtual bool fireCondition() = 0; + + // Only need these for conditions that are dynamic, like timer conditions... + // other conditions, like item related conditions, which don't change during + // the run of an environment, are completely initted when the environment + // is created. + virtual void writeAICondition(Common::WriteStream *) {} + virtual void readAICondition(Common::ReadStream *) {} +}; + +///////////////////////////////////////////// +// +// AIOneChildCondition + +class AIOneChildCondition : public AICondition { +public: + AIOneChildCondition(AICondition *); + virtual ~AIOneChildCondition(); + + virtual void writeAICondition(Common::WriteStream *); + virtual void readAICondition(Common::ReadStream *); + +protected: + AICondition *_child; +}; + +///////////////////////////////////////////// +// +// AITwoChildrenCondition + +class AITwoChildrenCondition : public AICondition { +public: + AITwoChildrenCondition(AICondition *, AICondition *); + virtual ~AITwoChildrenCondition(); + + virtual void writeAICondition(Common::WriteStream *); + virtual void readAICondition(Common::ReadStream *); + +protected: + AICondition *_leftChild, *_rightChild; +}; + +///////////////////////////////////////////// +// +// AINotCondition + +class AINotCondition : public AIOneChildCondition { +public: + AINotCondition(AICondition *); + + virtual bool fireCondition(); +}; + +///////////////////////////////////////////// +// +// AIAndCondition + +class AIAndCondition : public AITwoChildrenCondition { +public: + AIAndCondition(AICondition *, AICondition *); + + virtual bool fireCondition(); +}; + +///////////////////////////////////////////// +// +// AIOrCondition + +class AIOrCondition : public AITwoChildrenCondition { +public: + AIOrCondition(AICondition *, AICondition *); + + virtual bool fireCondition(); +}; + +///////////////////////////////////////////// +// +// AITimerCondition + +class AITimerCondition : public AICondition { +public: + AITimerCondition(const TimeValue, const TimeScale, const bool); + + void startTimer(); + void stopTimer(); + + virtual bool fireCondition(); + + virtual void writeAICondition(Common::WriteStream *); + virtual void readAICondition(Common::ReadStream *); + +protected: + static void AITimerFunction(FunctionPtr *, AITimerCondition *); + + FuseFunction _timerFuse; + bool _fired; +}; + +///////////////////////////////////////////// +// +// AILocationCondition + +class AILocationCondition : public AICondition { +public: + AILocationCondition(uint32); + virtual ~AILocationCondition(); + + void addLocation(tRoomViewID); + virtual bool fireCondition(); + + virtual void writeAICondition(Common::WriteStream *); + virtual void readAICondition(Common::ReadStream *); + +protected: + uint32 _numLocations, _maxLocations; + tRoomViewID *_locations; +}; + +///////////////////////////////////////////// +// +// AIDoorOpenedCondition + +class AIDoorOpenedCondition : public AICondition { +public: + AIDoorOpenedCondition(tRoomViewID); + virtual ~AIDoorOpenedCondition() {} + + virtual bool fireCondition(); + +protected: + tRoomViewID _doorLocation; +}; + +///////////////////////////////////////////// +// +// AIHasItemCondition + +class AIHasItemCondition : public AICondition { +public: + AIHasItemCondition(const tItemID); + + virtual bool fireCondition(); + +protected: + tItemID _item; +}; + +///////////////////////////////////////////// +// +// AIDoesntHaveItemCondition + +class AIDoesntHaveItemCondition : public AICondition { +public: + AIDoesntHaveItemCondition(const tItemID); + + virtual bool fireCondition(); + +protected: + tItemID _item; +}; + +///////////////////////////////////////////// +// +// AICurrentItemCondition + +class AICurrentItemCondition : public AICondition { +public: + AICurrentItemCondition(const tItemID); + + virtual bool fireCondition(); + +protected: + tItemID _item; +}; + +///////////////////////////////////////////// +// +// AICurrentBiochipCondition + +class AICurrentBiochipCondition : public AICondition { +public: + AICurrentBiochipCondition(const tItemID); + + virtual bool fireCondition(); + +protected: + tItemID _biochip; +}; + +///////////////////////////////////////////// +// +// AIItemStateCondition + +class AIItemStateCondition : public AICondition { +public: + AIItemStateCondition(const tItemID, const tItemState); + + virtual bool fireCondition(); + +protected: + tItemID _item; + tItemState _state; +}; + +///////////////////////////////////////////// +// +// AIEnergyMonitorCondition + +class AIEnergyMonitorCondition : public AICondition { +public: + AIEnergyMonitorCondition(const int32); + + virtual bool fireCondition(); + +protected: + int32 _energyThreshold; +}; + +///////////////////////////////////////////// +// +// AILastExtraCondition + +class AILastExtraCondition : public AICondition { +public: + AILastExtraCondition(const tExtraID); + + virtual bool fireCondition(); + +protected: + tExtraID _lastExtra; +}; + +///////////////////////////////////////////// +// +// Helper functions + +AICondition *makeLocationAndDoesntHaveItemCondition(const tRoomID room, const tDirectionConstant direction, const tItemID item); + +} // End of namespace Pegasus + +#endif -- cgit v1.2.3 From 12efb47b536d2f663c9cde2739a1fd40599da669 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Fri, 16 Dec 2011 14:17:50 -0500 Subject: PEGASUS: Remove t prefix from typedefs Some other minor cleanup too --- engines/pegasus/ai/ai_condition.h | 40 +++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'engines/pegasus/ai/ai_condition.h') diff --git a/engines/pegasus/ai/ai_condition.h b/engines/pegasus/ai/ai_condition.h index 559ec55c80..ba4f41108c 100755 --- a/engines/pegasus/ai/ai_condition.h +++ b/engines/pegasus/ai/ai_condition.h @@ -151,15 +151,15 @@ public: AILocationCondition(uint32); virtual ~AILocationCondition(); - void addLocation(tRoomViewID); + void addLocation(RoomViewID); virtual bool fireCondition(); - virtual void writeAICondition(Common::WriteStream *); - virtual void readAICondition(Common::ReadStream *); + virtual void writeAICondition(Common::WriteStream *); + virtual void readAICondition(Common::ReadStream *); protected: uint32 _numLocations, _maxLocations; - tRoomViewID *_locations; + RoomViewID *_locations; }; ///////////////////////////////////////////// @@ -168,13 +168,13 @@ protected: class AIDoorOpenedCondition : public AICondition { public: - AIDoorOpenedCondition(tRoomViewID); + AIDoorOpenedCondition(RoomViewID); virtual ~AIDoorOpenedCondition() {} virtual bool fireCondition(); protected: - tRoomViewID _doorLocation; + RoomViewID _doorLocation; }; ///////////////////////////////////////////// @@ -183,12 +183,12 @@ protected: class AIHasItemCondition : public AICondition { public: - AIHasItemCondition(const tItemID); + AIHasItemCondition(const ItemID); virtual bool fireCondition(); protected: - tItemID _item; + ItemID _item; }; ///////////////////////////////////////////// @@ -197,12 +197,12 @@ protected: class AIDoesntHaveItemCondition : public AICondition { public: - AIDoesntHaveItemCondition(const tItemID); + AIDoesntHaveItemCondition(const ItemID); virtual bool fireCondition(); protected: - tItemID _item; + ItemID _item; }; ///////////////////////////////////////////// @@ -211,12 +211,12 @@ protected: class AICurrentItemCondition : public AICondition { public: - AICurrentItemCondition(const tItemID); + AICurrentItemCondition(const ItemID); virtual bool fireCondition(); protected: - tItemID _item; + ItemID _item; }; ///////////////////////////////////////////// @@ -225,12 +225,12 @@ protected: class AICurrentBiochipCondition : public AICondition { public: - AICurrentBiochipCondition(const tItemID); + AICurrentBiochipCondition(const ItemID); virtual bool fireCondition(); protected: - tItemID _biochip; + ItemID _biochip; }; ///////////////////////////////////////////// @@ -239,13 +239,13 @@ protected: class AIItemStateCondition : public AICondition { public: - AIItemStateCondition(const tItemID, const tItemState); + AIItemStateCondition(const ItemID, const ItemState); virtual bool fireCondition(); protected: - tItemID _item; - tItemState _state; + ItemID _item; + ItemState _state; }; ///////////////////////////////////////////// @@ -268,19 +268,19 @@ protected: class AILastExtraCondition : public AICondition { public: - AILastExtraCondition(const tExtraID); + AILastExtraCondition(const ExtraID); virtual bool fireCondition(); protected: - tExtraID _lastExtra; + ExtraID _lastExtra; }; ///////////////////////////////////////////// // // Helper functions -AICondition *makeLocationAndDoesntHaveItemCondition(const tRoomID room, const tDirectionConstant direction, const tItemID item); +AICondition *makeLocationAndDoesntHaveItemCondition(const RoomID room, const DirectionConstant direction, const ItemID item); } // End of namespace Pegasus -- cgit v1.2.3 From a600dcb56a9633ebfae0d726480352b6f2e9b3ba Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Tue, 20 Dec 2011 18:26:25 -0500 Subject: PEGASUS: Some space/misc cleanup --- engines/pegasus/ai/ai_condition.h | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'engines/pegasus/ai/ai_condition.h') diff --git a/engines/pegasus/ai/ai_condition.h b/engines/pegasus/ai/ai_condition.h index ba4f41108c..2d93a52eab 100755 --- a/engines/pegasus/ai/ai_condition.h +++ b/engines/pegasus/ai/ai_condition.h @@ -37,7 +37,7 @@ namespace Pegasus { ///////////////////////////////////////////// // -// AICondition +// AICondition class AICondition { public: @@ -56,7 +56,7 @@ public: ///////////////////////////////////////////// // -// AIOneChildCondition +// AIOneChildCondition class AIOneChildCondition : public AICondition { public: @@ -72,7 +72,7 @@ protected: ///////////////////////////////////////////// // -// AITwoChildrenCondition +// AITwoChildrenCondition class AITwoChildrenCondition : public AICondition { public: @@ -88,7 +88,7 @@ protected: ///////////////////////////////////////////// // -// AINotCondition +// AINotCondition class AINotCondition : public AIOneChildCondition { public: @@ -99,7 +99,7 @@ public: ///////////////////////////////////////////// // -// AIAndCondition +// AIAndCondition class AIAndCondition : public AITwoChildrenCondition { public: @@ -110,7 +110,7 @@ public: ///////////////////////////////////////////// // -// AIOrCondition +// AIOrCondition class AIOrCondition : public AITwoChildrenCondition { public: @@ -121,7 +121,7 @@ public: ///////////////////////////////////////////// // -// AITimerCondition +// AITimerCondition class AITimerCondition : public AICondition { public: @@ -144,7 +144,7 @@ protected: ///////////////////////////////////////////// // -// AILocationCondition +// AILocationCondition class AILocationCondition : public AICondition { public: @@ -164,7 +164,7 @@ protected: ///////////////////////////////////////////// // -// AIDoorOpenedCondition +// AIDoorOpenedCondition class AIDoorOpenedCondition : public AICondition { public: @@ -179,7 +179,7 @@ protected: ///////////////////////////////////////////// // -// AIHasItemCondition +// AIHasItemCondition class AIHasItemCondition : public AICondition { public: @@ -193,7 +193,7 @@ protected: ///////////////////////////////////////////// // -// AIDoesntHaveItemCondition +// AIDoesntHaveItemCondition class AIDoesntHaveItemCondition : public AICondition { public: @@ -207,7 +207,7 @@ protected: ///////////////////////////////////////////// // -// AICurrentItemCondition +// AICurrentItemCondition class AICurrentItemCondition : public AICondition { public: @@ -221,7 +221,7 @@ protected: ///////////////////////////////////////////// // -// AICurrentBiochipCondition +// AICurrentBiochipCondition class AICurrentBiochipCondition : public AICondition { public: @@ -235,7 +235,7 @@ protected: ///////////////////////////////////////////// // -// AIItemStateCondition +// AIItemStateCondition class AIItemStateCondition : public AICondition { public: @@ -250,7 +250,7 @@ protected: ///////////////////////////////////////////// // -// AIEnergyMonitorCondition +// AIEnergyMonitorCondition class AIEnergyMonitorCondition : public AICondition { public: @@ -264,7 +264,7 @@ protected: ///////////////////////////////////////////// // -// AILastExtraCondition +// AILastExtraCondition class AILastExtraCondition : public AICondition { public: @@ -278,7 +278,7 @@ protected: ///////////////////////////////////////////// // -// Helper functions +// Helper functions AICondition *makeLocationAndDoesntHaveItemCondition(const RoomID room, const DirectionConstant direction, const ItemID item); -- cgit v1.2.3 From 983bd16bb78b1a6aa8872f2086dbcbca6954f2fb Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Tue, 3 Apr 2012 15:23:08 -0400 Subject: PEGASUS: Fix file permissions --- engines/pegasus/ai/ai_condition.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 engines/pegasus/ai/ai_condition.h (limited to 'engines/pegasus/ai/ai_condition.h') diff --git a/engines/pegasus/ai/ai_condition.h b/engines/pegasus/ai/ai_condition.h old mode 100755 new mode 100644 -- cgit v1.2.3