import string
import types
from process_common import *
from header_common import *
from header_operations import *
from module_info_pages import *
from module_strings import *
from module_skills import *
from module_music import *
from module_meshes import *
from module_sounds import *
from module_items import *
from module_troops import *
from module_factions import *
from module_quests import *
from module_party_templates import *
from module_parties import *
from module_scenes import *
from module_scripts import *
from module_mission_templates import *
from module_game_menus import *
from module_particle_systems import *
from module_scene_props import *
from module_scene_props import *
from module_presentations import *
from module_map_icons import *
from module_tableau_materials import *
from module_animations import *
def get_id_value(tag, identifier, tag_uses):
tag_type = -1
id_no = -1
if (tag == "str"):
id_no = find_object(strings,identifier)
tag_type = tag_string
elif (tag == "itm"):
id_no = find_object(items,identifier)
tag_type = tag_item
elif (tag == "trp"):
id_no = find_object(troops,identifier)
tag_type = tag_troop
elif (tag == "fac"):
id_no = find_object(factions,identifier)
tag_type = tag_faction
elif (tag == "qst"):
id_no = find_object(quests,identifier)
tag_type = tag_quest
elif (tag == "pt"):
id_no = find_object(party_templates,identifier)
tag_type = tag_party_tpl
elif (tag == "p"):
id_no = find_object(parties,identifier)
tag_type = tag_party
elif (tag == "scn"):
id_no = find_object(scenes,identifier)
tag_type = tag_scene
elif (tag == "mt"):
id_no = find_object(mission_templates,identifier)
tag_type = tag_mission_tpl
elif (tag == "mnu"):
id_no = find_object(game_menus,identifier)
tag_type = tag_menu
elif (tag == "script"):
id_no = find_object(scripts,identifier)
tag_type = tag_script
elif (tag == "psys"):
id_no = find_object(particle_systems,identifier)
tag_type = tag_particle_sys
elif (tag == "spr"):
id_no = find_object(scene_props,identifier)
tag_type = tag_scene_prop
elif (tag == "prsnt"):
id_no = find_object(presentations,identifier)
tag_type = tag_presentation
elif (tag == "snd"):
id_no = find_object(sounds,identifier)
tag_type = tag_sound
elif (tag == "icon"):
id_no = find_object(map_icons,identifier)
tag_type = tag_map_icon
elif (tag == "skl"):
id_no = find_object(skills,identifier)
tag_type = tag_skill
elif (tag == "track"):
id_no = find_object(tracks,identifier)
tag_type = tag_track
elif (tag == "mesh"):
id_no = find_object(meshes,identifier)
tag_type = tag_mesh
elif (tag == "anim"):
id_no = find_object(animations,identifier)
tag_type = tag_animation
elif (tag == "tableau"):
id_no = find_object(tableaus,identifier)
tag_type = tag_tableau
# INSERT NEW LINES:
elif (tag == "ip"):
id_no = find_object(info_pages,identifier)
tag_type = 0
# NO MORE NEW LINES.
if (tag_type > -1 and id_no > -1):
add_tag_use(tag_uses,tag_type,id_no)
return (tag_type, id_no)
def get_identifier_value(str, tag_uses):
underscore_pos = string.find(str, "_")
result = -1
if (underscore_pos > 0):
tag_str = str[0:underscore_pos]
id_str = str[underscore_pos + 1:len(str)]
(tag_type, id_no) = get_id_value(tag_str,id_str,tag_uses)
#if (tag_type > 0): # THIS LINE IS DISABLED
if (tag_type >= 0): # AND THIS LINE IS USED INSTEAD
if (id_no < 0):
print "Error: Unable to find object:" + str
else:
result = id_no | (tag_type << op_num_value_bits)
else:
print "Error: Unrecognized tag:" +tag_str + "in object:" + str
else:
print "Error: Invalid object:" +str + ".Variables should start with $ sign and references should start with a tag"
return result