07th-mod / umineko-question

94 stars 9 forks source link

Text disappearing issue #147

Open drojf opened 4 years ago

drojf commented 4 years ago

I had thought I fixed this issue already, but a user reported it still happening:

Example Gif (SPOILER)

edit; check the behavior with different textbox colors

drojf commented 4 years ago

I investigated the issue, it's reproducible with the following code:

(SPOILER BELOW)

advchar "10"
langjp:dwave_jp 0, but_2e1166:「そんなのじゃ理由にならねぇなッ!!/
langen:dwave_eng 0, but_2e1166:^"That proves nothing!!^/
se1 13
quakey 3,400
langjp@:dwave_jp 0, but_2e1167: 真里亞の目の前で殺人ができねぇから、うまく罠にかけようって回りくどいことしてるかも知れねぇじゃねえかッ!!」/
langen@:dwave_eng 0, but_2e1167:^  Maybe you chose the roundabout way of setting a clever trap because you couldn't commit murder in front of Maria!!"^/

se1 11
quakey 2,200
se1 11
quakey 2,200

langjp:^\
langen:^\

(END SPOILER) What happens is that

The main issue is that the langen:^\ part is treated as text, even though no text is emitted. I tried even putting \ by itself on a line and it's treated as text.

What isn't treated as text is the clickwait command, but this won't display the page-wait symbol. This could be considered as a possible workaround. But another way which is just as easy is to flag every "text" which actually emits no text in advance, so I can determine when text shouldn't be cleared. I'll try to do this and see how it goes.


The backlog was also broken but I can fix that part pretty easily - it was another somewhat unrelated bug.


In other cases, the \ can be collapsed onto the previous line, but because there are some commands in-between (quakey), collapsing is not possibnle, and it must be emitted as two separate text commands


Just incase I need to run this again next time, here's the code I used:

import re

script_path = r"C:\drojf\large_projects\umineko\umineko-question\InDevelopment\ManualUpdates\0.utf"

langjp_regex = re.compile("langjp[^A-Za-z一-龠ぁ-ゔ「」ァ-ヴー….『』]*\\\\")
langen_regex = re.compile("langen[^A-Za-z.『』\x10]*\\\\")

unique_lines = set()

cnt = 0
last_jp_line = 0
with open("output.utf", 'w', encoding='utf-8') as out:
    with open(script_path, encoding='utf-8') as file:
        for line in file.readlines():
            if langjp_regex.search(line):
                unique_lines.add(line)
                print(line)
                out.write("mov %disable_adv_clear, 1\n")
                last_jp_line = cnt

            out.write(line)

            if langen_regex.search(line):
                out.write("mov %disable_adv_clear, 0\n")
                if last_jp_line != cnt - 1:
                    raise Exception("eng line did not follow jp line")

            cnt += 1

print(unique_lines)
print("Num lines", cnt)