unsigned short off = 0;
unsigned int off = 0;
void readbin_U7UCFunc(ifstream &f, UCFunc &ucf, const UCOptions &options){	// offset to start of function	ucf._offset = f.tellg();	DEBUG_READ_PAIR("Offset: ", ucf._offset);	// Read Function Header		ucf._funcid = Read2(f);	DEBUG_READ_PAIR("FuncID: ", ucf._funcid);	ucf._funcsize = Read2(f);	DEBUG_READ_PAIR("FuncSize: ", ucf._funcsize);		// save body offset in case we need it	ucf._bodyoffset = f.tellg();		ucf._datasize = Read2(f);		// process ze data segment!	{		streampos pos = f.tellg(); // paranoia			unsigned short off = 0;		// Load all strings & their offsets		while( off < ucf._datasize )		{			assert(!f.eof());						string data;			getline(f, data, static_cast<char>(0x00));			ucf._data.insert(pair<unsigned int, string>(off, data));			off+=data.size()+1;		}		f.seekg(pos, ios::beg); // paranoia		f.seekg(ucf._datasize, ios::cur); // paranoia	}	#if 0		if(ucf._funcid==_search_func)		for(map<unsigned int, string>::iterator i=ucf._data.begin(); i!=ucf._data.end(); i++)			cout << i->first << "\t" << i->second << endl;	#endif		// process code segment	{		//streampos start_of_code_seg = f.tellg(); // what's this used for?		ucf._codeoffset = f.tellg();		// get the number of arguments to the function		ucf._num_args = Read2(f);		// get the number of local variables		ucf._num_locals = Read2(f);		// get the number of external function numbers		ucf._num_externs = Read2(f);				// load the external function numbers		for(unsigned int i=0; i<ucf._num_externs; i++)			ucf._externs.push_back(Read2(f));				// ok, now to load the usecode		unsigned int code_offset=0;		unsigned int code_size = ucf._funcsize - ucf._datasize - ((3+ucf._num_externs) * SIZEOF_USHORT);				DEBUG_READ_PAIR("Code Size: ", code_size);		while(code_offset<(code_size-2)) //TODO: Why the -2?!? it doesn't work otherwise		{			UCc ucop;						ucop._offset = code_offset;			ucop._id = Read1(f);			code_offset++;			const UCOpcodeData &otd = opcode_table_data[ucop._id];			//assert(((otd.asm_nmo.size()!=0) && (otd.ucs_nmo.size()!=0)));			for(unsigned int i=0; i<otd.num_bytes; i++)				ucop._params.push_back(Read1(f));			// parse the parameters			ucc_parse_parambytes(ucop, otd);			code_offset+=otd.num_bytes;			/* if we're an opcode that sets a return value, we need to mark the				function as one that returns a value */			if(otd.flag_return==true)				ucf.return_var=true;						/* if we're a function debugging opcode, set the debuging flag, and				assign the variable name string offset				TODO: Add this to opcodes.txt */			if((ucop._id==0x4D) && (options.game_bg() || options.game_si()))			{				ucf.debugging_info=true;				assert(ucop._params_parsed.size()>=2);				ucf.debugging_offset = ucop._params_parsed[1];				ucf.funcname = ucf._data.find(0x0000)->second;			}						ucf._opcodes.push_back(ucop);			#ifdef DEBUG_READ			cout << std::setw(4) << code_size << "\t" << std::setw(4) << code_offset << "\t" << std::setw(4) << (unsigned int)ucop._offset << "\t" << std::setw(2) << (unsigned int)ucop._id << "\t";			for(unsigned int i=0; i<ucop._params.size(); i++)				cout << std::setw(2) << (unsigned int)ucop._params[i] << ',';			cout << endl;			#endif		}	}}