Skip to content

Commit

Permalink
Fix various small issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Garanas committed Dec 1, 2024
1 parent 8b3b7d9 commit 47763eb
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 30 deletions.
28 changes: 16 additions & 12 deletions lua/keymap/keyactions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1960,16 +1960,20 @@ local keyActionsCinematics = {
action = 'UI_Lua import("/lua/ui/game/cinematics/moveto.lua").Append(true)',
category = 'cinematics',
},
['cinematics_move_to_insert'] = {
action = 'UI_Lua import("/lua/ui/game/cinematics/moveto.lua").Insert(true)',
['cinematics_move_to_remove'] = {
action = 'UI_Lua import("/lua/ui/game/cinematics/moveto.lua").RemoveLast(true)',
category = 'cinematics',
},
['cinematics_move_to_overwrite'] = {
action = 'UI_Lua import("/lua/ui/game/cinematics/moveto.lua").Overwrite(true)',
['cinematics_move_to_insert_at_index'] = {
action = 'UI_Lua import("/lua/ui/game/cinematics/moveto.lua").InsertAfterIndex(true)',
category = 'cinematics',
},
['cinematics_move_to_remove'] = {
action = 'UI_Lua import("/lua/ui/game/cinematics/moveto.lua").Remove(true)',
['cinematics_move_to_overwrite_at_index'] = {
action = 'UI_Lua import("/lua/ui/game/cinematics/moveto.lua").OverwriteAtIndex(true)',
category = 'cinematics',
},
['cinematics_move_to_remove_at_index'] = {
action = 'UI_Lua import("/lua/ui/game/cinematics/moveto.lua").RemoveAtIndex(true)',
category = 'cinematics',
},

Expand Down Expand Up @@ -2008,27 +2012,27 @@ local keyActionsCinematics = {

-- Preference file interactions
['cinematics_move_to_store_01'] = {
action = 'UI_Lua import("/lua/ui/game/cinematics/moveto.lua").StoreToDisk("01")',
action = 'UI_Lua import("/lua/ui/game/cinematics/moveto.lua").StoreToDisk("01", true)',
category = 'cinematics',
},
['cinematics_move_to_store_02'] = {
action = 'UI_Lua import("/lua/ui/game/cinematics/moveto.lua").StoreToDisk("02")',
action = 'UI_Lua import("/lua/ui/game/cinematics/moveto.lua").StoreToDisk("02", true)',
category = 'cinematics',
},
['cinematics_move_to_store_03'] = {
action = 'UI_Lua import("/lua/ui/game/cinematics/moveto.lua").StoreToDisk("03")',
action = 'UI_Lua import("/lua/ui/game/cinematics/moveto.lua").StoreToDisk("03", true)',
category = 'cinematics',
},
['cinematics_move_to_retrieve_01'] = {
action = 'UI_Lua import("/lua/ui/game/cinematics/moveto.lua").RetrieveFromDisk("01")',
action = 'UI_Lua import("/lua/ui/game/cinematics/moveto.lua").RetrieveFromDisk("01", true)',
category = 'cinematics',
},
['cinematics_move_to_retrieve_02'] = {
action = 'UI_Lua import("/lua/ui/game/cinematics/moveto.lua").RetrieveFromDisk("02")',
action = 'UI_Lua import("/lua/ui/game/cinematics/moveto.lua").RetrieveFromDisk("02", true)',
category = 'cinematics',
},
['cinematics_move_to_retrieve_03'] = {
action = 'UI_Lua import("/lua/ui/game/cinematics/moveto.lua").RetrieveFromDisk("03")',
action = 'UI_Lua import("/lua/ui/game/cinematics/moveto.lua").RetrieveFromDisk("03", true)',
category = 'cinematics',
}
}
Expand Down
15 changes: 8 additions & 7 deletions lua/keymap/keydescriptions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -561,29 +561,30 @@ keyDescriptions = {
['select_surface_bombers'] = '<LOC key_desc_0407>Select all Bombers (Normal)',
['select_torpedo_bombers'] = '<LOC key_desc_0408>Select all Bombers (Torpedo)',

-- CRUD-like operations
['cinematics_bind_keys'] = '<LOC key_desc_cinematics_bind_keys>Apply default key layout for cinematics. Applies until the game is restarted',

--#region MoveTo
['cinematics_move_to_clear'] = '<LOC key_desc_cinematics_move_to_clear>MoveTo - Clear sequence',
['cinematics_move_to_add'] = '<LOC key_desc_cinematics_move_to_add>MoveTo - Append current camera position to the sequence',
['cinematics_move_to_insert'] = '<LOC key_desc_cinematics_move_to_insert>MoveTo - Insert current camera position after the current index of the sequence',
['cinematics_move_to_overwrite'] = '<LOC key_desc_cinematics_move_to_overwrite>MoveTo - Overwrite with current camera position at the current index of the sequence',
['cinematics_move_to_remove'] = '<LOC key_desc_cinematics_move_to_remove>MoveTo - Remove camera position at the current index of the sequence',
['cinematics_move_to_remove'] = '<LOC key_desc_cinematics_move_to_remove>MoveTo - Remove the last camera position from sequence',
['cinematics_move_to_insert_at_index'] = '<LOC key_desc_cinematics_move_to_insert_at_index>MoveTo - Insert current camera position at the current index of the sequence. Shifts the existing camera positions to the right.',
['cinematics_move_to_overwrite_at_index'] = '<LOC key_desc_cinematics_move_to_overwrite_at_index>MoveTo - Overwrite with current camera position at the current index of the sequence',
['cinematics_move_to_remove_at_index'] = '<LOC key_desc_cinematics_move_to_remove_at_index>MoveTo - Remove camera position at the current index of the sequence',

-- Navigation
['cinematics_move_to_jump_current'] = '<LOC key_desc_cinematics_move_to_jump_current>MoveTo - Jump to the camera position at the current index of the sequence',
['cinematics_move_to_jump_forward'] = '<LOC key_desc_cinematics_move_to_jump_forward>MoveTo - Jump to the next camera position in the sequence',
['cinematics_move_to_jump_backward'] = '<LOC key_desc_cinematics_move_to_jump_backward>MoveTo - Jump to the previous camera position in the sequence',

-- Animation
['cinematics_move_to_animate_forward'] = '<LOC key_desc_cinematics_move_to_animate_forward>MoveTo - Animate to the next camera position in the sequence',
['cinematics_move_to_animate_backward'] = '<LOC key_desc_cinematics_move_to_animate_backward>MoveTo - Animate to the previous camera position in the sequence',
['cinematics_move_to_jump_and_animate_forward'] = '<LOC key_desc_cinematics_move_to_jump_and_animate_forward>MoveTo - Jump to the next camera position, then animate to the one after',
['cinematics_move_to_jump_and_animate_backward'] = '<LOC key_desc_cinematics_move_to_jump_and_animate_backward>MoveTo - Jump to the previous camera position, then animate to the one before',

-- Preference file interactions
['cinematics_move_to_store_01'] = '<LOC key_desc_cinematics_move_to_store_01>MoveTo - Save the 1st MoveTo sequence to the preference file',
['cinematics_move_to_store_02'] = '<LOC key_desc_cinematics_move_to_store_02>MoveTo - Save the 2nd MoveTo sequence to the preference file',
['cinematics_move_to_store_03'] = '<LOC key_desc_cinematics_move_to_store_03>MoveTo - Save the 3rd MoveTo sequence to the preference file',
['cinematics_move_to_retrieve_01'] = '<LOC key_desc_cinematics_move_to_retrieve_01>MoveTo - Load the 1st MoveTo sequence from the preference file',
['cinematics_move_to_retrieve_02'] = '<LOC key_desc_cinematics_move_to_retrieve_02>MoveTo - Load the 2nd MoveTo sequence from the preference file',
['cinematics_move_to_retrieve_03'] = '<LOC key_desc_cinematics_move_to_retrieve_03>MoveTo - Load the 3rd MoveTo sequence from the preference file',
--#endregion
}
9 changes: 6 additions & 3 deletions lua/ui/game/cinematics/Config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ local function DefaultMoveToLayout()

-- add, insert, overwrite and remove camera orientations
['A'] = keyActions.cinematics_move_to_add,
['S'] = keyActions.cinematics_move_to_insert,
['D'] = keyActions.cinematics_move_to_overwrite,
['DELETE'] = keyActions.cinematics_move_to_remove,
['S'] = keyActions.cinematics_move_to_insert_at_index,
['D'] = keyActions.cinematics_move_to_overwrite_at_index,
['BACKSPACE'] = keyActions.cinematics_move_to_remove,
['DELETE'] = keyActions.cinematics_move_to_remove_at_index,

-- animation
['Shift-Q'] = keyActions.cinematics_move_to_animate_forward,
Expand Down Expand Up @@ -71,4 +72,6 @@ function ApplyDefaultKeyLayout()
-- apply the keys
IN_ClearKeyMap()
IN_AddKeyMapTable(combinedKeyMap)

print("Applied hotkeys for cinematics")
end
34 changes: 26 additions & 8 deletions lua/ui/game/cinematics/MoveTo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ RetrieveFromDisk = function(key, doPrint)
-- inform user
if doPrint then
print("MoveTo - Loaded sequence for MoveTo to key '" ..
stringifiedKey .. "' (" .. table.getn(Sequence) .. " steps)")
stringifiedKey .. "' (" .. table.getn(Sequence) .. " steps)")
end
end

Expand All @@ -118,9 +118,9 @@ Append = function(doPrint)
end
end

--- Inserts a camera position at the specified index.
--- Inserts a camera position at the specified index, pushing back the other camera positions.
---@param doPrint? boolean
Insert = function(doPrint)
InsertAfterIndex = function(doPrint)
local sequenceCount = table.getn(Sequence)
if sequenceCount == 0 then
SequenceIndex = 1
Expand All @@ -129,16 +129,16 @@ Insert = function(doPrint)
end

local camera = GetCamera(DefaultCamera)
table.insert(camera, SequenceIndex + 1, camera:SaveSettings())
table.insert(Sequence, SequenceIndex, camera:SaveSettings())

if doPrint then
print("MoveTo - Insert into sequence at index " .. SequenceIndex .. " (" .. sequenceCount .. " steps)")
print("MoveTo - Insert into sequence at index " .. SequenceIndex .. " (" .. (sequenceCount + 1) .. " steps)")
end
end

--- Overwrites the camera position at the specified index.
---@param doPrint? boolean
Overwrite = function(doPrint)
OverwriteAtIndex = function(doPrint)
local sequenceCount = table.getn(Sequence)
if sequenceCount == 0 then
SequenceIndex = 1
Expand All @@ -158,7 +158,8 @@ end

--- Removes the current camera position.
---@param doPrint? boolean
Remove = function(doPrint)
---@return nil
RemoveAtIndex = function(doPrint)
local sequenceCount = table.getn(Sequence)
if sequenceCount == 0 then
print("No camera sequence defined")
Expand All @@ -168,7 +169,24 @@ Remove = function(doPrint)
table.remove(Sequence, SequenceIndex)

if doPrint then
print("MoveTo - Removed sequence " .. SequenceIndex .. " (" .. sequenceCount .. " steps)")
print("MoveTo - Removed at " .. SequenceIndex .. " (" .. (sequenceCount - 1).. " steps)")
end
end

--- Removes the last camera position.
---@param doPrint doPrint? boolean
---@return nil
RemoveLast = function(doPrint)
local sequenceCount = table.getn(Sequence)
if sequenceCount == 0 then
print("No camera sequence defined")
return nil
end

table.remove(Sequence)

if doPrint then
print("MoveTo - Removed last (" .. (sequenceCount - 1) .. " steps)")
end
end

Expand Down

0 comments on commit 47763eb

Please sign in to comment.