X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Fgame_sp%2FInitGameConditions.c;h=1641862ff1549041dde23437b1aeb378ce8392f1;hp=937d4dc543d3c5d8e5a85139f0c28b54ee877f00;hb=115ce6f2da1914d68b0fe0e5f9082973190dacdd;hpb=ce0bba1a070e5e64939491eb68087f68ef8fe870 diff --git a/src/game_sp/InitGameConditions.c b/src/game_sp/InitGameConditions.c index 937d4dc5..1641862f 100644 --- a/src/game_sp/InitGameConditions.c +++ b/src/game_sp/InitGameConditions.c @@ -10,38 +10,29 @@ // Init game conditions (variables) // ========================================================================== -void subInitGameConditions() +void subInitGameConditions(void) { - bCapturePane = False; - - MurphyVar0DAC = MurphyYPos; - MurphyVar0DAE = MurphyXPos; MurphyVarFaceLeft = 0; - KillMurphyFlag = 0; // no "kill Murphy" + KillMurphyFlag = 0; // no "kill Murphy" ExitToMenuFlag = 0; - LeadOutCounter = 0; // quit flag: lead-out counter - RedDiskCount = 0; // Red disk counter - - // ShowRedDiskCounter = 0; // show-red-disk time-out + LeadOutCounter = 0; // quit flag: lead-out counter + RedDiskCount = 0; // Red disk counter - YawnSleepCounter = 0; // Wake up sleeping Murphy + YawnSleepCounter = 0; // Wake up sleeping Murphy - ExplosionShake = 0; // Force explosion flag off + ExplosionShake = 0; // Force explosion flag off + ExplosionShakeMurphy = 0; // Force explosion flag off TerminalMaxCycles = 0x7F; YellowDisksExploded = 0; TimerVar = 0; - // ShowPanel = 1 ' Force Panel on - // MainForm.PanelVisible = True; + SnikSnaksElectronsFrozen = 0; // Snik-Snaks and Electrons move! - EnterRepeatCounter = 0; // restart Enter repeat counter - SnikSnaksElectronsFrozen = 0; // Snik-Snaks and Electr. move! - - SplitMoveFlag = 0; // Reset Split-through-ports - RedDiskReleasePhase = 0; // (re-)enable red disk release - RedDiskReleaseMurphyPos = 0; // Red disk was released here + SplitMoveFlag = 0; // Reset Split-through-ports + RedDiskReleasePhase = 0; // (re-)enable red disk release + RedDiskReleaseMurphyPos = 0; // Red disk was released here } @@ -50,11 +41,11 @@ void subInitGameConditions() // Locate Murphy and init location. // ========================================================================== -void InitMurphyPos() +void InitMurphyPos(void) { int si; - for (si = 0; si <= LevelMax - 1; si++) + for (si = 0; si < LevelMax; si++) if (PlayField16[si] == fiMurphy) break; @@ -65,17 +56,11 @@ void InitMurphyPos() void InitMurphyPosB(int si) { - MurphyYPos = GetStretchY(si) / Stretch; - MurphyXPos = GetStretchX(si) / Stretch; - - MurphyScreenXPos = GetStretchX(si); // Murphy's screen x-position - MurphyScreenYPos = GetStretchY(si); // Murphy's screen y-position + MurphyScreenXPos = MurphyXPos = GetStretchX(si); // Murphy's screen x-position + MurphyScreenYPos = MurphyYPos = GetStretchY(si); // Murphy's screen y-position // To Do: draw Murphy in location ax - StretchedSprites.BltImg(MurphyScreenXPos, MurphyScreenYPos, aniMurphy, 0); - - MurphyScreenXPos = MurphyScreenXPos / Stretch; - MurphyScreenYPos = MurphyScreenYPos / Stretch; + DDSpriteBuffer_BltImg(MurphyScreenXPos, MurphyScreenYPos, aniMurphy, 0); subCalculateScreenScrollPos(); // calculate screen start addrs @@ -94,7 +79,7 @@ void InitMurphyPosB(int si) // Convert to easy symbols and reset Infotron count If not ThenVer62 // ========================================================================== -int subConvertToEasySymbols() +int subConvertToEasySymbols(void) { int ax, bx, cx, dx, i; int al; @@ -227,13 +212,11 @@ loc_g_2778: void ResetInfotronsNeeded(int dx) { - if (LInfo.InfotronsNeeded != 0) // Jump If equal (autodetect) - { + if (LInfo.InfotronsNeeded != 0) // Jump If equal (autodetect) dx = LInfo.InfotronsNeeded; - } // loc_g_278D: - InfotronsNeeded = LowByte(dx); // Remaining Infotrons needed - TotalInfotronsNeeded = InfotronsNeeded; // Number of Infotrons needed + InfotronsNeeded = LowByte(dx); // Remaining Infotrons needed + TotalInfotronsNeeded = InfotronsNeeded; // Number of Infotrons needed } @@ -242,90 +225,35 @@ void ResetInfotronsNeeded(int dx) // Fetch and initialize a level // ========================================================================== -void subFetchAndInitLevelB() +void subFetchAndInitLevelB(void) { - boolean UpdatePlayTime; - - data_scr_demo = 0; - UpdatePlayTime = (0 == demo_stopped ? True : False); - demo_stopped = 0; - - subFetchAndInitLevelA(UpdatePlayTime); + subFetchAndInitLevelA(); } -void subFetchAndInitLevelA(boolean UpdatePlayTime) +void subFetchAndInitLevelA(void) { - if (UpdatePlayTime && (0 == demo_stopped)) - { - subUpdatePlayingTime(); // update playing time - } - - D_ModeFlag = 0; // 1=debug D pressed (CPU use) - if (0 != demo_stopped) // 1=demo, 0=game - DemoFlag = 1; - - GameBusyFlag = 0; // restore scissors too + GameBusyFlag = 0; // restore scissors too + subFetchAndInitLevel(); // fetch and initialize a level + GameBusyFlag = 1; // no free screen write - subFetchAndInitLevel(); // Fetch and initialize a level - - GameBusyFlag = 1; // no free screen write - - if (1 <= demo_stopped) - { - if (1 == demo_stopped) - { - DemoFlag = 0; // 1=demo, 0=game - demo_stopped = demo_stopped + 1; - } - else - { - DemoFlag = 0; // 1=demo, 0=game - } - } - - DemoKeyCode = 0; // delete last demo key! - if (DemoFlag != 0) // don't allow during game! only in Demo - { - DemoOffset = DemoPointer; // init demo pointer - DemoKeyRepeatCounter = 1; - subGetNextDemoKey(); // get next demo byte - } + DemoKeyCode = 0; // delete last demo key! } -void subFetchAndInitLevel() +void subFetchAndInitLevel(void) { int InfoCountInLevel; - Trace("modInitGameConditions", "--> subFetchAndInitLevel"); - Trace("modInitGameConditions", "Call ReadLevel"); - - ReadLevel(); // Read LEVELS.DAT - - Trace("modInitGameConditions", "ReadLevel return subFetchAndInitLeveled"); - - if (RecordDemoFlag == 1) - RecDemoRandomSeed = RandomSeed; - - GameBusyFlag = -GameBusyFlag; // make <>1 - - Trace("modInitGameConditions", "subConvertToEasySymbols"); - - InfoCountInLevel = subConvertToEasySymbols(); // Convert to easy symbols - GameBusyFlag = -GameBusyFlag; // restore - - Trace("modInitGameConditions", "subDisplayLevel"); - - subDisplayLevel(); // Paint (Init) game field - - ResetInfotronsNeeded(InfoCountInLevel); // and reset Infotron count + PrepareLevel(); // initialize level data - Data_SubRstFlg = 1; + GameBusyFlag = -GameBusyFlag; // make != 1 + InfoCountInLevel = subConvertToEasySymbols(); // convert to easy symbols + GameBusyFlag = -GameBusyFlag; // restore - Trace("modInitGameConditions", "subInitGameConditions"); + subDisplayLevel(); // paint (init) game field - subInitGameConditions(); // Init game conditions (vars) + ResetInfotronsNeeded(InfoCountInLevel); // and reset Infotron count - InitMurphyPos(); // Locate Murphy + screen pos + subInitGameConditions(); // init game conditions (vars) - Trace("modInitGameConditions", "<-- subFetchAndInitLevel"); + InitMurphyPos(); // locate Murphy + screen pos }