Skip to content

Commit

Permalink
эффекты
Browse files Browse the repository at this point in the history
  • Loading branch information
spidamoo committed Nov 30, 2013
1 parent cdc3e61 commit c57d912
Show file tree
Hide file tree
Showing 181 changed files with 13,862 additions and 19,246 deletions.
397 changes: 286 additions & 111 deletions SoDlib/SoDLib.depend

Large diffs are not rendered by default.

35 changes: 34 additions & 1 deletion SoDlib/SoDlib.cbp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,14 @@
<Compiler>
<Add option="-Wall" />
<Add option="-O2" />
<Add directory="include" />
<Add directory=".." />
<Add directory="../hge181/include" />
</Compiler>
<Linker>
<Add option="-s" />
<Add library="..\hge181\lib\gcc\libhge.a" />
<Add library="..\Box2D\libBox2D.a" />
</Linker>
</Target>
</Build>
Expand All @@ -54,9 +59,12 @@
<Unit filename="include/CharacterActionCause.h" />
<Unit filename="include/CharacterActionEffect.h" />
<Unit filename="include/CharacterHotSpot.h" />
<Unit filename="include/Condition.h" />
<Unit filename="include/ConditionPrototype.h" />
<Unit filename="include/Construction.h" />
<Unit filename="include/DebugDraw.h" />
<Unit filename="include/Effect.h" />
<Unit filename="include/EffectAction.h" />
<Unit filename="include/EffectPrototype.h" />
<Unit filename="include/Exception.h" />
<Unit filename="include/GUIWindow.h" />
Expand All @@ -67,8 +75,21 @@
<Unit filename="include/Platform.h" />
<Unit filename="include/PlayerCharacter.h" />
<Unit filename="include/SoDlib.h" />
<Unit filename="include/exprtk.hpp" />
<Unit filename="include/hgeGUIMenuItem.h" />
<Unit filename="include/muParser.h" />
<Unit filename="include/muParserBase.h" />
<Unit filename="include/muParserBytecode.h" />
<Unit filename="include/muParserCallback.h" />
<Unit filename="include/muParserDLL.h" />
<Unit filename="include/muParserDef.h" />
<Unit filename="include/muParserError.h" />
<Unit filename="include/muParserFixes.h" />
<Unit filename="include/muParserInt.h" />
<Unit filename="include/muParserStack.h" />
<Unit filename="include/muParserTemplateMagic.h" />
<Unit filename="include/muParserTest.h" />
<Unit filename="include/muParserToken.h" />
<Unit filename="include/muParserTokenReader.h" />
<Unit filename="include/tinystr.h" />
<Unit filename="include/tinyxml.h" />
<Unit filename="src/Animation.cpp" />
Expand All @@ -77,9 +98,12 @@
<Unit filename="src/CharacterActionCause.cpp" />
<Unit filename="src/CharacterActionEffect.cpp" />
<Unit filename="src/CharacterHotSpot.cpp" />
<Unit filename="src/Condition.cpp" />
<Unit filename="src/ConditionPrototype.cpp" />
<Unit filename="src/Construction.cpp" />
<Unit filename="src/DebugDraw.cpp" />
<Unit filename="src/Effect.cpp" />
<Unit filename="src/EffectAction.cpp" />
<Unit filename="src/EffectPrototype.cpp" />
<Unit filename="src/Exception.cpp" />
<Unit filename="src/GUIWindow.cpp" />
Expand All @@ -90,6 +114,15 @@
<Unit filename="src/Platform.cpp" />
<Unit filename="src/PlayerCharacter.cpp" />
<Unit filename="src/hgeGUIMenuItem.cpp" />
<Unit filename="src/muParser.cpp" />
<Unit filename="src/muParserBase.cpp" />
<Unit filename="src/muParserBytecode.cpp" />
<Unit filename="src/muParserCallback.cpp" />
<Unit filename="src/muParserDLL.cpp" />
<Unit filename="src/muParserError.cpp" />
<Unit filename="src/muParserInt.cpp" />
<Unit filename="src/muParserTest.cpp" />
<Unit filename="src/muParserTokenReader.cpp" />
<Unit filename="tinystr.cpp" />
<Unit filename="tinyxml.cpp" />
<Unit filename="tinyxmlerror.cpp" />
Expand Down
26 changes: 20 additions & 6 deletions SoDlib/include/Character.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,31 @@ class Character
void turn();
void run(float speed);
void jump(b2Vec2 speed);
void move(float dx, float dy);
void move(float dx, float dy);

