MONOC.CPP (34016B)
1 // 2 // Copyright 2020 Electronic Arts Inc. 3 // 4 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free 5 // software: you can redistribute it and/or modify it under the terms of 6 // the GNU General Public License as published by the Free Software Foundation, 7 // either version 3 of the License, or (at your option) any later version. 8 9 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed 10 // in the hope that it will be useful, but with permitted additional restrictions 11 // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT 12 // distributed with this program. You should have received a copy of the 13 // GNU General Public License along with permitted additional restrictions 14 // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection 15 16 /* $Header: F:\projects\c&c\vcs\code\monoc.cpv 2.13 16 Oct 1995 16:50:36 JOE_BOSTIC $ */ 17 /*********************************************************************************************** 18 *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S *** 19 *********************************************************************************************** 20 * * 21 * Project Name : Command & Conquer * 22 * * 23 * File Name : MONO.CPP * 24 * * 25 * Programmer : Joe L. Bostic * 26 * * 27 * Start Date : July 2, 1994 * 28 * * 29 * Last Update : October 17, 1994 [JLB] * 30 * * 31 *---------------------------------------------------------------------------------------------* 32 * Functions: * 33 * MonoClass::Clear -- Clears the monochrome screen object. * 34 * MonoClass::Draw_Box -- Draws a box using the IBM linedraw characters. * 35 * MonoClass::MonoClass -- The default constructor for monochrome screen object. * 36 * MonoClass::operator = -- Handles making one mono object have the same imagery as another. * 37 * MonoClass::Print -- Prints the text string at the current cursor coordinates. * 38 * MonoClass::Printf -- Prints a formatted string to the monochrome screen. * 39 * MonoClass::Scroll -- Scroll the monochrome screen up by the specified lines. * 40 * MonoClass::Set_Cursor -- Sets the monochrome cursor to the coordinates specified. * 41 * MonoClass::Text_Print -- Prints text to the monochrome object at coordinates indicated. * 42 * MonoClass::View -- Brings the mono object to the main display. * 43 * MonoClass::~MonoClass -- The default destructor for a monochrome screen object. * 44 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ 45 46 //#pragma inline 47 #include "function.h" 48 #include "monoc.h" 49 50 #include <stdlib.h> 51 #include <stdio.h> 52 #include <dos.h> 53 //#include <mem.h> 54 #include <stdarg.h> 55 #include <string.h> 56 57 58 //extern void output(short port, short data); 59 //#pragma aux output parm [dx] [ax] = \ 60 // "out dx,al" \ 61 // "inc dx" \ 62 // "mov al,ah" \ 63 // "out dx,al" 64 65 66 67 int MonoClass::Enabled = 0; 68 MonoClass * MonoClass::PageUsage[MonoClass::MAX_MONO_PAGES] = {0,0,0,0,0,0,0,0}; 69 //DOSSegmentClass MonoClass::MonoSegment(MonoClass::SEGMENT); 70 void * MonoClass::MonoSegment = (void*)0x000b0000; 71 72 /* 73 ** These are the IBM linedraw characters. 74 */ 75 MonoClass::BoxDataType const MonoClass::CharData[MonoClass::COUNT] = { 76 {0xDA,0xC4,0xBF,0xB3,0xD9,0xC4,0xC0,0xB3}, // Single line 77 {0xD5,0xCD,0xB8,0xB3,0xBE,0xCD,0xD4,0xB3}, // Double horz. 78 {0xD6,0xC4,0xB7,0xBA,0xBD,0xC4,0xD3,0xBA}, // Double vert. 79 {0xC9,0xCD,0xBB,0xBA,0xBC,0xCD,0xC8,0xBA} // Double horz and vert. 80 }; 81 82 83 /*********************************************************************************************** 84 * MonoClass::MonoClass -- The default constructor for monochrome screen object. * 85 * * 86 * This is the constructor for monochrome screen objects. It handles allocating a free * 87 * monochrome page. If there are no more pages available, then this is a big error. The * 88 * page allocated may not be the visible one. Call the View function in order to bring * 89 * it to the displayed page. * 90 * * 91 * INPUT: none * 92 * * 93 * OUTPUT: none * 94 * * 95 * WARNINGS: none * 96 * * 97 * HISTORY: * 98 * 10/17/1994 JLB : Created. * 99 *=============================================================================================*/ 100 MonoClass::MonoClass(void) 101 { 102 int index; 103 104 Attrib = DEFAULT_ATTRIBUTE; // Normal text color. 105 X = Y = 0; 106 for (index = 0; index < MAX_MONO_PAGES; index++) { 107 if (!PageUsage[index]) { 108 PageUsage[index] = this; 109 Page = (char)index; 110 break; 111 } 112 } 113 if (index == MAX_MONO_PAGES) { 114 // Major error message should pop up here! 115 delete this; 116 } 117 } 118 119 120 /*********************************************************************************************** 121 * MonoClass::~MonoClass -- The default destructor for a monochrome screen object. * 122 * * 123 * This is the default destructor for a monochrome screen object. * 124 * * 125 * INPUT: none * 126 * * 127 * OUTPUT: none * 128 * * 129 * WARNINGS: none * 130 * * 131 * HISTORY: * 132 * 10/17/1994 JLB : Created. * 133 *=============================================================================================*/ 134 MonoClass::~MonoClass(void) 135 { 136 PageUsage[Page] = 0; 137 } 138 139 140 /*********************************************************************************************** 141 * MonoClass::Draw_Box -- Draws a box using the IBM linedraw characters. * 142 * * 143 * Use this routine to draw a box to the monochrome screen. The IBM line draw characters * 144 * are used to give the it a fancy appearance. There are several line draw modes supported. * 145 * * 146 * INPUT: x,y -- The coordinates of the upper left corner of the box. * 147 * * 148 * w,y -- The width and height (respectively) to make the box. * 149 * * 150 * attrib -- The text attribute to use when drawing the box outline characters. * 151 * * 152 * thick -- The thickness style to use. Examine the BoxStyleType enum for * 153 * elaboration on the supported styles. * 154 * * 155 * OUTPUT: none * 156 * * 157 * WARNINGS: The interior of the box is NOT cleared by this routine. It is advised that this * 158 * area be cleared before the box is drawn. * 159 * * 160 * HISTORY: * 161 * 10/17/1994 JLB : Created. * 162 *=============================================================================================*/ 163 void MonoClass::Draw_Box(int x, int y, int w, int h, char attrib, BoxStyleType thick) 164 { 165 CellType cell; 166 char oldattrib = Attrib; 167 168 if (!Enabled || !w || !h) return; 169 170 cell.Attribute = attrib; 171 172 /* 173 ** Draw the horizontal lines. 174 */ 175 for (int xpos = 0; xpos < w-2; xpos++) { 176 cell.Character = CharData[thick].TopEdge; 177 Store_Cell(cell, x+xpos+1, y); 178 // MonoSegment.Copy_Word_To(*(short*)&cell, Offset(x+xpos+1, y)); 179 cell.Character = CharData[thick].BottomEdge; 180 Store_Cell(cell, x+xpos+1, y+h-1); 181 // MonoSegment.Copy_Word_To(*(short*)&cell, Offset(x+xpos+1, y+h-1)); 182 } 183 184 /* 185 ** Draw the vertical lines. 186 */ 187 for (int ypos = 0; ypos < h-2; ypos++) { 188 cell.Character = CharData[thick].LeftEdge; 189 Store_Cell(cell, x, y+ypos+1); 190 // MonoSegment.Copy_Word_To(*(short*)&cell, Offset(x, y+ypos+1)); 191 cell.Character = CharData[thick].RightEdge; 192 Store_Cell(cell, x+w-1, y+ypos+1); 193 // MonoSegment.Copy_Word_To(*(short*)&cell, Offset(x+w-1, y+ypos+1)); 194 } 195 196 /* 197 ** Draw the four corners. 198 */ 199 if (w > 1 && h > 1) { 200 cell.Character = CharData[thick].UpperLeft; 201 Store_Cell(cell, x, y); 202 // MonoSegment.Copy_Word_To(*(short*)&cell, Offset(x, y)); 203 cell.Character = CharData[thick].UpperRight; 204 Store_Cell(cell, x+w-1, y); 205 // MonoSegment.Copy_Word_To(*(short*)&cell, Offset(x+w-1, y)); 206 cell.Character = CharData[thick].BottomRight; 207 Store_Cell(cell, x+w-1, y+h-1); 208 // MonoSegment.Copy_Word_To(*(short*)&cell, Offset(x+w-1, y+h-1)); 209 cell.Character = CharData[thick].BottomLeft; 210 Store_Cell(cell, x, y+h-1); 211 // MonoSegment.Copy_Word_To(*(short*)&cell, Offset(x, y+h-1)); 212 } 213 214 Attrib = oldattrib; 215 } 216 217 218 /*********************************************************************************************** 219 * MonoClass::Set_Cursor -- Sets the monochrome cursor to the coordinates specified. * 220 * * 221 * Use this routine to set the monochrome's cursor position to the coordinates specified. * 222 * This is the normal way of controlling where the next Print or Printf will output the * 223 * text to. * 224 * * 225 * INPUT: x,y -- The coordinate to position the monochrome cursor. 0,0 is the upper left * 226 * corner. * 227 * * 228 * OUTPUT: none * 229 * * 230 * WARNINGS: none * 231 * * 232 * HISTORY: * 233 * 10/17/1994 JLB : Created. * 234 *=============================================================================================*/ 235 void MonoClass::Set_Cursor(int x, int y) 236 { 237 #ifdef FIX_ME_LATER 238 int pos = (y*COLUMNS)+x; 239 240 if (!Enabled) return; 241 242 X = (char)(x%COLUMNS); 243 Y = (char)(y%LINES); 244 245 if (Page == 0) { 246 _DX = CONTROL_PORT; 247 _AX = (short)(0x0E|(pos&0xFF00)); 248 asm { 249 out dx,al 250 inc dx 251 mov al,ah 252 out dx,al 253 } 254 255 _DX = CONTROL_PORT; 256 _AX = (short)(0x0F|(pos<<8)); 257 asm { 258 out dx,al 259 inc dx 260 mov al,ah 261 out dx,al 262 } 263 264 // outportb(CONTROL_PORT,0x0E|(pos&0xFF00)); 265 // outportb(CONTROL_PORT,0x0F|(pos<<8)); 266 } 267 268 #endif //FIX_ME_LATER 269 270 x=y; 271 y=x; 272 } 273 274 275 /*********************************************************************************************** 276 * MonoClass::Clear -- Clears the monochrome screen object. * 277 * * 278 * This routine will fill the monochrome screen object with spaces. It is clearing the * 279 * screen of data, making it free for output. The cursor is positioned at the upper left * 280 * corner of the screen by this routine. * 281 * * 282 * INPUT: none * 283 * * 284 * OUTPUT: none * 285 * * 286 * WARNINGS: none * 287 * * 288 * HISTORY: * 289 * 10/17/1994 JLB : Created. * 290 *=============================================================================================*/ 291 void MonoClass::Clear(void) 292 { 293 CellType cell; 294 // int offset; 295 296 if (!Enabled) return; 297 298 Set_Cursor(0, 0); 299 300 cell.Attribute = Attrib; 301 cell.Character = ' '; 302 303 // offset = Offset(0, 0); 304 for (int y = 0; y < LINES; y++) { 305 for (int x = 0; x < COLUMNS; x++) { 306 Store_Cell(cell, x, y); 307 } 308 } 309 } 310 311 312 /*********************************************************************************************** 313 * MonoClass::Scroll -- Scroll the monochrome screen up by the specified lines. * 314 * * 315 * Use this routine to scroll the monochrome screen up by the number of lines specified. * 316 * This routine is typically called by the printing functions so that the monochrome screen * 317 * behaves in the expected manner -- printing at the bottom of the screen scrolls it up * 318 * to make room for new text. * 319 * * 320 * INPUT: lines -- The number of lines to scroll the monochrome screen. * 321 * * 322 * OUTPUT: none * 323 * * 324 * WARNINGS: none * 325 * * 326 * HISTORY: * 327 * 10/17/1994 JLB : Created. * 328 *=============================================================================================*/ 329 void MonoClass::Scroll(int lines) 330 { 331 CellType cell; 332 333 if (!Enabled || lines <= 0) return; 334 335 memmove( (void*)((long)MonoSegment + Offset(0, 0)), 336 (void*)((long)MonoSegment + Offset(0, lines)), 337 (LINES-lines)*COLUMNS*sizeof(CellType)); 338 339 // DOSSegmentClass::Copy(MonoSegment, Offset(0, lines), MonoSegment, Offset(0, 0), (LINES-lines)*COLUMNS*sizeof(CellType)); 340 341 Y--; 342 cell.Attribute = Attrib; 343 cell.Character = ' '; 344 345 for (int l = LINES-lines; l < LINES; l++) { 346 for (int index = 0; index < COLUMNS; index++) { 347 Store_Cell(cell, index, l); 348 // MonoSegment.Copy_Word_To(*(short*)&cell, Offset(index, l)); 349 } 350 } 351 } 352 353 354 /*********************************************************************************************** 355 * MonoClass::Printf -- Prints a formatted string to the monochrome screen. * 356 * * 357 * Use this routine to output a formatted string, using the standard formatting options, * 358 * to the monochrome screen object's current cursor position. * 359 * * 360 * INPUT: text -- Pointer to the text to print. * 361 * * 362 * ... -- Any optional parameters to supply in formatting the text. * 363 * * 364 * OUTPUT: none * 365 * * 366 * WARNINGS: The total formatted text length must not exceed 255 characters. * 367 * * 368 * HISTORY: * 369 * 10/17/1994 JLB : Created. * 370 *=============================================================================================*/ 371 void MonoClass::Printf(char const *text, ...) 372 { 373 va_list va; 374 /* 375 ** The buffer object is placed at the end of the local variable list 376 ** so that if the sprintf happens to spill past the end, it isn't likely 377 ** to trash anything (important). The buffer is then manually truncated 378 ** to maximum allowed size before being printed. 379 */ 380 char buffer[256]; 381 382 if (!Enabled) return; 383 384 va_start(va, text); 385 vsprintf(buffer, text, va); 386 buffer[sizeof(buffer)-1] = '\0'; 387 388 Print(buffer); 389 va_end(va); 390 } 391 392 393 #ifdef NEVER 394 void MonoClass::Printf(int text, ...) 395 { 396 va_list va; 397 /* 398 ** The buffer object is placed at the end of the local variable list 399 ** so that if the sprintf happens to spill past the end, it isn't likely 400 ** to trash anything (important). The buffer is then manually truncated 401 ** to maximum allowed size before being printed. 402 */ 403 char buffer[256]; 404 405 if (!Enabled) return; 406 407 va_start(va, text); 408 vsprintf(buffer, Text_String(text), va); 409 buffer[sizeof(buffer)-1] = '\0'; 410 411 Print(buffer); 412 va_end(va); 413 } 414 #endif 415 416 417 /*********************************************************************************************** 418 * MonoClass::Print -- Prints the text string at the current cursor coordinates. * 419 * * 420 * Use this routine to output the specified text string at the monochrome object's current * 421 * text coordinate position. * 422 * * 423 * INPUT: ptr -- Pointer to the string to print. * 424 * * 425 * OUTPUT: none * 426 * * 427 * WARNINGS: none * 428 * * 429 * HISTORY: * 430 * 10/17/1994 JLB : Created. * 431 *=============================================================================================*/ 432 void MonoClass::Print(char const *ptr) 433 { 434 // int optr; 435 char startcol = X; 436 char const * text; 437 CellType cell; 438 439 if (!ptr || !Enabled) return; 440 441 text = ptr; 442 cell.Attribute = Attrib; 443 // optr = Offset(X, Y); 444 while (*text) { 445 446 /* 447 ** Sometimes the character string is used for cursor control instead 448 ** of plain text output. Check for this case. 449 */ 450 switch (*text) { 451 452 /* 453 ** The "return" code behaves as it did in the old C library 454 ** mono system. That is, it returns the cursor position to 455 ** the next line but at the starting column of the print. 456 */ 457 case '\r': 458 X = startcol; 459 Y++; 460 Scroll(Y-(LINES-1)); 461 // optr = Offset(X, Y); 462 break; 463 464 /* 465 ** The "newline" code behaves like the console newline character. 466 ** That is, it moves the cursor down one line and at the first 467 ** column. 468 */ 469 case '\n': 470 X = 0; 471 Y++; 472 Scroll(Y-(LINES-1)); 473 // optr = Offset(X, Y); 474 break; 475 476 /* 477 ** All other characters are output directly and the cursor moves 478 ** rightward to match. If the cursor wraps past the right 479 ** edge is it moved to the next now down at left margin. If the 480 ** cursor goes off the bottom of the display, the display is scrolled 481 ** upward a line. 482 */ 483 default: 484 cell.Character = *text; 485 Store_Cell(cell, X, Y); 486 // MonoSegment.Copy_Word_To(*(short*)&cell, optr); 487 // optr += sizeof(CellType); 488 489 X++; 490 if (X >= COLUMNS) { 491 X = 0; 492 Y++; 493 494 if (Y > (LINES-1)) { 495 Scroll(Y-(LINES-1)); 496 // optr = Offset(X, Y); 497 } 498 } 499 break; 500 501 } 502 text++; 503 } 504 505 Set_Cursor(X, Y); 506 } 507 508 509 /*********************************************************************************************** 510 * MonoClass::Text_Print -- Prints text to the monochrome object at coordinates indicated. * 511 * * 512 * Use this routine to output text to the monochrome object at the X and Y coordinates * 513 * specified. * 514 * * 515 * INPUT: text -- Pointer to the text string to display. * 516 * * 517 * x,y -- The X and Y character coordinates to start the printing at. * 518 * * 519 * attrib-- Optional parameter that specifies what text attribute code to use. * 520 * * 521 * OUTPUT: none * 522 * * 523 * WARNINGS: none * 524 * * 525 * HISTORY: * 526 * 10/17/1994 JLB : Created. * 527 *=============================================================================================*/ 528 void MonoClass::Text_Print(char const *text, int x, int y, char attrib) 529 { 530 char oldx = X; 531 char oldy = Y; 532 char oldattrib = Attrib; 533 534 X = (char)x; 535 Y = (char)y; 536 Attrib = attrib; 537 Print(text); 538 Attrib = oldattrib; 539 Set_Cursor(oldx, oldy); 540 } 541 542 #ifdef NEVER 543 void MonoClass::Text_Print(int text, int x, int y, char attrib) 544 { 545 char oldx = X; 546 char oldy = Y; 547 char oldattrib = Attrib; 548 549 if (text != TXT_NONE) { 550 X = (char)x; 551 Y = (char)y; 552 Attrib = attrib; 553 Print(Text_String(text)); 554 Attrib = oldattrib; 555 Set_Cursor(oldx, oldy); 556 } 557 } 558 559 void MonoClass::Print(int text) 560 { 561 Print(Text_String(text)); 562 } 563 #endif 564 565 566 /*********************************************************************************************** 567 * MonoClass::operator = -- Handles making one mono object have the same imagery as another. * 568 * * 569 * The assignment operator will handle copying the imagery from one monochrome object to * 570 * another. Use this routine in to make two monochrome class objects visually identical. * 571 * * 572 * INPUT: src -- A reference to the source (right side) monochrome object. * 573 * * 574 * OUTPUT: none * 575 * * 576 * WARNINGS: none * 577 * * 578 * HISTORY: * 579 * 10/17/1994 JLB : Created. * 580 *=============================================================================================*/ 581 MonoClass & MonoClass::operator = (MonoClass const & src) 582 { 583 memcpy((void*)((long)MonoSegment + src.Offset(0, 0)), (void*)((long)MonoSegment + Offset(0, 0)), SIZE_OF_PAGE); 584 // DOSSegmentClass::Copy(MonoSegment, src.Offset(0, 0), MonoSegment, Offset(0,0), SIZE_OF_PAGE); 585 Set_Cursor(src.X, src.Y); 586 return(*this); 587 } 588 589 590 /*********************************************************************************************** 591 * MonoClass::View -- Brings the mono object to the main display. * 592 * * 593 * Use this routine to display the mono object on the monochrome screen. It is possible * 594 * that the mono object exists on some background screen memory. Calling this routine will * 595 * perform the necessary memory swapping to bring the data to the front. The mono object * 596 * that was currently being viewed is not destroyed by this function. It is merely moved * 597 * off to some background page. It can be treated normally, except that is just isn't * 598 * visible. * 599 * * 600 * INPUT: none * 601 * * 602 * OUTPUT: none * 603 * * 604 * WARNINGS: none * 605 * * 606 * HISTORY: * 607 * 10/17/1994 JLB : Created. * 608 *=============================================================================================*/ 609 void MonoClass::View(void) 610 { 611 MonoClass *displace; // The page that is being displaced. 612 613 if (Get_Current() == this) return; 614 615 /* 616 ** If the visible page is already assigned to a real monochrome page 617 ** object, then it must be swapped with the new one. 618 */ 619 displace = Get_Current(); 620 if (displace) { 621 char temp[SIZE_OF_PAGE]; 622 623 memcpy(&temp[0], MonoSegment, SIZE_OF_PAGE); 624 memcpy(MonoSegment, (void*)((long)MonoSegment + Offset(0, 0)), SIZE_OF_PAGE); 625 memcpy((void*)((long)MonoSegment + Offset(0, 0)), &temp[0], SIZE_OF_PAGE); 626 627 // DOSSegmentClass::Swap(MonoSegment, Offset(0, 0), MonoSegment, 0, SIZE_OF_PAGE); 628 displace->Page = Page; 629 630 } else { 631 632 /* 633 ** Just copy the new page over since the display page is not assigned 634 ** to a real monochrome page object. 635 */ 636 memcpy(MonoSegment, (void*)((long)MonoSegment + Offset(0, 0)), SIZE_OF_PAGE); 637 // DOSSegmentClass::Copy(MonoSegment, Offset(0, 0), MonoSegment, 0, SIZE_OF_PAGE); 638 } 639 PageUsage[Page] = displace; 640 PageUsage[0] = this; 641 Page = 0; 642 643 Set_Cursor(X, Y); 644 } 645 646 647 648 /************************************************************************************ 649 ** This is the set of C wrapper functions that access the MonoClass support routines. 650 ** Since the C interface doesn't have the ability to write to non-visible pages, it 651 ** will just blast the output to whichever mono page is currently visible. If there is 652 ** no mono class object that is visible, then one will be created -- BUT NOT FREED. 653 ** Typically, this is ok, since the C interface will create only one MonoClass object 654 ** and the system supports up to 8. 655 */ 656 void Mono_Set_Cursor(int x, int y) 657 { 658 if (MonoClass::Is_Enabled()) { 659 MonoClass *mono = MonoClass::Get_Current(); 660 if (!mono) { 661 mono = new MonoClass(); 662 mono->View(); 663 } 664 mono->Set_Cursor(x, y); 665 } 666 } 667 668 int Mono_Printf(char const *string, ...) 669 { 670 va_list va; 671 char buffer[256]; 672 673 buffer[0] = '\0'; 674 if (MonoClass::Is_Enabled()) { 675 MonoClass *mono = MonoClass::Get_Current(); 676 if (!mono) { 677 mono = new MonoClass(); 678 mono->View(); 679 } 680 681 va_start(va, string); 682 vsprintf(buffer, string, va); 683 684 mono->Print(buffer); 685 686 va_end(va); 687 } 688 return((short)strlen(buffer)); 689 } 690 691 692 void Mono_Clear_Screen(void) 693 { 694 if (MonoClass::Is_Enabled()) { 695 MonoClass *mono = MonoClass::Get_Current(); 696 if (!mono) { 697 mono = new MonoClass(); 698 mono->View(); 699 } 700 mono->Clear(); 701 } 702 } 703 704 void Mono_Text_Print(void const *text, int x, int y, int attrib) 705 { 706 if (MonoClass::Is_Enabled()) { 707 MonoClass *mono = MonoClass::Get_Current(); 708 if (!mono) { 709 mono = new MonoClass(); 710 mono->View(); 711 } 712 mono->Text_Print((const char*)text, x, y, (char)attrib); 713 } 714 } 715 716 void Mono_Draw_Rect(int x, int y, int w, int h, int attrib, int thick) 717 { 718 if (MonoClass::Is_Enabled()) { 719 MonoClass *mono = MonoClass::Get_Current(); 720 if (!mono) { 721 mono = new MonoClass(); 722 mono->View(); 723 } 724 mono->Draw_Box(x, y, w, h, (char)attrib, (MonoClass::BoxStyleType)thick); 725 } 726 } 727 728 void Mono_Print(void const *text) 729 { 730 if (MonoClass::Is_Enabled()) { 731 MonoClass *mono = MonoClass::Get_Current(); 732 if (!mono) { 733 mono = new MonoClass(); 734 mono->View(); 735 } 736 mono->Print((const char*)text); 737 } 738 } 739 740 int Mono_X(void) 741 { 742 if (MonoClass::Is_Enabled()) { 743 MonoClass *mono = MonoClass::Get_Current(); 744 if (!mono) { 745 mono = new MonoClass(); 746 mono->View(); 747 } 748 return(short)mono->Get_X(); 749 } 750 return(0); 751 } 752 753 int Mono_Y(void) 754 { 755 if (MonoClass::Is_Enabled()) { 756 MonoClass *mono = MonoClass::Get_Current(); 757 if (!mono) { 758 mono = new MonoClass(); 759 mono->View(); 760 } 761 return(short)mono->Get_X(); 762 } 763 return(0); 764 } 765 766 767 void Mono_Put_Char(char , int ) 768 { 769 } 770 771 void Mono_Scroll(int ) 772 { 773 } 774 775 void Mono_View_Page(int ) 776 { 777 } 778 779 780 #ifdef NEVER 781 int Mono_Printf(int string, ...) 782 { 783 va_list va; 784 char buffer[256]; 785 786 buffer[0] = '\0'; 787 if (MonoClass::Is_Enabled()) { 788 MonoClass *mono = MonoClass::Get_Current(); 789 if (!mono) { 790 mono = new MonoClass(); 791 mono->View(); 792 } 793 794 va_start(va, string); 795 vsprintf(buffer, Text_String(string), va); 796 797 mono->Print(buffer); 798 799 va_end(va); 800 } 801 return((short)strlen(buffer)); 802 } 803 #endif 804