1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 08:23:53 +00:00

Merge remote-tracking branch 'gohan/Gohan'

This commit is contained in:
Marc Zinnschlag 2012-11-16 20:15:58 +01:00
commit 3dc013ceae
11 changed files with 320 additions and 1 deletions

View file

@ -63,7 +63,7 @@ add_openmw_dir (mwclass
add_openmw_dir (mwmechanics
mechanicsmanagerimp stat creaturestats magiceffects movement actors drawstate spells
activespells npcstats aipackage aisequence alchemy
activespells npcstats aipackage aisequence alchemy aiwander aitravel aifollow aiescort aiactivate
)
add_openmw_dir (mwbase

View file

@ -0,0 +1,21 @@
#include "aiactivate.hpp"
#include <iostream>
MWMechanics::AiActivate::AiActivate(const std::string &objectID):
mObjectID(objectID)
{
}
MWMechanics::AiActivate *MWMechanics::AiActivate::clone() const
{
return new AiActivate(*this);
}
bool MWMechanics::AiActivate::execute (const MWWorld::Ptr& actor)
{
std::cout << "AiActivate completed.\n";
return true;
}
int MWMechanics::AiActivate::getTypeId() const
{
return 4;
}

View file

@ -0,0 +1,23 @@
#ifndef GAME_MWMECHANICS_AIACTIVATE_H
#define GAME_MWMECHANICS_AIACTIVATE_H
#include "aipackage.hpp"
#include <string>
namespace MWMechanics
{
class AiActivate : AiPackage
{
public:
AiActivate(const std::string &objectID);
virtual AiActivate *clone() const;
virtual bool execute (const MWWorld::Ptr& actor);
///< \return Package completed?
virtual int getTypeId() const;
private:
std::string mObjectID;
};
}
#endif // GAME_MWMECHANICS_AIACTIVATE_H

View file

@ -0,0 +1,45 @@
#include "aiescort.hpp"
#include <iostream>
MWMechanics::AiEscort::AiEscort(const std::string &actorID,int duration, float x, float y, float z):
mActorID(actorID), mDuration(duration), mX(x), mY(y), mZ(z)
{
}
MWMechanics::AiEscort *MWMechanics::AiEscort::clone() const
{
return new AiEscort(*this);
}
bool MWMechanics::AiEscort::execute (const MWWorld::Ptr& actor)
{
std::cout << "AiEscort completed. \n";
return true;
}
int MWMechanics::AiEscort::getTypeId() const
{
return 2;
}
float MWMechanics::AiEscort::getX()
{
return mX;
}
float MWMechanics::AiEscort::getY()
{
return mY;
}
float MWMechanics::AiEscort::getZ()
{
return mZ;
}
std::string MWMechanics::AiEscort::getActorID()
{
return mActorID;
}
int MWMechanics::AiEscort::getDuration()
{
return mDuration;
}

View file

@ -0,0 +1,34 @@
#ifndef GAME_MWMECHANICS_AIESCORT_H
#define GAME_MWMECHANICS_AIESCORT_H
#include "aipackage.hpp"
#include <string>
namespace MWMechanics
{
class AiEscort : public AiPackage
{
public:
AiEscort(const std::string &actorID,int duration, float x, float y, float z);
virtual AiEscort *clone() const;
virtual bool execute (const MWWorld::Ptr& actor);
///< \return Package completed?
virtual int getTypeId() const;
float getX();
float getY();
float getZ();
std::string getActorID();
int getDuration();
private:
std::string mActorID;
float mX;
float mY;
float mZ;
int mDuration;
};
}
#endif

View file

@ -0,0 +1,22 @@
#include "aifollow.hpp"
#include <iostream>
MWMechanics::AiFollow::AiFollow(const std::string &actorID,float duration, float x, float y, float z):
mActorID(actorID), mDuration(duration), mX(x), mY(y), mZ(z)
{
}
MWMechanics::AiFollow *MWMechanics::AiFollow::clone() const
{
return new AiFollow(*this);
}
bool MWMechanics::AiFollow::execute (const MWWorld::Ptr& actor)
{
std::cout << "AiFollow completed.\n";
return true;
}
int MWMechanics::AiFollow::getTypeId() const
{
return 3;
}

View file

@ -0,0 +1,27 @@
#ifndef GAME_MWMECHANICS_AIFALLOW_H
#define GAME_MWMECHANICS_AIFALLOW_H
#include "aipackage.hpp"
#include <string>
namespace MWMechanics
{
class AiFollow : AiPackage
{
public:
AiFollow(const std::string &ActorID,float duration, float X, float Y, float Z);
virtual AiFollow *clone() const;
virtual bool execute (const MWWorld::Ptr& actor);
///< \return Package completed?
virtual int getTypeId() const;
private:
float mDuration;
float mX;
float mY;
float mZ;
std::string mActorID;
};
}
#endif

View file

@ -0,0 +1,39 @@
#include "aitravel.hpp"
#include <iostream>
MWMechanics::AiTravel::AiTravel(float x, float y, float z):
mX(x),mY(y),mZ(z)
{
}
MWMechanics::AiTravel * MWMechanics::AiTravel::clone() const
{
return new AiTravel(*this);
}
bool MWMechanics::AiTravel::execute (const MWWorld::Ptr& actor)
{
std::cout << "AiTravel completed.\n";
return true;
}
int MWMechanics::AiTravel::getTypeId() const
{
return 1;
}
float MWMechanics::AiTravel::getX()
{
return mX;
}
float MWMechanics::AiTravel::getY()
{
return mY;
}
float MWMechanics::AiTravel::getZ()
{
return mZ;
}

View file

@ -0,0 +1,31 @@
#ifndef GAME_MWMECHANICS_AITRAVEL_H
#define GAME_MWMECHANICS_AITRAVEL_H
#include "aipackage.hpp"
namespace MWMechanics
{
class AiTravel : public AiPackage
{
public:
AiTravel(float x, float y, float z);
virtual AiTravel *clone() const;
virtual bool execute (const MWWorld::Ptr& actor);
///< \return Package completed?
virtual int getTypeId() const;
float getX();
float getY();
float getZ();
private:
float mX;
float mY;
float mZ;
};
}
#endif

View file

@ -0,0 +1,43 @@
#include "aiwander.hpp"
#include <iostream>
MWMechanics::AiWander::AiWander(int distance, int duration, int timeOfDay,std::vector<int> idle):
mDistance(distance), mDuration(duration), mTimeOfDay(timeOfDay), mIdle(idle)
{
}
int MWMechanics::AiWander::getDistance() const
{
return mDistance;
}
int MWMechanics::AiWander::getDuration() const
{
return mDuration;
}
int MWMechanics::AiWander::getTimeOfDay() const
{
return mTimeOfDay;
}
MWMechanics::AiPackage * MWMechanics::AiWander::clone() const
{
return new AiWander(*this);
}
bool MWMechanics::AiWander::execute (const MWWorld::Ptr& actor)
{
std::cout << "AiWadner completed.\n";
return true;
}
int MWMechanics::AiWander::getTypeId() const
{
return 0;
}
int MWMechanics::AiWander::getIdle(int index) const
{
return mIdle.at(index);
}

View file

@ -0,0 +1,34 @@
#ifndef GAME_MWMECHANICS_AIWANDER_H
#define GAME_MWMECHANICS_AIWANDER_H
#include "aipackage.hpp"
#include <vector>
namespace MWMechanics
{
class AiWander : public AiPackage
{
public:
AiWander(int distance, int duration, int timeOfDay,std::vector<int> idle);
virtual AiPackage *clone() const;
virtual bool execute (const MWWorld::Ptr& actor);
///< \return Package completed?
virtual int getTypeId() const;
///< 0: Wander
int getDistance() const;
int getDuration()const;
int getTimeOfDay()const;
int getIdle(int index) const;
private:
int mDistance;
int mDuration;
int mTimeOfDay;
std::vector<int> mIdle;
};
}
#endif // AIWANDER_H