- Chinese patch by linshier
This commit is contained in:
wagic.the.homebrew@gmail.com
2010-07-31 14:41:04 +00:00
parent 1704a20d09
commit f40af0b1cb
65 changed files with 21364 additions and 175 deletions

View File

@@ -551,21 +551,21 @@ public:
MTGGameZone * dest = move->destinationZone();
GameObserver * g = GameObserver::GetInstance();
for (int i=0; i < 2; i++){
if (dest == g->players[i]->game->hand && tc->targetsZone(g->players[i]->game->inPlay)){
return "Bounce";
}else if (dest == g->players[i]->game->hand && tc->targetsZone(g->players[i]->game->graveyard)){
return "Reclaim";
}else if (dest == g->players[i]->game->graveyard && tc->targetsZone(g->players[i]->game->inPlay)){
return "Sacrifice";
}else if (dest == g->players[i]->game->library && tc->targetsZone(g->players[i]->game->graveyard)){
return "Recycle";
}else if (dest == g->players[i]->game->library){
return "Put in Library";
}else if (dest == g->players[i]->game->graveyard && tc->targetsZone(g->players[i]->game->hand)){
return "Discard";
}else if (dest == g->players[i]->game->exile){
return "Exile";
}else if (tc->targetsZone(g->players[i]->game->library)){
if (dest == g->players[i]->game->hand && tc->targetsZone(g->players[i]->game->inPlay)){
return "Bounce";
}else if (dest == g->players[i]->game->hand && tc->targetsZone(g->players[i]->game->graveyard)){
return "Reclaim";
}else if (dest == g->players[i]->game->graveyard && tc->targetsZone(g->players[i]->game->inPlay)){
return "Sacrifice";
}else if (dest == g->players[i]->game->library && tc->targetsZone(g->players[i]->game->graveyard)){
return "Recycle";
}else if (dest == g->players[i]->game->library){
return "Put in Library";
}else if (dest == g->players[i]->game->graveyard && tc->targetsZone(g->players[i]->game->hand)){
return "Discard";
}else if (dest == g->players[i]->game->exile){
return "Exile";
}else if (tc->targetsZone(g->players[i]->game->library)){
return "Fetch";
}
}

View File

@@ -5,7 +5,7 @@
#include <vector>
#include <string>
#include <JGE.h>
#include <JLBFont.h>
#include "../include/WFont.h"
#include <time.h>
#include "../include/Player.h"
@@ -19,7 +19,7 @@ public:
int value;
string text;
CreditBonus(int _value, string _text);
void Render(float x, float y, JLBFont * font);
void Render(float x, float y, WFont * font);
};
class Credits{

View File

@@ -5,14 +5,14 @@
#include "GameObserver.h"
#include <JGui.h>
#include <JLBFont.h>
#include "../include/WFont.h"
class MTGGamePhase: public ActionElement {
protected:
float animation;
int currentState;
JLBFont * mFont;
WFont * mFont;
public:
MTGGamePhase(int id);
virtual void Update(float dt);

View File

@@ -162,7 +162,7 @@ private:
list<HUDString *> events;
float timestamp;
float popdelay;
JLBFont * f;
WFont * f;
float maxWidth;
int addEvent(string s);
public:

View File

@@ -1,7 +1,7 @@
#ifndef _MENU_ITEM_H
#define _MENU_ITEM_H
#include <JLBFont.h>
#include "../include/WFont.h"
#include <JGui.h>
#include <hge/hgeparticle.h>
#include <string>
@@ -16,7 +16,7 @@ class MenuItem: public JGuiObject
{
private:
bool mHasFocus;
JLBFont *mFont;
WFont *mFont;
string mText;
int mX;
int mY;
@@ -31,7 +31,7 @@ class MenuItem: public JGuiObject
public:
MenuItem(int id, JLBFont *font, string text, int x, int y, JQuad * _off, JQuad * _on, const char * particle, JQuad * particleQuad, bool hasFocus = false);
MenuItem(int id, WFont *font, string text, int x, int y, JQuad * _off, JQuad * _on, const char * particle, JQuad * particleQuad, bool hasFocus = false);
~MenuItem();
virtual void Render();
virtual void Update(float dt);

View File

@@ -2,7 +2,7 @@
#define _SHOP_ITEM_H
#include <JGui.h>
#include <JLBFont.h>
#include "../include/WFont.h"
#include "SimpleMenu.h"
#include "MTGDeck.h"
#include "../include/PriceList.h"
@@ -22,7 +22,7 @@ class ShopItem:public JGuiObject{
friend class ShopItems;
bool mHasFocus;
bool mRelease;
JLBFont *mFont;
WFont *mFont;
string mText;
float xy[8];
JQuad * quad;
@@ -38,8 +38,8 @@ class ShopItem:public JGuiObject{
int quantity;
MTGCard * card;
int price;
ShopItem(int id, JLBFont * font, int _cardid, float _xy[], bool hasFocus, MTGAllCards * collection, int _price, DeckDataWrapper * ddw);
ShopItem(int id, JLBFont * font, char* text, JQuad * _quad, JQuad * _thumb,float _xy[], bool hasFocus, int _price);
ShopItem(int id, WFont * font, int _cardid, float _xy[], bool hasFocus, MTGAllCards * collection, int _price, DeckDataWrapper * ddw);
ShopItem(int id, WFont * font, char* text, JQuad * _quad, JQuad * _thumb,float _xy[], bool hasFocus, int _price);
~ShopItem();
int updateCount(DeckDataWrapper * ddw);
@@ -59,7 +59,7 @@ class ShopItems:public JGuiController,public JGuiListener{
PlayerData * playerdata;
PriceList * pricelist;
int mX, mY, mHeight;
JLBFont* mFont;
WFont* mFont;
JTexture * mBgAATex;
JQuad * mBgAA;
MTGAllCards * collection;
@@ -76,7 +76,7 @@ class ShopItems:public JGuiController,public JGuiListener{
public:
bool showCardList;
ShopItems(int id, JGuiListener* listener, JLBFont* font, int x, int y, MTGAllCards * _collection, int _setIds[]);
ShopItems(int id, JGuiListener* listener, WFont* font, int x, int y, MTGAllCards * _collection, int _setIds[]);
~ShopItems();
void Render();
virtual void Update(float dt);

View File

@@ -6,7 +6,7 @@
#include <string>
#include <JGui.h>
#include <JLBFont.h>
#include "../include/WFont.h"
#include "hge/hgeparticle.h"
class SimpleMenu:public JGuiController{
@@ -29,7 +29,7 @@ class SimpleMenu:public JGuiController{
static JQuad *spadeR, *spadeL, *jewel, *side;
static JTexture *spadeRTex, *spadeLTex, *jewelTex, *sideTex;
static JLBFont* titleFont;
static WFont* titleFont;
static hgeParticleSystem* stars;
// This works only because of no multithreading
static PIXEL_TYPE jewelGraphics[9];

View File

@@ -20,6 +20,7 @@ class Translator{
public:
map<string,string> values;
map<string,string> tempValues;
map<string,string> deckValues;
#if defined DEBUG_TRANSLATE
map<string,int> missingValues;
map<string,int> dontCareValues;
@@ -30,6 +31,7 @@ public:
~Translator();
int Add(string from, string to);
void initCards();
void initDecks();
void init();
static Translator * GetInstance();
static void EndInstance();
@@ -37,4 +39,5 @@ public:
string _(string toTranslate);
extern bool neofont;
#endif

View File

@@ -0,0 +1,109 @@
#ifndef WFONT_H_
#define WFONT_H_
#include <JLBFont.h>
#include <JRenderer.h>
#include <JSprite.h>
#include "config.h"
class WFont
{
public:
unsigned char id;
// Rendering text to screen.
virtual void DrawString(const char *s, float x, float y, int align=JGETEXT_LEFT, float leftOffset = 0, float width = 0) = 0;
virtual void DrawString(std::string s, float x, float y, int align=JGETEXT_LEFT, float leftOffset = 0, float width = 0) = 0;
// Set font color.
virtual void SetColor(PIXEL_TYPE color) = 0;
// Get font color.
virtual PIXEL_TYPE GetColor() const = 0;
// Set scale for rendering.
virtual void SetScale(float scale) = 0;
// Get rendering scale.
virtual float GetScale() const = 0;
// Get height of font.
virtual float GetHeight() const = 0;
// Get width of rendering string on screen.
virtual float GetStringWidth(const char *s) const = 0;
// Set font tracking.
virtual void SetTracking(float tracking) = 0;
// Set Base for the character set to use.
virtual void SetBase(int base) = 0;
virtual ~WFont() {};
};
class WLBFont : public WFont
{
public:
WLBFont(const char *fontname, int lineheight, bool useVideoRAM=false) {
it = NEW JLBFont(fontname,lineheight,useVideoRAM);
};
~WLBFont() {SAFE_DELETE(it);};
void DrawString(const char *s, float x, float y, int align=JGETEXT_LEFT, float leftOffset = 0, float width = 0) {it->DrawString(s,x,y,align,leftOffset,width);};
void DrawString(std::string s, float x, float y, int align=JGETEXT_LEFT, float leftOffset = 0, float width = 0) {it->DrawString(s,x,y,align,leftOffset,width);};
void SetColor(PIXEL_TYPE color) {it->SetColor(color);};
PIXEL_TYPE GetColor() const {return it->GetColor();};
void SetScale(float scale) {it->SetScale(scale);};
float GetScale() const {return it->GetScale();};
float GetHeight() const {return it->GetHeight();};
float GetStringWidth(const char *s) const {return it->GetStringWidth(s);};
void SetTracking(float tracking) {it->SetTracking(tracking);};
void SetBase(int base) {it->SetBase(base);};
private:
JLBFont * it;
};
//Why do we need this ? could it move somewhere else ?
#if defined (LINUX)
#define BYTE u8
#define DWORD u32
#endif
class WFBFont : public WFont
{
public:
WFBFont(const char *fontname, int lineheight, bool useVideoRAM=false);
~WFBFont();
void DrawString(const char *s, float x, float y, int align=JGETEXT_LEFT, float leftOffset = 0, float width = 0);
void DrawString(std::string s, float x, float y, int align=JGETEXT_LEFT, float leftOffset = 0, float width = 0);
void SetColor(PIXEL_TYPE color);
PIXEL_TYPE GetColor() const {return mColor0;};
void SetScale(float scale);
float GetScale() const;
float GetHeight() const;
float GetStringWidth(const char *s) const;
void SetTracking(float tracking) {};
void SetBase(int base) {};
private:
static JRenderer * mRenderer;
BYTE* mEngFont;
BYTE* mChnFont;
PIXEL_TYPE mColor0;
PIXEL_TYPE mColor;
int mFontSize;
float mScale;
int mBytesPerChar;
int mBytesPerRow;
int mCacheImageWidth;
int mCacheImageHeight;
int mCol;
int mRow;
int mCacheSize;
JTexture * mTexture;
JQuad ** mSprites;
int *mGBCode;
int mCurr;
DWORD* mCharBuffer;
int PreCacheChar(const BYTE *ch);
};
#endif

View File

@@ -6,6 +6,7 @@
#include "MTGDeck.h"
#include "MTGCard.h"
#include "WCachedResource.h"
#include "WFont.h"
#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
@@ -175,9 +176,16 @@ public:
JTexture* GetTexture(const string &textureName);
JTexture* GetTexture(int id);
int reloadJLBFonts();
int reloadWFonts();
int reloadWLBFonts();
//Wrapped from JResourceManger. TODO: Privatize
JLBFont * LoadJLBFont(const string &fontName, int height);
WFont * LoadWLBFont(const string &fontName, int height);
WFont * LoadWFBFont(const string &fontName, int height);
WFont * GetWFont(const string &fontName);
WFont * GetWFont(int id);
WFont * GetWLBFont(int id);
void RemoveWFonts();
void RemoveWLBFonts();
//Wrapped from JSoundSystem. TODO: Privatize.
JMusic * ssLoadMusic(const char *fileName);
@@ -204,6 +212,10 @@ private:
//Statistics of record.
unsigned int lastTime;
int lastError;
vector<WFont *> mWFontList;
map<string, int> mWFontMap;
vector<WLBFont *> mWLBFontList;
map<string, int> mWLBFontMap;
};
extern WResourceManager resources;