Fixed primitives, improved background images management for game settings, deck selection, deck editor background, post-match credits, deck editor selection and trophies room (now it's possibile to randomly use up to 3 background images and if the chosen image is not available, it will be rendered the default one).

This commit is contained in:
Vittorio Alfieri
2021-11-14 14:24:27 +01:00
parent 96f7072a77
commit c55c9c2507
9 changed files with 144 additions and 19 deletions

View File

@@ -2,8 +2,13 @@
## [master] (https://github.com/WagicProject/wagic/tree/master) ## [master] (https://github.com/WagicProject/wagic/tree/master)
### 14/11/21
- *Committed:* Fixed primitives, improved background images management for game settings, deck selection, deck editor background, post-match credits, deck editor selection and trophies room (now it's possibile to randomly use up to 3 background images and if the chosen image is not available, it will be rendered the default one). ([Vitty85](https://github.com/Vitty85))
- *Committed:* Fixed primitives, several bugs and crashes. https://github.com/WagicProject/wagic/commit/96f7072a77f566718fc49c2bfe3b0b192452faf6 ([EduardoMunozGomez](https://github.com/EduardoMunozGomez))
### 13/11/21 ### 13/11/21
- *Committed:* Fixed VOW set, added new AI deck, improved Android downloader for VOC and VOW sets. ([Vitty85](https://github.com/Vitty85)) - *Committed:* Fixed VOW set, added new AI deck, improved Android downloader for VOC and VOW sets. https://github.com/WagicProject/wagic/commit/9957719e0c3e2467fd12039c213d54f151664fdd ([Vitty85](https://github.com/Vitty85))
### 11/11/21 ### 11/11/21
- *Committed:* Fixed VOW and VOC sets, improved Android downloader for VOC and VOW sets. https://github.com/WagicProject/wagic/commit/8b91048d124be38bbb845c47c00857ce5a32cdac ([Vitty85](https://github.com/Vitty85)) - *Committed:* Fixed VOW and VOC sets, improved Android downloader for VOC and VOW sets. https://github.com/WagicProject/wagic/commit/8b91048d124be38bbb845c47c00857ce5a32cdac ([Vitty85](https://github.com/Vitty85))

View File

@@ -53740,8 +53740,8 @@ toughness=0
[card] [card]
name=Helix Pinnacle name=Helix Pinnacle
abilities=shroud abilities=shroud
auto={X}:thisforeach(X) all(this) counter(0/0,1,Tower) auto={X}:name(Put X counters) thisforeach(X) all(this) counter(0/0,1,Tower)
auto=@each my upkeep restriction{{type(helix pinnacle[counter{0/0.100.Tower}]|myBattlefield)~morethan~0}}:winGame auto=@each my upkeep restriction{compare(hascnttower)~morethan~99}:name(You win the game) winGame controller
text=Shroud -- {X}: Put X tower counters on Helix Pinnacle. -- At the beginning of your upkeep, if there are 100 or more tower counters on Helix Pinnacle, you win the game. text=Shroud -- {X}: Put X tower counters on Helix Pinnacle. -- At the beginning of your upkeep, if there are 100 or more tower counters on Helix Pinnacle, you win the game.
mana={G} mana={G}
type=Enchantment type=Enchantment
@@ -125390,7 +125390,7 @@ toughness=6
[card] [card]
name=Ulrich's Kindred name=Ulrich's Kindred
abilities=trample abilities=trample
auto={3}{G}:target(*[wolf;werewolf;attacking]) indestructible ueot auto={3}{G}:name(Gains indestructible) target(*[wolf;werewolf;attacking]) indestructible ueot
text=Trample -- {3}{G}: Target attacking Wolf or Werewolf gains indestructible until end of turn. text=Trample -- {3}{G}: Target attacking Wolf or Werewolf gains indestructible until end of turn.
mana={2}{R} mana={2}{R}
type=Creature type=Creature

View File

@@ -142,6 +142,8 @@ void CreditBonus::Render(float x, float y, WFont * font)
font->DrawString(buffer, x, y); font->DrawString(buffer, x, y);
} }
static std::string kBgFile = "";
Credits::Credits() Credits::Credits()
{ {
unlocked = -1; unlocked = -1;
@@ -163,6 +165,7 @@ Credits::~Credits()
if (bonus[i]) if (bonus[i])
delete bonus[i]; delete bonus[i];
bonus.clear(); bonus.clear();
kBgFile = ""; //Reset the chosen backgorund.
} }
void Credits::compute(GameObserver* g, GameApp * _app) void Credits::compute(GameObserver* g, GameApp * _app)
@@ -514,10 +517,29 @@ void Credits::Render()
return; return;
JRenderer * r = JRenderer::GetInstance(); JRenderer * r = JRenderer::GetInstance();
#if !defined (PSP) #if !defined (PSP)
JTexture * wpTex = WResourceManager::Instance()->RetrieveTexture("bgdeckeditor.jpg"); //Now it's possibile to randomly use up to 3 background images for post-match credits (if random index is 0, it will be rendered the default "bgdeckeditor.jpg" image).
JTexture * wpTex = NULL;
if(kBgFile == ""){
char temp[4096];
sprintf(temp, "bgdeckeditor%i.jpg", std::rand() % 3);
kBgFile.assign(temp);
wpTex = WResourceManager::Instance()->RetrieveTexture(kBgFile);
if (wpTex) {
JQuadPtr wpQuad = WResourceManager::Instance()->RetrieveTempQuad(kBgFile);
if (wpQuad.get())
r->RenderQuad(wpQuad.get(), 0, 0, 0, SCREEN_WIDTH_F / wpQuad->mWidth, SCREEN_HEIGHT_F / wpQuad->mHeight);
else {
kBgFile = "bgdeckeditor.jpg"; //Fallback to default background image for post-match credits.
wpTex = NULL;
}
} else
kBgFile = "bgdeckeditor.jpg"; //Fallback to default background image for post-match credits.
}
if(!wpTex)
wpTex = WResourceManager::Instance()->RetrieveTexture(kBgFile);
if (wpTex) if (wpTex)
{ {
JQuadPtr wpQuad = WResourceManager::Instance()->RetrieveTempQuad("bgdeckeditor.jpg"); JQuadPtr wpQuad = WResourceManager::Instance()->RetrieveTempQuad(kBgFile);
r->RenderQuad(wpQuad.get(), 0, 0, 0, SCREEN_WIDTH_F / wpQuad->mWidth, SCREEN_HEIGHT_F / wpQuad->mHeight); r->RenderQuad(wpQuad.get(), 0, 0, 0, SCREEN_WIDTH_F / wpQuad->mWidth, SCREEN_HEIGHT_F / wpQuad->mHeight);
} }
#else #else

View File

@@ -10,7 +10,21 @@
DeckEditorMenu::DeckEditorMenu(int id, JGuiListener* listener, int fontId, const string& _title, DeckDataWrapper *_selectedDeck, StatsWrapper *stats) : DeckEditorMenu::DeckEditorMenu(int id, JGuiListener* listener, int fontId, const string& _title, DeckDataWrapper *_selectedDeck, StatsWrapper *stats) :
DeckMenu(id, listener, fontId, _title), selectedDeck(_selectedDeck), stw(stats) DeckMenu(id, listener, fontId, _title), selectedDeck(_selectedDeck), stw(stats)
{ {
#if !defined (PSP)
//Now it's possibile to randomly use up to 3 background images for deck editor selection (if random index is 0, it will be rendered the default "menubgdeckeditor.jpg" image).
ostringstream bgFilename;
char temp[4096];
sprintf(temp, "menubgdeckeditor%i", std::rand() % 3);
backgroundName.assign(temp);
bgFilename << backgroundName << ".jpg";
JQuadPtr background = WResourceManager::Instance()->RetrieveTempQuad(bgFilename.str(), TEXTURE_SUB_5551);
if (!background.get()){
backgroundName = "menubgdeckeditor"; //Fallback to default background image for deck editor selection.
}
#else
backgroundName = "menubgdeckeditor"; backgroundName = "menubgdeckeditor";
#endif
mShowDetailsScreen = false; mShowDetailsScreen = false;
deckTitle = selectedDeck ? selectedDeck->parent->meta_name : ""; deckTitle = selectedDeck ? selectedDeck->parent->meta_name : "";

View File

@@ -151,7 +151,7 @@ void DeckMenu::RenderBackground()
{ {
ostringstream bgFilename; ostringstream bgFilename;
#if !defined (PSP) #if !defined (PSP)
if(backgroundName == "menubgdeckeditor") if(backgroundName.find("menubgdeckeditor") != string::npos) //Now it's possibile to randomly use up to 3 background images for deck editor selection.
bgFilename << backgroundName << ".jpg"; bgFilename << backgroundName << ".jpg";
else else
bgFilename << backgroundName << ".png"; bgFilename << backgroundName << ".png";

View File

@@ -27,6 +27,8 @@ namespace GameStateAwardsConst
const int kBackToMainMenuID = 1; const int kBackToMainMenuID = 1;
} }
static std::string kAwardFile = "";
GameStateAwards::GameStateAwards(GameApp* parent) : GameStateAwards::GameStateAwards(GameApp* parent) :
GameState(parent, "trophies") GameState(parent, "trophies")
{ {
@@ -35,7 +37,7 @@ GameStateAwards::GameStateAwards(GameApp* parent) :
GameStateAwards::~GameStateAwards() GameStateAwards::~GameStateAwards()
{ {
kAwardFile = ""; //Reset the chosen backgorund.
} }
void GameStateAwards::End() void GameStateAwards::End()
@@ -47,6 +49,8 @@ void GameStateAwards::End()
if (saveMe) if (saveMe)
options.save(); options.save();
kAwardFile = ""; //Reset the chosen backgorund.
} }
void GameStateAwards::Start() void GameStateAwards::Start()
{ {
@@ -168,7 +172,18 @@ void GameStateAwards::Render()
#if defined (PSP) #if defined (PSP)
JQuadPtr background = WResourceManager::Instance()->RetrieveTempQuad("pspawardback.jpg", TEXTURE_SUB_5551); JQuadPtr background = WResourceManager::Instance()->RetrieveTempQuad("pspawardback.jpg", TEXTURE_SUB_5551);
#else #else
JQuadPtr background = WResourceManager::Instance()->RetrieveTempQuad("awardback.jpg", TEXTURE_SUB_5551); //Now it's possibile to randomly use up to 3 background images for trophies room (if random index is 0, it will be rendered the default "awardback.jpg" image).
JQuadPtr background;
if(kAwardFile == ""){
char temp[4096];
sprintf(temp, "awardback%i.jpg", std::rand() % 3);
kAwardFile.assign(temp);
JQuadPtr background = WResourceManager::Instance()->RetrieveTempQuad(kAwardFile);
if (!background.get())
kAwardFile = "awardback.jpg"; //Fallback to default background image for trophies room.
}
background = WResourceManager::Instance()->RetrieveTempQuad(kAwardFile, TEXTURE_SUB_5551);
//JQuadPtr background = WResourceManager::Instance()->RetrieveTempQuad("awardback.jpg", TEXTURE_SUB_5551);
#endif #endif
if (background.get()) if (background.get())

View File

@@ -28,6 +28,8 @@
#define NO_USER_ACTIVITY_HELP_DELAY 10 #define NO_USER_ACTIVITY_HELP_DELAY 10
static std::string kBgFile = "";
GameStateDeckViewer::GameStateDeckViewer(GameApp* parent) : GameStateDeckViewer::GameStateDeckViewer(GameApp* parent) :
GameState(parent, "deckeditor"), mView(NULL), mCurrentView(CAROUSEL_VIEW) GameState(parent, "deckeditor"), mView(NULL), mCurrentView(CAROUSEL_VIEW)
{ {
@@ -102,6 +104,7 @@ GameStateDeckViewer::~GameStateDeckViewer()
SAFE_DELETE(myCollection); SAFE_DELETE(myCollection);
} }
SAFE_DELETE(filterMenu); SAFE_DELETE(filterMenu);
kBgFile = ""; //Reset the chosen backgorund.
} }
void GameStateDeckViewer::rebuildFilters() void GameStateDeckViewer::rebuildFilters()
@@ -303,6 +306,7 @@ void GameStateDeckViewer::End()
SAFE_DELETE(playerdata); SAFE_DELETE(playerdata);
SAFE_DELETE(filterMenu); SAFE_DELETE(filterMenu);
SAFE_DELETE(source); SAFE_DELETE(source);
kBgFile = ""; //Reset the chosen backgorund.
} }
void GameStateDeckViewer::addRemove(MTGCard * card) void GameStateDeckViewer::addRemove(MTGCard * card)
@@ -1570,13 +1574,32 @@ void GameStateDeckViewer::Render()
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT); WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
JRenderer::GetInstance()->ClearScreen(ARGB(0,0,0,0)); JRenderer::GetInstance()->ClearScreen(ARGB(0,0,0,0));
#if !defined (PSP) #if !defined (PSP)
JTexture * wpTex = WResourceManager::Instance()->RetrieveTexture("bgdeckeditor.jpg"); //Now it's possibile to randomly use up to 3 background images for deck editor background (if random index is 0, it will be rendered the default "bgdeckeditor.jpg" image).
JTexture * wpTex = NULL;
if(kBgFile == ""){
char temp[4096];
sprintf(temp, "bgdeckeditor%i.jpg", std::rand() % 3);
kBgFile.assign(temp);
wpTex = WResourceManager::Instance()->RetrieveTexture(kBgFile);
if (wpTex) {
JQuadPtr wpQuad = WResourceManager::Instance()->RetrieveTempQuad(kBgFile);
if (wpQuad.get())
JRenderer::GetInstance()->RenderQuad(wpQuad.get(), 0, 0, 0, SCREEN_WIDTH_F / wpQuad->mWidth, SCREEN_HEIGHT_F / wpQuad->mHeight);
else {
kBgFile = "bgdeckeditor.jpg"; //Fallback to default background image for deck editor background.
wpTex = NULL;
}
} else
kBgFile = "bgdeckeditor.jpg"; //Fallback to default background image for deck editor background.
}
if(!wpTex)
wpTex = WResourceManager::Instance()->RetrieveTexture(kBgFile);
if (wpTex) if (wpTex)
{ {
JQuadPtr wpQuad = WResourceManager::Instance()->RetrieveTempQuad("bgdeckeditor.jpg"); JQuadPtr wpQuad = WResourceManager::Instance()->RetrieveTempQuad(kBgFile);
JRenderer::GetInstance()->RenderQuad(wpQuad.get(), 0, 0, 0, SCREEN_WIDTH_F / wpQuad->mWidth, SCREEN_HEIGHT_F / wpQuad->mHeight); JRenderer::GetInstance()->RenderQuad(wpQuad.get(), 0, 0, 0, SCREEN_WIDTH_F / wpQuad->mWidth, SCREEN_HEIGHT_F / wpQuad->mHeight);
}/* }
if (mView->deck() == myDeck && mStage != STAGE_MENU) /*if (mView->deck() == myDeck && mStage != STAGE_MENU)
renderDeckBackground();*/ renderDeckBackground();*/
#else #else
JTexture * wpTex = WResourceManager::Instance()->RetrieveTexture("pspbgdeckeditor.jpg"); JTexture * wpTex = WResourceManager::Instance()->RetrieveTexture("pspbgdeckeditor.jpg");
@@ -1584,8 +1607,8 @@ void GameStateDeckViewer::Render()
{ {
JQuadPtr wpQuad = WResourceManager::Instance()->RetrieveTempQuad("pspbgdeckeditor.jpg"); JQuadPtr wpQuad = WResourceManager::Instance()->RetrieveTempQuad("pspbgdeckeditor.jpg");
JRenderer::GetInstance()->RenderQuad(wpQuad.get(), 0, 0, 0, SCREEN_WIDTH_F / wpQuad->mWidth, SCREEN_HEIGHT_F / wpQuad->mHeight); JRenderer::GetInstance()->RenderQuad(wpQuad.get(), 0, 0, 0, SCREEN_WIDTH_F / wpQuad->mWidth, SCREEN_HEIGHT_F / wpQuad->mHeight);
}/* }
if (mView->deck() == myDeck && mStage != STAGE_MENU) /*if (mView->deck() == myDeck && mStage != STAGE_MENU)
renderDeckBackground();*/ renderDeckBackground();*/
#endif #endif
mView->Render(); mView->Render();

View File

@@ -133,6 +133,7 @@ enum ENUM_OPERATION_LEVELS
int GameStateDuel::selectedPlayerDeckId = 0; int GameStateDuel::selectedPlayerDeckId = 0;
int GameStateDuel::selectedAIDeckId = 0; int GameStateDuel::selectedAIDeckId = 0;
static std::string kBgFile = "";
GameStateDuel::GameStateDuel(GameApp* parent) : GameStateDuel::GameStateDuel(GameApp* parent) :
GameState(parent, "duel") GameState(parent, "duel")
@@ -181,6 +182,7 @@ GameStateDuel::~GameStateDuel()
{ {
End(); End();
SAFE_DELETE(tournament); SAFE_DELETE(tournament);
kBgFile = ""; //Reset the chosen backgorund.
} }
void GameStateDuel::Start() void GameStateDuel::Start()
@@ -370,6 +372,7 @@ void GameStateDuel::End()
#endif #endif
MTGAbility::deletedpointers.clear(); // Clear the list of deallocated pointer. MTGAbility::deletedpointers.clear(); // Clear the list of deallocated pointer.
kBgFile = ""; //Reset the chosen backgorund.
} }
//TODO Move This to utils or ResourceManager. Don't we have more generic functions that can do that? //TODO Move This to utils or ResourceManager. Don't we have more generic functions that can do that?
@@ -1084,10 +1087,29 @@ void GameStateDuel::Render()
JRenderer::GetInstance()->RenderQuad(wpQuad.get(), 0, 0, 0, SCREEN_WIDTH_F / wpQuad->mWidth, SCREEN_HEIGHT_F / wpQuad->mHeight); JRenderer::GetInstance()->RenderQuad(wpQuad.get(), 0, 0, 0, SCREEN_WIDTH_F / wpQuad->mWidth, SCREEN_HEIGHT_F / wpQuad->mHeight);
} }
#else #else
JTexture * wpTex = WResourceManager::Instance()->RetrieveTexture("bgdeckeditor.jpg"); //Now it's possibile to randomly use up to 3 background images for deck selection (if random index is 0, it will be rendered the default "bgdeckeditor.jpg" image).
JTexture * wpTex = NULL;
if(kBgFile == ""){
char temp[4096];
sprintf(temp, "bgdeckeditor%i.jpg", std::rand() % 3);
kBgFile.assign(temp);
wpTex = WResourceManager::Instance()->RetrieveTexture(kBgFile);
if (wpTex) {
JQuadPtr wpQuad = WResourceManager::Instance()->RetrieveTempQuad(kBgFile);
if (wpQuad.get())
JRenderer::GetInstance()->RenderQuad(wpQuad.get(), 0, 0, 0, SCREEN_WIDTH_F / wpQuad->mWidth, SCREEN_HEIGHT_F / wpQuad->mHeight);
else {
kBgFile = "bgdeckeditor.jpg"; //Fallback to default background image for deck selection.
wpTex = NULL;
}
} else
kBgFile = "bgdeckeditor.jpg"; //Fallback to default background image for deck selection.
}
if(!wpTex)
wpTex = WResourceManager::Instance()->RetrieveTexture(kBgFile);
if (wpTex) if (wpTex)
{ {
JQuadPtr wpQuad = WResourceManager::Instance()->RetrieveTempQuad("bgdeckeditor.jpg"); JQuadPtr wpQuad = WResourceManager::Instance()->RetrieveTempQuad(kBgFile);
JRenderer::GetInstance()->RenderQuad(wpQuad.get(), 0, 0, 0, SCREEN_WIDTH_F / wpQuad->mWidth, SCREEN_HEIGHT_F / wpQuad->mHeight); JRenderer::GetInstance()->RenderQuad(wpQuad.get(), 0, 0, 0, SCREEN_WIDTH_F / wpQuad->mWidth, SCREEN_HEIGHT_F / wpQuad->mHeight);
} }
#endif #endif

