FoaS has it right. If you have the source you can change a game engine. Some are designed with editable files to change parts of the game, but not alot, and major things normally can't be changed that way.
If you don't have the source you have to do what is known as reversing. Basicly you rewrite the whole game code by looking at what it does, and using some tools to get a look into the compiled code itself to help recreate the original source code. (not an easy process)