void bankManager::loadScene(ofxXmlSettings & XML, ofPtr<scene> nScene){
    
    
    nScene->setName(XML.getValue("NAME", ""));
    nScene->setUid(XML.getValue("UID", nScene->getUid()));
    nScene->setFadeIn(XML.getValue("FADE_IN", 0.01));
    nScene->setFadeOut(XML.getValue("FADE_OUT", 0.01));
    
    int numZones = XML.getNumTags("ZONE");
    
    for(int tz = 0; tz < numZones; tz++){
        
        ofSleepMillis(1000/60); //FIX ME : a hack to prevent UDP flooding
                                //but really OSC Manager should handle this and throttle the number of messages per frame
        
        if(XML.pushTag("ZONE", tz)){
            
            ofPtr<triggerZone> z = nScene->addTriggerZone(currentZone, true); //isLoading flag to prevent OSC flood
            
            loadZone(XML, z);
            
            
            //zone tag
            XML.popTag();
            
        }
        
    }
    
    
    allScenes.push_back(nScene);

}
Beispiel #2
0
void AGOSEngine_PuzzlePack::loadMouseImage() {
	loadZone(_variableArray[500]);
	VgaPointersEntry *vpe = &_vgaBufferPointers[_variableArray[500]];

	byte *src = vpe->vgaFile2 + READ_LE_UINT32(vpe->vgaFile2 + _variableArray[501] * 8);
	memcpy(_mouseData, src, _maxCursorWidth * _maxCursorHeight);
}
Beispiel #3
0
void CWorld::LoadLOD()
{
	loadMob();	
	loadShop();
	loadSkill();
	loadSkillTree();
	loadArmorPreview();
	loadSSkill();
	loadAction();
	loadItemData();	
	loadSetItemData();
	loadAffinity();
	loadMakeItem();
	loadCatalog();
	loadEvent();
	loadNPCHelp();
	loadCombo();
	loadBigpet();
	loadRareOption();
	loadOption();
	loadTitleData();
	loadQuest();
	loadLacarette();
	loadZone();
	loadNotice();
	loadEntity();
	loadZoneData();
	loadTEventString();
	loadLevelUpGuide();
	loadChangeEquipment();
	LoadItemCollection();
	LoadItemCompose();
}
Beispiel #4
0
void AGOSEngine::dumpAllVgaImageFiles() {
	uint8 start = (getGameType() == GType_PN) ? 0 : 2;
	uint16 end = (getGameType() == GType_PN) ? 26 : 450;

	for (int z = start; z < end; z++) {
		loadZone(z, false);
		dumpVgaBitmaps(z);
	}
}
void ZoneViewerWindow::openArchive()
{
    QString filePath;
    // OpenGL rendering interferes wtih QFileDialog
    m_viewport->setAnimation(false);
    filePath = QFileDialog::getOpenFileName(0, "Select a S3D file to open",
        m_scene->assetPath(), "S3D Archive (*.s3d)");
    if(!filePath.isEmpty())
    {
        QFileInfo info(filePath);
        loadZone(info.absolutePath(), info.baseName());
        m_viewport->setFocus();
    }
    m_viewport->setAnimation(true);
}
Beispiel #6
0
void AGOSEngine::dumpAllVgaScriptFiles() {
	uint8 start = (getGameType() == GType_PN) ? 0 : 2;
	uint16 end = (getGameType() == GType_PN) ? 26 : 450;

	for (int z = start; z < end; z++) {
		uint16 zoneNum = (getGameType() == GType_PN) ? 0 : z;
		loadZone(z, false);

		VgaPointersEntry *vpe = &_vgaBufferPointers[zoneNum];
		if (vpe->vgaFile1 != NULL) {
			_curVgaFile1 = vpe->vgaFile1;
			dumpVgaFile(_curVgaFile1);
		}
	}
}
Beispiel #7
0
void AGOSEngine_PN::opn_opcode62() {
	int32 zoneNum = varval();

	_videoLockOut |= 0x80;

	vc29_stopAllSounds();

	_hitCalled = 0;
	_oneClick = 0;

	loadZone(zoneNum);

	setWindowImage(2, 2);

	_copyScnFlag = 0;
	_vgaSpriteChanged = 0;

	_videoLockOut &= ~0x80;

	setScriptReturn(true);
}
Beispiel #8
0
void AGOSEngine::o_loadZone() {
	// 97: load zone
	uint vga_res = getVarOrWord();

	_videoLockOut |= 0x80;

	if (getGameType() == GType_ELVIRA1 || getGameType() == GType_ELVIRA2 ||
		getGameType() == GType_WW) {
		vc27_resetSprite();
		vc29_stopAllSounds();
	}

	loadZone(vga_res);

	if (getGameType() == GType_ELVIRA1 || getGameType() == GType_ELVIRA2 ||
		getGameType() == GType_WW) {
		_copyScnFlag = 0;
		_vgaSpriteChanged = 0;
	}

	_videoLockOut &= ~0x80;
}
/**
  * This method is used to load the zone and all of it's sub elememnts
  * @param zoneNode The XML node to load the zone from
  * @param intoLevel The level to create the zone in
  * @return  0 , The file was loaded without problems
  *         -2 , If the file is corrupt
  */  
