/* 'WBMind' was written by Sophocles Metsis. Coding in DICE started on 26/07/93. DME was used as an editor. On 26/10/93 I continued developing the program. AZ154 was used as an editor. Still using DICE . I'm now using an A1200 since I just got one. The BW 'hint' pegs are now operational, as far as I know. Also the random combination generator was written but not tested instead a combination of letters is hardcoded for testing of the BW 'hint' pegs. On 27/10/93 I finished the random number generator. You now have 1 chance in 100 to get the same combination twice. Also I think a bug in the BW 'hint' pegs section is now gone. On 30/10/93 I improved the random number generator (faster, more random) and optimized the code for drawing the peg holes. I also made the window a GIMMEZEROZERO window to accomodate different font sizes and recalculated all the graphic offsets, however I do not read in the default screen text size so I do not adjust the window size accordingly. That is something left to be done in the future. Also added a simple comm box routine to use when someone wins. On 25/12/93 (Yes, Christmas) I did some housekeeping to make the program a little more readable. I moved the win sequence in to the main part of the program and I appended two functions that should have been one in the first place. I've switched back to dme know since I wrote my own great macros. On 26/12/93 I made the start_new_game function for simplticitys sake. On 01/01/94 (Yeap! the first day of 1994) I added a menu with the Quit item on it. On 06/01/94 I made the about menu and requester. On 08/01/94 I made the level menu and got rid (I think) of the bug that crashed the system now and then. On 18/1/94 I used srand() for the seed instead of shitloads of rands();. I also got rid of the bug that got the letters all scrwed up after you changed from a higher level to a lower one. Now when you move the cursor to a position that already has a letter, the CurrentLetter becomes that letter. On 26/1/94 I managed to put the Zoom gadget on the top left. No I have to redraw everything every time the window is enlarged again. I should also turn of the menus when the window is iconized. On 2/2/94 I discovered that since the window right now is a GZZ and cannot be made as small as the windows title bar so now I have to make it in to a regular window and add barheight to all y coords and 2 to all x coords. On 3/2/94 I made all the graphics come out at the right place for a non GZZ window. I'm also now using a non GZZ window. Live and learn I guess. On 4/2/94 I made started the redraw_all routine. On 6/2/94 I made the redraw_all routine work better. It looks like its doing what it should except for when you win and then iconify it. Shold next fix that. On 11/2/94 I made the About Requester an EasyRequest that does not hold up intuition when active. On 13/2/94 I started making gadgets for the PosLetters. On 14/2/94 I continued with the above gadgets. On 24/2/94 I finnaly got it to jump from screen to screen. On 16/5/94 I finnaly put the finishing touches and wrote a doc file for it. WBMind now runs the same from both WB and CLI. On 17/5/94 I made to icons for it and released v 1.0 of it. */ #include #include #include #include #include #include #include #include #include ULONG IBLock; /* For Intuition Base Lock */ USHORT wakeup; USHORT class; USHORT code; APTR address; USHORT menu_number; UBYTE *NextScreen; int NumOfLetters = 6; int CurrentLetter = 0; int PreviousLetter = 0; int CurrentXPos = 0; int TempCurrentXPos = 0; /* Store tempor. CurrentXPos during redrawing */ int PreviousXPos = 0; int TempPreviousXPos = 0; /* Store tempor. PreviousXPos during redrawing */ int CurrentYPos = 0; int TempCurrentYPos = 0; /* Store tempor. CurrentYPos during redrawing */ int NextBWPeg = 0; int PosLetter[4]; int PosLetterArray[10][4]; int HiddenLetter[4]; WORD MyArray[4]; struct Window *w; struct Screen *current_screen; struct IntuiMessage *message; struct IntuitionBase *IntuiBase; struct MenuItem *item; BOOL Quit = FALSE; BOOL win = FALSE; BOOL loose = FALSE; BOOL passed = FALSE; BOOL iconified = FALSE; /* flag to keep track of window iconification */ char my_text[17]; char CommBoxText[2][17]; char Letters[10][2]; void do_borders(void); void do_dots(void); void write_letters(void); void init_array (void); void init_startup_arrays(void); void do_BWPegHoles (void); void do_BWPegBoard (void); void MoveLetter (void); void PrintMovedLetter (void); void PrintPos (void); void PrintPrevPos (void); void GenRandNum (void); void PutBWPeg (void); void CheckBWPegs (void); void PutCommText (void); void do_gadget_text (void); void start_new_game (void); void redraw_all (void); void SetPosGadgets (void); void ArrangeLetters (void); void ArrangeCurrentLetter (void); void WindowSetup (void); int rand (void); struct Gadget Pos0Gadget= { NULL, /* NextGadget */ 54, /* LeftEdge */ 115, /* TopEdge */ 10, /* Width */ 10, /* Height */ GADGHNONE, /* Gad highlight temp COMP */ RELVERIFY, /* Program will receive message when user has released it */ BOOLGADGET, NULL, NULL, NULL, NULL, NULL, 0, NULL }; struct Gadget Pos1Gadget= { &Pos0Gadget, /* NextGadget */ 70, /* LeftEdge */ 115, /* TopEdge */ 10, /* Width */ 10, /* Height */ GADGHNONE, /* Gad highlight temp COMP */ RELVERIFY, /* Program will receive message when user has released it */ BOOLGADGET, NULL, NULL, NULL, NULL, NULL, 0, NULL }; struct Gadget Pos2Gadget= { &Pos1Gadget, /* NextGadget */ 86, /* LeftEdge */ 115, /* TopEdge */ 10, /* Width */ 10, /* Height */ GADGHNONE, /* Gad highlight temp COMP */ RELVERIFY, /* Program will receive message when user has released it */ BOOLGADGET, NULL, NULL, NULL, NULL, NULL, 0, NULL }; struct Gadget Pos3Gadget= { &Pos2Gadget, /* NextGadget */ 102, /* LeftEdge */ 115, /* TopEdge */ 10, /* Width */ 10, /* Height */ GADGHNONE, /* Gad highlight temp COMP */ RELVERIFY, /* Program will receive message when user has released it */ BOOLGADGET, NULL, NULL, NULL, NULL, NULL, 0, NULL }; struct Gadget DoPegsGadget= { &Pos3Gadget, /* NextGadget */ 16, /* LeftEdge */ 112, /* TopEdge */ 15, /* Width */ 9, /* Height */ GADGHNONE, /* Gad highlight temp COMP */ RELVERIFY, /* Program will receive message when user has released it */ BOOLGADGET, NULL, NULL, NULL, NULL, NULL, 0, NULL }; struct Gadget LetterAGadget= { &DoPegsGadget, /* NextGadget */ 132, /* LeftEdge */ 23, /* TopEdge */ 10, /* Width */ 9, /* Height */ GADGHNONE, /* Gad highlight temp COMP */ RELVERIFY, /* Program will receive message when user has released it */ BOOLGADGET, NULL, NULL, NULL, NULL, NULL, 0, NULL }; struct Gadget LetterBGadget= { &LetterAGadget, /* NextGadget */ 132, /* LeftEdge */ 33, /* TopEdge */ 10, /* Width */ 9, /* Height */ GADGHNONE, /* Gad highlight temp COMP */ RELVERIFY, /* Program will receive message when user has released it */ BOOLGADGET, NULL, NULL, NULL, NULL, NULL, 0, NULL }; struct Gadget LetterCGadget= { &LetterBGadget, /* NextGadget */ 132, /* LeftEdge */ 43, /* TopEdge */ 10, /* Width */ 9, /* Height */ GADGHNONE, /* Gad highlight temp COMP */ RELVERIFY, /* Program will receive message when user has released it */ BOOLGADGET, NULL, NULL, NULL, NULL, NULL, 0, NULL }; struct Gadget LetterDGadget= { &LetterCGadget, /* NextGadget */ 132, /* LeftEdge */ 53, /* TopEdge */ 10, /* Width */ 9, /* Height */ GADGHNONE, /* Gad highlight temp COMP */ RELVERIFY, /* Program will receive message when user has released it */ BOOLGADGET, NULL, NULL, NULL, NULL, NULL, 0, NULL }; struct Gadget LetterEGadget= { &LetterDGadget, /* NextGadget */ 132, /* LeftEdge */ 63, /* TopEdge */ 10, /* Width */ 9, /* Height */ GADGHNONE, /* Gad highlight temp COMP */ RELVERIFY, /* Program will receive message when user has released it */ BOOLGADGET, NULL, NULL, NULL, NULL, NULL, 0, NULL }; struct Gadget LetterFGadget= { &LetterEGadget, /* NextGadget */ 132, /* LeftEdge */ 73, /* TopEdge */ 10, /* Width */ 9, /* Height */ GADGHNONE, /* Gad highlight temp COMP */ RELVERIFY, /* Program will receive message when user has released it */ BOOLGADGET, NULL, NULL, NULL, NULL, NULL, 0, NULL }; struct Gadget LetterGGadget= { &LetterFGadget, /* NextGadget */ 132, /* LeftEdge */ 83, /* TopEdge */ 10, /* Width */ 9, /* Height */ GADGHNONE, /* Gad highlight temp COMP */ RELVERIFY, /* Program will receive message when user has released it */ BOOLGADGET, NULL, NULL, NULL, NULL, NULL, 0, NULL }; struct Gadget LetterHGadget= { &LetterGGadget, /* NextGadget */ 132, /* LeftEdge */ 93, /* TopEdge */ 10, /* Width */ 9, /* Height */ GADGHNONE, /* Gad highlight temp COMP */ RELVERIFY, /* Program will receive message when user has released it */ BOOLGADGET, NULL, NULL, NULL, NULL, NULL, 0, NULL }; struct Gadget LetterIGadget= { &LetterHGadget, /* NextGadget */ 132, /* LeftEdge */ 103, /* TopEdge */ 10, /* Width */ 9, /* Height */ GADGHNONE, /* Gad highlight temp COMP */ RELVERIFY, /* Program will receive message when user has released it */ BOOLGADGET, NULL, NULL, NULL, NULL, NULL, 0, NULL }; struct Gadget LetterJGadget= { &LetterIGadget, /* NextGadget */ 132, /* LeftEdge */ 113, /* TopEdge */ 10, /* Width */ 9, /* Height */ GADGHNONE, /* Gad highlight temp COMP */ RELVERIFY, /* Program will receive message when user has released it */ BOOLGADGET, NULL, NULL, NULL, NULL, NULL, 0, NULL }; struct Gadget JumpGadget= { &LetterJGadget, /* NextGadget, no more gadgets in the list. */ 85, /* LeftEdge, 40 pixels out. */ 4, /* TopEdge, 4 lines down. Changed in program acording to BarHeight*/ 63, /* Width, 71 pixels wide. */ 14, /* Height, 11 pixels lines heigh. */ GADGHCOMP, /* Flags, when this gadget is highlighted, the gadget */ /* will be rendered in the complement colours. */ /* Colour 0 (00) will be changed to colour 3 (11) */ /* Colour 1 (01) - " - 2 (10) */ /* Colour 2 (10) - " - 1 (01) */ /* Colour 3 (11) - " - 0 (00) */ RELVERIFY, /* the user has selected this gadget, and when the user */ /* has released it. */ BOOLGADGET, /* GadgetType, a Boolean gadget. */ NULL, /* GadgetRender, a pointer to our Border structure. */ /* (Since Intuition does not know if this will be a */ /* pointer to a Border structure or an Image structure, */ /* Intuition expects an APTR (normal memory pointer). */ /* We will therefore have to calm down the compiler by */ /* doing some "casting".) */ NULL, /* SelectRender, NULL since we do not supply the gadget */ /* with an alternative image. (We complement the */ /* colours instead) */ NULL, /* GadgetText, a pointer to our IntuiText structure. */ /* (See chapter 3 GRAPHICS for more information) */ NULL, /* MutualExclude, no mutual exclude. */ NULL, /* SpecialInfo, NULL since this is a Boolean gadget. */ /* (It is not a Proportional/String or Integer gdget) */ 0, /* GadgetID, no id. */ NULL /* UserData, no user data connected to the gadget. */ }; struct Gadget GiveUpGadget= { &JumpGadget, /* NextGadget, no more gadgets in the list. */ 8, /* LeftEdge, 8 pixels out. */ 14, /* TopEdge, 14 lines down. */ 73, /* Width, 71 pixels wide. */ 14, /* Height, 11 pixels lines heigh. */ GADGHCOMP, /* Flags, when this gadget is highlighted, the gadget */ /* will be rendered in the complement colours. */ /* Colour 0 (00) will be changed to colour 3 (11) */ /* Colour 1 (01) - " - 2 (10) */ /* Colour 2 (10) - " - 1 (01) */ /* Colour 3 (11) - " - 0 (00) */ RELVERIFY, /* the user has selected this gadget, and when the user */ /* has released it. */ BOOLGADGET, /* GadgetType, a Boolean gadget. */ NULL, /* GadgetRender, a pointer to our Border structure. */ /* (Since Intuition does not know if this will be a */ /* pointer to a Border structure or an Image structure, */ /* Intuition expects an APTR (normal memory pointer). */ /* We will therefore have to calm down the compiler by */ /* doing some "casting".) */ NULL, /* SelectRender, NULL since we do not supply the gadget */ /* with an alternative image. (We complement the */ /* colours instead) */ NULL, /* GadgetText, a pointer to our IntuiText structure. */ /* (See chapter 3 GRAPHICS for more information) */ NULL, /* MutualExclude, no mutual exclude. */ NULL, /* SpecialInfo, NULL since this is a Boolean gadget. */ /* (It is not a Proportional/String or Integer gdget) */ 0, /* GadgetID, no id. */ NULL /* UserData, no user data connected to the gadget. */ }; struct TagItem TagList [] = { {WA_Zoom, MyArray}, {TAG_DONE, NULL}, }; struct ExtNewWindow nw = { 200,30, /* Starting Corner */ 156,170, /* size x,y */ 0,1, /* detail, block pens */ CLOSEWINDOW | /* IDCMP Flags */ MOUSEBUTTONS| RAWKEY | GADGETUP| MENUPICK| NEWSIZE| MENUVERIFY, WINDOWDEPTH | /* Window Flags */ WINDOWDRAG | SMART_REFRESH| ACTIVATE| WFLG_NW_EXTENDED| WINDOWCLOSE , &GiveUpGadget, /* Pointer to first gadget */ NULL, /* Pointer to check mark */ "WBMind", /* title */ NULL, /* screen pointer */ NULL, /* bitmap pointer */ 156,0, /* Min x,y */ 156,170, /* Max x,y */ CUSTOMSCREEN, /* Type Connected to WorkBench Screen */ TagList }; struct TextAttr my_font= { "topaz.font", TOPAZ_EIGHTY, FS_NORMAL, FPF_ROMFONT }; struct IntuiText nt= { 1, /* FrontPen, colour register 2. */ 0, /* BackPen, colour register 3. */ JAM1, /* DrawMode, draw the characters with colour 2, */ /* on a colour 3 background. */ 0, 0, /* LeftEdge, TopEdge. */ &my_font, /* ITextFont, use my_font. */ my_text, /* IText, the text that will be printed. */ /* (Remember my_text = &my_text[0].) */ NULL /* NextText, no other IntuiText structures are */ /* connected. */ }; SHORT BCommBot[]= /* Now define the border arrays */ { /* for then windows graphics */ 5,152, 142,152, 142,128 }; SHORT BCommTop[]= { 142,128, 5,128, 5,152 }; SHORT WCommBot[]= { 6,151, 141,151, 141,129 }; SHORT WCommTop[]= { 141,127, 4,127, 4,151 }; SHORT BBWPegs[]= { 4,122, 4,18, 33,18 }; SHORT WBWPegs[]= { 34,18, 34,123, 4,123 }; SHORT BPlayArea[]= { 42,123, 116,123, 116,18 }; SHORT WPlayArea[]= { 115,18, 41,18, 41,123 }; SHORT BLetters[]= { 123,122, 123,18, 141,18 }; SHORT WLetters[]= { 142,18, 142,123, 123,123 }; SHORT BBWPegBorBot[]= { 11,120, 27,120, 27,20 }; SHORT BBWPegBorTop[]= { 27,20, 11,20, 11,120 }; SHORT BGiveUp[]= { 5,15, 76,15, 76,2 }; SHORT WGiveUp[]= { 4,15, 4,2, 75,2 }; SHORT BJump[]= { 82,15, 143,15, 143,2 }; SHORT WJump[]= { 81,15, 81,2, 142,2 }; struct Border nb= { 0, 0, /* LeftEdge, TopEdge. */ 1, /* FrontPen, colour register 1. */ 0, /* BackPen, for the moment unused. */ JAM1, /* DrawMode, draw the lines with colour 1. */ 3, /* Count, 5 pair of coordinates in the array. */ BCommBot, /* XY, pointer to the array with the coordinates. */ NULL, /* NextBorder, no other Border structures are connected. */ }; struct IntuiText about_text2= { 0, /* FrontPen, colour 0 (blue). */ 0, /* BackPen, not used since JAM1. */ JAM1, /* DrawMode, do not change the background. */ 15, /* LedtEdge, 15 pixels out. */ 15, /* TopEdge, 5 lines down. */ NULL, /* ITextFont, default font. */ "written using DICE", /* IText, the text . */ NULL, /* NextText, no more IntuiText structures link. */ }; struct IntuiText about_text= { 0, /* FrontPen, colour 0 (blue). */ 0, /* BackPen, not used since JAM1. */ JAM1, /* DrawMode, do not change the background. */ 15, /* LedtEdge, 15 pixels out. */ 5, /* TopEdge, 5 lines down. */ NULL, /* ITextFont, default font. */ "WBMind by Sophocles Metsis", /* IText, the text . */ &about_text2, /* NextText, no more IntuiText structures link. */ }; struct IntuiText ok_text= { 0, /* FrontPen, colour 0 (blue). */ 0, /* BackPen, not used since JAM1. */ JAM1, /* DrawMode, do not change the background. */ 6, /* LedtEdge, 6 pixels out. */ 3, /* TopEdge, 3 lines down. */ NULL, /* ITextFont, default font. */ "OK", /* IText, the text that will be printed. */ NULL, /* NextText, no more IntuiText structures link. */ }; /* The text for the first item: */ struct IntuiText menu_1_text_3 = { 0, /* FrontPen, blue (wb background). */ 0, /* BackPen, not used since JAM1. */ JAM1, /* DrawMode, do not change the background. */ 0, /* LeftEdge, 0 number of pixels out. */ /* This will leave enough space for the check mark. */ 1, /* TopEdge, 1 line down. */ NULL, /* TextAttr, my_font. (Default font)*/ "Quit", /* IText, the string. */ NULL /* NextItem, no link to other IntuiText structures. */ }; struct IntuiText menu_1_text_2 = { 0, /* FrontPen, blue (wb background). */ 0, /* BackPen, not used since JAM1. */ JAM1, /* DrawMode, do not change the background. */ 0, /* LeftEdge, 0 number of pixels out. */ /* This will leave enough space for the check mark. */ 1, /* TopEdge, 1 line down. */ NULL, /* TextAttr, my_font. (Default font)*/ "About", /* IText, the string. */ NULL /* NextItem, no link to other IntuiText structures. */ }; struct IntuiText menu_1_text_1 = { 0, /* FrontPen, blue (wb background). */ 0, /* BackPen, not used since JAM1. */ JAM1, /* DrawMode, do not change the background. */ 0, /* LeftEdge, 0 number of pixels out. */ /* This will leave enough space for the check mark. */ 1, /* TopEdge, 1 line down. */ NULL, /* TextAttr, my_font. (Default font)*/ "Level", /* IText, the string. */ NULL /* NextItem, no link to other IntuiText structures. */ }; struct IntuiText menu1_sub5_text = { 0, /* FrontPen, blue (wb background). */ 0, /* BackPen, not used since JAM1. */ JAM1, /* DrawMode, do not change the background. */ CHECKWIDTH, /* LeftEdge, 0 number of pixels out. */ /* This will leave enough space for the check mark. */ 1, /* TopEdge, 1 line down. */ NULL, /* TextAttr, my_font. (Default font)*/ "10 Hard", /* IText, the string. */ NULL /* NextItem, no link to other IntuiText structures. */ }; struct IntuiText menu1_sub4_text = { 0, /* FrontPen, blue (wb background). */ 0, /* BackPen, not used since JAM1. */ JAM1, /* DrawMode, do not change the background. */ CHECKWIDTH, /* LeftEdge, 0 number of pixels out. */ /* This will leave enough space for the check mark. */ 1, /* TopEdge, 1 line down. */ NULL, /* TextAttr, my_font. (Default font)*/ " 9", /* IText, the string. */ NULL /* NextItem, no link to other IntuiText structures. */ }; struct IntuiText menu1_sub3_text = { 0, /* FrontPen, blue (wb background). */ 0, /* BackPen, not used since JAM1. */ JAM1, /* DrawMode, do not change the background. */ CHECKWIDTH, /* LeftEdge, 0 number of pixels out. */ /* This will leave enough space for the check mark. */ 1, /* TopEdge, 1 line down. */ NULL, /* TextAttr, my_font. (Default font)*/ " 8", /* IText, the string. */ NULL /* NextItem, no link to other IntuiText structures. */ }; struct IntuiText menu1_sub2_text = { 0, /* FrontPen, blue (wb background). */ 0, /* BackPen, not used since JAM1. */ JAM1, /* DrawMode, do not change the background. */ CHECKWIDTH, /* LeftEdge, 0 number of pixels out. */ /* This will leave enough space for the check mark. */ 1, /* TopEdge, 1 line down. */ NULL, /* TextAttr, my_font. (Default font)*/ " 7", /* IText, the string. */ NULL /* NextItem, no link to other IntuiText structures. */ }; struct IntuiText menu1_sub1_text = { 0, /* FrontPen, blue (wb background). */ 0, /* BackPen, not used since JAM1. */ JAM1, /* DrawMode, do not change the background. */ CHECKWIDTH, /* LeftEdge, 0 number of pixels out. */ /* This will leave enough space for the check mark. */ 1, /* TopEdge, 1 line down. */ NULL, /* TextAttr, my_font. (Default font)*/ " 6 Easy", /* IText, the string. */ NULL /* NextItem, no link to other IntuiText structures. */ }; struct MenuItem menu_item_3= { NULL, /* struct MenuItem *NextItem; */ 0,10,90,10, /* SHORT LeftEdge, TopEdge, Width, Height;*/ ITEMTEXT| /* USHORT Flags; */ ITEMENABLED| COMMSEQ| HIGHCOMP, 0, /* LONG MutualExclude; */ (APTR) &menu_1_text_3,/* APTR ItemFill; */ NULL, /* APTR SelectFill; */ 'Q', /* BYTE Command; */ NULL, /* struct MenuItem *SubItem; */ MENUNULL /* USHORT NextSelect; */ }; struct MenuItem menu_item_2= { &menu_item_3, /* struct MenuItem *NextItem; */ 0,0,90,10, /* SHORT LeftEdge, TopEdge, Width, Height;*/ ITEMTEXT| /* USHORT Flags; */ ITEMENABLED| HIGHCOMP, 0, /* LONG MutualExclude; */ (APTR) &menu_1_text_2,/* APTR ItemFill; */ NULL, /* APTR SelectFill; */ NULL, /* BYTE Command; */ NULL, /* struct MenuItem *SubItem; */ MENUNULL /* USHORT NextSelect; */ }; struct MenuItem menu1_sub5= { NULL, /* struct MenuItem *NextItem; */ 60,0,60+CHECKWIDTH,10, /* SHORT LeftEdge, TopEdge, Width, Height;*/ ITEMTEXT| /* USHORT Flags; */ ITEMENABLED| CHECKIT| HIGHCOMP, 0x0000000F, /* LONG MutualExclude; */ (APTR) &menu1_sub5_text,/* APTR ItemFill; */ NULL, /* APTR SelectFill; */ NULL, /* BYTE Command; */ NULL, /* struct MenuItem *SubItem; */ MENUNULL /* USHORT NextSelect; */ }; struct MenuItem menu1_sub4= { &menu1_sub5, /* struct MenuItem *NextItem; */ 60,0,60+CHECKWIDTH,10, /* SHORT LeftEdge, TopEdge, Width, Height;*/ ITEMTEXT| /* USHORT Flags; */ ITEMENABLED| CHECKIT| HIGHCOMP, 0x00000017, /* LONG MutualExclude; */ (APTR) &menu1_sub4_text,/* APTR ItemFill; */ NULL, /* APTR SelectFill; */ NULL, /* BYTE Command; */ NULL, /* struct MenuItem *SubItem; */ MENUNULL /* USHORT NextSelect; */ }; struct MenuItem menu1_sub3= { &menu1_sub4, /* struct MenuItem *NextItem; */ 60,0,60+CHECKWIDTH,10, /* SHORT LeftEdge, TopEdge, Width, Height;*/ ITEMTEXT| /* USHORT Flags; */ ITEMENABLED| CHECKIT| HIGHCOMP, 0x0000001B, /* LONG MutualExclude; */ (APTR) &menu1_sub3_text,/* APTR ItemFill; */ NULL, /* APTR SelectFill; */ NULL, /* BYTE Command; */ NULL, /* struct MenuItem *SubItem; */ MENUNULL /* USHORT NextSelect; */ }; struct MenuItem menu1_sub2= { &menu1_sub3, /* struct MenuItem *NextItem; */ 60,0,60+CHECKWIDTH,10, /* SHORT LeftEdge, TopEdge, Width, Height;*/ ITEMTEXT| /* USHORT Flags; */ ITEMENABLED| CHECKIT| HIGHCOMP, 0x0000001D, /* LONG MutualExclude; */ (APTR) &menu1_sub2_text,/* APTR ItemFill; */ NULL, /* APTR SelectFill; */ NULL, /* BYTE Command; */ NULL, /* struct MenuItem *SubItem; */ MENUNULL /* USHORT NextSelect; */ }; struct MenuItem menu1_sub1= { &menu1_sub2, /* struct MenuItem *NextItem; */ 60,0,60+CHECKWIDTH,10, /* SHORT LeftEdge, TopEdge, Width, Height;*/ ITEMTEXT| /* USHORT Flags; */ ITEMENABLED| CHECKIT| CHECKED| HIGHCOMP, 0x0000001E, /* LONG MutualExclude; */ (APTR) &menu1_sub1_text,/* APTR ItemFill; */ NULL, /* APTR SelectFill; */ NULL, /* BYTE Command; */ NULL, /* struct MenuItem *SubItem; */ MENUNULL /* USHORT NextSelect; */ }; struct MenuItem menu_item_1= { &menu_item_2, /* struct MenuItem *NextItem; */ 0,0,90,10, /* SHORT LeftEdge, TopEdge, Width, Height;*/ ITEMTEXT| /* USHORT Flags; */ ITEMENABLED| HIGHCOMP, 0, /* LONG MutualExclude; */ (APTR) &menu_1_text_1,/* APTR ItemFill; */ NULL, /* APTR SelectFill; */ NULL, /* BYTE Command; */ &menu1_sub1, /* struct MenuItem *SubItem; */ MENUNULL /* USHORT NextSelect; */ }; struct Menu my_menu= { NULL, /* NextMenu, no other menu structures */ /* connected. */ 0, /* LeftEdge, 0 pixels to the right. */ 0, /* TopEdge, for the moment ignored by */ /* Intuition. Set to 0. */ 96, /* Width, 60 pixels wide. */ 0, /* Height, for the moment ignored by */ /* Intuition. Set to 0. */ MENUENABLED, /* Flags, this menu should be enabled. */ "WBMind", /* MenuName, the title of the menu. */ &menu_item_1,/* FirstItem, pointer to the first item */ /* in the list. */ 0, 0, 0, 0 /* JazzX, JazzY, BeatX, BeatY */ }; struct EasyStruct AboutES = { sizeof(struct EasyStruct), 0, "About WBMind", " WBMind v. 1.0 \nby Sophocles Metsis\nsopho@wpi.wpi.edu\n written using DICE", "Cool", }; void _main () { IntuiBase = (struct IntuitionBase *) OpenLibrary((UBYTE *) "intuition.library", 36l ); IBLock = LockIBase(0); current_screen=(struct Screen *)(IntuiBase->ActiveScreen); UnlockIBase (IBLock); WindowSetup (); init_startup_arrays (); w = OpenWindowTagList(&nw,TagList); if (w!=NULL) /* Make sure we have opened the window */ { /* before we actually write something to it */ SetMenuStrip(w,&my_menu); do_borders(); /* Now draw graphics using borders */ do_gadget_text(); /* also write the text in the gadgets */ do_BWPegBoard(); /* Now draw the hint PEG area */ PosLetter[CurrentXPos]=CurrentLetter; start_new_game (); strcpy(my_text," WBMind by "); PutCommText (); strcpy(my_text,"Sophocles Metsis"); PutCommText (); while ( !Quit ) /* This is the main loop */ { SetPosGadgets(); WaitPort(w->UserPort); message = (struct IntuiMessage *)GetMsg(w->UserPort); if (message != NULL) { class = message->Class; code = message->Code; address = message->IAddress; ReplyMsg((struct Message *)message); } if (!iconified) { switch (class) { case MOUSEBUTTONS: { if ( (win || loose) && (code==SELECTUP) ) code=68; else break; } case RAWKEY: { if (!win && !loose) MoveLetter(); else if (code==68) { strcpy(my_text,"Here is another."); PutCommText (); start_new_game(); } break; } case MENUPICK: { while (code != MENUNULL) { item = ItemAddress( &my_menu, menu_number ); if (MENUNUM(code)==0 && ITEMNUM(code)==2) Quit = TRUE; if (MENUNUM(code)==0 && ITEMNUM(code)==1) { ClearMenuStrip (w); ModifyIDCMP(w,0); EasyRequest(w, &AboutES, NULL, NULL, NULL); ModifyIDCMP(w,CLOSEWINDOW | RAWKEY| GADGETUP| MENUPICK| NEWSIZE| MOUSEBUTTONS| MENUVERIFY); SetMenuStrip(w,&my_menu); } if (MENUNUM(code)==0 && ITEMNUM(code)==0) { NumOfLetters= (int)(6+SUBNUM(code)); strcpy(my_text," OK start over"); PutCommText (); start_new_game(); } code = item->NextSelect; } break; } case GADGETUP: { if (!win && !loose) { if(address == &GiveUpGadget) loose=TRUE; if(address == &JumpGadget) { if (!IntuiBase->FirstScreen->NextScreen) /* Make sure their is more than one screen open. */ { strcpy(my_text,"Nowhere to jump."); PutCommText (); } else { ClearMenuStrip (w); CloseWindow(w); current_screen = (struct Screen *)(current_screen->NextScreen); if ( !current_screen ) /* Make sure we did not reach the end of the screen list */ current_screen=(struct Screen *)(IntuiBase->FirstScreen); ScreenToFront (current_screen); WindowSetup (); w = OpenWindowTagList(&nw,TagList); SetMenuStrip(w,&my_menu); redraw_all (); } } if(address == &DoPegsGadget) { code = 68; /* Simulate Return key */ MoveLetter(); } if(address == &Pos0Gadget) { if (CurrentXPos==0) { code = 77; /* Simulate Down key */ MoveLetter(); } else { PreviousXPos=CurrentXPos; CurrentXPos=0; ArrangeLetters(); } } if(address == &Pos1Gadget) { if (CurrentXPos==1) { code = 77; /* Simulate Down key */ MoveLetter(); } else { PreviousXPos=CurrentXPos; CurrentXPos=1; ArrangeLetters(); } } if(address == &Pos2Gadget) { if (CurrentXPos==2) { code = 77; /* Simulate Down key */ MoveLetter(); } else { PreviousXPos=CurrentXPos; CurrentXPos=2; ArrangeLetters(); } } if(address == &Pos3Gadget) { if (CurrentXPos==3) { code = 77; /* Simulate Down key */ MoveLetter(); } else { PreviousXPos=CurrentXPos; CurrentXPos=3; ArrangeLetters(); } } if(address == &LetterAGadget) { if(CurrentLetter==0) { code=78; /* Simulate Right key pressed */ MoveLetter(); } else { PreviousLetter=CurrentLetter; CurrentLetter=0; ArrangeCurrentLetter(); } } if(address == &LetterBGadget) { if(CurrentLetter==1) { code=78; /* Simulate Right key pressed */ MoveLetter(); } else { PreviousLetter=CurrentLetter; CurrentLetter=1; ArrangeCurrentLetter(); } } if(address == &LetterCGadget) { if(CurrentLetter==2) { code=78; /* Simulate Right key pressed */ MoveLetter(); } else { PreviousLetter=CurrentLetter; CurrentLetter=2; ArrangeCurrentLetter(); } } if(address == &LetterDGadget) { if(CurrentLetter==3) { code=78; /* Simulate Right key pressed */ MoveLetter(); } else { PreviousLetter=CurrentLetter; CurrentLetter=3; ArrangeCurrentLetter(); } } if(address == &LetterEGadget) { if(CurrentLetter==4) { code=78; /* Simulate Right key pressed */ MoveLetter(); } else { PreviousLetter=CurrentLetter; CurrentLetter=4; ArrangeCurrentLetter(); } } if(address == &LetterFGadget) { if(CurrentLetter==5) { code=78; /* Simulate Right key pressed */ MoveLetter(); } else { PreviousLetter=CurrentLetter; CurrentLetter=5; ArrangeCurrentLetter(); } } if( (address==&LetterGGadget) && (NumOfLetters>6) ) { if(CurrentLetter==6) { code=78; /* Simulate Right key pressed */ MoveLetter(); } else { PreviousLetter=CurrentLetter; CurrentLetter=6; ArrangeCurrentLetter(); } } if( (address==&LetterHGadget) && (NumOfLetters>7) ) { if(CurrentLetter==7) { code=78; /* Simulate Right key pressed */ MoveLetter(); } else { PreviousLetter=CurrentLetter; CurrentLetter=7; ArrangeCurrentLetter(); } } if( (address==&LetterIGadget) && (NumOfLetters>8) ) { if(CurrentLetter==8) { code=78; /* Simulate Right key pressed */ MoveLetter(); } else { PreviousLetter=CurrentLetter; CurrentLetter=8; ArrangeCurrentLetter(); } } if( (address==&LetterJGadget) && (NumOfLetters>9) ) { if(CurrentLetter==9) { code=78; /* Simulate Right key pressed */ MoveLetter(); } else { PreviousLetter=CurrentLetter; CurrentLetter=9; ArrangeCurrentLetter(); } } } /* End of if !win && !loose statm.*/ break; } case NEWSIZE: { /* Now the user iconified this */ iconified=TRUE; ClearMenuStrip (w); break; } case CLOSEWINDOW: Quit = TRUE; } } else if (class == NEWSIZE) /* Its iconified we need to put it back*/ { iconified=FALSE; redraw_all(); SetMenuStrip(w,&my_menu); } else if (class == CLOSEWINDOW) Quit=TRUE; if (win && !passed) { strcpy(my_text," Dude you won!"); PutCommText (); strcpy(my_text," Play again."); PutCommText (); passed = TRUE; } if (loose && !passed) { int i; strcpy(my_text,"You lost. It was"); PutCommText (); strcpy(my_text,"XXXX. Try again."); for (i=0; i<4; i++) my_text[i]=65+HiddenLetter[i]; PutCommText (); passed = TRUE; } } /* End main While loop */ ClearMenuStrip (w); CloseWindow(w); } } /* -= END MAIN =- */ void do_borders() { nb.FrontPen = 1; nb.XY = BCommBot; DrawBorder( w->RPort, &nb, 4, 2+current_screen->BarHeight ); nb.XY = BCommTop; DrawBorder( w->RPort, &nb, 4, 2+current_screen->BarHeight ); nb.XY = BBWPegs; DrawBorder( w->RPort, &nb, 4, 2+current_screen->BarHeight ); nb.XY = BPlayArea; DrawBorder( w->RPort, &nb, 4, 2+current_screen->BarHeight ); nb.XY = BLetters; DrawBorder( w->RPort, &nb, 4, 2+current_screen->BarHeight ); nb.XY = BBWPegBorTop; DrawBorder( w->RPort, &nb, 4, 2+current_screen->BarHeight ); nb.XY = BBWPegBorBot; DrawBorder( w->RPort, &nb, 4, 2+current_screen->BarHeight ); nb.XY = BGiveUp; DrawBorder( w->RPort, &nb, 4, 2+current_screen->BarHeight ); nb.XY = BJump; DrawBorder( w->RPort, &nb, 4, 2+current_screen->BarHeight ); nb.FrontPen = 2; nb.XY = WCommBot; DrawBorder( w->RPort, &nb, 4, 2+current_screen->BarHeight ); nb.XY = WCommTop; DrawBorder( w->RPort, &nb, 4, 2+current_screen->BarHeight ); nb.XY = WBWPegs; DrawBorder( w->RPort, &nb, 4, 2+current_screen->BarHeight ); nb.XY = WPlayArea; DrawBorder( w->RPort, &nb, 4, 2+current_screen->BarHeight ); nb.XY = WLetters; DrawBorder( w->RPort, &nb, 4, 2+current_screen->BarHeight ); nb.XY = WGiveUp; DrawBorder( w->RPort, &nb, 4, 2+current_screen->BarHeight ); nb.XY = WJump; DrawBorder( w->RPort, &nb, 4, 2+current_screen->BarHeight ); } void do_dots() { int i; SetAPen(w->RPort,0); RectFill(w->RPort,47,21+current_screen->BarHeight,118,124+current_screen->BarHeight); strcpy(my_text,"o o o o"); nt.IText=my_text; nt.FrontPen = 1; for (i=0; i<(10-CurrentYPos); i++) { PrintIText( w->RPort, &nt, 54, 23+i*10+current_screen->BarHeight ); PrintIText( w->RPort, &nt, 56, 23+i*10+current_screen->BarHeight ); } } void do_gadget_text() { nt.FrontPen = 1; strcpy(my_text,"Give Up"); /* Do the Gadget_text */ PrintIText( w->RPort, &nt, 17, 7+current_screen->BarHeight ); strcpy(my_text,"Jump"); PrintIText( w->RPort, &nt,100, 7+current_screen->BarHeight ); } void write_letters () { int i; nt.FrontPen = 2; for (i=0; i<10; i++) { strcpy(my_text,&Letters[i][0]); if (i == NumOfLetters) nt.FrontPen = 3; PrintIText( w->RPort, &nt, 133, 24+i*10+current_screen->BarHeight ); } } void init_startup_arrays() { int i; strcpy(&Letters[0][0],"A"); strcpy(&Letters[1][0],"B"); strcpy(&Letters[2][0],"C"); strcpy(&Letters[3][0],"D"); strcpy(&Letters[4][0],"E"); strcpy(&Letters[5][0],"F"); strcpy(&Letters[6][0],"G"); strcpy(&Letters[7][0],"H"); strcpy(&Letters[8][0],"I"); strcpy(&Letters[9][0],"J"); for (i=0; i<10; i++) { PosLetterArray[i][0]=10; PosLetterArray[i][1]=10; PosLetterArray[i][2]=10; PosLetterArray[i][3]=10; } init_array(); } void init_array () { PosLetter[0]=10; PosLetter[1]=10; PosLetter[2]=10; PosLetter[3]=10; } void do_BWPegHoles() { int i; SetAPen(w->RPort,0); for (i=0; i<10; i++) { RectFill(w->RPort, 18, 118-i*10+current_screen->BarHeight, 21, 120-i*10+current_screen->BarHeight); RectFill(w->RPort, 25, 118-i*10+current_screen->BarHeight, 28, 120-i*10+current_screen->BarHeight); RectFill(w->RPort, 18, 114-i*10+current_screen->BarHeight, 21, 116-i*10+current_screen->BarHeight); RectFill(w->RPort, 25, 114-i*10+current_screen->BarHeight, 28, 116-i*10+current_screen->BarHeight); } } void do_BWPegBoard() { int i; SetAPen(w->RPort,3); SetDrMd(w->RPort,JAM1); RectFill(w->RPort,16,23+current_screen->BarHeight,30,121+current_screen->BarHeight); SetAPen(w->RPort,1); for (i=0; i<9; i++) { Move(w->RPort, 15, 32+i*10+current_screen->BarHeight); Draw(w->RPort, 30, 32+i*10+current_screen->BarHeight); } } void MoveLetter () { if (code==77) /* DOWN key pressed */ { PreviousLetter=CurrentLetter; CurrentLetter++; if (CurrentLetter==NumOfLetters) CurrentLetter=0; PosLetter[CurrentXPos]=CurrentLetter; PrintMovedLetter(); PrintPos(); } if (code==76) /* UP key pressed */ { PreviousLetter=CurrentLetter; CurrentLetter--; if (CurrentLetter==-1) CurrentLetter=NumOfLetters-1; PosLetter[CurrentXPos]=CurrentLetter; PrintMovedLetter(); PrintPos(); } if ( code == 78 ) /* Right key pressed */ { PreviousXPos=CurrentXPos; CurrentXPos++; if ( CurrentXPos == 4 ) CurrentXPos = 0; if ( PosLetter[CurrentXPos] == 10 ) PosLetter[CurrentXPos]=CurrentLetter; else { PreviousLetter=CurrentLetter; CurrentLetter=PosLetter[CurrentXPos]; PrintMovedLetter(); } PrintPrevPos(); PrintPos(); } if ( code == 79 ) /* Left key pressed */ { PreviousXPos=CurrentXPos; CurrentXPos--; if ( CurrentXPos == -1 ) CurrentXPos = 3; if ( PosLetter[CurrentXPos] == 10 ) PosLetter[CurrentXPos]=CurrentLetter; else { PreviousLetter=CurrentLetter; CurrentLetter=PosLetter[CurrentXPos]; PrintMovedLetter(); } PrintPrevPos(); PrintPos(); } if ( code == 68 ) /* Return key pressed */ { if ( PosLetter[0]!=10 && PosLetter[1]!=10 && PosLetter[2]!=10 && PosLetter[3]!=10 ) { PosLetterArray[CurrentYPos][0]=PosLetter[0]; PosLetterArray[CurrentYPos][1]=PosLetter[1]; PosLetterArray[CurrentYPos][2]=PosLetter[2]; PosLetterArray[CurrentYPos][3]=PosLetter[3]; NextBWPeg = 0; CheckBWPegs(); PreviousXPos=CurrentXPos; PrintPrevPos(); CurrentYPos++; if (CurrentYPos == 10 && !win) loose = TRUE; init_array(); CurrentXPos=0; PosLetter[0]=CurrentLetter; if (win == FALSE && loose == FALSE) PrintPos(); } } } void PrintMovedLetter() { strcpy(my_text,&Letters[PreviousLetter][0]); nt.FrontPen=0; PrintIText( w->RPort, &nt, 135, 25+current_screen->BarHeight+PreviousLetter*10 ); nt.FrontPen=2; if (PreviousLetter > NumOfLetters-1) nt.FrontPen=3; /* Just in case we flipped from a higher level to a lower level */ PrintIText( w->RPort, &nt, 133, 24+current_screen->BarHeight+PreviousLetter*10 ); strcpy(my_text,&Letters[CurrentLetter][0]); nt.FrontPen=1; PrintIText( w->RPort, &nt, 133, 24+current_screen->BarHeight+CurrentLetter*10 ); nt.FrontPen=2; PrintIText( w->RPort, &nt, 135, 25+current_screen->BarHeight+CurrentLetter*10 ); } void PrintPos() { SetAPen(w->RPort,0); RectFill(w->RPort,52+CurrentXPos*16,115+current_screen->BarHeight-CurrentYPos*10,64+CurrentXPos*16,122+current_screen->BarHeight-CurrentYPos*10); nt.FrontPen=1; strcpy(my_text,&Letters[PosLetter[CurrentXPos]][0]); PrintIText( w->RPort, &nt, 54+CurrentXPos*16, 115+current_screen->BarHeight-CurrentYPos*10 ); nt.FrontPen=2; PrintIText( w->RPort, &nt, 56+CurrentXPos*16, 116+current_screen->BarHeight-CurrentYPos*10 ); } void PrintPrevPos() { SetAPen(w->RPort,0); RectFill(w->RPort,52+PreviousXPos*16,115+current_screen->BarHeight-CurrentYPos*10,64+PreviousXPos*16,122+current_screen->BarHeight-CurrentYPos*10); nt.FrontPen=2; strcpy(my_text,&Letters[PosLetter[PreviousXPos]][0]); PrintIText( w->RPort, &nt, 54+PreviousXPos*16, 115+current_screen->BarHeight-CurrentYPos*10 ); } void GenRandNum() { /* Here we'll put RND nums in the array */ ULONG seconds, microns; CurrentTime(&seconds,µns); srand(seconds % (microns % 25)); HiddenLetter[0] = rand() % NumOfLetters; HiddenLetter[2] = rand() % NumOfLetters; srand(microns % (seconds % 19)); HiddenLetter[1] = rand() % NumOfLetters; HiddenLetter[3] = rand() % NumOfLetters; } void CheckBWPegs() { /* First Check for Blacks */ int i,j; SetAPen(w->RPort,1); /* Make pen Black */ for (i=0; i<4; i++) { if (PosLetter[i] == HiddenLetter[i]) PutBWPeg(); } if (NextBWPeg==4) win = TRUE; SetAPen(w->RPort,2); /* Make Pen White */ for (i=0; i<4; i++) { for (j=0; j<4; j++) { if (PosLetter[i]==HiddenLetter[j] && i!=j && HiddenLetter[i]!=PosLetter[i] && HiddenLetter[j]!=PosLetter[j]) { PutBWPeg(); break; } } } } void PutBWPeg() { switch (NextBWPeg) { case 0: { RectFill(w->RPort,18,118-10*CurrentYPos+current_screen->BarHeight,21,120-10*CurrentYPos+current_screen->BarHeight); break;} case 1: { RectFill(w->RPort,25,118-10*CurrentYPos+current_screen->BarHeight,28,120-10*CurrentYPos+current_screen->BarHeight); break;} case 2: { RectFill(w->RPort,18,114-10*CurrentYPos+current_screen->BarHeight,21,116-10*CurrentYPos+current_screen->BarHeight); break;} case 3: RectFill(w->RPort,25,114-10*CurrentYPos+current_screen->BarHeight,28,116-10*CurrentYPos+current_screen->BarHeight); } NextBWPeg++; } void PutCommText() { SetAPen(w->RPort,0); /* Make Pen background */ RectFill(w->RPort,11,132+current_screen->BarHeight,144,152+current_screen->BarHeight); /* Clear Comm box */ nt.FrontPen=1; PrintIText(w->RPort, &nt, 12,142+current_screen->BarHeight); strcpy (CommBoxText[1],CommBoxText[0]); strcpy (CommBoxText[0],my_text); strcpy (my_text,CommBoxText[1]); PrintIText(w->RPort, &nt, 12,133+current_screen->BarHeight); } void start_new_game() { if (CurrentLetter > NumOfLetters-1) /* Changed to lower level */ { init_array(); PreviousLetter = CurrentLetter; CurrentLetter = NumOfLetters-1; PosLetter[CurrentXPos]=CurrentLetter; } CurrentYPos=0; do_BWPegHoles(); /* Now draw the holes on the hint Peg Area */ do_dots(); /* Now draw the 'holes' on the playing area */ PrintPos(); /* Now display the current letter on the current hole position */ write_letters(); /* Now write the selectable letters */ PrintMovedLetter(); /* Now "select" the current letter */ win = FALSE; loose = FALSE; passed = FALSE; GenRandNum (); /* Put random nums in HiddenLetter Array */ } void redraw_all() { do_borders(); /* Now draw graphics using borders */ do_gadget_text(); /* also write the text in the gadgets */ do_BWPegBoard(); /* Now draw the hint PEG area */ do_BWPegHoles(); do_dots(); RectFill(w->RPort,11,132+current_screen->BarHeight,144,152+current_screen->BarHeight); /* Clear Comm box */ nt.FrontPen=1; strcpy (my_text,CommBoxText[0]); PrintIText(w->RPort, &nt, 12,142+current_screen->BarHeight); strcpy (my_text,CommBoxText[1]); PrintIText(w->RPort, &nt, 12,133+current_screen->BarHeight); write_letters(); /* Now write the selectable letters */ PrintMovedLetter(); /* Now "select" the current letter */ if (win != TRUE && loose != TRUE) PrintPos(); /* Now display the current letter on the current hole position */ TempCurrentXPos = CurrentXPos; TempCurrentYPos = CurrentYPos; PosLetterArray[CurrentYPos][0]=PosLetter[0]; PosLetterArray[CurrentYPos][1]=PosLetter[1]; PosLetterArray[CurrentYPos][2]=PosLetter[2]; PosLetterArray[CurrentYPos][3]=PosLetter[3]; for (PreviousXPos=0; PreviousXPos<4; PreviousXPos++) { if (PosLetter[PreviousXPos]!=10 && PreviousXPos!=CurrentXPos) PrintPrevPos(); } for (CurrentYPos=0; CurrentYPosBarHeight - 10*CurrentYPos; Pos1Gadget.TopEdge = 113 + current_screen->BarHeight - 10*CurrentYPos; Pos2Gadget.TopEdge = 113 + current_screen->BarHeight - 10*CurrentYPos; Pos3Gadget.TopEdge = 113 + current_screen->BarHeight - 10*CurrentYPos; DoPegsGadget.TopEdge = 113 + current_screen->BarHeight - 10*CurrentYPos; } void ArrangeLetters() { if ( PosLetter[CurrentXPos] == 10 ) PosLetter[CurrentXPos]=CurrentLetter; else { PreviousLetter=CurrentLetter; CurrentLetter=PosLetter[CurrentXPos]; PrintMovedLetter(); } PrintPrevPos(); PrintPos(); } void ArrangeCurrentLetter () { PosLetter[CurrentXPos]=CurrentLetter; PrintMovedLetter(); PrintPos(); } void WindowSetup () { nw.Screen = current_screen; nw.Height = 160 + current_screen->BarHeight; menu_item_1.Height = 2 + current_screen->Font->ta_YSize; menu_item_2.Height = menu_item_1.Height; menu_item_3.Height = menu_item_1.Height; menu1_sub1.Height = menu_item_1.Height; menu1_sub2.Height = menu_item_1.Height; menu1_sub3.Height = menu_item_1.Height; menu1_sub4.Height = menu_item_1.Height; menu1_sub5.Height = menu_item_1.Height; menu_item_2.TopEdge = menu_item_1.Height; menu_item_3.TopEdge = 2 * menu_item_1.Height; menu1_sub2.TopEdge = menu_item_1.Height; menu1_sub3.TopEdge = 2 * menu_item_1.Height; menu1_sub4.TopEdge = 3 * menu_item_1.Height; menu1_sub5.TopEdge = 4 * menu_item_1.Height; GiveUpGadget.TopEdge = 4 + current_screen->BarHeight; JumpGadget.TopEdge = 4 + current_screen->BarHeight; LetterAGadget.TopEdge= 23 + current_screen->BarHeight; LetterBGadget.TopEdge= 33 + current_screen->BarHeight; LetterCGadget.TopEdge= 43 + current_screen->BarHeight; LetterDGadget.TopEdge= 53 + current_screen->BarHeight; LetterEGadget.TopEdge= 63 + current_screen->BarHeight; LetterFGadget.TopEdge= 73 + current_screen->BarHeight; LetterGGadget.TopEdge= 83 + current_screen->BarHeight; LetterHGadget.TopEdge= 93 + current_screen->BarHeight; LetterIGadget.TopEdge= 103 + current_screen->BarHeight; LetterJGadget.TopEdge= 113 + current_screen->BarHeight; MyArray[0]=(WORD)(current_screen->Width-179); MyArray[1]=0; MyArray[2]=156; MyArray[3]=(WORD)(1+current_screen->BarHeight); } routing_that_is_never_called() { _waitwbmsg(); /* This routine is just to have two entry points both wb and cli */ }