ok, that makes sense BUT those constants are all named after entities so it's pretty safe to assume if entities are being represented with float values that those values must represent an ID (of sorts). That being assumed - how can entities share values with entities of a different "type". Entities of the same type (ie.. IT_) all have different float values assigned to them but by simply changing the "type" to (ex IT2_) you can start re-using floats.
I think I found the answer:
real rogue code:
float(float w) RankForWeapon =
{
if (w == IT_PLASMA_GUN)
return 1;
if (w == IT_LIGHTNING)
return 2;
if (w == IT_MULTI_ROCKET)
return 3;
if (w == IT_ROCKET_LAUNCHER)
return 4;
if (w == IT_LAVA_SUPER_NAILGUN)
return 5;
if (w == IT_SUPER_NAILGUN)
return 6;
if (w == IT_MULTI_GRENADE)
return 7;
if (w == IT_GRENADE_LAUNCHER)
return 8;
if (w == IT_LAVA_NAILGUN)
return 9;
if (w == IT_SUPER_SHOTGUN)
return 10;
if (w == IT_NAILGUN)
return 11;
return 12;
};
RankForWeapon is a function that accepts and returns a float. It is super safe to assume that ONLY a weapon can access this function. So therefore as long as all the weapons have a unique float, it doesn't matter if every other type of entitity had overlapping floats (in contrast to this group) because every different entity type (weapons, items, etc) will have their own sequestered functions. So, in short - all the float is is an ID. It's used as a comparison value in order to process inventory (and maybe some other "state machine" style functions).
Gypsy
I think I found the answer:
real rogue code:
float(float w) RankForWeapon =
{
if (w == IT_PLASMA_GUN)
return 1;
if (w == IT_LIGHTNING)
return 2;
if (w == IT_MULTI_ROCKET)
return 3;
if (w == IT_ROCKET_LAUNCHER)
return 4;
if (w == IT_LAVA_SUPER_NAILGUN)
return 5;
if (w == IT_SUPER_NAILGUN)
return 6;
if (w == IT_MULTI_GRENADE)
return 7;
if (w == IT_GRENADE_LAUNCHER)
return 8;
if (w == IT_LAVA_NAILGUN)
return 9;
if (w == IT_SUPER_SHOTGUN)
return 10;
if (w == IT_NAILGUN)
return 11;
return 12;
};
RankForWeapon is a function that accepts and returns a float. It is super safe to assume that ONLY a weapon can access this function. So therefore as long as all the weapons have a unique float, it doesn't matter if every other type of entitity had overlapping floats (in contrast to this group) because every different entity type (weapons, items, etc) will have their own sequestered functions. So, in short - all the float is is an ID. It's used as a comparison value in order to process inventory (and maybe some other "state machine" style functions).
Gypsy
Comment