# Path: scene_info.py
# class SceneInfo():
#   def __init__(self,
#                file_id    = -1,
#                speaker    = -1,
#                speaking   = False,
#                sprite     = SpriteId(),
#                voice      = VoiceId(),
#                bgm        = -1,
#                headshot   = -1,
#                mode       = None,
#                special    = None,
#                box_color  = common.BOX_COLORS.orange,
#                box_type   = common.BOX_TYPES.normal,
#                ammo       = -1,
#                bgd        = -1,
#                cutin      = -1,
#                flash      = -1,
#                movie      = -1,
#                img_filter = IMG_FILTERS.unfiltered,
#                chapter    = -1,
#                scene      = -1,
#                room       = -1,
#                extra_val  = -1
#               ):
#     self.file_id    = file_id
#     
#     self.speaker    = speaker
#     self.speaking   = speaking
#     self.sprite     = sprite
#     self.voice      = voice
#     self.bgm        = bgm
#     
#     self.headshot   = headshot
#     
#     self.mode       = mode
#     self.special    = special
#     self.box_color  = box_color
#     self.box_type   = box_type
#     
#     self.ammo       = ammo
#     self.bgd        = bgd
#     self.cutin      = cutin
#     self.flash      = flash
#     self.movie      = movie
#     
#     self.img_filter = img_filter
#     
#     self.chapter    = chapter
#     self.scene      = scene
#     self.room       = room
#     
#     self.extra_val  = extra_val


import os
import re
from text_files import load_text, save_text
from scene_info import SceneInfo
    
    match = TEXT_PARSER.search(text)
    
    if match:
      # Remove any trailing linebreaks, because 
      first_part = match.group(1)
      second_part = match.group(2)
      third_part = match.group(4)
      
      if not second_part:
        self.original = first_part
      else:
        self.translated = first_part
        self.original = second_part
      
      if third_part:
        self.comments = third_part
    
    self.original_notags = TAG_KILLER.sub("", self.original)
    self.translated_notags = TAG_KILLER.sub("", self.translated)
  
  ##############################################################################
  ### @fn    pack()
  ### @desc  Converts all the data into the script file format.
  ### @param for_game -- Whether to include the original, untranslated data.
  ###                    True = exclude untranslated, since we don't need it.
  ##############################################################################
  def pack(self, for_game = False):
  
    if self.translated == "":

# Path: scene_info.py
# class SceneInfo():
#   def __init__(self,
#                file_id    = -1,
#                speaker    = -1,
#                speaking   = False,
#                sprite     = SpriteId(),
#                voice      = VoiceId(),
#                bgm        = -1,
#                headshot   = -1,
#                mode       = None,
#                special    = None,
#                box_color  = common.BOX_COLORS.orange,
#                box_type   = common.BOX_TYPES.normal,
#                ammo       = -1,
#                bgd        = -1,
#                cutin      = -1,
#                flash      = -1,
#                movie      = -1,
#                img_filter = IMG_FILTERS.unfiltered,
#                chapter    = -1,
#                scene      = -1,
#                room       = -1,
#                extra_val  = -1
#               ):
#     self.file_id    = file_id
#     
#     self.speaker    = speaker
#     self.speaking   = speaking
#     self.sprite     = sprite
#     self.voice      = voice
#     self.bgm        = bgm
#     
#     self.headshot   = headshot
#     
#     self.mode       = mode
#     self.special    = special
#     self.box_color  = box_color
#     self.box_type   = box_type
#     
#     self.ammo       = ammo
#     self.bgd        = bgd
#     self.cutin      = cutin
#     self.flash      = flash
#     self.movie      = movie
#     
#     self.img_filter = img_filter
#     
#     self.chapter    = chapter
#     self.scene      = scene
#     self.room       = room
#     
#     self.extra_val  = extra_val


# Path: script_file.py
import os
import re
from text_files import load_text, save_text
from scene_info import SceneInfo

    
    match = TEXT_PARSER.search(text)
    
    if match:
      # Remove any trailing linebreaks, because 
      first_part = match.group(1)
      second_part = match.group(2)
      third_part = match.group(4)
      
      if not second_part:
        self.original = first_part
      else:
        self.translated = first_part
        self.original = second_part
      
      if third_part:
        self.comments = third_part
    
    self.original_notags = TAG_KILLER.sub("", self.original)
    self.translated_notags = TAG_KILLER.sub("", self.translated)
  
  ##############################################################################
  ### @fn    pack()
  ### @desc  Converts all the data into the script file format.
  ### @param for_game -- Whether to include the original, untranslated data.
  ###                    True = exclude untranslated, since we don't need it.
  ##############################################################################
  def pack(self, for_game = False):
  
    if self.translated == "":

      output = u"\ufeff" + self.original + u"\u0000"