123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467 |
- //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
- //ÛÛ ÛÛ
- //ÛÛ VFX.H: C type definitions & API function prototypes ÛÛ
- //ÛÛ ÛÛ
- //ÛÛ Source compatible with 32-bit 80386 C/C++ ÛÛ
- //ÛÛ ÛÛ
- //ÛÛ V0.10 of 10-Dec-92: Initial version ÛÛ
- //ÛÛ V1.01 of 12-May-93: Added VFX_shape_lookaside(), new polygon calls ÛÛ
- //ÛÛ PCX_draw() returns void ÛÛ
- //ÛÛ V1.02 of 18-Jun-93: Added rotation/scaling calls ÛÛ
- //ÛÛ intervals parameter added to window_fade() ÛÛ
- //ÛÛ Added VFX_RECT structure ÛÛ
- //ÛÛ V1.03 of 28-Jul-93: VERTEX2D structure changed to SCRNVERTEX ÛÛ
- //ÛÛ Fixed-VFX_POINT data types renamed ÛÛ
- //ÛÛ Added VFX_bank_reset() call ÛÛ
- //ÛÛ V1.04 of 4-Sep-93: Indirect function prototypes changed for C++ use ÛÛ
- //ÛÛ V1.05 of 26-Sep-93: Added FLOAT typedef ÛÛ
- //ÛÛ VFX_RGB BYTE members changed to UBYTEs ÛÛ
- //ÛÛ V1.06 of 13-Oct-93: Added VFX_pane_refresh(), other new calls ÛÛ
- //ÛÛ V1.07 of 17-Nov-93: Added MetaWare High C support ÛÛ
- //ÛÛ V1.10 of 3-Dec-93: Modified VFX_pane_refresh(), WINDOW structure ÛÛ
- //ÛÛ V1.15 of 13-Mar-94: Added new VFX.C function prototypes ÛÛ
- //ÛÛ Added new WINDOW members, PANE_LIST structure ÛÛ
- //ÛÛ ÛÛ
- //ÛÛ Project: 386FX Sound & Light(TM) ÛÛ
- //ÛÛ Author: Ken Arnold, John Miles, John Lemberger ÛÛ
- //ÛÛ ÛÛ
- //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
- //ÛÛ ÛÛ
- //ÛÛ Copyright (C) 1992-1994 Non-Linear Arts, Inc. ÛÛ
- //ÛÛ ÛÛ
- //ÛÛ Non-Linear Arts, Inc. ÛÛ
- //ÛÛ 3415 Greystone #200 ÛÛ
- //ÛÛ Austin, TX 78731 ÛÛ
- //ÛÛ ÛÛ
- //ÛÛ (512) 346-9595 / FAX (512) 346-9596 / BBS (512) 454-9990 ÛÛ
- //ÛÛ ÛÛ
- //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
- #ifndef VFX_H
- #define VFX_H
- #ifndef TRUE
- #define TRUE -1
- #endif
- #ifndef FALSE
- #define FALSE 0
- #endif
- #define SHAPE_FILE_VERSION '01.1' // 1.10 backwards for big-endian compare
- //
- // MetaWare support
- //
- #ifdef __HIGHC__
- #define _CC(_REVERSE_PARMS | _NEAR_CALL)
- #pragma Global_aliasing_convention("_%r");
- #pragma Align_members(1)
- #endif
- #ifdef __cplusplus
- extern "C" {
- #endif
- #ifdef WIN32
- #pragma pack(1)
- #endif
- #ifndef TYPEDEFS1
- #define TYPEDEFS1
- typedef unsigned char UBYTE;
- typedef unsigned short UWORD;
- typedef unsigned long ULONG;
- typedef unsigned char BYTE;
- #ifndef WIN32
- typedef unsigned WORD;
- #endif
- typedef signed long LONG;
- typedef float FLOAT;
- typedef signed long FIXED16; // 16:16 fixed-VFX_POINT type [-32K,+32K]
- typedef signed long FIXED30; // 2:30 fixed-VFX_POINT type [-1.999,+1.999]
- #endif
- #define GIF_SCRATCH_SIZE 20526L // Temp memory req'd for GIF decompression
- #define S_BLACK 264
- //
- // VFX_map_polygon() flags
- //
- #define MP_XLAT 0x0001 // Use lookaside table (speed loss = ~9%)
- #define MP_XP 0x0002 // Enable transparency (speed loss = ~6%)
- //
- // VFX_shape_transform() flags
- //
- #define ST_XLAT 0x0001 // Use shape_lookaside() table
- #define ST_REUSE 0x0002 // Use buffer contents from prior call
- //
- // VFX_line_draw() modes
- //
- #define LD_DRAW 0
- #define LD_TRANSLATE 1
- #define LD_EXECUTE 2
- //
- // VFX_pane_scroll() modes
- //
- #define PS_NOWRAP 0
- #define PS_WRAP 1
- #define NO_COLOR -1
- //
- // VFX_shape_visible_rectangle() mirror values
- //
- #define VR_NO_MIRROR 0
- #define VR_X_MIRROR 1
- #define VR_Y_MIRROR 2
- #define VR_XY_MIRROR 3
- //
- // PANE_LIST.flags values
- //
- #define PL_FREE 0 // Free and available for assignment
- #define PL_VALID 1 // Assigned; to be refreshed
- #define PL_CONTAINED 2 // Contained within another pane; don't refresh
- //
- // VFX data structures
- //
- typedef unsigned char STENCIL;
- typedef struct _window
- {
- UBYTE *buffer;
- LONG x_max;
- LONG y_max;
- STENCIL *stencil;
- UBYTE *shadow;
- }
- WINDOW;
- typedef struct _pane
- {
- WINDOW *window;
- LONG x0;
- LONG y0;
- LONG x1;
- LONG y1;
- }
- PANE;
- typedef struct _pane_list
- {
- PANE *array;
- ULONG *flags;
- LONG size;
- }
- PANE_LIST;
- typedef union
- {
- void *v;
- UBYTE *b;
- UWORD *w;
- ULONG *d;
- }
- FLEX_PTR;
- typedef struct
- {
- LONG scrn_width;
- LONG scrn_height;
- LONG bytes_per_pixel;
- LONG ncolors;
- LONG npages;
- ULONG flags;
- }
- VFX_DESC;
- typedef struct
- {
- UBYTE r;
- UBYTE g;
- UBYTE b;
- }
- VFX_RGB;
- typedef struct
- {
- UBYTE color;
- VFX_RGB VFX_RGB;
- }
- VFX_CRGB;
- typedef struct
- {
- LONG x;
- LONG y;
- }
- VFX_POINT;
- typedef struct
- {
- LONG version;
- LONG char_count;
- LONG char_height;
- LONG font_background;
- }
- FONT;
- typedef struct // Vertex structure used by polygon primitives
- {
- LONG x; // Screen X
- LONG y; // Screen Y
- FIXED16 c; // Color/addition value used by some primitives
- FIXED16 u; // Texture source X
- FIXED16 v; // Texture source Y
- FIXED30 w; // Homogeneous perspective divisor (unused by VFX3D)
- }
- SCRNVERTEX;
- typedef struct
- {
- LONG x0;
- LONG y0;
- LONG x1;
- LONG y1;
- }
- VFX_RECT;
- #define INT_TO_FIXED16(x) (((long)(int)(x)) << 16)
- #define DOUBLE_TO_FIXED16(x) ((long) ((x) * 65536.0 + 0.5))
- #define FIXED16_TO_DOUBLE(x) (((double)(x)) / 65536.0)
- #define FIXED16_TO_INT(x) ((int) ((x)<0 ? -(-(x) >> 16) : (x) >> 16))
- #define ROUND_FIXED16_TO_INT(x) ((int) ((x)<0 ? -((32768-(x)) >> 16) : ((x)+32768) >> 16))
- #define FIXED16_TO_FIXED30(x) ((x) << 14)
- #define FIXED30_TO_FIXED16(x) ((x) >> 14)
- #define FIXED30_TO_DOUBLE(x) (((double)x) / 1073741824.0)
- #define DOUBLE_TO_FIXED30(x) ((long) (x * 1073741824.0 + 0.5))
- #define PIXELS_IN_PANE(pane) (((pane).x1-(pane).x0+1)*((pane).y1-(pane).y0+1))
- #define PIXELS_IN_PANEP(pane) (((pane)->x1-(pane)->x0+1)*((pane)->y1-(pane)0>y0+1))
- //
- // Hardware-specific VFX DLL functions
- //
- /*
- extern VFX_DESC * (*VFX_describe_driver)(void);
- extern void (*VFX_init_driver)(void);
- extern void (*VFX_shutdown_driver)(void);
- extern void (*VFX_wait_vblank)(void);
- extern void (*VFX_wait_vblank_leading)(void);
- extern void (*VFX_area_wipe)(LONG x0, LONG y0, LONG x1, LONG y1,
- LONG color);
- extern void (*VFX_window_refresh)(WINDOW *target, LONG x0, LONG y0,
- LONG x1, LONG y1);
- extern void (*VFX_window_read)(WINDOW *destination, LONG x0, LONG y0,
- LONG x1, LONG y1);
- extern void (*VFX_pane_refresh)(PANE *target, LONG x0, LONG y0,
- LONG x1, LONG y1);
- extern void (*VFX_DAC_read)(LONG color_number, VFX_RGB *triplet);
- extern void (*VFX_DAC_write)(LONG color_number, VFX_RGB *triplet);
- extern void (*VFX_bank_reset)(void);
- extern void (*VFX_line_address)(LONG x, LONG y, UBYTE **addr, ULONG *nbytes);
- */
- //
- // Device-independent VFX API functions (VFXC.C)
- //
- extern ULONG VFX_stencil_size(WINDOW *source, ULONG transparent_color);
- extern STENCIL *VFX_stencil_construct(WINDOW *source, void *dest, ULONG transparent_color);
- extern void VFX_stencil_destroy(STENCIL *stencil);
- extern WINDOW *VFX_window_construct(LONG width, LONG height);
- extern void VFX_window_destroy(WINDOW *window);
- extern PANE *VFX_pane_construct(WINDOW *window, LONG x0, LONG y0, LONG x1, LONG y1);
- extern void VFX_pane_destroy(PANE *pane);
- extern PANE_LIST *VFX_pane_list_construct(LONG n_entries);
- extern void VFX_pane_list_destroy(PANE_LIST *list);
- extern void VFX_pane_list_clear(PANE_LIST *list);
- extern LONG VFX_pane_list_add(PANE_LIST *list, PANE *target);
- extern LONG VFX_pane_list_add_area(PANE_LIST *list, WINDOW *window, LONG x0, LONG y0,
- LONG x1, LONG y1);
- extern void VFX_pane_list_delete_entry(PANE_LIST *list, LONG entry_num);
- extern void VFX_pane_list_refresh(PANE_LIST *list);
- //
- // Device-independent VFX API functions (VFXA.ASM)
- //
- extern BYTE * VFX_driver_name(void *VFXScanDLL);
- extern LONG VFX_register_driver(void *DLLbase);
- extern LONG VFX_line_draw (PANE *pane, LONG x0, LONG y0,
- LONG x1, LONG y1, LONG mode, LONG parm);
- extern long VFX_shape_draw (PANE *pane, void *shape_table,
- LONG shape_number, LONG hotX, LONG hotY);
- extern long VFX_nTile_draw (PANE* pane, void *tile, LONG hotX, LONG hotY, unsigned char *fadeTable = 0);
- extern long VFX_newShape_count (void *shape);
- extern void VFX_shape_lookaside (UBYTE *table);
- extern long VFX_shape_translate_draw (PANE *pane, void *shape_table,
- LONG shape_number,
- LONG hotX, LONG hotY);
- extern void VFX_shape_remap_colors(void *shape_table,
- ULONG shape_number);
- void VFX_shape_visible_rectangle(void *shape_table,
- LONG shape_number, LONG hotX, LONG hotY,
- LONG mirror, LONG *rectangle);
- extern LONG VFX_shape_scan (PANE *pane, ULONG transparentColor,
- LONG hotX, LONG hotY, void *buffer);
-
- extern long VFX_newShape_scan (PANE *shapePane, UBYTE xparentColor, UBYTE Hsx, UBYTE Hsy, unsigned char* *shapeBuffer);
- extern long VFX_deltaShape_scan (PANE *shapePane, UBYTE xparentColor, UBYTE Hsx, UBYTE Hsy, unsigned char* *shapeBuffer);
- extern long VFX_tile_scan (PANE *shapePane, UBYTE xparentColor, UBYTE Hsx, UBYTE Hsy, unsigned char* *shapeBuffer);
-
- extern LONG VFX_shape_bounds(void *shape_table, LONG shape_num);
- extern LONG VFX_shape_origin(void *shape_table, LONG shape_num);
- extern LONG VFX_shape_resolution(void *shape_table, LONG shape_num);
- extern LONG VFX_shape_minxy(void *shape_table, LONG shape_num);
- extern void VFX_shape_palette(void *shape_table, LONG shape_num,
- VFX_RGB *palette);
- extern LONG VFX_shape_colors(void *shape_table, LONG shape_num,
- VFX_CRGB *colors);
- extern LONG VFX_shape_set_colors(void *shape_table, LONG shape_number,
- VFX_CRGB *colors);
- extern LONG VFX_shape_count(void *shape_table);
- extern LONG VFX_shape_list(void *shape_table, ULONG *index_list);
- extern LONG VFX_shape_palette_list(void *shape_table, ULONG *index_list);
- extern LONG VFX_pixel_write (PANE *pane, LONG x, LONG y, ULONG color);
- extern LONG VFX_pixel_read (PANE *pane, LONG x, LONG y);
- extern LONG VFX_rectangle_hash (PANE *pane, LONG x0, LONG y0,
- LONG x1, LONG y1, ULONG color);
- extern LONG VFX_pane_wipe (PANE *pane, LONG color);
- extern LONG VFX_pane_copy (PANE *source, LONG sx, LONG sy,
- PANE *target, LONG tx, LONG ty, LONG fill);
- extern LONG VFX_pane_scroll (PANE *pane, LONG dx, LONG dy,
- LONG mode, LONG parm);
- extern void VFX_ellipse_draw(PANE *pane, LONG xc, LONG yc,
- LONG width, LONG height, LONG color);
- extern void VFX_ellipse_fill(PANE *pane, LONG xc, LONG yc,
- LONG width, LONG height, LONG color);
- extern void VFX_point_transform(VFX_POINT *in, VFX_POINT *out, VFX_POINT *origin,
- LONG rot, LONG x_scale, LONG y_scale);
- extern void VFX_Cos_Sin(LONG Angle, FIXED16 *Cos, FIXED16 *Sin);
- extern void VFX_fixed_mul(FIXED16 M1, FIXED16 M2,
- FIXED16 *result);
- extern LONG VFX_font_height(void *font);
- extern LONG VFX_character_width(void *font, LONG character);
- extern LONG VFX_character_draw(PANE *pane, LONG x, LONG y, void *font,
- LONG character, UBYTE *color_translate);
- extern void VFX_string_draw(PANE *pane, LONG x, LONG y, void *font,
- char *string, UBYTE *color_translate);
- extern LONG VFX_ILBM_draw(PANE *pane, UBYTE *ILBM_buffer);
- extern void VFX_ILBM_palette(UBYTE *ILBM_buffer, VFX_RGB *palette);
- extern LONG VFX_ILBM_resolution(UBYTE *ILBM_buffer);
- extern void VFX_PCX_draw(PANE *pane, UBYTE *PCX_buffer);
- extern void VFX_PCX_palette(UBYTE *PCX_buffer, LONG PCX_file_size,
- VFX_RGB *palette);
- extern LONG VFX_PCX_resolution(UBYTE *PCX_buffer);
- extern LONG VFX_GIF_draw(PANE *pane, UBYTE *GIF_buffer,
- void *GIF_scratch);
- extern void VFX_GIF_palette(UBYTE *GIF_buffer, VFX_RGB *palette);
- extern LONG VFX_GIF_resolution(UBYTE *GIF_buffer);
- extern LONG VFX_pixel_fade(PANE *source, PANE *destination,
- LONG intervals, LONG rnd);
- extern void VFX_window_fade(WINDOW *buffer, VFX_RGB *palette, LONG intervals);
- extern LONG VFX_color_scan(PANE *pane, ULONG *colors);
- extern void VFX_shape_transform(PANE *pane,
- void *shape_table, LONG shape_number, LONG hotX, LONG hotY,
- void *buffer, LONG rot, LONG x_scale, LONG y_scale, LONG flags);
- //
- // VFX 3D polygon functions
- //
- extern void VFX_flat_polygon(PANE *pane, LONG vcnt, SCRNVERTEX *vlist);
- extern void VFX_Gouraud_polygon(PANE *pane, LONG vcnt,
- SCRNVERTEX *vlist);
- extern void VFX_dithered_Gouraud_polygon(PANE *pane, FIXED16
- dither_amount, LONG vcnt, SCRNVERTEX *vlist);
- extern void VFX_map_lookaside(UBYTE *table);
- extern void VFX_map_polygon(PANE *pane, LONG vcnt, SCRNVERTEX *vlist,
- WINDOW *texture, ULONG flags);
- extern void VFX_translate_polygon(PANE *pane, LONG vcnt, SCRNVERTEX *vlist,
- void *lookaside);
- extern void VFX_illuminate_polygon(PANE *pane, FIXED16 dither_amount,
- LONG vcnt, SCRNVERTEX *vlist);
- #ifdef __cplusplus
- }
- #endif
- //
- // MetaWare support
- //
- #ifdef __HIGHC__
- #pragma Global_aliasing_convention();
- #pragma Align_members(4)
- #endif
- #ifdef WIN32
- #pragma pack()
- #endif
- #endif
|