]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - pr_comp.h
host: Check !host.restless instead of !cls.demoplayback for rand() call
[xonotic/darkplaces.git] / pr_comp.h
index 45cc9f13b538254245620e93a4454c917e41edd4..19b8f15a8c50f2758ddc86c7240a6ce993e84065 100644 (file)
--- a/pr_comp.h
+++ b/pr_comp.h
@@ -42,7 +42,7 @@ typedef enum etype_e {ev_void, ev_string, ev_float, ev_vector, ev_entity, ev_fie
 #define        RESERVED_OFS    28
 
 
-enum opcode_e
+typedef enum opcode_e
 {
        OP_DONE,
        OP_MUL_F,
@@ -118,8 +118,91 @@ enum opcode_e
        OP_OR,
 
        OP_BITAND,
-       OP_BITOR
-};
+       OP_BITOR,
+
+       OP_STORE_I = 113,
+
+       OP_ADD_I = 116,
+       OP_ADD_FI,
+       OP_ADD_IF,
+
+       OP_SUB_I,
+       OP_SUB_FI,
+       OP_SUB_IF,
+       OP_CONV_IF,
+       OP_CONV_FI,
+
+       OP_LOAD_I = 126,
+       OP_STOREP_I,
+
+       OP_BITAND_I = 130,
+       OP_BITOR_I,
+
+       OP_MUL_I,
+       OP_DIV_I,
+       OP_EQ_I,
+       OP_NE_I,
+
+       OP_NOT_I = 138,
+
+       OP_DIV_VF,
+       
+       OP_STORE_P = 152,
+
+       OP_LE_I = 161,
+       OP_GE_I,
+       OP_LT_I,
+       OP_GT_I,
+       
+       OP_LE_IF,
+       OP_GE_IF,
+       OP_LT_IF,
+       OP_GT_IF,
+
+       OP_LE_FI,
+       OP_GE_FI,
+       OP_LT_FI,
+       OP_GT_FI,
+
+       OP_EQ_IF,
+       OP_EQ_FI,
+
+       OP_MUL_IF = 179,
+       OP_MUL_FI,
+       OP_MUL_VI,
+       OP_DIV_IF = 183,
+       OP_DIV_FI,
+       OP_BITAND_IF,
+       OP_BITOR_IF,
+       OP_BITAND_FI,
+       OP_BITOR_FI,
+       OP_AND_I,
+       OP_OR_I,
+       OP_AND_IF,
+       OP_OR_IF,
+       OP_AND_FI,
+       OP_OR_FI,
+       OP_NE_IF,
+       OP_NE_FI,
+
+       OP_GSTOREP_I,
+       OP_GSTOREP_F,
+       OP_GSTOREP_ENT,
+       OP_GSTOREP_FLD,
+       OP_GSTOREP_S,
+       OP_GSTOREP_FNC,         
+       OP_GSTOREP_V,
+       OP_GADDRESS,
+       OP_GLOAD_I,
+       OP_GLOAD_F,
+       OP_GLOAD_FLD,
+       OP_GLOAD_ENT,
+       OP_GLOAD_S,
+       OP_GLOAD_FNC,
+       OP_BOUNDCHECK,
+       OP_GLOAD_V = 216
+}
+opcode_t;
 
 
 typedef struct statement_s
@@ -164,10 +247,13 @@ typedef struct mfunction_s
        int             locals;                         // total ints of parms + locals
 
        // these are doubles so that they can count up to 54bits or so rather than 32bit
+       double  tprofile;           // realtime in this function
+       double  tbprofile;          // realtime in builtins called by this function (NOTE: builtins also have a tprofile!)
        double  profile;                // runtime
        double  builtinsprofile; // cost of builtin functions called by this function
        double  callcount; // times the functions has been called since the last profile call
        double  totaltime; // total execution time of this function DIRECTLY FROM THE ENGINE
+       double  tprofile_total;         // runtime (NOTE: tbprofile_total makes no real sense, so not accumulating that)
        double  profile_total;          // runtime
        double  builtinsprofile_total; // cost of builtin functions called by this function
        int     recursion;
@@ -180,6 +266,14 @@ typedef struct mfunction_s
 }
 mfunction_t;
 
+typedef struct mstatement_s
+{
+       opcode_t        op;
+       int                     operand[3]; // always a global or -1 for unused
+       int                     jumpabsolute; // only used by IF, IFNOT, GOTO
+}
+mstatement_t;
+
 
 #define        PROG_VERSION    6
 typedef struct dprograms_s