Skip to content

Commit

Permalink
Added conversion of fixed to float in the archived save game reader.
Browse files Browse the repository at this point in the history
  • Loading branch information
danij committed Aug 29, 2006
1 parent 8af66b6 commit 70a8311
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions doomsday/engine/portable/src/p_arch.c
Expand Up @@ -1878,6 +1878,33 @@ static void ReadValue(gamemap_t* map, valuetype_t valueType, void* dst,
value_Str(prop->size));
}
}
else if(valueType == DDVT_FLOAT)
{
float* d = dst;
switch(prop->size)
{
case 2:
if(flags & DT_UNSIGNED)
{
if(flags & DT_FRACBITS)
*d = FIX2FLT(USHORT(*((short*)(src))) << FRACBITS);
else
*d = FIX2FLT(USHORT(*((short*)(src))));
}
else
{
if(flags & DT_FRACBITS)
*d = FIX2FLT(SHORT(*((short*)(src))) << FRACBITS);
else
*d = FIX2FLT(SHORT(*((short*)(src))));
}
break;

default:
Con_Error("ReadValue: DDVT_FLOAT incompatible with value type %s\n",
value_Str(prop->size));
}
}
else if(valueType == DDVT_SHORT || valueType == DDVT_FLAT_INDEX)
{
short* d = dst;
Expand Down

0 comments on commit 70a8311

Please sign in to comment.