void doDamage(int amount);

void setAnim(int anim);

float animatedValue(float prev, float next), midanglePosition(float prev, float next), midangleAngle(float prev, float next);

b2Vec2 getPosition();
void setPosition(b2Vec2 newPos);
float getX();
float getY();
float getHalfHeight();
float getHalfWidth();
int getOnGround();
int getOnGround();

float getHotSpotX(int index), getHotSpotY(int index);

float getAnimTime();

void addCondition(Condition* condition);
void removeCondition(int index);

int getDamage();
protected:
float animatedValue(float prev, float next), midanglePosition(float prev, float next), midangleAngle(float prev, float next);

protected:
Game* game;

b2Vec2 position, prevPosition, speed;
Expand Down Expand Up @@ -82,7 +92,11 @@ class Character
int hotSpotsCount;

bool turnedRight;
int onGround;
int onGround;

int currentHitPoints, maxHitPoints;

Condition** conditions; int conditionsCount;
};
#define CHARACTER_H_COMPLETE
#endif // CHARACTER_H
9 changes: 6 additions & 3 deletions SoDlib/include/CharacterActionCause.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@ const int ACTIONCAUSE_TYPE_NPC_TARGETSIDE = 101;
const int ACTIONCAUSE_TYPE_NPC_TARGETFARTHER = 102;
const int ACTIONCAUSE_TYPE_NPC_TARGETCLOSER = 103;

const int ACTIONCAUSE_TYPE_ONGROUND = 201;
const int ACTIONCAUSE_TYPE_ONGROUND = 201;

const int ACTIONCAUSE_TYPE_ANIM_TIME_PASSED = 301;
const int ACTIONCAUSE_TYPE_ANIM_TIME_IS = 302;


class CharacterActionCause
{
public:
CharacterActionCause(int type, int param);
CharacterActionCause(int type, float param);
CharacterActionCause(TiXmlElement* elem);
virtual ~CharacterActionCause();

Expand All @@ -27,7 +30,7 @@ class CharacterActionCause
bool test(Game* game, Character* character);
protected:
int type;
int param;
float param;
private:
};

Expand Down
3 changes: 2 additions & 1 deletion SoDlib/include/CharacterActionEffect.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
const int ACTIONEFFECT_TYPE_TURN = 1;
const int ACTIONEFFECT_TYPE_CHANGEANIM = 2;
const int ACTIONEFFECT_TYPE_RUN = 3;
const int ACTIONEFFECT_TYPE_JUMP = 4;
const int ACTIONEFFECT_TYPE_JUMP = 4;
const int ACTIONEFFECT_TYPE_SPAWN_EFFECT = 5;

