Code Search for Developers
 
 
  

EntityStates.h from palisma2d at Krugle


Show EntityStates.h syntax highlighted

/**
**************************************************************************************
*Palisma - Secrets of the Illuminati is an open-source 2D RPG                        *
*Copyright (C) 2006, Tony Sparks                                                     *
*                                                                                    *
*This library is free software; you can redistribute it and/or                       *
*modify it under the terms of the GNU Lesser General Public                          *
*License as published by the Free Software Foundation; either                        *
*version 2.1 of the License, or (at your option) any later version.                  *
*                                                                                    *
*This library 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                   *
*Lesser General Public License for more details.                                     *
*                                                                                    *
*You should have received a copy of the GNU Lesser General Public                    *
*License along with this library; if not, write to the Free Software                 *
*Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA      *
**************************************************************************************
*/
#pragma once

//#include "state.h"
#include "ientity.h"
//#include "dialogbox.h"


/**
==========================
Walking State
==========================
*/
class WalkState : public State
{
public:
    WalkState() {m_sound = NULL;};

    //void Enter(IEntity* p) { };
    void Exec(IEntity* p);
    void Exit(IEntity* p) { };

    std::string GetStateType() { return ENT_STATES[WALKING]; }

    virtual ~WalkState() {};
};

/**
=========================
Idle state
=========================
*/
class IdleState : public State
{
public:
    IdleState() {m_sound = NULL;};

    //void Enter(IEntity* p) { };
    void Exec(IEntity* p);// { };
    void Exit(IEntity* p) { };

    std::string GetStateType() { return ENT_STATES[IDLE]; }

    virtual ~IdleState() {};
};

/**
=========================
Attack state
=========================
*/
class AttackState : public State
{
public:
    AttackState() {m_sound = NULL;};

    //void Enter(IEntity* p) { };
    void Exec(IEntity* p);// { };
    void Exit(IEntity* p) { };

    std::string GetStateType() { return ENT_STATES[ATTACKING1]; }

    virtual ~AttackState() {};
};

/**
==========================
Hit State
==========================
*/
class HitState : public State
{
public:
    HitState() {m_sound = NULL;};

    //void Enter(IEntity* p) { };
    void Exec(IEntity* p);// { };
    void Exit(IEntity* p) { };

    std::string GetStateType() { return ENT_STATES[HIT]; }

    virtual ~HitState() {};
};

/**
==========================
Dead State
==========================
*/
class DeadState : public State
{
public:
    DeadState() {m_sound = NULL;};

    //void Enter(IEntity* p) { };
    void Exec(IEntity* p);
    void Exit(IEntity* p) { };

    std::string GetStateType() { return ENT_STATES[DEAD]; }

    virtual ~DeadState() {};
};

/**
==========================
Throwing State
==========================
*/
class ThrowingState : public State
{
public:
    ThrowingState() {m_sound = NULL;};

    //void Enter(IEntity* p) { };
    void Exec(IEntity* p);// { };
    void Exit(IEntity* p) {  };

    std::string GetStateType() { return ENT_STATES[THROWING]; }

    virtual ~ThrowingState() {};
};

/**
==========================
Thrown State
==========================
*/
class ThrownState : public State
{
public:
    ThrownState() {m_sound = NULL;};

    void Enter(IEntity* p);
    void Exec(IEntity* p);// { };
    void Exit(IEntity* p) { };

    std::string GetStateType() { return ENT_STATES[THROWN]; }

    virtual ~ThrownState() {};
};

/**
==========================
Talk State
==========================
*/
class TalkState : public State
{
public:
    TalkState() {m_sound = NULL;};

    void Enter(IEntity* p);
    void Exec(IEntity* p){};
    void Exit(IEntity* p) { };

    std::string GetStateType() { return ENT_STATES[TALKING]; }

    virtual ~TalkState() {};
};

/**
==========================
Carrying State
==========================
*/
class CarryingState : public State
{
public:
    CarryingState() {m_sound = NULL;};

    //void Enter(IEntity* p) { };
    void Exec(IEntity* p);// { };
    void Exit(IEntity* p) { };

    std::string GetStateType() { return ENT_STATES[CARRYING]; }

    virtual ~CarryingState() {};
};

/**
==========================
Carried State
==========================
*/
class CarriedState : public State
{
public:
    CarriedState() {m_sound = NULL;};

    //void Enter(IEntity* p) { };
    void Exec(IEntity* p);// { };
    void Exit(IEntity* p) {  p->SetBounds( (int)p->m_world.x, (int)p->m_world.y, p->m_attributes.GetInt("width"), p->m_attributes.GetInt("height") );};

    std::string GetStateType() { return ENT_STATES[CARRIED]; }

    virtual ~CarriedState() {};
};

/**
==========================
Carrying State
==========================
*/
class CarryingWalkingState : public State
{
public:
    CarryingWalkingState() {m_sound = NULL;};

    //void Enter(IEntity* p) { };
    void Exec(IEntity* p);// { };
    void Exit(IEntity* p) { };

    std::string GetStateType() { return ENT_STATES[CARRYING_WALKING]; }

    virtual ~CarryingWalkingState() {};
};


/*-----------------------------------------
    Weapon States 
------------------------------------------*/

class FiringState : public State
{
public:
    FiringState() {m_sound = NULL;};

    //void Enter(IEntity* p) { };
    void Exec(IEntity* p) { };
    void Exit(IEntity* p) { };

    std::string GetStateType() { return ENT_STATES[WP_FIRING]; }

    virtual ~FiringState() {};
};

class ReadyState : public State
{
public:
    ReadyState() {m_sound = NULL;};

    //void Enter(IEntity* p) { };
    void Exec(IEntity* p) { };
    void Exit(IEntity* p) { };

    std::string GetStateType() { return ENT_STATES[WP_READY]; }

    virtual ~ReadyState() {};
};

class ReloadingState : public State
{
public:
    ReloadingState() {m_sound = NULL;};

    //void Enter(IEntity* p) { };
    void Exec(IEntity* p) { };
    void Exit(IEntity* p) { };

    std::string GetStateType() { return ENT_STATES[WP_RELOADING]; }

    virtual ~ReloadingState() {};
};



See more files for this project here

palisma2d

The University of Wisconsin-Parkside Developers Union first product. More info to come. Code name Palisma.

Project homepage: http://code.google.com/p/palisma2d/
Programming language(s): C,C++
License: gpl2

  DialogModel.cpp
  DialogModel.h
  DialogState.cpp
  DialogState.h
  Enemy.cpp
  Enemy.h
  EntityController.cpp
  EntityController.h
  EntityEvents.cpp
  EntityEvents.h
  EntityFactory.cpp
  EntityFactory.h
  EntityManager.cpp
  EntityManager.h
  EntityStates.cpp
  EntityStates.h
  Event.h
  HUD.cpp
  HUD.h
  IEntity.cpp
  IEntity.h
  IWeapon.cpp
  IWeapon.h
  InGameState.cpp
  InGameState.h
  Inventory.cpp
  Inventory.h
  MissionHolder.cpp
  MissionHolder.h
  Player.cpp
  Player.h
  PlayerConfig.cpp
  PlayerConfig.h
  PlayerController.cpp
  PlayerController.h
  QuestImporter.cpp
  QuestImporter.h
  ReadMe.txt
  Scene.cpp
  Scene.h
  Shotgun.cpp
  Shotgun.h
  State.h
  StateFactory.cpp
  StateFactory.h
  StateMachine.cpp
  StateMachine.h
  Tile.cpp
  Tile.h
  Weather.cpp
  Weather.h
  stdafx.cpp
  stdafx.h