示例#1
0
void initialize_shape_handler(
	void)
{
	FSSpec shapes_file;
	OSErr error;

	/* open the resource fork of our shape file for reading */
	error= get_file_spec(&shapes_file, strFILENAMES, filenameSHAPES8, strPATHS);
	if (error==noErr)
	{
		open_shapes_file(&shapes_file);
	}
	
	if (error!=noErr || shapes_file_refnum==-1)
	{
		alert_user(fatalError, strERRORS, badExtraFileLocations, error);
	}
	else
	{
		atexit(shutdown_shape_handler);
	}

	hollow_pixmap= NewPixMap();
	assert(hollow_pixmap);
	if (HOLLOW_PIXMAP_BUFFER_SIZE)
	{
		hollow_data= (pixel8 *)NewPtr(HOLLOW_PIXMAP_BUFFER_SIZE);
		assert(hollow_data);
	}

	/* bounds and rowBytes are deliberately unset! */
	(*hollow_pixmap)->pixelType= 0;
	(*hollow_pixmap)->pixelSize= 8;
	(*hollow_pixmap)->cmpCount= 1;
	(*hollow_pixmap)->cmpSize= (*hollow_pixmap)->pixelSize;
	(*hollow_pixmap)->pmReserved= 0;

	return;
}
示例#2
0
bool handle_open_document(const std::string& filename)
{
	bool done = false;
	FileSpecifier file(filename);
	switch (file.GetType())
	{
	case _typecode_scenario:
		set_map_file(file);
		break;
	case _typecode_savegame:
		if (load_and_start_game(file))
		{
			done = true;
		}
		break;
	case _typecode_film:
		if (handle_open_replay(file))
		{
			done = true;
		}
		break;
	case _typecode_physics:
		set_physics_file(file);
		break;
	case _typecode_shapes:
		open_shapes_file(file);
		break;
	case _typecode_sounds:
		SoundManager::instance()->OpenSoundFile(file);
		break;
	default:
		break;
	}
	
	return done;
}