Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Commit

Permalink
Added Everest Custom Height Display Trigger.
Browse files Browse the repository at this point in the history
Fixed Core Mode and Dreaming state in chapter checkpoint settings not saving.
Fixed custom tilesets not loading when loading a file from backup.
  • Loading branch information
Cruor authored and Vexatos committed Aug 20, 2021
1 parent ed699c0 commit f62f882
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 9 deletions.
9 changes: 9 additions & 0 deletions lang/en_gb.lang
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,15 @@ placements.triggers.everest/activateDreamBlocksTrigger.tooltips.fastAnimation=Wh
placements.triggers.everest/customBirdTutorialTrigger.tooltips.birdId=Which bird the trigger should affect.
placements.triggers.everest/customBirdTutorialTrigger.tooltips.showTutorial=If ticked, the targeted bird will show its speech bubble. If unchecked, the bird will fly away.

# Custom Height Display (Everest)
placements.triggers.everest/CustomHeightDisplayTrigger.tooltips.vanilla=Whether this trigger should use the vanilla height display. The vanilla one only uses the target attribute.
placements.triggers.everest/CustomHeightDisplayTrigger.tooltips.target=The new meter count.
placements.triggers.everest/CustomHeightDisplayTrigger.tooltips.from=The previous meter count.
placements.triggers.everest/CustomHeightDisplayTrigger.tooltips.progressAudio=Whether the trigger should increment audio progress.
placements.triggers.everest/CustomHeightDisplayTrigger.tooltips.displayOnTransition=Whether the trigger should wait for a room transition to occur before displaying the counter.
placements.triggers.everest/CustomHeightDisplayTrigger.tooltips.text=The text of the counter. The meter count specified in target is substituted in for {x}.\nExample: "Currently at {x} meters".


# -- Effects --

placements.effects.tentacles.names.sides=Sides
Expand Down
4 changes: 1 addition & 3 deletions src/backups.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,7 @@ function openBackupDialog()
latestBackupFilename = getBackupFilename(side)

# The latest filename may also be in another folder, make sure we get the right folder
Ahorn.showFileOpenDialog(MenuItem(), dirname(joinpath(backupFolder, latestBackupFilename)))
Ahorn.loadedState.filename = latestFilename
Ahorn.persistence["files_lastfile"] = latestFilename
Ahorn.showFileOpenDialog(MenuItem(), dirname(joinpath(backupFolder, latestBackupFilename)), latestFilename)
end
end

Expand Down
15 changes: 13 additions & 2 deletions src/helpers/form_helper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ mutable struct DictionaryChoiceOption <: Option
end

Base.size(option::DictionaryChoiceOption) = (2, 1)
getValue(option::DictionaryChoiceOption) = typeof(option.value) === String ? Ahorn.convertString(option.as, option.value) : option.value
getValue(option::DictionaryChoiceOption) = option.value
setValue!(option::DictionaryChoiceOption, value::Any) = Ahorn.setComboIndex!(option.combobox, collect(values(option.options)), value, allowCustom=false)
getGroup(option::DictionaryChoiceOption) = 1
setGtkProperty!(option::DictionaryChoiceOption, field::Symbol, value::Any) = set_gtk_property!(option.combobox, field, value)
Expand All @@ -224,7 +224,18 @@ function addToGrid!(grid::Gtk.GtkGrid, option::DictionaryChoiceOption, col::Inte

@guarded signal_connect(option.combobox, "changed") do args...
text = Gtk.bytestring(GAccessor.active_text(option.combobox))
option.value = get(option.options, text, text)

if haskey(option.options, text)
option.value = get(option.options, text, text)

else
try
option.value = Ahorn.convertString(option.as, text)

catch
option.value = first(option.options)[2]
end
end
end
end

Expand Down
2 changes: 1 addition & 1 deletion src/triggers/activate_dream_blocks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ using ..Ahorn, Maple

const placements = Ahorn.PlacementDict(
"Activate Space Jams (Everest)" => Ahorn.EntityPlacement(
Maple.ActivateDreamBlocks,
Maple.ActivateDreamBlocksTrigger,
"rectangle"
)
)
Expand Down
12 changes: 12 additions & 0 deletions src/triggers/everest_custom_height_display.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module EverestCustomHeightDisplay

using ..Ahorn, Maple

const placements = Ahorn.PlacementDict(
"Custom Height Display (Everest)" => Ahorn.EntityPlacement(
Maple.CustomHeightDisplayTrigger,
"rectangle"
)
)

end
7 changes: 4 additions & 3 deletions src/windows/file_dialog_window.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function lastMapDir()
return targetDir
end

function showFileOpenDialog(leaf::Ahorn.MenuItemsTypes=MenuItem(), folder::String=lastMapDir())
function showFileOpenDialog(leaf::Ahorn.MenuItemsTypes=MenuItem(), folder::String=lastMapDir(), overrideFilename::Union{String, Nothing}=nothing)
@Ahorn.catchall begin
filename = openDialog("Select map binary", window, ["*.bin"], folder=folder)

Expand All @@ -23,7 +23,8 @@ function showFileOpenDialog(leaf::Ahorn.MenuItemsTypes=MenuItem(), folder::Strin
deleteDrawableRoomCache(loadedState.map)
end

loadedState.filename = filename
# Allow backups to "fake" where a file is actually stored
loadedState.filename = something(overrideFilename, filename)
loadedState.side = loadSide(filename)
loadedState.map = loadedState.side.map
loadedState.lastSavedHash = hash(loadedState.side)
Expand All @@ -32,7 +33,7 @@ function showFileOpenDialog(leaf::Ahorn.MenuItemsTypes=MenuItem(), folder::Strin

persistence["files_lastroom"] = loadedState.roomName
persistence["files_lastfile"] = loadedState.filename

packageName = loadedState.map.package

EntityIds.updateValidIds(loadedState.map)
Expand Down

0 comments on commit f62f882

Please sign in to comment.