Hex to float convertion problem

Discuss Halo 2 modding, progress on figuring things out, mapfiles...you know the drill. Cheating discussion not allowed.
Post Reply
fun_bidoux





Posts: 7
Joined: Sat Apr 15, 2006 12:05 pm

Hex to float convertion problem

Post by fun_bidoux »

Hello,


I'm trying to make some thing with the coll tag but I dont know how to convert a hex(C3F528BE) string to a float(-0.165)... can somme one help me please?


Thanks,
User avatar
shade45




Translator Artisan Enthraller Logistician
Stylist Wave Firestorm New Age

Posts: 2270
Joined: Fri Apr 01, 2005 1:04 pm

Post by shade45 »

We'll I don't know the exact math to do the conversion. But all you need to do is highlight the hex value. Then assuming your using hex workshop look at the bottom left of the screen for the float value.

http://img478.imageshack.us/img478/3941/captureis4.jpg
fun_bidoux





Posts: 7
Joined: Sat Apr 15, 2006 12:05 pm

Post by fun_bidoux »

thanks but I whant to create a small application(c++) that will export and import collision between the maps and 3ds max.
User avatar
kornman00




ONI New Age

Posts: 146
Joined: Fri Dec 12, 2003 6:30 pm
Contact:

Post by kornman00 »

void blahblah()
{
int eatme = 0xC3F528BE;
float kthx = *(reinterpret_cast<float*>(&eatme));
}

if your doing in C++ though, why not just treat the data as a real number right from the start (assuming your trying to convert input data)?
fun_bidoux





Posts: 7
Joined: Sat Apr 15, 2006 12:05 pm

Post by fun_bidoux »

thanks you very much! :D It's working :D when you inverse the hex (C3F528BE to BE28F5C3).
User avatar
kornman00




ONI New Age

Posts: 146
Joined: Fri Dec 12, 2003 6:30 pm
Contact:

Post by kornman00 »

Yeah, code is always done in big endian (compiler takes care of byte swapping the result code), but windows runs on little endian machines.
Post Reply