コード例 #1
0
ファイル: ProgsEdict.cs プロジェクト: Memorix101/SharpQuake
        /// <summary>
        /// PR_UglyValueString
        /// Returns a string describing *data in a type specific manner
        /// Easier to parse than PR_ValueString
        /// </summary>
        static unsafe string UglyValueString(etype_t type, eval_t* val)
        {
            type &= (etype_t)~DEF_SAVEGLOBAL;
            string result;

            switch (type)
            {
                case etype_t.ev_string:
                    result = GetString(val->_string);
                    break;

                case etype_t.ev_entity:
                    result = Server.NumForEdict(Server.ProgToEdict(val->edict)).ToString();
                    break;

                case etype_t.ev_function:
                    dfunction_t f = _Functions[val->function];
                    result = GetString(f.s_name);
                    break;

                case etype_t.ev_field:
                    ddef_t def = FindField(val->_int);
                    result = GetString(def.s_name);
                    break;

                case etype_t.ev_void:
                    result = "void";
                    break;

                case etype_t.ev_float:
                    result = val->_float.ToString("F6", CultureInfo.InvariantCulture.NumberFormat);
                    break;

                case etype_t.ev_vector:
                    result = String.Format(CultureInfo.InvariantCulture.NumberFormat,
                        "{0:F6} {1:F6} {2:F6}", val->vector[0], val->vector[1], val->vector[2]);
                    break;

                default:
                    result = "bad type " + type.ToString();
                    break;
            }

            return result;
        }
コード例 #2
0
ファイル: Progs.cs プロジェクト: Memorix101/SharpQuake
 public unsafe void StoreVector(int offset, eval_t* value)
 {
     int offset1;
     if (IsV(offset, out offset1))
     {
         fixed (void* pv = &this.v)
         {
             eval_t* a = (eval_t*)((int*)pv + offset1);
             a->vector[0] = value->vector[0];
             a->vector[1] = value->vector[1];
             a->vector[2] = value->vector[2];
         }
     }
     else
     {
         fixed (void* pf = this.fields)
         {
             eval_t* a = (eval_t*)((int*)pf + offset1);
             a->vector[0] = value->vector[0];
             a->vector[1] = value->vector[1];
             a->vector[2] = value->vector[2];
         }
     }
 }
コード例 #3
0
ファイル: Progs.cs プロジェクト: Memorix101/SharpQuake
 public unsafe void LoadVector(int offset, eval_t* result)
 {
     int offset1;
     if (IsV(offset, out offset1))
     {
         fixed (void* pv = &this.v)
         {
             eval_t* a = (eval_t*)((int*)pv + offset1);
             result->vector[0] = a->vector[0];
             result->vector[1] = a->vector[1];
             result->vector[2] = a->vector[2];
         }
     }
     else
     {
         fixed (void* pf = this.fields)
         {
             eval_t* a = (eval_t*)((int*)pf + offset1);
             result->vector[0] = a->vector[0];
             result->vector[1] = a->vector[1];
             result->vector[2] = a->vector[2];
         }
     }
 }
コード例 #4
0
ファイル: Progs.cs プロジェクト: Memorix101/SharpQuake
 public unsafe void StoreInt(int offset, eval_t* value)
 {
     int offset1;
     if (IsV(offset, out offset1))
     {
         fixed (void* pv = &this.v)
         {
             eval_t* a = (eval_t*)((int*)pv + offset1);
             a->_int = value->_int;
         }
     }
     else
     {
         fixed (void* pv = this.fields)
         {
             eval_t* a = (eval_t*)((int*)pv + offset1);
             a->_int = value->_int;
         }
     }
 }
コード例 #5
0
ファイル: Progs.cs プロジェクト: Memorix101/SharpQuake
 public unsafe void LoadInt(int offset, eval_t* result)
 {
     int offset1;
     if (IsV(offset, out offset1))
     {
         fixed (void* pv = &this.v)
         {
             eval_t* a = (eval_t*)((int*)pv + offset1);
             result->_int = a->_int;
         }
     }
     else
     {
         fixed (void* pv = this.fields)
         {
             eval_t* a = (eval_t*)((int*)pv + offset1);
             result->_int = a->_int;
         }
     }
 }