X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftape.c;h=d6f89455405ea725b5c3de389cf4ed92960e5c23;hb=d51197e00ec619213ee9c09714bafe855774ae8c;hp=5e7bca1539bc172b7bdbc83b123e78f61d2a883b;hpb=a99a1803e5097bc598b4c6f73259715da148ab27;p=rocksndiamonds.git diff --git a/src/tape.c b/src/tape.c index 5e7bca15..d6f89455 100644 --- a/src/tape.c +++ b/src/tape.c @@ -894,10 +894,10 @@ byte *TapePlayAction(void) action[i] = tape.pos[tape.counter].action[i]; #if DEBUG_TAPE_WHEN_PLAYING - Print("%05d", FrameCounter); + DebugContinued("", "%05d", FrameCounter); for (i = 0; i < MAX_TAPE_ACTIONS; i++) - Print(" %08x", action[i]); - Print("\n"); + DebugContinued("", " %08x", action[i]); + DebugContinued("tape:play", "\n"); #endif tape.set_centered_player = FALSE; @@ -955,7 +955,7 @@ unsigned int GetTapeLengthFrames(void) int i; if (TAPE_IS_EMPTY(tape)) - return(0); + return 0; for (i = 0; i < tape.length; i++) tape_length_frames += tape.pos[i].delay; @@ -1324,8 +1324,7 @@ void AutoPlayTapes(void) global.autoplay_leveldir); if (autoplay_leveldir == NULL) - Error(ERR_EXIT, "no such level identifier: '%s'", - global.autoplay_leveldir); + Fail("no such level identifier: '%s'", global.autoplay_leveldir); leveldir_current = autoplay_leveldir; @@ -1494,14 +1493,14 @@ static boolean PatchTape(struct TapeInfo *tape, char *mode) return FALSE; } - byte property_bits = tape->property_bits; + boolean unpatch_tape = FALSE; + boolean use_property_bit = FALSE; byte property_bitmask = 0; - boolean set_property_bit = TRUE; if (strSuffix(mode, ":0") || strSuffix(mode, ":off") || strSuffix(mode, ":clear")) - set_property_bit = FALSE; + unpatch_tape = TRUE; if (strEqual(mode, "em_random_bug") || strPrefix(mode, "em_random_bug:")) { @@ -1515,6 +1514,8 @@ static boolean PatchTape(struct TapeInfo *tape, char *mode) } property_bitmask = TAPE_PROPERTY_EM_RANDOM_BUG; + + use_property_bit = TRUE; } else { @@ -1523,22 +1524,29 @@ static boolean PatchTape(struct TapeInfo *tape, char *mode) return FALSE; } - if (set_property_bit) - property_bits |= property_bitmask; - else - property_bits &= ~property_bitmask; - - if (property_bits == tape->property_bits) + // patching tapes using property bits may be used for several patch modes + if (use_property_bit) { - Print("Tape already patched for '%s'!\n", mode); + byte property_bits = tape->property_bits; + boolean set_property_bit = (unpatch_tape ? FALSE : TRUE); - return FALSE; + if (set_property_bit) + property_bits |= property_bitmask; + else + property_bits &= ~property_bitmask; + + if (property_bits == tape->property_bits) + { + Print("Tape already patched for '%s'!\n", mode); + + return FALSE; + } + + tape->property_bits = property_bits; } Print("Patching for '%s' ... ", mode); - tape->property_bits = property_bits; - return TRUE; } @@ -1567,8 +1575,7 @@ void PatchTapes(void) global.patchtapes_leveldir); if (patchtapes_leveldir == NULL) - Error(ERR_EXIT, "no such level identifier: '%s'", - global.patchtapes_leveldir); + Fail("no such level identifier: '%s'", global.patchtapes_leveldir); leveldir_current = patchtapes_leveldir; @@ -1713,7 +1720,7 @@ void CreateTapeButtons(void) GDI_END); if (gi == NULL) - Error(ERR_EXIT, "cannot create gadget"); + Fail("cannot create gadget"); tape_gadget[id] = gi; }