Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sub load_keymap(prefix as string, ext as string, fn as integer, keymap() as keymap_type)
- dim as integer filemode=freefile, e=0,i=0,k=0
- e=open(data_path+tiles_path+prefix+nconcat(fn,3)+ext for input as #filemode)
- if not(e=0) then exit sub
- #ifdef __TILE_DEBUG__
- sx_keywait _
- ckey, _
- "KEYMAP:" _
- +quot _
- +nconcat(fn,3) _
- +".CFG" _
- +quot, _
- 15,9,1,0,0,,,,sx_placeholder()
- #endif
- i=0
- do while not(eof(filemode))
- if ubound(keymap,0)=0 then
- redim preserve keymap(0 to 0)
- else
- redim preserve keymap(lbound(keymap,1) to i)
- end if
- input #filemode,keymap(i).key
- redim preserve (keymap(i).instruct)(0 to 1)
- for k = 0 to 1
- input #filemode, keymap(i).instruct(k)
- next k
- i+=1
- loop
- #ifdef __TILE_DEBUG__
- for i = lbound(keymap,1) to ubound(keymap,1) step 1
- ''color 15,0
- ''print "| #";i;":";chr(34);keymap(i).key;chr(34);":";
- sx_keywait _
- ckey, _
- "| #" _
- +nconcat(i,3) _
- +":" _
- +quot _
- +keymap(i).key _
- +quot _
- +":", _
- 15,9,1,0,0,,,,sx_placeholder()
- for k=0 to 1
- if k>lbound(keymap(i).instruct,1) then
- print ",";
- end if
- print keymap(i).instruct(k);
- next k
- print
- next i
- #endif
- #ifdef __TILE_DEBUG__
- ''pcopy 1,0
- sx_keywait ckey,"",15,9,,0.2,,,,,sx_placeholder()
- #endif
- close #filemode
- end sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement