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