rnd-20091023-1-src
[rocksndiamonds.git] / src / game_sp / init.c
1
2 #include "main_sp.h"
3 #include "global.h"
4
5
6 Bitmap *sp_objects;
7
8 Bitmap *screenBitmap;
9
10 #if 0
11 static void BlitScreenToBitmap_SP__Stage_Blt()
12 {
13   BlitScreenToBitmap_SP(window);
14 }
15 #endif
16
17 static void init_struct_functions()
18 {
19 #if 1
20   Stage.Blt = &DDScrollBuffer_Blt;
21 #else
22   Stage.Blt = &BlitScreenToBitmap_SP__Stage_Blt;
23 #endif
24
25   Stage.ScrollTo      = &DDScrollBuffer_ScrollTo;
26   Stage.ScrollTowards = &DDScrollBuffer_ScrollTowards;
27   Stage.SoftScrollTo  = &DDScrollBuffer_SoftScrollTo;
28
29   StretchedSprites.BltEx = &DDSpriteBuffer_BltEx;
30 }
31
32 static void init_global_values()
33 {
34   menBorder.Checked = True * 0;
35   menPanel.Checked = True;
36   menAutoScroll.Checked = True;
37
38   MainForm.picPane.Width  = picPane.Width  = SCR_FIELDX * TILEX;
39   MainForm.picPane.Height = picPane.Height = SCR_FIELDY * TILEY;
40 }
41
42 void sp_open_all()
43 {
44   init_struct_functions();
45   init_global_values();
46
47   Form_Load();
48
49   SetBitmaps_SP(&sp_objects);
50
51 #if 1
52   screenBitmap = CreateBitmap(60 * TILEX, 24 * TILEY,
53                               DEFAULT_DEPTH);
54 #else
55   screenBitmap = CreateBitmap(MAX_BUF_XSIZE * TILEX, MAX_BUF_YSIZE * TILEY,
56                               DEFAULT_DEPTH);
57 #endif
58
59   DDSpriteBuffer_CreateFromFile("[NONE]", 16, 16);
60 }
61
62 void sp_close_all()
63 {
64 }
65
66 unsigned int InitEngineRandom_SP(long seed)
67 {
68   if (seed == NEW_RANDOMIZE)
69   {
70     subRandomize();
71
72     seed = (long)RandomSeed;
73   }
74
75   RandomSeed = (short)seed;
76
77   return (unsigned int) seed;
78 }