diff --git a/projects/mtg/bin/Res/player/avatar.jpg b/projects/mtg/bin/Res/player/avatar.jpg new file mode 100644 index 000000000..29e85c6e4 Binary files /dev/null and b/projects/mtg/bin/Res/player/avatar.jpg differ diff --git a/projects/mtg/icon.png b/projects/mtg/icon.png index 1223548ec..7185ef6b1 100644 Binary files a/projects/mtg/icon.png and b/projects/mtg/icon.png differ diff --git a/projects/mtg/include/GameStateDeckViewer.h b/projects/mtg/include/GameStateDeckViewer.h index 0fe8e912d..8ca9d9a38 100644 --- a/projects/mtg/include/GameStateDeckViewer.h +++ b/projects/mtg/include/GameStateDeckViewer.h @@ -73,6 +73,7 @@ class GameStateDeckViewer: public GameState, public JGuiListener MTGCard * cardIndex[7]; int hudAlpha; float scrollSpeed; + int delSellMenu; public: GameStateDeckViewer(GameApp* parent): GameState(parent) { @@ -141,6 +142,7 @@ class GameStateDeckViewer: public GameState, public JGuiListener virtual void Start() { hudAlpha = 0; + delSellMenu = 0; pricelist = NEW PriceList(RESPATH"/settings/prices.dat",mParent->collection); playerdata = NEW PlayerData(mParent->collection); sellMenu = NULL; @@ -276,6 +278,10 @@ class GameStateDeckViewer: public GameState, public JGuiListener if (hudAlpha < 0) hudAlpha = 0; if (sellMenu){ sellMenu->Update(dt); + if (delSellMenu){ + SAFE_DELETE(sellMenu); + delSellMenu = 0; + } return; } if (mStage == STAGE_WAITING || mStage == STAGE_ONSCREEN_MENU){ @@ -460,6 +466,7 @@ class GameStateDeckViewer: public GameState, public JGuiListener deckname = "Deck"; } sprintf(buffer,"%s - %i/%i", deckname.c_str(),currentPos, total); + mFont->SetScale(1.0f); mFont->SetColor(ARGB(hudAlpha,255,255,255)); mFont->DrawString(buffer,SCREEN_WIDTH/2, y+5,JGETEXT_CENTER); @@ -502,8 +509,9 @@ class GameStateDeckViewer: public GameState, public JGuiListener } void renderOnScreenMenu(){ - mFont->SetColor(ARGB(255,255,255,255)); - mFont->SetScale(1.0); + JLBFont * font = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT); + font->SetColor(ARGB(255,255,255,255)); + font->SetScale(1.0); JRenderer * r = JRenderer::GetInstance(); float pspIconsSize = 0.5; @@ -529,12 +537,12 @@ class GameStateDeckViewer: public GameState, public JGuiListener r->RenderQuad(pspIcons[3],leftPspX + 20, leftPspY,0,pspIconsSize,pspIconsSize); - mFont->DrawString("Prev.", leftPspX - 35, leftPspY-15); - mFont->DrawString("Next", leftPspX + 15, leftPspY-15); - mFont->DrawString("card", leftPspX - 35, leftPspY); - mFont->DrawString("card", leftPspX + 15, leftPspY); - mFont->DrawString("Next color", leftPspX - 33, leftPspY - 35); - mFont->DrawString("Prev. color", leftPspX -33 , leftPspY +25); + font->DrawString("Prev.", leftPspX - 35, leftPspY-15); + font->DrawString("Next", leftPspX + 15, leftPspY-15); + font->DrawString("card", leftPspX - 35, leftPspY); + font->DrawString("card", leftPspX + 15, leftPspY); + font->DrawString("Next color", leftPspX - 33, leftPspY - 35); + font->DrawString("Prev. color", leftPspX -33 , leftPspY +25); //RIGHT PSP CIRCLE render r->FillCircle(rightPspX+(onScreenTransition*204),rightPspY,40,ARGB(128,50,50,50)); @@ -544,16 +552,16 @@ class GameStateDeckViewer: public GameState, public JGuiListener r->RenderQuad(pspIcons[7],rightPspX, rightPspY + 20,0,pspIconsSize,pspIconsSize); if (displayed_deck == myCollection){ - mFont->DrawString("Add card", rightPspX + 20, rightPspY-15); - mFont->DrawString("Display Deck", rightPspX - 35, rightPspY - 40); + font->DrawString("Add card", rightPspX + 20, rightPspY-15); + font->DrawString("Display Deck", rightPspX - 35, rightPspY - 40); }else{ - mFont->DrawString("Remove card", rightPspX + 20, rightPspY-15); - mFont->DrawString("Display Collection", rightPspX - 35, rightPspY - 40); + font->DrawString("Remove card", rightPspX + 20, rightPspY-15); + font->DrawString("Display Collection", rightPspX - 35, rightPspY - 40); } - mFont->DrawString("Deck info", rightPspX - 70 , rightPspY-15); - mFont->DrawString("Sell card", rightPspX - 30 , rightPspY+20); + font->DrawString("Deck info", rightPspX - 70 , rightPspY-15); + font->DrawString("Sell card", rightPspX - 30 , rightPspY+20); //Bottom menus - mFont->DrawString("menu", SCREEN_WIDTH-35 +rightTransition, SCREEN_HEIGHT-15); + font->DrawString("menu", SCREEN_WIDTH-35 +rightTransition, SCREEN_HEIGHT-15); @@ -563,15 +571,15 @@ class GameStateDeckViewer: public GameState, public JGuiListener for (int j=0; jgetCount(j); if (value > 0){ - sprintf(buffer, "%i", value); - mFont->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,0.5); - if (value > 9){nb_letters += 3;}else{nb_letters+=2;} + sprintf(buffer, "%i", value); + 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,0.5); + if (value > 9){nb_letters += 3;}else{nb_letters+=2;} } } int value = myDeck->getCount(); sprintf(buffer, "Your Deck: %i cards", value); - mFont->DrawString(buffer, SCREEN_WIDTH-200+rightTransition, SCREEN_HEIGHT/2 + 25); + font->DrawString(buffer, SCREEN_WIDTH-200+rightTransition, SCREEN_HEIGHT/2 + 25); //TODO, put back ! /*int nbCreatures = myDeck->countByType("Creature"); @@ -582,13 +590,13 @@ class GameStateDeckViewer: public GameState, public JGuiListener */ - mFont->DrawString("You are currently viewing your", SCREEN_WIDTH-200+rightTransition, 5); + font->DrawString("You are currently viewing your", SCREEN_WIDTH-200+rightTransition, 5); if (displayed_deck == myCollection){ - mFont->DrawString("collection. Press TRIANGLE", SCREEN_WIDTH-200+rightTransition, 20); - mFont->DrawString("to switch to your deck", SCREEN_WIDTH-200+rightTransition, 35); + font->DrawString("collection. Press TRIANGLE", SCREEN_WIDTH-200+rightTransition, 20); + font->DrawString("to switch to your deck", SCREEN_WIDTH-200+rightTransition, 35); }else{ - mFont->DrawString("deck. Press TRIANGLE to", SCREEN_WIDTH-200+rightTransition, 20); - mFont->DrawString("switch to your collection", SCREEN_WIDTH-200+rightTransition, 35); + font->DrawString("deck. Press TRIANGLE to", SCREEN_WIDTH-200+rightTransition, 20); + font->DrawString("switch to your collection", SCREEN_WIDTH-200+rightTransition, 35); } } @@ -791,8 +799,8 @@ class GameStateDeckViewer: public GameState, public JGuiListener } } case 21: - SAFE_DELETE(sellMenu); //TODO, stop deleting this object while it's being used !!! - break; + delSellMenu = 1; + break; } } diff --git a/projects/mtg/include/GameStateDuel.h b/projects/mtg/include/GameStateDuel.h index d408e277a..cc564bf0e 100644 --- a/projects/mtg/include/GameStateDuel.h +++ b/projects/mtg/include/GameStateDuel.h @@ -18,6 +18,7 @@ class GameStateDuel: public GameState, public JGuiListener #ifdef TESTSUITE TestSuite * testSuite; #endif + int showMsg; int mGamePhase; Player * mCurrentPlayer; Player * mPlayers[2]; diff --git a/projects/mtg/src/CardGui.cpp b/projects/mtg/src/CardGui.cpp index d8a9bff08..cea9dcbe9 100644 --- a/projects/mtg/src/CardGui.cpp +++ b/projects/mtg/src/CardGui.cpp @@ -1,6 +1,7 @@ #include "../include/config.h" #include "../include/CardGui.h" #include "../include/ManaCostHybrid.h" +#include "../include/Subtypes.h" #include void CardGui::alternateRender(MTGCard * card, JLBFont * mFont, JQuad ** manaIcons, float x, float y, float rotation, float scale){ @@ -63,7 +64,6 @@ void CardGui::alternateRender(MTGCard * card, JLBFont * mFont, JQuad ** manaIcon unsigned int j = 0; while ((h = manacost->getHybridCost(j))){ - OutputDebugString("Hybrid\n"); for (int i = 0; i < 2; i++){ int color = h->color1; int value = h->value1; @@ -178,6 +178,14 @@ void CardGui::alternateRender(MTGCard * card, JLBFont * mFont, JQuad ** manaIcon mFont->DrawString(buf,x+v.x,y+v.y); } + for (int i = card->nb_types-1; i>=0; i--){ + v.x = ((-width/2)+10) * scale; + v.y = (height/2-20 - 12 * i) * scale; + v.Rotate(rotation); + string s = Subtypes::subtypesList->find(card->types[i]); + mFont->DrawString(s.c_str(),x+v.x,y+v.y); + } + } diff --git a/projects/mtg/src/GameStateDuel.cpp b/projects/mtg/src/GameStateDuel.cpp index ef6a0fd7b..73e683763 100644 --- a/projects/mtg/src/GameStateDuel.cpp +++ b/projects/mtg/src/GameStateDuel.cpp @@ -47,6 +47,7 @@ GameStateDuel::GameStateDuel(GameApp* parent): GameState(parent) { #ifdef TESTSUITE testSuite = NULL; #endif + showMsg = 0; } GameStateDuel::~GameStateDuel() { @@ -69,8 +70,8 @@ void GameStateDuel::Start() mGamePhase = DUEL_STATE_CHOOSE_DECK1; mFont = GameApp::CommonRes->GetJLBFont(Constants::MENU_FONT); - mFont->SetBase(0); // using 2nd font - opponentMenuFont = mFont; //NEW JLBFont("graphics/simon",22); + mFont->SetBase(0); + opponentMenuFont = mFont; menu = NEW SimpleMenu(DUEL_MENU_GAME_MENU, this, mFont, SCREEN_WIDTH/2-100, 25); @@ -280,6 +281,7 @@ void GameStateDuel::Update(float dt) } game->Update(dt); if (game->gameOver){ + showMsg = (rand() % 5); if (!mPlayers[0]->isAI() && mPlayers[1]->isAI() && mPlayers[0]!= game->gameOver){ #if defined (WIN32) || defined (LINUX) char buf[4096]; @@ -352,7 +354,7 @@ void GameStateDuel::Render() if (!mPlayers[0]->isAI() && mPlayers[1]->isAI() ){ if (game->gameOver !=mPlayers[0]){ sprintf (buffer, "Victory! Congratulations, You earn 500 credits"); - }else{ + }else{ sprintf (buffer, "You have been defeated"); } }else{ @@ -363,6 +365,16 @@ void GameStateDuel::Render() sprintf(buffer, "Player %i wins (%i)", winner, p0life ); } mFont->DrawString(buffer, 10, 150); + + if (showMsg == 1){ + JLBFont * f = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT); + mFont->DrawString("Please support this project !" ,10,180); + f->DrawString("Wagic is free, open source, and developed on the little free time I have" ,10,196); + f->DrawString("If you enjoy this game, please consider donating a few bucks" ,10,208); + f->DrawString("I'll drink a beer in your name!" ,10,220); + f->DrawString("Thanks in advance for your support." ,10,232); + mFont->DrawString("-> http://wololo.net/wagic" ,10,244); + } break; } case DUEL_STATE_CHOOSE_DECK1: diff --git a/projects/mtg/src/GameStateOptions.cpp b/projects/mtg/src/GameStateOptions.cpp index 915667eeb..9bff6115f 100644 --- a/projects/mtg/src/GameStateOptions.cpp +++ b/projects/mtg/src/GameStateOptions.cpp @@ -69,43 +69,36 @@ void GameStateOptions::Render() "Wagic, The Homebrew ?! by WilLoW", "This is a work in progress and it contains bugs", "updates on http://www.wololo.net/wagic", - "Many thanks to J for his help in this release, and to all card creators", + "Many thanks to the programmers and card creators who helped in this release", "", "Developped with the JGE++ Library (http://jge.khors.com)", - "", - "this freeware app is not endorsed by Wizards of the Coast, Inc", - "", + "Player's avatar from http://mathieuchoinet.blogspot.com, under CC License", + "Background picture from KDE4 , www.kde.org", "SFX From www.soundsnap.com", - - }; - - const char * const MusicText[] = { "", "Music by Celestial Aeon Project, under Creative Commons License", - "Their music can be downloaded at http://www.jamendo.com" + "Their music can be downloaded at http://www.jamendo.com", + "", + "This work is not related to or endoresed by Wizards of the Coast, Inc", + "", + "Please support this project with donations at http://wololo.net/wagic", }; + JLBFont * mFont = GameApp::CommonRes->GetJLBFont("graphics/magic"); mFont->SetColor(ARGB(255,200,200,200)); mFont->SetScale(1.0); float startpos = 272 - timer * 10; float pos = startpos; - for (int i = 0; i < 10; i++){ + int size = sizeof(CreditsText) / sizeof(CreditsText[0]); + for (int i = 0; i < size; i++){ pos = startpos +20*i; if (pos > -20){ mFont->DrawString(CreditsText[i],SCREEN_WIDTH/2,pos ,JGETEXT_CENTER); } } - if (GameApp::HasMusic){ - for (int i = 0; i < 3; i++){ - pos = startpos +20*(10+i); - if (pos > -20){ - mFont->DrawString(MusicText[i],SCREEN_WIDTH/2, pos,JGETEXT_CENTER); - } - } - } if (pos < -20) timer = 0; mFont->SetScale(1.f); diff --git a/projects/mtg/src/MTGGuiPlay.cpp b/projects/mtg/src/MTGGuiPlay.cpp index 1a769180c..052e31753 100644 --- a/projects/mtg/src/MTGGuiPlay.cpp +++ b/projects/mtg/src/MTGGuiPlay.cpp @@ -352,6 +352,14 @@ void MTGGuiPlay::Render(){ RenderPlayerInfo(0); RenderPlayerInfo(1); + int opponentHand = game->players[1]->game->hand->nb_cards; + char buffer[10]; + sprintf(buffer,"%i",opponentHand); + mFont->SetColor(ARGB(128,0,0,0)); + mFont->DrawString(buffer, 56, 20); + mFont->SetColor(ARGB(255,255,255,255)); + mFont->DrawString(buffer, 54, 18); + if (mGlitterAlpha < 0){ mGlitterAlpha = 510; int position = rand() % 2; diff --git a/projects/mtg/src/Subtypes.cpp b/projects/mtg/src/Subtypes.cpp index 1bc74f131..72201e69c 100644 --- a/projects/mtg/src/Subtypes.cpp +++ b/projects/mtg/src/Subtypes.cpp @@ -14,11 +14,6 @@ Subtypes::Subtypes(){ int Subtypes::Add(string value){ int result = find(value); if (result) return result; -#if defined (WIN32) - char buf[4096]; - sprintf(buf, "Adding new type: *%s*\n",value.c_str()); - OutputDebugString(buf); -#endif std::transform( value.begin(), value.end(), value.begin(), ::tolower ); nb_items++; values[value] = nb_items;