From f671f617137ccd1b006428a188cd15f38e4795cd Mon Sep 17 00:00:00 2001 From: Vittorio Alfieri Date: Thu, 16 Sep 2021 22:11:43 +0200 Subject: [PATCH] Fixed primitives, improved sound tracks management, now it's possbile to add a custom tracks for Shop section (Track2.mp3), Option window (Track3.mp3) and Awards section (Track4.mp3) and it's also possible to add two subfolders "MainMenu" and "Battlefield" within "suound" folder where it's possbile to add twenty custom songs ("TrackMenuXX.mp3" and "TrackDuelXX.mp3") that will be played randomly in main menu windows and when match starts. --- CHANGELOG.md | 5 ++- .../bin/Res/sets/primitives/borderline.txt | 2 +- projects/mtg/bin/Res/sets/primitives/mtg.txt | 6 ++-- .../bin/Res/sets/primitives/planeswalkers.txt | 2 +- projects/mtg/src/GameApp.cpp | 3 ++ projects/mtg/src/GameStateAwards.cpp | 2 ++ projects/mtg/src/GameStateDuel.cpp | 31 +++++++++++++------ projects/mtg/src/GameStateMenu.cpp | 11 +++++-- projects/mtg/src/GameStateOptions.cpp | 2 ++ projects/mtg/src/GameStateShop.cpp | 2 ++ 10 files changed, 49 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 133d47fa8..9afd24e71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,11 @@ ## [master] (https://github.com/WagicProject/wagic/tree/master) +### 16/09/21 +- *Committed:* Fixed primitives, improved sound tracks management, now it's possbile to add a custom tracks for Shop section (Track2.mp3), Option window (Track3.mp3) and Awards section (Track4.mp3) and it's also possible to add two subfolders "MainMenu" and "Battlefield" within "suound" folder where it's possbile to add twenty custom songs ("TrackMenuXX.mp3" and "TrackDuelXX.mp3") that will be played randomly in main menu windows and when match starts. ([Vitty85](https://github.com/Vitty85)) + ### 13/09/21 -- *Committed:* Fixed AFR, STA, STX and J21 sets, fixed "_PROLIFERATE_" macro and fixed primitives with "proliferate" ability, fixed all primitives with "mutate" ability, improved "proliferate" and "duplicatecounters" keywords, added a new target "permanent" to target togheter a player and permanents on battlefield (e.g. cards with "proliferate"). ([Vitty85](https://github.com/Vitty85)) +- *Committed:* Fixed AFR, STA, STX and J21 sets, fixed "_PROLIFERATE_" macro and fixed primitives with "proliferate" ability, fixed all primitives with "mutate" ability, improved "proliferate" and "duplicatecounters" keywords, added a new target "permanent" to target togheter a player and permanents on battlefield (e.g. cards with "proliferate"). https://github.com/WagicProject/wagic/commit/2af470e42b9621a64373094db2ce454263d6bc51 ([Vitty85](https://github.com/Vitty85)) ### 12/09/21 - *Committed:* Added/Fixed primitives, updated the "missing_cards_by_sets" folder, added a new option "keepname" to keep the original name after the copy (e.g. Olag, Ludevic's Hubris), implemented a fix to avoid triggering of oneshot abilities when "flip" ability is used to return from a copy, fixed an issue with colors and "transforms" keyword, implemented a fix to avoid crashes when the card paying extracost has also a cost alteration (e.g. combo with "Pirate's Pillage" and "Ruby Medallion"), added a new keyword "totmanaspent" to return the real amount of mana spent to cast a card (e.g. Memory Deluge), added new keywords "pnumofidentitycols" and "onumofidentitycols" to return the total amount of commander identity colors for controller or opponent (e.g. War Room), improved "totcnt" keyword, added new keywords "totalcololorsinplay" and "oppototalcololorsinplay" to return the total amount of colors on controller or opponent battlefield (e.g. Moonveil Regent), added new keywords "pcoven" and "ocoven" to return if a player controls three or more creatures with different powers (e.g. Augur of Autumn). https://github.com/WagicProject/wagic/commit/04a6a4bfe2a4ae6fd2541723e3a338343320d851 ([Vitty85](https://github.com/Vitty85)) diff --git a/projects/mtg/bin/Res/sets/primitives/borderline.txt b/projects/mtg/bin/Res/sets/primitives/borderline.txt index ba6a5e1b3..aff40bde2 100644 --- a/projects/mtg/bin/Res/sets/primitives/borderline.txt +++ b/projects/mtg/bin/Res/sets/primitives/borderline.txt @@ -12496,7 +12496,7 @@ toughness=2 [card] name=Contamination auto=upcost[{S(creature|mybattlefield)}] sacrifice -auto=lord(land) transforms((removetypes,newability[becomes(Swamp)])) forever +auto=lord(land) transforms((,newability[loseabilities],newability[losesubtypesof(land)],newability[becomes(swamp)])) text=At the beginning of your upkeep, sacrifice Contamination unless you sacrifice a creature. -- If a land is tapped for mana, it produces {B} instead of any other type and amount. mana={2}{B} type=Enchantment diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index 8644de6d8..cc5ddc2d2 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -131017,9 +131017,11 @@ toughness=1 [/card] [card] name=Walking Ballista +auto=if compare(fullpaid)~lessthan~2 then indestructible ueot auto=counter(1/1,XX) -auto={4}:counter(1/1,1) -auto={C(1/1,-1)}:damage:1 target(creature,player) +auto={4}:name(Put 1/1 counter) counter(1/1) +auto={C(1/1,-1)}:name(Damage creature or player) damage:1 target(creature,player) +auto=if compare(fullpaid)~lessthan~2 then -indestructible ueot text=Walking Ballista enters the battlefield with X +1/+1 counters on it. -- {4}: Put a +1/+1 counter on Walking Ballista. -- Remove a +1/+1 counter from Walking Ballista: It deals 1 damage to target creature or player. mana={X}{X} type=Artifact Creature diff --git a/projects/mtg/bin/Res/sets/primitives/planeswalkers.txt b/projects/mtg/bin/Res/sets/primitives/planeswalkers.txt index 6e40d6aeb..7878f0c49 100644 --- a/projects/mtg/bin/Res/sets/primitives/planeswalkers.txt +++ b/projects/mtg/bin/Res/sets/primitives/planeswalkers.txt @@ -2857,7 +2857,7 @@ auto=counter(0/0,5,Loyalty) auto=token(Tibalt Emblem,Emblem,0/0,shroud,indestructible,notrigger) and!( transforms((,newability[lord(*[counter{0/0.1.TibaltExiled}]|myexile) canplayfromexile],newability[lord(*[counter{0/0.1.TibaltExiled}]|myexile) anytypeofmana],newability[{0}:name(Cast from opponent exile) target(*[counter{0/0.1.TibaltExiled}]|opponentexile) moveto(myexile) and!( transforms((,newability[counter(0/0.1.TibaltExiled)],newability[canplayfromexile],newability[anytypeofmana],newability[phaseaction[endofturn once checkex] moveTo(ownerexile)],newability[phaseaction[untap once checkex] counter(0/0.1.TibaltExiled)])) ueot )!])) forever )! auto={C(0/0,2,Loyalty)}:name(+2: Exile the top card) all(*[zpos=1]|library) moveto(ownerexile) and!( counter(0/0,1,TibaltExiled) )! auto={C(0/0,-3,Loyalty)}:name(-3: Exile target artifact or creature) target(*[artifact;creature]|battlefield) moveto(ownerexile) and!( counter(0/0,1,TibaltExiled) )! -auto={C(0/0,-8,Loyalty)}:name(-8: Exile all cards from all graveyards) all(*|graveyard) moveto(ownerexile) and!( counter(0/0,1,TibaltExiled) )! +auto={C(0/0,-8,Loyalty)}:name(-8: Exile all cards from all graveyards) add{R}{R}{R} && ability$!all(*|graveyard) moveto(ownerexile) and!( counter(0/0.1.TibaltExiled) )! !$ controller text=As Tibalt enters the battlefield, you get an emblem with "You may play cards exiled with Tibalt, Cosmic Impostor, and you may spend mana as though it were mana of any color to cast those spells." -- +2: Exile the top card of each player’s library. -- -3: Exile target artifact or creature. -- -8: Exile all cards from all graveyards. Add {R}{R}{R}. // {1}{B} Valki, God of Lies mana={5}{B}{R} type=Legendary Planeswalker diff --git a/projects/mtg/src/GameApp.cpp b/projects/mtg/src/GameApp.cpp index eb12d2a8a..6b82cd7c3 100644 --- a/projects/mtg/src/GameApp.cpp +++ b/projects/mtg/src/GameApp.cpp @@ -550,6 +550,9 @@ void GameApp::playMusic(string filename, bool loop) if (filename.compare(currentMusicFile) == 0 && music) return; + if(!WResourceManager::Instance()->ssLoadMusic(filename.c_str())) + return; // Added to avoid opening not existing file. + if (music) { JSoundSystem::GetInstance()->StopMusic(music); diff --git a/projects/mtg/src/GameStateAwards.cpp b/projects/mtg/src/GameStateAwards.cpp index 4405f0cff..4dd1a74fa 100644 --- a/projects/mtg/src/GameStateAwards.cpp +++ b/projects/mtg/src/GameStateAwards.cpp @@ -147,6 +147,8 @@ void GameStateAwards::Start() detailview = NULL; setSrc = NULL; showMenu = false; + + GameApp::playMusic("Track4.mp3"); // Added music for trophies. } void GameStateAwards::Create() diff --git a/projects/mtg/src/GameStateDuel.cpp b/projects/mtg/src/GameStateDuel.cpp index 388dd49f6..42872bd75 100644 --- a/projects/mtg/src/GameStateDuel.cpp +++ b/projects/mtg/src/GameStateDuel.cpp @@ -770,16 +770,27 @@ void GameStateDuel::Update(float dt) sprintf(temp, "ai_baka_music%i.mp3", OpponentsDeckid); musictrack.assign(temp); } - else if (mParent->gameType == GAME_TYPE_CLASSIC || mParent->gameType == GAME_TYPE_COMMANDER) - musictrack = "ai_baka_music.mp3"; - else if (mParent->gameType == GAME_TYPE_MOMIR) - musictrack = "ai_baka_music_momir.mp3"; - else if (mParent->gameType == GAME_TYPE_RANDOM1 || mParent->gameType == GAME_TYPE_RANDOM2) musictrack - = "ai_baka_music_random.mp3"; - else if (mParent->gameType == GAME_TYPE_RANDOM3 || mParent->gameType == GAME_TYPE_RANDOM5) musictrack - = "ai_baka_music_random.mp3"; - else if (mParent->gameType == GAME_TYPE_HORDE || mParent->gameType == GAME_TYPE_SET_LIMITED) musictrack - = "ai_baka_music_momir.mp3"; + // Now it's possibile to use up to 20 sound tracks for duels. + if (!MusicExist(musictrack)){ + char temp[4096]; + sprintf(temp, "Battlefield/TrackDuel%i.mp3", std::rand() % 20); + musictrack.assign(temp); + } + // Try if there is a sound track for specific game type. + if (!MusicExist(musictrack)){ + if (mParent->gameType == GAME_TYPE_CLASSIC) + musictrack = "ai_baka_music.mp3"; + else if (mParent->gameType == GAME_TYPE_COMMANDER) + musictrack = "ai_baka_music_commander.mp3"; + else if (mParent->gameType == GAME_TYPE_MOMIR) + musictrack = "ai_baka_music_momir.mp3"; + else if (mParent->gameType == GAME_TYPE_RANDOM1 || mParent->gameType == GAME_TYPE_RANDOM2 || mParent->gameType == GAME_TYPE_RANDOM3 || mParent->gameType == GAME_TYPE_RANDOM5) + musictrack = "ai_baka_music_random.mp3"; + else if (mParent->gameType == GAME_TYPE_HORDE) + musictrack = "ai_baka_music_horde.mp3"; + else if (mParent->gameType == GAME_TYPE_SET_LIMITED) + musictrack = "ai_baka_music_limited.mp3"; + } if (!MusicExist(musictrack)) musictrack = "ai_baka_music.mp3"; diff --git a/projects/mtg/src/GameStateMenu.cpp b/projects/mtg/src/GameStateMenu.cpp index 36052b695..f11e3490b 100644 --- a/projects/mtg/src/GameStateMenu.cpp +++ b/projects/mtg/src/GameStateMenu.cpp @@ -141,8 +141,15 @@ void GameStateMenu::Start() subMenuController = NULL; SAFE_DELETE(mGuiController); - GameApp::playMusic("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. + musicFilename.assign(temp); + musicFilename = WResourceManager::Instance()->musicFile(musicFilename); + if (musicFilename.length() < 1 || !FileExists(musicFilename)) + musicFilename = "Track0.mp3"; + GameApp::playMusic(musicFilename); + hasChosenGameType = false; mParent->gameType = GAME_TYPE_CLASSIC; diff --git a/projects/mtg/src/GameStateOptions.cpp b/projects/mtg/src/GameStateOptions.cpp index 1fd09265c..f3be11162 100644 --- a/projects/mtg/src/GameStateOptions.cpp +++ b/projects/mtg/src/GameStateOptions.cpp @@ -142,6 +142,8 @@ void GameStateOptions::Start() optionsMenu->Add(kCancelMenuID, "Cancel"); optionsTabs->Entering(JGE_BTN_NONE); + + GameApp::playMusic("Track3.mp3"); // Added music for options. } void GameStateOptions::End() diff --git a/projects/mtg/src/GameStateShop.cpp b/projects/mtg/src/GameStateShop.cpp index c24d4bcf5..729ba47c9 100644 --- a/projects/mtg/src/GameStateShop.cpp +++ b/projects/mtg/src/GameStateShop.cpp @@ -147,6 +147,8 @@ void GameStateShop::Start() pspIcons[i]->SetHotSpot(16, 16); } + GameApp::playMusic("Track2.mp3"); // Added music for shop. + JRenderer::GetInstance()->EnableVSync(true); taskList = NULL;