rnd-19981026-2
[rocksndiamonds.git] / src / init.c
index ce82c209eb9c6dbeeaa5490c1d8976831303d17f..488b4338c53a819df4c536e528a204ea2b5414f6 100644 (file)
@@ -94,37 +94,17 @@ void InitLevelAndPlayerInfo()
 {
   int i;
 
-  /* initialize local player's setup */
-  setup.sound_on = TRUE;
-  setup.sound_loops_on = FALSE;
-  setup.sound_music_on = FALSE;
-  setup.sound_simple_on = FALSE;
-  setup.toons_on = TRUE;
-  setup.direct_draw_on = FALSE;
-  setup.scroll_delay_on = FALSE;
-  setup.soft_scrolling_on = TRUE;
-  setup.fading_on = FALSE;
-  setup.autorecord_on = FALSE;
-  setup.quick_doors = FALSE;
-  setup.joystick_nr = 0;
-
   /* choose default local player */
   local_player = &stored_player[0];
+  for (i=0; i<MAX_PLAYERS; i++)
+    stored_player[i].connected = FALSE;
+  local_player->connected = TRUE;
 
   if (!LoadLevelInfo())                        /* global level info */
     Error(ERR_EXIT, NULL);
 
-  LoadPlayerInfo(PLAYER_SETUP);                /* global setup info */
-  LoadPlayerInfo(PLAYER_LEVEL);                /* level specific info */
-
-  /* after LoadPlayerInfo(), because it overwrites 'local_player' */
-  for (i=0; i<MAX_PLAYERS; i++)
-  {
-    stored_player[i].connected = FALSE;
-    stored_player[i].local = FALSE;
-  }
-  local_player->connected = TRUE;
-  local_player->local = TRUE;
+  LoadSetup();                         /* global setup info */
+  LoadLevelSetup();                    /* info about last played level */
 }
 
 void InitNetworkServer()
@@ -156,14 +136,14 @@ void InitSound()
 #ifndef MSDOS
   if (access(sound_device_name,W_OK)<0)
   {
-    Error(ERR_RETURN, "cannot access sound device - no sounds");
+    Error(ERR_WARN, "cannot access sound device - no sounds");
     sound_status = SOUND_OFF;
     return;
   }
 
   if ((sound_device = open(sound_device_name,O_WRONLY))<0)
   {
-    Error(ERR_RETURN, "cannot open sound device - no sounds");
+    Error(ERR_WARN, "cannot open sound device - no sounds");
     sound_status = SOUND_OFF;
     return;
   }
@@ -173,11 +153,19 @@ void InitSound()
 
 #ifdef VOXWARE
   sound_loops_allowed = TRUE;
+
+  /*
   setup.sound_loops_on = TRUE;
+  */
+
 #endif
 #else
   sound_loops_allowed = TRUE;
+
+  /*
   setup.sound_loops_on = TRUE;
+  */
+
 #endif
 
   for(i=0; i<NUM_SOUNDS; i++)
@@ -202,14 +190,14 @@ void InitSoundServer()
 #ifndef MSDOS
   if (pipe(sound_pipe)<0)
   {
-    Error(ERR_RETURN, "cannot create pipe - no sounds");
+    Error(ERR_WARN, "cannot create pipe - no sounds");
     sound_status = SOUND_OFF;
     return;
   }
 
   if ((sound_process_id = fork()) < 0)
   {       
-    Error(ERR_RETURN, "cannot create sound server process - no sounds");
+    Error(ERR_WARN, "cannot create sound server process - no sounds");
     sound_status = SOUND_OFF;
     return;
   }
@@ -230,23 +218,25 @@ void InitSoundServer()
 
 void InitJoystick()
 {
+  int joystick_nr = setup.input[0].joystick_nr;
+
   if (global_joystick_status == JOYSTICK_OFF)
     return;
 
 #ifndef MSDOS
-  if (access(joystick_device_name[setup.joystick_nr], R_OK) < 0)
+  if (access(joystick_device_name[joystick_nr], R_OK) < 0)
   {
-    Error(ERR_RETURN, "cannot access joystick device '%s'",
-         joystick_device_name[setup.joystick_nr]);
+    Error(ERR_WARN, "cannot access joystick device '%s'",
+         joystick_device_name[joystick_nr]);
     joystick_status = JOYSTICK_OFF;
     return;
   }
 
   if ((joystick_device =
-       open(joystick_device_name[setup.joystick_nr], O_RDONLY)) < 0)
+       open(joystick_device_name[joystick_nr], O_RDONLY)) < 0)
   {
-    Error(ERR_RETURN, "cannot open joystick device '%s'",
-         joystick_device_name[setup.joystick_nr]);
+    Error(ERR_WARN, "cannot open joystick device '%s'",
+         joystick_device_name[joystick_nr]);
     joystick_status = JOYSTICK_OFF;
     return;
   }