- This is some Work in progress to make Wagic less "game" dependent. This change especially is an attempt at moving away from some dangerous patents owned by some company. It introduces "modrules.xml", a global configuration file describing dynamic settings for any given Wagic mod. It is very basic for now, but allows to customize a bit. In particular, it allows to remove the concept of shop and deck editor from the game, dynamically generate the main menu, and represent card activation with a mask rather than a rotation. I have a sample in progress which I hope to submit in the days to come, a proof of concept (nothing fancy yet) for another type of game using these ideas, as well as a few other things I introduced recently. In the future, I am hoping to extend modrules.xml so that it entirely describes the rules of a given card game. the other files in rules.txt will describe "extensions" to the core rules, just like they do right now, so this new file does not make them obsolete. - Also fixed minor bugs I stumbled upon while developing
130 lines
2.8 KiB
C++
130 lines
2.8 KiB
C++
/* Graphical representation of a Card Instance, used in game */
|
|
|
|
#ifndef _CARD_GUI_H_
|
|
#define _CARD_GUI_H_
|
|
|
|
#include <hge/hgeparticle.h>
|
|
#include <JGui.h>
|
|
#include "Pos.h"
|
|
#include "PlayGuiObject.h"
|
|
#include "WResource_Fwd.h"
|
|
|
|
class MTGCard;
|
|
class MTGCardInstance;
|
|
class PlayGuiObject;
|
|
|
|
namespace DrawMode
|
|
{
|
|
enum
|
|
{
|
|
kNormal = 0,
|
|
kText,
|
|
kHidden
|
|
};
|
|
const int kNumDrawModes = 3;
|
|
}
|
|
|
|
struct CardGui: public PlayGuiObject
|
|
{
|
|
protected:
|
|
|
|
/*
|
|
** Tries to render the Big version of a card picture, backups to text version in case of failure
|
|
*/
|
|
static void RenderBig(MTGCard * card, const Pos& pos);
|
|
|
|
void RenderCountersBig(const Pos& pos);
|
|
static void AlternateRender(MTGCard * card, const Pos& pos);
|
|
static void TinyCropRender(MTGCard * card, const Pos& pos, JQuad * quad);
|
|
|
|
public:
|
|
static const float Width;
|
|
static const float Height;
|
|
static const float BigWidth;
|
|
static const float BigHeight;
|
|
|
|
PIXEL_TYPE mMask;
|
|
|
|
MTGCardInstance* card;
|
|
CardGui(MTGCardInstance* card, float x, float y);
|
|
CardGui(MTGCardInstance* card, const Pos& ref);
|
|
virtual void Render();
|
|
virtual void Update(float dt);
|
|
|
|
void DrawCard(const Pos& inPosition, int inMode = DrawMode::kNormal);
|
|
static void DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode = DrawMode::kNormal);
|
|
|
|
static JQuadPtr AlternateThumbQuad(MTGCard * card);
|
|
virtual ostream& toString(ostream&) const;
|
|
};
|
|
|
|
class CardView: public CardGui
|
|
{
|
|
public:
|
|
|
|
typedef enum
|
|
{
|
|
nullZone, handZone, playZone
|
|
} SelectorZone;
|
|
|
|
const SelectorZone owner;
|
|
|
|
MTGCardInstance* getCard(); // remove this when possible
|
|
CardView(const SelectorZone, MTGCardInstance* card, float x, float y);
|
|
CardView(const SelectorZone, MTGCardInstance* card, const Pos& ref);
|
|
virtual ~CardView();
|
|
|
|
void Render()
|
|
{
|
|
CardGui::Render();
|
|
}
|
|
|
|
void Render(JQuad* q)
|
|
{
|
|
Pos::Render(q);
|
|
}
|
|
|
|
virtual ostream& toString(ostream&) const;
|
|
|
|
float GetCenterX();
|
|
float GetCenterY();
|
|
};
|
|
|
|
class TransientCardView: public CardGui
|
|
{
|
|
public:
|
|
TransientCardView(MTGCardInstance* card, float x, float y);
|
|
TransientCardView(MTGCardInstance* card, const Pos& ref);
|
|
};
|
|
|
|
|
|
class SimpleCardEffect
|
|
{
|
|
public:
|
|
virtual void doEffect(Pos * card) = 0;
|
|
virtual void undoEffect(Pos * card) = 0;
|
|
};
|
|
|
|
class SimpleCardEffectRotate:public SimpleCardEffect
|
|
{
|
|
protected:
|
|
float mRotation;
|
|
public:
|
|
SimpleCardEffectRotate(float rotation);
|
|
void doEffect(Pos * card);
|
|
void undoEffect(Pos * card);
|
|
};
|
|
|
|
class SimpleCardEffectMask:public SimpleCardEffect
|
|
{
|
|
protected:
|
|
PIXEL_TYPE mMask;
|
|
public:
|
|
SimpleCardEffectMask(PIXEL_TYPE mask);
|
|
void doEffect(Pos * card);
|
|
void undoEffect(Pos * card);
|
|
};
|
|
|
|
|
|
#endif
|