mirror of
https://github.com/libretro/gw-libretro.git
synced 2024-11-27 01:41:08 +00:00
Updated Dungeons and Dragons to support mouse and touches
This commit is contained in:
parent
70c45d50c7
commit
73f4b205ff
@ -1,40 +1,8 @@
|
||||
local unit1 = system.loadunit 'unit1'
|
||||
local forms = system.loadunit 'forms'
|
||||
local controls = system.loadunit 'controls'
|
||||
|
||||
local keymap = {
|
||||
up = { forms.vk_up, 'Up' },
|
||||
down = { forms.vk_down, 'Down' },
|
||||
left = { forms.vk_left, 'Left' },
|
||||
right = { forms.vk_right, 'Right' },
|
||||
b = { forms.vk_shift, 'Rotate' },
|
||||
a = { forms.vk_control, 'Attack' },
|
||||
x = { forms.vk_menu, 'Move' },
|
||||
l1 = { 53, 'ACL' }
|
||||
}
|
||||
|
||||
local menu = {
|
||||
{ unit1.form1.btn_acl_down, 'ACL', 53 }
|
||||
}
|
||||
|
||||
local timers = {
|
||||
unit1.form1.timer_bat_moves,
|
||||
unit1.form1.timer_bat_warrior_move,
|
||||
unit1.form1.timer_blinking,
|
||||
unit1.form1.timer_demo_mode,
|
||||
unit1.form1.timer_found_arrow_hook,
|
||||
unit1.form1.timer_found_dragon,
|
||||
unit1.form1.timer_game_over_lose,
|
||||
unit1.form1.timer_game_over_win,
|
||||
unit1.form1.timer_game_start,
|
||||
unit1.form1.timer_move_to_arrow,
|
||||
unit1.form1.timer_move_to_bat,
|
||||
unit1.form1.timer_move_to_dragon,
|
||||
unit1.form1.timer_move_to_free,
|
||||
unit1.form1.timer_move_to_hook,
|
||||
unit1.form1.timer_move_to_pit,
|
||||
unit1.form1.timer_score,
|
||||
unit1.form1.timer_shoot_arrow
|
||||
}
|
||||
unit1.form1.oncreate()
|
||||
|
||||
unit1.pfarrow.data = system.loadbin( 'Arrow.pcm' )
|
||||
unit1.pfbat.data = system.loadbin( 'Bat.pcm' )
|
||||
@ -48,18 +16,94 @@ unit1.pfstep.data = system.loadbin( 'Step.pcm' )
|
||||
unit1.pfstepbat.data = system.loadbin( 'Step_bat.pcm' )
|
||||
unit1.pfwin.data = system.loadbin( 'Win.pcm' )
|
||||
|
||||
unit1.form1.oncreate()
|
||||
|
||||
unit1.bsound = true
|
||||
unit1.imode = 1
|
||||
unit1.form1.gam_set_mode()
|
||||
|
||||
return system.init(
|
||||
unit1.form1.im_background,
|
||||
keymap,
|
||||
function( key ) unit1.form1.onkeydown( nil, key, 0 ) end,
|
||||
function( key ) unit1.form1.onkeyup( nil, key, 0 ) end,
|
||||
timers,
|
||||
{ 73, 66, 207, 143 },
|
||||
menu
|
||||
)
|
||||
local zoom = { left = 73, top = 66, width = 207, height = 143 }
|
||||
local cursor, right = system.splith( zoom )
|
||||
local attack, move = system.splitv( right )
|
||||
|
||||
return system.init{
|
||||
background = unit1.form1.im_background,
|
||||
zoom = zoom,
|
||||
|
||||
controls = {
|
||||
{
|
||||
button = unit1.form1.btn_acl_top,
|
||||
label = 'ACL'
|
||||
},
|
||||
{
|
||||
button = unit1.form1.btn_cursor_top,
|
||||
zone = cursor,
|
||||
label = 'Cursor',
|
||||
lbl_dy = 32,
|
||||
keys = { b = true },
|
||||
xkeys = { forms.vk_shift }
|
||||
},
|
||||
{
|
||||
button = unit1.form1.btn_attack_top,
|
||||
zone = attack,
|
||||
label = 'Attack',
|
||||
keys = { a = true },
|
||||
xkeys = { forms.vk_control }
|
||||
},
|
||||
{
|
||||
button = unit1.form1.btn_move_top,
|
||||
zone = move,
|
||||
label = 'Move',
|
||||
keys = { x = true },
|
||||
xkeys = { forms.vk_menu }
|
||||
},
|
||||
{
|
||||
label = 'Up',
|
||||
keys = { up = true },
|
||||
xkeys = { forms.vk_up }
|
||||
},
|
||||
{
|
||||
label = 'Down',
|
||||
keys = { down = true },
|
||||
xkeys = { forms.vk_down }
|
||||
},
|
||||
{
|
||||
label = 'Left',
|
||||
keys = { left = true },
|
||||
xkeys = { forms.vk_left }
|
||||
},
|
||||
{
|
||||
label = 'Right',
|
||||
keys = { right = true },
|
||||
xkeys = { forms.vk_right }
|
||||
}
|
||||
},
|
||||
|
||||
timers = {
|
||||
unit1.form1.timer_bat_moves,
|
||||
unit1.form1.timer_bat_warrior_move,
|
||||
unit1.form1.timer_blinking,
|
||||
unit1.form1.timer_demo_mode,
|
||||
unit1.form1.timer_found_arrow_hook,
|
||||
unit1.form1.timer_found_dragon,
|
||||
unit1.form1.timer_game_over_lose,
|
||||
unit1.form1.timer_game_over_win,
|
||||
unit1.form1.timer_game_start,
|
||||
unit1.form1.timer_move_to_arrow,
|
||||
unit1.form1.timer_move_to_bat,
|
||||
unit1.form1.timer_move_to_dragon,
|
||||
unit1.form1.timer_move_to_free,
|
||||
unit1.form1.timer_move_to_hook,
|
||||
unit1.form1.timer_move_to_pit,
|
||||
unit1.form1.timer_score,
|
||||
unit1.form1.timer_shoot_arrow
|
||||
},
|
||||
|
||||
onkey = function( key, pressed )
|
||||
local handler = pressed and unit1.form1.onkeydown or unit1.form1.onkeyup
|
||||
handler( nil, key, 0 )
|
||||
end,
|
||||
|
||||
onbutton = function( button, pressed )
|
||||
local handler = pressed and button.onmousedown or button.onmouseup
|
||||
handler( nil, controls.mbleft, false, 0, 0 )
|
||||
end
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user