Browse Source

Work in progress in-game menu only a start.

master
5 years ago
parent
commit
4da9877e85
2 changed files with 842 additions and 538 deletions
  1. 676
    538
      DevilMayCry4SpecialEdition.CT
  2. 166
    0
      luas/d3dmenu.lua

+ 676
- 538
DevilMayCry4SpecialEdition.CT
File diff suppressed because it is too large
View File


+ 166
- 0
luas/d3dmenu.lua View File

@@ -0,0 +1,166 @@
function init_options()
selected_option = 1 --global, access for click event and script execution
addresses = getAddressList()
local txtheight = fmap.Height
local txtstatus = "ON"
opt1 = 'Disable Camera Events (No "Screen Blink", but Some Issues in Missions)'
Option1State = addresses.getMemoryRecordByDescription(opt1).Active
if Option1State then
txtstatus = "ON"
else
txtstatus = "OFF"
end
Option1 = hook.createTextContainer(fmap, 0, 50,
"Disable Camera Events:\t\t"..txtstatus)
opt2 = 'Auto-Skip Cutscenes (Checking This Enables Everything Under This Section)'
Option2State = addresses.getMemoryRecordByDescription(opt2).Active
if Option2State then
txtstatus = "ON"
else
txtstatus = "OFF"
end
Option2 = hook.createTextContainer(fmap, 0, 50+txtheight,
"Auto-Skip Cutscenes:\t\t..txtstatus")
opt3 = 'Disable Bloody Palace Timer'
Option3State = addresses.getMemoryRecordByDescription(opt3).Active
if Option3State then
txtstatus = "ON"
else
txtstatus = "OFF"
end
Option3 = hook.createTextContainer(fmap, 0, 50+txtheight*2,
"Disable Timer:\t\t"..txtstatus)
end
function createD3Dmenu()
if background ~= nil then
bgsprite.destroy()
bgtexture.destroy()
end
background = createPicture()
bitmap = background.getBitmap()
bitmap.setHeight(1)
bitmap.setWidth(1)
canvas = bitmap.getCanvas()
canvas.setPixel(0,0, 0xffffff) --Place black pixel at the center.
bgtexture = hook.createTexture(background)
bgsprite = hook.createSprite(bgtexture)
bgsprite.Width = 200
bgsprite.Height = 200
bgsprite.X = 0 --centered horizontally
bgsprite.Alphablend = 0.5
if highlight ~= nil then
hlsprite.destroy()
hltexture.destroy()
end
highlight = createPicture()
bitmap = highlight.getBitmap()
bitmap.setHeight(1)
bitmap.setWidth(1)
canvas = bitmap.getCanvas()
canvas.setPixel(0,0, 0x003333) --Place dark blue at the center.
hltexture = hook.createTexture(highlight)
hlsprite = hook.createSprite(hltexture)
hlsprite.Visible = false --not yet
hlsprite.X = 0 --line up with background
hlsprite.Width = 200
font = createFont()
fmap = hook.createFontmap(font)
hlsprite.Height = fmap.Height
hlsprite.Visible = true
init_options()
end
function execute_selected()
local toggle = "OFF"
if (selected_option == 1) then --no switch statements in Lua
Option1State = not Option1State
addresses.getMemoryRecordByDescription(opt1).Active = Option1State
if (Option1State) then
toggle = "ON"
else
toggle = "OFF"
end
Option1.Text = "Disable Camera Events:\t\t"..toggle
elseif (selected_option == 2) then
Option2State = not Option2State
addresses.getMemoryRecordByDescription(opt2).Active = Option2State
if (Option2State) then
toggle = "ON"
else
toggle = "OFF"
end
Option2.Text = "Auto-Skip Cutscenes:\t\t"..toggle
elseif (selected_option == 3) then
Option3State = not Option2State
addresses.getMemoryRecordByDescription(opt3).Active = Option3State
if (Option3State) then
toggle = "ON"
else
toggle = "OFF"
end
Option3.Text = "Disable Timer:\t\t"..toggle
end
end
function highlight_selected()
hlsprite.Y = 50 + (fmap.Height * (selected_option - 1))
end
function option_click(object, x, y)
if (object == Option1) then
selected_option = 1
execute_selected()
elseif (object == Option2) then
selected_option = 2
execute_selected()
elseif (object == Option3) then
selected_option = 3
execute_selected()
end
highlight_selected()
end
function keypress(virtualkey, character)
--Unused. DMC4SE seems to use DINPUT8 which this functionality is incompatible with.
if (virtualkey == VK_DOWN) and (selected_option < 3) then
selected_option = selected_option + 1 --AFAIK no '++' or '--' operators in Lua
end
if (virtualkey == VK_UP) and (selected_option > 1) then
selected_option = selected_option - 1 --No += operator either. Eh.
end
if (virtualkey == VK_RETURN) then
execute_option()
end
highlight_selected()
return false --Do not pass input to the game.
end
function toggle_display()
bgsprite.Visible = not bgsprite.Visible
hlsprite.Visible = not hlsprite.Visible
Option1.Visible = not Option1.Visible
Option2.Visible = not Option2.Visible
Option3.Visible = not Option3.Visible
end
function destroyD3Dmenu()
--Clean up... everything.
bgsprite.destroy()
bgtexture.destroy()
hlsprite.destroy()
hltexture.destroy()
background.destroy()
highlight.destroy()
bitmap.destroy()
Option1.destroy()
Option2.destroy()
Option3.destroy()
fmap.destroy()
font.destroy()
canvas.destroy()
end

Loading…
Cancel
Save