Example #1
0
bool CMapLayout::LoadMapLayout(const char *filename)
{
	// open our output layout file
	KeyValues *pLayoutKeys = new KeyValues( "LayoutKeys" );
	if ( !pLayoutKeys->LoadFromFile( g_pFullFileSystem, filename, "GAME" ) )
	{
		//Msg( "Failed to load map layout %s\n", filename );
		pLayoutKeys->deleteThis();
		return false;
	}

	while ( pLayoutKeys )
	{
		if ( !Q_stricmp( pLayoutKeys->GetName(), "room" ) )
		{
			if ( !CRoom::LoadRoomFromKeyValues( pLayoutKeys, this ) )
				return false;
		}
		else if ( !Q_stricmp( pLayoutKeys->GetName(), "logical_room" ) )
		{
			LoadLogicalRoom( pLayoutKeys );
		}
		else if ( !Q_stricmp( pLayoutKeys->GetName(), "mapmisc" ) )
		{
			m_iPlayerStartTileX = pLayoutKeys->GetInt( "PlayerStartX" );
			m_iPlayerStartTileY = pLayoutKeys->GetInt( "PlayerStartY" );
		}
		else if ( Q_stricmp( pLayoutKeys->GetName(), "mission_settings" ) == 0 )
		{
			m_pGenerationOptions = pLayoutKeys->MakeCopy();
		}
		else if ( Q_stricmp( pLayoutKeys->GetName(), "instance_spawn" ) == 0 )
		{
			m_InstanceSpawns[m_InstanceSpawns.AddToTail()].LoadFromKeyValues( pLayoutKeys );
		}
		else if ( Q_stricmp( pLayoutKeys->GetName(), "npc_encounter" ) == 0 )
		{
			CASW_Encounter *pEncounter = new CASW_Encounter();
			pEncounter->LoadFromKeyValues( pLayoutKeys );
			m_Encounters.AddToTail( pEncounter );
		}
		pLayoutKeys = pLayoutKeys->GetNextKey();
	}

	MarkEncounterRooms();

	SetCurrentFilename(filename);

	pLayoutKeys->deleteThis();

	return true;
}
Example #2
0
CMapLayout::CMapLayout( KeyValues *pGenerationOptions ) :
m_pGenerationOptions( pGenerationOptions )
{
	SetCurrentFilename("");

	m_iPlayerStartTileX = MAP_LAYOUT_TILES_WIDE * 0.5f;
	m_iPlayerStartTileY = MAP_LAYOUT_TILES_WIDE * 0.5f;

	// clear our pointer grid
	for (int y=0;y<MAP_LAYOUT_TILES_WIDE;y++)
	{
		for (int x=0;x<MAP_LAYOUT_TILES_WIDE;x++)
		{
			m_pRoomGrid[x][y] = NULL;
		}
	}
}
Example #3
0
void SolveSpaceUI::UpdateWindowTitle(void) {
    SetCurrentFilename(saveFile);
}