int initfunctions[2048]; int globalfunctions[2048]; int globalfunctionsPostWaitdraw[2048]; int count[3]; global script init { void addInitFunction(*f) { initfunctions[count] = f; ++count[0]; } void addFunction(*f) { globalfunctions[count] = f; ++count[1]; } void addLateFunction(*f) { globalfunctionsPostWaitdraw[count] = f; ++count[2]; } initfunctions((*void)StartTangoZH); initfunctions((*void)StartGhostZH); initfunctions((*void)StartMain); globalfunctions((*void)Tango_Update1); globalfunctions((*void)Ghost_Update1); globalfunctions((*void)Main); globalfunctionsPostWaitdraw((*void)Tango_Update2); globalfunctionsPostWaitdraw((*void)Ghost_Update2); globalfunctionsPostWaitdraw((*void)Cleanup); } global script active { void run() { for ( int q = 0; q < count[0]; ++q ) { globalfunctions[q]; } while(1) { for ( int q = 0; q < count[1]; ++q ) { globalfunctions[q]; } Waitdraw(); for ( int q = 0; q < count[2]; ++q ) { globalfunctionsPostWaitdraw[q]; } Waitframe(); } } }