Readarrayfromfile

From EDukeWiki
Revision as of 11:51, 8 July 2010 by CraigFatman (talk | contribs) (Created page with ''''readarrayfromfile''' <array name> <quote number> Reads a file into a gamearray; the quote contains file name. Each array element will contain 4 bytes of f...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

readarrayfromfile <array name> <quote number>

Reads a file into a gamearray; the quote contains file name. Each array element will contain 4 bytes of file content. The file is to be previously saved with writearraytofile.

Here's an example of how an array can be accessed byte-wise (in case you are using files which were not created by writearraytofile):

gamevar ofs // Byte address
gamevar idx // Array index
gamevar oct // Byte to select
gamevar ret // Value to return

setvarvar idx ofs  shiftvarr idx 2
setvarvar oct ofs  andvar oct 3 // DWORD to BYTE ptr
setvarvar ret ARRAY[idx]
ifvarand oct 2  shiftvarr ret 16
ifvarand oct 1  shiftvarr ret 8
andvar ret 255