def execute(self, editing, instant):
     Debug.log(
         f"Executing dialogue character={self.character} anim={self.anim} text={self.text} "
         f"voice={self.voice}", self)
     self.dialogue.start_dialogue(self.character, self.anim, self.text,
                                  self.voice)
     if instant:
         self.dialogue.end_dialogue()
 def execute(self, editing, instant):
     Debug.log(
         f"Executing bg load bg={self.bg} "
         f"load_path={self.load_path}", self)
     if self.bg == self.TOP:
         self.bg_top.set_bg("data_lt2/bg/" + self.load_path)
     else:
         self.bg_btm.set_bg("data_lt2/bg/" + self.load_path)
Exemplo n.º 3
0
 def change_to_file(self, file_path):
     Debug.log(f"Changing to file: {file_path}", self)
     if file_path.endswith(".arc"):
         try:
             load_animation(file_path, self.preview_sprite)
             if self.preview_sprite.frame_count > 0:
                 self.preview_sprite.set_frame(1)
         except:
             load_bg(file_path, self.preview_sprite)
         self.preview_sprite.add(self.preview_group)
 def execute(self, editing, instant):
     Debug.log(
         f"Executing load characters={self.characters} anims={self.characters_anim}",
         self)
     self.setup_characters()
     self.bg_top.set_bg(f"data_lt2/bg/event/sub{self.top_id}.arc")
     self.bg_btm.set_bg(f"data_lt2/bg/map/main{self.btm_id}.arc")
     self.bg_top.set_opacity(0)
     self.bg_btm.set_opacity(120)
     if editing:
         self.bg_top.set_fade_max_opacity(180)
         self.bg_btm.set_fade_max_opacity(180)
     else:
         self.bg_top.set_fade_max_opacity(255)
         self.bg_btm.set_fade_max_opacity(255)
 def execute(self, editing, instant):
     Debug.log(
         f"Executing fade screen={self.fade_screen} "
         f"type={self.fade_type} time={self.fade_frames}", self)
     if self.fade_screen & self.FADE_TOP:
         self.bg_top.fade(self.fade_type, self.fade_frames, instant)
         if editing:
             self.bg_top.set_fade_max_opacity(180)
         else:
             self.bg_top.set_fade_max_opacity(255)
     if self.fade_screen & self.FADE_BTM:
         self.bg_btm.fade(self.fade_type, self.fade_frames, instant)
         if editing:
             self.bg_btm.set_fade_max_opacity(180)
         else:
             self.bg_btm.set_fade_max_opacity(255)
 def execute(self, editing, instant):
     Debug.log(
         f"Executing chr anim character={self.character} "
         f"anim={self.next_anim}", self)
     self.character.set_anim(self.next_anim)
Exemplo n.º 7
0
 def change_to_folder(self, folder_path):
     Debug.log(f"Changing to folder: {folder_path}", self)
     self.open_folder(folder_path + "/")
