Hello and thanks for the query
Firstly I may know your age? Lots depend on it.
According to the symptoms like cracking sounds it seems you have Osteoarthritis
of knee and hip but be need not to forget about PIVD at a age above 40. Consult you doctor and go far X-ray Knee and Lumberspine to rule out the cause.
The other possibility for the pain are Gout
and Avascular Necrosis
My advise to you consult you doctor and get diagnosed and treatment according to that.