class CharacterActionEffect
{
Expand Down
22 changes: 22 additions & 0 deletions SoDlib/include/Condition
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "Condition.h"

Condition::Condition(ConditionPrototype* prototype, Character* inflictor)
{
this->prototype = prototype;
this->inflictor = inflictor;

totalTime = 0.0f;
tickTime = 0.0f;
}

Condition::~Condition()
{
//dtor
}

void Condition::initialize()
{
prototype->setParamsFromCharacter(inflictor);

totalTime = prototype->getDuration();
}
25 changes: 25 additions & 0 deletions SoDlib/include/Condition.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#ifndef CONDITION_H
#define CONDITION_H

#include <SoDlib.h>

class Condition
{
public:
Condition(ConditionPrototype* prototype, Character* inflictor, Character* bearer);
virtual ~Condition();

void initialize();

void update(float dt);

float getTime();
protected:
ConditionPrototype* prototype;
Character* inflictor; Character* bearer;

float totalTime, tickTime, interval;
private:
};

#endif // CONDITION_H
39 changes: 39 additions & 0 deletions SoDlib/include/ConditionPrototype.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#ifndef CONDITION_PROTOTYPE_H
#define CONDITION_PROTOTYPE_H

#include <SoDlib.h>

const int CONDITION_TYPE_DAMAGE = 1;
const int CONDITION_TYPE_STUN = 2;

const int CONDITION_PROTOTYPE_PARAM_DAMAGE = 0;

const int CONDITION_PROTOTYPE_PARAMS_COUNT = 1;

static const char* CONDITION_PROTOTYPE_PARAM_NAMES[CONDITION_PROTOTYPE_PARAMS_COUNT] = {
"damage"
};

class ConditionPrototype
{
public:
ConditionPrototype();
virtual ~ConditionPrototype();

void loadFromXml(TiXmlElement* xml);

void setParam(int index, float value);
void setParamsFromCharacter(Character* character);

int getType();
float getValue(), getDuration(), getInterval();

Condition* spawnCondition(Character* inflictor, Character* bearer);
protected:
int type;
float* params;
mu::Parser valueParser, durationParser, intervalParser;
private:
};

#endif // CONDITION_PROTOTYPE_H
33 changes: 24 additions & 9 deletions SoDlib/include/Effect.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,35 @@
class Effect
{
public:
Effect();
virtual ~Effect();
Effect(Game* game, EffectPrototype* prototype);
virtual ~Effect();

void setOwner(Character* character); Character* getOwner();
void initialize();

void update(float dt), draw();
void update(float dt), draw(bool schematicMode);

float getTime();
void setPosition(b2Vec2 position); b2Vec2 getPosition();

void setAnimation(hgeAnimation* animation, int blendMode);

bool characterCrosses(Character* character);
protected:
Game* game;
b2Vec2 position, prevPosition, speed;
Game* game; Character* owner;
float angle, speed;
b2Vec2 position, prevPosition, componentSpeed;
float time;
int r, g, b, a;
float scale;

EffectPrototype* prototype;

float* actionTimes;

exprtk::expression<float> speedExpr, angleExpr, rExpr, gExpr, bExpr, aExpr,
timeExpr, amountExpr, durationExpr;
hgeAnimation* animation;

EffectPrototype* prototype;
int** actionInteractions;
private:
};
#define EFFECT_H_COMPLETE
#endif // EFFECT_H
41 changes: 41 additions & 0 deletions SoDlib/include/EffectAction.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#ifndef EFFECTACTION_H
#define EFFECTACTION_H

#include <SoDlib.h>

const int EFFECTACTION_TYPE_SPAWN_EFFECT = 1;
const int EFFECTACTION_TYPE_DESTRUCT = 2;
const int EFFECTACTION_TYPE_INFLICT_CONDITION = 3;

const int EFFECTACTION_CONDITION_NONE = 0;
const int EFFECTACTION_CONDITION_CROSS_GROUND = 1;
const int EFFECTACTION_CONDITION_CROSS_ENEMY_BODY = 2;
const int EFFECTACTION_CONDITION_CROSS_FRIEND_BODY = 3;

const int EFFECTACTION_TARGET_FRIEND = 1;
const int EFFECTACTION_TARGET_ENEMY = 2;

class EffectAction
{
public:
EffectAction();
virtual ~EffectAction();

void loadFromXml(TiXmlElement* xml);
float getStartTime();
float getInterval();
int getCondition();
int getTargets();
int getType(); int getParam();
int getMaxInteractions();
protected:
int type; int param;
float interval;
int condition;
float startTime;
int targets;
int maxInteractions;
private:
};

#endif // EFFECTACTION_H
Loading

0 comments on commit c57d912

Please sign in to comment.