Fixed primitives, improved background images management, now it's possbile to add a different background for opponent deck choosing (menupanel2.jpg) and added a new sub-folder "background" for custom themes where it will be possbile to store up to six new background images for battlefield (from "backdrop1.jpg" to "backdrop6.jpg") that will be randomly choosen when match starts.

This commit is contained in:
Vittorio Alfieri
2021-09-20 15:36:42 +02:00
parent e2a1705b3f
commit 832d033488
8 changed files with 46 additions and 16 deletions

View File

@@ -2,8 +2,11 @@
## [master] (https://github.com/WagicProject/wagic/tree/master)
### 20/09/21
- *Committed:* Fixed primitives, improved background images management, now it's possbile to add a different background for opponent deck choosing (menupanel2.jpg) and added a new sub-folder "background" for custom themes where it will be possbile to store up to six new background images for battlefield (from "backdrop1.jpg" to "backdrop6.jpg") that will be randomly choosen when match starts. ([Vitty85](https://github.com/Vitty85))
### 19/09/21
- *Committed:* Fixed a bug on sound tracks for PSP/PSVita devices, removed a test on vampired trigger due to a fake error on test suite. ([Vitty85](https://github.com/Vitty85))
- *Committed:* Fixed a bug on sound tracks for PSP/PSVita devices, removed a test on vampired trigger due to a fake error on test suite. https://github.com/WagicProject/wagic/commit/e2a1705b3f5ec84d975e468af9d1e48b7be5c581 ([Vitty85](https://github.com/Vitty85))
- *Committed:* Fixed typos in several primitives, updated the "missing_cards_by_sets" folder, fixed MID, MIC and CC2 sets. https://github.com/WagicProject/wagic/commit/ff47c0dd44fba6f2ccbf9e259583ac7f977741b2 ([Vitty85](https://github.com/Vitty85))

View File

@@ -650,7 +650,7 @@ subtype=Dakkon
name=Daretti, Ingenious Iconoclast
auto=counter(0/0,3,loyalty)
auto={C(0/0,1,Loyalty)}:name(+1: Create a 1/1 colorless Construct) token(Construct,Artifact Creature Construct,1/1,defender)
auto={C(0/0,-1,Loyalty)}:name(-1: Sacrifice artifact to destroy) {S(artifact|mybattlefield)}:destroy target(creature,artifact|battlefield)
auto={C(0/0,-1,Loyalty)}{S(artifact|mybattlefield)}:name(-1: Sacrifice artifact to destroy) target(creature,artifact|battlefield) destroy
auto={C(0/0,-6,Loyalty)}:name(-6: Create three copies of an artifact...) clone target(artifact|graveyard,battlefield)*3
text=+1: Create a 1/1 colorless Construct artifact creature token with defender. -- -1: You may sacrifice an artifact. If you do, destroy target artifact or creature. -- -6: Choose target artifact card in a graveyard or artifact on the battlefield. Create three tokens that are copies of it.
mana={1}{B}{R}

View File

@@ -49,6 +49,7 @@ protected:
bool mShowDetailsScreen;
bool mAlwaysShowDetailsButton;
bool mClosed;
bool isOpponent;
public:
VerticalTextScroller * mScroller;
@@ -67,7 +68,7 @@ public:
JQuadPtr pspIcons[8];
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, bool chooseOpponent = false);
~DeckMenu();
DeckMetaData * getSelectedDeck();

View File

@@ -34,7 +34,7 @@ hgeParticleSystem* DeckMenu::stars = NULL;
// TODO:
// *** Need to make this configurable in a file somewhere to allow for class reuse
DeckMenu::DeckMenu(int id, JGuiListener* listener, int fontId, const string _title, const int&, bool showDetailsOverride) :
DeckMenu::DeckMenu(int id, JGuiListener* listener, int fontId, const string _title, const int&, bool showDetailsOverride, bool chooseOpponent) :
JGuiController(JGE::GetInstance(), id, listener), fontId(fontId), mShowDetailsScreen( showDetailsOverride )
{
@@ -85,6 +85,7 @@ JGuiController(JGE::GetInstance(), id, listener), fontId(fontId), mShowDetailsSc
selectionT = 0;
timeOpen = 0;
mClosed = false;
isOpponent = chooseOpponent;
if (mFont->GetStringWidth(title.c_str()) > titleWidth)
titleFontScale = SCALE_SHRINK;
@@ -256,7 +257,12 @@ void DeckMenu::Render()
menuholder = WResourceManager::Instance()->RetrieveTempQuad("pspmenuholder.png");//new graphics menuholder for PSP
#else
avatarholder = WResourceManager::Instance()->RetrieveTempQuad("avatarholder.png");//new graphics avatarholder
menupanel = WResourceManager::Instance()->RetrieveTempQuad("menupanel.jpg");//new graphics menupanel
if(isOpponent){
menupanel = WResourceManager::Instance()->RetrieveTempQuad("menupanel2.jpg");//try to load the new graphics menupanel for opponent.
if(!menupanel.get())
menupanel = WResourceManager::Instance()->RetrieveTempQuad("menupanel.jpg");//fallback to new graphics menupanel for player
} else
menupanel = WResourceManager::Instance()->RetrieveTempQuad("menupanel.jpg");//new graphics menupanel for player
menuholder = WResourceManager::Instance()->RetrieveTempQuad("menuholder.png");//new graphics menuholder
#endif
bool inDeckMenu = backgroundName.find("DeckMenuBackdrop") != string::npos;

View File

@@ -235,6 +235,13 @@ void GameApp::Create()
#if !defined (PSP)
WResourceManager::Instance()->RetrieveTexture("backdrop.jpg", RETRIEVE_MANAGE);
WResourceManager::Instance()->RetrieveTexture("backdropframe.png", RETRIEVE_MANAGE);
for(int i = 1 ; i < 7; i++){
char temp[4096];
string fileName = "";
sprintf(temp, "background/backdrop%i.jpg", i); //Now it's possibile to randomly use up to other 6 background images for match.
fileName.assign(temp);
WResourceManager::Instance()->RetrieveTexture(fileName, RETRIEVE_MANAGE);
}
#else
WResourceManager::Instance()->RetrieveTexture("pspbackdrop.jpg", RETRIEVE_MANAGE);
WResourceManager::Instance()->RetrieveTexture("pspbackdropframe.png", RETRIEVE_MANAGE);

View File

@@ -240,7 +240,7 @@ void GameStateDuel::Start()
decksneeded = 1;
deckmenu = NEW DeckMenu(DUEL_MENU_CHOOSE_DECK, this, Fonts::OPTION_FONT, "Choose a Deck",
GameStateDuel::selectedPlayerDeckId, true);
GameStateDuel::selectedPlayerDeckId, true, false);
deckmenu->enableDisplayDetailsOverride();
DeckManager *deckManager = DeckManager::GetInstance();
vector<DeckMetaData *> playerDeckList = BuildDeckList(options.profileFile(), "", NULL, 0, mParent->gameType);
@@ -288,7 +288,7 @@ void GameStateDuel::Start()
else if(createDeckMenu && (mParent->players[0] == PLAYER_TYPE_CPU && mParent->players[1] == PLAYER_TYPE_CPU))
{
//DeckManager::EndInstance();
deckmenu = NEW DeckMenu(DUEL_MENU_CHOOSE_DECK, this, Fonts::OPTION_FONT, "Choose a Deck", GameStateDuel::selectedPlayerDeckId, true);
deckmenu = NEW DeckMenu(DUEL_MENU_CHOOSE_DECK, this, Fonts::OPTION_FONT, "Choose a Deck", GameStateDuel::selectedPlayerDeckId, true, true);
int nmbDecks = options[Options::CHEATMODEAIDECK].number ? 1000 : options[Options::AIDECKS_UNLOCKED].number;
if (nmbDecks > 1)
{
@@ -386,7 +386,7 @@ void GameStateDuel::ConstructOpponentMenu()
if (opponentMenu == NULL)
{
opponentMenu = NEW DeckMenu(DUEL_MENU_CHOOSE_OPPONENT, this, Fonts::OPTION_FONT, "Choose Opponent",
GameStateDuel::selectedAIDeckId, true);
GameStateDuel::selectedAIDeckId, true, true);
int nbUnlockedDecks = options[Options::CHEATMODEAIDECK].number ? 1000 : options[Options::AIDECKS_UNLOCKED].number;
if ((mParent->gameType == GAME_TYPE_COMMANDER || mParent->gameType == GAME_TYPE_CLASSIC || mParent->gameType == GAME_TYPE_DEMO) && mParent->players[1] == PLAYER_TYPE_CPU)
@@ -770,10 +770,10 @@ void GameStateDuel::Update(float dt)
sprintf(temp, "ai_baka_music%i.mp3", OpponentsDeckid);
musictrack.assign(temp);
}
// Now it's possibile to use up to 20 sound tracks for duels.
// Now it's possibile to randomly use up to 20 new sound tracks for duels (if random index is 20, it will be played the default "ai_baka_music.mp3" file).
if (!MusicExist(musictrack)){
char temp[4096];
sprintf(temp, "Battlefield/TrackDuel%i.mp3", std::rand() % 20);
sprintf(temp, "Battlefield/TrackDuel%i.mp3", std::rand() % 21);
musictrack.assign(temp);
}
// Try if there is a sound track for specific game type.

View File

@@ -144,9 +144,10 @@ void GameStateMenu::Start()
#if defined (PSP)
GameApp::playMusic("Track0.mp3");
#else
// Now it's possibile to randomly use up to 20 new sound tracks for main menu (if random index is 20, it will be played the default "Track0.mp3").
char temp[4096];
string musicFilename = "";
sprintf(temp, "MainMenu/TrackMenu%i.mp3", std::rand() % 20); // Now it's possibile to use up to 20 sound tracks for main menu.
sprintf(temp, "MainMenu/TrackMenu%i.mp3", std::rand() % 21);
musicFilename.assign(temp);
musicFilename = WResourceManager::Instance()->musicFile(musicFilename);
if (musicFilename.length() < 1 || !FileExists(musicFilename))

View File

@@ -5,9 +5,10 @@
#include "GameObserver.h"
#include "Rules.h"
const std::string kBackdropFile = "backdrop.jpg";
const std::string kBackdropFrameFile = "backdropframe.png";
const std::string kPspBackdropFile = "pspbackdrop.jpg";
static std::string kBackdropFile = "";
static std::string kBackdropFrameFile = "backdropframe.png";
static std::string kPspBackdropFile = "pspbackdrop.jpg";
static std::string kPspBackdropFrameFile = "pspbackdropframe.png";
GuiBackground::GuiBackground(GameObserver* observer)
: GuiLayer(observer)
@@ -22,7 +23,11 @@ void GuiBackground::Render()
{
JRenderer* renderer = JRenderer::GetInstance();
JQuadPtr quad;
#if !defined (PSP)
JQuadPtr quadframe = WResourceManager::Instance()->RetrieveTempQuad(kBackdropFrameFile);
#else
JQuadPtr quadframe = WResourceManager::Instance()->RetrieveTempQuad(kPspBackdropFrameFile);
#endif
if (observer && observer->mRules && observer->mRules->bg.size())
{
quad = WResourceManager::Instance()->RetrieveTempQuad(observer->mRules->bg);
@@ -30,6 +35,15 @@ void GuiBackground::Render()
if (!quad.get())
{
#if !defined (PSP)
//Now it's possibile to randomly use up to 6 new background images for match (if random index is 0, it will be rendered the default "backdrop.jpg" image).
if(kBackdropFile == ""){
char temp[4096];
sprintf(temp, "background/backdrop%i.jpg", std::rand() % 7);
kBackdropFile.assign(temp);
quad = WResourceManager::Instance()->RetrieveTempQuad(kBackdropFile);
if (!quad.get())
kBackdropFile = "backdrop.jpg"; //Fallback to default background image for match.
}
quad = WResourceManager::Instance()->RetrieveTempQuad(kBackdropFile);
#else
quad = WResourceManager::Instance()->RetrieveTempQuad(kPspBackdropFile);
@@ -39,10 +53,8 @@ void GuiBackground::Render()
{
renderer->RenderQuad(quad.get(), 0, 0, 0, SCREEN_WIDTH_F / quad->mWidth, SCREEN_HEIGHT_F / quad->mHeight);
}
#if !defined (PSP)
if (quadframe.get())
{
renderer->RenderQuad(quadframe.get(), 0, 0, 0, SCREEN_WIDTH_F / quadframe->mWidth, SCREEN_HEIGHT_F / quadframe->mHeight);
}
#endif
}