| 601 | #include "NH:sys/amiga/randwin.c" |
| 602 | |
| 603 | void |
| 604 | RandomWindow(char *name) |
| 605 | { |
| 606 | struct MsgPort *tport; |
| 607 | struct timerequest *trq; |
| 608 | static int once = 0; |
| 609 | struct Gadget *gd; |
| 610 | struct Window *w; |
| 611 | struct IntuiMessage *imsg; |
| 612 | int ticks = 0, aredone = 0, timerdone = 0; |
| 613 | long mask, got; |
| 614 | |
| 615 | tport = CreateMsgPort(); |
| 616 | trq = (struct timerequest *)CreateIORequest( tport, sizeof( *trq ) ); |
| 617 | if( tport == NULL || trq == NULL ) |
| 618 | { |
| 619 | allocerr: |
| 620 | if( tport ) DeleteMsgPort( tport ); |
| 621 | if( trq ) DeleteIORequest( (struct IORequest *)trq ); |
| 622 | Delay( 8 * 50 ); |
| 623 | return; |
| 624 | } |
| 625 | |
| 626 | if( OpenDevice( TIMERNAME, UNIT_VBLANK, (struct IORequest *)trq, 0L ) != 0 ) |
| 627 | goto allocerr; |
| 628 | |
| 629 | trq->tr_node.io_Command = TR_ADDREQUEST; |
| 630 | trq->tr_time.tv_secs = 8; |
| 631 | trq->tr_time.tv_micro = 0; |
| 632 | |
| 633 | SendIO( (struct IORequest *)trq ); |
| 634 | |
| 635 | /* Place the name in the center of the screen */ |
| 636 | Rnd_IText5.IText = name; |
| 637 | Rnd_IText6.LeftEdge = Rnd_IText4.LeftEdge + |
| 638 | (strlen(Rnd_IText4.IText)+1)*8; |
| 639 | Rnd_NewWindowStructure1.Width = ( |
| 640 | (strlen( Rnd_IText2.IText )+1) * 8 ) + |
| 641 | HackScreen->WBorLeft + HackScreen->WBorRight; |
| 642 | Rnd_IText5.LeftEdge = (Rnd_NewWindowStructure1.Width - |
| 643 | (strlen(name)*8))/2; |
| 644 | |
| 645 | gd = Rnd_NewWindowStructure1.FirstGadget; |
| 646 | gd->LeftEdge = (Rnd_NewWindowStructure1.Width - gd->Width)/2; |
| 647 | /* Chose correct modifier */ |
| 648 | Rnd_IText6.IText = "a"; |
| 649 | switch( *name ) |
| 650 | { |
| 651 | case 'a': case 'e': case 'i': case 'o': |
| 652 | case 'u': case 'A': case 'E': case 'I': |
| 653 | case 'O': case 'U': |
| 654 | Rnd_IText6.IText = "an"; |
| 655 | break; |
| 656 | } |
| 657 | |
| 658 | if( !once ) |
| 659 | { |
| 660 | if( bigscreen ) |
no test coverage detected