📄 !bestlib.doc
字号:
(word)SHIP1N , 199,167, /* ship #1[N] */
(word)SHIP1NE, 200,168, /* ship #1[NE] */
(word)SHIP1E , 201,169, /* ship #1[E] */
(word)SHIP1SE, 202,170, /* ship #1[SE] */
(word)SHIP1S , 203,171, /* ship #1[S] */
(word)SHIP1SW, 204,172, /* ship #1[SW] */
(word)SHIP1W , 205,173, /* ship #1[W] */
(word)SHIP1NW, 206,174, /* ship #1[NW] */
(word)BIRD1 , 207,175, /* bird #1 */
(word)DIAMON1, 208,179, /* diamond #1 */
(word)EXPLOS1, 209,180, /* explosion #1 */
(word)TOOTHG1, 210,181, /* toothgrin #1 */
(word)HOURGL1, 211,182, /* hourglass #1 */
(word)METEOR1, 212,183, /* meteor #1 */
(word)SPACES1, 213,184, /* spaceship #1 */
(word)BIKERL1, 214,185, /* biker #1[left] */
(word)BIKERR1, 215,186, /* biker #1[right] */
(word)FROWN1 , 216,187, /* frown #1 */
(word)GRIN1 , 217,188, /* grin #1 */
(word)LAMP1L , 218,189, /* lamp #1[left] */
(word)LAMP1R , 219,190, /* lamp #1[right] */
(word)SAILB1L, 220,191, /* sailboat #1[left] */
(word)SAILB1R, 221,224, /* sailboat #1[right] */
(word)SHARK1L, 222,225, /* shark #1[left] */
(word)SHARK1R, 223,226, /* shark #1[right] */
(word)
(word)TARGET1, 192,126, /* target #1 */
(word)TRUCK1L, 193,127, /* truck #1[left] */
(word)TRUCK1R, 194,145, /* truck #1[right] */
(word)VAN1L , 195,146, /* van #1[left] */
(word)VAN1R , 196,164, /* van #1[right] */
(word)BALLO11, 197,165, /* balloon #1[1] */
(word)BALLO12, 198,166, /* balloon #1[2] */
(word)BALLO13, 199,167, /* balloon #1[3] */
(word)SUN1 , 200,168, /* sun #1 */
(word)FIGUR3L, 201,169, /* figure #3[left] */
(word)FIGUR3R, 202,170, /* figure #3[right] */
(word)FIGUR41, 203,171, /* figure #4[1] */
(word)FIGUR42, 204,172, /* figure #4[2] */
(word)FIGUR52, 205,173, /* figure #5[2] */
(word)FISH1L , 206,174, /* fish #1[left] */
(word)FISH1R , 207,175, /* fish #1[right] */
(word)FISH2L , 208,179, /* fish #2[left] */
(word)FISH2R , 209,180, /* fish #2[right] */
(word)PLANE1L, 210,181, /* plane #1[left] */
(word)PLANE1R, 211,182, /* plane #1[right] */
(word)JET1L , 212,183, /* jet #1[left] */
(word)JET1R , 213,184, /* jet #1[right] */
(word)TARGET2, 255, /* target #2 */
(word)BOTTLE1, 254, /* bottle #1 */
(word)FIGUR1L, 253, /* figure #1[left] */
(word)FIGUR1R, 252, /* figure #1[right] */
(word)FIGUR2L, 251, /* figure #2[left] */
(word)FIGUR2R, 250, /* figure #2[right] */
(word)FIGUR51, 249, /* figure #5[1] */
(word)FIGUR6L, 248, /* figure #6[left] */
(word)FIGUR6R, 247, /* figure #6[right] */
(word)MOON1L , 246, /* moon #1[left] */
(word)MOON1R , 245 /* moon #1[right] */
};
--------------------------------------------------------------------------------
/* MESSAGES */
DASHES printf("\n----------------------------------------
----------------------------------------")
DISTRIBUTE printf("\n------------------------- DISTRIBUTION IS ENCOURAGED ----
---------------------")
DOUBLESPACE printf("\n\n")
SINGLESPACE printf("\n")
--------------------------------------------------------------------------------
/* MACROS */
ischar(ch) (((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z')
|| ch == APOSTROPHE || ch == HYPHEN) ? TRUE : FALSE)
RETURNS: TRUE if 'ch' is a valid character used in words
FALSE if 'ch' is not a valid character used in words
/* ONE-ARGUMENT MACROS */
absolute value of a
ABS(a) (((a)<0) ? -(a) : (a))
round a to nearest integer towards 0
FLOOR(a) ((a)>0 ? (int)(a) : -(int)(-a))
round a to nearest integer away from 0
CEILING(a) ( (a) == (int)(a) ? (a) \
: (a) > 0 ? 1+(int)(a) : -( 1+(int)(-a) ))
round a to nearest int
ROUND(a) (((a) > 0) ? (int)(a+0.5) : -(int)(0.5-a))
take sign of a, either -1, 0, or 1
ZSGN(a) (((a) < 0) ? -1 : (a) > 0 ? 1 : 0)
take binary sign of a, either -1, or 1 if >= 0
SGN(a) (((a) < 0) ? -1 : 1)
shout if something that should be true isn't
ASSERT(x) if (!(x)) fprintf(stderr," Assert failed: x\n");
square a
SQR(a) ((a)*(a))
/* TWO-ARGUMENT MACROS */
return minimum of a and b
MINIMUM(a,b) ( ((a) < (b)) ? (a) : (b) )
return maximum of a and b
MAXIMUM(a,b) ( ((a) > (b)) ? (a) : (b) )
swap a and b
SWAP(a,b) { a^=b; b^=a; a^=b; }
linear interpolation from l (when a=0) to h (when a=1)
(equal to (a*h) + ( (1-a) * l)
LERP(a,l,h) ( (l) + (((h)-(l)) * (a)) )
clamp the input to the specified range
CLAMP(v,l,h) ( (v) < (l) ? (l) : (v) > (h) ? (h) : v)
/* MEMORY ALLOCATION MACROS */
create a new instance of a structure (see Gem by Hultquist)
NEWSTRUCT(x) (struct x *) (malloc( (unsigned)sizeof(struct x) ))
create a new instance of a type
NEWTYPE(x) (x *) (malloc( (unsigned)sizeof(x) ))
--------------------------------------------------------------------------------
/* TYPE DEFINITIONS */
typedef unsigned char boolean... a TRUE or FALSE type, as in Pascal
typedef boolean flag............ flag data type
typedef unsigned char byte...... an 8-bit/1 byte (0..255) type, as in Pascal
typedef signed char shortint.... an 8-bit/1 byte (-128..+127) type, as in Pascal
typedef unsigned int word....... a 16-bit/2-byte (0..65535) type, as in Pascal
typedef struct {
byte ascii................... ASCII code of character pressed
byte scan.................... SCAN code of character pressed
} asciiscan;
typedef struct {
byte y....................... ordinate
byte x....................... abscissa
byte start................... starting scan line
byte end..................... ending scan line
boolean on................... TRUE if the cursor is on, FALSE if it is not
} cursordata;
typedef struct document_def {
char *line................... pointer to a line of the document
struct document_def *prev..... pointer to previous line
struct document_def *next..... pointer to next line
} document;
typedef struct {
byte fgclr................. foreground color or NO if no color fill
byte bgclr................. background color or NO if no color fill
char fillchar.............. character to fill with or NO if no character fill
byte x..................... abscissa (if TCUR, uses text cursor abscissa
if MCUR, uses mouse cursor abscissa)
byte y..................... ordinate (if TCUR, uses text cursor ordinate
if MCUR, uses mouse cursor ordinate)
shortint length............ x-length of area
shortint height............ y-height of area
char *overwrite............ text to overwrite or NULL if overwrite all
char *text................. text to print or NULL if no text
} filldata;
*** NOTE if "fillchar" and "print" are both defined, "print" is printed
typedef struct {
word size............... size of image in bytes
byte tclr............... transparency color or number of 8-pixel groups
int x................... abscissa (if MCUR, uses mouse cursor abscissa)
int y................... ordinate (if MCUR, uses mouse cursor ordinate)
int length.............. x-length (do not modify)
int height.............. y-height (do not modify)
int how : 1............. draw with the current scroll (TRUE) or not (FALSE)
int for_future : 15..... no current purpose, other than to fill the integer
} imagedata;
*** NOTE if used with _16_i_... "tclr" is number of 8-pixel groups per row
if used with _16_c_... or _16_p_..., "tclr" is transparency color
typedef struct linked_list {
struct linked_list *next...... pointer to next node
} llist;
typedef struct linked_list_s {
struct linked_list_s *next.... pointer to next node
} llist_single;
typedef struct linked_list_d {
struct linked_list_d *prev.... pointer to previous node
struct linked_list_d *next.... pointer to next node
} llist_double;
typedef struct {
byte update............. TRUE "ms_stat" has updated structure "mousedata"
FALSE no structure variables have been updated
int pos[2].............. old mouse cursor x,y position
int buts[2]............. old left,right button 0 not pressed 1 pressed
int npos[2]............. new mouse cursor x,y position
int nbuts[2]............ new left,right button 0 not pressed 1 pressed
int butlr[2]............ x,y position of last left button release
int butlp[2]............ x,y position of last left button press
int butrr[2]............ x,y position of last right button release
int butrp[2]............ x,y position of last right button press
} mousedata;
typedef struct {
byte fgclr.............. foreground color or NO if no color fill
byte bgclr.............. background color or NO if no color fill
byte command = ALIGN_NONE - no command
= ALIGN_HORZ - horizontal center; shifts odd lengths left
= ALIGN_VERT - vertical center; shifts odd lengths up
= ALIGN_CENTER - horizontal and vertical center
= ALIGN_RIGHT - right justify; flush to the right margin
byte x.................. abscissa (if TCUR, uses text cursor abscissa
if MCUR, uses mouse cursor abscissa)
byte y.................. ordinate (if TCUR, uses text cursor ordinate
if MCUR, uses mouse cursor ordinate)
char *text.............. text to print
} printdata;
*** NOTE "command" will revert to ALIGN_NONE if the length of string "string"
is greater than 80 (the width of the text screen)
*** NOTE if both "x" and "y" = TCUR, the cursor is advanced to one past the
last character printed
typedef struct {
word size............... size of image in bytes
byte fgclr.............. NO if no color fill
byte bgclr.............. NO if no color fill
byte x.................. abscissa (if TCUR, uses text cursor abscissa
if MCUR, uses mouse cursor abscissa)
byte y.................. ordinate (if TCUR, uses text cursor ordinate
if MCUR, uses mouse cursor ordinate)
byte length............. x-length (do not modify)
byte height............. y-height (do not modify)
} textimagedata;
typedef struct {
byte fgclr.............. foreground color or NO if no color fill
byte bgcl
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -