I was trying to convert 32bit game client to 64bit. But I can't compile, because the client has an inline ASM code, 64bit doesn't support __asm inline. So I can't find a solution for this. I hope I can get into this community.
define inline code:
#define PR_FLOAT_TO_INTASM __asm \
{ \
__asm fld PR_FCNV \
__asm fistp PR_ICNV \
}
#define PR_FLOAT_TO_INT(inreal, outint) \
{ \
PR_FCNV = (inreal); \
PR_FLOAT_TO_INTASM; \
(outint) = PR_ICNV > PR_FCNV ? PR_ICNV - 1 : PR_ICNV; \
}
Example code using:
float CMapOutdoor::GetTerrainHeight(float fx, float fy)
{
if (fy < 0)
fy = -fy;
long lx, ly;
PR_FLOAT_TO_INT(fx, lx);
PR_FLOAT_TO_INT(fy, ly);
WORD usCoordX, usCoordY;
usCoordX = (WORD)(lx / CTerrainImpl::TERRAIN_XSIZE);
usCoordY = (WORD)(ly / CTerrainImpl::TERRAIN_YSIZE);
BYTE byTerrainNum;
if (!GetTerrainNumFromCoord(usCoordX, usCoordY, &byTerrainNum))
return 0.0f;
CTerrain* pTerrain;
if (!GetTerrainPointer(byTerrainNum, &pTerrain))
return 0.0f;
return pTerrain->GetHeight(lx, ly);
}
Error code:
error C2146: syntax error : missing ';' before identifier 'PR_ICNV'
error C2146: syntax error : missing ';' before identifier 'fistp'
error C2146: syntax error : missing ';' before identifier '}'