MCPcopy Create free account
hub / github.com/NetHack/NetHack / RandomWindow

Function RandomWindow

sys/amiga/winami.c:603–747  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

601#include "NH:sys/amiga/randwin.c"
602
603void
604RandomWindow(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 {
619allocerr:
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 )

Callers 1

amii_player_selectionFunction · 0.85

Calls 4

SetBorderFunction · 0.85
OpenShWindowFunction · 0.85
CloseShWindowFunction · 0.85
DelayFunction · 0.50

Tested by

no test coverage detected