int CMapFileFilterXML::loadZone(QDomElement *zoneNode,CMapLevel *intoLevel)
{
	int gridWidth = m_mapManager->getMapData()->gridSize.width();
	int gridHeight = m_mapManager->getMapData()->gridSize.height();

	
	CMapZone *zone = NULL;

	if (intoLevel == NULL)
	{
		zone = m_mapManager->createZone(QPoint(-1,-1),NULL,false);
	}
	else
	{
		int x = zoneNode->attribute("X",QString::number(-1)).toInt();
		int y = zoneNode->attribute("Y",QString::number(-1)).toInt();

		if (x==-1 || y==-1)
		{
			kDebug() << "Unable to find zone pos ";
			return -2;
		}
		
		zone = m_mapManager->createZone(QPoint (x * gridWidth,y * gridHeight),intoLevel,false);
		zone->loadQDomElement(zoneNode);
		loadPluginPropertiesForElement(zone,zoneNode);
	}

	
	QDomNode n = zoneNode->firstChild();
	while (!n.isNull() )
	{
		QDomElement e = n.toElement();

		if (e.isNull() )
		{
			kDebug() << "Unable to find element ";
			return -2;
		}

		if (e.tagName()=="Level")
		{
			CMapLevel *level = m_mapManager->createLevel(UP,zone);
			QString id = e.attribute("ID","-2");
			if (id=="-2")
			{
				kDebug() << "Unable to find level ID";
				return -2;
			}
			level->setLevelID(id.toInt());

			QDomNode n2 = e.firstChild();
			while (!n2.isNull() )
			{
				QDomElement e2 = n2.toElement();

				if (e2.isNull() )
				{
					kDebug() << "Unable to find element ";
					return -2;
				}
			
				int x1 = e2.attribute("X",QString::number(-1)).toInt();
				int y1 = e2.attribute("Y",QString::number(-1)).toInt();			
				
				if (x1==-1 || y1==-1)
				{
					kDebug() << "Unable to find pos ";
					return -2;
				}

				if (e2.tagName()=="Zone")
				{
					loadZone(&e2,level);
				}
				else if (e2.tagName()=="Room")
				{
					CMapRoom *room = m_mapManager->createRoom(QPoint(x1 * gridWidth,y1 * gridHeight),level);
					
					room->loadQDomElement(&e2);
					loadPluginPropertiesForElement(room,&e2);
				}
				else if (e2.tagName()=="Text")
				{
					CMapText *text = m_mapManager->createText(QPoint (x1,y1),level,"");
					text->loadQDomElement(&e2);
					loadPluginPropertiesForElement(text,&e2);
				}
				else
				{
					kDebug() << "Unknown Type :  " << e2.tagName();
				}
				
				n2 = n2.nextSibling();
			}
		}
				

		n = n.nextSibling();
	}
	
	return 0;
}
//int CMapFileFilterXML::loadXMLData(QString filename)
int CMapFileFilterXML::loadXMLData(const QByteArray & buffer)
{
	// TODO_jp : Make sure Zone ID and level ID max value is set corretly
	QDomDocument doc ("map");	

	if (!doc.setContent( buffer))
	{
		kDebug() << "Unable to open the map file, not a valid xml document";
		// file.close();
		return -1;
	}

	for (CMapPluginBase *plugin = m_mapManager->getPluginList()->first(); plugin!=0; plugin = m_mapManager->getPluginList()->next())
	{
		plugin->loadAboutToStart();
	}

    QDomElement docElem = doc.documentElement();

	// Check that this version of the file can be loaded
	QDomElement e = readChildElement(&docElem,"Version");
	if (!e.isNull())
	{
		QString major = e.attribute("Major","");
		QString minor = e.attribute("Minor","");
		
		if (major != "1" || minor != "0")
		{
			 //TODO_jp : Output error message
			kDebug() << "This version can't be loaded";
			return -4;
		}
    }
    else
    {
		//TODO_jp : Output error message
		kDebug() << "Unable to find version";		
		return -2;
    }

	// Find Root Zone
    QDomElement rootZoneNode = readChildElement(&docElem,"Zone");
    if (rootZoneNode.isNull())
    {
		//TODO_jp : Output error message
		kDebug() << "Unable to find root zone";
		return -2;
    }

    // Load Root Zone
    int errorZone =loadZone(&rootZoneNode,NULL);
    
    if (errorZone!=0)
    {
		return errorZone;
	}

    // Find Paths
    QDomElement pathsNode = readChildElement(&docElem,"Paths");
    if (pathsNode.isNull())
    {
		//TODO_jp : Output error message
		kDebug() << "Unable to find paths";
		return -2;
    }

	// Load Paths
	int errorPath = loadPaths(&pathsNode);

	if (errorPath!=0)
	{
		return errorPath;
	}

	// Find Links
	QDomElement linksNode = readChildElement(&docElem,"Links");
	if (pathsNode.isNull())
	{
		//TODO_jp : Output error message
		kDebug() << "Unable to find links";
		return -2;
	}

	int errorLinks = loadLinks(&linksNode);
	if (errorLinks!=0)
	{
		return errorLinks;
	}

	// Return no error
	return 0;
}