]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
PRVM_64: make savegames precision-loss-less
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 11 Apr 2012 13:34:44 +0000 (13:34 +0000)
committerRudolf Polzer <divverent@alientrap.org>
Wed, 11 Apr 2012 13:36:44 +0000 (15:36 +0200)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11792 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=da3c5a5aa0e139aa68f51bec4d8c0763a99c908e

clvm_cmds.c
prvm_edict.c
quakedef.h

index c765ca252f8444245890ea55bfac499c17da5702..e5cfe01102cbda3057bb72159c8fba63a3ca07b2 100644 (file)
@@ -1602,7 +1602,7 @@ static void VM_CL_getplayerkey (prvm_prog_t *prog)
                        {
                                vec3_t origin;
                                Matrix4x4_OriginFromMatrix(&e->render.matrix, origin);
-                               dpsnprintf(t, sizeof(t), "%.9g %.9g %.9g", origin[0], origin[1], origin[2]);
+                               dpsnprintf(t, sizeof(t), VECTOR_LOSSLESS_FORMAT, origin[0], origin[1], origin[2]);
                        }
                }
        if(!t[0])
index 4d20f1c1045238c87c29616f7fe59cdf462d01e0..82392bbf8921b8082e0160566c8f5575bdddfcad 100644 (file)
@@ -526,10 +526,10 @@ char *PRVM_UglyValueString (prvm_prog_t *prog, etype_t type, prvm_eval_t *val, c
                dpsnprintf (line, linelength, "void");
                break;
        case ev_float:
-               dpsnprintf (line, linelength, "%.9g", val->_float);
+               dpsnprintf (line, linelength, FLOAT_LOSSLESS_FORMAT, val->_float);
                break;
        case ev_vector:
-               dpsnprintf (line, linelength, "%.9g %.9g %.9g", val->vector[0], val->vector[1], val->vector[2]);
+               dpsnprintf (line, linelength, VECTOR_LOSSLESS_FORMAT, val->vector[0], val->vector[1], val->vector[2]);
                break;
        default:
                dpsnprintf (line, linelength, "bad type %i", type);
index a3ba79f3abd901a702db039df625cf10969b6646..acd0a90912e9c73c21db247b7be34a68c01f47c5 100644 (file)
@@ -553,8 +553,12 @@ void Sys_Shared_Init(void);
 
 #ifdef PRVM_64
 #define FLOAT_IS_TRUE_FOR_INT(x) ((x) & 0x7FFFFFFFFFFFFFFF) // also match "negative zero" doubles of value 0x8000000000000000
+#define FLOAT_LOSSLESS_FORMART "%.17g"
+#define VECTOR_LOSSLESS_FORMART "%.17g %.17g %.17g"
 #else
 #define FLOAT_IS_TRUE_FOR_INT(x) ((x) & 0x7FFFFFFF) // also match "negative zero" floats of value 0x80000000
+#define FLOAT_LOSSLESS_FORMART "%.9g"
+#define VECTOR_LOSSLESS_FORMART "%.9g %.9g %.9g"
 #endif
 
 #endif