home *** CD-ROM | disk | FTP | other *** search
/ Amiga Times / AmigaTimes.iso / programme / trionbbs110 / Trion / docs / RIPdoors / ripgraph.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-10-06  |  6.9 KB  |  316 lines

  1.  
  2.  
  3. /*  Trion BBS 'RIPscrip Clidoor Support' system functions               */
  4. /*                                                                      */
  5. /*  V 1.00   08 - Jan - 1998                                            */
  6. /*                                                                      */
  7. /*  (c) Copyright 1995-98 by Paul Spijkerman                            */
  8.  
  9.  
  10. #include "ripdoor.h"
  11.  
  12.  
  13. void ripprint(UWORD x, UWORD y, UBYTE *text)
  14. {
  15.    UBYTE *str = "!|@0000";           /* RIP_TEXT_XY */
  16.  
  17.    Store2Chars( &str[3], x );
  18.    Store2Chars( &str[5], y );
  19.  
  20.    printf( "%s%s\r\n" , str, text);
  21. }
  22.  
  23.  
  24. /*
  25. void Color(UWORD color)
  26. {
  27.    UBYTE *str = "!|c00";
  28.  
  29.    str[3] = MakeMegaChar( color / 36 );
  30.    str[4] = MakeMegaChar( color % 36 );
  31.  
  32.    printf("%s\r\n" , str);
  33. }
  34. */
  35.  
  36. void Color(UWORD color)
  37. {
  38.    UBYTE *str = "!|c00";
  39.  
  40.    Store2Chars( &str[3], color);
  41.  
  42.    printf("%s\r\n" , str);
  43. }
  44.  
  45. /* Choose one of the 64 EGA colors for the 16 color RIP palette */
  46. /* cX = 0-63 */
  47.  
  48. void SetPalette(UWORD  c1, UWORD  c2, UWORD  c3, UWORD  c4, UWORD  c5,
  49.                 UWORD  c6, UWORD  c7, UWORD  c8, UWORD  c9, UWORD c10,
  50.                 UWORD c11, UWORD c12, UWORD c13, UWORD c14, UWORD c15,
  51.                 UWORD c16)
  52. {
  53.    UBYTE *str = "!|Q00000000000000000000000000000000";
  54.  
  55.    Store2Chars( &str[ 3],  c1 );
  56.    Store2Chars( &str[ 5],  c2 );
  57.    Store2Chars( &str[ 7],  c3 );
  58.    Store2Chars( &str[ 9],  c4 );
  59.    Store2Chars( &str[11],  c5 );
  60.    Store2Chars( &str[13],  c6 );
  61.    Store2Chars( &str[15],  c7 );
  62.    Store2Chars( &str[17],  c8 );
  63.    Store2Chars( &str[19],  c9 );
  64.    Store2Chars( &str[21], c10 );
  65.    Store2Chars( &str[23], c11 );
  66.    Store2Chars( &str[25], c12 );
  67.    Store2Chars( &str[27], c13 );
  68.    Store2Chars( &str[29], c14 );
  69.    Store2Chars( &str[31], c15 );
  70.    Store2Chars( &str[33], c16 );
  71.  
  72.    printf( "%s\r\n" , str);
  73. }
  74.  
  75. /* color = 0-15 */
  76. /* value = 0-63 */
  77.  
  78. void OnePalette(UWORD color, UWORD value)
  79. {
  80.    UBYTE *str = "!|a0000";
  81.  
  82.    Store2Chars( &str[3], color);
  83.    Store2Chars( &str[5], value);
  84.  
  85.    printf("%s\r\n" , str);
  86. }
  87.  
  88.  
  89. /* Graphics draw mode */
  90. /* mode = 0, normal drawing mode (overwrite) */
  91. /* mode = 1, XOR (complimentary) mode */
  92.  
  93. void  GraphicsMode  (UWORD mode)
  94. {
  95.    UBYTE *str = "!|W00";
  96.  
  97.    Store2Chars( &str[3], mode );
  98.  
  99.    printf("%s\r\n" , str);
  100. }
  101.  
  102.  
  103. /*
  104. void PlotAt(UWORD x, UWORD y)
  105. {
  106.    UBYTE *str = "!|X0000";
  107.  
  108.    str[3] = MakeMegaChar( x / 36 );
  109.    str[4] = MakeMegaChar( x % 36 );
  110.    str[5] = MakeMegaChar( y / 36 );
  111.    str[6] = MakeMegaChar( y % 36 );
  112.  
  113.    printf("%s\r\n" , str);
  114. }
  115. */
  116.  
  117. void PlotAt(UWORD x, UWORD y)
  118. {
  119.    UBYTE *str = "!|X0000";
  120.  
  121.    Store2Chars( &str[3], x );
  122.    Store2Chars( &str[5], y );
  123.  
  124.    printf("%s\r\n" , str);
  125. }
  126.  
  127. /*
  128. void LineAt(UWORD x1, UWORD y1, UWORD x2, UWORD y2)
  129. {
  130.    UBYTE *str = "!|L00000000";
  131.  
  132.    str[3] = MakeMegaChar( x1 / 36 );
  133.    str[4] = MakeMegaChar( x1 % 36 );
  134.    str[5] = MakeMegaChar( y1 / 36 );
  135.    str[6] = MakeMegaChar( y1 % 36 );
  136.  
  137.    str[ 7] = MakeMegaChar( x2 / 36 );
  138.    str[ 8] = MakeMegaChar( x2 % 36 );
  139.    str[ 9] = MakeMegaChar( y2 / 36 );
  140.    str[10] = MakeMegaChar( y2 % 36 );
  141.  
  142.    printf( "%c%s\r\n" , 1, str);      /* ^A!|......\r  , \r of \r\n */
  143. }
  144. */
  145.  
  146. void LineAt(UWORD x1, UWORD y1, UWORD x2, UWORD y2)
  147. {
  148.    UBYTE *str = "!|L00000000";
  149.  
  150.    Store2Chars( &str[3], x1 );
  151.    Store2Chars( &str[5], y1 );
  152.  
  153.    Store2Chars( &str[7], x2 );
  154.    Store2Chars( &str[9], y2 );
  155.  
  156.    /* printf( "%c%s\r\n" , 1, str); */     /* ^A!|......\r  , \r of \r\n */
  157.    printf( "%s\r\n" , str);
  158. }
  159.  
  160. void Rectangle(UWORD x1, UWORD y1, UWORD x2, UWORD y2)
  161. {
  162.    UBYTE *str = "!|R00000000";
  163.  
  164.    Store2Chars( &str[3], x1 );
  165.    Store2Chars( &str[5], y1 );
  166.  
  167.    Store2Chars( &str[7], x2 );
  168.    Store2Chars( &str[9], y2 );
  169.  
  170.    printf( "%s\r\n" , str);
  171. }
  172.  
  173. void FilledRectangle(UWORD x1, UWORD y1, UWORD x2, UWORD y2)
  174. {
  175.    UBYTE *str = "!|B00000000";
  176.  
  177.    Store2Chars( &str[3], x1 );
  178.    Store2Chars( &str[5], y1 );
  179.  
  180.    Store2Chars( &str[7], x2 );
  181.    Store2Chars( &str[9], y2 );
  182.  
  183.    printf( "%s\r\n" , str);
  184. }
  185.  
  186. /* style 00=normal, 01-03=dotted, 04 = custom (see pattern) */
  187. /* pattern .. 16 bit line pattern */
  188. /* line thickness  1 or 3 */
  189.  
  190. void SetLineStyle(UWORD style, UWORD pattern, UWORD thick)
  191. {
  192.    UBYTE *str = "!|=00000000";
  193.  
  194.    Store2Chars( &str[3], style   );
  195.    Store4Chars( &str[5], pattern );
  196.    Store2Chars( &str[9], thick   );
  197.  
  198.    printf("%s\r\n" , str);
  199. }
  200.  
  201. /* pattern 0 = solid with background color */
  202. /* pattern 1 = solid .. 2-11 = line and/or dot patterns */
  203. /* color = 0-15 */
  204.  
  205. void FillStyle(UWORD pattern, UWORD color)
  206. {
  207.    UBYTE *str = "!|S0000";
  208.  
  209.    Store2Chars( &str[3], pattern );
  210.    Store2Chars( &str[5], color   );
  211.  
  212.    printf("%s\r\n" , str);
  213. }
  214.  
  215. /* define 8x8 pixel fill pattern */
  216.  
  217. void CustomFillPattern(UWORD  c1, UWORD  c2, UWORD  c3, UWORD  c4, UWORD  c5,
  218.                        UWORD  c6, UWORD  c7, UWORD  c8, UWORD color)
  219. {
  220.    UBYTE *str = "!|s000000000000000000";
  221.  
  222.    Store2Chars( &str[ 3],  c1 );
  223.    Store2Chars( &str[ 5],  c2 );
  224.    Store2Chars( &str[ 7],  c3 );
  225.    Store2Chars( &str[ 9],  c4 );
  226.    Store2Chars( &str[11],  c5 );
  227.    Store2Chars( &str[13],  c6 );
  228.    Store2Chars( &str[15],  c7 );
  229.    Store2Chars( &str[17],  c8 );
  230.    Store2Chars( &str[19],  color );
  231.  
  232.    printf( "%s\r\n" , str);
  233. }
  234.  
  235. /* Fills in all directions up to <border> color (don't change border) */
  236.  
  237. void FloodFill(UWORD x, UWORD y, UWORD border)
  238. {
  239.    UBYTE *str = "!|F000000";
  240.  
  241.    Store2Chars( &str[3], x );
  242.    Store2Chars( &str[5], y );
  243.    Store2Chars( &str[7], border );
  244.  
  245.    printf( "%s\r\n" , str);
  246. }
  247.  
  248.  
  249. void BezierCurve(UWORD x1, UWORD y1, UWORD x2, UWORD y2,
  250.                  UWORD x3, UWORD y3, UWORD x4, UWORD y4, UWORD count )
  251. {
  252.    UBYTE *str = "!|Z000000000000000000";
  253.  
  254.    Store2Chars( &str[ 3],  x1 );
  255.    Store2Chars( &str[ 5],  y1 );
  256.    Store2Chars( &str[ 7],  x2 );
  257.    Store2Chars( &str[ 9],  y2 );
  258.    Store2Chars( &str[11],  x3 );
  259.    Store2Chars( &str[13],  y3 );
  260.    Store2Chars( &str[15],  x4 );
  261.    Store2Chars( &str[17],  y4 );
  262.    Store2Chars( &str[19],  count );
  263.  
  264.    printf( "%s\r\n" , str);
  265. }
  266.  
  267.  
  268. void Circle(UWORD x, UWORD y, UWORD radius)
  269. {
  270.    UBYTE *str = "!|C000000";
  271.  
  272.    Store2Chars( &str[3], x );
  273.    Store2Chars( &str[5], y );
  274.    Store2Chars( &str[7], radius );
  275.  
  276.    printf( "%s\r\n" , str);
  277. }
  278.  
  279.  
  280. /* ToDo and test:        */
  281.  
  282. /* RIP_TEXT_WINDOW       */
  283. /* RIP_VIEWPORT          */
  284. /* RIP_RESET_WINDOWS     */
  285. /* RIP_ERASE_WINDOW      */
  286. /* RIP_ERASE_VIEW        */
  287. /* RIP_GOTOXY            */
  288. /* RIP_MOVE              */
  289. /* RIP_HOME              */
  290. /* RIP_TEXT              */
  291. /* RIP_FONT_STYLE        */
  292. /* RIP_ERASE_EOL         */
  293.  
  294. /* RIP_OVAL              */
  295. /* RIP_FILLED_OVAL       */
  296. /* RIP_ARC               */
  297. /* RIP_OVAL_ARC          */
  298. /* RIP_PIE_SLICE         */
  299. /* RIP_OVAL_PIE_SLICE    */
  300. /* RIP_POLYGON           */
  301. /* RIP_FILL_POLYGON      */
  302. /* RIP_POLYLINE          */
  303.  
  304. /* RIP_MOUSE             */
  305. /* RIP_KILL_MOUSE_FIELDS */
  306. /* RIP_BEGIN_TEXT        */
  307. /* RIP_REGION_TEXT       */
  308. /* RIP_END_TEXT          */
  309. /* RIP_DEFINE            */
  310. /* RIP_QUERY             */
  311. /* RIP_COPY_REGION       */
  312. /* RIP_READ_SCENE        */
  313. /* RIP_FILE_QUERY        */
  314. /* RIP_ENTER_BLOCK_MODE  */
  315.  
  316.