# 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: text_printer.py
# IMG_FILTERS  = Enum("unfiltered", "sepia", "inverted")
# 
# Path: voice.py
# class VoiceId():
#   def __init__(
#     self,
#     char_id = -1,
#     chapter = -1,
#     voice_id = -1
#   ):
#     self.char_id  = char_id
#     self.chapter  = chapter
#     self.voice_id = voice_id


import common
from scene_info import SceneInfo
from sprite import SpriteId, SPRITE_TYPE
from text_printer import IMG_FILTERS
from voice import VoiceId
from wrd.ops import *
        
        # These flash IDs are special trial animations that kind of screw things up.
        invalid_flash = [500, 501, 502, 503]
        
        if (state in [1, 3, 4]) and (id not in invalid_flash):
          if id in flash_stack:
            flash_stack.remove(id)
          flash_stack.append(id)
        
        elif state == -1 and len(flash_stack) > 0:
          if id in flash_stack:
            flash_stack.remove(id)
          else:
            flash_stack.pop()
        
        if len(flash_stack) == 0:
          cur_flash = -1
        else:
          cur_flash = flash_stack[-1]
          cur_trialcam = None
          cur_sprite = SpriteId()
    
    ########################################
    ### Play a voice
    ########################################
    elif op == WRD_VOICE:
      char_id   = params["char_id"]
      chapter   = params["chapter"]
      voice_id  = params["voice_id"]
      

# 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: text_printer.py
# IMG_FILTERS  = Enum("unfiltered", "sepia", "inverted")
# 
# Path: voice.py
# class VoiceId():
#   def __init__(
#     self,
#     char_id = -1,
#     chapter = -1,
#     voice_id = -1
#   ):
#     self.char_id  = char_id
#     self.chapter  = chapter
#     self.voice_id = voice_id


# Path: wrd/scene.py
import common
from scene_info import SceneInfo
from sprite import SpriteId, SPRITE_TYPE
from text_printer import IMG_FILTERS
from voice import VoiceId
from wrd.ops import *

        
        # These flash IDs are special trial animations that kind of screw things up.
        invalid_flash = [500, 501, 502, 503]
        
        if (state in [1, 3, 4]) and (id not in invalid_flash):
          if id in flash_stack:
            flash_stack.remove(id)
          flash_stack.append(id)
        
        elif state == -1 and len(flash_stack) > 0:
          if id in flash_stack:
            flash_stack.remove(id)
          else:
            flash_stack.pop()
        
        if len(flash_stack) == 0:
          cur_flash = -1
        else:
          cur_flash = flash_stack[-1]
          cur_trialcam = None
          cur_sprite = SpriteId()
    
    ########################################
    ### Play a voice
    ########################################
    elif op == WRD_VOICE:
      char_id   = params["char_id"]
      chapter   = params["chapter"]
      voice_id  = params["voice_id"]
      

      cur_voice = VoiceId(char_id, chapter, voice_id)