Skip to content

Commit

Permalink
Merge pull request #278 from besteon/staging
Browse files Browse the repository at this point in the history
Next Release: 6.5.0
  • Loading branch information
UTDZac authored Oct 31, 2022
2 parents 0430396 + 77c1a51 commit bcdc3af
Show file tree
Hide file tree
Showing 18 changed files with 1,720 additions and 2,962 deletions.
15 changes: 13 additions & 2 deletions Ironmon-Tracker.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Main = {}

-- The latest version of the tracker. Should be updated with each PR.
Main.Version = { major = "6", minor = "4", patch = "2" }
Main.Version = { major = "6", minor = "5", patch = "0" }

Main.CreditsList = { -- based on the PokemonBizhawkLua project by MKDasher
CreatedBy = "Besteon",
Expand Down Expand Up @@ -98,7 +98,9 @@ function Main.Initialize()
else
Main.OS = "Linux"
Main.Directory = nil -- will return "" from Utils function
print("Error attempting to use 'io.popen(\"cd\")':")
print(err)
print("Lua Engine: " .. client.get_lua_engine())
end

Main.CheckForVersionUpdate()
Expand Down Expand Up @@ -173,7 +175,9 @@ function Main.Run()
GameSettings.initialize()

-- If the loaded game is unsupported, remove the Tracker padding but continue to let the game play.
if GameSettings.game == 0 then
if GameSettings.gamename == "Unsupported Game" then
print("Unsupported Game detected, please load a supported game ROM")
print("Check the README.txt file in the tracker folder for supported games")
client.SetGameExtraPadding(0, 0, 0, 0)
while true do
emu.frameadvance()
Expand Down Expand Up @@ -561,6 +565,12 @@ function Main.LoadSettings()
Theme.MOVE_TYPES_ENABLED = enableMoveTypes
Theme.Buttons.MoveTypeEnabled.toggleState = not enableMoveTypes -- Show the opposite of the Setting, can't change existing theme strings
end

local enableTextShadows = settings.theme.DRAW_TEXT_SHADOWS
if enableTextShadows ~= nil then
Theme.DRAW_TEXT_SHADOWS = enableTextShadows
Theme.Buttons.DrawTextShadows.toggleState = enableTextShadows
end
end

return true
Expand Down Expand Up @@ -610,6 +620,7 @@ function Main.SaveSettings(forced)
settings.theme[encodedKey] = string.upper(string.sub(string.format("%#x", Theme.COLORS[colorkey]), 5))
end
settings.theme["MOVE_TYPES_ENABLED"] = Theme.MOVE_TYPES_ENABLED
settings.theme["DRAW_TEXT_SHADOWS"] = Theme.DRAW_TEXT_SHADOWS

Inifile.save(Constants.Files.SETTINGS, settings)
Options.settingsUpdated = false
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ We'd ideally like to support all non-English versions if we can, see [here](http

## Latest Changes

- **_NEW!!_ Random Ball Picker!**
- **_NEW!!_ Theme Library!**

![image](https://user-images.githubusercontent.com/4258818/194925877-c97f8676-550a-40e7-b813-9b730ed53c38.png)
![image](https://user-images.githubusercontent.com/4258818/198950378-2a70157a-7a2d-4890-83ff-b657af4b2a1c.png)

See the project's Wiki for a full [version changelog](https://github.com/besteon/Ironmon-Tracker/wiki/Version-Changelog).

Expand Down
13 changes: 0 additions & 13 deletions ThemePresets.txt

This file was deleted.

34 changes: 24 additions & 10 deletions ironmon_tracker/Battle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -242,17 +242,28 @@ function Battle.updateTrackedInfo()
-- Track move so long as the mon was able to use it
local attackerSlot = Battle.Combatants[Battle.IndexMap[Battle.attacker]]
local transformData = Battle.BattleAbilities[Battle.attacker % 2][attackerSlot].transformData
--Only track moves for enemies; our moves could be TM moves, or moves we didn't forget from earlier levels
if not transformData.isOwn then
local attackingMon = Tracker.getPokemon(transformData.slot,transformData.isOwn)
if attackingMon ~= nil then
Tracker.TrackMove(attackingMon.pokemonID, lastMoveByAttacker, attackingMon.level)
--Handle snatch
if Battle.battleMsg == GameSettings.BattleScript_SnatchedMove then
local battlerSlot = Battle.Combatants[Battle.IndexMap[Battle.battler]]
local battlerTransformData = Battle.BattleAbilities[Battle.battler % 2][battlerSlot].transformData
if not battlerTransformData.isOwn then
local lastMoveByBattler = Memory.readword(GameSettings.gBattleResults + 0x22 + ((Battle.battler % 2) * 0x2))
local battlerMon = Tracker.getPokemon(battlerTransformData.slot,battlerTransformData.isOwn)
Tracker.TrackMove(battlerMon.pokemonID, lastMoveByBattler, battlerMon.level)
end
else
--Only track moves for enemies; our moves could be TM moves, or moves we didn't forget from earlier levels
if not transformData.isOwn then
local attackingMon = Tracker.getPokemon(transformData.slot,transformData.isOwn)
if attackingMon ~= nil then
Tracker.TrackMove(attackingMon.pokemonID, lastMoveByAttacker, attackingMon.level)
end
end
end

--Only track ability-changing moves if they also did not fail/miss
if bit.band(moveFlags,0x29) == 0 then -- MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE | MOVE_RESULT_FAILED
Battle.trackAbilityChanges(lastMoveByAttacker,nil)
--Only track ability-changing moves if they also did not fail/miss
if bit.band(moveFlags,0x29) == 0 then -- MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE | MOVE_RESULT_FAILED
Battle.trackAbilityChanges(lastMoveByAttacker,nil)
end
end
end
--only get one chance to record
Expand Down Expand Up @@ -505,6 +516,9 @@ end
function Battle.endCurrentBattle()
if not Battle.inBattle then return end

-- Only record Last Level Seen after the battle, so the info shown doesn't get overwritten by current level
Tracker.recordLastLevelsSeen()

--Most of the time, Run Away message is present only after the battle ends
Battle.battleMsg = Memory.readdword(GameSettings.gBattlescriptCurrInstr)
if Battle.battleMsg == GameSettings.BattleScript_RanAwayUsingMonAbility then
Expand Down Expand Up @@ -541,7 +555,7 @@ function Battle.endCurrentBattle()
RightOwn = false,
RightOther = false,
}
BattleAbilities = {
Battle.BattleAbilities = {
[0] = {},
[1] = {},
}
Expand Down
33 changes: 33 additions & 0 deletions ironmon_tracker/Constants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,23 @@ Constants.GAME_STATS = { -- Enums for in-game stats
USED_ROCK_SMASH = 19,
}

Constants.PreloadedThemes = {
["Fire Red"] = "FFFFFF FFFFFF 55CB6B 62C7FE FEFA69 FEFA69 FF1920 81000E FF1920 81000E 58050D 0 1",
["Leaf Green"] = "FFFFFF FFFFFF 62C7FE FE7573 FEFA69 FEFA69 55CB6B 006200 55CB6B 006200 053A04 0 1",
["Beach Getaway"] = "222222 222222 5463FF E78EA9 A581E6 444444 E78EA9 B9F8D3 E78EA9 FFFBE7 40DFEF 0 0",
["Blue Da Ba Dee"] = "FFFFFF FFFFFF 2EB5FF E04DBA FEFA69 55CB6B 198BFF 004881 198BFF 004881 072557 1 1",
["Calico Cat"] = "4A3432 4A3432 E07E3D 8A9298 E07E3D FCFCF0 8A9298 FCFCF0 E07E3D FBCA8C 0F0601 0 0",
["Calico Cat v2"] = "4A3432 4A3432 E07E3D 8A9298 E07E3D FCFCF0 FCFCF0 FCFCF0 FBCA8C FBCA8C E07E3D 0 0",
["Cotton Candy"] = "000000 000000 1A85FF D41159 9155D9 EEEEEE D35FB7 FFCBF3 1A85FF A0D3FF 5D3A9B 0 0",
["GameCube"] = "C8C8C8 C8C8C8 2ACA38 FE4A4A EBE31A CBCCC4 000000 342A54 000000 342A54 000000 1 1",
["Item Bag"] = "636363 636363 017BC4 DF2800 DE8C4A 636363 D7B452 FEFFCF D7B452 FEFFCF F6CF73 0 0",
["Neon Lights"] = "FFFFFF FFFFFF 38FF12 FF00E3 FFF100 FFFFFF 00F5FB 000000 001EFF 000000 000000 1 1",
["Simple Monotone"] = "222222 222222 01B910 FE5958 555555 FFFFFF 000000 FFFFFF 000000 FFFFFF 555555 0 0",
["Team Rocket"] = "EEF5FE EEF5FE 8F7DEB D6335E F4E7BA F4E7BA 8F7DEB 333333 D6335E 333333 333333 1 1",
["USS Galactic"] = "EEEEEE EEEEEE 00ADB5 DFBB9D B6C8EF 00ADB5 222831 393E46 222831 393E46 000000 1 1",
["Cozy Fall Leaves"] = "2C432C 2C432C FA8223 9C7456 307940 307940 7D5D1E 9ED4B0 7D5D1E 9ED4B0 9ED4B0 0 0",
}

Constants.OrderedLists = {
STATSTAGES = {
"hp",
Expand Down Expand Up @@ -141,6 +158,22 @@ Constants.OrderedLists = {
"Lower box background",
"Main background",
},
PRELOADED_THEMES = {
"Fire Red",
"Leaf Green",
"Beach Getaway",
"Blue Da Ba Dee",
"Calico Cat",
"Calico Cat v2",
"Cotton Candy",
"GameCube",
"Item Bag",
"Neon Lights",
"Simple Monotone",
"Team Rocket",
"USS Galactic",
"Cozy Fall Leaves",
},
TIPS = { -- currently disabled, may use later
"Helpful tips are shown down here.", -- Skipped after it's shown once
"Tracked data is auto-saved after every battle.",
Expand Down
Loading

0 comments on commit bcdc3af

Please sign in to comment.