long i;
// byte T;
+#if 1
+ // CurPath = "/home/aeglos/projects/rocksndiamonds/levels/TEST_supaplex/supaplex/levels.dat";
+ CurPath = "/home/aeglos/projects/rocksndiamonds/supaplex_demo_JENS0001.sp";
+ LevelNumber = 1;
+#endif
+
DemoAvailable = False;
if (STRING_IS_LIKE(CurPath, "*.mpx"))
{
+ printf("::: reading MPX file ...\n");
+
ReadMPX();
return;
}
if (STRING_IS_LIKE(CurPath, "*.sp"))
{
+ printf("::: reading SP file ...\n");
+
ReadDemo();
return;
}
if (DemoFlag != 0)
{
+ printf("::: reading demo file ...\n");
+
ReadDemo();
return;
}
+ printf("::: reading level file ...\n");
+
FileMax = 0;
FieldWidth = 60;
FieldHeight = 24;
// --- On Error GoTo ReadLevelEH
-#if 1
- CurPath = "/home/aeglos/projects/rocksndiamonds/levels/TEST_supaplex/supaplex/levels.dat";
- LevelNumber = 1;
-#endif
-
printf("::: '%s', %d\n", CurPath, LevelNumber);
FNum = fopen(CurPath, "rb");
#else
FILE_GET(FNum, i, &PlayField8, sizeof(PlayField8));
#endif
+
i = (LevelNumber) * ((long)(FieldMax) + 1) + 1 - HeaderSize;
FILE_GET(FNum, i, &LInfo, sizeof(LInfo)); // store level info in an extra structure
}
#endif
- AnimationPosTable = REDIM_1D(sizeof(int), 0, LevelMax - 2 *FieldWidth);
- AnimationSubTable = REDIM_1D(sizeof(byte), 0, LevelMax - 2 *FieldWidth);
+ AnimationPosTable = REDIM_1D(sizeof(int), 0, LevelMax - 2 * FieldWidth);
+ AnimationSubTable = REDIM_1D(sizeof(byte), 0, LevelMax - 2 * FieldWidth);
TerminalState = REDIM_1D(sizeof(byte), FieldWidth, LevelMax - FieldWidth);
GravityFlag = LInfo.InitialGravity;
FieldWidth = 60;
FieldHeight = 24;
HeaderSize = 96;
+
FieldMax = (FieldWidth * FieldHeight) + HeaderSize - 1;
LevelMax = (FieldWidth * FieldHeight) - 1;
// --- On Error GoTo ReadDemoEH
+
FileMax = FileLen(CurPath) - 1;
+
PlayField8 = REDIM_1D(sizeof(byte), 0, FileMax + 1 - 1);
DisPlayField = REDIM_1D(sizeof(byte), 0, FieldMax + 1 - 1);
+
// FNum = FreeFile();
+
FNum = fopen(CurPath, "rb");
+
i = (LevelNumber - 1) * ((long)(FieldMax) + 1) + 1;
#if 1
FILE_GET(FNum, i, PlayField8, FileMax + 1);
#else
FILE_GET(FNum, i, &PlayField8, sizeof(PlayField8));
#endif
+
i = (LevelNumber) * ((long)(FieldMax) + 1) + 1 - HeaderSize;
FILE_GET(FNum, i, &LInfo, sizeof(LInfo)); // store level info in an extra structure
+
fclose(FNum);
+
// --- On Error GoTo 0
if (FieldMax < FileMax)
DemoAvailable = True;
ReadSignature();
+
PlayField16 = REDIM_1D(sizeof(int), -FieldWidth, FieldMax);
+
for (i = 0; i <= FieldMax; i++)
{
PlayField16[i] = PlayField8[i];
PlayField8[i] = 0;
}
- AnimationPosTable = REDIM_1D(sizeof(int), 0, LevelMax - 2 *FieldWidth);
- AnimationSubTable = REDIM_1D(sizeof(byte), 0, LevelMax - 2 *FieldWidth);
+ AnimationPosTable = REDIM_1D(sizeof(int), 0, LevelMax - 2 * FieldWidth);
+ AnimationSubTable = REDIM_1D(sizeof(byte), 0, LevelMax - 2 * FieldWidth);
TerminalState = REDIM_1D(sizeof(byte), 0, FieldMax + 1 - 1);
+
DemoPointer = FieldMax + 1;
DemoOffset = DemoPointer;
DemoKeyRepeatCounter = 0;
+
// DemoFlag = 1
// DemoAvailable = True
+
GravityFlag = LInfo.InitialGravity;
FreezeZonks = LInfo.InitialFreezeZonks;
+
RandomSeed = LInfo.DemoRandomSeed;
+
LevelLoaded = True;
+
return;
#if 0
if (DemoFlag != 0)
{
+ printf("::: playing demo ...\n");
+
// EP set level success byte: demo, not game
WasDemoFlag = 1;
EP_GameDemoVar0DAA = 0; // demo
}
else // loc_g_1836:
{
+ printf("::: playing game ...\n");
+
// EP set level success byte: game, not demo
WasDemoFlag = 0;
EP_GameDemoVar0DAA = 1; // game
Ay = MainForm.picPane.Height / 2;
}
+#if 1
+ ScreenScrollXPos = Stretch * (MurphyScreenXPos + 16) - ax;
+ ScreenScrollYPos = Stretch * (MurphyScreenYPos + 16) - Ay;
+#else
ScreenScrollXPos = Stretch * (MurphyScreenXPos + 8) - ax;
ScreenScrollYPos = Stretch * (MurphyScreenYPos + 8) - Ay;
+#endif
#if 0
printf("::: MainGameLoop.c: subCalculateScreenScrollPos(): %d, %d [%d, %d] -> %d, %d\n",