1 #include "body.h"
2 
3 void
GetGameSize(int state,int & xsize,int & ysize)4 GetGameSize(int state, int &xsize, int &ysize)
5 {
6     switch(state%NUM_GAME) {
7     case 1:
8         xsize = 24;
9         ysize = 12;
10         break;
11     case 2:
12         xsize = 36;
13         ysize = 16;
14         break;
15     default: // expected 0
16         xsize = 18;
17         ysize =  8;
18         break;
19     }
20 }
21 
22 void
GetBoardSizeFromGameSize(int xsize,int ysize,int & width,int & height)23 GetBoardSizeFromGameSize(int xsize, int ysize, int &width, int &height)
24 {
25     if (globRes.fitPixmap) {
26         // When fitPixmap is True, Width and Height resources are ignored,
27         // but magFactor is still valid.
28         unsigned int w, h;
29         Mp[0].GetSize(w, h);
30         width  = (w + 2*XMARGIN) * (xsize+2);
31         height = (h + 2*YMARGIN) * (ysize+2);
32         width  = (int) (width  * globRes.magFactor);
33         height = (int) (height * globRes.magFactor);
34     }
35 
36     if (width < MIN_WIN_WID)
37         width = MIN_WIN_WID;
38     if (width > max_win_wid)
39         width = max_win_wid;
40     if (height< MIN_WIN_HEI)
41         height= MIN_WIN_HEI;
42     if (height> max_win_hei)
43         height= max_win_hei;
44 }
45 
46 void
SetGameStart(void)47 SetGameStart(void)
48 {
49     bd->GameOver();
50     mb->DisableRestart();
51     bd->Sort();
52     if (globRes.autoDemo) {
53         XtAppAddTimeOut(app_context, 2000,
54                         (XtTimerCallbackProc)AutoDemoCB, NULL);
55         mb->DemoMode();
56         bd->SetDemo(1);
57         bd->Shuffle();
58     } else {
59         bd->SetDemo(0);
60     }
61 }
62