View File

@@ -16,12 +16,16 @@ namespace GameStateOptionsConst
const int kReloadID = 5; const int kReloadID = 5;
} }
static std::string kBgFile = "";
GameStateOptions::GameStateOptions(GameApp* parent) : GameStateOptions::GameStateOptions(GameApp* parent) :
GameState(parent, "options"), mReload(false), grabber(NULL), optionsMenu(NULL), optionsTabs(NULL) GameState(parent, "options"), mReload(false), grabber(NULL), optionsMenu(NULL), optionsTabs(NULL)
{ {
} }
GameStateOptions::~GameStateOptions() GameStateOptions::~GameStateOptions()
{ {
kBgFile = ""; //Reset the chosen backgorund.
} }
void GameStateOptions::Start() void GameStateOptions::Start()
@@ -153,6 +157,7 @@ void GameStateOptions::End()
JRenderer::GetInstance()->EnableVSync(false); JRenderer::GetInstance()->EnableVSync(false);
SAFE_DELETE(optionsTabs); SAFE_DELETE(optionsTabs);
SAFE_DELETE(optionsMenu); SAFE_DELETE(optionsMenu);
kBgFile = ""; //Reset the chosen backgorund.
} }
void GameStateOptions::Update(float dt) void GameStateOptions::Update(float dt)
@@ -237,10 +242,29 @@ void GameStateOptions::Render()
//Erase //Erase
JRenderer::GetInstance()->ClearScreen(ARGB(0,0,0,0)); JRenderer::GetInstance()->ClearScreen(ARGB(0,0,0,0));
#if !defined (PSP) #if !defined (PSP)
JTexture * wpTex = WResourceManager::Instance()->RetrieveTexture("bgdeckeditor.jpg"); //Now it's possibile to randomly use up to 3 background images for game settings (if random index is 0, it will be rendered the default "bgdeckeditor.jpg" image).
JTexture * wpTex = NULL;
if(kBgFile == ""){
char temp[4096];
sprintf(temp, "bgdeckeditor%i.jpg", std::rand() % 3);
kBgFile.assign(temp);
wpTex = WResourceManager::Instance()->RetrieveTexture(kBgFile);
if (wpTex) {
JQuadPtr wpQuad = WResourceManager::Instance()->RetrieveTempQuad(kBgFile);
if (wpQuad.get())
JRenderer::GetInstance()->RenderQuad(wpQuad.get(), 0, 0, 0, SCREEN_WIDTH_F / wpQuad->mWidth, SCREEN_HEIGHT_F / wpQuad->mHeight);
else {
kBgFile = "bgdeckeditor.jpg"; //Fallback to default background image for game settings.
wpTex = NULL;
}
} else
kBgFile = "bgdeckeditor.jpg"; //Fallback to default background image for game settings.
}
if(!wpTex)
wpTex = WResourceManager::Instance()->RetrieveTexture(kBgFile);
if (wpTex) if (wpTex)
{ {
JQuadPtr wpQuad = WResourceManager::Instance()->RetrieveTempQuad("bgdeckeditor.jpg"); JQuadPtr wpQuad = WResourceManager::Instance()->RetrieveTempQuad(kBgFile);
JRenderer::GetInstance()->RenderQuad(wpQuad.get(), 0, 0, 0, SCREEN_WIDTH_F / wpQuad->mWidth, SCREEN_HEIGHT_F / wpQuad->mHeight); JRenderer::GetInstance()->RenderQuad(wpQuad.get(), 0, 0, 0, SCREEN_WIDTH_F / wpQuad->mWidth, SCREEN_HEIGHT_F / wpQuad->mHeight);
} }
#else #else