Resuming on my threading support work with the card caching mechanism. This change unfortunately touches quite a few files, but I needed to get it out of the way before things got out of hand: one significant hurdle is the assumed lifetime of a JQuad pointer. In a single threaded model, the life time of the pointer is clear: you fetch it into the cache, the cache makes room, you use the pointer immediately. In a multithreaded context however, it's unsafe, as the drawing thread can request a few JQuads, and the cache operating on a separate thread can potentially bounce a JQuad out of the cache before the draw routine is done using it, which ends up in an access violation when you attempt to draw using an invalidated quad pointer. To prevent this, the bulk of this change swaps out the use of naked JQuad* pointers in the code with a JQuadPtr, which is basically a typedef to a boost shared_ptr<JQuad>.
This btw points out another circular dependancy between the texture and the JQuad - a texture owns a bunch of JQuads, yet the renderer uses JQuads and always assumes that the texture is valid. We're going to need to add more defensiveness to JGE to protect against this. Other changes in this check-in: WResourceManager doesn't derive from JResourceManager anymore. It actually didn't require anything from the base, so I killed the dependency. Also cleaned up the notion of a WTrackedQuad in the WCachedResource - it didn't need a separate class, just a better container. I've build this & tested against PSP, win, linux, QT (linux). I haven't tried against iOS and QT Win, or Maemo. If these other platforms are broken, I apologize in advance! - I'm hoping it should be fairly simple to put them back into play.
This commit is contained in:
+178
-138
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* Wagic, The Homebrew ?! is licensed under the BSD license
|
* Wagic, The Homebrew ?! is licensed under the BSD license
|
||||||
* See LICENSE in the Folder's root
|
* See LICENSE in the Folder's root
|
||||||
* http://wololo.net/wagic/
|
* http://wololo.net/wagic/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SPELLSTACK_H_
|
#ifndef _SPELLSTACK_H_
|
||||||
#define _SPELLSTACK_H_
|
#define _SPELLSTACK_H_
|
||||||
@@ -27,6 +27,8 @@
|
|||||||
#include "TargetsList.h"
|
#include "TargetsList.h"
|
||||||
#include "Targetable.h"
|
#include "Targetable.h"
|
||||||
|
|
||||||
|
#include "WResource_Fwd.h"
|
||||||
|
|
||||||
class GuiLayer;
|
class GuiLayer;
|
||||||
class PlayGuiObject;
|
class PlayGuiObject;
|
||||||
class MTGCardInstance;
|
class MTGCardInstance;
|
||||||
@@ -43,168 +45,206 @@ class TargetChooser;
|
|||||||
#define ACTIONSTACK_STANDARD 0
|
#define ACTIONSTACK_STANDARD 0
|
||||||
#define ACTIONSTACK_TARGET 1
|
#define ACTIONSTACK_TARGET 1
|
||||||
|
|
||||||
class Interruptible: public PlayGuiObject, public Targetable{
|
class Interruptible: public PlayGuiObject, public Targetable
|
||||||
public:
|
{
|
||||||
//TODO : remove these when they are back in PlayGuiObject
|
public:
|
||||||
float x, y;
|
//TODO : remove these when they are back in PlayGuiObject
|
||||||
|
float x, y;
|
||||||
|
|
||||||
|
int state, display;
|
||||||
|
MTGCardInstance * source;
|
||||||
|
virtual void Entering()
|
||||||
|
{
|
||||||
|
mHasFocus = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool Leaving(JButton key)
|
||||||
|
{
|
||||||
|
mHasFocus = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool ButtonPressed()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual int resolve()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void Render()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int typeAsTarget()
|
||||||
|
{
|
||||||
|
return TARGET_STACKACTION;
|
||||||
|
}
|
||||||
|
|
||||||
|
Interruptible(bool hasFocus = false) : PlayGuiObject(40,x,y,hasFocus)
|
||||||
|
{
|
||||||
|
state = NOT_RESOLVED;
|
||||||
|
display = 0;
|
||||||
|
source = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual const string getDisplayName() const;
|
||||||
|
void Render(MTGCardInstance * source, JQuad * targetQuad, string alt1, string alt2, string action, bool bigQuad = false);
|
||||||
|
|
||||||
|
virtual int receiveEvent(WEvent * event)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int state, display;
|
|
||||||
MTGCardInstance * source;
|
|
||||||
virtual void Entering(){mHasFocus = true;};
|
|
||||||
virtual bool Leaving(JButton key){mHasFocus = false;return true;};
|
|
||||||
virtual bool ButtonPressed(){return true;};
|
|
||||||
virtual int resolve(){return 0;};
|
|
||||||
virtual void Render(){};
|
|
||||||
int typeAsTarget(){return TARGET_STACKACTION;};
|
|
||||||
Interruptible(bool hasFocus = false):PlayGuiObject(40,x,y,hasFocus){state=NOT_RESOLVED;display=0;source=NULL;};
|
|
||||||
virtual const string getDisplayName() const;
|
|
||||||
void Render(MTGCardInstance * source, JQuad * targetQuad, string alt1, string alt2, string action, bool bigQuad = false);
|
|
||||||
virtual int receiveEvent(WEvent * event) {return 0;};
|
|
||||||
#if defined (WIN32) || defined (LINUX) || defined (IOS)
|
#if defined (WIN32) || defined (LINUX) || defined (IOS)
|
||||||
virtual void Dump();
|
virtual void Dump();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
float GetVerticalTextOffset() const;
|
float GetVerticalTextOffset() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class NextGamePhase: public Interruptible {
|
class NextGamePhase: public Interruptible
|
||||||
public:
|
{
|
||||||
int resolve();
|
public:
|
||||||
bool extraDamagePhase();
|
int resolve();
|
||||||
void Render();
|
bool extraDamagePhase();
|
||||||
virtual ostream& toString(ostream& out) const;
|
void Render();
|
||||||
virtual const string getDisplayName() const;
|
virtual ostream& toString(ostream& out) const;
|
||||||
NextGamePhase(int id);
|
virtual const string getDisplayName() const;
|
||||||
|
NextGamePhase(int id);
|
||||||
};
|
};
|
||||||
|
|
||||||
class Spell: public Interruptible {
|
class Spell: public Interruptible
|
||||||
protected:
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MTGGameZone * from;
|
MTGGameZone * from;
|
||||||
TargetChooser * tc;
|
TargetChooser * tc;
|
||||||
ManaCost * cost;
|
ManaCost * cost;
|
||||||
int payResult;
|
int payResult;
|
||||||
int computeX(MTGCardInstance * card);
|
int computeX(MTGCardInstance * card);
|
||||||
int computeXX(MTGCardInstance * card);
|
int computeXX(MTGCardInstance * card);
|
||||||
Spell(MTGCardInstance* _source);
|
Spell(MTGCardInstance* _source);
|
||||||
Spell(int id, MTGCardInstance* _source, TargetChooser *_tc, ManaCost * _cost, int payResult);
|
Spell(int id, MTGCardInstance* _source, TargetChooser *_tc, ManaCost * _cost, int payResult);
|
||||||
~Spell();
|
~Spell();
|
||||||
int resolve();
|
int resolve();
|
||||||
void Render();
|
void Render();
|
||||||
bool FullfilledAlternateCost(const int &costType);
|
bool FullfilledAlternateCost(const int &costType);
|
||||||
const string getDisplayName() const;
|
const string getDisplayName() const;
|
||||||
virtual ostream& toString(ostream& out) const;
|
virtual ostream& toString(ostream& out) const;
|
||||||
MTGCardInstance * getNextCardTarget(MTGCardInstance * previous = 0);
|
MTGCardInstance * getNextCardTarget(MTGCardInstance * previous = 0);
|
||||||
Player * getNextPlayerTarget(Player * previous = 0);
|
Player * getNextPlayerTarget(Player * previous = 0);
|
||||||
Damageable * getNextDamageableTarget(Damageable * previous = 0);
|
Damageable * getNextDamageableTarget(Damageable * previous = 0);
|
||||||
Interruptible * getNextInterruptible(Interruptible * previous, int type);
|
Interruptible * getNextInterruptible(Interruptible * previous, int type);
|
||||||
Spell * getNextSpellTarget(Spell * previous = 0);
|
Spell * getNextSpellTarget(Spell * previous = 0);
|
||||||
Damage * getNextDamageTarget(Damage * previous = 0);
|
Damage * getNextDamageTarget(Damage * previous = 0);
|
||||||
Targetable * getNextTarget(Targetable * previous = 0, int type = -1);
|
Targetable * getNextTarget(Targetable * previous = 0, int type = -1);
|
||||||
int getNbTargets();
|
int getNbTargets();
|
||||||
};
|
};
|
||||||
|
|
||||||
class StackAbility: public Interruptible {
|
class StackAbility: public Interruptible
|
||||||
public:
|
{
|
||||||
MTGAbility * ability;
|
public:
|
||||||
int resolve();
|
MTGAbility * ability;
|
||||||
void Render();
|
int resolve();
|
||||||
virtual ostream& toString(ostream& out) const;
|
void Render();
|
||||||
virtual const string getDisplayName() const;
|
virtual ostream& toString(ostream& out) const;
|
||||||
StackAbility(int id, MTGAbility * _ability);
|
virtual const string getDisplayName() const;
|
||||||
|
StackAbility(int id, MTGAbility * _ability);
|
||||||
};
|
};
|
||||||
|
|
||||||
class PutInGraveyard: public Interruptible {
|
class PutInGraveyard: public Interruptible {
|
||||||
public:
|
public:
|
||||||
MTGCardInstance * card;
|
MTGCardInstance * card;
|
||||||
int removeFromGame;
|
int removeFromGame;
|
||||||
int resolve();
|
int resolve();
|
||||||
void Render();
|
void Render();
|
||||||
virtual ostream& toString(ostream& out) const;
|
virtual ostream& toString(ostream& out) const;
|
||||||
PutInGraveyard(int id, MTGCardInstance * _card);
|
PutInGraveyard(int id, MTGCardInstance * _card);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class DrawAction: public Interruptible {
|
class DrawAction: public Interruptible
|
||||||
public:
|
{
|
||||||
int nbcards;
|
public:
|
||||||
Player * player;
|
int nbcards;
|
||||||
int resolve();
|
Player * player;
|
||||||
void Render();
|
int resolve();
|
||||||
virtual ostream& toString(ostream& out) const;
|
void Render();
|
||||||
DrawAction(int id, Player * _player, int _nbcards);
|
virtual ostream& toString(ostream& out) const;
|
||||||
|
DrawAction(int id, Player * _player, int _nbcards);
|
||||||
};
|
};
|
||||||
|
|
||||||
class LifeAction: public Interruptible {
|
class LifeAction: public Interruptible
|
||||||
public:
|
{
|
||||||
int amount;
|
public:
|
||||||
Damageable * target;
|
int amount;
|
||||||
int resolve();
|
Damageable * target;
|
||||||
void Render();
|
int resolve();
|
||||||
virtual ostream& toString(ostream& out) const;
|
void Render();
|
||||||
LifeAction(int id, Damageable * _target, int amount);
|
virtual ostream& toString(ostream& out) const;
|
||||||
|
LifeAction(int id, Damageable * _target, int amount);
|
||||||
};
|
};
|
||||||
|
|
||||||
class ActionStack :public GuiLayer{
|
class ActionStack :public GuiLayer
|
||||||
protected:
|
{
|
||||||
JQuad * pspIcons[8];
|
protected:
|
||||||
GameObserver* game;
|
JQuadPtr pspIcons[8];
|
||||||
int interruptDecision[2];
|
GameObserver* game;
|
||||||
float timer;
|
int interruptDecision[2];
|
||||||
int currentState;
|
float timer;
|
||||||
int mode;
|
int currentState;
|
||||||
int checked;
|
int mode;
|
||||||
|
int checked;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
NOT_DECIDED = 0,
|
NOT_DECIDED = 0,
|
||||||
INTERRUPT = -1,
|
INTERRUPT = -1,
|
||||||
DONT_INTERRUPT = 1,
|
DONT_INTERRUPT = 1,
|
||||||
DONT_INTERRUPT_ALL = 2,
|
DONT_INTERRUPT_ALL = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
int setIsInterrupting(Player * player);
|
int setIsInterrupting(Player * player);
|
||||||
int count( int type = 0 , int state = 0 , int display = -1);
|
int count( int type = 0 , int state = 0 , int display = -1);
|
||||||
Interruptible * getPrevious(Interruptible * next, int type = 0, int state = 0 , int display = -1);
|
Interruptible * getPrevious(Interruptible * next, int type = 0, int state = 0 , int display = -1);
|
||||||
int getPreviousIndex(Interruptible * next, int type = 0, int state = 0 , int display = -1);
|
int getPreviousIndex(Interruptible * next, int type = 0, int state = 0 , int display = -1);
|
||||||
Interruptible * getNext(Interruptible * previous, int type = 0, int state = 0 , int display = -1);
|
Interruptible * getNext(Interruptible * previous, int type = 0, int state = 0 , int display = -1);
|
||||||
int getNextIndex(Interruptible * previous, int type = 0, int state = 0 , int display = -1);
|
int getNextIndex(Interruptible * previous, int type = 0, int state = 0 , int display = -1);
|
||||||
void Fizzle(Interruptible * action);
|
void Fizzle(Interruptible * action);
|
||||||
Interruptible * getAt(int id);
|
Interruptible * getAt(int id);
|
||||||
void cancelInterruptOffer(int cancelMode = 1);
|
void cancelInterruptOffer(int cancelMode = 1);
|
||||||
void endOfInterruption();
|
void endOfInterruption();
|
||||||
Interruptible * getLatest(int state);
|
Interruptible * getLatest(int state);
|
||||||
Player * askIfWishesToInterrupt;
|
Player * askIfWishesToInterrupt;
|
||||||
int garbageCollect();
|
int garbageCollect();
|
||||||
int addAction(Interruptible * interruptible);
|
int addAction(Interruptible * interruptible);
|
||||||
Spell * addSpell(MTGCardInstance* card, TargetChooser * tc, ManaCost * mana, int payResult, int storm);
|
Spell * addSpell(MTGCardInstance* card, TargetChooser * tc, ManaCost * mana, int payResult, int storm);
|
||||||
int AddNextGamePhase();
|
int AddNextGamePhase();
|
||||||
int AddNextCombatStep();
|
int AddNextCombatStep();
|
||||||
int addPutInGraveyard(MTGCardInstance * card);
|
int addPutInGraveyard(MTGCardInstance * card);
|
||||||
int addDraw(Player * player, int nbcards = 1);
|
int addDraw(Player * player, int nbcards = 1);
|
||||||
int addLife(Damageable * _target,int amount = 0);
|
int addLife(Damageable * _target,int amount = 0);
|
||||||
int addDamage(MTGCardInstance * _source, Damageable * target, int _damage);
|
int addDamage(MTGCardInstance * _source, Damageable * target, int _damage);
|
||||||
int addAbility(MTGAbility * ability);
|
int addAbility(MTGAbility * ability);
|
||||||
void Update(float dt);
|
void Update(float dt);
|
||||||
bool CheckUserInput(JButton key);
|
bool CheckUserInput(JButton key);
|
||||||
virtual void Render();
|
virtual void Render();
|
||||||
ActionStack(GameObserver* game);
|
ActionStack(GameObserver* game);
|
||||||
int resolve();
|
int resolve();
|
||||||
int has(Interruptible * action);
|
int has(Interruptible * action);
|
||||||
int has(MTGAbility * ability);
|
int has(MTGAbility * ability);
|
||||||
int receiveEventPlus(WEvent * event);
|
int receiveEventPlus(WEvent * event);
|
||||||
#if defined (WIN32) || defined (LINUX) || defined (IOS)
|
#if defined (WIN32) || defined (LINUX) || defined (IOS)
|
||||||
void Dump();
|
void Dump();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace DrawMode
|
|||||||
{
|
{
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
kNormal,
|
kNormal = 0,
|
||||||
kText,
|
kText,
|
||||||
kHidden
|
kHidden
|
||||||
};
|
};
|
||||||
@@ -28,8 +28,8 @@ struct CardGui: public PlayGuiObject
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Tries to render the Big version of a card picture, backups to text version in case of failure
|
** 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);
|
static void RenderBig(MTGCard * card, const Pos& pos);
|
||||||
|
|
||||||
void RenderCountersBig(const Pos& pos);
|
void RenderCountersBig(const Pos& pos);
|
||||||
@@ -51,7 +51,7 @@ public:
|
|||||||
void DrawCard(const Pos& inPosition, int inMode = DrawMode::kNormal);
|
void DrawCard(const Pos& inPosition, int inMode = DrawMode::kNormal);
|
||||||
static void DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode = DrawMode::kNormal);
|
static void DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode = DrawMode::kNormal);
|
||||||
|
|
||||||
static JQuad * AlternateThumbQuad(MTGCard * card);
|
static JQuadPtr AlternateThumbQuad(MTGCard * card);
|
||||||
virtual ostream& toString(ostream&) const;
|
virtual ostream& toString(ostream&) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -75,12 +75,12 @@ public:
|
|||||||
{
|
{
|
||||||
CardGui::Render();
|
CardGui::Render();
|
||||||
}
|
}
|
||||||
;
|
|
||||||
void Render(JQuad* q)
|
void Render(JQuad* q)
|
||||||
{
|
{
|
||||||
Pos::Render(q);
|
Pos::Render(q);
|
||||||
}
|
}
|
||||||
;
|
|
||||||
virtual ostream& toString(ostream&) const;
|
virtual ostream& toString(ostream&) const;
|
||||||
|
|
||||||
float GetCenterX();
|
float GetCenterX();
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ private:
|
|||||||
int isRandomDeckUnlocked();
|
int isRandomDeckUnlocked();
|
||||||
int IsMoreAIDecksUnlocked(DeckStats * stats);
|
int IsMoreAIDecksUnlocked(DeckStats * stats);
|
||||||
string unlockedTextureName;
|
string unlockedTextureName;
|
||||||
JQuad * GetUnlockedQuad(string texturename);
|
JQuadPtr GetUnlockedQuad(string texturename);
|
||||||
public:
|
public:
|
||||||
int value;
|
int value;
|
||||||
Player * p1, *p2;
|
Player * p1, *p2;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include <JGui.h>
|
#include <JGui.h>
|
||||||
#include "GuiLayers.h"
|
#include "GuiLayers.h"
|
||||||
#include "ActionStack.h"
|
#include "ActionStack.h"
|
||||||
|
#include "WResource_Fwd.h"
|
||||||
|
|
||||||
class GuiLayer;
|
class GuiLayer;
|
||||||
class JGuiObject;
|
class JGuiObject;
|
||||||
@@ -17,7 +18,8 @@ class GameObserver;
|
|||||||
#define DAMAGE_COMBAT 1
|
#define DAMAGE_COMBAT 1
|
||||||
#define DAMAGE_OTHER 2
|
#define DAMAGE_OTHER 2
|
||||||
|
|
||||||
class Damageable:public Targetable {
|
class Damageable:public Targetable
|
||||||
|
{
|
||||||
protected:
|
protected:
|
||||||
public:
|
public:
|
||||||
int life;
|
int life;
|
||||||
@@ -33,10 +35,11 @@ public:
|
|||||||
virtual int afterDamage(){return 0;}
|
virtual int afterDamage(){return 0;}
|
||||||
virtual int poisoned(){return 0;}
|
virtual int poisoned(){return 0;}
|
||||||
virtual int prevented(){return 0;}
|
virtual int prevented(){return 0;}
|
||||||
virtual JQuad * getIcon(){return NULL;};
|
virtual JQuadPtr getIcon(){return JQuadPtr();}
|
||||||
};
|
};
|
||||||
|
|
||||||
class Damage: public Interruptible {
|
class Damage: public Interruptible
|
||||||
|
{
|
||||||
protected:
|
protected:
|
||||||
void init(MTGCardInstance * source, Damageable * target, int damage, int typeOfDamage);
|
void init(MTGCardInstance * source, Damageable * target, int damage, int typeOfDamage);
|
||||||
public:
|
public:
|
||||||
@@ -50,8 +53,8 @@ class Damage: public Interruptible {
|
|||||||
virtual ostream& toString(ostream& out) const;
|
virtual ostream& toString(ostream& out) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class DamageStack : public GuiLayer, public Interruptible
|
||||||
class DamageStack : public GuiLayer, public Interruptible{
|
{
|
||||||
protected:
|
protected:
|
||||||
int currentState;
|
int currentState;
|
||||||
GameObserver* game;
|
GameObserver* game;
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public:
|
|||||||
float mSelectionTargetY;
|
float mSelectionTargetY;
|
||||||
|
|
||||||
//used for detailed info button
|
//used for detailed info button
|
||||||
JQuad * pspIcons[8];
|
JQuadPtr pspIcons[8];
|
||||||
JTexture * pspIconsTexture;
|
JTexture * pspIconsTexture;
|
||||||
|
|
||||||
DeckMenu(int id, JGuiListener* listener, int fontId, const string _title = "", const int& startIndex = 0, bool alwaysShowDetailsButton = false);
|
DeckMenu(int id, JGuiListener* listener, int fontId, const string _title = "", const int& startIndex = 0, bool alwaysShowDetailsButton = false);
|
||||||
|
|||||||
@@ -83,6 +83,6 @@ public:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern JQuad* manaIcons[7];
|
extern JQuadPtr manaIcons[7];
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -81,8 +81,8 @@ enum DECK_VIEWER_MENU_ITEMS
|
|||||||
class GameStateDeckViewer: public GameState, public JGuiListener
|
class GameStateDeckViewer: public GameState, public JGuiListener
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
JQuad * mIcons[CARDS_DISPLAYED];
|
JQuadPtr mIcons[CARDS_DISPLAYED];
|
||||||
JQuad * pspIcons[8];
|
JQuadPtr pspIcons[8];
|
||||||
JTexture * pspIconsTexture;
|
JTexture * pspIconsTexture;
|
||||||
float last_user_activity;
|
float last_user_activity;
|
||||||
float onScreenTransition;
|
float onScreenTransition;
|
||||||
@@ -92,7 +92,6 @@ private:
|
|||||||
int mStage;
|
int mStage;
|
||||||
int useFilter;
|
int useFilter;
|
||||||
JMusic * bgMusic;
|
JMusic * bgMusic;
|
||||||
JQuad * backQuad;
|
|
||||||
int lastPos;
|
int lastPos;
|
||||||
int lastTotal;
|
int lastTotal;
|
||||||
|
|
||||||
|
|||||||
@@ -16,10 +16,9 @@ private:
|
|||||||
SimpleMenu* subMenuController;
|
SimpleMenu* subMenuController;
|
||||||
SimpleMenu* gameTypeMenu;
|
SimpleMenu* gameTypeMenu;
|
||||||
int hasChosenGameType;
|
int hasChosenGameType;
|
||||||
JQuad * mIcons[10];
|
JQuadPtr mIcons[10];
|
||||||
JTexture * bgTexture;
|
JTexture * bgTexture;
|
||||||
JQuad * mBg;
|
JQuadPtr mBg;
|
||||||
JQuad * mSplash;
|
|
||||||
JTexture * splashTex;
|
JTexture * splashTex;
|
||||||
float mCreditsYPos;
|
float mCreditsYPos;
|
||||||
int currentState;
|
int currentState;
|
||||||
|
|||||||
@@ -61,10 +61,9 @@ private:
|
|||||||
class GameStateShop: public GameState, public JGuiListener
|
class GameStateShop: public GameState, public JGuiListener
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
JQuad * pspIcons[8];
|
JQuadPtr pspIcons[8];
|
||||||
WSrcCards * srcCards;
|
WSrcCards * srcCards;
|
||||||
JTexture * altThumb[8];
|
JTexture * altThumb[8];
|
||||||
JQuad * mBack;
|
|
||||||
TaskList * taskList;
|
TaskList * taskList;
|
||||||
float mElapsed;
|
float mElapsed;
|
||||||
WGuiMenu * shopMenu;
|
WGuiMenu * shopMenu;
|
||||||
|
|||||||
@@ -3,11 +3,11 @@
|
|||||||
|
|
||||||
#include "GuiLayers.h"
|
#include "GuiLayers.h"
|
||||||
|
|
||||||
class GuiFrame: public GuiLayer
|
class GuiFrame : public GuiLayer
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
JQuad* wood;
|
JQuadPtr wood;
|
||||||
JQuad* gold1, *gold2, *goldGlow;
|
JQuadPtr gold1, gold2, goldGlow;
|
||||||
float step;
|
float step;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
class GuiHand;
|
class GuiHand;
|
||||||
|
|
||||||
struct HandLimitor: public Limitor
|
struct HandLimitor : public Limitor
|
||||||
{
|
{
|
||||||
GuiHand* hand;
|
GuiHand* hand;
|
||||||
virtual bool select(Target*);
|
virtual bool select(Target*);
|
||||||
@@ -18,7 +18,7 @@ struct HandLimitor: public Limitor
|
|||||||
HandLimitor(GuiHand* hand);
|
HandLimitor(GuiHand* hand);
|
||||||
};
|
};
|
||||||
|
|
||||||
class GuiHand: public GuiLayer
|
class GuiHand : public GuiLayer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static const float ClosedRowX;
|
static const float ClosedRowX;
|
||||||
@@ -32,7 +32,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
const MTGHand* hand;
|
const MTGHand* hand;
|
||||||
JQuad *back;
|
JQuadPtr back;
|
||||||
vector<CardView*> cards;
|
vector<CardView*> cards;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -44,7 +44,7 @@ public:
|
|||||||
friend struct HandLimitor;
|
friend struct HandLimitor;
|
||||||
};
|
};
|
||||||
|
|
||||||
class GuiHandOpponent: public GuiHand
|
class GuiHandOpponent : public GuiHand
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GuiHandOpponent(MTGHand* hand);
|
GuiHandOpponent(MTGHand* hand);
|
||||||
@@ -53,12 +53,13 @@ public:
|
|||||||
virtual int receiveEventMinus(WEvent* e);
|
virtual int receiveEventMinus(WEvent* e);
|
||||||
};
|
};
|
||||||
|
|
||||||
class GuiHandSelf: public GuiHand
|
class GuiHandSelf : public GuiHand
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
Open, Closed
|
Open,
|
||||||
|
Closed
|
||||||
} HandState;
|
} HandState;
|
||||||
HandState state;
|
HandState state;
|
||||||
Pos backpos;
|
Pos backpos;
|
||||||
@@ -79,7 +80,6 @@ public:
|
|||||||
{
|
{
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
;
|
|
||||||
|
|
||||||
HandLimitor* limitor;
|
HandLimitor* limitor;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
#include "GameApp.h"
|
#include "GameApp.h"
|
||||||
#include "GuiLayers.h"
|
#include "GuiLayers.h"
|
||||||
|
|
||||||
class ManaIcon: public Pos
|
class ManaIcon : public Pos
|
||||||
{
|
{
|
||||||
hgeParticleSystem* particleSys;
|
hgeParticleSystem* particleSys;
|
||||||
JQuad* icon;
|
JQuadPtr icon;
|
||||||
|
|
||||||
float zoomP1, zoomP2, zoomP3, zoomP4, zoomP5, zoomP6;
|
float zoomP1, zoomP2, zoomP3, zoomP4, zoomP5, zoomP6;
|
||||||
float xP1, xP2, xP3;
|
float xP1, xP2, xP3;
|
||||||
@@ -35,7 +35,7 @@ public:
|
|||||||
~ManaIcon();
|
~ManaIcon();
|
||||||
};
|
};
|
||||||
|
|
||||||
class GuiMana: public GuiLayer
|
class GuiMana : public GuiLayer
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
vector<ManaIcon*> manas;
|
vector<ManaIcon*> manas;
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ class MTGCardInstance: public CardPrimitive, public MTGCard, public Damageable {
|
|||||||
int isInPlay();
|
int isInPlay();
|
||||||
JSample * getSample();
|
JSample * getSample();
|
||||||
|
|
||||||
JQuad * getIcon();
|
JQuadPtr getIcon();
|
||||||
|
|
||||||
ostream& toString(ostream&) const;
|
ostream& toString(ostream&) const;
|
||||||
|
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ public:
|
|||||||
virtual void confirmChange(bool confirmed);
|
virtual void confirmChange(bool confirmed);
|
||||||
OptionThemeStyle(string _displayValue);
|
OptionThemeStyle(string _displayValue);
|
||||||
};
|
};
|
||||||
|
|
||||||
class OptionDirectory: public OptionSelect
|
class OptionDirectory: public OptionSelect
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -157,7 +158,7 @@ private:
|
|||||||
static const string DIRTESTER;
|
static const string DIRTESTER;
|
||||||
public:
|
public:
|
||||||
OptionTheme(OptionThemeStyle * style = NULL);
|
OptionTheme(OptionThemeStyle * style = NULL);
|
||||||
JQuad * getImage();
|
JQuadPtr getImage();
|
||||||
virtual void updateValue();
|
virtual void updateValue();
|
||||||
virtual float getHeight();
|
virtual float getHeight();
|
||||||
virtual void Render();
|
virtual void Render();
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
JTexture * mAvatarTex;
|
JTexture * mAvatarTex;
|
||||||
JQuad * mAvatar;
|
JQuadPtr mAvatar;
|
||||||
int playMode;
|
int playMode;
|
||||||
bool canPutLandsIntoPlay;
|
bool canPutLandsIntoPlay;
|
||||||
int landsPlayerCanStillPlay;
|
int landsPlayerCanStillPlay;
|
||||||
@@ -88,7 +88,7 @@ public:
|
|||||||
|
|
||||||
Player * opponent();
|
Player * opponent();
|
||||||
int getId();
|
int getId();
|
||||||
JQuad * getIcon();
|
JQuadPtr getIcon();
|
||||||
|
|
||||||
virtual int receiveEvent(WEvent * event)
|
virtual int receiveEvent(WEvent * event)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
A class for very simple menus structure
|
A class for very simple menus structure
|
||||||
*/
|
*/
|
||||||
#ifndef _SIMPLEMENU_H_
|
#ifndef _SIMPLEMENU_H_
|
||||||
#define _SIMPLEMENU_H_
|
#define _SIMPLEMENU_H_
|
||||||
|
|
||||||
@@ -9,6 +9,8 @@
|
|||||||
#include "WFont.h"
|
#include "WFont.h"
|
||||||
#include "hge/hgeparticle.h"
|
#include "hge/hgeparticle.h"
|
||||||
|
|
||||||
|
#include "WResource_Fwd.h"
|
||||||
|
|
||||||
class SimpleMenu: public JGuiController
|
class SimpleMenu: public JGuiController
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
@@ -21,7 +23,7 @@ private:
|
|||||||
float timeOpen;
|
float timeOpen;
|
||||||
bool mClosed;
|
bool mClosed;
|
||||||
|
|
||||||
static JQuad *spadeR, *spadeL, *jewel, *side;
|
static JQuadPtr spadeR, spadeL, jewel, side;
|
||||||
static JTexture *spadeRTex, *spadeLTex, *jewelTex, *sideTex;
|
static JTexture *spadeRTex, *spadeLTex, *jewelTex, *sideTex;
|
||||||
static WFont* titleFont;
|
static WFont* titleFont;
|
||||||
static hgeParticleSystem* stars;
|
static hgeParticleSystem* stars;
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
#define INVALID_MTEX -1
|
#define INVALID_MTEX -1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "WResource_Fwd.h"
|
||||||
|
|
||||||
class WResource
|
class WResource
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -18,118 +20,105 @@ public:
|
|||||||
WResource();
|
WResource();
|
||||||
virtual ~WResource();
|
virtual ~WResource();
|
||||||
|
|
||||||
virtual unsigned long size()=0; //Size of cached item in bytes.
|
virtual unsigned long size() = 0; //Size of cached item in bytes.
|
||||||
virtual bool isGood()=0; //Return true if this has data.
|
virtual bool isGood() = 0; //Return true if this has data.
|
||||||
virtual bool isLocked(); //Is the resource locked?
|
virtual bool isLocked(); //Is the resource locked?
|
||||||
virtual void lock(); //Lock it.
|
virtual void lock(); //Lock it.
|
||||||
virtual void unlock(bool force = false); //Unlock it. Forcing a lock will also remove "permanent" status.
|
virtual void unlock(bool force = false); //Unlock it. Forcing a lock will also remove "permanent" status.
|
||||||
|
|
||||||
bool isPermanent(); //Is the resource permanent?
|
bool isPermanent(); //Is the resource permanent?
|
||||||
void deadbolt(); //Make it permanent.
|
void deadbolt(); //Make it permanent.
|
||||||
void hit(); //Update resource's last used time.
|
void hit(); //Update resource's last used time.
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int loadedMode; //What submode settings were we loaded with? (For refresh)
|
int loadedMode; //What submode settings were we loaded with? (For refresh)
|
||||||
unsigned int lastTime; //When was the last time we were hit?
|
unsigned int lastTime; //When was the last time we were hit?
|
||||||
unsigned char locks; //Remember to unlock when we're done using locked stuff, or else this'll be useless.
|
unsigned char locks; //Remember to unlock when we're done using locked stuff, or else this'll be useless.
|
||||||
};
|
};
|
||||||
|
|
||||||
class WCachedResource: public WResource
|
class WCachedResource: public WResource
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
friend class WResourceManager;
|
friend class WResourceManager;
|
||||||
template<class cacheItem, class cacheActual> friend class WCache;
|
template<class cacheItem,class cacheActual> friend class WCache;
|
||||||
|
|
||||||
virtual ~WCachedResource();
|
virtual ~WCachedResource();
|
||||||
|
|
||||||
string mFilename;
|
string mFilename;
|
||||||
virtual void Refresh()=0; //Basically calls Attempt(filename) and remaps in situ.
|
virtual void Refresh() = 0; //Basically calls Attempt(filename) and remaps in situ.
|
||||||
virtual bool Attempt(string filename, int submode, int & error)=0; //Returns true if we've loaded our data and isGood().
|
virtual bool Attempt(const string& filename, int submode, int & error) = 0; //Returns true if we've loaded our data and isGood().
|
||||||
};
|
|
||||||
|
|
||||||
class WTrackedQuad: public WResource
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
WTrackedQuad(string _resname);
|
|
||||||
~WTrackedQuad();
|
|
||||||
bool isGood();
|
|
||||||
unsigned long size();
|
|
||||||
string resname;
|
|
||||||
JQuad * quad;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class WCachedTexture: public WCachedResource
|
class WCachedTexture: public WCachedResource
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
friend class WResourceManager;
|
friend class WResourceManager;
|
||||||
template<class cacheItem, class cacheActual> friend class WCache;
|
template<class cacheItem,class cacheActual> friend class WCache;
|
||||||
|
|
||||||
WCachedTexture();
|
WCachedTexture();
|
||||||
~WCachedTexture();
|
~WCachedTexture();
|
||||||
|
|
||||||
void Refresh();
|
void Refresh();
|
||||||
unsigned long size();
|
unsigned long size();
|
||||||
bool isGood();
|
bool isGood();
|
||||||
bool isLocked(); //Is the resource locked?
|
bool isLocked(); //Is the resource locked?
|
||||||
bool Attempt(string filename, int submode, int & error);
|
bool Attempt(const string& filename, int submode, int & error);
|
||||||
bool compare(JTexture * t)
|
bool compare(JTexture * t)
|
||||||
{
|
{
|
||||||
return (t == texture);
|
return (t == texture);
|
||||||
}
|
}
|
||||||
;
|
|
||||||
JTexture * Actual(); //Return this texture as is. Does not make a new one.
|
|
||||||
JQuad * GetQuad(string resname);
|
|
||||||
|
|
||||||
WTrackedQuad
|
JTexture* Actual(); //Return this texture as is. Does not make a new one.
|
||||||
* GetTrackedQuad(float offX = 0.0f, float offY = 0.0f, float width = 0.0f, float height = 0.0f, string resname = ""); //Get us a new/existing quad.
|
JQuadPtr GetQuad(const string& resname);
|
||||||
|
|
||||||
JQuad * GetQuad(float offX = 0.0f, float offY = 0.0f, float width = 0.0f, float height = 0.0f, string resname = ""); //Alias to GetTrackedQuad.
|
JQuadPtr GetQuad(float offX = 0.0f, float offY = 0.0f, float width = 0.0f, float height = 0.0f, const string& resname="");
|
||||||
JQuad * GetCard(float offX = 0.0f, float offY = 0.0f, float width = 0.0f, float height = 0.0f, string resname = ""); //Same as above, but centered when new.
|
JQuadPtr GetCard(float offX = 0.0f, float offY = 0.0f, float width = 0.0f, float height = 0.0f, const string& resname=""); //Same as above, but centered when new.
|
||||||
|
|
||||||
bool ReleaseQuad(JQuad* quad); //We're done with this quad, so delete and stop tracking. True if existed.
|
|
||||||
protected:
|
protected:
|
||||||
JTexture * texture;
|
JTexture* texture;
|
||||||
vector<WTrackedQuad*> trackedQuads;
|
map<string, JQuadPtr> mTrackedQuads;
|
||||||
};
|
};
|
||||||
|
|
||||||
class WCachedParticles: public WCachedResource
|
class WCachedParticles: public WCachedResource
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
friend class WResourceManager;
|
friend class WResourceManager;
|
||||||
template<class cacheItem, class cacheActual> friend class WCache;
|
template<class cacheItem,class cacheActual> friend class WCache;
|
||||||
WCachedParticles();
|
WCachedParticles();
|
||||||
~WCachedParticles();
|
~WCachedParticles();
|
||||||
void Refresh();
|
void Refresh();
|
||||||
unsigned long size();
|
unsigned long size();
|
||||||
|
|
||||||
bool isGood();
|
bool isGood();
|
||||||
bool Attempt(string filename, int submode, int & error);
|
bool Attempt(const string& filename, int submode, int& error);
|
||||||
bool compare(hgeParticleSystemInfo * p)
|
bool compare(hgeParticleSystemInfo * p)
|
||||||
{
|
{
|
||||||
return (p == particles);
|
return (p == particles);
|
||||||
}
|
}
|
||||||
;
|
|
||||||
|
|
||||||
hgeParticleSystemInfo * Actual();
|
hgeParticleSystemInfo* Actual();
|
||||||
protected:
|
protected:
|
||||||
hgeParticleSystemInfo * particles;
|
hgeParticleSystemInfo* particles;
|
||||||
};
|
};
|
||||||
|
|
||||||
class WCachedSample: public WCachedResource
|
class WCachedSample: public WCachedResource
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
friend class WResourceManager;
|
friend class WResourceManager;
|
||||||
template<class cacheItem, class cacheActual> friend class WCache;
|
template<class cacheItem,class cacheActual> friend class WCache;
|
||||||
|
|
||||||
WCachedSample();
|
WCachedSample();
|
||||||
~WCachedSample();
|
~WCachedSample();
|
||||||
|
|
||||||
bool compare(JSample * s)
|
bool compare(JSample * s)
|
||||||
{
|
{
|
||||||
return (s == sample);
|
return (s == sample);
|
||||||
}
|
}
|
||||||
;
|
|
||||||
unsigned long size();
|
unsigned long size();
|
||||||
bool isGood();
|
bool isGood();
|
||||||
void Refresh();
|
void Refresh();
|
||||||
bool Attempt(string filename, int submode, int & error);
|
bool Attempt(const string& filename, int submode, int & error);
|
||||||
|
|
||||||
JSample * Actual(); //Return this sample.
|
JSample * Actual(); //Return this sample.
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#ifndef _WDATASRC_H_
|
#ifndef _WDATASRC_H_
|
||||||
#define _WDATASRC_H_
|
#define _WDATASRC_H_
|
||||||
|
|
||||||
|
#include "WResource_Fwd.h"
|
||||||
|
|
||||||
class WCardFilter;
|
class WCardFilter;
|
||||||
struct WCardSort;
|
struct WCardSort;
|
||||||
struct WDistort;
|
struct WDistort;
|
||||||
@@ -18,24 +20,24 @@ public:
|
|||||||
hooked = NULL;
|
hooked = NULL;
|
||||||
currentPos = 0;
|
currentPos = 0;
|
||||||
}
|
}
|
||||||
;
|
|
||||||
virtual ~WSyncable()
|
virtual ~WSyncable()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
;
|
|
||||||
//Local
|
//Local
|
||||||
virtual bool Hook(WSyncable* s);
|
virtual bool Hook(WSyncable* s);
|
||||||
virtual int getOffset()
|
virtual int getOffset()
|
||||||
{
|
{
|
||||||
return currentPos;
|
return currentPos;
|
||||||
}
|
}
|
||||||
;
|
|
||||||
virtual bool setOffset(int i)
|
virtual bool setOffset(int i)
|
||||||
{
|
{
|
||||||
currentPos = i;
|
currentPos = i;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
;
|
|
||||||
//Recursive
|
//Recursive
|
||||||
virtual int getPos();
|
virtual int getPos();
|
||||||
virtual bool next();
|
virtual bool next();
|
||||||
@@ -51,47 +53,48 @@ public:
|
|||||||
WDataSource()
|
WDataSource()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
;
|
|
||||||
virtual JQuad * getImage(int offset = 0)
|
virtual JQuadPtr getImage(int offset = 0)
|
||||||
{
|
{
|
||||||
return NULL;
|
return JQuadPtr();
|
||||||
}
|
}
|
||||||
;
|
|
||||||
virtual JQuad * getThumb(int offset = 0)
|
virtual JQuadPtr getThumb(int offset = 0)
|
||||||
{
|
{
|
||||||
return NULL;
|
return JQuadPtr();
|
||||||
}
|
}
|
||||||
;
|
|
||||||
virtual MTGCard * getCard(int offset = 0, bool ignore = false)
|
virtual MTGCard * getCard(int offset = 0, bool ignore = false)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
;
|
|
||||||
virtual MTGDeck * getDeck(int offset = 0)
|
virtual MTGDeck * getDeck(int offset = 0)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
;
|
|
||||||
virtual WDistort * getDistort(int offset = 0)
|
virtual WDistort * getDistort(int offset = 0)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
;
|
|
||||||
virtual bool thisCard(int mtgid)
|
virtual bool thisCard(int mtgid)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
;
|
|
||||||
virtual int getControlID()
|
virtual int getControlID()
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
; //TODO FIXME: Need a "not a valid button" define.
|
|
||||||
|
//TODO FIXME: Need a "not a valid button" define.
|
||||||
virtual void Update(float dt)
|
virtual void Update(float dt)
|
||||||
{
|
{
|
||||||
mLastInput += dt;
|
mLastInput += dt;
|
||||||
}
|
}
|
||||||
;
|
|
||||||
virtual void Touch()
|
virtual void Touch()
|
||||||
{
|
{
|
||||||
mLastInput = 0;
|
mLastInput = 0;
|
||||||
@@ -101,12 +104,12 @@ public:
|
|||||||
{
|
{
|
||||||
return mLastInput;
|
return mLastInput;
|
||||||
}
|
}
|
||||||
;
|
|
||||||
virtual void setElapsed(float f)
|
virtual void setElapsed(float f)
|
||||||
{
|
{
|
||||||
mLastInput = f;
|
mLastInput = f;
|
||||||
}
|
}
|
||||||
;
|
|
||||||
protected:
|
protected:
|
||||||
float mLastInput;
|
float mLastInput;
|
||||||
};
|
};
|
||||||
@@ -114,7 +117,7 @@ protected:
|
|||||||
class WSrcImage: public WDataSource
|
class WSrcImage: public WDataSource
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual JQuad * getImage(int offset = 0);
|
virtual JQuadPtr getImage(int offset = 0);
|
||||||
WSrcImage(string s);
|
WSrcImage(string s);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -133,8 +136,8 @@ public:
|
|||||||
WSrcCards(float delay = 0.2);
|
WSrcCards(float delay = 0.2);
|
||||||
~WSrcCards();
|
~WSrcCards();
|
||||||
|
|
||||||
virtual JQuad * getImage(int offset = 0);
|
virtual JQuadPtr getImage(int offset = 0);
|
||||||
virtual JQuad * getThumb(int offset = 0);
|
virtual JQuadPtr getThumb(int offset = 0);
|
||||||
virtual MTGCard * getCard(int offset = 0, bool ignore = false);
|
virtual MTGCard * getCard(int offset = 0, bool ignore = false);
|
||||||
|
|
||||||
virtual int Size(bool all = false); //Returns the number of cards, or the number of cards that match the filter.
|
virtual int Size(bool all = false); //Returns the number of cards, or the number of cards that match the filter.
|
||||||
@@ -171,7 +174,6 @@ public:
|
|||||||
{
|
{
|
||||||
return filtersRoot;
|
return filtersRoot;
|
||||||
}
|
}
|
||||||
;
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@@ -191,141 +193,141 @@ public:
|
|||||||
void swapSrc();
|
void swapSrc();
|
||||||
|
|
||||||
//Wrapped functions
|
//Wrapped functions
|
||||||
JQuad * getImage(int offset = 0)
|
JQuadPtr getImage(int offset = 0)
|
||||||
{
|
{
|
||||||
return active->getImage(offset);
|
return active->getImage(offset);
|
||||||
}
|
}
|
||||||
;
|
|
||||||
JQuad * getThumb(int offset = 0)
|
JQuadPtr getThumb(int offset = 0)
|
||||||
{
|
{
|
||||||
return active->getThumb(offset);
|
return active->getThumb(offset);
|
||||||
}
|
}
|
||||||
;
|
|
||||||
MTGCard * getCard(int offset = 0, bool ignore = false)
|
MTGCard * getCard(int offset = 0, bool ignore = false)
|
||||||
{
|
{
|
||||||
return active->getCard(offset, ignore);
|
return active->getCard(offset, ignore);
|
||||||
}
|
}
|
||||||
;
|
|
||||||
int Size(bool all = false)
|
int Size(bool all = false)
|
||||||
{
|
{
|
||||||
return active->Size();
|
return active->Size();
|
||||||
}
|
}
|
||||||
;
|
|
||||||
WCardFilter * getfiltersRoot()
|
WCardFilter * getfiltersRoot()
|
||||||
{
|
{
|
||||||
return active->getFiltersRoot();
|
return active->getFiltersRoot();
|
||||||
}
|
}
|
||||||
;
|
|
||||||
void Shuffle()
|
void Shuffle()
|
||||||
{
|
{
|
||||||
active->Shuffle();
|
active->Shuffle();
|
||||||
}
|
}
|
||||||
;
|
|
||||||
bool thisCard(int mtgid)
|
bool thisCard(int mtgid)
|
||||||
{
|
{
|
||||||
return active->thisCard(mtgid);
|
return active->thisCard(mtgid);
|
||||||
}
|
}
|
||||||
;
|
|
||||||
bool next()
|
bool next()
|
||||||
{
|
{
|
||||||
return active->next();
|
return active->next();
|
||||||
}
|
}
|
||||||
;
|
|
||||||
bool prev()
|
bool prev()
|
||||||
{
|
{
|
||||||
return active->prev();
|
return active->prev();
|
||||||
}
|
}
|
||||||
;
|
|
||||||
void Sort(int method)
|
void Sort(int method)
|
||||||
{
|
{
|
||||||
active->Sort(method);
|
active->Sort(method);
|
||||||
}
|
}
|
||||||
;
|
|
||||||
bool setOffset(int pos)
|
bool setOffset(int pos)
|
||||||
{
|
{
|
||||||
return active->setOffset(pos);
|
return active->setOffset(pos);
|
||||||
}
|
}
|
||||||
;
|
|
||||||
bool isEmptySet(WCardFilter * f)
|
bool isEmptySet(WCardFilter * f)
|
||||||
{
|
{
|
||||||
return active->isEmptySet(f);
|
return active->isEmptySet(f);
|
||||||
}
|
}
|
||||||
;
|
|
||||||
void addFilter(WCardFilter * f)
|
void addFilter(WCardFilter * f)
|
||||||
{
|
{
|
||||||
active->addFilter(f);
|
active->addFilter(f);
|
||||||
}
|
}
|
||||||
;
|
|
||||||
void clearFilters()
|
void clearFilters()
|
||||||
{
|
{
|
||||||
active->clearFilters();
|
active->clearFilters();
|
||||||
}
|
}
|
||||||
;
|
|
||||||
WCardFilter* unhookFilters()
|
WCardFilter* unhookFilters()
|
||||||
{
|
{
|
||||||
return active->unhookFilters();
|
return active->unhookFilters();
|
||||||
}
|
}
|
||||||
;
|
|
||||||
bool matchesFilters(MTGCard * c)
|
bool matchesFilters(MTGCard * c)
|
||||||
{
|
{
|
||||||
return active->matchesFilters(c);
|
return active->matchesFilters(c);
|
||||||
}
|
}
|
||||||
;
|
|
||||||
void validate()
|
void validate()
|
||||||
{
|
{
|
||||||
active->validate();
|
active->validate();
|
||||||
}
|
}
|
||||||
;
|
|
||||||
void bakeFilters()
|
void bakeFilters()
|
||||||
{
|
{
|
||||||
active->bakeFilters();
|
active->bakeFilters();
|
||||||
}
|
}
|
||||||
; //Discards all invalidated cards.
|
//Discards all invalidated cards.
|
||||||
float filterFee()
|
float filterFee()
|
||||||
{
|
{
|
||||||
return active->filterFee();
|
return active->filterFee();
|
||||||
}
|
}
|
||||||
;
|
|
||||||
void updateCounts()
|
void updateCounts()
|
||||||
{
|
{
|
||||||
active->updateCounts();
|
active->updateCounts();
|
||||||
}
|
}
|
||||||
;
|
|
||||||
void clearCounts()
|
void clearCounts()
|
||||||
{
|
{
|
||||||
active->clearCounts();
|
active->clearCounts();
|
||||||
}
|
}
|
||||||
;
|
|
||||||
void addCount(MTGCard * c, int qty = 1)
|
void addCount(MTGCard * c, int qty = 1)
|
||||||
{
|
{
|
||||||
active->addCount(c, qty);
|
active->addCount(c, qty);
|
||||||
}
|
}
|
||||||
;
|
|
||||||
int loadMatches(MTGAllCards* ac)
|
int loadMatches(MTGAllCards* ac)
|
||||||
{
|
{
|
||||||
return active->loadMatches(ac);
|
return active->loadMatches(ac);
|
||||||
}
|
}
|
||||||
;
|
|
||||||
int loadMatches(MTGDeck * deck)
|
int loadMatches(MTGDeck * deck)
|
||||||
{
|
{
|
||||||
return active->loadMatches(deck);
|
return active->loadMatches(deck);
|
||||||
}
|
}
|
||||||
;
|
|
||||||
int loadMatches(WSrcCards* src, bool all = false)
|
int loadMatches(WSrcCards* src, bool all = false)
|
||||||
{
|
{
|
||||||
return loadMatches(src, all);
|
return loadMatches(src, all);
|
||||||
}
|
}
|
||||||
;
|
|
||||||
int addRandomCards(MTGDeck * i, int howmany = 1)
|
int addRandomCards(MTGDeck * i, int howmany = 1)
|
||||||
{
|
{
|
||||||
return active->addRandomCards(i, howmany);
|
return active->addRandomCards(i, howmany);
|
||||||
}
|
}
|
||||||
;
|
|
||||||
int addToDeck(MTGDeck * i, int num = -1)
|
int addToDeck(MTGDeck * i, int num = -1)
|
||||||
{
|
{
|
||||||
return active->addToDeck(i, num);
|
return active->addToDeck(i, num);
|
||||||
}
|
}
|
||||||
;
|
|
||||||
protected:
|
protected:
|
||||||
WSrcCards * active;
|
WSrcCards * active;
|
||||||
WSrcCards * inactive;
|
WSrcCards * inactive;
|
||||||
|
|||||||
@@ -5,12 +5,13 @@
|
|||||||
#include <JTypes.h>
|
#include <JTypes.h>
|
||||||
#include "MTGDeck.h"
|
#include "MTGDeck.h"
|
||||||
#include "MTGCard.h"
|
#include "MTGCard.h"
|
||||||
|
#include "utils.h"
|
||||||
#include "WCachedResource.h"
|
#include "WCachedResource.h"
|
||||||
#include "WFont.h"
|
#include "WFont.h"
|
||||||
|
|
||||||
#define HUGE_CACHE_LIMIT 20000000 // Size of the cache for Windows and Linux
|
#define HUGE_CACHE_LIMIT 20000000 // Size of the cache for Windows and Linux
|
||||||
#define SAMPLES_CACHE_SIZE 1500000 // Size in bytes of the cached samples
|
#define SAMPLES_CACHE_SIZE 1500000 // Size in bytes of the cached samples
|
||||||
#define PSI_CACHE_SIZE 500000 // Size in bytes of the cahed particles
|
#define PSI_CACHE_SIZE 500000 // Size in bytes of the cached particles
|
||||||
#define TEXTURES_CACHE_MINSIZE 2000000 // Minimum size of the cache on the PSP. The program should complain if the cache ever gets smaller than this
|
#define TEXTURES_CACHE_MINSIZE 2000000 // Minimum size of the cache on the PSP. The program should complain if the cache ever gets smaller than this
|
||||||
#define OPERATIONAL_SIZE 5000000 // Size required by Wagic for operational stuff. 3MB is not enough. The cache will usually try to take (Total Ram - Operational size)
|
#define OPERATIONAL_SIZE 5000000 // Size required by Wagic for operational stuff. 3MB is not enough. The cache will usually try to take (Total Ram - Operational size)
|
||||||
#define MIN_LINEAR_RAM 1500000
|
#define MIN_LINEAR_RAM 1500000
|
||||||
@@ -20,6 +21,7 @@
|
|||||||
#define MAX_CACHE_TIME 2000000000
|
#define MAX_CACHE_TIME 2000000000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define THUMBNAILS_OFFSET 100000000
|
#define THUMBNAILS_OFFSET 100000000
|
||||||
#define OTHERS_OFFSET 2000000000
|
#define OTHERS_OFFSET 2000000000
|
||||||
|
|
||||||
@@ -30,41 +32,39 @@
|
|||||||
#define MAX_CACHED_SAMPLES 50
|
#define MAX_CACHED_SAMPLES 50
|
||||||
#define MAX_CACHE_GARBAGE 10
|
#define MAX_CACHE_GARBAGE 10
|
||||||
|
|
||||||
|
|
||||||
enum ENUM_WRES_INFO
|
enum ENUM_WRES_INFO
|
||||||
{
|
{
|
||||||
WRES_UNLOCKED = 0, //Resource is unlocked.
|
WRES_UNLOCKED = 0, //Resource is unlocked.
|
||||||
WRES_MAX_LOCK = 250, //Maximum number of locks for a resource.
|
WRES_MAX_LOCK = 250, //Maximum number of locks for a resource.
|
||||||
WRES_PERMANENT = 251, //Resource is permanent (ie, managed)
|
WRES_PERMANENT = 251, //Resource is permanent (ie, managed)
|
||||||
WRES_UNDERLOCKED = 252,
|
WRES_UNDERLOCKED = 252, //Resource was released too many times.
|
||||||
//Resource was released too many times.
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ENUM_RETRIEVE_STYLE
|
enum ENUM_RETRIEVE_STYLE
|
||||||
{
|
{
|
||||||
RETRIEVE_EXISTING, //Only returns a resource if it already exists. Does not lock or unlock.
|
RETRIEVE_EXISTING, //Only returns a resource if it already exists. Does not lock or unlock.
|
||||||
RETRIEVE_NORMAL, //Returns or creates a resource. Does not change lock status.
|
RETRIEVE_NORMAL, //Returns or creates a resource. Does not change lock status.
|
||||||
RETRIEVE_LOCK, //As above, locks cached resource. Not for quads.
|
RETRIEVE_LOCK, //As above, locks cached resource. Not for quads.
|
||||||
RETRIEVE_UNLOCK, //As above, unlocks cached resource. Not for quads.
|
RETRIEVE_UNLOCK, //As above, unlocks cached resource. Not for quads.
|
||||||
RETRIEVE_RESOURCE, //Only retrieves a managed resource. Does not make a new one.
|
RETRIEVE_RESOURCE, //Only retrieves a managed resource. Does not make a new one.
|
||||||
RETRIEVE_MANAGE, //Makes resource permanent.
|
RETRIEVE_MANAGE, //Makes resource permanent.
|
||||||
RETRIEVE_THUMB, //Retrieve it as a thumbnail.
|
RETRIEVE_THUMB, //Retrieve it as a thumbnail.
|
||||||
CACHE_THUMB = RETRIEVE_THUMB,
|
CACHE_THUMB = RETRIEVE_THUMB, //Backwards compatibility.
|
||||||
//Backwords compatibility.
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ENUM_CACHE_SUBTYPE
|
enum ENUM_CACHE_SUBTYPE
|
||||||
{
|
{
|
||||||
CACHE_NORMAL = (1 << 0), //Use default values. Not really a flag.
|
CACHE_NORMAL = (1<<0), //Use default values. Not really a flag.
|
||||||
CACHE_EXISTING = (1 << 1), //Retrieve it only if it already exists
|
CACHE_EXISTING = (1<<1), //Retrieve it only if it already exists
|
||||||
|
|
||||||
//Because these bits only modify how a cached resource's Attempt() is called,
|
//Because these bits only modify how a cached resource's Attempt() is called,
|
||||||
//We can use them over and over for each resource type.
|
//We can use them over and over for each resource type.
|
||||||
TEXTURE_SUB_EXACT = (1 << 2), //Don't do any fiddling with the filename.
|
TEXTURE_SUB_EXACT = (1<<2), //Don't do any fiddling with the filename.
|
||||||
TEXTURE_SUB_CARD = (1 << 3), //Retrieve using cardFile, not graphicsFile.
|
TEXTURE_SUB_CARD = (1<<3), //Retrieve using cardFile, not graphicsFile.
|
||||||
TEXTURE_SUB_AVATAR = (1 << 4), //Retrieve using avatarFile, not graphicsFile.
|
TEXTURE_SUB_AVATAR = (1<<4), //Retrieve using avatarFile, not graphicsFile.
|
||||||
TEXTURE_SUB_THUMB = (1 << 5),//Retrieve prepending "thumbnails\" to the filename.
|
TEXTURE_SUB_THUMB = (1<<5), //Retrieve prepending "thumbnails\" to the filename.
|
||||||
TEXTURE_SUB_5551 = (1 << 6),
|
TEXTURE_SUB_5551 = (1<<6), //For textures. If we have to allocate, use RGBA5551.
|
||||||
//For textures. If we have to allocate, use RGBA5551.
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -73,8 +73,8 @@ enum ENUM_CACHE_ERROR
|
|||||||
CACHE_ERROR_NONE = 0,
|
CACHE_ERROR_NONE = 0,
|
||||||
CACHE_ERROR_NOT_CACHED = CACHE_ERROR_NONE,
|
CACHE_ERROR_NOT_CACHED = CACHE_ERROR_NONE,
|
||||||
CACHE_ERROR_404,
|
CACHE_ERROR_404,
|
||||||
CACHE_ERROR_BAD, //Something went wrong with item->attempt()
|
CACHE_ERROR_BAD, //Something went wrong with item->attempt()
|
||||||
CACHE_ERROR_BAD_ALLOC, //Couldn't allocate item
|
CACHE_ERROR_BAD_ALLOC, //Couldn't allocate item
|
||||||
CACHE_ERROR_LOST,
|
CACHE_ERROR_LOST,
|
||||||
CACHE_ERROR_NOT_MANAGED,
|
CACHE_ERROR_NOT_MANAGED,
|
||||||
};
|
};
|
||||||
@@ -84,7 +84,7 @@ struct WCacheSort
|
|||||||
bool operator()(const WResource * l, const WResource * r); //Predicate for use in sorting. See flatten().
|
bool operator()(const WResource * l, const WResource * r); //Predicate for use in sorting. See flatten().
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class cacheItem, class cacheActual>
|
template <class cacheItem, class cacheActual>
|
||||||
class WCache
|
class WCache
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -93,13 +93,13 @@ public:
|
|||||||
WCache();
|
WCache();
|
||||||
~WCache();
|
~WCache();
|
||||||
|
|
||||||
cacheItem* Retrieve(int id, const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL); //Primary interface function.
|
cacheItem* Retrieve(int id, const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL); //Primary interface function.
|
||||||
bool Release(cacheActual* actual); //Releases an item, and deletes it if unlocked.
|
bool Release(cacheActual* actual); //Releases an item, and deletes it if unlocked.
|
||||||
bool RemoveMiss(int id = 0); //Removes a cache miss.
|
bool RemoveMiss(int id=0); //Removes a cache miss.
|
||||||
bool RemoveOldest(); //Remove oldest unlocked item.
|
bool RemoveOldest(); //Remove oldest unlocked item.
|
||||||
bool Cleanup(); //Repeats RemoveOldest() until cache fits in size limits
|
bool Cleanup(); //Repeats RemoveOldest() until cache fits in size limits
|
||||||
void ClearUnlocked(); //Remove all unlocked items.
|
void ClearUnlocked(); //Remove all unlocked items.
|
||||||
void Refresh(); //Refreshes all cache items.
|
void Refresh(); //Refreshes all cache items.
|
||||||
unsigned int Flatten(); //Ensures that the times don't loop. Returns new lastTime.
|
unsigned int Flatten(); //Ensures that the times don't loop. Returns new lastTime.
|
||||||
void Resize(unsigned long size, int items); //Sets new limits, then enforces them. Lock safe, so not a "hard limit".
|
void Resize(unsigned long size, int items); //Sets new limits, then enforces them. Lock safe, so not a "hard limit".
|
||||||
protected:
|
protected:
|
||||||
@@ -127,12 +127,11 @@ protected:
|
|||||||
|
|
||||||
struct WManagedQuad
|
struct WManagedQuad
|
||||||
{
|
{
|
||||||
WCachedTexture * texture;
|
WCachedTexture* texture;
|
||||||
string resname;
|
string resname;
|
||||||
};
|
};
|
||||||
|
|
||||||
//This class is a wrapper for JResourceManager
|
class WResourceManager
|
||||||
class WResourceManager: public JResourceManager
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static WResourceManager* Instance()
|
static WResourceManager* Instance()
|
||||||
@@ -154,11 +153,11 @@ public:
|
|||||||
virtual ~WResourceManager();
|
virtual ~WResourceManager();
|
||||||
|
|
||||||
void Unmiss(string filename);
|
void Unmiss(string filename);
|
||||||
JQuad * RetrieveCard(MTGCard * card, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL);
|
JQuadPtr RetrieveCard(MTGCard * card, int style = RETRIEVE_NORMAL,int submode = CACHE_NORMAL);
|
||||||
JSample * RetrieveSample(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL);
|
JSample * RetrieveSample(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL);
|
||||||
JTexture * RetrieveTexture(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL);
|
JTexture * RetrieveTexture(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL);
|
||||||
JQuad * RetrieveQuad(const string& filename, float offX = 0.0f, float offY = 0.0f, float width = 0.0f, float height = 0.0f, string resname = "", int style = RETRIEVE_LOCK, int submode = CACHE_NORMAL, int id = 0);
|
JQuadPtr RetrieveQuad(const string& filename, float offX=0.0f, float offY=0.0f, float width=0.0f, float height=0.0f, string resname="", int style = RETRIEVE_LOCK, int submode = CACHE_NORMAL, int id = 0);
|
||||||
JQuad * RetrieveTempQuad(const string& filename, int submode = CACHE_NORMAL);
|
JQuadPtr RetrieveTempQuad(const string& filename, int submode = CACHE_NORMAL);
|
||||||
hgeParticleSystemInfo * RetrievePSI(const string& filename, JQuad * texture, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL);
|
hgeParticleSystemInfo * RetrievePSI(const string& filename, JQuad * texture, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL);
|
||||||
int RetrieveError();
|
int RetrieveError();
|
||||||
|
|
||||||
@@ -166,9 +165,8 @@ public:
|
|||||||
void Release(JSample * sample);
|
void Release(JSample * sample);
|
||||||
bool RemoveOldest();
|
bool RemoveOldest();
|
||||||
|
|
||||||
bool Cleanup(); //Force a cleanup. Return false if nothing removed.
|
|
||||||
void ClearUnlocked(); //Remove unlocked items.
|
void ClearUnlocked(); //Remove unlocked items.
|
||||||
void Refresh(); //Refreshes all files in cache, for when mode/profile changes.
|
void Refresh(); //Refreshes all files in cache, for when mode/profile changes.
|
||||||
|
|
||||||
unsigned int nowTime();
|
unsigned int nowTime();
|
||||||
|
|
||||||
@@ -181,8 +179,8 @@ public:
|
|||||||
unsigned int CountManaged();
|
unsigned int CountManaged();
|
||||||
|
|
||||||
int CreateQuad(const string &quadName, const string &textureName, float x, float y, float width, float height);
|
int CreateQuad(const string &quadName, const string &textureName, float x, float y, float width, float height);
|
||||||
JQuad* GetQuad(const string &quadName);
|
JQuadPtr GetQuad(const string &quadName);
|
||||||
JQuad* GetQuad(int id);
|
JQuadPtr GetQuad(int id);
|
||||||
|
|
||||||
int AddQuadToManaged(const WManagedQuad& inManagedQuad);
|
int AddQuadToManaged(const WManagedQuad& inManagedQuad);
|
||||||
|
|
||||||
@@ -222,17 +220,17 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
/*
|
/*
|
||||||
** Singleton object only accessibly via Instance(), constructor is private
|
** Singleton object only accessibly via Instance(), constructor is private
|
||||||
*/
|
*/
|
||||||
WResourceManager();
|
WResourceManager();
|
||||||
|
|
||||||
bool bThemedCards; //Does the theme have a "sets" directory for overwriting cards?
|
bool bThemedCards; //Does the theme have a "sets" directory for overwriting cards?
|
||||||
void FlattenTimes(); //To prevent bad cache timing on int overflow
|
void FlattenTimes(); //To prevent bad cache timing on int overflow
|
||||||
|
|
||||||
//For cached stuff
|
//For cached stuff
|
||||||
WCache<WCachedTexture, JTexture> textureWCache;
|
WCache<WCachedTexture,JTexture> textureWCache;
|
||||||
WCache<WCachedSample, JSample> sampleWCache;
|
WCache<WCachedSample,JSample> sampleWCache;
|
||||||
WCache<WCachedParticles, hgeParticleSystemInfo> psiWCache;
|
WCache<WCachedParticles,hgeParticleSystemInfo> psiWCache;
|
||||||
|
|
||||||
typedef std::map<std::string, WManagedQuad> ManagedQuadMap;
|
typedef std::map<std::string, WManagedQuad> ManagedQuadMap;
|
||||||
ManagedQuadMap mManagedQuads;
|
ManagedQuadMap mManagedQuads;
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
#ifndef WRESOURCE_FWD_H
|
||||||
|
#define WRESOURCE_FWD_H
|
||||||
|
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
|
|
||||||
|
typedef boost::shared_ptr<JQuad> JQuadPtr;
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -1275,9 +1275,7 @@ AIPlayerBaka::AIPlayerBaka(MTGDeck * deck, string file, string fileSmall, string
|
|||||||
|
|
||||||
if (mAvatarTex)
|
if (mAvatarTex)
|
||||||
mAvatar = WResourceManager::Instance()->RetrieveQuad(avatarFile, 0, 0, 35, 50, "bakaAvatar", RETRIEVE_NORMAL,
|
mAvatar = WResourceManager::Instance()->RetrieveQuad(avatarFile, 0, 0, 35, 50, "bakaAvatar", RETRIEVE_NORMAL,
|
||||||
TEXTURE_SUB_AVATAR);
|
TEXTURE_SUB_AVATAR);
|
||||||
else
|
|
||||||
mAvatar = NULL;
|
|
||||||
|
|
||||||
initTimer();
|
initTimer();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,14 +96,14 @@ void Interruptible::Render(MTGCardInstance * source, JQuad * targetQuad, string
|
|||||||
|
|
||||||
mFont->DrawString(_(action).c_str(), x + 35, y + GetVerticalTextOffset(), JGETEXT_LEFT);
|
mFont->DrawString(_(action).c_str(), x + 35, y + GetVerticalTextOffset(), JGETEXT_LEFT);
|
||||||
JRenderer * renderer = JRenderer::GetInstance();
|
JRenderer * renderer = JRenderer::GetInstance();
|
||||||
JQuad * quad = WResourceManager::Instance()->RetrieveCard(source, CACHE_THUMB);
|
JQuadPtr quad = WResourceManager::Instance()->RetrieveCard(source, CACHE_THUMB);
|
||||||
if (!quad)
|
if (!quad.get())
|
||||||
quad = CardGui::AlternateThumbQuad(source);
|
quad = CardGui::AlternateThumbQuad(source);
|
||||||
if (quad)
|
if (quad.get())
|
||||||
{
|
{
|
||||||
quad->SetColor(ARGB(255,255,255,255));
|
quad->SetColor(ARGB(255,255,255,255));
|
||||||
float scale = mHeight / quad->mHeight;
|
float scale = mHeight / quad->mHeight;
|
||||||
renderer->RenderQuad(quad, x + (quad->mWidth * scale / 2), y + (quad->mHeight * scale / 2), 0, scale, scale);
|
renderer->RenderQuad(quad.get(), x + (quad->mWidth * scale / 2), y + (quad->mHeight * scale / 2), 0, scale, scale);
|
||||||
}
|
}
|
||||||
else if (alt1.size())
|
else if (alt1.size())
|
||||||
{
|
{
|
||||||
@@ -157,7 +157,7 @@ void StackAbility::Render()
|
|||||||
target = (Damageable *) _target;
|
target = (Damageable *) _target;
|
||||||
}
|
}
|
||||||
|
|
||||||
JQuad * quad = NULL;
|
JQuadPtr quad;
|
||||||
string alt2 = "";
|
string alt2 = "";
|
||||||
if (target)
|
if (target)
|
||||||
{
|
{
|
||||||
@@ -168,7 +168,7 @@ void StackAbility::Render()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Interruptible::Render(source, quad, alt1, alt2, action);
|
Interruptible::Render(source, quad.get(), alt1, alt2, action);
|
||||||
}
|
}
|
||||||
StackAbility::StackAbility(int id, MTGAbility * _ability) :
|
StackAbility::StackAbility(int id, MTGAbility * _ability) :
|
||||||
Interruptible(id), ability(_ability)
|
Interruptible(id), ability(_ability)
|
||||||
@@ -220,8 +220,7 @@ Interruptible(id), tc(tc), cost(_cost), payResult(payResult)
|
|||||||
int Spell::computeX(MTGCardInstance * card)
|
int Spell::computeX(MTGCardInstance * card)
|
||||||
{
|
{
|
||||||
ManaCost * c = cost->Diff(card->getManaCost());
|
ManaCost * c = cost->Diff(card->getManaCost());
|
||||||
int x = 0;
|
int x = c->getCost(Constants::MTG_NB_COLORS);
|
||||||
x = c->getCost(Constants::MTG_NB_COLORS);
|
|
||||||
delete c;
|
delete c;
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
@@ -229,8 +228,7 @@ int Spell::computeX(MTGCardInstance * card)
|
|||||||
int Spell::computeXX(MTGCardInstance * card)
|
int Spell::computeXX(MTGCardInstance * card)
|
||||||
{
|
{
|
||||||
ManaCost * c = cost->Diff(card->getManaCost());
|
ManaCost * c = cost->Diff(card->getManaCost());
|
||||||
int xx = 0;
|
int xx = c->getCost(Constants::MTG_NB_COLORS) / 2;
|
||||||
xx = c->getCost(Constants::MTG_NB_COLORS) / 2;
|
|
||||||
delete c;
|
delete c;
|
||||||
return xx;
|
return xx;
|
||||||
}
|
}
|
||||||
@@ -351,9 +349,9 @@ void Spell::Render()
|
|||||||
string action = source->getName();
|
string action = source->getName();
|
||||||
string alt1 = "";
|
string alt1 = "";
|
||||||
|
|
||||||
JQuad * quad = NULL;
|
|
||||||
string alt2 = "";
|
string alt2 = "";
|
||||||
Damageable * target = getNextDamageableTarget();
|
Damageable * target = getNextDamageableTarget();
|
||||||
|
JQuadPtr quad;
|
||||||
if (target)
|
if (target)
|
||||||
{
|
{
|
||||||
quad = target->getIcon();
|
quad = target->getIcon();
|
||||||
@@ -362,7 +360,7 @@ void Spell::Render()
|
|||||||
alt2 = ((MTGCardInstance *) target)->name;
|
alt2 = ((MTGCardInstance *) target)->name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Interruptible::Render(source, quad, alt1, alt2, action, true);
|
Interruptible::Render(source, quad.get(), alt1, alt2, action, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
ostream& Spell::toString(ostream& out) const
|
ostream& Spell::toString(ostream& out) const
|
||||||
@@ -407,12 +405,12 @@ void PutInGraveyard::Render()
|
|||||||
mFont->DrawString(_("is exiled").c_str(), x + 30, y, JGETEXT_LEFT);
|
mFont->DrawString(_("is exiled").c_str(), x + 30, y, JGETEXT_LEFT);
|
||||||
}
|
}
|
||||||
JRenderer * renderer = JRenderer::GetInstance();
|
JRenderer * renderer = JRenderer::GetInstance();
|
||||||
JQuad * quad = WResourceManager::Instance()->RetrieveCard(card, CACHE_THUMB);
|
JQuadPtr quad = WResourceManager::Instance()->RetrieveCard(card, CACHE_THUMB);
|
||||||
if (quad)
|
if (quad.get())
|
||||||
{
|
{
|
||||||
quad->SetColor(ARGB(255,255,255,255));
|
quad->SetColor(ARGB(255,255,255,255));
|
||||||
float scale = 30 / quad->mHeight;
|
float scale = 30 / quad->mHeight;
|
||||||
renderer->RenderQuad(quad, x, y, 0, scale, scale);
|
renderer->RenderQuad(quad.get(), x, y, 0, scale, scale);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1117,21 +1115,21 @@ void ActionStack::Render()
|
|||||||
static const float kIconVerticalOffset = 24;
|
static const float kIconVerticalOffset = 24;
|
||||||
if (mCount > 1)
|
if (mCount > 1)
|
||||||
{
|
{
|
||||||
renderer->RenderQuad(pspIcons[7], x0 + 10, kIconVerticalOffset, 0, kGamepadIconSize, kGamepadIconSize);
|
renderer->RenderQuad(pspIcons[7].get(), x0 + 10, kIconVerticalOffset, 0, kGamepadIconSize, kGamepadIconSize);
|
||||||
mFont->DrawString(kInterruptString, x0 + 19, kIconVerticalOffset - 6);
|
mFont->DrawString(kInterruptString, x0 + 19, kIconVerticalOffset - 6);
|
||||||
|
|
||||||
renderer->RenderQuad(pspIcons[4], x0 + 97, kIconVerticalOffset, 0, kGamepadIconSize, kGamepadIconSize);
|
renderer->RenderQuad(pspIcons[4].get(), x0 + 97, kIconVerticalOffset, 0, kGamepadIconSize, kGamepadIconSize);
|
||||||
mFont->DrawString(kNoString, x0 + 106, kIconVerticalOffset - 6);
|
mFont->DrawString(kNoString, x0 + 106, kIconVerticalOffset - 6);
|
||||||
|
|
||||||
renderer->RenderQuad(pspIcons[6], x0 + 145, kIconVerticalOffset, 0, kGamepadIconSize, kGamepadIconSize);
|
renderer->RenderQuad(pspIcons[6].get(), x0 + 145, kIconVerticalOffset, 0, kGamepadIconSize, kGamepadIconSize);
|
||||||
mFont->DrawString(kNoToAllString, x0 + 154, kIconVerticalOffset - 6);
|
mFont->DrawString(kNoToAllString, x0 + 154, kIconVerticalOffset - 6);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
renderer->RenderQuad(pspIcons[7], x0 + 40, kIconVerticalOffset, 0, kGamepadIconSize, kGamepadIconSize);
|
renderer->RenderQuad(pspIcons[7].get(), x0 + 40, kIconVerticalOffset, 0, kGamepadIconSize, kGamepadIconSize);
|
||||||
mFont->DrawString(kInterruptString, x0 + 49, kIconVerticalOffset - 6);
|
mFont->DrawString(kInterruptString, x0 + 49, kIconVerticalOffset - 6);
|
||||||
|
|
||||||
renderer->RenderQuad(pspIcons[4], x0 + 140, kIconVerticalOffset - 6, 0, kGamepadIconSize, kGamepadIconSize);
|
renderer->RenderQuad(pspIcons[4].get(), x0 + 140, kIconVerticalOffset - 6, 0, kGamepadIconSize, kGamepadIconSize);
|
||||||
mFont->DrawString(kNoString, x0 + 146, kIconVerticalOffset - 6);
|
mFont->DrawString(kNoString, x0 + 146, kIconVerticalOffset - 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -140,13 +140,14 @@ void CardGui::Render()
|
|||||||
tc = game->getCurrentTargetChooser();
|
tc = game->getCurrentTargetChooser();
|
||||||
|
|
||||||
bool alternate = true;
|
bool alternate = true;
|
||||||
JQuad * quad = WResourceManager::Instance()->RetrieveCard(card, CACHE_THUMB);
|
JQuadPtr quad = WResourceManager::Instance()->RetrieveCard(card, CACHE_THUMB);
|
||||||
|
|
||||||
#if defined (WIN32) || defined (LINUX)
|
#if defined (WIN32) || defined (LINUX)
|
||||||
//On pcs we render the big image if the thumbnail is not available
|
//On pcs we render the big image if the thumbnail is not available
|
||||||
if (!quad) quad = WResourceManager::Instance()->RetrieveCard(card);
|
if (!quad.get())
|
||||||
|
quad = WResourceManager::Instance()->RetrieveCard(card);
|
||||||
#endif
|
#endif
|
||||||
if (quad)
|
if (quad.get())
|
||||||
alternate = false;
|
alternate = false;
|
||||||
else
|
else
|
||||||
quad = AlternateThumbQuad(card);
|
quad = AlternateThumbQuad(card);
|
||||||
@@ -154,24 +155,26 @@ void CardGui::Render()
|
|||||||
float cardScale = quad ? 40 / quad->mHeight : 1;
|
float cardScale = quad ? 40 / quad->mHeight : 1;
|
||||||
float scale = actZ * cardScale;
|
float scale = actZ * cardScale;
|
||||||
|
|
||||||
JQuad* shadow = NULL;
|
JQuadPtr shadow;
|
||||||
if (actZ > 1)
|
if (actZ > 1)
|
||||||
{
|
{
|
||||||
shadow = WResourceManager::Instance()->GetQuad("shadow");
|
shadow = WResourceManager::Instance()->GetQuad("shadow");
|
||||||
shadow->SetColor(ARGB(static_cast<unsigned char>(actA)/2,255,255,255));
|
shadow->SetColor(ARGB(static_cast<unsigned char>(actA)/2,255,255,255));
|
||||||
renderer->RenderQuad(shadow, actX + (actZ - 1) * 15, actY + (actZ - 1) * 15, actT, 28 * actZ / 16, 40 * actZ / 16);
|
renderer->RenderQuad(shadow.get(), actX + (actZ - 1) * 15, actY + (actZ - 1) * 15, actT, 28 * actZ / 16, 40 * actZ / 16);
|
||||||
}
|
}
|
||||||
JQuad* extracostshadow = NULL;
|
|
||||||
if(card->isExtraCostTarget )
|
JQuadPtr extracostshadow;
|
||||||
|
if (card->isExtraCostTarget)
|
||||||
{
|
{
|
||||||
extracostshadow = WResourceManager::Instance()->GetQuad("extracostshadow");
|
extracostshadow = WResourceManager::Instance()->GetQuad("extracostshadow");
|
||||||
extracostshadow->SetColor(ARGB(static_cast<unsigned char>(actA)/2,100,0,0));
|
extracostshadow->SetColor(ARGB(static_cast<unsigned char>(actA)/2,100,0,0));
|
||||||
renderer->RenderQuad(extracostshadow, actX + (actZ - 1) * 15, actY + (actZ - 1) * 15, actT, 28 * actZ / 16, 40 * actZ / 16);
|
renderer->RenderQuad(extracostshadow.get(), actX + (actZ - 1) * 15, actY + (actZ - 1) * 15, actT, 28 * actZ / 16, 40 * actZ / 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (quad)
|
if (quad)
|
||||||
{
|
{
|
||||||
quad->SetColor(ARGB(static_cast<unsigned char>(actA),255,255,255));
|
quad->SetColor(ARGB(static_cast<unsigned char>(actA),255,255,255));
|
||||||
renderer->RenderQuad(quad, actX, actY, actT, scale, scale);
|
renderer->RenderQuad(quad.get(), actX, actY, actT, scale, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (alternate)
|
if (alternate)
|
||||||
@@ -181,7 +184,7 @@ void CardGui::Render()
|
|||||||
mFont->DrawString(_(card->getName()), actX - actZ * Width / 2 + 1, actY - actZ * Height / 2 + 1);
|
mFont->DrawString(_(card->getName()), actX - actZ * Width / 2 + 1, actY - actZ * Height / 2 + 1);
|
||||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
||||||
|
|
||||||
JQuad * icon = NULL;
|
JQuadPtr icon;
|
||||||
if (card->hasSubtype("plains"))
|
if (card->hasSubtype("plains"))
|
||||||
icon = WResourceManager::Instance()->GetQuad("c_white");
|
icon = WResourceManager::Instance()->GetQuad("c_white");
|
||||||
else if (card->hasSubtype("swamp"))
|
else if (card->hasSubtype("swamp"))
|
||||||
@@ -192,21 +195,21 @@ void CardGui::Render()
|
|||||||
icon = WResourceManager::Instance()->GetQuad("c_red");
|
icon = WResourceManager::Instance()->GetQuad("c_red");
|
||||||
else if (card->hasSubtype("island"))
|
else if (card->hasSubtype("island"))
|
||||||
icon = WResourceManager::Instance()->GetQuad("c_blue");
|
icon = WResourceManager::Instance()->GetQuad("c_blue");
|
||||||
|
|
||||||
if (icon)
|
if (icon.get())
|
||||||
{
|
{
|
||||||
icon->SetColor(ARGB(static_cast<unsigned char>(actA),255,255,255));
|
icon->SetColor(ARGB(static_cast<unsigned char>(actA),255,255,255));
|
||||||
renderer->RenderQuad(icon, actX, actY, 0);
|
renderer->RenderQuad(icon.get(), actX, actY, 0);
|
||||||
icon->SetColor(ARGB(255,255,255,255)); //Putting color back as this quad is shared
|
icon->SetColor(ARGB(255,255,255,255)); //Putting color back as this quad is shared
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
JQuad * mor = NULL;
|
JQuadPtr mor;
|
||||||
if(card->isMorphed && !alternate)
|
if(card->isMorphed && !alternate)
|
||||||
{
|
{
|
||||||
mor = WResourceManager::Instance()->GetQuad("morph");
|
mor = WResourceManager::Instance()->GetQuad("morph");
|
||||||
mor->SetColor(ARGB(255,255,255,255));
|
mor->SetColor(ARGB(255,255,255,255));
|
||||||
renderer->RenderQuad(mor, actX, actY, actT,scale, scale);
|
renderer->RenderQuad(mor.get(), actX, actY, actT,scale, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
//draws the numbers power/toughness
|
//draws the numbers power/toughness
|
||||||
@@ -249,14 +252,15 @@ void CardGui::Render()
|
|||||||
if (!shadow)
|
if (!shadow)
|
||||||
shadow = WResourceManager::Instance()->GetQuad("shadow");
|
shadow = WResourceManager::Instance()->GetQuad("shadow");
|
||||||
shadow->SetColor(ARGB(200,255,255,255));
|
shadow->SetColor(ARGB(200,255,255,255));
|
||||||
renderer->RenderQuad(shadow, actX, actY, actT, (28 * actZ + 1) / 16, 40 * actZ / 16);
|
renderer->RenderQuad(shadow.get(), actX, actY, actT, (28 * actZ + 1) / 16, 40 * actZ / 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayGuiObject::Render();
|
PlayGuiObject::Render();
|
||||||
}
|
}
|
||||||
|
|
||||||
JQuad * CardGui::AlternateThumbQuad(MTGCard * card)
|
JQuadPtr CardGui::AlternateThumbQuad(MTGCard * card)
|
||||||
{
|
{
|
||||||
JQuad * q;
|
JQuadPtr q;
|
||||||
|
|
||||||
if (card->data->countColors() > 1)
|
if (card->data->countColors() > 1)
|
||||||
{
|
{
|
||||||
@@ -301,7 +305,7 @@ void CardGui::AlternateRender(MTGCard * card, const Pos& pos)
|
|||||||
{
|
{
|
||||||
// Draw the "unknown" card model
|
// Draw the "unknown" card model
|
||||||
JRenderer * renderer = JRenderer::GetInstance();
|
JRenderer * renderer = JRenderer::GetInstance();
|
||||||
JQuad * q;
|
JQuadPtr q;
|
||||||
|
|
||||||
float x = pos.actX;
|
float x = pos.actX;
|
||||||
|
|
||||||
@@ -339,13 +343,13 @@ void CardGui::AlternateRender(MTGCard * card, const Pos& pos)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (q && q->mTex)
|
if (q.get() && q->mTex)
|
||||||
{
|
{
|
||||||
q->SetHotSpot(static_cast<float> (q->mTex->mWidth / 2), static_cast<float> (q->mTex->mHeight / 2));
|
q->SetHotSpot(static_cast<float> (q->mTex->mWidth / 2), static_cast<float> (q->mTex->mHeight / 2));
|
||||||
|
|
||||||
float scale = pos.actZ * 250 / q->mHeight;
|
float scale = pos.actZ * 250 / q->mHeight;
|
||||||
q->SetColor(ARGB((int)pos.actA,255,255,255));
|
q->SetColor(ARGB((int)pos.actA,255,255,255));
|
||||||
renderer->RenderQuad(q, x, pos.actY, pos.actT, scale, scale);
|
renderer->RenderQuad(q.get(), x, pos.actY, pos.actT, scale, scale);
|
||||||
}
|
}
|
||||||
// Write the title
|
// Write the title
|
||||||
WFont * font = WResourceManager::Instance()->GetWFont(Fonts::MAGIC_FONT);
|
WFont * font = WResourceManager::Instance()->GetWFont(Fonts::MAGIC_FONT);
|
||||||
@@ -395,19 +399,19 @@ void CardGui::AlternateRender(MTGCard * card, const Pos& pos)
|
|||||||
|
|
||||||
if (scale < 0)
|
if (scale < 0)
|
||||||
{
|
{
|
||||||
renderer->RenderQuad(manaIcons[h->color1], x + (-12 * j + 75 + 3 * SineHelperFunction((float) t)) * pos.actZ,
|
renderer->RenderQuad(manaIcons[h->color1].get(), x + (-12 * j + 75 + 3 * SineHelperFunction((float) t)) * pos.actZ,
|
||||||
pos.actY + (yOffset + 3 * CosineHelperFunction((float) t)) * pos.actZ, 0, 0.4f + scale, 0.4f
|
pos.actY + (yOffset + 3 * CosineHelperFunction((float) t)) * pos.actZ, 0, 0.4f + scale, 0.4f
|
||||||
+ scale);
|
+ scale);
|
||||||
renderer->RenderQuad(manaIcons[h->color2], x + (-12 * j + 75 + 3 * SineHelperFunction((float) v)) * pos.actZ,
|
renderer->RenderQuad(manaIcons[h->color2].get(), x + (-12 * j + 75 + 3 * SineHelperFunction((float) v)) * pos.actZ,
|
||||||
pos.actY + (yOffset + 3 * CosineHelperFunction((float) v)) * pos.actZ, 0, 0.4f - scale, 0.4f
|
pos.actY + (yOffset + 3 * CosineHelperFunction((float) v)) * pos.actZ, 0, 0.4f - scale, 0.4f
|
||||||
- scale);
|
- scale);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
renderer->RenderQuad(manaIcons[h->color2], x + (-12 * j + 75 + 3 * SineHelperFunction((float) v)) * pos.actZ,
|
renderer->RenderQuad(manaIcons[h->color2].get(), x + (-12 * j + 75 + 3 * SineHelperFunction((float) v)) * pos.actZ,
|
||||||
pos.actY + (yOffset + 3 * CosineHelperFunction((float) v)) * pos.actZ, 0, 0.4f - scale, 0.4f
|
pos.actY + (yOffset + 3 * CosineHelperFunction((float) v)) * pos.actZ, 0, 0.4f - scale, 0.4f
|
||||||
- scale);
|
- scale);
|
||||||
renderer->RenderQuad(manaIcons[h->color1], x + (-12 * j + 75 + 3 * SineHelperFunction((float) t)) * pos.actZ,
|
renderer->RenderQuad(manaIcons[h->color1].get(), x + (-12 * j + 75 + 3 * SineHelperFunction((float) t)) * pos.actZ,
|
||||||
pos.actY + (yOffset + 3 * CosineHelperFunction((float) t)) * pos.actZ, 0, 0.4f + scale, 0.4f
|
pos.actY + (yOffset + 3 * CosineHelperFunction((float) t)) * pos.actZ, 0, 0.4f + scale, 0.4f
|
||||||
+ scale);
|
+ scale);
|
||||||
}
|
}
|
||||||
@@ -417,7 +421,7 @@ void CardGui::AlternateRender(MTGCard * card, const Pos& pos)
|
|||||||
{
|
{
|
||||||
for (int cost = manacost->getCost(i); cost > 0; --cost)
|
for (int cost = manacost->getCost(i); cost > 0; --cost)
|
||||||
{
|
{
|
||||||
renderer->RenderQuad(manaIcons[i], x + (-12 * j + 75) * pos.actZ, pos.actY + (yOffset) * pos.actZ, 0, 0.4f
|
renderer->RenderQuad(manaIcons[i].get(), x + (-12 * j + 75) * pos.actZ, pos.actY + (yOffset) * pos.actZ, 0, 0.4f
|
||||||
* pos.actZ, 0.4f * pos.actZ);
|
* pos.actZ, 0.4f * pos.actZ);
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
@@ -427,7 +431,7 @@ void CardGui::AlternateRender(MTGCard * card, const Pos& pos)
|
|||||||
{
|
{
|
||||||
char buffer[10];
|
char buffer[10];
|
||||||
sprintf(buffer, "%d", cost);
|
sprintf(buffer, "%d", cost);
|
||||||
renderer->RenderQuad(manaIcons[0], x + (-12 * j + 75) * pos.actZ, pos.actY + (yOffset) * pos.actZ, 0, 0.4f * pos.actZ,
|
renderer->RenderQuad(manaIcons[0].get(), x + (-12 * j + 75) * pos.actZ, pos.actY + (yOffset) * pos.actZ, 0, 0.4f * pos.actZ,
|
||||||
0.4f * pos.actZ);
|
0.4f * pos.actZ);
|
||||||
float w = font->GetStringWidth(buffer);
|
float w = font->GetStringWidth(buffer);
|
||||||
font->DrawString(buffer, x + (-12 * j + 76 - w / 2) * pos.actZ, pos.actY + (yOffset - 5) * pos.actZ);
|
font->DrawString(buffer, x + (-12 * j + 76 - w / 2) * pos.actZ, pos.actY + (yOffset - 5) * pos.actZ);
|
||||||
@@ -438,7 +442,7 @@ void CardGui::AlternateRender(MTGCard * card, const Pos& pos)
|
|||||||
{
|
{
|
||||||
char buffer[10];
|
char buffer[10];
|
||||||
sprintf(buffer, "X");
|
sprintf(buffer, "X");
|
||||||
renderer->RenderQuad(manaIcons[0], x + (-12 * j + 75) * pos.actZ, pos.actY + (yOffset) * pos.actZ, 0, 0.4f * pos.actZ,
|
renderer->RenderQuad(manaIcons[0].get(), x + (-12 * j + 75) * pos.actZ, pos.actY + (yOffset) * pos.actZ, 0, 0.4f * pos.actZ,
|
||||||
0.4f * pos.actZ);
|
0.4f * pos.actZ);
|
||||||
float w = font->GetStringWidth(buffer);
|
float w = font->GetStringWidth(buffer);
|
||||||
font->DrawString(buffer, x + (-12 * j + 76 - w / 2) * pos.actZ, pos.actY + (yOffset - 5) * pos.actZ);
|
font->DrawString(buffer, x + (-12 * j + 76 - w / 2) * pos.actZ, pos.actY + (yOffset - 5) * pos.actZ);
|
||||||
@@ -522,12 +526,11 @@ font->SetScale(backup_scale);
|
|||||||
|
|
||||||
void CardGui::TinyCropRender(MTGCard * card, const Pos& pos, JQuad * quad)
|
void CardGui::TinyCropRender(MTGCard * card, const Pos& pos, JQuad * quad)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!quad)
|
if (!quad)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
JRenderer * renderer = JRenderer::GetInstance();
|
JRenderer * renderer = JRenderer::GetInstance();
|
||||||
JQuad * q;
|
JQuadPtr q;
|
||||||
|
|
||||||
float x = pos.actX;
|
float x = pos.actX;
|
||||||
float displayScale = 250 / BigHeight;
|
float displayScale = 250 / BigHeight;
|
||||||
@@ -566,14 +569,13 @@ void CardGui::TinyCropRender(MTGCard * card, const Pos& pos, JQuad * quad)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (q.get() && q->mTex)
|
||||||
if (q && q->mTex)
|
|
||||||
{
|
{
|
||||||
q->SetHotSpot(static_cast<float> (q->mTex->mWidth / 2), static_cast<float> (q->mTex->mHeight / 2));
|
q->SetHotSpot(static_cast<float> (q->mTex->mWidth / 2), static_cast<float> (q->mTex->mHeight / 2));
|
||||||
|
|
||||||
float scale = pos.actZ * displayScale * BigHeight / q->mHeight;
|
float scale = pos.actZ * displayScale * BigHeight / q->mHeight;
|
||||||
q->SetColor(ARGB((int)pos.actA,255,255,255));
|
q->SetColor(ARGB((int)pos.actA,255,255,255));
|
||||||
renderer->RenderQuad(q, x, pos.actY, pos.actT, scale, scale);
|
renderer->RenderQuad(q.get(), x, pos.actY, pos.actT, scale, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<string> txt = card->data->formattedText();
|
const std::vector<string> txt = card->data->formattedText();
|
||||||
@@ -638,21 +640,21 @@ void CardGui::TinyCropRender(MTGCard * card, const Pos& pos, JQuad * quad)
|
|||||||
|
|
||||||
if (scale < 0)
|
if (scale < 0)
|
||||||
{
|
{
|
||||||
renderer->RenderQuad(manaIcons[h->color1], x + (-12 * j + 75 + 3 * SineHelperFunction((float) t)) * pos.actZ,
|
renderer->RenderQuad(manaIcons[h->color1].get(), x + (-12 * j + 75 + 3 * SineHelperFunction((float) t)) * pos.actZ,
|
||||||
pos.actY + (yOffset + 3 * CosineHelperFunction((float) t)) * pos.actZ, 0, 0.4f + scale, 0.4f
|
pos.actY + (yOffset + 3 * CosineHelperFunction((float) t)) * pos.actZ, 0, 0.4f + scale, 0.4f
|
||||||
+ scale);
|
+ scale);
|
||||||
renderer->RenderQuad(manaIcons[h->color2], x + (-12 * j + 75 + 3 * SineHelperFunction((float) v)) * pos.actZ,
|
renderer->RenderQuad(manaIcons[h->color2].get(), x + (-12 * j + 75 + 3 * SineHelperFunction((float) v)) * pos.actZ,
|
||||||
pos.actY + (yOffset + 3 * CosineHelperFunction((float) v)) * pos.actZ, 0, 0.4f - scale, 0.4f
|
pos.actY + (yOffset + 3 * CosineHelperFunction((float) v)) * pos.actZ, 0, 0.4f - scale, 0.4f
|
||||||
- scale);
|
- scale);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
renderer->RenderQuad(manaIcons[h->color2], x + (-12 * j + 75 + 3 * SineHelperFunction((float) v)) * pos.actZ,
|
renderer->RenderQuad(manaIcons[h->color2].get(), x + (-12 * j + 75 + 3 * SineHelperFunction((float) v)) * pos.actZ,
|
||||||
pos.actY + (yOffset + 3 * CosineHelperFunction((float) v)) * pos.actZ, 0, 0.4f - scale, 0.4f
|
pos.actY + (yOffset + 3 * CosineHelperFunction((float) v)) * pos.actZ, 0, 0.4f - scale, 0.4f
|
||||||
- scale);
|
- scale);
|
||||||
renderer->RenderQuad(manaIcons[h->color1], x + (-12 * j + 75 + 3 * SineHelperFunction((float) t)) * pos.actZ,
|
renderer->RenderQuad(manaIcons[h->color1].get(), x + (-12 * j + 75 + 3 * SineHelperFunction((float) t)) * pos.actZ,
|
||||||
pos.actY + (yOffset + 3 * CosineHelperFunction((float) t)) * pos.actZ, 0, 0.4f + scale, 0.4f
|
pos.actY + (yOffset + 3 * CosineHelperFunction((float) t)) * pos.actZ, 0, 0.4f + scale, 0.4f
|
||||||
+ scale);
|
+ scale);
|
||||||
}
|
}
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
@@ -660,8 +662,8 @@ void CardGui::TinyCropRender(MTGCard * card, const Pos& pos, JQuad * quad)
|
|||||||
{
|
{
|
||||||
for (int cost = manacost->getCost(i); cost > 0; --cost)
|
for (int cost = manacost->getCost(i); cost > 0; --cost)
|
||||||
{
|
{
|
||||||
renderer->RenderQuad(manaIcons[i], x + (-12 * j + 75) * pos.actZ, pos.actY + (yOffset) * pos.actZ, 0, 0.4f
|
renderer->RenderQuad(manaIcons[i].get(), x + (-12 * j + 75) * pos.actZ, pos.actY + (yOffset) * pos.actZ, 0, 0.4f
|
||||||
* pos.actZ, 0.4f * pos.actZ);
|
* pos.actZ, 0.4f * pos.actZ);
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -670,19 +672,19 @@ void CardGui::TinyCropRender(MTGCard * card, const Pos& pos, JQuad * quad)
|
|||||||
{
|
{
|
||||||
char buffer[10];
|
char buffer[10];
|
||||||
sprintf(buffer, "%d", cost);
|
sprintf(buffer, "%d", cost);
|
||||||
renderer->RenderQuad(manaIcons[0], x + (-12 * j + 75) * pos.actZ, pos.actY + (yOffset) * pos.actZ, 0, 0.4f * pos.actZ,
|
renderer->RenderQuad(manaIcons[0].get(), x + (-12 * j + 75) * pos.actZ, pos.actY + (yOffset) * pos.actZ, 0, 0.4f * pos.actZ,
|
||||||
0.4f * pos.actZ);
|
0.4f * pos.actZ);
|
||||||
float w = font->GetStringWidth(buffer);
|
float w = font->GetStringWidth(buffer);
|
||||||
font->DrawString(buffer, x + (-12 * j + 76 - w / 2) * pos.actZ, pos.actY + (yOffset - 5) * pos.actZ);
|
font->DrawString(buffer, x + (-12 * j + 76 - w / 2) * pos.actZ, pos.actY + (yOffset - 5) * pos.actZ);
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
//Has X?
|
//Has X?
|
||||||
if (manacost->hasX())
|
if (int cost = manacost->hasX())
|
||||||
{
|
{
|
||||||
char buffer[10];
|
char buffer[10];
|
||||||
sprintf(buffer, "X");
|
sprintf(buffer, "X");
|
||||||
renderer->RenderQuad(manaIcons[0], x + (-12 * j + 75) * pos.actZ, pos.actY + (yOffset) * pos.actZ, 0, 0.4f * pos.actZ,
|
renderer->RenderQuad(manaIcons[0].get(), x + (-12 * j + 75) * pos.actZ, pos.actY + (yOffset) * pos.actZ, 0, 0.4f * pos.actZ,
|
||||||
0.4f * pos.actZ);
|
0.4f * pos.actZ);
|
||||||
float w = font->GetStringWidth(buffer);
|
float w = font->GetStringWidth(buffer);
|
||||||
font->DrawString(buffer, x + (-12 * j + 76 - w / 2) * pos.actZ, pos.actY + (yOffset - 5) * pos.actZ);
|
font->DrawString(buffer, x + (-12 * j + 76 - w / 2) * pos.actZ, pos.actY + (yOffset - 5) * pos.actZ);
|
||||||
}
|
}
|
||||||
@@ -700,59 +702,59 @@ void CardGui::TinyCropRender(MTGCard * card, const Pos& pos, JQuad * quad)
|
|||||||
s += _(Subtypes::subtypesList->find(card->data->types[0]));
|
s += _(Subtypes::subtypesList->find(card->data->types[0]));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DebugTrace ("Typeless card: " << setlist[card->setId].c_str() << card->data->getName() << card->getId());
|
DebugTrace("Typeless card: " << setlist[card->setId].c_str() << card->data->getName() << card->getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
font->DrawString(s.c_str(), x + (22 - BigWidth / 2)*pos.actZ, pos.actY + (49 - BigHeight / 2)*pos.actZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
font->DrawString(s.c_str(), x + (22 - BigWidth / 2)*pos.actZ, pos.actY + (49 - BigHeight / 2)*pos.actZ);
|
//expansion and rarity
|
||||||
}
|
font->SetColor(ARGB((int)pos.actA, 0, 0, 0));
|
||||||
|
|
||||||
//expansion and rarity
|
|
||||||
font->SetColor(ARGB((int)pos.actA, 0, 0, 0));
|
|
||||||
{
|
|
||||||
char buf[512];
|
|
||||||
switch(card->getRarity())
|
|
||||||
{
|
{
|
||||||
|
char buf[512];
|
||||||
|
switch(card->getRarity())
|
||||||
|
{
|
||||||
case Constants::RARITY_M:
|
case Constants::RARITY_M:
|
||||||
sprintf(buf,_("%s Mythic").c_str(),setlist[card->setId].c_str());
|
sprintf(buf,_("%s Mythic").c_str(),setlist[card->setId].c_str());
|
||||||
break;
|
break;
|
||||||
case Constants::RARITY_R:
|
case Constants::RARITY_R:
|
||||||
sprintf(buf,_("%s Rare").c_str(),setlist[card->setId].c_str());
|
sprintf(buf,_("%s Rare").c_str(),setlist[card->setId].c_str());
|
||||||
break;
|
break;
|
||||||
case Constants::RARITY_U:
|
case Constants::RARITY_U:
|
||||||
sprintf(buf,_("%s Uncommon").c_str(),setlist[card->setId].c_str());
|
sprintf(buf,_("%s Uncommon").c_str(),setlist[card->setId].c_str());
|
||||||
break;
|
break;
|
||||||
case Constants::RARITY_C:
|
case Constants::RARITY_C:
|
||||||
sprintf(buf,_("%s Common").c_str(),setlist[card->setId].c_str());
|
sprintf(buf,_("%s Common").c_str(),setlist[card->setId].c_str());
|
||||||
break;
|
break;
|
||||||
case Constants::RARITY_L:
|
case Constants::RARITY_L:
|
||||||
sprintf(buf,_("%s Land").c_str(),setlist[card->setId].c_str());
|
sprintf(buf,_("%s Land").c_str(),setlist[card->setId].c_str());
|
||||||
break;
|
break;
|
||||||
case Constants::RARITY_T:
|
case Constants::RARITY_T:
|
||||||
sprintf(buf,_("%s Token").c_str(),setlist[card->setId].c_str());
|
sprintf(buf,_("%s Token").c_str(),setlist[card->setId].c_str());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case Constants::RARITY_S:
|
case Constants::RARITY_S:
|
||||||
sprintf(buf,_("%s Special").c_str(),setlist[card->setId].c_str());
|
sprintf(buf,_("%s Special").c_str(),setlist[card->setId].c_str());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(card->data->getColor())
|
switch(card->data->getColor())
|
||||||
{
|
{
|
||||||
case Constants::MTG_COLOR_BLACK:
|
case Constants::MTG_COLOR_BLACK:
|
||||||
case Constants::MTG_COLOR_GREEN:
|
case Constants::MTG_COLOR_GREEN:
|
||||||
case Constants::MTG_COLOR_BLUE:
|
case Constants::MTG_COLOR_BLUE:
|
||||||
case Constants::MTG_COLOR_LAND:
|
case Constants::MTG_COLOR_LAND:
|
||||||
font->SetColor(ARGB((int)pos.actA,255,255,255));
|
font->SetColor(ARGB((int)pos.actA,255,255,255));
|
||||||
font->DrawString(buf, x + (22 - BigWidth / 2)*pos.actZ, pos.actY + (BigHeight / 2 - 30)*pos.actZ);
|
font->DrawString(buf, x + (22 - BigWidth / 2)*pos.actZ, pos.actY + (BigHeight / 2 - 30)*pos.actZ);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
font->DrawString(buf, x + (22 - BigWidth / 2)*pos.actZ, pos.actY + (BigHeight / 2 - 30)*pos.actZ);
|
font->DrawString(buf, x + (22 - BigWidth / 2)*pos.actZ, pos.actY + (BigHeight / 2 - 30)*pos.actZ);
|
||||||
break; //Leave black
|
break; //Leave black
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
font->SetScale(backup_scale);
|
||||||
|
|
||||||
font->SetScale(backup_scale);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Renders a big card on screen. Defaults to the "alternate" rendering if no image is found
|
//Renders a big card on screen. Defaults to the "alternate" rendering if no image is found
|
||||||
@@ -762,26 +764,26 @@ void CardGui::RenderBig(MTGCard* card, const Pos& pos)
|
|||||||
|
|
||||||
float x = pos.actX;
|
float x = pos.actX;
|
||||||
|
|
||||||
JQuad * quad = WResourceManager::Instance()->RetrieveCard(card);
|
JQuadPtr quad = WResourceManager::Instance()->RetrieveCard(card);
|
||||||
if (quad)
|
if (quad.get())
|
||||||
{
|
{
|
||||||
if (quad->mHeight < quad->mWidth)
|
if (quad->mHeight < quad->mWidth)
|
||||||
{
|
{
|
||||||
return TinyCropRender(card, pos, quad);
|
return TinyCropRender(card, pos, quad.get());
|
||||||
}
|
}
|
||||||
quad->SetColor(ARGB(255,255,255,255));
|
quad->SetColor(ARGB(255,255,255,255));
|
||||||
float scale = pos.actZ * 257.f / quad->mHeight;
|
float scale = pos.actZ * 257.f / quad->mHeight;
|
||||||
renderer->RenderQuad(quad, x, pos.actY, pos.actT, scale, scale);
|
renderer->RenderQuad(quad.get(), x, pos.actY, pos.actT, scale, scale);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//No card found, attempt to render the thumbnail instead (better than nothing, even if it gets super stretched)
|
//No card found, attempt to render the thumbnail instead (better than nothing, even if it gets super stretched)
|
||||||
JQuad * q;
|
JQuadPtr q;
|
||||||
if ((q = WResourceManager::Instance()->RetrieveCard(card, CACHE_THUMB)))
|
if ((q = WResourceManager::Instance()->RetrieveCard(card, CACHE_THUMB)))
|
||||||
{
|
{
|
||||||
float scale = pos.actZ * 250 / q->mHeight;
|
float scale = pos.actZ * 250 / q->mHeight;
|
||||||
q->SetColor(ARGB(255,255,255,255));
|
q->SetColor(ARGB(255,255,255,255));
|
||||||
renderer->RenderQuad(q, x, pos.actY, pos.actT, scale, scale);
|
renderer->RenderQuad(q.get(), x, pos.actY, pos.actT, scale, scale);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -201,12 +201,12 @@ void Credits::compute(Player * _p1, Player * _p2, GameApp * _app)
|
|||||||
SAFE_DELETE(playerdata);
|
SAFE_DELETE(playerdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
JQuad * Credits::GetUnlockedQuad(string textureName)
|
JQuadPtr Credits::GetUnlockedQuad(string textureName)
|
||||||
{
|
{
|
||||||
if (!textureName.size()) return NULL;
|
if (!textureName.size()) return JQuadPtr();
|
||||||
|
|
||||||
JTexture * unlockedTex = WResourceManager::Instance()->RetrieveTexture(textureName);
|
JTexture * unlockedTex = WResourceManager::Instance()->RetrieveTexture(textureName);
|
||||||
if (!unlockedTex) return NULL;
|
if (!unlockedTex) return JQuadPtr();
|
||||||
|
|
||||||
return WResourceManager::Instance()->RetrieveQuad(unlockedTextureName, 2, 2, unlockedTex->mWidth - 4, unlockedTex->mHeight - 4);
|
return WResourceManager::Instance()->RetrieveQuad(unlockedTextureName, 2, 2, unlockedTex->mWidth - 4, unlockedTex->mHeight - 4);
|
||||||
|
|
||||||
@@ -239,11 +239,11 @@ void Credits::Render()
|
|||||||
if (g->gameOver != p1)
|
if (g->gameOver != p1)
|
||||||
{
|
{
|
||||||
sprintf(buffer, _("Congratulations! You earn %i credits").c_str(), value);
|
sprintf(buffer, _("Congratulations! You earn %i credits").c_str(), value);
|
||||||
JQuad * unlockedQuad = GetUnlockedQuad(unlockedTextureName);
|
JQuadPtr unlockedQuad = GetUnlockedQuad(unlockedTextureName);
|
||||||
if (unlockedQuad)
|
if (unlockedQuad)
|
||||||
{
|
{
|
||||||
showMsg = 0;
|
showMsg = 0;
|
||||||
r->RenderQuad(unlockedQuad, 20, 20);
|
r->RenderQuad(unlockedQuad.get(), 20, 20);
|
||||||
}
|
}
|
||||||
if (unlockedString.size())
|
if (unlockedString.size())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -193,21 +193,21 @@ void Damage::Render()
|
|||||||
sprintf(buffer, _("Deals %i damage to").c_str(), damage);
|
sprintf(buffer, _("Deals %i damage to").c_str(), damage);
|
||||||
mFont->DrawString(buffer, x + 20, y, JGETEXT_LEFT);
|
mFont->DrawString(buffer, x + 20, y, JGETEXT_LEFT);
|
||||||
JRenderer * renderer = JRenderer::GetInstance();
|
JRenderer * renderer = JRenderer::GetInstance();
|
||||||
JQuad * quad = WResourceManager::Instance()->RetrieveCard(source, CACHE_THUMB);
|
JQuadPtr quad = WResourceManager::Instance()->RetrieveCard(source, CACHE_THUMB);
|
||||||
if (quad)
|
if (quad.get())
|
||||||
{
|
{
|
||||||
float scale = 30 / quad->mHeight;
|
float scale = 30 / quad->mHeight;
|
||||||
renderer->RenderQuad(quad, x, y, 0, scale, scale);
|
renderer->RenderQuad(quad.get(), x, y, 0, scale, scale);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mFont->DrawString(_(source->getName()).c_str(), x, y - 15);
|
mFont->DrawString(_(source->getName()).c_str(), x, y - 15);
|
||||||
}
|
}
|
||||||
quad = target->getIcon();
|
quad = target->getIcon();
|
||||||
if (quad)
|
if (quad.get())
|
||||||
{
|
{
|
||||||
float scale = 30 / quad->mHeight;
|
float scale = 30 / quad->mHeight;
|
||||||
renderer->RenderQuad(quad, x + 150, y, 0, scale, scale);
|
renderer->RenderQuad(quad.get(), x + 150, y, 0, scale, scale);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -92,8 +92,8 @@ JGuiController(id, listener), fontId(fontId), mShowDetailsScreen( showDetailsOve
|
|||||||
|
|
||||||
mSelectionTargetY = selectionY = kVerticalMargin;
|
mSelectionTargetY = selectionY = kVerticalMargin;
|
||||||
|
|
||||||
if (NULL == stars)
|
if (NULL == stars)
|
||||||
stars = NEW hgeParticleSystem(WResourceManager::Instance()->RetrievePSI("stars.psi", WResourceManager::Instance()->GetQuad("stars")));
|
stars = NEW hgeParticleSystem(WResourceManager::Instance()->RetrievePSI("stars.psi", WResourceManager::Instance()->GetQuad("stars").get()));
|
||||||
stars->FireAt(mX, mY);
|
stars->FireAt(mX, mY);
|
||||||
|
|
||||||
updateScroller();
|
updateScroller();
|
||||||
@@ -101,8 +101,6 @@ JGuiController(id, listener), fontId(fontId), mShowDetailsScreen( showDetailsOve
|
|||||||
|
|
||||||
void DeckMenu::RenderDeckManaColors()
|
void DeckMenu::RenderDeckManaColors()
|
||||||
{
|
{
|
||||||
JRenderer *renderer = JRenderer::GetInstance();
|
|
||||||
|
|
||||||
// display the deck mana colors if known
|
// display the deck mana colors if known
|
||||||
// We only want to display the mana symbols on the game screens and not the Deck Editor screens.
|
// We only want to display the mana symbols on the game screens and not the Deck Editor screens.
|
||||||
// Need a better way to determine where/when to display the mana symbols. Perhaps make it a property setting.
|
// Need a better way to determine where/when to display the mana symbols. Perhaps make it a property setting.
|
||||||
@@ -120,7 +118,7 @@ void DeckMenu::RenderDeckManaColors()
|
|||||||
{
|
{
|
||||||
if ( (deckManaColors.at(colorIdx) == '1') != 0)
|
if ( (deckManaColors.at(colorIdx) == '1') != 0)
|
||||||
{
|
{
|
||||||
renderer->RenderQuad(manaIcons[colorIdx], manaIconX, manaIconY, 0, 0.5f, 0.5f);
|
JRenderer::GetInstance()->RenderQuad(manaIcons[colorIdx].get(), manaIconX, manaIconY, 0, 0.5f, 0.5f);
|
||||||
manaIconX += 15;
|
manaIconX += 15;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -138,9 +136,9 @@ void DeckMenu::RenderBackground()
|
|||||||
static bool loadBackground = true;
|
static bool loadBackground = true;
|
||||||
if (loadBackground)
|
if (loadBackground)
|
||||||
{
|
{
|
||||||
JQuad *background = WResourceManager::Instance()->RetrieveTempQuad(bgFilename.str(), TEXTURE_SUB_5551);
|
JQuadPtr background = WResourceManager::Instance()->RetrieveTempQuad(bgFilename.str(), TEXTURE_SUB_5551);
|
||||||
if (background)
|
if (background.get())
|
||||||
JRenderer::GetInstance()->RenderQuad(background, 0, 0);
|
JRenderer::GetInstance()->RenderQuad(background.get(), 0, 0);
|
||||||
else
|
else
|
||||||
loadBackground = false;
|
loadBackground = false;
|
||||||
}
|
}
|
||||||
@@ -227,6 +225,7 @@ void DeckMenu::Render()
|
|||||||
mSelectedDeck = currentMenuItem->meta;
|
mSelectedDeck = currentMenuItem->meta;
|
||||||
|
|
||||||
WFont *mainFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
|
WFont *mainFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
|
||||||
|
|
||||||
// display the "more info" button if special condition is met
|
// display the "more info" button if special condition is met
|
||||||
if (showDetailsScreen())
|
if (showDetailsScreen())
|
||||||
{
|
{
|
||||||
@@ -236,7 +235,7 @@ void DeckMenu::Render()
|
|||||||
float boxStartX = detailedInfoBoxX - stringWidth / 2;
|
float boxStartX = detailedInfoBoxX - stringWidth / 2;
|
||||||
DWORD currentColor = mainFont->GetColor();
|
DWORD currentColor = mainFont->GetColor();
|
||||||
renderer->FillRoundRect( boxStartX, detailedInfoBoxY - 5, stringWidth, mainFont->GetHeight() + 15, .5, ARGB( 255, 0, 0, 0) );
|
renderer->FillRoundRect( boxStartX, detailedInfoBoxY - 5, stringWidth, mainFont->GetHeight() + 15, .5, ARGB( 255, 0, 0, 0) );
|
||||||
renderer->RenderQuad(pspIcons[5], detailedInfoBoxX, detailedInfoBoxY + 2, 0, pspIconsSize, pspIconsSize);
|
renderer->RenderQuad(pspIcons[5].get(), detailedInfoBoxX, detailedInfoBoxY + 2, 0, pspIconsSize, pspIconsSize);
|
||||||
mainFont->SetColor(currentColor);
|
mainFont->SetColor(currentColor);
|
||||||
mainFont->DrawString(detailedInfoString, boxStartX, detailedInfoBoxY + 10);
|
mainFont->DrawString(detailedInfoString, boxStartX, detailedInfoBoxY + 10);
|
||||||
}
|
}
|
||||||
@@ -244,8 +243,9 @@ void DeckMenu::Render()
|
|||||||
// display the avatar image
|
// display the avatar image
|
||||||
if (currentMenuItem->imageFilename.size() > 0)
|
if (currentMenuItem->imageFilename.size() > 0)
|
||||||
{
|
{
|
||||||
JQuad * quad = WResourceManager::Instance()->RetrieveTempQuad(currentMenuItem->imageFilename, TEXTURE_SUB_AVATAR);
|
JQuadPtr quad = WResourceManager::Instance()->RetrieveTempQuad(currentMenuItem->imageFilename, TEXTURE_SUB_AVATAR);
|
||||||
if (quad) renderer->RenderQuad(quad, avatarX, avatarY);
|
if (quad.get())
|
||||||
|
renderer->RenderQuad(quad.get(), avatarX, avatarY);
|
||||||
}
|
}
|
||||||
// fill in the description part of the screen
|
// fill in the description part of the screen
|
||||||
string text = wordWrap(currentMenuItem->desc, descWidth, mainFont->mFontID );
|
string text = wordWrap(currentMenuItem->desc, descWidth, mainFont->mFontID );
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ DeckMenuItem::DeckMenuItem(DeckMenu* _parent, int id, int fontId, string text, f
|
|||||||
JTexture * tex = WResourceManager::Instance()->RetrieveTexture("new.png");
|
JTexture * tex = WResourceManager::Instance()->RetrieveTexture("new.png");
|
||||||
if (tex)
|
if (tex)
|
||||||
{
|
{
|
||||||
JQuad * quad = WResourceManager::Instance()->RetrieveQuad("new.png", 2.0f, 2.0f, tex->mWidth - 4.0f, tex->mHeight - 4.0f); //avoids weird rectangle around the texture because of bilinear filtering
|
JQuadPtr quad = WResourceManager::Instance()->RetrieveQuad("new.png", 2.0f, 2.0f, tex->mWidth - 4.0f, tex->mHeight - 4.0f); //avoids weird rectangle around the texture because of bilinear filtering
|
||||||
newImageWidth = quad->mWidth;
|
newImageWidth = quad->mWidth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -74,10 +74,10 @@ void DeckMenuItem::RenderWithOffset(float yOffset)
|
|||||||
JTexture * tex = WResourceManager::Instance()->RetrieveTexture("new.png");
|
JTexture * tex = WResourceManager::Instance()->RetrieveTexture("new.png");
|
||||||
if (tex)
|
if (tex)
|
||||||
{
|
{
|
||||||
JQuad * quad = WResourceManager::Instance()->RetrieveQuad("new.png", 2.0f, 2.0f, tex->mWidth - 4.0f, tex->mHeight - 4.0f); //avoids weird rectangle aroudn the texture because of bilinear filtering
|
JQuadPtr quad = WResourceManager::Instance()->RetrieveQuad("new.png", 2.0f, 2.0f, tex->mWidth - 4.0f, tex->mHeight - 4.0f); //avoids weird rectangle aroudn the texture because of bilinear filtering
|
||||||
quad->SetHotSpot(quad->mWidth/2.0f, quad->mHeight/2.0f);
|
quad->SetHotSpot(quad->mWidth/2.0f, quad->mHeight/2.0f);
|
||||||
float x = mX + min(ITEM_PX_WIDTH - quad->mWidth, GetWidth() )/2 + quad->mWidth/2;
|
float x = mX + min(ITEM_PX_WIDTH - quad->mWidth, GetWidth() )/2 + quad->mWidth/2;
|
||||||
if (quad) JRenderer::GetInstance()->RenderQuad(quad, x , mY + yOffset + quad->mHeight/2, 0.5);
|
if (quad) JRenderer::GetInstance()->RenderQuad(quad.get(), x , mY + yOffset + quad->mHeight/2, 0.5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ JMusic * GameApp::music = NULL;
|
|||||||
string GameApp::currentMusicFile = "";
|
string GameApp::currentMusicFile = "";
|
||||||
string GameApp::systemError = "";
|
string GameApp::systemError = "";
|
||||||
|
|
||||||
JQuad* manaIcons[7] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL };
|
JQuadPtr manaIcons[7];
|
||||||
|
|
||||||
GameState::GameState(GameApp* parent) :
|
GameState::GameState(GameApp* parent) :
|
||||||
mParent(parent)
|
mParent(parent)
|
||||||
@@ -156,13 +156,13 @@ void GameApp::Create()
|
|||||||
RETRIEVE_MANAGE);
|
RETRIEVE_MANAGE);
|
||||||
|
|
||||||
for (int i = sizeof(manaIcons) / sizeof(manaIcons[0]) - 1; i >= 0; --i)
|
for (int i = sizeof(manaIcons) / sizeof(manaIcons[0]) - 1; i >= 0; --i)
|
||||||
if (manaIcons[i])
|
if (manaIcons[i].get())
|
||||||
manaIcons[i]->SetHotSpot(16, 16);
|
manaIcons[i]->SetHotSpot(16, 16);
|
||||||
|
|
||||||
LOG("--Loading back.jpg");
|
LOG("--Loading back.jpg");
|
||||||
WResourceManager::Instance()->RetrieveTexture("back.jpg", RETRIEVE_MANAGE);
|
WResourceManager::Instance()->RetrieveTexture("back.jpg", RETRIEVE_MANAGE);
|
||||||
JQuad * jq = WResourceManager::Instance()->RetrieveQuad("back.jpg", 0, 0, 0, 0, "back", RETRIEVE_MANAGE);
|
JQuadPtr jq = WResourceManager::Instance()->RetrieveQuad("back.jpg", 0, 0, 0, 0, "back", RETRIEVE_MANAGE);
|
||||||
if (jq)
|
if (jq.get())
|
||||||
jq->SetHotSpot(jq->mWidth / 2, jq->mHeight / 2);
|
jq->SetHotSpot(jq->mWidth / 2, jq->mHeight / 2);
|
||||||
|
|
||||||
WResourceManager::Instance()->RetrieveTexture("back_thumb.jpg", RETRIEVE_MANAGE);
|
WResourceManager::Instance()->RetrieveTexture("back_thumb.jpg", RETRIEVE_MANAGE);
|
||||||
|
|||||||
@@ -137,9 +137,9 @@ void GameStateAwards::Render()
|
|||||||
JRenderer * r = JRenderer::GetInstance();
|
JRenderer * r = JRenderer::GetInstance();
|
||||||
r->ClearScreen(ARGB(0,0,0,0));
|
r->ClearScreen(ARGB(0,0,0,0));
|
||||||
|
|
||||||
JQuad * mBg = WResourceManager::Instance()->RetrieveTempQuad("awardback.jpg", TEXTURE_SUB_5551);
|
JQuadPtr background = WResourceManager::Instance()->RetrieveTempQuad("awardback.jpg", TEXTURE_SUB_5551);
|
||||||
if (mBg)
|
if (background.get())
|
||||||
r->RenderQuad(mBg, 0, 0);
|
r->RenderQuad(background.get(), 0, 0);
|
||||||
|
|
||||||
switch (mState)
|
switch (mState)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ void GameStateDeckViewer::rebuildFilters()
|
|||||||
{
|
{
|
||||||
if (!filterMenu) filterMenu = NEW WGuiFilters("Filter by...", NULL);
|
if (!filterMenu) filterMenu = NEW WGuiFilters("Filter by...", NULL);
|
||||||
if (source)
|
if (source)
|
||||||
SAFE_DELETE(source);
|
SAFE_DELETE(source);
|
||||||
source = NEW WSrcDeckViewer(myDeck, myCollection);
|
source = NEW WSrcDeckViewer(myDeck, myCollection);
|
||||||
filterMenu->setSrc(source);
|
filterMenu->setSrc(source);
|
||||||
if (displayed_deck != myDeck) source->swapSrc();
|
if (displayed_deck != myDeck) source->swapSrc();
|
||||||
@@ -184,7 +184,7 @@ void GameStateDeckViewer::buildEditorMenu()
|
|||||||
deckSummaryInformation << "All changes are final." << endl;
|
deckSummaryInformation << "All changes are final." << endl;
|
||||||
|
|
||||||
if (menu)
|
if (menu)
|
||||||
SAFE_DELETE( menu );
|
SAFE_DELETE( menu );
|
||||||
//Build menu.
|
//Build menu.
|
||||||
JRenderer::GetInstance()->FillRoundRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 100, ARGB(0, 0, 0, 0) );
|
JRenderer::GetInstance()->FillRoundRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 100, ARGB(0, 0, 0, 0) );
|
||||||
menu = NEW DeckEditorMenu(MENU_DECK_BUILDER, this, Fonts::OPTION_FONT, "Deck Editor", myDeck, stw);
|
menu = NEW DeckEditorMenu(MENU_DECK_BUILDER, this, Fonts::OPTION_FONT, "Deck Editor", myDeck, stw);
|
||||||
@@ -245,8 +245,6 @@ void GameStateDeckViewer::Start()
|
|||||||
pspIcons[i]->SetHotSpot(16, 16);
|
pspIcons[i]->SetHotSpot(16, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
backQuad = WResourceManager::Instance()->GetQuad("back");
|
|
||||||
|
|
||||||
//init welcome menu
|
//init welcome menu
|
||||||
updateDecks();
|
updateDecks();
|
||||||
|
|
||||||
@@ -449,7 +447,7 @@ void GameStateDeckViewer::Update(float dt)
|
|||||||
{
|
{
|
||||||
filterMenu = NEW WGuiFilters("Filter by...", NULL);
|
filterMenu = NEW WGuiFilters("Filter by...", NULL);
|
||||||
if (source)
|
if (source)
|
||||||
SAFE_DELETE(source);
|
SAFE_DELETE(source);
|
||||||
source = NEW WSrcDeckViewer(myDeck, myCollection);
|
source = NEW WSrcDeckViewer(myDeck, myCollection);
|
||||||
filterMenu->setSrc(source);
|
filterMenu->setSrc(source);
|
||||||
if (displayed_deck != myDeck) source->swapSrc();
|
if (displayed_deck != myDeck) source->swapSrc();
|
||||||
@@ -633,7 +631,7 @@ void GameStateDeckViewer::renderOnScreenBasicInfo()
|
|||||||
renderer->FillRoundRect(SCREEN_WIDTH - (w + 27), y + 5, w + 10, 15, 5, ARGB(128,0,0,0));
|
renderer->FillRoundRect(SCREEN_WIDTH - (w + 27), y + 5, w + 10, 15, 5, ARGB(128,0,0,0));
|
||||||
|
|
||||||
mFont->DrawString(buffer, SCREEN_WIDTH - 22, y + 15, JGETEXT_RIGHT);
|
mFont->DrawString(buffer, SCREEN_WIDTH - 22, y + 15, JGETEXT_RIGHT);
|
||||||
if (useFilter != 0) renderer->RenderQuad(mIcons[useFilter - 1], SCREEN_WIDTH - 10, y + 15, 0.0f, 0.5, 0.5);
|
if (useFilter != 0) renderer->RenderQuad(mIcons[useFilter - 1].get(), SCREEN_WIDTH - 10, y + 15, 0.0f, 0.5, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
//returns position of the current card (cusor) in the currently viewed color/filter
|
//returns position of the current card (cusor) in the currently viewed color/filter
|
||||||
@@ -743,10 +741,10 @@ void GameStateDeckViewer::renderOnScreenMenu()
|
|||||||
//LEFT PSP CIRCLE render
|
//LEFT PSP CIRCLE render
|
||||||
r->FillCircle(leftPspX, leftPspY, 40, ARGB(128,50,50,50));
|
r->FillCircle(leftPspX, leftPspY, 40, ARGB(128,50,50,50));
|
||||||
|
|
||||||
r->RenderQuad(pspIcons[0], leftPspX, leftPspY - 20, 0, pspIconsSize, pspIconsSize);
|
r->RenderQuad(pspIcons[0].get(), leftPspX, leftPspY - 20, 0, pspIconsSize, pspIconsSize);
|
||||||
r->RenderQuad(pspIcons[1], leftPspX, leftPspY + 20, 0, pspIconsSize, pspIconsSize);
|
r->RenderQuad(pspIcons[1].get(), leftPspX, leftPspY + 20, 0, pspIconsSize, pspIconsSize);
|
||||||
r->RenderQuad(pspIcons[2], leftPspX - 20, leftPspY, 0, pspIconsSize, pspIconsSize);
|
r->RenderQuad(pspIcons[2].get(), leftPspX - 20, leftPspY, 0, pspIconsSize, pspIconsSize);
|
||||||
r->RenderQuad(pspIcons[3], leftPspX + 20, leftPspY, 0, pspIconsSize, pspIconsSize);
|
r->RenderQuad(pspIcons[3].get(), leftPspX + 20, leftPspY, 0, pspIconsSize, pspIconsSize);
|
||||||
|
|
||||||
font->DrawString(_("Prev."), leftPspX - 35, leftPspY - 15);
|
font->DrawString(_("Prev."), leftPspX - 35, leftPspY - 15);
|
||||||
font->DrawString(_("Next"), leftPspX + 15, leftPspY - 15);
|
font->DrawString(_("Next"), leftPspX + 15, leftPspY - 15);
|
||||||
@@ -757,10 +755,10 @@ void GameStateDeckViewer::renderOnScreenMenu()
|
|||||||
|
|
||||||
//RIGHT PSP CIRCLE render
|
//RIGHT PSP CIRCLE render
|
||||||
r->FillCircle(rightPspX + (onScreenTransition * 204), rightPspY, 40, ARGB(128,50,50,50));
|
r->FillCircle(rightPspX + (onScreenTransition * 204), rightPspY, 40, ARGB(128,50,50,50));
|
||||||
r->RenderQuad(pspIcons[4], rightPspX + 20, rightPspY, 0, pspIconsSize, pspIconsSize);
|
r->RenderQuad(pspIcons[4].get(), rightPspX + 20, rightPspY, 0, pspIconsSize, pspIconsSize);
|
||||||
r->RenderQuad(pspIcons[5], rightPspX, rightPspY - 20, 0, pspIconsSize, pspIconsSize);
|
r->RenderQuad(pspIcons[5].get(), rightPspX, rightPspY - 20, 0, pspIconsSize, pspIconsSize);
|
||||||
r->RenderQuad(pspIcons[6], rightPspX - 20, rightPspY, 0, pspIconsSize, pspIconsSize);
|
r->RenderQuad(pspIcons[6].get(), rightPspX - 20, rightPspY, 0, pspIconsSize, pspIconsSize);
|
||||||
r->RenderQuad(pspIcons[7], rightPspX, rightPspY + 20, 0, pspIconsSize, pspIconsSize);
|
r->RenderQuad(pspIcons[7].get(), rightPspX, rightPspY + 20, 0, pspIconsSize, pspIconsSize);
|
||||||
|
|
||||||
font->DrawString(_("Toggle Images"), rightPspX - 35, rightPspY - 40);
|
font->DrawString(_("Toggle Images"), rightPspX - 35, rightPspY - 40);
|
||||||
|
|
||||||
@@ -789,8 +787,8 @@ void GameStateDeckViewer::renderOnScreenMenu()
|
|||||||
{
|
{
|
||||||
sprintf(buffer, "%i", value);
|
sprintf(buffer, "%i", value);
|
||||||
font->DrawString(buffer, SCREEN_WIDTH - 190 + rightTransition + nb_letters * 13, SCREEN_HEIGHT / 2 + 40);
|
font->DrawString(buffer, SCREEN_WIDTH - 190 + rightTransition + nb_letters * 13, SCREEN_HEIGHT / 2 + 40);
|
||||||
r->RenderQuad(mIcons[j], SCREEN_WIDTH - 197 + rightTransition + nb_letters * 13, SCREEN_HEIGHT / 2 + 46, 0, 0.5,
|
r->RenderQuad(mIcons[j].get(), SCREEN_WIDTH - 197 + rightTransition + nb_letters * 13, SCREEN_HEIGHT / 2 + 46, 0, 0.5,
|
||||||
0.5);
|
0.5);
|
||||||
if (value > 9)
|
if (value > 9)
|
||||||
{
|
{
|
||||||
nb_letters += 3;
|
nb_letters += 3;
|
||||||
@@ -863,7 +861,7 @@ void GameStateDeckViewer::renderOnScreenMenu()
|
|||||||
{
|
{
|
||||||
sprintf(buffer, "%i", value);
|
sprintf(buffer, "%i", value);
|
||||||
font->DrawString(buffer, 38 + nb_letters * 13 + leftTransition, posY + 5);
|
font->DrawString(buffer, 38 + nb_letters * 13 + leftTransition, posY + 5);
|
||||||
r->RenderQuad(mIcons[j], 30 + nb_letters * 13 + leftTransition, posY + 11, 0, 0.5, 0.5);
|
r->RenderQuad(mIcons[j].get(), 30 + nb_letters * 13 + leftTransition, posY + 11, 0, 0.5, 0.5);
|
||||||
if (value > 9)
|
if (value > 9)
|
||||||
{
|
{
|
||||||
nb_letters += 3;
|
nb_letters += 3;
|
||||||
@@ -976,7 +974,7 @@ void GameStateDeckViewer::renderOnScreenMenu()
|
|||||||
// Column titles
|
// Column titles
|
||||||
for (int j = 0; j < Constants::MTG_NB_COLORS - 1; j++)
|
for (int j = 0; j < Constants::MTG_NB_COLORS - 1; j++)
|
||||||
{
|
{
|
||||||
r->RenderQuad(mIcons[j], 52 + j * 15 + leftTransition, posY - 10, 0, 0.5, 0.5);
|
r->RenderQuad(mIcons[j].get(), 52 + j * 15 + leftTransition, posY - 10, 0, 0.5, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
//font->DrawString(_("C"), 30 + leftTransition, posY-16);
|
//font->DrawString(_("C"), 30 + leftTransition, posY-16);
|
||||||
@@ -1060,7 +1058,7 @@ void GameStateDeckViewer::renderOnScreenMenu()
|
|||||||
posX = 72;
|
posX = 72;
|
||||||
for (int j = 0; j < stw->countLandsPerColor[i] + stw->countBasicLandsPerColor[i]; j++)
|
for (int j = 0; j < stw->countLandsPerColor[i] + stw->countBasicLandsPerColor[i]; j++)
|
||||||
{
|
{
|
||||||
r->RenderQuad(mIcons[i], posX + leftTransition, posY + 6, 0, 0.5, 0.5);
|
r->RenderQuad(mIcons[i].get(), posX + leftTransition, posY + 6, 0, 0.5, 0.5);
|
||||||
posX += ((j + 1) % 10 == 0) ? 17 : 13;
|
posX += ((j + 1) % 10 == 0) ? 17 : 13;
|
||||||
if ((((j + 1) % 30) == 0) && (j < stw->countLandsPerColor[i] + stw->countBasicLandsPerColor[i] - 1))
|
if ((((j + 1) % 30) == 0) && (j < stw->countLandsPerColor[i] + stw->countBasicLandsPerColor[i] - 1))
|
||||||
{
|
{
|
||||||
@@ -1122,7 +1120,7 @@ void GameStateDeckViewer::renderOnScreenMenu()
|
|||||||
// Column titles
|
// Column titles
|
||||||
for (int j = 0; j < Constants::MTG_NB_COLORS - 1; j++)
|
for (int j = 0; j < Constants::MTG_NB_COLORS - 1; j++)
|
||||||
{
|
{
|
||||||
r->RenderQuad(mIcons[j], 67 + j * 15 + leftTransition, posY - 10, 0, 0.5, 0.5);
|
r->RenderQuad(mIcons[j].get(), 67 + j * 15 + leftTransition, posY - 10, 0, 0.5, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
font->DrawString(_("C"), 30 + leftTransition, posY - 16);
|
font->DrawString(_("C"), 30 + leftTransition, posY - 16);
|
||||||
@@ -1234,7 +1232,7 @@ void GameStateDeckViewer::renderOnScreenMenu()
|
|||||||
posX = 72;
|
posX = 72;
|
||||||
for (int j = 0; j < stw->totalCostPerColor[i]; j++)
|
for (int j = 0; j < stw->totalCostPerColor[i]; j++)
|
||||||
{
|
{
|
||||||
r->RenderQuad(mIcons[i], posX + leftTransition, posY + 6, 0, 0.5, 0.5);
|
r->RenderQuad(mIcons[i].get(), posX + leftTransition, posY + 6, 0, 0.5, 0.5);
|
||||||
posX += ((j + 1) % 10 == 0) ? 17 : 13;
|
posX += ((j + 1) % 10 == 0) ? 17 : 13;
|
||||||
if ((((j + 1) % 30) == 0) && (j < stw->totalCostPerColor[i] - 1))
|
if ((((j + 1) % 30) == 0) && (j < stw->totalCostPerColor[i] - 1))
|
||||||
{
|
{
|
||||||
@@ -1306,53 +1304,14 @@ void GameStateDeckViewer::renderCard(int id, float rotation)
|
|||||||
int alpha = (int) (255 * (scale + 1.0 - max_scale));
|
int alpha = (int) (255 * (scale + 1.0 - max_scale));
|
||||||
|
|
||||||
if (!card) return;
|
if (!card) return;
|
||||||
JQuad * quad = NULL;
|
|
||||||
|
|
||||||
int cacheError = CACHE_ERROR_NONE;
|
int mode = !options[Options::DISABLECARDS].number ? DrawMode::kNormal : DrawMode::kText;
|
||||||
|
|
||||||
if (!options[Options::DISABLECARDS].number)
|
Pos pos = Pos(x, y, scale * 285 / 250, 0.0, 255);
|
||||||
{
|
CardGui::DrawCard(card, pos, mode);
|
||||||
quad = WResourceManager::Instance()->RetrieveCard(card, RETRIEVE_EXISTING);
|
|
||||||
cacheError = WResourceManager::Instance()->RetrieveError();
|
|
||||||
if (!quad && cacheError != CACHE_ERROR_404)
|
|
||||||
{
|
|
||||||
if (last_user_activity > (abs(2 - id) + 1) * NO_USER_ACTIVITY_SHOWCARD_DELAY)
|
|
||||||
quad = WResourceManager::Instance()->RetrieveCard(card);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
quad = backQuad;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int quadAlpha = alpha;
|
int quadAlpha = alpha;
|
||||||
if (!displayed_deck->count(card)) quadAlpha /= 2;
|
if (!displayed_deck->count(card)) quadAlpha /= 2;
|
||||||
if (quad)
|
|
||||||
{
|
|
||||||
if (quad == backQuad)
|
|
||||||
{
|
|
||||||
quad->SetColor(ARGB(255,255,255,255));
|
|
||||||
float _scale = scale * (285 / quad->mHeight);
|
|
||||||
JRenderer::GetInstance()->RenderQuad(quad, x, y, 0.0f, _scale, _scale);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Pos pos = Pos(x, y, scale * 285 / 250, 0.0, 255);
|
|
||||||
CardGui::DrawCard(card, pos);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Pos pos = Pos(x, y, scale * 285 / 250, 0.0, 255);
|
|
||||||
CardGui::DrawCard(card, pos, DrawMode::kText);
|
|
||||||
if (!options[Options::DISABLECARDS].number) quad = WResourceManager::Instance()->RetrieveCard(card, CACHE_THUMB);
|
|
||||||
if (quad)
|
|
||||||
{
|
|
||||||
float _scale = 285 * scale / quad->mHeight;
|
|
||||||
quad->SetColor(ARGB(40,255,255,255));
|
|
||||||
JRenderer::GetInstance()->RenderQuad(quad, x, y, 0, _scale, _scale);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
quadAlpha = 255 - quadAlpha;
|
quadAlpha = 255 - quadAlpha;
|
||||||
if (quadAlpha > 0)
|
if (quadAlpha > 0)
|
||||||
{
|
{
|
||||||
@@ -1385,9 +1344,8 @@ void GameStateDeckViewer::Render()
|
|||||||
{
|
{
|
||||||
|
|
||||||
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
|
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
|
||||||
JRenderer * r = JRenderer::GetInstance();
|
|
||||||
|
|
||||||
r->ClearScreen(ARGB(0,0,0,0));
|
JRenderer::GetInstance()->ClearScreen(ARGB(0,0,0,0));
|
||||||
if (displayed_deck == myDeck && mStage != STAGE_MENU)
|
if (displayed_deck == myDeck && mStage != STAGE_MENU)
|
||||||
renderDeckBackground();
|
renderDeckBackground();
|
||||||
int order[3] = { 1, 2, 3 };
|
int order[3] = { 1, 2, 3 };
|
||||||
|
|||||||
@@ -73,8 +73,6 @@ GameStateMenu::GameStateMenu(GameApp* parent) :
|
|||||||
mGuiController = NULL;
|
mGuiController = NULL;
|
||||||
subMenuController = NULL;
|
subMenuController = NULL;
|
||||||
gameTypeMenu = NULL;
|
gameTypeMenu = NULL;
|
||||||
mSplash = NULL;
|
|
||||||
mBg = NULL;
|
|
||||||
//bgMusic = NULL;
|
//bgMusic = NULL;
|
||||||
timeIndex = 0;
|
timeIndex = 0;
|
||||||
angleMultiplier = MIN_ANGLE_MULTIPLIER;
|
angleMultiplier = MIN_ANGLE_MULTIPLIER;
|
||||||
@@ -129,8 +127,6 @@ void GameStateMenu::Create()
|
|||||||
scrollerSet = 0;
|
scrollerSet = 0;
|
||||||
|
|
||||||
splashTex = NULL;
|
splashTex = NULL;
|
||||||
mSplash = NULL;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameStateMenu::Destroy()
|
void GameStateMenu::Destroy()
|
||||||
@@ -428,16 +424,16 @@ void GameStateMenu::ensureMGuiController()
|
|||||||
{
|
{
|
||||||
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MENU_FONT);
|
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MENU_FONT);
|
||||||
mFont->SetColor(ARGB(255,255,255,255));
|
mFont->SetColor(ARGB(255,255,255,255));
|
||||||
mGuiController->Add(NEW MenuItem(MENUITEM_PLAY, mFont, "Play", 80, 50 + SCREEN_HEIGHT / 2, mIcons[8], mIcons[9],
|
mGuiController->Add(NEW MenuItem(MENUITEM_PLAY, mFont, "Play", 80, 50 + SCREEN_HEIGHT / 2, mIcons[8].get(), mIcons[9].get(),
|
||||||
"particle1.psi", WResourceManager::Instance()->GetQuad("particles"), true));
|
"particle1.psi", WResourceManager::Instance()->GetQuad("particles").get(), true));
|
||||||
mGuiController->Add(NEW MenuItem(MENUITEM_DECKEDITOR, mFont, "Deck Editor", 160, 50 + SCREEN_HEIGHT / 2, mIcons[2],
|
mGuiController->Add(NEW MenuItem(MENUITEM_DECKEDITOR, mFont, "Deck Editor", 160, 50 + SCREEN_HEIGHT / 2, mIcons[2].get(),
|
||||||
mIcons[3], "particle2.psi", WResourceManager::Instance()->GetQuad("particles")));
|
mIcons[3].get(), "particle2.psi", WResourceManager::Instance()->GetQuad("particles").get()));
|
||||||
mGuiController->Add(NEW MenuItem(MENUITEM_SHOP, mFont, "Shop", 240, 50 + SCREEN_HEIGHT / 2, mIcons[0], mIcons[1],
|
mGuiController->Add(NEW MenuItem(MENUITEM_SHOP, mFont, "Shop", 240, 50 + SCREEN_HEIGHT / 2, mIcons[0].get(), mIcons[1].get(),
|
||||||
"particle3.psi", WResourceManager::Instance()->GetQuad("particles")));
|
"particle3.psi", WResourceManager::Instance()->GetQuad("particles").get()));
|
||||||
mGuiController->Add(NEW MenuItem(MENUITEM_OPTIONS, mFont, "Options", 320, 50 + SCREEN_HEIGHT / 2, mIcons[6], mIcons[7],
|
mGuiController->Add(NEW MenuItem(MENUITEM_OPTIONS, mFont, "Options", 320, 50 + SCREEN_HEIGHT / 2, mIcons[6].get(), mIcons[7].get(),
|
||||||
"particle4.psi", WResourceManager::Instance()->GetQuad("particles")));
|
"particle4.psi", WResourceManager::Instance()->GetQuad("particles").get()));
|
||||||
mGuiController->Add(NEW MenuItem(MENUITEM_EXIT, mFont, "Exit", 400, 50 + SCREEN_HEIGHT / 2, mIcons[4], mIcons[5],
|
mGuiController->Add(NEW MenuItem(MENUITEM_EXIT, mFont, "Exit", 400, 50 + SCREEN_HEIGHT / 2, mIcons[4].get(), mIcons[5].get(),
|
||||||
"particle5.psi", WResourceManager::Instance()->GetQuad("particles")));
|
"particle5.psi", WResourceManager::Instance()->GetQuad("particles").get()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -499,7 +495,6 @@ void GameStateMenu::Update(float dt)
|
|||||||
//Release splash texture
|
//Release splash texture
|
||||||
WResourceManager::Instance()->Release(splashTex);
|
WResourceManager::Instance()->Release(splashTex);
|
||||||
splashTex = NULL;
|
splashTex = NULL;
|
||||||
mSplash = NULL;
|
|
||||||
|
|
||||||
//check for deleted collection / first-timer
|
//check for deleted collection / first-timer
|
||||||
wagic::ifstream file(options.profileFile(PLAYER_COLLECTION).c_str());
|
wagic::ifstream file(options.profileFile(PLAYER_COLLECTION).c_str());
|
||||||
@@ -644,26 +639,17 @@ void GameStateMenu::Render()
|
|||||||
}
|
}
|
||||||
else if ((currentState & MENU_STATE_MAJOR) == MENU_STATE_MAJOR_LOADING_CARDS)
|
else if ((currentState & MENU_STATE_MAJOR) == MENU_STATE_MAJOR_LOADING_CARDS)
|
||||||
{
|
{
|
||||||
if (!splashTex)
|
string wp = loadRandomWallpaper();
|
||||||
|
if (wp.size())
|
||||||
{
|
{
|
||||||
splashTex = WResourceManager::Instance()->RetrieveTexture("splash.jpg", RETRIEVE_LOCK);
|
JTexture * wpTex = WResourceManager::Instance()->RetrieveTexture(wp);
|
||||||
mSplash = WResourceManager::Instance()->RetrieveTempQuad("splash.jpg");
|
if (wpTex)
|
||||||
}
|
|
||||||
if (mSplash)
|
|
||||||
renderer->RenderQuad(mSplash, 0, 0);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
string wp = loadRandomWallpaper();
|
|
||||||
if (wp.size())
|
|
||||||
{
|
{
|
||||||
JTexture * wpTex = WResourceManager::Instance()->RetrieveTexture(wp);
|
JQuadPtr wpQuad = WResourceManager::Instance()->RetrieveTempQuad(wp);
|
||||||
if (wpTex)
|
renderer->RenderQuad(wpQuad.get(), 0, 0, 0, SCREEN_WIDTH_F / wpQuad->mWidth, SCREEN_HEIGHT_F / wpQuad->mHeight);
|
||||||
{
|
|
||||||
JQuad * wpQuad = WResourceManager::Instance()->RetrieveTempQuad(wp);
|
|
||||||
renderer->RenderQuad(wpQuad, 0, 0, 0, SCREEN_WIDTH_F / wpQuad->mWidth, SCREEN_HEIGHT_F / wpQuad->mHeight);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char text[512];
|
char text[512];
|
||||||
if (mCurrentSetName[0])
|
if (mCurrentSetName[0])
|
||||||
{
|
{
|
||||||
@@ -702,11 +688,11 @@ void GameStateMenu::Render()
|
|||||||
renderer->FillRoundRect(SCREEN_WIDTH / 2 - 100, SCREEN_HEIGHT, 191, 6, 5, ARGB(100,10,5,0));
|
renderer->FillRoundRect(SCREEN_WIDTH / 2 - 100, SCREEN_HEIGHT, 191, 6, 5, ARGB(100,10,5,0));
|
||||||
scroller->Render();
|
scroller->Render();
|
||||||
|
|
||||||
if (mBg)
|
if (mBg.get())
|
||||||
renderer->RenderQuad(mBg, SCREEN_WIDTH / 2, 50);
|
renderer->RenderQuad(mBg.get(), SCREEN_WIDTH / 2, 50);
|
||||||
|
|
||||||
JQuad * jq = WResourceManager::Instance()->RetrieveTempQuad("button_shoulder.png");
|
JQuadPtr jq = WResourceManager::Instance()->RetrieveTempQuad("button_shoulder.png");
|
||||||
if (jq)
|
if (jq.get())
|
||||||
{
|
{
|
||||||
int alp = 255;
|
int alp = 255;
|
||||||
if (options.newAward())
|
if (options.newAward())
|
||||||
@@ -719,7 +705,7 @@ void GameStateMenu::Render()
|
|||||||
;
|
;
|
||||||
mFont->SetScale(1.0f);
|
mFont->SetScale(1.0f);
|
||||||
mFont->SetScale(50.0f / mFont->GetStringWidth(s.c_str()));
|
mFont->SetScale(50.0f / mFont->GetStringWidth(s.c_str()));
|
||||||
renderer->RenderQuad(jq, SCREEN_WIDTH - 64, 2);
|
renderer->RenderQuad(jq.get(), SCREEN_WIDTH - 64, 2);
|
||||||
mFont->DrawString(s, SCREEN_WIDTH - 10, 9, JGETEXT_RIGHT);
|
mFont->DrawString(s, SCREEN_WIDTH - 10, 9, JGETEXT_RIGHT);
|
||||||
mFont = WResourceManager::Instance()->GetWFont(Fonts::MENU_FONT);
|
mFont = WResourceManager::Instance()->GetWFont(Fonts::MENU_FONT);
|
||||||
mFont->SetScale(olds);
|
mFont->SetScale(olds);
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ GameStateShop::GameStateShop(GameApp* parent) :
|
|||||||
menu = NULL;
|
menu = NULL;
|
||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
altThumb[i] = NULL;
|
altThumb[i] = NULL;
|
||||||
mBack = NULL;
|
|
||||||
boosterDisplay = NULL;
|
boosterDisplay = NULL;
|
||||||
taskList = NULL;
|
taskList = NULL;
|
||||||
srcCards = NULL;
|
srcCards = NULL;
|
||||||
@@ -143,8 +142,6 @@ void GameStateShop::Start()
|
|||||||
altThumb[6] = WResourceManager::Instance()->RetrieveTexture("land_thumb.jpg", RETRIEVE_LOCK);
|
altThumb[6] = WResourceManager::Instance()->RetrieveTexture("land_thumb.jpg", RETRIEVE_LOCK);
|
||||||
altThumb[7] = WResourceManager::Instance()->RetrieveTexture("gold_thumb.jpg", RETRIEVE_LOCK);
|
altThumb[7] = WResourceManager::Instance()->RetrieveTexture("gold_thumb.jpg", RETRIEVE_LOCK);
|
||||||
|
|
||||||
mBack = WResourceManager::Instance()->GetQuad("back");
|
|
||||||
|
|
||||||
for (int i = 0; i < 8; ++i)
|
for (int i = 0; i < 8; ++i)
|
||||||
{
|
{
|
||||||
std::ostringstream stream;
|
std::ostringstream stream;
|
||||||
@@ -674,17 +671,17 @@ void GameStateShop::Render()
|
|||||||
if (mStage == STAGE_FADE_IN)
|
if (mStage == STAGE_FADE_IN)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
JQuad * mBg = WResourceManager::Instance()->RetrieveTempQuad("shop.jpg", TEXTURE_SUB_5551);
|
JQuadPtr mBg = WResourceManager::Instance()->RetrieveTempQuad("shop.jpg", TEXTURE_SUB_5551);
|
||||||
if (mBg)
|
if (mBg.get())
|
||||||
r->RenderQuad(mBg, 0, 0);
|
r->RenderQuad(mBg.get(), 0, 0);
|
||||||
|
|
||||||
JQuad * quad = WResourceManager::Instance()->RetrieveTempQuad("shop_light.jpg", TEXTURE_SUB_5551);
|
JQuadPtr quad = WResourceManager::Instance()->RetrieveTempQuad("shop_light.jpg", TEXTURE_SUB_5551);
|
||||||
if (quad)
|
if (quad.get())
|
||||||
{
|
{
|
||||||
r->EnableTextureFilter(false);
|
r->EnableTextureFilter(false);
|
||||||
r->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE);
|
r->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE);
|
||||||
quad->SetColor(ARGB(lightAlpha,255,255,255));
|
quad->SetColor(ARGB(lightAlpha,255,255,255));
|
||||||
r->RenderQuad(quad, 0, 0);
|
r->RenderQuad(quad.get(), 0, 0);
|
||||||
r->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA);
|
r->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA);
|
||||||
r->EnableTextureFilter(true);
|
r->EnableTextureFilter(true);
|
||||||
}
|
}
|
||||||
@@ -740,7 +737,7 @@ void GameStateShop::Render()
|
|||||||
mFont->DrawString(stream.str(), 5, SCREEN_HEIGHT - 14);
|
mFont->DrawString(stream.str(), 5, SCREEN_HEIGHT - 14);
|
||||||
|
|
||||||
float len = 4 + mFont->GetStringWidth(kOtherCardsString.c_str());
|
float len = 4 + mFont->GetStringWidth(kOtherCardsString.c_str());
|
||||||
r->RenderQuad(pspIcons[6], SCREEN_WIDTH - len - kGamepadIconSize - 10, SCREEN_HEIGHT - 8, 0, kGamepadIconSize, kGamepadIconSize);
|
r->RenderQuad(pspIcons[6].get(), SCREEN_WIDTH - len - kGamepadIconSize - 10, SCREEN_HEIGHT - 8, 0, kGamepadIconSize, kGamepadIconSize);
|
||||||
mFont->DrawString(kOtherCardsString, SCREEN_WIDTH - len, SCREEN_HEIGHT - 14);
|
mFont->DrawString(kOtherCardsString, SCREEN_WIDTH - len, SCREEN_HEIGHT - 14);
|
||||||
|
|
||||||
mFont->SetColor(ARGB(255,255,255,0));
|
mFont->SetColor(ARGB(255,255,255,0));
|
||||||
|
|||||||
@@ -16,17 +16,18 @@ GuiBackground::~GuiBackground()
|
|||||||
void GuiBackground::Render()
|
void GuiBackground::Render()
|
||||||
{
|
{
|
||||||
JRenderer* renderer = JRenderer::GetInstance();
|
JRenderer* renderer = JRenderer::GetInstance();
|
||||||
JQuad * quad = NULL;
|
JQuadPtr quad;
|
||||||
GameObserver * go = GameObserver::GetInstance();
|
GameObserver * go = GameObserver::GetInstance();
|
||||||
if (go && go->mRules && go->mRules->bg.size())
|
if (go && go->mRules && go->mRules->bg.size())
|
||||||
{
|
{
|
||||||
quad = WResourceManager::Instance()->RetrieveTempQuad(go->mRules->bg);
|
quad = WResourceManager::Instance()->RetrieveTempQuad(go->mRules->bg);
|
||||||
}
|
}
|
||||||
if (!quad)
|
if (!quad.get())
|
||||||
{
|
{
|
||||||
quad = WResourceManager::Instance()->RetrieveTempQuad("backdrop.jpg");
|
quad = WResourceManager::Instance()->RetrieveTempQuad("backdrop.jpg");
|
||||||
}
|
}
|
||||||
if (!quad)
|
if (quad.get())
|
||||||
return;
|
{
|
||||||
renderer->RenderQuad(quad, 0, 18);
|
renderer->RenderQuad(quad.get(), 0, 18);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -390,7 +390,7 @@ void GuiCombat::Render()
|
|||||||
if (activeAtk->card->has(Constants::TRAMPLE))
|
if (activeAtk->card->has(Constants::TRAMPLE))
|
||||||
{
|
{
|
||||||
go->opponent()->mAvatar->SetHotSpot(18, 25);
|
go->opponent()->mAvatar->SetHotSpot(18, 25);
|
||||||
enemy_avatar.Render(go->opponent()->mAvatar);
|
enemy_avatar.Render(go->opponent()->mAvatar.get());
|
||||||
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
|
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
|
||||||
mFont->SetColor(ARGB(255, 255, 64, 0));
|
mFont->SetColor(ARGB(255, 255, 64, 0));
|
||||||
{
|
{
|
||||||
@@ -402,9 +402,9 @@ void GuiCombat::Render()
|
|||||||
}
|
}
|
||||||
if (ok_tex)
|
if (ok_tex)
|
||||||
{
|
{
|
||||||
JQuad *ok_quad = WResourceManager::Instance()->RetrieveTempQuad("Ok.png");
|
JQuadPtr ok_quad = WResourceManager::Instance()->RetrieveTempQuad("Ok.png");
|
||||||
ok_quad->SetHotSpot(28, 22);
|
ok_quad->SetHotSpot(28, 22);
|
||||||
ok.Render(ok_quad);
|
ok.Render(ok_quad.get());
|
||||||
}
|
}
|
||||||
renderer->DrawLine(0, SCREEN_HEIGHT / 2 + 10, SCREEN_WIDTH, SCREEN_HEIGHT / 2 + 10, ARGB(255, 255, 64, 0));
|
renderer->DrawLine(0, SCREEN_HEIGHT / 2 + 10, SCREEN_WIDTH, SCREEN_HEIGHT / 2 + 10, ARGB(255, 255, 64, 0));
|
||||||
if (FIRST_STRIKE == step)
|
if (FIRST_STRIKE == step)
|
||||||
|
|||||||
@@ -9,11 +9,9 @@ GuiFrame::GuiFrame()
|
|||||||
wood = WResourceManager::Instance()->RetrieveQuad("wood.png", 0, 0, SCREEN_WIDTH, 28);
|
wood = WResourceManager::Instance()->RetrieveQuad("wood.png", 0, 0, SCREEN_WIDTH, 28);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wood = NULL;
|
|
||||||
GameApp::systemError += "Can't load wood texture : " __FILE__ "\n";
|
GameApp::systemError += "Can't load wood texture : " __FILE__ "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
goldGlow = gold1 = gold2 = NULL;
|
|
||||||
if (WResourceManager::Instance()->GetTexture("gold.png"))
|
if (WResourceManager::Instance()->GetTexture("gold.png"))
|
||||||
{
|
{
|
||||||
gold1 = WResourceManager::Instance()->RetrieveQuad("gold.png", 0, 0, SCREEN_WIDTH, 6, "gold1");
|
gold1 = WResourceManager::Instance()->RetrieveQuad("gold.png", 0, 0, SCREEN_WIDTH, 6, "gold1");
|
||||||
@@ -41,23 +39,23 @@ void GuiFrame::Render()
|
|||||||
float sized = step / 4;
|
float sized = step / 4;
|
||||||
if (sized > SCREEN_WIDTH)
|
if (sized > SCREEN_WIDTH)
|
||||||
sized -= SCREEN_WIDTH;
|
sized -= SCREEN_WIDTH;
|
||||||
renderer->RenderQuad(wood, 0, 0);
|
renderer->RenderQuad(wood.get(), 0, 0);
|
||||||
if (gold1)
|
if (gold1.get())
|
||||||
{
|
{
|
||||||
renderer->RenderQuad(gold1, -sized, 16);
|
renderer->RenderQuad(gold1.get(), -sized, 16);
|
||||||
renderer->RenderQuad(gold1, -sized + 479, 16);
|
renderer->RenderQuad(gold1.get(), -sized + 479, 16);
|
||||||
|
|
||||||
if (goldGlow)
|
if (goldGlow.get())
|
||||||
{
|
{
|
||||||
goldGlow->SetColor(ARGB((100+(rand()%50)), 255, 255, 255));
|
goldGlow->SetColor(ARGB((100+(rand()%50)), 255, 255, 255));
|
||||||
renderer->RenderQuad(goldGlow, -sized, 9);
|
renderer->RenderQuad(goldGlow.get(), -sized, 9);
|
||||||
renderer->RenderQuad(goldGlow, -sized + 480, 9);
|
renderer->RenderQuad(goldGlow.get(), -sized + 480, 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gold2)
|
if (gold2.get())
|
||||||
{
|
{
|
||||||
renderer->RenderQuad(gold2, step / 2, 16);
|
renderer->RenderQuad(gold2.get(), step / 2, 16);
|
||||||
renderer->RenderQuad(gold2, step / 2 - 479, 16);
|
renderer->RenderQuad(gold2.get(), step / 2 - 479, 16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ GuiHand::GuiHand(MTGHand* hand) :
|
|||||||
GuiLayer(), hand(hand)
|
GuiLayer(), hand(hand)
|
||||||
{
|
{
|
||||||
back = WResourceManager::Instance()->RetrieveTempQuad("handback.png");
|
back = WResourceManager::Instance()->RetrieveTempQuad("handback.png");
|
||||||
if (back)
|
if (back.get())
|
||||||
back->SetTextureRect(1, 0, 100, 250);
|
back->SetTextureRect(1, 0, 100, 250);
|
||||||
else
|
else
|
||||||
GameApp::systemError = "Error loading hand texture : " __FILE__;
|
GameApp::systemError = "Error loading hand texture : " __FILE__;
|
||||||
@@ -68,7 +68,7 @@ GuiHandOpponent::GuiHandOpponent(MTGHand* hand) :
|
|||||||
|
|
||||||
void GuiHandOpponent::Render()
|
void GuiHandOpponent::Render()
|
||||||
{
|
{
|
||||||
JQuad * quad = WResourceManager::Instance()->GetQuad("back_thumb");
|
JQuadPtr quad = WResourceManager::Instance()->GetQuad("back_thumb");
|
||||||
|
|
||||||
float x = 45;
|
float x = 45;
|
||||||
for (vector<CardView*>::iterator it = cards.begin(); it != cards.end(); ++it)
|
for (vector<CardView*>::iterator it = cards.begin(); it != cards.end(); ++it)
|
||||||
@@ -76,7 +76,7 @@ void GuiHandOpponent::Render()
|
|||||||
(*it)->x = x;
|
(*it)->x = x;
|
||||||
(*it)->y = 2;
|
(*it)->y = 2;
|
||||||
(*it)->zoom = 0.3f;
|
(*it)->zoom = 0.3f;
|
||||||
(*it)->Render(quad);
|
(*it)->Render(quad.get());
|
||||||
x += 18;
|
x += 18;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -207,16 +207,16 @@ void GuiHandSelf::Render()
|
|||||||
if (OptionHandDirection::HORIZONTAL == options[Options::HANDDIRECTION].number)
|
if (OptionHandDirection::HORIZONTAL == options[Options::HANDDIRECTION].number)
|
||||||
{
|
{
|
||||||
back->SetColor(ARGB(255,255,0,0));
|
back->SetColor(ARGB(255,255,0,0));
|
||||||
JRenderer::GetInstance()->RenderQuad(back, backpos.actX, backpos.actY, backpos.actT, backpos.actZ, backpos.actZ);
|
JRenderer::GetInstance()->RenderQuad(back.get(), backpos.actX, backpos.actY, backpos.actT, backpos.actZ, backpos.actZ);
|
||||||
back->SetColor(ARGB(255,255,255,255));
|
back->SetColor(ARGB(255,255,255,255));
|
||||||
mFont->DrawString("0", SCREEN_WIDTH - 10, backpos.actY);
|
mFont->DrawString("0", SCREEN_WIDTH - 10, backpos.actY);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
backpos.Render(back);
|
backpos.Render(back.get());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
backpos.Render(back);
|
backpos.Render(back.get());
|
||||||
if (OptionClosedHand::VISIBLE == options[Options::CLOSEDHAND].number || state == Open)
|
if (OptionClosedHand::VISIBLE == options[Options::CLOSEDHAND].number || state == Open)
|
||||||
for (vector<CardView*>::iterator it = cards.begin(); it != cards.end(); ++it)
|
for (vector<CardView*>::iterator it = cards.begin(); it != cards.end(); ++it)
|
||||||
(*it)->Render();
|
(*it)->Render();
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ ManaIcon::ManaIcon(int color, float x, float y, float destx, float desty) :
|
|||||||
Pos(x, y, 0.5, 0.0, 255), f(-1), destx(destx), desty(desty), mode(ALIVE), color(color)
|
Pos(x, y, 0.5, 0.0, 255), f(-1), destx(destx), desty(desty), mode(ALIVE), color(color)
|
||||||
{
|
{
|
||||||
hgeParticleSystemInfo * psi = NULL;
|
hgeParticleSystemInfo * psi = NULL;
|
||||||
JQuad * mq = WResourceManager::Instance()->GetQuad("stars");
|
JQuadPtr mq = WResourceManager::Instance()->GetQuad("stars");
|
||||||
|
|
||||||
if (!mq)
|
if (!mq.get())
|
||||||
{
|
{
|
||||||
particleSys = NULL;
|
particleSys = NULL;
|
||||||
return;
|
return;
|
||||||
@@ -22,22 +22,22 @@ ManaIcon::ManaIcon(int color, float x, float y, float destx, float desty) :
|
|||||||
switch (color)
|
switch (color)
|
||||||
{
|
{
|
||||||
case Constants::MTG_COLOR_RED:
|
case Constants::MTG_COLOR_RED:
|
||||||
psi = WResourceManager::Instance()->RetrievePSI("manared.psi", mq);
|
psi = WResourceManager::Instance()->RetrievePSI("manared.psi", mq.get());
|
||||||
break;
|
break;
|
||||||
case Constants::MTG_COLOR_BLUE:
|
case Constants::MTG_COLOR_BLUE:
|
||||||
psi = WResourceManager::Instance()->RetrievePSI("manablue.psi", mq);
|
psi = WResourceManager::Instance()->RetrievePSI("manablue.psi", mq.get());
|
||||||
break;
|
break;
|
||||||
case Constants::MTG_COLOR_GREEN:
|
case Constants::MTG_COLOR_GREEN:
|
||||||
psi = WResourceManager::Instance()->RetrievePSI("managreen.psi", mq);
|
psi = WResourceManager::Instance()->RetrievePSI("managreen.psi", mq.get());
|
||||||
break;
|
break;
|
||||||
case Constants::MTG_COLOR_BLACK:
|
case Constants::MTG_COLOR_BLACK:
|
||||||
psi = WResourceManager::Instance()->RetrievePSI("manablack.psi", mq);
|
psi = WResourceManager::Instance()->RetrievePSI("manablack.psi", mq.get());
|
||||||
break;
|
break;
|
||||||
case Constants::MTG_COLOR_WHITE:
|
case Constants::MTG_COLOR_WHITE:
|
||||||
psi = WResourceManager::Instance()->RetrievePSI("manawhite.psi", mq);
|
psi = WResourceManager::Instance()->RetrievePSI("manawhite.psi", mq.get());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
psi = WResourceManager::Instance()->RetrievePSI("mana.psi", mq);
|
psi = WResourceManager::Instance()->RetrievePSI("mana.psi", mq.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!psi)
|
if (!psi)
|
||||||
@@ -45,7 +45,7 @@ ManaIcon::ManaIcon(int color, float x, float y, float destx, float desty) :
|
|||||||
psi = NEW hgeParticleSystemInfo();
|
psi = NEW hgeParticleSystemInfo();
|
||||||
if (!psi)
|
if (!psi)
|
||||||
return;
|
return;
|
||||||
hgeParticleSystemInfo * defaults = WResourceManager::Instance()->RetrievePSI("mana.psi", mq);
|
hgeParticleSystemInfo * defaults = WResourceManager::Instance()->RetrievePSI("mana.psi", mq.get());
|
||||||
if (defaults)
|
if (defaults)
|
||||||
{
|
{
|
||||||
memcpy(psi, defaults, sizeof(hgeParticleSystemInfo));
|
memcpy(psi, defaults, sizeof(hgeParticleSystemInfo));
|
||||||
@@ -66,7 +66,7 @@ ManaIcon::ManaIcon(int color, float x, float y, float destx, float desty) :
|
|||||||
psi->fSizeVar = 0.25396827f;
|
psi->fSizeVar = 0.25396827f;
|
||||||
psi->fSpinStart = -5.5555553f;
|
psi->fSpinStart = -5.5555553f;
|
||||||
psi->fAlphaVar = 0.77777779f;
|
psi->fAlphaVar = 0.77777779f;
|
||||||
psi->sprite = mq;
|
psi->sprite = mq.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (color)
|
switch (color)
|
||||||
@@ -150,7 +150,7 @@ void ManaIcon::Render()
|
|||||||
renderer->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE);
|
renderer->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE);
|
||||||
particleSys->Render();
|
particleSys->Render();
|
||||||
renderer->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA);
|
renderer->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA);
|
||||||
renderer->RenderQuad(icon, actX, actY, actT, actZ + zoomP1 * sinf(M_PI * zoomP3), actZ + zoomP2 * cosf(M_PI * zoomP4));
|
renderer->RenderQuad(icon.get(), actX, actY, actT, actZ + zoomP1 * sinf(M_PI * zoomP3), actZ + zoomP2 * cosf(M_PI * zoomP4));
|
||||||
}
|
}
|
||||||
void ManaIcon::Update(float dt, float shift)
|
void ManaIcon::Update(float dt, float shift)
|
||||||
{
|
{
|
||||||
@@ -269,7 +269,7 @@ void GuiMana::RenderStatic()
|
|||||||
if (values[i])
|
if (values[i])
|
||||||
{
|
{
|
||||||
offset -= 20;
|
offset -= 20;
|
||||||
r->RenderQuad(manaIcons[i], xEnd + 15 + offset, y + 5, 0, 0.7f, 0.7f);
|
r->RenderQuad(manaIcons[i].get(), xEnd + 15 + offset, y + 5, 0, 0.7f, 0.7f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
r->FillRoundRect(x0, y, static_cast<float> (20 * totalColors + 5), 8, 2, ARGB(100,0,0,0));
|
r->FillRoundRect(x0, y, static_cast<float> (20 * totalColors + 5), 8, 2, ARGB(100,0,0,0));
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ namespace
|
|||||||
GuiPhaseBar::GuiPhaseBar() :
|
GuiPhaseBar::GuiPhaseBar() :
|
||||||
phase(NULL), angle(0.0f)
|
phase(NULL), angle(0.0f)
|
||||||
{
|
{
|
||||||
JQuad * quad = NULL;
|
JQuadPtr quad = WResourceManager::Instance()->GetQuad("phasebar");
|
||||||
if ((quad = WResourceManager::Instance()->GetQuad("phasebar")) != NULL)
|
if (quad.get() != NULL)
|
||||||
{
|
{
|
||||||
quad->mHeight = kHeight;
|
quad->mHeight = kHeight;
|
||||||
quad->mWidth = kWidth;
|
quad->mWidth = kWidth;
|
||||||
@@ -68,7 +68,7 @@ void GuiPhaseBar::Update(float dt)
|
|||||||
void GuiPhaseBar::Render()
|
void GuiPhaseBar::Render()
|
||||||
{
|
{
|
||||||
GameObserver * g = GameObserver::GetInstance();
|
GameObserver * g = GameObserver::GetInstance();
|
||||||
JQuad * quad = WResourceManager::Instance()->GetQuad("phasebar");
|
JQuadPtr quad = WResourceManager::Instance()->GetQuad("phasebar");
|
||||||
|
|
||||||
JRenderer::GetInstance()->DrawLine(0, CENTER, SCREEN_WIDTH, CENTER, ARGB(255, 255, 255, 255));
|
JRenderer::GetInstance()->DrawLine(0, CENTER, SCREEN_WIDTH, CENTER, ARGB(255, 255, 255, 255));
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ void GuiPhaseBar::Render()
|
|||||||
for (int glyph = 3; glyph < 6; ++glyph)
|
for (int glyph = 3; glyph < 6; ++glyph)
|
||||||
{
|
{
|
||||||
scale = ICONSCALE * sinf(angle + glyph * M_PI / 6) / 2;
|
scale = ICONSCALE * sinf(angle + glyph * M_PI / 6) / 2;
|
||||||
DrawGlyph(quad, glyph, yPos, angle, p, scale);
|
DrawGlyph(quad.get(), glyph, yPos, angle, p, scale);
|
||||||
yPos += kWidth * scale;
|
yPos += kWidth * scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ void GuiPhaseBar::Render()
|
|||||||
{
|
{
|
||||||
scale = ICONSCALE * sinf(angle + glyph * M_PI / 6) / 2;
|
scale = ICONSCALE * sinf(angle + glyph * M_PI / 6) / 2;
|
||||||
yPos -= kWidth * scale;
|
yPos -= kWidth * scale;
|
||||||
DrawGlyph(quad, glyph, yPos, angle, p, scale);
|
DrawGlyph(quad.get(), glyph, yPos, angle, p, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (angle > 0)
|
if (angle > 0)
|
||||||
@@ -97,7 +97,7 @@ void GuiPhaseBar::Render()
|
|||||||
yPos -= kWidth * scale;
|
yPos -= kWidth * scale;
|
||||||
float xPos = static_cast<float> (p % (kPhases * (int) (kWidth + 1)));
|
float xPos = static_cast<float> (p % (kPhases * (int) (kWidth + 1)));
|
||||||
quad->SetTextureRect(xPos, kHeight, kWidth, kHeight);
|
quad->SetTextureRect(xPos, kHeight, kWidth, kHeight);
|
||||||
JRenderer::GetInstance()->RenderQuad(quad, 0, yPos, 0.0, scale, scale);
|
JRenderer::GetInstance()->RenderQuad(quad.get(), 0, yPos, 0.0, scale, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
//print phase name
|
//print phase name
|
||||||
|
|||||||
@@ -57,28 +57,27 @@ void GuiAvatar::Render()
|
|||||||
float x0 = actX;
|
float x0 = actX;
|
||||||
float y0 = actY;
|
float y0 = actY;
|
||||||
|
|
||||||
JQuad * quad = player->mAvatar;
|
if (player->mAvatar.get())
|
||||||
if (quad)
|
|
||||||
{
|
{
|
||||||
if (corner == BOTTOM_RIGHT)
|
if (corner == BOTTOM_RIGHT)
|
||||||
{
|
{
|
||||||
x0 -= quad->mWidth * actZ;
|
x0 -= player->mAvatar->mWidth * actZ;
|
||||||
y0 -= quad->mHeight * actZ;
|
y0 -= player->mAvatar->mHeight * actZ;
|
||||||
}
|
}
|
||||||
switch (corner)
|
switch (corner)
|
||||||
{
|
{
|
||||||
case TOP_LEFT:
|
case TOP_LEFT:
|
||||||
quad->SetHotSpot(0, 0);
|
player->mAvatar->SetHotSpot(0, 0);
|
||||||
break;
|
break;
|
||||||
case BOTTOM_RIGHT:
|
case BOTTOM_RIGHT:
|
||||||
quad->SetHotSpot(35, 50);
|
player->mAvatar->SetHotSpot(35, 50);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
quad->SetColor(ARGB((int)actA, 255, avatarRed, avatarRed));
|
player->mAvatar->SetColor(ARGB((int)actA, 255, avatarRed, avatarRed));
|
||||||
r->RenderQuad(quad, actX, actY, actT, actZ, actZ);
|
r->RenderQuad(player->mAvatar.get(), actX, actY, actT, actZ, actZ);
|
||||||
if (mHasFocus)
|
if (mHasFocus)
|
||||||
{
|
{
|
||||||
r->FillRect(x0, x0, quad->mWidth * actZ, quad->mHeight * actZ, ARGB(abs(128 - wave),255,255,255));
|
r->FillRect(x0, x0, player->mAvatar->mWidth * actZ, player->mAvatar->mHeight * actZ, ARGB(abs(128 - wave),255,255,255));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,11 +151,11 @@ void GuiGameZone::toggleDisplay()
|
|||||||
void GuiGameZone::Render()
|
void GuiGameZone::Render()
|
||||||
{
|
{
|
||||||
//Texture
|
//Texture
|
||||||
JQuad * quad = WResourceManager::Instance()->GetQuad("back_thumb");
|
JQuadPtr quad = WResourceManager::Instance()->GetQuad("back_thumb");
|
||||||
float scale = defaultHeight / quad->mHeight;
|
float scale = defaultHeight / quad->mHeight;
|
||||||
quad->SetColor(ARGB((int)(actA),255,255,255));
|
quad->SetColor(ARGB((int)(actA),255,255,255));
|
||||||
|
|
||||||
JRenderer::GetInstance()->RenderQuad(quad, actX, actY, 0.0, scale * actZ, scale * actZ);
|
JRenderer::GetInstance()->RenderQuad(quad.get(), actX, actY, 0.0, scale * actZ, scale * actZ);
|
||||||
|
|
||||||
float x0 = actX;
|
float x0 = actX;
|
||||||
if (x0 < SCREEN_WIDTH / 2)
|
if (x0 < SCREEN_WIDTH / 2)
|
||||||
|
|||||||
@@ -642,7 +642,7 @@ int MTGCardInstance::canBlock(MTGCardInstance * opponent)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
JQuad * MTGCardInstance::getIcon()
|
JQuadPtr MTGCardInstance::getIcon()
|
||||||
{
|
{
|
||||||
return WResourceManager::Instance()->RetrieveCard(this, CACHE_THUMB);
|
return WResourceManager::Instance()->RetrieveCard(this, CACHE_THUMB);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -203,11 +203,11 @@ void OptionProfile::Render()
|
|||||||
else
|
else
|
||||||
sprintf(buf, "profiles/%s/avatar.jpg", selections[value].c_str());
|
sprintf(buf, "profiles/%s/avatar.jpg", selections[value].c_str());
|
||||||
string filename = buf;
|
string filename = buf;
|
||||||
JQuad * mAvatar = WResourceManager::Instance()->RetrieveTempQuad(filename, TEXTURE_SUB_EXACT);
|
JQuadPtr avatar = WResourceManager::Instance()->RetrieveTempQuad(filename, TEXTURE_SUB_EXACT);
|
||||||
|
|
||||||
if (mAvatar)
|
if (avatar)
|
||||||
{
|
{
|
||||||
renderer->RenderQuad(mAvatar, x, pY);
|
renderer->RenderQuad(avatar.get(), x, pY);
|
||||||
pX += 40;
|
pX += 40;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -460,7 +460,7 @@ OptionTheme::OptionTheme(OptionThemeStyle * style) :
|
|||||||
ts = style;
|
ts = style;
|
||||||
}
|
}
|
||||||
|
|
||||||
JQuad * OptionTheme::getImage()
|
JQuadPtr OptionTheme::getImage()
|
||||||
{
|
{
|
||||||
char buf[512];
|
char buf[512];
|
||||||
string val = selections[value];
|
string val = selections[value];
|
||||||
@@ -510,11 +510,11 @@ void OptionTheme::Render()
|
|||||||
}
|
}
|
||||||
sprintf(buf, _("Theme: %s").c_str(), selections[value].c_str());
|
sprintf(buf, _("Theme: %s").c_str(), selections[value].c_str());
|
||||||
|
|
||||||
JQuad * q = getImage();
|
JQuadPtr q = getImage();
|
||||||
if (q)
|
if (q)
|
||||||
{
|
{
|
||||||
float scale = 128 / q->mHeight;
|
float scale = 128 / q->mHeight;
|
||||||
renderer->RenderQuad(q, x, y, 0, scale, scale);
|
renderer->RenderQuad(q.get(), x, y, 0, scale, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::OPTION_FONT);
|
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::OPTION_FONT);
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ Damageable(20)
|
|||||||
poisonCount = 0;
|
poisonCount = 0;
|
||||||
damageCount = 0;
|
damageCount = 0;
|
||||||
preventable = 0;
|
preventable = 0;
|
||||||
mAvatar = NULL;
|
|
||||||
mAvatarTex = NULL;
|
mAvatarTex = NULL;
|
||||||
type_as_damageable = DAMAGEABLE_PLAYER;
|
type_as_damageable = DAMAGEABLE_PLAYER;
|
||||||
playMode = MODE_HUMAN;
|
playMode = MODE_HUMAN;
|
||||||
@@ -51,7 +50,6 @@ Player::~Player()
|
|||||||
SAFE_DELETE(manaPool);
|
SAFE_DELETE(manaPool);
|
||||||
SAFE_DELETE(game);
|
SAFE_DELETE(game);
|
||||||
WResourceManager::Instance()->Release(mAvatarTex);
|
WResourceManager::Instance()->Release(mAvatarTex);
|
||||||
mAvatar = NULL;
|
|
||||||
mAvatarTex = NULL;
|
mAvatarTex = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,14 +58,11 @@ void Player::loadAvatar(string file)
|
|||||||
if (mAvatarTex)
|
if (mAvatarTex)
|
||||||
{
|
{
|
||||||
WResourceManager::Instance()->Release(mAvatarTex);
|
WResourceManager::Instance()->Release(mAvatarTex);
|
||||||
mAvatar = NULL;
|
|
||||||
mAvatarTex = NULL;
|
mAvatarTex = NULL;
|
||||||
}
|
}
|
||||||
mAvatarTex = WResourceManager::Instance()->RetrieveTexture(file, RETRIEVE_LOCK, TEXTURE_SUB_AVATAR);
|
mAvatarTex = WResourceManager::Instance()->RetrieveTexture(file, RETRIEVE_LOCK, TEXTURE_SUB_AVATAR);
|
||||||
if (mAvatarTex)
|
if (mAvatarTex)
|
||||||
mAvatar = WResourceManager::Instance()->RetrieveQuad(file, 0, 0, 35, 50, "playerAvatar", RETRIEVE_NORMAL, TEXTURE_SUB_AVATAR);
|
mAvatar = WResourceManager::Instance()->RetrieveQuad(file, 0, 0, 35, 50, "playerAvatar", RETRIEVE_NORMAL, TEXTURE_SUB_AVATAR);
|
||||||
else
|
|
||||||
mAvatar = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const string Player::getDisplayName() const
|
const string Player::getDisplayName() const
|
||||||
@@ -92,7 +87,7 @@ int Player::getId()
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
JQuad * Player::getIcon()
|
JQuadPtr Player::getIcon()
|
||||||
{
|
{
|
||||||
return mAvatar;
|
return mAvatar;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,10 +19,10 @@ namespace
|
|||||||
const float kSpadeRightBottomOffset = 3;
|
const float kSpadeRightBottomOffset = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
JQuad* SimpleMenu::spadeR = NULL;
|
JQuadPtr SimpleMenu::spadeR;
|
||||||
JQuad* SimpleMenu::spadeL = NULL;
|
JQuadPtr SimpleMenu::spadeL;
|
||||||
JQuad* SimpleMenu::jewel = NULL;
|
JQuadPtr SimpleMenu::jewel;
|
||||||
JQuad* SimpleMenu::side = NULL;
|
JQuadPtr SimpleMenu::side;
|
||||||
JTexture* SimpleMenu::spadeRTex = NULL;
|
JTexture* SimpleMenu::spadeRTex = NULL;
|
||||||
JTexture* SimpleMenu::spadeLTex = NULL;
|
JTexture* SimpleMenu::spadeLTex = NULL;
|
||||||
JTexture* SimpleMenu::jewelTex = NULL;
|
JTexture* SimpleMenu::jewelTex = NULL;
|
||||||
@@ -52,15 +52,15 @@ SimpleMenu::SimpleMenu(int id, JGuiListener* listener, int fontId, float x, floa
|
|||||||
if (!spadeRTex) spadeRTex = WResourceManager::Instance()->RetrieveTexture("spade_ur.png", RETRIEVE_MANAGE);
|
if (!spadeRTex) spadeRTex = WResourceManager::Instance()->RetrieveTexture("spade_ur.png", RETRIEVE_MANAGE);
|
||||||
if (!jewelTex) jewelTex = renderer->CreateTexture(5, 5, TEX_TYPE_USE_VRAM);
|
if (!jewelTex) jewelTex = renderer->CreateTexture(5, 5, TEX_TYPE_USE_VRAM);
|
||||||
if (!sideTex) sideTex = WResourceManager::Instance()->RetrieveTexture("menuside.png", RETRIEVE_MANAGE);
|
if (!sideTex) sideTex = WResourceManager::Instance()->RetrieveTexture("menuside.png", RETRIEVE_MANAGE);
|
||||||
if (NULL == spadeL) spadeL = WResourceManager::Instance()->RetrieveQuad("spade_ul.png", 0, 0, 0, 0, "spade_ul", RETRIEVE_MANAGE);
|
spadeL = WResourceManager::Instance()->RetrieveQuad("spade_ul.png", 0, 0, 0, 0, "spade_ul", RETRIEVE_MANAGE);
|
||||||
if (NULL == spadeR) spadeR = WResourceManager::Instance()->RetrieveQuad("spade_ur.png", 0, 0, 0, 0, "spade_ur", RETRIEVE_MANAGE);
|
spadeR = WResourceManager::Instance()->RetrieveQuad("spade_ur.png", 0, 0, 0, 0, "spade_ur", RETRIEVE_MANAGE);
|
||||||
if (NULL == jewel) jewel = NEW JQuad(jewelTex, 1, 1, 3, 3);
|
jewel.reset(NEW JQuad(jewelTex, 1, 1, 3, 3));
|
||||||
if (NULL == side) side = WResourceManager::Instance()->RetrieveQuad("menuside.png", 1, 1, 1, kPoleWidth, "menuside", RETRIEVE_MANAGE);
|
side = WResourceManager::Instance()->RetrieveQuad("menuside.png", 1, 1, 1, kPoleWidth, "menuside", RETRIEVE_MANAGE);
|
||||||
|
|
||||||
if (NULL == stars) stars = NEW hgeParticleSystem(WResourceManager::Instance()->RetrievePSI("stars.psi", WResourceManager::Instance()->GetQuad("stars")));
|
if (NULL == stars)
|
||||||
|
stars = NEW hgeParticleSystem(WResourceManager::Instance()->RetrievePSI("stars.psi", WResourceManager::Instance()->GetQuad("stars").get()));
|
||||||
|
|
||||||
stars->FireAt(mX, mY);
|
stars->FireAt(mX, mY);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleMenu::~SimpleMenu()
|
SimpleMenu::~SimpleMenu()
|
||||||
@@ -83,14 +83,14 @@ void SimpleMenu::drawHorzPole(float x, float y, float width)
|
|||||||
rightXOffset = kSpadeRightBottomOffset;
|
rightXOffset = kSpadeRightBottomOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer->RenderQuad(side, x, y, 0, width);
|
renderer->RenderQuad(side.get(), x, y, 0, width);
|
||||||
spadeR->SetHFlip(true);
|
spadeR->SetHFlip(true);
|
||||||
spadeL->SetHFlip(false);
|
spadeL->SetHFlip(false);
|
||||||
renderer->RenderQuad(spadeR, x - leftXOffset, y - yOffset );
|
renderer->RenderQuad(spadeR.get(), x - leftXOffset, y - yOffset );
|
||||||
renderer->RenderQuad(spadeL, x + width - rightXOffset, y - yOffset);
|
renderer->RenderQuad(spadeL.get(), x + width - rightXOffset, y - yOffset);
|
||||||
|
|
||||||
renderer->RenderQuad(jewel, x, y - 1);
|
renderer->RenderQuad(jewel.get(), x, y - 1);
|
||||||
renderer->RenderQuad(jewel, x + width - 1, y - 1);
|
renderer->RenderQuad(jewel.get(), x + width - 1, y - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleMenu::drawVertPole(float x, float y, float height)
|
void SimpleMenu::drawVertPole(float x, float y, float height)
|
||||||
@@ -110,14 +110,14 @@ void SimpleMenu::drawVertPole(float x, float y, float height)
|
|||||||
bottomYOffset = kSpadeRightBottomOffset;
|
bottomYOffset = kSpadeRightBottomOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer->RenderQuad(side, x + kPoleWidth, y, M_PI / 2, height);
|
renderer->RenderQuad(side.get(), x + kPoleWidth, y, M_PI / 2, height);
|
||||||
spadeR->SetHFlip(true);
|
spadeR->SetHFlip(true);
|
||||||
spadeL->SetHFlip(false);
|
spadeL->SetHFlip(false);
|
||||||
renderer->RenderQuad(spadeR, x + kPoleWidth + xOffset, y - topYOffset, M_PI / 2);
|
renderer->RenderQuad(spadeR.get(), x + kPoleWidth + xOffset, y - topYOffset, M_PI / 2);
|
||||||
renderer->RenderQuad(spadeL, x + kPoleWidth + xOffset, y + height - bottomYOffset, M_PI / 2);
|
renderer->RenderQuad(spadeL.get(), x + kPoleWidth + xOffset, y + height - bottomYOffset, M_PI / 2);
|
||||||
|
|
||||||
renderer->RenderQuad(jewel, x - 1, y - 1);
|
renderer->RenderQuad(jewel.get(), x - 1, y - 1);
|
||||||
renderer->RenderQuad(jewel, x - 1, y + height - 1);
|
renderer->RenderQuad(jewel.get(), x - 1, y + height - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleMenu::Render()
|
void SimpleMenu::Render()
|
||||||
@@ -236,7 +236,7 @@ void SimpleMenu::Close()
|
|||||||
|
|
||||||
void SimpleMenu::destroy()
|
void SimpleMenu::destroy()
|
||||||
{
|
{
|
||||||
SAFE_DELETE(SimpleMenu::jewel);
|
SimpleMenu::jewel.reset();
|
||||||
SAFE_DELETE(SimpleMenu::stars);
|
SAFE_DELETE(SimpleMenu::stars);
|
||||||
SAFE_DELETE(SimpleMenu::jewelTex);
|
SAFE_DELETE(SimpleMenu::jewelTex);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,11 +128,11 @@ void SimplePopup::drawCorner(string imageName, bool flipX, bool flipY, float x,
|
|||||||
{
|
{
|
||||||
LOG(" Drawing a Corner! ");
|
LOG(" Drawing a Corner! ");
|
||||||
JRenderer* r = JRenderer::GetInstance();
|
JRenderer* r = JRenderer::GetInstance();
|
||||||
JQuad *horizontalBarImage = WResourceManager::Instance()->RetrieveTempQuad( imageName, TEXTURE_SUB_5551);
|
JQuadPtr horizontalBarImage = WResourceManager::Instance()->RetrieveTempQuad( imageName, TEXTURE_SUB_5551);
|
||||||
horizontalBarImage->SetHFlip(flipX);
|
horizontalBarImage->SetHFlip(flipX);
|
||||||
horizontalBarImage->SetVFlip(flipY);
|
horizontalBarImage->SetVFlip(flipY);
|
||||||
|
|
||||||
r->RenderQuad( horizontalBarImage, x, y);
|
r->RenderQuad(horizontalBarImage.get(), x, y);
|
||||||
LOG(" Done Drawing a Corner! ");
|
LOG(" Done Drawing a Corner! ");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,13 +140,13 @@ void SimplePopup::drawHorzPole(string imageName, bool flipX = false, bool flipY
|
|||||||
{
|
{
|
||||||
LOG(" Drawing a horizontal border! ");
|
LOG(" Drawing a horizontal border! ");
|
||||||
JRenderer* r = JRenderer::GetInstance();
|
JRenderer* r = JRenderer::GetInstance();
|
||||||
JQuad *horizontalBarImage = WResourceManager::Instance()->RetrieveTempQuad( imageName, TEXTURE_SUB_5551);
|
JQuadPtr horizontalBarImage = WResourceManager::Instance()->RetrieveTempQuad( imageName, TEXTURE_SUB_5551);
|
||||||
if ( horizontalBarImage != NULL )
|
if ( horizontalBarImage != NULL )
|
||||||
{
|
{
|
||||||
horizontalBarImage->SetHFlip(flipX);
|
horizontalBarImage->SetHFlip(flipX);
|
||||||
horizontalBarImage->SetVFlip(flipY);
|
horizontalBarImage->SetVFlip(flipY);
|
||||||
|
|
||||||
r->RenderQuad( horizontalBarImage, x, y, 0, width );
|
r->RenderQuad(horizontalBarImage.get(), x, y, 0, width);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -159,13 +159,13 @@ void SimplePopup::drawVertPole(string imageName, bool flipX = false, bool flipY
|
|||||||
{
|
{
|
||||||
LOG(" Drawing a Vertical border! ");
|
LOG(" Drawing a Vertical border! ");
|
||||||
JRenderer* r = JRenderer::GetInstance();
|
JRenderer* r = JRenderer::GetInstance();
|
||||||
JQuad *verticalBarImage = WResourceManager::Instance()->RetrieveTempQuad( imageName, TEXTURE_SUB_5551);
|
JQuadPtr verticalBarImage = WResourceManager::Instance()->RetrieveTempQuad( imageName, TEXTURE_SUB_5551);
|
||||||
if ( verticalBarImage != NULL )
|
if ( verticalBarImage != NULL )
|
||||||
{
|
{
|
||||||
verticalBarImage->SetHFlip(flipX);
|
verticalBarImage->SetHFlip(flipX);
|
||||||
verticalBarImage->SetVFlip(flipY);
|
verticalBarImage->SetVFlip(flipY);
|
||||||
|
|
||||||
r->RenderQuad( verticalBarImage, x, y, 0, 1.0f, height);
|
r->RenderQuad(verticalBarImage.get(), x, y, 0, 1.0f, height);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ StoryImage::StoryImage(string img, float mX, float mY) :
|
|||||||
}
|
}
|
||||||
void StoryImage::Render()
|
void StoryImage::Render()
|
||||||
{
|
{
|
||||||
JQuad * quad = WResourceManager::Instance()->RetrieveTempQuad(img);
|
JQuadPtr quad = WResourceManager::Instance()->RetrieveTempQuad(img);
|
||||||
if (quad)
|
if (quad)
|
||||||
{
|
{
|
||||||
float x = mX;
|
float x = mX;
|
||||||
@@ -202,13 +202,13 @@ void StoryImage::Render()
|
|||||||
x = SCREEN_WIDTH / 2;
|
x = SCREEN_WIDTH / 2;
|
||||||
quad->SetHotSpot(quad->mWidth / 2, 0);
|
quad->SetHotSpot(quad->mWidth / 2, 0);
|
||||||
}
|
}
|
||||||
JRenderer::GetInstance()->RenderQuad(quad, x, mY);
|
JRenderer::GetInstance()->RenderQuad(quad.get(), x, mY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float StoryImage::getHeight()
|
float StoryImage::getHeight()
|
||||||
{
|
{
|
||||||
JQuad * quad = WResourceManager::Instance()->RetrieveQuad(img);
|
JQuadPtr quad = WResourceManager::Instance()->RetrieveQuad(img);
|
||||||
if (quad)
|
if (quad)
|
||||||
{
|
{
|
||||||
return quad->mHeight;
|
return quad->mHeight;
|
||||||
|
|||||||
@@ -112,19 +112,19 @@ const KeyRep& translateKey(LocalKeySym key)
|
|||||||
KeyRep& k = res->second;
|
KeyRep& k = res->second;
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
case PSP_CTRL_SELECT : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)2*32, 32, 64, 32, "PSP_CTRL_SELECT", RETRIEVE_NORMAL); break;
|
case PSP_CTRL_SELECT : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)2*32, 32, 64, 32, "PSP_CTRL_SELECT", RETRIEVE_NORMAL).get(); break;
|
||||||
case PSP_CTRL_START : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)0*32, 32, 64, 32, "PSP_CTRL_START", RETRIEVE_NORMAL); break;
|
case PSP_CTRL_START : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)0*32, 32, 64, 32, "PSP_CTRL_START", RETRIEVE_NORMAL).get(); break;
|
||||||
case PSP_CTRL_UP : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)0*32, 0, 32, 32, "PSP_CTRL_UP", RETRIEVE_NORMAL); break;
|
case PSP_CTRL_UP : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)0*32, 0, 32, 32, "PSP_CTRL_UP", RETRIEVE_NORMAL).get(); break;
|
||||||
case PSP_CTRL_RIGHT : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)3*32, 0, 32, 32, "PSP_CTRL_RIGHT", RETRIEVE_NORMAL); break;
|
case PSP_CTRL_RIGHT : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)3*32, 0, 32, 32, "PSP_CTRL_RIGHT", RETRIEVE_NORMAL).get(); break;
|
||||||
case PSP_CTRL_DOWN : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)1*32, 0, 32, 32, "PSP_CTRL_DOWN", RETRIEVE_NORMAL); break;
|
case PSP_CTRL_DOWN : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)1*32, 0, 32, 32, "PSP_CTRL_DOWN", RETRIEVE_NORMAL).get(); break;
|
||||||
case PSP_CTRL_LEFT : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)2*32, 0, 32, 32, "PSP_CTRL_LEFT", RETRIEVE_NORMAL); break;
|
case PSP_CTRL_LEFT : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)2*32, 0, 32, 32, "PSP_CTRL_LEFT", RETRIEVE_NORMAL).get(); break;
|
||||||
case PSP_CTRL_LTRIGGER : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)6*32, 32, 64, 32, "PSP_CTRL_LTRIGGER", RETRIEVE_NORMAL); break;
|
case PSP_CTRL_LTRIGGER : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)6*32, 32, 64, 32, "PSP_CTRL_LTRIGGER", RETRIEVE_NORMAL).get(); break;
|
||||||
case PSP_CTRL_RTRIGGER : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)8*32, 32, 64, 32, "PSP_CTRL_RTRIGGER", RETRIEVE_NORMAL); break;
|
case PSP_CTRL_RTRIGGER : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)8*32, 32, 64, 32, "PSP_CTRL_RTRIGGER", RETRIEVE_NORMAL).get(); break;
|
||||||
case PSP_CTRL_TRIANGLE : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)5*32, 0, 32, 32, "PSP_CTRL_TRIANGLE", RETRIEVE_NORMAL); break;
|
case PSP_CTRL_TRIANGLE : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)5*32, 0, 32, 32, "PSP_CTRL_TRIANGLE", RETRIEVE_NORMAL).get(); break;
|
||||||
case PSP_CTRL_CIRCLE : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)4*32, 0, 32, 32, "PSP_CTRL_CIRCLE", RETRIEVE_NORMAL); break;
|
case PSP_CTRL_CIRCLE : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)4*32, 0, 32, 32, "PSP_CTRL_CIRCLE", RETRIEVE_NORMAL).get(); break;
|
||||||
case PSP_CTRL_CROSS : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)7*32, 0, 32, 32, "PSP_CTRL_CROSS", RETRIEVE_NORMAL); break;
|
case PSP_CTRL_CROSS : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)7*32, 0, 32, 32, "PSP_CTRL_CROSS", RETRIEVE_NORMAL).get(); break;
|
||||||
case PSP_CTRL_SQUARE : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)6*32, 0, 32, 32, "PSP_CTRL_SQUARE", RETRIEVE_NORMAL); break;
|
case PSP_CTRL_SQUARE : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)6*32, 0, 32, 32, "PSP_CTRL_SQUARE", RETRIEVE_NORMAL).get(); break;
|
||||||
case PSP_CTRL_HOLD : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)4*32, 0, 32, 32, "PSP_CTRL_HOLD", RETRIEVE_NORMAL); break;
|
case PSP_CTRL_HOLD : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)4*32, 0, 32, 32, "PSP_CTRL_HOLD", RETRIEVE_NORMAL).get(); break;
|
||||||
default: /* Unknown key : no icon */ ;
|
default: /* Unknown key : no icon */ ;
|
||||||
}
|
}
|
||||||
return k;
|
return k;
|
||||||
@@ -191,18 +191,18 @@ const KeyRep& translateKey(JButton key) {
|
|||||||
KeyRep& k = res->second;
|
KeyRep& k = res->second;
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
case JGE_BTN_CTRL : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)2*32, 32, 64, 32, "PSP_CTRL_SELECT", RETRIEVE_NORMAL); break;
|
case JGE_BTN_CTRL : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)2*32, 32, 64, 32, "PSP_CTRL_SELECT", RETRIEVE_NORMAL).get(); break;
|
||||||
case JGE_BTN_MENU : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)0*32, 32, 64, 32, "PSP_CTRL_START", RETRIEVE_NORMAL); break;
|
case JGE_BTN_MENU : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)0*32, 32, 64, 32, "PSP_CTRL_START", RETRIEVE_NORMAL).get(); break;
|
||||||
case JGE_BTN_UP : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)0*32, 0, 32, 32, "PSP_CTRL_UP", RETRIEVE_NORMAL); break;
|
case JGE_BTN_UP : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)0*32, 0, 32, 32, "PSP_CTRL_UP", RETRIEVE_NORMAL).get(); break;
|
||||||
case JGE_BTN_RIGHT : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)3*32, 0, 32, 32, "PSP_CTRL_RIGHT", RETRIEVE_NORMAL); break;
|
case JGE_BTN_RIGHT : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)3*32, 0, 32, 32, "PSP_CTRL_RIGHT", RETRIEVE_NORMAL).get(); break;
|
||||||
case JGE_BTN_DOWN : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)1*32, 0, 32, 32, "PSP_CTRL_DOWN", RETRIEVE_NORMAL); break;
|
case JGE_BTN_DOWN : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)1*32, 0, 32, 32, "PSP_CTRL_DOWN", RETRIEVE_NORMAL).get(); break;
|
||||||
case JGE_BTN_LEFT : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)2*32, 0, 32, 32, "PSP_CTRL_LEFT", RETRIEVE_NORMAL); break;
|
case JGE_BTN_LEFT : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)2*32, 0, 32, 32, "PSP_CTRL_LEFT", RETRIEVE_NORMAL).get(); break;
|
||||||
case JGE_BTN_PREV : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)6*32, 32, 64, 32, "PSP_CTRL_LTRIGGER", RETRIEVE_NORMAL); break;
|
case JGE_BTN_PREV : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)6*32, 32, 64, 32, "PSP_CTRL_LTRIGGER", RETRIEVE_NORMAL).get(); break;
|
||||||
case JGE_BTN_NEXT : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)8*32, 32, 64, 32, "PSP_CTRL_RTRIGGER", RETRIEVE_NORMAL); break;
|
case JGE_BTN_NEXT : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)8*32, 32, 64, 32, "PSP_CTRL_RTRIGGER", RETRIEVE_NORMAL).get(); break;
|
||||||
case JGE_BTN_CANCEL : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)5*32, 0, 32, 32, "PSP_CTRL_TRIANGLE", RETRIEVE_NORMAL); break;
|
case JGE_BTN_CANCEL : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)5*32, 0, 32, 32, "PSP_CTRL_TRIANGLE", RETRIEVE_NORMAL).get(); break;
|
||||||
case JGE_BTN_OK : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)4*32, 0, 32, 32, "PSP_CTRL_CIRCLE", RETRIEVE_NORMAL); break;
|
case JGE_BTN_OK : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)4*32, 0, 32, 32, "PSP_CTRL_CIRCLE", RETRIEVE_NORMAL).get(); break;
|
||||||
case JGE_BTN_SEC : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)7*32, 0, 32, 32, "PSP_CTRL_CROSS", RETRIEVE_NORMAL); break;
|
case JGE_BTN_SEC : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)7*32, 0, 32, 32, "PSP_CTRL_CROSS", RETRIEVE_NORMAL).get(); break;
|
||||||
case JGE_BTN_PRI : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)6*32, 0, 32, 32, "PSP_CTRL_SQUARE", RETRIEVE_NORMAL); break;
|
case JGE_BTN_PRI : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)6*32, 0, 32, 32, "PSP_CTRL_SQUARE", RETRIEVE_NORMAL).get(); break;
|
||||||
default: /* Unknown key : no icon */ ;
|
default: /* Unknown key : no icon */ ;
|
||||||
}
|
}
|
||||||
return k;
|
return k;
|
||||||
|
|||||||
@@ -77,19 +77,7 @@ WCachedTexture::WCachedTexture()
|
|||||||
WCachedTexture::~WCachedTexture()
|
WCachedTexture::~WCachedTexture()
|
||||||
{
|
{
|
||||||
if (texture)
|
if (texture)
|
||||||
SAFE_DELETE(texture);
|
SAFE_DELETE(texture);
|
||||||
|
|
||||||
if (!trackedQuads.size()) return;
|
|
||||||
|
|
||||||
vector<WTrackedQuad*>::iterator it;
|
|
||||||
WTrackedQuad * tq = NULL;
|
|
||||||
|
|
||||||
for (it = trackedQuads.begin(); it != trackedQuads.end(); it++)
|
|
||||||
{
|
|
||||||
tq = (*it);
|
|
||||||
SAFE_DELETE(tq);
|
|
||||||
}
|
|
||||||
trackedQuads.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JTexture * WCachedTexture::Actual()
|
JTexture * WCachedTexture::Actual()
|
||||||
@@ -99,135 +87,44 @@ JTexture * WCachedTexture::Actual()
|
|||||||
|
|
||||||
bool WCachedTexture::isLocked()
|
bool WCachedTexture::isLocked()
|
||||||
{
|
{
|
||||||
if (locks != WRES_UNLOCKED) return true;
|
return (locks != WRES_UNLOCKED);
|
||||||
|
|
||||||
for (vector<WTrackedQuad*>::iterator it = trackedQuads.begin(); it != trackedQuads.end(); it++)
|
|
||||||
{
|
|
||||||
if ((*it) && (*it)->isLocked()) return true;
|
|
||||||
//null case
|
|
||||||
//tokens that were using workarounds such as mixes of aslongas with CD checks
|
|
||||||
//and thisforeach would call to cache the tokens image, but since the effect never resolved it was NULL
|
|
||||||
//when it came time to check if it was locked, it would trigger a break point here.
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WCachedTexture::ReleaseQuad(JQuad* quad)
|
JQuadPtr WCachedTexture::GetQuad(float offX, float offY, float width, float height, const string& resname)
|
||||||
{
|
{
|
||||||
if (quad == NULL) return false;
|
if (!texture) return JQuadPtr();
|
||||||
|
|
||||||
WTrackedQuad * tq = NULL;
|
|
||||||
vector<WTrackedQuad*>::iterator nit;
|
|
||||||
for (vector<WTrackedQuad*>::iterator it = trackedQuads.begin(); it != trackedQuads.end(); it = nit)
|
|
||||||
{
|
|
||||||
nit = it;
|
|
||||||
nit++;
|
|
||||||
if ((*it) && (*it)->quad == quad)
|
|
||||||
{
|
|
||||||
tq = (*it);
|
|
||||||
tq->unlock();
|
|
||||||
|
|
||||||
if (!tq->isLocked())
|
|
||||||
{
|
|
||||||
SAFE_DELETE(tq);
|
|
||||||
trackedQuads.erase(it);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true; //Returns true when found.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
WTrackedQuad * WCachedTexture::GetTrackedQuad(float offX, float offY, float width, float height, string resname)
|
|
||||||
{
|
|
||||||
if (!texture) return NULL;
|
|
||||||
|
|
||||||
bool allocated = false;
|
|
||||||
WTrackedQuad * tq = NULL;
|
|
||||||
JQuad * quad = NULL;
|
|
||||||
|
|
||||||
vector<WTrackedQuad*>::iterator it;
|
|
||||||
|
|
||||||
if (width == 0.0f || width > static_cast<float> (texture->mWidth)) width = static_cast<float> (texture->mWidth);
|
if (width == 0.0f || width > static_cast<float> (texture->mWidth)) width = static_cast<float> (texture->mWidth);
|
||||||
if (height == 0.0f || height > static_cast<float> (texture->mHeight)) height = static_cast<float> (texture->mHeight);
|
if (height == 0.0f || height > static_cast<float> (texture->mHeight)) height = static_cast<float> (texture->mHeight);
|
||||||
|
|
||||||
for (it = trackedQuads.begin(); it != trackedQuads.end(); it++)
|
std::map<string, JQuadPtr>::iterator iter = mTrackedQuads.find(resname);
|
||||||
{
|
if (iter != mTrackedQuads.end())
|
||||||
if ((*it) && (*it)->resname == resname)
|
return iter->second;
|
||||||
{
|
|
||||||
tq = (*it);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!tq)
|
JQuadPtr quad(NEW JQuad(texture, offX, offY, width, height));
|
||||||
{
|
|
||||||
allocated = true;
|
|
||||||
tq = NEW WTrackedQuad(resname);
|
|
||||||
if (!tq) return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
quad = tq->quad;
|
|
||||||
|
|
||||||
if (!quad)
|
|
||||||
{
|
|
||||||
quad = NEW JQuad(texture, offX, offY, width, height);
|
|
||||||
/*
|
|
||||||
There's a risk this erases the texture calling the quad creation.... Erwan 2010/03/13
|
|
||||||
if(!quad) {
|
|
||||||
//Probably out of memory. Try again.
|
|
||||||
WResourceManager::Instance()->Cleanup();
|
|
||||||
quad = NEW JQuad(texture,offX,offY,width,height);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if (!quad)
|
|
||||||
{
|
|
||||||
if (allocated && tq)
|
|
||||||
SAFE_DELETE(tq);
|
|
||||||
fprintf(stderr, "WCACHEDRESOURCE:GetTrackedQuad - Quad is null\n");
|
|
||||||
return NULL; //Probably a crash.
|
|
||||||
}
|
|
||||||
|
|
||||||
tq->quad = quad;
|
|
||||||
if (allocated) trackedQuads.push_back(tq);
|
|
||||||
return tq;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Update JQ's values to what we called this with.
|
//Update JQ's values to what we called this with.
|
||||||
quad->SetTextureRect(offX, offY, width, height);
|
quad->SetTextureRect(offX, offY, width, height);
|
||||||
return tq;
|
mTrackedQuads.insert(std::pair<string, JQuadPtr>(resname, quad));
|
||||||
|
return quad;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JQuad * WCachedTexture::GetQuad(float offX, float offY, float width, float height, string resname)
|
JQuadPtr WCachedTexture::GetQuad(const string& resname)
|
||||||
{
|
{
|
||||||
WTrackedQuad * tq = GetTrackedQuad(offX, offY, width, height, resname);
|
JQuadPtr result;
|
||||||
|
std::map<string, JQuadPtr>::iterator iter = mTrackedQuads.find(resname);
|
||||||
|
if (iter != mTrackedQuads.end())
|
||||||
|
result = iter->second;
|
||||||
|
|
||||||
if (tq) return tq->quad;
|
return result;
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JQuad * WCachedTexture::GetQuad(string resname)
|
JQuadPtr WCachedTexture::GetCard(float offX, float offY, float width, float height, const string& resname)
|
||||||
{
|
{
|
||||||
vector<WTrackedQuad*>::iterator it;
|
JQuadPtr jq = GetQuad(offX, offY, width, height, resname);
|
||||||
|
if (jq.get())
|
||||||
for (it = trackedQuads.begin(); it != trackedQuads.end(); it++)
|
jq->SetHotSpot(static_cast<float> (jq->mTex->mWidth / 2), static_cast<float> (jq->mTex->mHeight / 2));
|
||||||
{
|
|
||||||
if ((*it) && (*it)->resname == resname)
|
|
||||||
{
|
|
||||||
return (*it)->quad;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
JQuad * WCachedTexture::GetCard(float offX, float offY, float width, float height, string resname)
|
|
||||||
{
|
|
||||||
JQuad * jq = GetQuad(offX, offY, width, height, resname);
|
|
||||||
if (jq) jq->SetHotSpot(static_cast<float> (jq->mTex->mWidth / 2), static_cast<float> (jq->mTex->mHeight / 2));
|
|
||||||
|
|
||||||
return jq;
|
return jq;
|
||||||
}
|
}
|
||||||
@@ -265,46 +162,45 @@ void WCachedTexture::Refresh()
|
|||||||
|
|
||||||
JRenderer::GetInstance()->TransferTextureToGLContext(*texture);
|
JRenderer::GetInstance()->TransferTextureToGLContext(*texture);
|
||||||
|
|
||||||
for (vector<WTrackedQuad*>::iterator it = trackedQuads.begin(); it != trackedQuads.end(); it++)
|
for (map<string, JQuadPtr>::iterator it = mTrackedQuads.begin(); it != mTrackedQuads.end(); ++it)
|
||||||
{
|
{
|
||||||
if ((*it) && (*it)->quad) (*it)->quad->mTex = texture;
|
if (it->second.get())
|
||||||
|
it->second->mTex = texture;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WCachedTexture::Attempt(string filename, int submode, int & error)
|
bool WCachedTexture::Attempt(const string& filename, int submode, int & error)
|
||||||
{
|
{
|
||||||
mFilename = filename;
|
mFilename = filename;
|
||||||
int format = TEXTURE_FORMAT;
|
int format = TEXTURE_FORMAT;
|
||||||
loadedMode = submode;
|
loadedMode = submode;
|
||||||
string realname;
|
string realname = filename;
|
||||||
|
|
||||||
//Form correct filename.
|
//Form correct filename.
|
||||||
if (submode & TEXTURE_SUB_EXACT)
|
if (submode & TEXTURE_SUB_CARD)
|
||||||
realname = filename;
|
|
||||||
else if (submode & TEXTURE_SUB_CARD)
|
|
||||||
{
|
{
|
||||||
if (submode & TEXTURE_SUB_THUMB)
|
if (submode & TEXTURE_SUB_THUMB)
|
||||||
{
|
{
|
||||||
for (string::size_type i = 0; i < filename.size(); i++)
|
for (string::size_type i = 0; i < realname.size(); i++)
|
||||||
{
|
{
|
||||||
if (filename[i] == '\\' || filename[i] == '/')
|
if (realname[i] == '\\' || realname[i] == '/')
|
||||||
{
|
{
|
||||||
filename.insert(i + 1, "thumbnails/");
|
realname.insert(i + 1, "thumbnails/");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
realname = WResourceManager::Instance()->cardFile(filename);
|
realname = WResourceManager::Instance()->cardFile(realname);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (submode & TEXTURE_SUB_THUMB) filename.insert(0, "thumbnails/");
|
if (submode & TEXTURE_SUB_THUMB) realname.insert(0, "thumbnails/");
|
||||||
|
|
||||||
if (submode & TEXTURE_SUB_AVATAR)
|
if (submode & TEXTURE_SUB_AVATAR)
|
||||||
realname = WResourceManager::Instance()->avatarFile(filename);
|
realname = WResourceManager::Instance()->avatarFile(realname);
|
||||||
else
|
else
|
||||||
realname = WResourceManager::Instance()->graphicsFile(filename);
|
realname = WResourceManager::Instance()->graphicsFile(realname);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Apply pixel mode
|
//Apply pixel mode
|
||||||
@@ -364,7 +260,7 @@ void WCachedSample::Refresh()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WCachedSample::Attempt(string filename, int submode, int & error)
|
bool WCachedSample::Attempt(const string& filename, int submode, int & error)
|
||||||
{
|
{
|
||||||
loadedMode = submode;
|
loadedMode = submode;
|
||||||
|
|
||||||
@@ -418,7 +314,7 @@ void WCachedParticles::Refresh()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WCachedParticles::Attempt(string filename, int submode, int & error)
|
bool WCachedParticles::Attempt(const string& filename, int submode, int & error)
|
||||||
{
|
{
|
||||||
|
|
||||||
JFileSystem* fileSys = JFileSystem::GetInstance();
|
JFileSystem* fileSys = JFileSystem::GetInstance();
|
||||||
@@ -459,26 +355,3 @@ WCachedParticles::~WCachedParticles()
|
|||||||
{
|
{
|
||||||
SAFE_DELETE(particles);
|
SAFE_DELETE(particles);
|
||||||
}
|
}
|
||||||
|
|
||||||
//WTrackedQuad
|
|
||||||
unsigned long WTrackedQuad::size()
|
|
||||||
{
|
|
||||||
return sizeof(JQuad);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool WTrackedQuad::isGood()
|
|
||||||
{
|
|
||||||
return (quad != NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
WTrackedQuad::WTrackedQuad(string _resname)
|
|
||||||
{
|
|
||||||
quad = NULL;
|
|
||||||
resname = _resname;
|
|
||||||
}
|
|
||||||
|
|
||||||
WTrackedQuad::~WTrackedQuad()
|
|
||||||
{
|
|
||||||
if (quad)
|
|
||||||
SAFE_DELETE(quad);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ bool WSyncable::prev()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//WSrcImage
|
//WSrcImage
|
||||||
JQuad * WSrcImage::getImage(int offset)
|
JQuadPtr WSrcImage::getImage(int offset)
|
||||||
{
|
{
|
||||||
return WResourceManager::Instance()->RetrieveTempQuad(filename);
|
return WResourceManager::Instance()->RetrieveTempQuad(filename);
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,7 @@ WSrcCards::WSrcCards(float delay)
|
|||||||
filtersRoot = NULL;
|
filtersRoot = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
JQuad * WSrcCards::getImage(int offset)
|
JQuadPtr WSrcCards::getImage(int offset)
|
||||||
{
|
{
|
||||||
#if defined WIN32 || defined LINUX //Loading delay only on PSP.
|
#if defined WIN32 || defined LINUX //Loading delay only on PSP.
|
||||||
#else
|
#else
|
||||||
@@ -66,7 +66,7 @@ JQuad * WSrcCards::getImage(int offset)
|
|||||||
return WResourceManager::Instance()->RetrieveCard(getCard(offset));
|
return WResourceManager::Instance()->RetrieveCard(getCard(offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
JQuad * WSrcCards::getThumb(int offset)
|
JQuadPtr WSrcCards::getThumb(int offset)
|
||||||
{
|
{
|
||||||
return WResourceManager::Instance()->RetrieveCard(getCard(offset), RETRIEVE_THUMB);
|
return WResourceManager::Instance()->RetrieveCard(getCard(offset), RETRIEVE_THUMB);
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-10
@@ -504,22 +504,22 @@ void WFBFont::DrawString(const char *s, float x, float y, int align, float leftO
|
|||||||
float scale = 0.05f * cosf(2 * M_PI * ((float) t) / 256.0f);
|
float scale = 0.05f * cosf(2 * M_PI * ((float) t) / 256.0f);
|
||||||
if (scale < 0)
|
if (scale < 0)
|
||||||
{
|
{
|
||||||
mRenderer->RenderQuad(manaIcons[mana], xx + 3 * sinf(2 * M_PI * ((float) t) / 256.0f), yy + 3 * cosf(2
|
mRenderer->RenderQuad(manaIcons[mana].get(), xx + 3 * sinf(2 * M_PI * ((float) t) / 256.0f), yy + 3 * cosf(2
|
||||||
* M_PI * ((float) (t - 35)) / 256.0f), 0, 0.5f * mScale, 0.5f * mScale);
|
* M_PI * ((float) (t - 35)) / 256.0f), 0, 0.5f * mScale, 0.5f * mScale);
|
||||||
mRenderer->RenderQuad(manaIcons[mana2], xx + 3 * sinf(2 * M_PI * ((float) v) / 256.0f), yy + 3 * cosf(2
|
mRenderer->RenderQuad(manaIcons[mana2].get(), xx + 3 * sinf(2 * M_PI * ((float) v) / 256.0f), yy + 3 * cosf(2
|
||||||
* M_PI * ((float) (v - 35)) / 256.0f), 0, 0.5f * mScale, 0.5f * mScale);
|
* M_PI * ((float) (v - 35)) / 256.0f), 0, 0.5f * mScale, 0.5f * mScale);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mRenderer->RenderQuad(manaIcons[mana2], xx + 3 * sinf(2 * M_PI * ((float) v) / 256.0f), yy + 3 * cosf(2
|
mRenderer->RenderQuad(manaIcons[mana2].get(), xx + 3 * sinf(2 * M_PI * ((float) v) / 256.0f), yy + 3 * cosf(2
|
||||||
* M_PI * ((float) (v - 35)) / 256.0f), 0, 0.5f * mScale, 0.5f * mScale);
|
* M_PI * ((float) (v - 35)) / 256.0f), 0, 0.5f * mScale, 0.5f * mScale);
|
||||||
mRenderer->RenderQuad(manaIcons[mana], xx + 3 * sinf(2 * M_PI * ((float) t) / 256.0f), yy + 3 * cosf(2
|
mRenderer->RenderQuad(manaIcons[mana].get(), xx + 3 * sinf(2 * M_PI * ((float) t) / 256.0f), yy + 3 * cosf(2
|
||||||
* M_PI * ((float) (t - 35)) / 256.0f), 0, 0.5f * mScale, 0.5f * mScale);
|
* M_PI * ((float) (t - 35)) / 256.0f), 0, 0.5f * mScale, 0.5f * mScale);
|
||||||
}
|
}
|
||||||
mana = Constants::MTG_NB_COLORS + 1; // do not draw colorless cost in hybrid mana cost
|
mana = Constants::MTG_NB_COLORS + 1; // do not draw colorless cost in hybrid mana cost
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mRenderer->RenderQuad(manaIcons[mana], xx, yy, 0, 0.5f * mScale, 0.5f * mScale);
|
mRenderer->RenderQuad(manaIcons[mana].get(), xx, yy, 0, 0.5f * mScale, 0.5f * mScale);
|
||||||
mRenderer->BindTexture(mTexture); // manaIcons use different texture, so we need to rebind it.
|
mRenderer->BindTexture(mTexture); // manaIcons use different texture, so we need to rebind it.
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -923,22 +923,22 @@ void WGBKFont::DrawString(const char *s, float x, float y, int align, float left
|
|||||||
float scale = 0.05f * cosf(2 * M_PI * ((float) t) / 256.0f);
|
float scale = 0.05f * cosf(2 * M_PI * ((float) t) / 256.0f);
|
||||||
if (scale < 0)
|
if (scale < 0)
|
||||||
{
|
{
|
||||||
mRenderer->RenderQuad(manaIcons[mana], xx + 3 * sinf(2 * M_PI * ((float) t) / 256.0f), yy + 3 * cosf(2
|
mRenderer->RenderQuad(manaIcons[mana].get(), xx + 3 * sinf(2 * M_PI * ((float) t) / 256.0f), yy + 3 * cosf(2
|
||||||
* M_PI * ((float) (t - 35)) / 256.0f), 0, 0.5f * mScale, 0.5f * mScale);
|
* M_PI * ((float) (t - 35)) / 256.0f), 0, 0.5f * mScale, 0.5f * mScale);
|
||||||
mRenderer->RenderQuad(manaIcons[mana2], xx + 3 * sinf(2 * M_PI * ((float) v) / 256.0f), yy + 3 * cosf(2
|
mRenderer->RenderQuad(manaIcons[mana2].get(), xx + 3 * sinf(2 * M_PI * ((float) v) / 256.0f), yy + 3 * cosf(2
|
||||||
* M_PI * ((float) (v - 35)) / 256.0f), 0, 0.5f * mScale, 0.5f * mScale);
|
* M_PI * ((float) (v - 35)) / 256.0f), 0, 0.5f * mScale, 0.5f * mScale);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mRenderer->RenderQuad(manaIcons[mana2], xx + 3 * sinf(2 * M_PI * ((float) v) / 256.0f), yy + 3 * cosf(2
|
mRenderer->RenderQuad(manaIcons[mana2].get(), xx + 3 * sinf(2 * M_PI * ((float) v) / 256.0f), yy + 3 * cosf(2
|
||||||
* M_PI * ((float) (v - 35)) / 256.0f), 0, 0.5f * mScale, 0.5f * mScale);
|
* M_PI * ((float) (v - 35)) / 256.0f), 0, 0.5f * mScale, 0.5f * mScale);
|
||||||
mRenderer->RenderQuad(manaIcons[mana], xx + 3 * sinf(2 * M_PI * ((float) t) / 256.0f), yy + 3 * cosf(2
|
mRenderer->RenderQuad(manaIcons[mana].get(), xx + 3 * sinf(2 * M_PI * ((float) t) / 256.0f), yy + 3 * cosf(2
|
||||||
* M_PI * ((float) (t - 35)) / 256.0f), 0, 0.5f * mScale, 0.5f * mScale);
|
* M_PI * ((float) (t - 35)) / 256.0f), 0, 0.5f * mScale, 0.5f * mScale);
|
||||||
}
|
}
|
||||||
mana = Constants::MTG_NB_COLORS + 1; // donot draw colorless cost in hybrid mana cost
|
mana = Constants::MTG_NB_COLORS + 1; // donot draw colorless cost in hybrid mana cost
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mRenderer->RenderQuad(manaIcons[mana], xx, yy, 0, 0.5f * mScale, 0.5f * mScale);
|
mRenderer->RenderQuad(manaIcons[mana].get(), xx, yy, 0, 0.5f * mScale, 0.5f * mScale);
|
||||||
mRenderer->BindTexture(mTexture); // manaIcons use different texture, so we need to rebind it.
|
mRenderer->BindTexture(mTexture); // manaIcons use different texture, so we need to rebind it.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+27
-26
@@ -38,6 +38,7 @@ PIXEL_TYPE WGuiBase::getColor(int type)
|
|||||||
}
|
}
|
||||||
return ARGB(150,50,50,50);
|
return ARGB(150,50,50,50);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Renders the backdrop of a WGui item.
|
Renders the backdrop of a WGui item.
|
||||||
Meant to be overriden in subclasses that require a unique backdrop.
|
Meant to be overriden in subclasses that require a unique backdrop.
|
||||||
@@ -102,7 +103,6 @@ bool WGuiItem::Leaving(JButton key)
|
|||||||
|
|
||||||
void WGuiItem::Render()
|
void WGuiItem::Render()
|
||||||
{
|
{
|
||||||
|
|
||||||
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::OPTION_FONT);
|
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::OPTION_FONT);
|
||||||
DWORD oldcolor = mFont->GetColor();
|
DWORD oldcolor = mFont->GetColor();
|
||||||
mFont->SetColor(getColor(WGuiColor::TEXT));
|
mFont->SetColor(getColor(WGuiColor::TEXT));
|
||||||
@@ -1203,10 +1203,10 @@ void WGuiAward::Overlay()
|
|||||||
float fH = mFont->GetHeight();
|
float fH = mFont->GetHeight();
|
||||||
|
|
||||||
if (fH < 16) fH = 18;
|
if (fH < 16) fH = 18;
|
||||||
JQuad * button = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float) 4 * 32, 0, 32, 32, "", RETRIEVE_NORMAL);
|
JQuadPtr button = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float) 4 * 32, 0, 32, 32, "", RETRIEVE_NORMAL);
|
||||||
|
|
||||||
r->FillRoundRect(5, 10, fW + 32, fH + 2, 2, getColor(WGuiColor::BACK));
|
r->FillRoundRect(5, 10, fW + 32, fH + 2, 2, getColor(WGuiColor::BACK));
|
||||||
if (button) r->RenderQuad(button, 10, 12, 0, .5, .5);
|
if (button) r->RenderQuad(button.get(), 10, 12, 0, .5, .5);
|
||||||
mFont->DrawString(::_(s), 30, 16);
|
mFont->DrawString(::_(s), 30, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1215,8 +1215,7 @@ void WGuiAward::Overlay()
|
|||||||
void WGuiAward::Underlay()
|
void WGuiAward::Underlay()
|
||||||
{
|
{
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
JRenderer * r = JRenderer::GetInstance();
|
JQuadPtr trophy;
|
||||||
JQuad * trophy = NULL;
|
|
||||||
|
|
||||||
string n = Options::getName(id);
|
string n = Options::getName(id);
|
||||||
if (n.size())
|
if (n.size())
|
||||||
@@ -1230,12 +1229,12 @@ void WGuiAward::Underlay()
|
|||||||
trophy = WResourceManager::Instance()->RetrieveTempQuad("trophy_set.png"); //TODO FIXME: Should look in set dir too.
|
trophy = WResourceManager::Instance()->RetrieveTempQuad("trophy_set.png"); //TODO FIXME: Should look in set dir too.
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!trophy) //Fallback to basic trophy image.
|
if (!trophy.get()) //Fallback to basic trophy image.
|
||||||
trophy = WResourceManager::Instance()->RetrieveTempQuad("trophy.png");
|
trophy = WResourceManager::Instance()->RetrieveTempQuad("trophy.png");
|
||||||
|
|
||||||
if (trophy)
|
if (trophy.get())
|
||||||
{
|
{
|
||||||
r->RenderQuad(trophy, 0, SCREEN_HEIGHT - trophy->mHeight);
|
JRenderer::GetInstance()->RenderQuad(trophy.get(), 0, SCREEN_HEIGHT - trophy->mHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1245,7 +1244,6 @@ void WGuiAward::Render()
|
|||||||
|
|
||||||
if (!goa) return;
|
if (!goa) return;
|
||||||
|
|
||||||
JRenderer * renderer = JRenderer::GetInstance();
|
|
||||||
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::OPTION_FONT);
|
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::OPTION_FONT);
|
||||||
mFont->SetScale(1);
|
mFont->SetScale(1);
|
||||||
mFont->SetColor(getColor(WGuiColor::TEXT));
|
mFont->SetColor(getColor(WGuiColor::TEXT));
|
||||||
@@ -1256,7 +1254,7 @@ void WGuiAward::Render()
|
|||||||
float fM = fH / 5; //Font Margin is 20% font height
|
float fM = fH / 5; //Font Margin is 20% font height
|
||||||
|
|
||||||
myX += fM;
|
myX += fM;
|
||||||
renderer->FillRoundRect(x - fM / 2, y - fM, getWidth() - fM, fH - fM, fM, getColor(WGuiColor::BACK_TAB));
|
JRenderer::GetInstance()->FillRoundRect(x - fM / 2, y - fM, getWidth() - fM, fH - fM, fM, getColor(WGuiColor::BACK_TAB));
|
||||||
mFont->DrawString(::_(displayValue).c_str(), myX, myY, JGETEXT_LEFT);
|
mFont->DrawString(::_(displayValue).c_str(), myX, myY, JGETEXT_LEFT);
|
||||||
|
|
||||||
myY += fH + 3 * fM;
|
myY += fH + 3 * fM;
|
||||||
@@ -1292,7 +1290,7 @@ WGuiAward::~WGuiAward()
|
|||||||
}
|
}
|
||||||
bool WGuiAward::Visible()
|
bool WGuiAward::Visible()
|
||||||
{
|
{
|
||||||
//WGuiAward is only visible when it's tied to an already acchieved award.
|
//WGuiAward is only visible when it's tied to an already achieved award.
|
||||||
GameOptionAward * goa = dynamic_cast<GameOptionAward*> (&options[id]);
|
GameOptionAward * goa = dynamic_cast<GameOptionAward*> (&options[id]);
|
||||||
if (!goa || !goa->number) return false;
|
if (!goa || !goa->number) return false;
|
||||||
return true;
|
return true;
|
||||||
@@ -1316,11 +1314,11 @@ void WGuiImage::imageScale(float _w, float _h)
|
|||||||
|
|
||||||
float WGuiImage::getHeight()
|
float WGuiImage::getHeight()
|
||||||
{
|
{
|
||||||
JQuad * q = NULL;
|
JQuadPtr q = source->getImage();
|
||||||
|
|
||||||
if (imgH == 0)
|
if (imgH == 0)
|
||||||
{
|
{
|
||||||
if (source && (q = source->getImage())) //Intentional assignment.
|
if (source && q.get())
|
||||||
return MAX(height,q->mHeight+(2*margin));
|
return MAX(height,q->mHeight+(2*margin));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1331,15 +1329,14 @@ void WGuiImage::Render()
|
|||||||
{
|
{
|
||||||
if (!source) return;
|
if (!source) return;
|
||||||
|
|
||||||
JRenderer * renderer = JRenderer::GetInstance();
|
JQuadPtr q = source->getImage();
|
||||||
JQuad * q = source->getImage();
|
|
||||||
if (q)
|
if (q)
|
||||||
{
|
{
|
||||||
float xS = 1, yS = 1;
|
float xS = 1, yS = 1;
|
||||||
if (imgH != 0 && q->mHeight != 0) yS = imgH / q->mHeight;
|
if (imgH != 0 && q->mHeight != 0) yS = imgH / q->mHeight;
|
||||||
if (imgW != 0 && q->mWidth != 0) xS = imgW / q->mWidth;
|
if (imgW != 0 && q->mWidth != 0) xS = imgW / q->mWidth;
|
||||||
|
|
||||||
renderer->RenderQuad(q, x + margin, y + margin, 0, xS, yS);
|
JRenderer::GetInstance()->RenderQuad(q.get(), x + margin, y + margin, 0, xS, yS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1358,7 +1355,7 @@ void WGuiCardImage::Render()
|
|||||||
|
|
||||||
if (!source || (c = source->getCard(mOffset.getPos())) == NULL)
|
if (!source || (c = source->getCard(mOffset.getPos())) == NULL)
|
||||||
{ //No card, use card back.
|
{ //No card, use card back.
|
||||||
JQuad * q;
|
JQuadPtr q;
|
||||||
if (bThumb)
|
if (bThumb)
|
||||||
{
|
{
|
||||||
q = WResourceManager::Instance()->GetQuad("back_thumb");
|
q = WResourceManager::Instance()->GetQuad("back_thumb");
|
||||||
@@ -1371,13 +1368,13 @@ void WGuiCardImage::Render()
|
|||||||
q = WResourceManager::Instance()->GetQuad("back");
|
q = WResourceManager::Instance()->GetQuad("back");
|
||||||
float scale = p.actZ * 257.f / q->mHeight;
|
float scale = p.actZ * 257.f / q->mHeight;
|
||||||
q->SetColor(ARGB(255,255,255,255));
|
q->SetColor(ARGB(255,255,255,255));
|
||||||
renderer->RenderQuad(q, p.x, p.y, 0, scale, scale);
|
renderer->RenderQuad(q.get(), p.x, p.y, 0, scale, scale);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ //Have card.
|
{ //Have card.
|
||||||
if (bThumb)
|
if (bThumb)
|
||||||
{ //Thumbnail.
|
{ //Thumbnail.
|
||||||
JQuad * q = NULL;
|
JQuadPtr q;
|
||||||
if (!options[Options::DISABLECARDS].number)
|
if (!options[Options::DISABLECARDS].number)
|
||||||
{
|
{
|
||||||
q = source->getThumb(mOffset.getPos());
|
q = source->getThumb(mOffset.getPos());
|
||||||
@@ -1386,14 +1383,19 @@ void WGuiCardImage::Render()
|
|||||||
q = source->getImage(mOffset.getPos());
|
q = source->getImage(mOffset.getPos());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (!q && (q = CardGui::AlternateThumbQuad(c)) == NULL) return; //TODO Some kind of error image.
|
if (!q.get())
|
||||||
renderer->RenderQuad(q, p.x, p.y);
|
{
|
||||||
|
q = CardGui::AlternateThumbQuad(c);
|
||||||
|
if (q.get() == NULL)
|
||||||
|
return; //TODO Some kind of error image.
|
||||||
|
}
|
||||||
|
renderer->RenderQuad(q.get(), p.x, p.y);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ //Normal card.
|
{ //Normal card.
|
||||||
JQuad * q = source->getImage(mOffset.getPos());
|
JQuadPtr q = source->getImage(mOffset.getPos());
|
||||||
|
|
||||||
int mode = (!q || options[Options::DISABLECARDS].number) ? DrawMode::kText : DrawMode::kNormal;
|
int mode = (!q.get() || options[Options::DISABLECARDS].number) ? DrawMode::kText : DrawMode::kNormal;
|
||||||
CardGui::DrawCard(c, p, mode);
|
CardGui::DrawCard(c, p, mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1413,7 +1415,7 @@ WGuiCardDistort::~WGuiCardDistort()
|
|||||||
|
|
||||||
void WGuiCardDistort::Render()
|
void WGuiCardDistort::Render()
|
||||||
{
|
{
|
||||||
JQuad * q = NULL;
|
JQuadPtr q;
|
||||||
|
|
||||||
if (distortSrc)
|
if (distortSrc)
|
||||||
{
|
{
|
||||||
@@ -1455,7 +1457,7 @@ void WGuiCardDistort::Render()
|
|||||||
if (!q || options[Options::DISABLECARDS].number) q = CardGui::AlternateThumbQuad(c); //TODO alternateX should render to texture.
|
if (!q || options[Options::DISABLECARDS].number) q = CardGui::AlternateThumbQuad(c); //TODO alternateX should render to texture.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!q) return;
|
if (!q.get()) return;
|
||||||
mesh->SetTexture(q->mTex);
|
mesh->SetTexture(q->mTex);
|
||||||
float x0, y0, w0, h0;
|
float x0, y0, w0, h0;
|
||||||
q->GetTextureRect(&x0, &y0, &w0, &h0);
|
q->GetTextureRect(&x0, &y0, &w0, &h0);
|
||||||
@@ -1511,7 +1513,6 @@ WDistort::WDistort(float x1, float y1, float x2, float y2, float x3, float y3, f
|
|||||||
|
|
||||||
void WGuiListRow::Render()
|
void WGuiListRow::Render()
|
||||||
{
|
{
|
||||||
|
|
||||||
int start = 0, nowPos = 0, vHeight = 0;
|
int start = 0, nowPos = 0, vHeight = 0;
|
||||||
int nbitems = (int) items.size();
|
int nbitems = (int) items.size();
|
||||||
|
|
||||||
|
|||||||
@@ -172,13 +172,6 @@ WResourceManager::WResourceManager()
|
|||||||
#ifdef DEBUG_CACHE
|
#ifdef DEBUG_CACHE
|
||||||
menuCached = 0;
|
menuCached = 0;
|
||||||
#endif
|
#endif
|
||||||
mTextureList.clear();
|
|
||||||
mTextureList.reserve(0);
|
|
||||||
mTextureMap.clear();
|
|
||||||
|
|
||||||
mQuadList.clear();
|
|
||||||
mQuadList.reserve(0);
|
|
||||||
mQuadMap.clear();
|
|
||||||
|
|
||||||
psiWCache.Resize(PSI_CACHE_SIZE, 20);
|
psiWCache.Resize(PSI_CACHE_SIZE, 20);
|
||||||
sampleWCache.Resize(SAMPLES_CACHE_SIZE, MAX_CACHED_SAMPLES);
|
sampleWCache.Resize(SAMPLES_CACHE_SIZE, MAX_CACHED_SAMPLES);
|
||||||
@@ -192,16 +185,15 @@ WResourceManager::WResourceManager()
|
|||||||
WResourceManager::~WResourceManager()
|
WResourceManager::~WResourceManager()
|
||||||
{
|
{
|
||||||
LOG("==Destroying WResourceManager==");
|
LOG("==Destroying WResourceManager==");
|
||||||
RemoveAll();
|
|
||||||
RemoveWFonts();
|
RemoveWFonts();
|
||||||
|
|
||||||
LOG("==Successfully Destroyed WResourceManager==");
|
LOG("==Successfully Destroyed WResourceManager==");
|
||||||
}
|
}
|
||||||
|
|
||||||
JQuad * WResourceManager::RetrieveCard(MTGCard * card, int style, int submode)
|
JQuadPtr WResourceManager::RetrieveCard(MTGCard * card, int style, int submode)
|
||||||
{
|
{
|
||||||
//Cards are never, ever resource managed, so just check cache.
|
//Cards are never, ever resource managed, so just check cache.
|
||||||
if (!card || options[Options::DISABLECARDS].number) return NULL;
|
if (!card || options[Options::DISABLECARDS].number) return JQuadPtr();
|
||||||
|
|
||||||
submode = submode | TEXTURE_SUB_CARD;
|
submode = submode | TEXTURE_SUB_CARD;
|
||||||
|
|
||||||
@@ -224,14 +216,14 @@ JQuad * WResourceManager::RetrieveCard(MTGCard * card, int style, int submode)
|
|||||||
// In that case, we "unmiss" it after trying the [id].jpg, in order to give a chance to the [name.jpg]
|
// In that case, we "unmiss" it after trying the [id].jpg, in order to give a chance to the [name.jpg]
|
||||||
bool canUnmiss = false;
|
bool canUnmiss = false;
|
||||||
{
|
{
|
||||||
JQuad * tempQuad = RetrieveQuad(filename1, 0, 0, 0, 0, "", RETRIEVE_EXISTING, submode | TEXTURE_SUB_5551, id);
|
JQuadPtr tempQuad = RetrieveQuad(filename1, 0, 0, 0, 0, "", RETRIEVE_EXISTING, submode | TEXTURE_SUB_5551, id);
|
||||||
lastError = textureWCache.mError;
|
lastError = textureWCache.mError;
|
||||||
if (!tempQuad && lastError != CACHE_ERROR_404)
|
if (!tempQuad && lastError != CACHE_ERROR_404)
|
||||||
{
|
{
|
||||||
canUnmiss = true;
|
canUnmiss = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
JQuad * jq = RetrieveQuad(filename1, 0, 0, 0, 0, "", style, submode | TEXTURE_SUB_5551, id);
|
JQuadPtr jq = RetrieveQuad(filename1, 0, 0, 0, 0, "", style, submode | TEXTURE_SUB_5551, id);
|
||||||
if (!jq)
|
if (!jq)
|
||||||
{
|
{
|
||||||
if (canUnmiss)
|
if (canUnmiss)
|
||||||
@@ -258,7 +250,7 @@ JQuad * WResourceManager::RetrieveCard(MTGCard * card, int style, int submode)
|
|||||||
return jq;
|
return jq;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return JQuadPtr();
|
||||||
}
|
}
|
||||||
|
|
||||||
int WResourceManager::AddQuadToManaged(const WManagedQuad& inQuad)
|
int WResourceManager::AddQuadToManaged(const WManagedQuad& inQuad)
|
||||||
@@ -288,11 +280,11 @@ int WResourceManager::CreateQuad(const string &quadName, const string &textureNa
|
|||||||
|
|
||||||
if (jtex)
|
if (jtex)
|
||||||
{
|
{
|
||||||
WTrackedQuad * tq = jtex->GetTrackedQuad(x, y, width, height, quadName);
|
JQuadPtr quad = jtex->GetQuad(x, y, width, height, quadName);
|
||||||
|
|
||||||
if (tq)
|
if (quad.get())
|
||||||
{
|
{
|
||||||
tq->deadbolt();
|
jtex->deadbolt();
|
||||||
|
|
||||||
WManagedQuad mq;
|
WManagedQuad mq;
|
||||||
mq.resname = quadName;
|
mq.resname = quadName;
|
||||||
@@ -305,10 +297,9 @@ int WResourceManager::CreateQuad(const string &quadName, const string &textureNa
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
JQuad* WResourceManager::GetQuad(const string &quadName)
|
JQuadPtr WResourceManager::GetQuad(const string &quadName)
|
||||||
{
|
{
|
||||||
|
JQuadPtr result;
|
||||||
JQuad* result = NULL;
|
|
||||||
ManagedQuadMap::const_iterator found = mManagedQuads.find(quadName);
|
ManagedQuadMap::const_iterator found = mManagedQuads.find(quadName);
|
||||||
if (found != mManagedQuads.end())
|
if (found != mManagedQuads.end())
|
||||||
{
|
{
|
||||||
@@ -318,16 +309,15 @@ JQuad* WResourceManager::GetQuad(const string &quadName)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
JQuad * WResourceManager::GetQuad(int id)
|
JQuadPtr WResourceManager::GetQuad(int id)
|
||||||
{
|
{
|
||||||
|
JQuadPtr result;
|
||||||
JQuad* result = NULL;
|
|
||||||
if (id < 0 || id >= (int) mManagedQuads.size()) return result;
|
if (id < 0 || id >= (int) mManagedQuads.size()) return result;
|
||||||
|
|
||||||
IDLookupMap::const_iterator key = mIDLookupMap.find(id);
|
IDLookupMap::const_iterator key = mIDLookupMap.find(id);
|
||||||
if (key != mIDLookupMap.end())
|
if (key != mIDLookupMap.end())
|
||||||
{
|
{
|
||||||
WCachedTexture * jtex = mManagedQuads[key->second].texture;
|
WCachedTexture* jtex = mManagedQuads[key->second].texture;
|
||||||
if (jtex)
|
if (jtex)
|
||||||
{
|
{
|
||||||
result = jtex->GetQuad(key->second);
|
result = jtex->GetQuad(key->second);
|
||||||
@@ -337,21 +327,19 @@ JQuad * WResourceManager::GetQuad(int id)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
JQuad * WResourceManager::RetrieveTempQuad(const string& filename, int submode)
|
JQuadPtr WResourceManager::RetrieveTempQuad(const string& filename, int submode)
|
||||||
{
|
{
|
||||||
return RetrieveQuad(filename, 0, 0, 0, 0, "temporary", RETRIEVE_NORMAL, submode);
|
return RetrieveQuad(filename, 0, 0, 0, 0, "temporary", RETRIEVE_NORMAL, submode);
|
||||||
}
|
}
|
||||||
|
|
||||||
JQuad * WResourceManager::RetrieveQuad(const string& filename, float offX, float offY, float width, float height, string resname,
|
JQuadPtr WResourceManager::RetrieveQuad(const string& filename, float offX, float offY, float width, float height, string resname,
|
||||||
int style, int submode, int id)
|
int style, int submode, int id)
|
||||||
{
|
{
|
||||||
JQuad * jq = NULL;
|
|
||||||
|
|
||||||
//Lookup managed resources, but only with a real resname.
|
//Lookup managed resources, but only with a real resname.
|
||||||
if (resname.size() && (style == RETRIEVE_MANAGE || style == RETRIEVE_RESOURCE))
|
if (resname.size() && (style == RETRIEVE_MANAGE || style == RETRIEVE_RESOURCE))
|
||||||
{
|
{
|
||||||
jq = GetQuad(resname);
|
JQuadPtr quad = GetQuad(resname);
|
||||||
if (jq || style == RETRIEVE_RESOURCE) return jq;
|
if (quad.get() || style == RETRIEVE_RESOURCE) return quad;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Aliases.
|
//Aliases.
|
||||||
@@ -374,14 +362,15 @@ JQuad * WResourceManager::RetrieveQuad(const string& filename, float offX, float
|
|||||||
lastError = textureWCache.mError;
|
lastError = textureWCache.mError;
|
||||||
|
|
||||||
//Somehow, jtex wasn't promoted.
|
//Somehow, jtex wasn't promoted.
|
||||||
if (style == RETRIEVE_MANAGE && jtex && !jtex->isPermanent()) return NULL;
|
if (style == RETRIEVE_MANAGE && jtex && !jtex->isPermanent()) return JQuadPtr();
|
||||||
|
|
||||||
//Make this quad, overwriting any similarly resname'd quads.
|
//Make this quad, overwriting any similarly resname'd quads.
|
||||||
if (jtex)
|
if (jtex)
|
||||||
{
|
{
|
||||||
WTrackedQuad * tq = jtex->GetTrackedQuad(offX, offY, width, height, resname);
|
JQuadPtr quad = jtex->GetQuad(offX, offY, width, height, resname);
|
||||||
|
|
||||||
if (!tq) return NULL;
|
if (!quad.get())
|
||||||
|
return quad;
|
||||||
|
|
||||||
if (style == RETRIEVE_MANAGE && resname != "")
|
if (style == RETRIEVE_MANAGE && resname != "")
|
||||||
{
|
{
|
||||||
@@ -392,16 +381,16 @@ JQuad * WResourceManager::RetrieveQuad(const string& filename, float offX, float
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (style == RETRIEVE_LOCK)
|
if (style == RETRIEVE_LOCK)
|
||||||
tq->lock();
|
jtex->lock();
|
||||||
else if (style == RETRIEVE_UNLOCK)
|
else if (style == RETRIEVE_UNLOCK)
|
||||||
tq->unlock();
|
jtex->unlock();
|
||||||
else if (style == RETRIEVE_MANAGE) tq->deadbolt();
|
else if (style == RETRIEVE_MANAGE) jtex->deadbolt();
|
||||||
|
|
||||||
return tq->quad;
|
return quad;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Texture doesn't exist, so no quad.
|
//Texture doesn't exist, so no quad.
|
||||||
return NULL;
|
return JQuadPtr();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WResourceManager::Release(JTexture * tex)
|
void WResourceManager::Release(JTexture * tex)
|
||||||
@@ -442,16 +431,7 @@ void WResourceManager::ClearUnlocked()
|
|||||||
sampleWCache.ClearUnlocked();
|
sampleWCache.ClearUnlocked();
|
||||||
psiWCache.ClearUnlocked();
|
psiWCache.ClearUnlocked();
|
||||||
}
|
}
|
||||||
bool WResourceManager::Cleanup()
|
|
||||||
{
|
|
||||||
int check = 0;
|
|
||||||
|
|
||||||
if (textureWCache.Cleanup()) check++;
|
|
||||||
if (sampleWCache.Cleanup()) check++;
|
|
||||||
if (psiWCache.Cleanup()) check++;
|
|
||||||
|
|
||||||
return (check > 0);
|
|
||||||
}
|
|
||||||
void WResourceManager::Release(JSample * sample)
|
void WResourceManager::Release(JSample * sample)
|
||||||
{
|
{
|
||||||
if (!sample) return;
|
if (!sample) return;
|
||||||
@@ -985,74 +965,6 @@ void WResourceManager::Refresh()
|
|||||||
textureWCache.Refresh();
|
textureWCache.Refresh();
|
||||||
psiWCache.Refresh();
|
psiWCache.Refresh();
|
||||||
|
|
||||||
map<string, WCachedTexture*>::iterator it;
|
|
||||||
vector<JQuad*>::iterator q;
|
|
||||||
|
|
||||||
//Now do some juggling so that managed resources also reload.
|
|
||||||
map<JTexture *, JTexture *> oldTextures;
|
|
||||||
map<JTexture *, string> newNames;
|
|
||||||
map<JTexture *, JTexture *>::iterator oldIt;
|
|
||||||
vector<JTexture*>::iterator jtex;
|
|
||||||
map<string, int>::iterator mapping;
|
|
||||||
JTexture * newtex;
|
|
||||||
JTexture * oldtex = NULL;
|
|
||||||
|
|
||||||
//Store old mappings.
|
|
||||||
for (mapping = mTextureMap.begin(); mapping != mTextureMap.end(); mapping++)
|
|
||||||
{
|
|
||||||
if (oldTextures[mTextureList[mapping->second]] == NULL)
|
|
||||||
{
|
|
||||||
newtex = JRenderer::GetInstance()->LoadTexture(graphicsFile(mapping->first).c_str(), 0, TEXTURE_FORMAT);
|
|
||||||
oldtex = mTextureList[mapping->second];
|
|
||||||
if (!newtex)
|
|
||||||
newNames[oldtex] = mapping->first;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
newNames[newtex] = mapping->first;
|
|
||||||
}
|
|
||||||
|
|
||||||
oldTextures[oldtex] = newtex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Remap quads.
|
|
||||||
for (q = mQuadList.begin(); q != mQuadList.end(); q++)
|
|
||||||
{
|
|
||||||
newtex = oldTextures[(*q)->mTex];
|
|
||||||
if (newtex != NULL) (*q)->mTex = newtex;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Rebuild mTextureList and mapping.
|
|
||||||
mTextureList.clear();
|
|
||||||
mTextureMap.clear();
|
|
||||||
int x = 0;
|
|
||||||
for (oldIt = oldTextures.begin(); oldIt != oldTextures.end(); oldIt++)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (oldIt->second)
|
|
||||||
newtex = oldIt->second;
|
|
||||||
else
|
|
||||||
newtex = oldIt->first;
|
|
||||||
|
|
||||||
mTextureList.push_back(newtex);
|
|
||||||
mTextureMap[newNames[newtex]] = x;
|
|
||||||
x++;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Rebuild mapping.
|
|
||||||
for (mapping = mTextureMap.begin(); mapping != mTextureMap.end(); mapping++)
|
|
||||||
{
|
|
||||||
if (oldTextures[mTextureList[mapping->second]] == NULL) continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Delete unused textures.
|
|
||||||
for (oldIt = oldTextures.begin(); oldIt != oldTextures.end(); oldIt++)
|
|
||||||
{
|
|
||||||
if (!oldIt->second || !oldIt->first) continue;
|
|
||||||
|
|
||||||
SAFE_DELETE(oldtex);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Check for card images in theme.
|
//Check for card images in theme.
|
||||||
bThemedCards = false;
|
bThemedCards = false;
|
||||||
if (!options[Options::ACTIVE_THEME].isDefault())
|
if (!options[Options::ACTIVE_THEME].isDefault())
|
||||||
@@ -1199,7 +1111,7 @@ cacheItem* WCache<cacheItem, cacheActual>::Retrieve(int id, const string& filena
|
|||||||
//Unlink the managed resource from the cache.
|
//Unlink the managed resource from the cache.
|
||||||
UnlinkCache(tc);
|
UnlinkCache(tc);
|
||||||
|
|
||||||
//Post it in managed WResourceManager::Instance()->
|
//Post it in managed resources.
|
||||||
managed[makeID(id, filename, submode)] = tc;
|
managed[makeID(id, filename, submode)] = tc;
|
||||||
tc->deadbolt();
|
tc->deadbolt();
|
||||||
}
|
}
|
||||||
@@ -1221,8 +1133,8 @@ cacheItem* WCache<cacheItem, cacheActual>::Retrieve(int id, const string& filena
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Record managed failure. Cache failure is recorded in Get().
|
//Record managed failure. Cache failure is recorded in Get().
|
||||||
if ((style == RETRIEVE_MANAGE || style == RETRIEVE_RESOURCE) && mError == CACHE_ERROR_404) managed[makeID(id, filename, submode)]
|
if ((style == RETRIEVE_MANAGE || style == RETRIEVE_RESOURCE) && mError == CACHE_ERROR_404)
|
||||||
= NULL;
|
managed[makeID(id, filename, submode)] = NULL;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user