Skip to content

Commit 660e8cc

Browse files
committed
Merge pull request #9 from kiij/issue-6
Don't split menus across files, fixes #6
2 parents 565f58f + 67ae87f commit 660e8cc

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

CCScriptWriter/CCScriptWriter.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,8 @@ def getText(self, i, stop=None, dataType=False):
455455
block = ""
456456
start = i
457457
text = False
458+
normal_block_expect_02 = False
459+
458460
while True:
459461
if stop and stop == i:
460462
break
@@ -471,6 +473,10 @@ def getText(self, i, stop=None, dataType=False):
471473
length = self.getLength(i)
472474
block += "[{}".format(FormatHex(c))
473475

476+
# Mark if we expect an [02] before the end of the block
477+
if c == 0x19:
478+
normal_block_expect_02 = True
479+
474480
# Get the rest of the control code.
475481
codeEnd = i + length
476482
while i < codeEnd:
@@ -479,7 +485,10 @@ def getText(self, i, stop=None, dataType=False):
479485
block += "]"
480486

481487
# Stop if this is a block-ending character.
482-
if c == 0x02 or c == 0x0A:
488+
if c == 0x02 and normal_block_expect_02:
489+
# But don't stop if we expect an [02] that doesn't end the block
490+
normal_block_expect_02 = False
491+
elif c == 0x02 or c == 0x0A:
483492
break
484493
# Check if it's a special character.
485494
elif c == 0x52 or c == 0x8b or c == 0x8c or c == 0x8d:
@@ -737,4 +746,4 @@ def main():
737746
print("\rProgram execution aborted.")
738747

739748
if __name__ == "__main__":
740-
main()
749+
main()

0 commit comments

Comments
 (0)