+2009-09-23
+ * fixed bug when reading Supaplex single level files (preventing loader
+ from seeking to level position like in Supaplex level package files)
+
2009-08-01
* first classic Supaplex level running and solved by solution/demo tape
-#define COMPILE_DATE_STRING "2009-09-19 02:10"
+#define COMPILE_DATE_STRING "2009-09-25 20:53"
}
/* position file stream to the requested level inside the level package */
- if (fseek(file, nr * SP_LEVEL_SIZE, SEEK_SET) != 0)
+ if (level_file_info->packed &&
+ fseek(file, nr * SP_LEVEL_SIZE, SEEK_SET) != 0)
{
level->no_valid_file = TRUE;
int subAnimateTerminals;
// int bl, ax, al, X, Y;
+#if 1
+ short bl, al, X, Y;
+#else
int bl, al, X, Y;
+#endif
if (LowByte(PlayField16[si]) != fiTerminal)
return subAnimateTerminals;
}
#endif
+#if 1
+ printf("::: BugsTerminals.c: ========== subRandomize()\n");
+#endif
+
return subRandomize;
} // subRandomize
if (0x8000 == (RandomSeed & 0x8000))
RSeed = RSeed | 0x8000;
+#if 0
+ /* !!! TEST !!! */
+ Tmp = 0xFFFF & (((0x5E5 * RSeed) & 0xFFFF) + 0x31);
+#else
Tmp = 0xFFFF & (((0x5E5 * RandomSeed) & 0xFFFF) + 0x31);
+#endif
RandomSeed = 0x7FFF & Tmp;
if ((Tmp & 0x8000) != 0)
RandomSeed = RandomSeed | 0x8000;
// Mov randomseed, ax
// shr ax,1
+#if 0
+ printf("::: BugsTerminals.c: ---------- subGetRandomNumber(): %d\n",
+ subGetRandomNumber);
+#endif
+
return subGetRandomNumber;
} // subGetRandomNumber
-
// Public DisplayMin%, DisplayMax%, DisplayWidth%, DisplayHeight%
-int TimerVar, RandomSeed;
+int TimerVar;
+#if 1
+short RandomSeed;
+#else
+int RandomSeed;
+#endif
currency DeltaT; // Interval between two frames (in ms)
long DeltaTPlay, DeltaTDemo;
boolean BlockingSpeed;
CurPath = "/home/aeglos/projects/rocksndiamonds/supaplex_demo_JENS0001.sp";
LevelNumber = 1;
#else
+
+#if 0
+ // sprintf(CurPathTEST, "/home/aeglos/projects/rocksndiamonds/levels/TEST_supaplex/test_solutions/%03d.sp", level_nr);
+
+ sprintf(CurPathTEST, "/home/aeglos/projects/Level_Stuff/SUPAPLEX/SUPAPLEX_LEVELS/Set77/77S%03d.SP", level_nr);
+#else
sprintf(CurPathTEST, "/home/aeglos/projects/Level_Stuff/SUPAPLEX/SUPAPLEX_LEVELS/solve00/JENS%04d.SP", level_nr);
+#endif
+
CurPath = CurPathTEST;
LevelNumber = level_nr;
#endif
printf("::: Globals.c: ReadDemo(): %d / %d\n", GravityFlag, FreezeZonks);
#endif
- RandomSeed = LInfo.DemoRandomSeed;
+
+
+#if 0
+ /* !!! TESTING BIG / LITTLE ENDIAN STUFF !!! */
+ LInfo.DemoRandomSeed =
+ LowByte(LInfo.DemoRandomSeed) << 8 |
+ HighByte(LInfo.DemoRandomSeed);
+ for (i = 0; i < 10; i++)
+ LInfo.SpecialPort[i].PortLocation =
+ LowByte(LInfo.SpecialPort[i].PortLocation) << 8 |
+ HighByte(LInfo.SpecialPort[i].PortLocation);
+
+ printf("::: swapping file bytes for DemoRandomSeed etc.\n");
+#else
+ printf("::: keeping file bytes in (maybe wrong) 'native' order.\n");
+#endif
#if 1
+ printf("::: LInfo.DemoRandomSeed == %d\n", LInfo.DemoRandomSeed);
+#endif
+
+ RandomSeed = LInfo.DemoRandomSeed;
+
+#if 0
+ printf("::: SpeedByte == %d\n", LInfo.SpeedByte);
+ printf("::: CheckSumByte == %d\n", LInfo.CheckSumByte);
printf("::: RandomSeed == %d\n", RandomSeed);
-#if 1
+#if 0
{
int i;
for (i = 0; i < 10; i++)
printf("::: TEST random number: %d\n", subGetRandomNumber());
-
- int buffer, value = -3;
-
- MovHighByte(&buffer, value);
- value = SgnHighByte(buffer);
-
- printf("::: TEST: 0x%08x / %d\n", value, value);
}
#endif
extern int FreezeZonks;
extern int HeaderSize;
extern int LevelNumber;
-extern int TimerVar, RandomSeed;
+extern int TimerVar;
+extern short RandomSeed;
extern long DeltaTPlay, DeltaTDemo;
extern long FileMax;
extern long SignatureDelay;
return subAnimateMurphy;
#if 1
- printf("::: Murphy.c: !!!!!!!!!! GAME SOLVED !!!!!!!!!!\n");
+ printf("::: Murphy.c: !!!!!!!!!! LEVEL %d SOLVED !!!!!!!!!!\n", LevelNumber);
#endif
subSoundFXExit();
int i, cx, bx;
+#if 1
+ cx = LInfo.SpecialPortCount; // number of special ports
+
+ for (i = 0; i < cx; i++)
+ {
+ bx = HighByte(LInfo.SpecialPort[i].PortLocation);
+ MovHighByte(&bx, LowByte(LInfo.SpecialPort[i].PortLocation));
+
+ if (bx / 2 == si)
+ {
+ GravityFlag = LInfo.SpecialPort[i].Gravity;
+ FreezeZonks = LInfo.SpecialPort[i].FreezeZonks;
+ SnikSnaksElectronsFrozen = LInfo.SpecialPort[i].FreezeEnemies;
+
+ // RandomTime = RandomTime Xor RandomSeed 'is RandomTime used at all? no!
+
+ break;
+ }
+ }
+
+#else
+
cx = LInfo.SpecialPortCount; // number of special ports
for (i = 1; i <= cx; i++)
{
// RandomTime = RandomTime Xor RandomSeed 'is RandomTime used at all? no!
i = cx + 1;
}
-
}
}
+#endif
return subSpPortTest;
} // subSpPortTest
#ifndef HAS_SpecialPortType
typedef struct
{
+#if 1
+ short PortLocation; // = 2*(x+(y*60))
+#else
int PortLocation; // = 2*(x+(y*60))
+#endif
byte Gravity; // 1 = turn on, anything else (0) = turn off
byte FreezeZonks; // 2 = turn on, anything else (0) = turn off (1=off!)
byte FreezeEnemies; // 1 = turn on, anything else (0) = turn off
// amount of Infotrons in the level, and use the low byte of that number.
// (A multiple of 256 Infotrons will then result in 0-to-eat, etc.!)
byte SpecialPortCount; // Maximum 10 allowed!
- SpecialPortType SpecialPort[10 + 1];
+ SpecialPortType SpecialPort[10];
byte SpeedByte; // = Speed XOR Highbyte(RandomSeed)
byte CheckSumByte; // = CheckSum XOR SpeedByte
+#if 1
+ short DemoRandomSeed;
+#else
int DemoRandomSeed;
+#endif
} LevelInfoType;
#define HAS_LevelInfoType
#endif