jargon

Dungeon Keymap.bas

Feb 14th, 2021
693
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. sub load_keymap(prefix as string, ext as string, fn as integer, keymap() as keymap_type)
  2.  
  3.     dim as integer filemode=freefile, e=0,i=0,k=0
  4.    
  5.     e=open(data_path+tiles_path+prefix+nconcat(fn,3)+ext for input as #filemode)
  6.    
  7.     if not(e=0) then exit sub
  8.    
  9.     #ifdef __TILE_DEBUG__
  10.            
  11.         sx_keywait _
  12.         ckey, _
  13.         "KEYMAP:" _
  14.             +quot _
  15.             +nconcat(fn,3) _
  16.             +".CFG" _
  17.             +quot, _
  18.         15,9,1,0,0,,,,sx_placeholder()
  19.  
  20.     #endif
  21.  
  22.     i=0
  23.     do while not(eof(filemode))
  24.        
  25.         if ubound(keymap,0)=0 then
  26.             redim preserve keymap(0 to 0)      
  27.         else
  28.             redim preserve keymap(lbound(keymap,1) to i)
  29.         end if
  30.  
  31.         input #filemode,keymap(i).key
  32.        
  33.         redim preserve (keymap(i).instruct)(0 to 1)
  34.        
  35.         for k = 0 to 1
  36.             input #filemode, keymap(i).instruct(k)
  37.         next k
  38.        
  39.         i+=1
  40.     loop
  41.    
  42.     #ifdef __TILE_DEBUG__
  43.  
  44.         for i = lbound(keymap,1) to ubound(keymap,1) step 1
  45.        
  46.             ''color 15,0
  47.             ''print "| #";i;":";chr(34);keymap(i).key;chr(34);":";
  48.            
  49.             sx_keywait _
  50.                 ckey, _
  51.                 "| #" _
  52.                     +nconcat(i,3) _
  53.                 +":" _
  54.                     +quot _
  55.                         +keymap(i).key _
  56.                     +quot _
  57.                 +":", _
  58.                 15,9,1,0,0,,,,sx_placeholder()
  59.  
  60.             for k=0 to 1           
  61.                
  62.                 if k>lbound(keymap(i).instruct,1) then
  63.                     print ",";
  64.                 end if
  65.            
  66.                 print keymap(i).instruct(k);
  67.                
  68.             next k
  69.            
  70.             print
  71.            
  72.         next i
  73.  
  74.     #endif
  75.  
  76.     #ifdef __TILE_DEBUG__
  77.        
  78.         ''pcopy 1,0
  79.         sx_keywait ckey,"",15,9,,0.2,,,,,sx_placeholder()
  80.        
  81.     #endif
  82.    
  83.     close #filemode
  84.  
  85. end sub
  86.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×