Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

7.5.4 Patch #383

Merged
merged 23 commits into from
May 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b6416db
Update GameSettings.lua
UTDZac Apr 20, 2023
da5b1a7
GameSettings: adding basic addresses to start
UTDZac Apr 20, 2023
0f88b74
GameSettings: adding remaining jp addr to startup
UTDZac Apr 20, 2023
d764fd2
GameSettings: adding more missing JP addresses
UTDZac Apr 20, 2023
993606c
Adding JP lang for tracker display
UTDZac Apr 21, 2023
382fa1a
GameSettings: remaining addresses for JP
UTDZac Apr 21, 2023
a617e91
Japanese: cleaner text UI updates
UTDZac Apr 21, 2023
fb75fda
Utils: add diagnostic to bypass error check
UTDZac Apr 21, 2023
d51211f
GameSettings: cleaning up leftover comments
UTDZac Apr 21, 2023
55f11c9
GameSettings: adding clarity to JP addresses
UTDZac Apr 21, 2023
ebd657a
Merge pull request #379 from besteon/utdzac/japanese-support
UTDZac Apr 21, 2023
196ea10
Update to reflect FR J support
Fellshadow Apr 21, 2023
fede85b
Update README.md
Fellshadow Apr 21, 2023
71540fa
revert README changes
Fellshadow Apr 26, 2023
f840c5b
Fix incorrect pixel-width for Char "1"
UTDZac May 4, 2023
532f135
Change evo parsing to split by comma (looking at you mr. mime)
Fellshadow May 4, 2023
eb67ca8
fix nickname read for team viewer reading past the end of sequence
Fellshadow May 9, 2023
ed9ec34
Update Battle.lua
jtigues May 20, 2023
8f2887d
Merge branch 'dev' into TraceDoublesBugfix
jtigues May 20, 2023
3f3525a
Update Battle.lua
jtigues May 20, 2023
72bd218
Merge pull request #382 from jtigues/TraceDoublesBugfix
Fellshadow May 20, 2023
ec937c6
Battle: adding back in nil check for battler
UTDZac May 24, 2023
4a5ad97
7.5.4 patch
Fellshadow May 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

## General Information

Ironmon-Tracker is a collection of lua scripts for the [Bizhawk emulator](https://tasvideos.org/BizHawk/ReleaseHistory) (v2.8 or higher) or [mGBA emulator](https://mgba.io/downloads.html)* (v0.10.0 or higher) used to track IronMon attempts.
> *mGBA's lua scripting is currently limited and doesn't provide any drawing functionality, this means the tracker on mGBA is purely text-based in the scripting window as we can't draw images/screens like on Bizhawk.
Ironmon-Tracker is a collection of lua scripts for the [Bizhawk emulator](https://tasvideos.org/BizHawk/ReleaseHistory) (v2.8 or higher) or [mGBA emulator](https://mgba.io/downloads.html)\* (v0.10.0 or higher) used to track IronMon attempts.
> \*mGBA's lua scripting is currently limited and doesn't provide any drawing functionality, this means the tracker on mGBA is purely text-based in the scripting window as we can't draw images/screens like on Bizhawk.

For more information on IronMon, see <http://ironmon.gg>

Expand All @@ -23,14 +23,13 @@ For NDS (gen 4/5) games, please use the [NDS IronMon Tracker](https://github.com

Currently supported Pokémon games / languages:

| Version | Ruby | Sapphire | Emerald | FireRed | LeafGreen |
| :------: | :----------: | :--------------: | :-------------: | :-------------: | :---------------: |
| English | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
| Spanish | ❌ | ❌ | ❌ | ✔️ | ❌ |
| French | ❌ | ❌ | ❌ | ✔️ | ❌ |
| Italian | ❌ | ❌ | ❌ | ✔️ | ❌ |
| German | ❌ | ❌ | ❌ | ✔️ | ❌ |
| Japanese | ❌ | ❌ | ❌ | ❌ | ❌ |
| Version | Ruby | Sapphire | Emerald | FireRed | LeafGreen |
| :-------: | :--: | :------: | :-----: | :-----: | :-------: |
| English | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
| Spanish | ❌ | ❌ | ❌ | ✔️ | ❌ |
| French | ❌ | ❌ | ❌ | ✔️ | ❌ |
| Italian | ❌ | ❌ | ❌ | ✔️ | ❌ |
| German | ❌ | ❌ | ❌ | ✔️ | ❌ |

We'd ideally like to support all non-English versions if we can, progress updates can be found [here](https://github.com/besteon/Ironmon-Tracker/issues/62).

Expand All @@ -40,9 +39,9 @@ We'd ideally like to support all non-English versions if we can, progress update
- You can get the latest project release from the [Releases](https://github.com/besteon/Ironmon-Tracker/releases/latest) section of this Github repository.
2. **Get a Supported Emulator**
- We recommend using the Bizhawk emulator (Windows/Linux only)
- [Download Bizhawk](https://tasvideos.org/BizHawk/ReleaseHistory) (v2.8 or higher)
- If you are on Windows, make sure to also download and run the [prereq installer](https://github.com/TASEmulators/BizHawk-Prereqs/releases) first
- If you are on Linux, we recommend using Bizhawk 2.9 or higher
- [Download Bizhawk](https://tasvideos.org/BizHawk/ReleaseHistory) (v2.8 or higher)
- If you are on Windows, make sure to also download and run the [prereq installer](https://github.com/TASEmulators/BizHawk-Prereqs/releases) first
- If you are on Linux, we recommend using Bizhawk 2.9 or higher
- Alternatively, you can use the MGBA emulator (Windows/Mac/Linux)
- [Download MGBA](https://mgba.io/downloads.html) (v0.10.0 or higher)
3. **Install and Setup**
Expand Down Expand Up @@ -79,11 +78,13 @@ There are a couple of VS Code extensions which we recommend, which should automa
- [vscode-lua](https://marketplace.visualstudio.com/items?itemName=trixnz.vscode-lua): Provides intellisense and linting for Lua.

Lua Versions:

- Bizhawk 2.8 uses Lua 5.1, this is the version currently set in our `.vscode/settings.json` file for linting.
- Bizhawk 2.9 and mGBA use Lua 5.4
- Since we intend to still support Bizhawk 2.8 the code must be compatible with both Lua 5.1 and 5.4
- Since we intend to still support Bizhawk 2.8 the code must be compatible with both Lua 5.1 and 5.4

Emu-specific Lua documentation:

- [Bizhawk Lua Functions](https://tasvideos.org/Bizhawk/LuaFunctions)
- [mGBA Scripting API](https://mgba.io/docs/scripting.html)

Expand Down
85 changes: 50 additions & 35 deletions ironmon_tracker/Battle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -495,61 +495,76 @@ function Battle.checkAbilitiesToTrack()
local battlerAbility = Battle.BattleParties[Battle.battler % 2][Battle.Combatants[Battle.IndexMap[Battle.battler]]].ability
local battleTargetAbility = Battle.BattleParties[Battle.battlerTarget % 2][Battle.Combatants[Battle.IndexMap[Battle.battlerTarget]]].ability

local abilityMsg
-- BATTLER: 'battler' had their ability triggered
local abilityMsg = GameSettings.ABILITIES.BATTLER[Battle.battleMsg]
if abilityMsg ~= nil and abilityMsg[battlerAbility] then
-- Track a Traced pokemon's ability
if battlerAbility == 36 then
Battle.trackAbilityChanges(nil,36)
combatantIndexesToTrack[Battle.battlerTarget] = Battle.battlerTarget
if GameSettings.ABILITIES.BATTLER then
abilityMsg = GameSettings.ABILITIES.BATTLER[Battle.battleMsg]
if abilityMsg ~= nil and abilityMsg[battlerAbility] then
-- Track a Traced pokemon's ability; need to grab the target from the buffers for doubles
if battlerAbility == 36 then
Battle.trackAbilityChanges(nil,36)
local target = Memory.readbyte(GameSettings.gBattleTextBuff1 + 2)
combatantIndexesToTrack[target] = target
else
combatantIndexesToTrack[Battle.battler] = Battle.battler
end
end
combatantIndexesToTrack[Battle.battler] = Battle.battler
end

-- REVERSE_BATTLER: 'battlerTarget' had their ability triggered by the battler's ability
abilityMsg = GameSettings.ABILITIES.REVERSE_BATTLER[Battle.battleMsg]
if abilityMsg ~= nil and abilityMsg[battleTargetAbility] then
combatantIndexesToTrack[Battle.battlerTarget] = Battle.battlerTarget
combatantIndexesToTrack[Battle.battler] = Battle.battler
if GameSettings.ABILITIES.REVERSE_BATTLER then
abilityMsg = GameSettings.ABILITIES.REVERSE_BATTLER[Battle.battleMsg]
if abilityMsg ~= nil and abilityMsg[battleTargetAbility] then
combatantIndexesToTrack[Battle.battlerTarget] = Battle.battlerTarget
combatantIndexesToTrack[Battle.battler] = Battle.battler
end
end

-- ATTACKER: 'battleTarget' had their ability triggered
abilityMsg = GameSettings.ABILITIES.ATTACKER[Battle.battleMsg]
if abilityMsg ~= nil and abilityMsg[battleTargetAbility] then
combatantIndexesToTrack[Battle.battlerTarget] = Battle.battlerTarget
if GameSettings.ABILITIES.ATTACKER then
abilityMsg = GameSettings.ABILITIES.ATTACKER[Battle.battleMsg]
if abilityMsg ~= nil and abilityMsg[battleTargetAbility] then
combatantIndexesToTrack[Battle.battlerTarget] = Battle.battlerTarget
end
end
--Synchronize
if abilityMsg ~= nil and abilityMsg[battlerAbility] and (Battle.Synchronize.attacker == Battle.attacker and Battle.Synchronize.battlerTarget == Battle.battlerTarget and Battle.Synchronize.battler ~= Battle.battler and Battle.Synchronize.battlerTarget ~= -1) then
combatantIndexesToTrack[Battle.battler] = Battle.battler
end

-- REVERSE ATTACKER: 'attacker' had their ability triggered
abilityMsg = GameSettings.ABILITIES.REVERSE_ATTACKER[Battle.battleMsg]
if abilityMsg ~= nil and abilityMsg[attackerAbility] then
combatantIndexesToTrack[Battle.attacker] = Battle.attacker
if GameSettings.ABILITIES.REVERSE_ATTACKER then
abilityMsg = GameSettings.ABILITIES.REVERSE_ATTACKER[Battle.battleMsg]
if abilityMsg ~= nil and abilityMsg[attackerAbility] then
combatantIndexesToTrack[Battle.attacker] = Battle.attacker
end
end

abilityMsg = GameSettings.ABILITIES.STATUS_INFLICT[Battle.battleMsg]
if abilityMsg ~= nil then
-- Log allied pokemon contact status ability trigger for Synchronize
if abilityMsg[battlerAbility] and ((Battle.battler == Battle.battlerTarget) or (Battle.Synchronize.attacker == Battle.attacker and Battle.Synchronize.battlerTarget == Battle.battlerTarget and Battle.Synchronize.battler ~= Battle.battler)) then
combatantIndexesToTrack[Battle.battler] = Battle.battler
end
if abilityMsg[battleTargetAbility] then
Battle.Synchronize.turnCount = Battle.turnCount
Battle.Synchronize.battler = Battle.battler
Battle.Synchronize.attacker = Battle.attacker
Battle.Synchronize.battlerTarget = Battle.battlerTarget
if GameSettings.ABILITIES.STATUS_INFLICT then
abilityMsg = GameSettings.ABILITIES.STATUS_INFLICT[Battle.battleMsg]
if abilityMsg ~= nil then
-- Log allied pokemon contact status ability trigger for Synchronize
if abilityMsg[battlerAbility] and ((Battle.battler == Battle.battlerTarget) or (Battle.Synchronize.attacker == Battle.attacker and Battle.Synchronize.battlerTarget == Battle.battlerTarget and Battle.Synchronize.battler ~= Battle.battler)) then
combatantIndexesToTrack[Battle.battler] = Battle.battler
end
if abilityMsg[battleTargetAbility] then
Battle.Synchronize.turnCount = Battle.turnCount
Battle.Synchronize.battler = Battle.battler
Battle.Synchronize.attacker = Battle.attacker
Battle.Synchronize.battlerTarget = Battle.battlerTarget
end
end
end

abilityMsg = GameSettings.ABILITIES.BATTLE_TARGET[Battle.battleMsg]
if abilityMsg ~= nil then
if abilityMsg[battleTargetAbility] and abilityMsg.scope == "self" then
combatantIndexesToTrack[Battle.battlerTarget] = Battle.battlerTarget
end
if abilityMsg.scope == "other" and abilityMsg[attackerAbility] then
combatantIndexesToTrack[Battle.attacker] = Battle.attacker
if GameSettings.ABILITIES.BATTLE_TARGET then
abilityMsg = GameSettings.ABILITIES.BATTLE_TARGET[Battle.battleMsg]
if abilityMsg ~= nil then
if abilityMsg[battleTargetAbility] and abilityMsg.scope == "self" then
combatantIndexesToTrack[Battle.battlerTarget] = Battle.battlerTarget
end
if abilityMsg.scope == "other" and abilityMsg[attackerAbility] then
combatantIndexesToTrack[Battle.attacker] = Battle.attacker
end
end
end

Expand Down
2 changes: 1 addition & 1 deletion ironmon_tracker/Constants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ Constants.CharWidths = {
[" "] = 1,
["%"] = 7,
["0"] = 4,
["1"] = 3,
["1"] = 4,
["2"] = 4,
["3"] = 4,
["4"] = 4,
Expand Down
20 changes: 9 additions & 11 deletions ironmon_tracker/Drawing.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ function Drawing.drawText(x, y, text, color, shadowcolor, size, family, style)
y = y - 1
end

-- Need a bit more space when drawing larger characters
if GameSettings.language == "Japanese" and Utils.startsWithJapaneseChineseChar(text) then
y = y + 1
end

-- For now, don't draw shadows for smaller-than-normal text (old behavior)
if Theme.DRAW_TEXT_SHADOWS and shadowcolor ~= nil and size == nil then
gui.drawText(x + 1, y + 1, text, shadowcolor, nil, size or Constants.Font.SIZE, family or Constants.Font.FAMILY, style)
Expand All @@ -76,18 +81,11 @@ function Drawing.drawText(x, y, text, color, shadowcolor, size, family, style)
end

function Drawing.drawHeader(x, y, text, color, shadowcolor, size, family, style)
-- For some reason on Linux the text is offset by 1 pixel (tested on Bizhawk 2.9)
if Main.OS == "Linux" then
x = x + 1
y = y - 1
-- Need even more space when drawing larger characters in the header
if GameSettings.language == "Japanese" and Utils.startsWithJapaneseChineseChar(text) then
y = y + 1
end

-- For now, don't draw shadows for smaller-than-normal text (old behavior)
if Theme.DRAW_TEXT_SHADOWS and shadowcolor ~= nil and size == nil then
gui.drawText(x + 1, y + 1, text, shadowcolor, nil, size or Constants.Font.HEADERSIZE, family or Constants.Font.FAMILY, style)
end
-- void gui.drawText(x, y, message, forecolor, backcolor, fontsize, fontfamily, fontstyle, horizalign, vertalign, surfacename)
gui.drawText(x, y, text, color, nil, size or Constants.Font.HEADERSIZE, family or Constants.Font.FAMILY, style)
Drawing.drawText(x, y, text, color, shadowcolor, size or Constants.Font.HEADERSIZE, family, style)
end

function Drawing.drawNumber(x, y, number, spacing, color, shadowcolor, size, family, style)
Expand Down
1 change: 1 addition & 0 deletions ironmon_tracker/FileManager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ FileManager.Files = {
ItalyData = "ItalyData.lua",
FranceData = "FranceData.lua",
GermanyData = "GermanyData.lua",
JapanData = "JapanData.lua",
},
Other = {
REPEL = "repelUsage.png",
Expand Down
Loading