rnd-19981017-1
[rocksndiamonds.git] / src / tape.c
index 33713069c4da4302fe7bddfe685a2ef27612b0ac..01eb1d41737a58d609c2c62bc68488cf5a64609c 100644 (file)
@@ -1,12 +1,12 @@
 /***********************************************************
 *  Rocks'n'Diamonds -- McDuffin Strikes Back!              *
 *----------------------------------------------------------*
-*  ©1997 Artsoft Development                               *
-*        Holger Schemel                                    *
-*        33604 Bielefeld                                   *
-*        Telefon: (0521) 290471                            *
-*        eMail: aeglos@valinor.owl.de                      *
-*               aeglos@uni-paderborn.de                    *
+*  (c) 1995-98 Artsoft Entertainment                       *
+*              Holger Schemel                              *
+*              Oststrasse 11a                              *
+*              33604 Bielefeld                             *
+*              phone: ++49 +521 290471                     *
+*              email: aeglos@valinor.owl.de                *
 *----------------------------------------------------------*
 *  tape.c                                                  *
 ***********************************************************/
@@ -42,10 +42,14 @@ void TapeStartRecording()
 
 void TapeStopRecording()
 {
+  int i;
+
   if (!tape.recording)
     return;
 
-  tape.pos[tape.counter].joystickdata = 0;
+  for(i=0; i<MAX_PLAYERS; i++)
+    tape.pos[tape.counter].action[i] = 0;
+
   tape.counter++;
   tape.length = tape.counter;
   tape.length_seconds = GetTapeLength();
@@ -54,8 +58,10 @@ void TapeStopRecording()
   DrawVideoDisplay(VIDEO_STATE_REC_OFF,0);
 }
 
-void TapeRecordAction(int joy)
+void TapeRecordAction(byte joy[MAX_PLAYERS])
 {
+  int i;
+
   if (!tape.recording || tape.pausing)
     return;
 
@@ -65,16 +71,17 @@ void TapeRecordAction(int joy)
     return;
   }
 
-  if (joy)
-  {
-    tape.pos[tape.counter].joystickdata = joy;
-    tape.counter++;
-    tape.pos[tape.counter].delay = 0;
-  }
+  for(i=0; i<MAX_PLAYERS; i++)
+    tape.pos[tape.counter].action[i] = joy[i];
+
+  tape.counter++;
+  tape.pos[tape.counter].delay = 0;
 }
 
 void TapeRecordDelay()
 {
+  int i;
+
   if (!tape.recording || tape.pausing)
     return;
 
@@ -86,9 +93,11 @@ void TapeRecordDelay()
 
   tape.pos[tape.counter].delay++;
 
-  if (tape.pos[tape.counter].delay>=255)
+  if (tape.pos[tape.counter].delay >= 255)
   {
-    tape.pos[tape.counter].joystickdata = 0;
+    for(i=0; i<MAX_PLAYERS; i++)
+      tape.pos[tape.counter].action[i] = 0;
+
     tape.counter++;
     tape.pos[tape.counter].delay = 0;
   }
@@ -139,28 +148,35 @@ void TapeStopPlaying()
   DrawVideoDisplay(VIDEO_STATE_PLAY_OFF,0);
 }
 
-int TapePlayAction()
+int *TapePlayAction()
 {
+  static int joy[MAX_PLAYERS];
+  int i;
+
   if (!tape.playing || tape.pausing)
-    return(0);
+    return(NULL);
 
   if (tape.counter>=tape.length)
   {
     TapeStop();
-    return(0);
+    return(NULL);
   }
 
   if (tape.delay_played == tape.pos[tape.counter].delay)
   {
     tape.delay_played = 0;
     tape.counter++;
-    return(tape.pos[tape.counter-1].joystickdata);
+
+    for(i=0; i<MAX_PLAYERS; i++)
+      joy[i] = tape.pos[tape.counter-1].action[i];
+
+    return(joy);
   }
-  else
-    return(0);
+
+  return(NULL);
 }
 
-BOOL TapePlayDelay()
+boolean TapePlayDelay()
 {
   if (!tape.playing || tape.pausing)
     return(FALSE);
@@ -226,5 +242,5 @@ unsigned int GetTapeLength()
   for(i=0;i<tape.length;i++)
     tape_length += tape.pos[i].delay;
 
-  return(tape_length * GAME_FRAME_DELAY / 100);
+  return(tape_length * GAME_FRAME_DELAY / 1000);
 }