📄 datafile.inc
字号:
{* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Datafile access routines.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*}
{$IFDEF ALLEGRO_INTERFACE}
const
DAT_MAGIC = (ord ('A') shl 24) + (ord ('L') shl 16) + (ord ('L') shl 8) + ord ('.');
DAT_FILE = (ord ('F') shl 24) + (ord ('I') shl 16) + (ord ('L') shl 8) + ord ('E');
DAT_DATA = (ord ('D') shl 24) + (ord ('A') shl 16) + (ord ('T') shl 8) + ord ('A');
DAT_FONT = (ord ('F') shl 24) + (ord ('O') shl 16) + (ord ('N') shl 8) + ord ('T');
DAT_SAMPLE = (ord ('S') shl 24) + (ord ('A') shl 16) + (ord ('M') shl 8) + ord ('P');
DAT_MIDI = (ord ('M') shl 24) + (ord ('I') shl 16) + (ord ('D') shl 8) + ord ('I');
DAT_PATCH = (ord ('P') shl 24) + (ord ('A') shl 16) + (ord ('T') shl 8) + ord (' ');
DAT_FLI = (ord ('F') shl 24) + (ord ('L') shl 16) + (ord ('I') shl 8) + ord ('C');
DAT_BITMAP = (ord ('B') shl 24) + (ord ('M') shl 16) + (ord ('P') shl 8) + ord (' ');
DAT_RLE_SPRITE = (ord ('R') shl 24) + (ord ('L') shl 16) + (ord ('E') shl 8) + ord (' ');
DAT_C_SPRITE = (ord ('C') shl 24) + (ord ('M') shl 16) + (ord ('P') shl 8) + ord (' ');
DAT_XC_SPRITE = (ord ('X') shl 24) + (ord ('C') shl 16) + (ord ('M') shl 8) + ord ('P');
DAT_PALETTE = (ord ('P') shl 24) + (ord ('A') shl 16) + (ord ('L') shl 8) + ord (' ');
DAT_PROPERTY = (ord ('p') shl 24) + (ord ('r') shl 16) + (ord ('o') shl 8) + ord ('p');
DAT_NAME = (ord ('N') shl 24) + (ord ('A') shl 16) + (ord ('M') shl 8) + ord ('E');
DAT_END = -1;
type
P_DATAFILE_PROPERTY = ^DATAFILE_PROPERTY;
DATAFILE_PROPERTY = record
dat : p_uint8s; // pointer to the data
types : sint32; // property type
end;
P_DATAFILE = ^DATAFILE;
DATAFILE = record
dat : Pointer; // // pointer to the data
types : sint32; // object type
size : sint32; // size of the object
prop : P_DATAFILE_PROPERTY; // object properties
end;
load_datafile_ptr = procedure(dat: P_DATAFILE); cdecl;
reg_load_ptr = function(f: P_PACKFILE; size: sint32): Pointer; cdecl;
reg_destroy_ptr = procedure(data: Pointer); cdecl;
load_bitmap_ptr = function(const filename: PChar; pal: P_PALETTE): P_BITMAP; cdecl;
save_bitmap_ptr = function(const filename: PChar; bmp: P_BITMAP; const pal: P_PALETTE): sint32; cdecl;
var
load_datafile: function(const filename: PChar): P_DATAFILE; cdecl;
load_datafile_callback: function(const filename: PChar; callback: load_datafile_ptr): P_DATAFILE; cdecl;
unload_datafile: procedure(dat: P_DATAFILE); cdecl;
load_datafile_object: function(const filename, objectname: PChar): P_DATAFILE; cdecl;
unload_datafile_object: procedure(dat: P_DATAFILE); cdecl;
find_datafile_object: function(const dat: P_DATAFILE; const objectname: PChar): P_DATAFILE; cdecl;
get_datafile_property: function(const dat: P_DATAFILE; types: sint32): PChar; cdecl;
register_datafile_object: procedure(id: sint32; load: reg_load_ptr; destroy: reg_destroy_ptr); cdecl;
fixup_datafile: procedure(dat: P_DATAFILE); cdecl;
load_bitmap: function(const filename: PChar; pal: P_PALETTE): P_BITMAP; cdecl;
load_bmp: function(const filename: PChar; pal: P_PALETTE): P_BITMAP; cdecl;
load_bmp_pf: function(f: P_PACKFILE; pal: P_PALETTE): P_BITMAP; cdecl;
load_lbm: function(const filename: PChar; pal: P_PALETTE): P_BITMAP; cdecl;
load_pcx: function(const filename: PChar; pal: P_PALETTE): P_BITMAP; cdecl;
load_pcx_pf: function(f: P_PACKFILE; pal: P_PALETTE): P_BITMAP; cdecl;
load_tga: function(const filename: PChar; pal: P_PALETTE): P_BITMAP; cdecl;
load_tga_pf: function(f: P_PACKFILE; pal: P_PALETTE): P_BITMAP; cdecl;
save_bitmap: function(const filename: PChar; bmp: P_BITMAP; const pal: P_PALETTE): sint32; cdecl;
save_bmp: function(const filename: PChar; bmp: P_BITMAP; const pal: P_PALETTE): sint32; cdecl;
save_bmp_pf: function(f: P_PACKFILE; bmp: P_BITMAP; const pal: P_PALETTE): sint32; cdecl;
save_pcx: function(const filename: PChar; bmp: P_BITMAP; const pal: P_PALETTE): sint32; cdecl;
save_pcx_pf: function(f: P_PACKFILE; bmp: P_BITMAP; const pal: P_PALETTE): sint32; cdecl;
save_tga: function(const filename: PChar; bmp: P_BITMAP; const pal: P_PALETTE): sint32; cdecl;
save_tga_pf: function(f: P_PACKFILE; bmp: P_BITMAP; const pal: P_PALETTE): sint32; cdecl;
register_bitmap_file_type: procedure(const ext: PChar; load: load_bitmap_ptr; save: save_bitmap_ptr); cdecl;
{$ENDIF ALLEGRO_INTERFACE}
{$IFDEF ALLEGRO_IMPLEMENTATION}
{$ENDIF ALLEGRO_IMPLEMENTATION}
{$IFDEF ALLEGRO_LOADVARIABLE}
load_datafile := LoadDLL('load_datafile');
load_datafile_callback := LoadDLL('load_datafile_callback');
unload_datafile := LoadDLL('unload_datafile');
load_datafile_object := LoadDLL('load_datafile_object');
unload_datafile_object := LoadDLL('unload_datafile_object');
find_datafile_object := LoadDLL('find_datafile_object');
get_datafile_property := LoadDLL('get_datafile_property');
register_datafile_object := LoadDLL('register_datafile_object');
fixup_datafile := LoadDLL('fixup_datafile');
load_bitmap := LoadDLL('load_bitmap');
load_bmp := LoadDLL('load_bmp');
load_bmp_pf := LoadDLL('load_bmp_pf');
load_lbm := LoadDLL('load_lbm');
load_pcx := LoadDLL('load_pcx');
load_pcx_pf := LoadDLL('load_pcx_pf');
load_tga := LoadDLL('load_tga');
load_tga_pf := LoadDLL('load_tga_pf');
save_bitmap := LoadDLL('save_bitmap');
save_bmp := LoadDLL('save_bmp');
save_bmp_pf := LoadDLL('save_bmp_pf');
save_pcx := LoadDLL('save_pcx');
save_pcx_pf := LoadDLL('save_pcx_pf');
save_tga := LoadDLL('save_tga');
save_tga_pf := LoadDLL('save_tga_pf');
register_bitmap_file_type := LoadDLL('register_bitmap_file_type');
{$ENDIF ALLEGRO_LOADVARIABLE}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -