A 40,000-acre fire chewed through desert wilderness Thursday after destroying 100 homes and buildings and was on course to possibly merge with a blaze in the San Bernardino National Forest.

The huge fire edged northwest toward the forest, burning greasewood, Joshua trees, pinon pines and brush on the desert floor. Containment was just 20 percent. Five miles away, a 7,000-acre fire in the forest was 5 percent surrounded.

Click here to visit FOXNews.com's Natural Disaster Center

Gov. Arnold Schwarzenegger declared a state of emergency in San Bernardino County to better coordinate and expedite state efforts to help people affected.

Evacuation orders were lifted for several communities, including the old Western film locale of Pioneertown, but new evacuations were ordered for dozens of homes in Morongo Valley, and residents of Burns Canyon and Rimrock remained unable to return home.

"We're very, very lucky," said Sandy Dugan, whose Pioneertown home still stood while the charred remains of others smoldered. "It's hard to see your neighbors' homes gone."

Authorities said the odor of smoke from the blazes 100 miles east of Los Angeles could be detected in Las Vegas and Ogden, Utah.

Fire officials said that both fires could link up on the desert floor. Higher up in the mountains, millions of dead trees carried the potential for even more destruction, but they were at least 15 miles from either fire.

Kevin Olson, deputy chief of operations in the headquarters of the California Department of Forestry, said it was possible "but not very likely at this time" that the fires would reach the timber stands.

Swaths of Southern California forests have been weakened by drought and killed by bark beetles. For several years, workers have been cutting down dead trees near communities and roads. Thousands of acres have been cleared but experts say it will take up to 20 years to remove all the deadwood.

However, Olson said there have been contingency plans for several years on how to fight fires and evacuate people in the beetle-infested areas.

The larger fire was ignited by lightning during the weekend and roared into an inferno Tuesday, racing through tiny high desert communities. Forty-two houses, 55 other buildings and 91 vehicles were destroyed in Pioneertown and other communities near Yucca Valley.

About 1,350 firefighters worked the blaze with the help of bulldozers, helicopters and air tankers. Nine firefighters and two civilians have been treated for minor burns or smoke inhalation.

Pioneertown, established in the 1940s as a location for filming cowboy movies, lost none of its Western-style storefronts, but some residents weren't so lucky.

Rex Davis, 55, was told his nearby vacation home was destroyed but had to see it for himself.

"You're still thinking maybe it didn't burn," he said.

The two fires were each about 30 miles from Big Bear, one of several communities atop the San Bernardino Mountains that were evacuated when wildfires swept Southern California in 2003.

Those 15 fires were collectively the most devastating in recent state history, killing 22 people, destroying 3,640 homes and blackening 750,000 acres.

Robert Vinson, 51, brought his wife and two sons to the Big Bear Lakefront Lodge on Tuesday for a vacation to escape the 105-degree heat in his Riverside County town of Menifee. He planned to stay until Saturday unless things got hotter.

"When I see the flames from my hotel room and they get within 10 miles, I'm leaving. I'm not going to wait until they're under my balcony," he said.

Click here to visit FOXNews.com's Natural Disaster Center