def event_to_commands(event: formats.event.Event, character_obj, bg_top,
                      bg_btm, waiter, sfx_player, dialogue):
    commands = list()
    commands.append(
        LoadCMD(character_obj, event.characters,
                list(map(lambda x: x != 0,
                         event.characters_shown)), event.characters_pos,
                event.characters_anim_index.copy(), event.map_top_id,
                event.map_bottom_id, bg_top, bg_btm))
    commands[-1].setup_characters()
    next_voice = -1
    for event_gds_cmd in event.event_gds.commands:  # type: formats.gds.GDSCommand
        if event_gds_cmd.command == 0x2:
            commands.append(
                FadeCMD(FadeCMD.FADE_IN, FadeCMD.FADE_BOTH, bg_top, bg_btm,
                        None))
        elif event_gds_cmd.command == 0x3:
            commands.append(
                FadeCMD(FadeCMD.FADE_OUT, FadeCMD.FADE_BOTH, bg_top, bg_btm,
                        None))
        elif event_gds_cmd.command == 0x4:
            dialogue_gds = event.get_text(event_gds_cmd.params[0])
            if len(dialogue_gds.params) != 5:
                continue
            character = None
            for char in character_obj:
                if char.get_char_id(
                ) == dialogue_gds.params[0] and char.get_char_id() != 0:
                    character = char
                    break
            commands.append(
                DialogueCMD(dialogue, character, dialogue_gds.params[4],
                            dialogue_gds.params[1], next_voice))
            next_voice = -1
        elif event_gds_cmd.command == 0x21:
            commands.append(
                BGLoadCMD(BGLoadCMD.BTM, bg_top, bg_btm,
                          event_gds_cmd.params[0]))
        elif event_gds_cmd.command == 0x22:
            commands.append(
                BGLoadCMD(BGLoadCMD.TOP, bg_top, bg_btm,
                          event_gds_cmd.params[0]))
        elif event_gds_cmd.command == 0x2a:
            commands.append(ChrShowCMD(character_obj[event_gds_cmd.params[0]]))
        elif event_gds_cmd.command == 0x2b:
            commands.append(ChrHideCMD(character_obj[event_gds_cmd.params[0]]))
        elif event_gds_cmd.command == 0x2c:
            # WTF WHY DOES THIS WORK LIKE THIS
            if event_gds_cmd.params[0] < len(character_obj):
                commands.append(
                    ChrVisibilityCMD(character_obj[event_gds_cmd.params[0]],
                                     event_gds_cmd.params[1] > 0))
        elif event_gds_cmd.command == 0x30:
            character = None
            for char in character_obj:
                if char.get_char_id(
                ) == event_gds_cmd.params[0] and char.get_char_id() != 0:
                    character = char
                    break
            if character is not None or True:
                commands.append(
                    ChrSlotCMD(character_obj[event_gds_cmd.params[0]],
                               event_gds_cmd.params[1]))
        elif event_gds_cmd.command == 0x32:
            commands.append(
                FadeCMD(FadeCMD.FADE_IN, FadeCMD.FADE_BTM, bg_top, bg_btm,
                        None))
        elif event_gds_cmd.command == 0x33:
            commands.append(
                FadeCMD(FadeCMD.FADE_OUT, FadeCMD.FADE_BTM, bg_top, bg_btm,
                        None))
        elif event_gds_cmd.command == 0x31:
            commands.append(WaitCMD(waiter, event_gds_cmd.params[0]))
        elif event_gds_cmd.command == 0x37:
            commands.append(BGOpacityCMD(bg_btm, event_gds_cmd.params[3]))
        elif event_gds_cmd.command == 0x3f:
            character = None
            for char in character_obj:
                if char.get_char_id(
                ) == event_gds_cmd.params[0] and char.get_char_id() != 0:
                    character = char
                    break
            commands.append(ChrAnimCMD(character, event_gds_cmd.params[1]))
        elif event_gds_cmd.command == 0x5c:
            next_voice = event_gds_cmd.params[0]
        elif event_gds_cmd.command == 0x5d:
            commands.append(SadSfxCMD(sfx_player, event_gds_cmd.params[0]))
        elif event_gds_cmd.command == 0x6a:
            commands.append(BGShakeCMD(bg_btm))
        elif event_gds_cmd.command == 0x72:
            commands.append(
                FadeCMD(FadeCMD.FADE_OUT, FadeCMD.FADE_BOTH, bg_top, bg_btm,
                        event_gds_cmd.params[0]))
        elif event_gds_cmd.command == 0x80:
            commands.append(
                FadeCMD(FadeCMD.FADE_IN, FadeCMD.FADE_BOTH, bg_top, bg_btm,
                        event_gds_cmd.params[0]))
        elif event_gds_cmd.command == 0x87:
            commands.append(
                FadeCMD(FadeCMD.FADE_OUT, FadeCMD.FADE_TOP, bg_top, bg_btm,
                        event_gds_cmd.params[0]))
        elif event_gds_cmd.command == 0x88:
            commands.append(
                FadeCMD(FadeCMD.FADE_IN, FadeCMD.FADE_TOP, bg_top, bg_btm,
                        event_gds_cmd.params[0]))
        else:
            Debug.log_warning(
                f"Command {hex(event_gds_cmd.command)} not recognised (skipped). ",
                "GDS to Commands")
    return commands
 def execute(self, editing, instant):
     Debug.log(f"Executing bg shake bg={self.bg}", self)
     self.bg.shake()
 def execute(self, editing, instant):
     Debug.log(f"Executing wait frames={self.wait_frames}", self)
     if not instant:
         self.waiter.wait(self.wait_frames)
 def execute(self, editing, instant):
     Debug.log(f"Executing bg opacity bg={self.bg} opacity={self.opacity}",
               self)
     self.bg.set_opacity(self.opacity)
 def execute(self, editing, instant):
     Debug.log(f"Executing sad sfx sad_id={self.sad_id}", self)
     if not instant:
         self.player.play(
             f"data_lt2/stream/ST_{str(self.sad_id).zfill(3)}.SAD")
 def execute(self, editing, instant):
     Debug.log(
         f"Executing chr slot character={self.character} "
         f"slot={self.next_slot}", self)
     self.character.set_slot(self.next_slot)
 def execute(self, editing, instant):
     Debug.log(
         f"Executing chr visibility character={self.character} "
         f"visibility={self.visibility}", self)
     if self.character:
         self.character.set_visibility(self.visibility)
 def execute(self, editing, instant):
     Debug.log(f"Executing chr hide character={self.character}", self)
     self.character.hide()
 def execute(self, editing, instant):
     Debug.log(f"Executing chr show character={self.character}", self)
     self.character.show()
 def execute(self, editing, instant):
     Debug.log(f"Executing unknown", self)