#!/usr/bin/python

# This script will do the asset build for Mario Kart, minus fonts (right now)
# and billboard textures (probably forever).

# You can do any single part of it or all of it.

# Be sure to make clean before testing or else it'll look like it didn't work. 

import sys, string, os, re

def execute( command ):
    print ( command );
    os.system( command );


print("You must define this variable: GAMEROOT.  It should point at the mk64 dir");

DIR = os.environ['GAMEROOT'];
ASSETSDIR = DIR + "/i10n/assets/zh/textures/raw/"
TOOLSDIR = DIR + "/i10n/tools/";
ROOT = os.environ['ROOT'];

# step 1: Create the .s files

def step1():
    
    execute( TOOLSDIR + "rawToDotS.py < " + TOOLSDIR + "rawToDotS.txt " );


# step 2: Convert the title logo

def step2():

    print "This step has been superceded by step 3."

# step 3: convert the @#&%&%* pushstart
# must start with .sgi file.

def step3():

    execute( "cv.py < " + DIR + "/i10n/tools/pushstart.txt");


# step 4: Do the font list (currently not here, as we have no font textures)

def step4():
    execute(TOOLSDIR + "processFontsZH.py");


# step 5: Do the "Nintendo" billboard textures (to be done by hand)

if ( len(sys.argv)!=2 ):
    print("Must say which steps (1-3)")
    sys.exit(-1)

if ( string.find( sys.argv[1], "1" ) != -1 ):
    print "--------Step1-----------------------"
    step1()

if ( string.find( sys.argv[1], "2" ) != -1 ):
    print "--------Step2-----------------------"
    step2();
    
if ( string.find( sys.argv[1], "3" ) != -1 ):
    print "--------Step3-----------------------"
    step3();

if ( string.find( sys.argv[1], "4" ) != -1 ):
    print "--------Step4-----------------------"
    step4();
