Source code for /engineering/rendsite/test/source/2XTILE/Testing/TESTER.COriginal file TESTER.C
   1 #include <stdlib.h>
   2 #include <conio.h>
   3 #include "xtile21!.h"
   4 #include <stdio.h>
   5 #include <alloc.h>
   6 #include <dos.h>
   7 
   8 
   9 #define	ALLBUTTONS	30
  10 #define ALLBANDREDRAW  31
  11 
  12 #define RELOAD		(STORE + (1680/4) + 1)
  13 
  14 #define	AFTERSPLIT	3200
  15 
  16 #define	TRUE	1
  17 #define	FALSE	0
  18 
  19 
  20 int	Size, Color = 1;
  21 
  22 int   LastX = -1;
  23 int   LastY = -1;
  24 float Slp   = 0;
  25 
  26 
  27 FILE		*test;
  28 char*     far  mpoint;
  29 char*	far  mmask;
  30 char*	far  mask1;
  31 char*	far  pal;
  32 char* 	far	font;
  33 char*	far  fmask;
  34 
  35 char*	far hex;
  36 
  37 int  	Value;
  38 
  39 int X, Y;
  40 unsigned int	SplitMFlag	= NORMALPAGE;
  41 
  42 /*void	XUser_MouseHndlr (	unsigned int	Mouse_X,
  43 					unsigned int	Mouse_Y,
  44 					unsigned int	Event_Mask  ) {
  45 
  46    if ( SplitMFlag == SPLITPAGE )    XSet_Write_Page( PAGE0, 400 );
  47 
  48    XMouse_InActive();
  49 
  50    XPaste_Tile( 0, 0, 8, 8, MOUSERELOAD );
  51 
  52    XSet_Box( Mouse_X, Mouse_Y, 4, 4, 10 );
  53    XSet_Write_Page( AFTERSPLIT, 400 );
  54 
  55    XMouse_Active(  XLEFT_BUTTON, Mouse_X, Mouse_Y, SplitMFlag );
  56 }; */
  57 /*
  58 void	XUser_MouseHndlr (	unsigned int	Mouse_X,
  59 					unsigned int	Mouse_Y,
  60 					unsigned int	Event_Mask  ) {
  61 
  62    int X;
  63 
  64    XMouse_InActiveS();
  65 
  66    XPaste_Tile( 0, 0, 8, 8, MOUSERELOAD );
  67 
  68 
  69    if ( Mouse_X > 209 ) X = Mouse_X -209;
  70    else
  71       X = Mouse_X;
  72 
  73    XSet_Box( X, Mouse_Y, 4, 4, 10 );
  74    XSet_Write_Page( AFTERSPLIT, 400 );
  75 
  76    XMouse_ActiveS(  XLEFT_BUTTON, Mouse_X, Mouse_Y );
  77 };
  78 
  79 */
  80 
  81 
  82 void main() {
  83 
  84 
  85 	char		What[20];
  86 	int		Mode;
  87 	char		Command;
  88 
  89 	printf("What mode : ");
  90 	gets( What );
  91 	Mode = atoi( What );
  92 
  93 	test  = fopen("othello.pal", "rb");
  94 	pal  = farmalloc( 768 );
  95 	fread( pal, sizeof(char), 768, test);
  96 	fclose( test );
  97 
  98 /*	test  = fopen("mpoint2.spi", "rb");
  99 	mpoint  = farmalloc( 256 );
 100 	fread( mpoint, sizeof(char), 256, test);
 101 	fclose( test );
 102 
 103 	test  = fopen("mpoint2.spm", "rb");
 104 	mmask  = farmalloc( 64 );
 105 	fread( mmask, sizeof(char), 64, test);
 106 	fclose( test );
 107 */
 108 	test  = fopen("board.vga", "rb");
 109 	hex  = farmalloc( 16134 );
 110 	fread( hex, sizeof(char), 16134, test);
 111 	fclose( test );
 112 
 113  /*	test  = fopen("test4.fnt", "rb");
 114 	font  = farmalloc( 168 );
 115 	fread( font, sizeof(char), 168, test);
 116 	fclose( test );
 117 
 118 	test  = fopen("test4.msf", "rb");
 119 	fmask  = farmalloc( 24 );
 120 	fread( fmask, sizeof(char), 24, test);
 121 	fclose( test );
 122 
 123 */
 124 	XClear(0);
 125 
 126 	XInit_Mode( Mode );
 127 
 128 	XClear(0);
 129 
 130 
 131 	XSet_Display_PageP( PAGE0, 320, 240, 0, 0, 0, 255, pal );
 132 	XSet_Write_Page(   PAGE0, 320 );
 133 
 134 	X = 168;
 135 	Y = 96;
 136 
 137 	XSet_Clip( 4, 316, 4, 236 );
 138 	Command = getch();
 139 	while( (Command != 'q') && (Command != 'Q') ) {
 140 
 141 	   XSet_Box( 0, 0, 320, 240, 0 );
 142 	   XPut_ScaledBitmap( 4, 4, X, Y, 168, 96, hex+6 );
 143 
 144 	   switch( Command ) {
 145 
 146 	      case 'u' : Y++;
 147 			 break;
 148 
 149 	      case 'm' : Y--;
 150 			 break;
 151 
 152 	      case 'h' : X++;
 153 			 break;
 154 
 155 	      case 'k' : Y--;
 156 			 break;
 157 
 158 	      case 'j' : X = 168;
 159 			 Y = 96;
 160 			 break;
 161 	   };
 162 
 163 	   Command = getch();
 164 	};
 165 
 166 	/*
 167 	XSet_SplitScreen( 30 );
 168 	getch();
 169 
 170 */
 171 
 172 
 173 
 174 /*
 175 	getch();
 176 	XPut_Tile( 16, 10, 24, 17, hex );
 177 	XPut_Tile( 17, 29, 24, 17, hex );
 178 	XPut_Tile( 18, 48, 24, 17, hex );
 179 	XPut_Tile( 19, 67, 24, 17, hex );
 180 
 181 	getch();
 182 	XPut_TileA( 48, 10, 24, 17, hex );
 183 	XPut_TileA( 49, 29, 24, 17, hex );
 184 	XPut_TileA( 50, 48, 24, 17, hex );
 185 	XPut_TileA( 51, 67, 24, 17, hex );
 186 
 187 	getch();
 188 	XPut_Tile_M( 80, 10, 24, 17, hex );
 189 
 190 	getch();
 191 	XPut_TileA_M( 112, 10, 24, 17, hex );
 192 	XPut_TileA_M( 113, 29, 24, 17, hex );
 193 	XPut_TileA_M( 114, 48, 24, 17, hex );
 194 	XPut_TileA_M( 115, 67, 24, 17, hex );
 195 
 196 
 197 	XUpload_Sprite( STORE, 1680, mpoint );
 198 
 199 	XPaste_Tile( 0,0,20,21, STORE);
 200 	getch();
 201 
 202 
 203 	XReload_TileW( 0,0,20,21, RELOAD);
 204 
 205 	do {
 206 
 207 	   XPaste_Sprite_M( X, Y, 20, 21, STORE, mmask );
 208 
 209 	   XWait_Retrace();
 210 
 211 	   XPaste_Tile( X, Y, 20, 21, RELOAD );
 212 
 213 	   X = X + 2;
 214 	   Y++;
 215 
 216 	   XReload_TileW( X, Y, 20, 21, RELOAD );
 217 
 218 	} while (X < 321 );
 219 
 220 	getch();
 221 
 222 	XMove_Tile( 100, 100, 16, 16, 40, 40 );
 223 	getch();
 224 	XMove_Tile( 100, 100, 16, 16, 100, 150);
 225 	getch();
 226 	XMove_Tile( 100, 100, 16, 16, 40, 100);
 227 	getch();
 228 	XMove_Tile( 100, 100, 16, 16, 160, 100);
 229 	getch();
 230 	XMove_Tile( 100, 100, 16, 16, 108, 108);
 231 	*/
 232 
 233 	/* Test fonts */
 234 /*	XRegister_Font4( STORE, 7, 'A', DONTUPLOADFONT, font );
 235 	XChar4(   100, 10, 'B');
 236 	XChar4_M( 100, 25, 'B');
 237 	getch();
 238 
 239 	XString4( 100, 50, DONTMASK, "ABCDEFG");
 240 	getch();
 241 	XString4( 100, 65, DOMASK, "ABCDEFG");
 242 
 243 	getch();
 244 
 245 	XRegister_Font4( STORE, 7, 'A', UPLOADFONT, font );
 246 	XChar4(   100, 80, 'A');
 247 	getch();
 248 	XString4( 100, 100, DONTMASK, "ABCDEFG");
 249 	Register_Font_Masks4( fmask );
 250 	getch();
 251 	XChar4_M( 200, 115, 'A');
 252 
 253 	getch();
 254 	XString4( 100, 130, DOMASK, "ABCDEFG");
 255 	getch();
 256 
 257 	XString4_C( 200, 130, 5, "ABCDEFG");
 258 	getch();
 259 
 260 */
 261 /*	XRegister_Mouse( mpoint, mmask, XUser_MouseHndlr );
 262 
 263 	   XPaste_Sprite_M( 120, 20, 8, 8, MOUSEOFFSET, mmask );
 264 	   XPaste_Sprite_M( 121, 30, 8, 8, MOUSEOFFSET, mmask );
 265 	   XPaste_Sprite_M( 122, 40, 8, 8, MOUSEOFFSET, mmask );
 266 	   XPaste_Sprite_M( 123, 50, 8, 8, MOUSEOFFSET, mmask );
 267 */
 268 /*	getch();
 269 
 270 	XMouse_Active( XLEFT_BUTTON, 64, 64, SplitMFlag );
 271 
 272 	getch();
 273 
 274 	XMouse_InActive();
 275 
 276 	SplitMFlag = SPLITPAGE;
 277 
 278 	XMouse_Active( XLEFT_BUTTON, 8, 8, SplitMFlag );
 279 
 280 	getch();
 281 
 282 	XMouse_InActive();
 283 
 284 */
 285 /*	getch();
 286 
 287 	XMouse_ActiveS( XLEFT_BUTTON, 100, 207 );
 288 
 289 	getch();
 290 
 291 	XMouse_InActiveS();
 292 
 293 	getch();
 294 
 295 	XMouse_ActiveS( XLEFT_BUTTON, 100, 220 );
 296 
 297 	getch();
 298 
 299 	XMouse_InActiveS();
 300 
 301 	getch();
 302 
 303 
 304 	XSet_View( 12, 12 );
 305 	getch();
 306 	XSet_View( 16, 16 );
 307 	getch();
 308 	XSet_View( 20, 20 );
 309 	getch();
 310 	XSet_View( 24, 24 );
 311 	getch();
 312 
 313 */
 314 
 315 
 316 
 317 
 318 };
 319