You can perform the "engine change" you've described above and pass the smog check. However, while installing the 2004 Chevy Silverado engine, you will need to install ALL the emission components from that engine including the catalytic converter and EVAP system. The exhaust system (the mufflers and everything after the CAT) can be that of the 1985. The muffler is not part of the smog inspection.
After the swap is complete, your Chevy truck will have to be inspected by a California State Referee. A regular smog check station will not be allowed to perform the initial smog check on the truck. You must visit a smog check referee office. The referee will ensure that the engine change was done properly and that the new engine does not pollute. If all is well they will issue you a BAR label which will be placed somewhere on your vehicles chassis which will be an indication that your Chevy truck is now California legal.
We recommend you speak directly with a State Referee before beginning any work, just to get the fine details. You can contact the referee by calling (800) 622-7733.