rnd-20100207-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 static void init_struct_functions()
11 {
12   Stage.Blt           = &DDScrollBuffer_Blt;
13   Stage.ScrollTo      = &DDScrollBuffer_ScrollTo;
14   Stage.ScrollTowards = &DDScrollBuffer_ScrollTowards;
15   Stage.SoftScrollTo  = &DDScrollBuffer_SoftScrollTo;
16
17   StretchedSprites.BltEx  = &DDSpriteBuffer_BltEx;
18   StretchedSprites.BltImg = &DDSpriteBuffer_BltImg;
19 }
20
21 static void init_global_values()
22 {
23   menBorder.Checked = False;
24   menPanel.Checked = True;
25   menAutoScroll.Checked = True;
26
27   MainForm.picPane.Width  = picPane.Width  = SCR_FIELDX * TILEX;
28   MainForm.picPane.Height = picPane.Height = SCR_FIELDY * TILEY;
29 }
30
31 void sp_open_all()
32 {
33   init_struct_functions();
34   init_global_values();
35
36   Form_Load();
37
38   SetBitmaps_SP(&sp_objects);
39
40 #if 0
41   /* too small for oversized levels, but too big for graphics performance */
42   /* (the whole playfield is drawn/updated, not only visible/scrolled area) */
43   /* !!! FIX THIS !!! */
44   screenBitmap = CreateBitmap(60 * TILEX, 24 * TILEY,
45                               DEFAULT_DEPTH);
46 #else
47   screenBitmap = CreateBitmap(MAX_BUF_XSIZE * TILEX, MAX_BUF_YSIZE * TILEY,
48                               DEFAULT_DEPTH);
49 #endif
50
51   DDSpriteBuffer_CreateFromFile("[NONE]", 16, 16);
52 }
53
54 void sp_close_all()
55 {
56 }
57
58 unsigned int InitEngineRandom_SP(long seed)
59 {
60   if (seed == NEW_RANDOMIZE)
61   {
62 #if 0
63   printf("::: init.c: InitEngineRandom_SP(): subRandomize()\n");
64 #endif
65
66     subRandomize();
67
68     seed = (long)RandomSeed;
69   }
70
71   RandomSeed = (short)seed;
72
73 #if 0
74   printf("::: init.c: InitEngineRandom_SP(): RandomSeed == %d\n", RandomSeed);
75 #endif
76
77   return (unsigned int) seed;
78 }