]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - progsvm.h
Redesigned TaskQueue to have a queue and distributor model so that threads can keep...
[xonotic/darkplaces.git] / progsvm.h
index 0a46d2aaaaad42d1c5951bd98cba02727851a160..41c755d6358231fe245253950d26dea17509b195 100644 (file)
--- a/progsvm.h
+++ b/progsvm.h
@@ -116,43 +116,6 @@ typedef struct prvm_edict_s
        } fields;
 } prvm_edict_t;
 
-#define VMPOLYGONS_MAXPOINTS 64
-
-typedef struct vmpolygons_triangle_s
-{
-       rtexture_t              *texture;
-       int                             drawflag;
-       qboolean hasalpha;
-       unsigned short  elements[3];
-} vmpolygons_triangle_t;
-
-typedef struct vmpolygons_s
-{
-       mempool_t               *pool;
-       qboolean                initialized;
-
-       int                             max_vertices;
-       int                             num_vertices;
-       float                   *data_vertex3f;
-       float                   *data_color4f;
-       float                   *data_texcoord2f;
-
-       int                             max_triangles;
-       int                             num_triangles;
-       vmpolygons_triangle_t *data_triangles;
-       unsigned short  *data_sortedelement3s;
-
-       qboolean                begin_active;
-       int     begin_draw2d;
-       rtexture_t              *begin_texture;
-       int                             begin_drawflag;
-       int                             begin_vertices;
-       float                   begin_vertex[VMPOLYGONS_MAXPOINTS][3];
-       float                   begin_color[VMPOLYGONS_MAXPOINTS][4];
-       float                   begin_texcoord[VMPOLYGONS_MAXPOINTS][2];
-       qboolean                begin_texture_hasalpha;
-} vmpolygons_t;
-
 extern prvm_eval_t prvm_badvalue;
 
 #define PRVM_alledictfloat(ed, fieldname)    (PRVM_EDICTFIELDFLOAT(ed, prog->fieldoffsets.fieldname))
@@ -541,7 +504,7 @@ typedef struct prvm_prog_s
        ddef_t                          *globaldefs;
        mstatement_t            *statements;
        int                                     entityfields;                   // number of vec_t fields in progs (some variables are 3)
-       int                                     entityfieldsarea;               // LordHavoc: equal to max_edicts * entityfields (for bounds checking)
+       int                                     entityfieldsarea;               // LadyHavoc: equal to max_edicts * entityfields (for bounds checking)
 
        // loaded values from the disk format
        int                                     progs_version;
@@ -630,13 +593,22 @@ typedef struct prvm_prog_s
        fssearch_t                      *opensearches[PRVM_MAX_OPENSEARCHES];
        const char *         opensearches_origin[PRVM_MAX_OPENSEARCHES];
        skeleton_t                      *skeletons[MAX_EDICTS];
+       cmd_state_t                     *console_cmd; // points to the relevant console command interpreter for this vm (&cmd_client or &cmd_server), also used to access cvars
 
        // buffer for storing all tempstrings created during one invocation of ExecuteProgram
        sizebuf_t                       tempstringsbuf;
 
-       // LordHavoc: moved this here to clean up things that relied on prvm_prog_list too much
-       // FIXME: make VM_CL_R_Polygon functions use Debug_Polygon functions?
-       vmpolygons_t            vmpolygons;
+       // in csqc the polygonbegin,polygonvertex,polygonend sequencing is
+       // stateful, so this tracks the last polygonbegin's choice of
+       // CL_Mesh_CSQC or CL_Mesh_UI for this polygon
+       dp_model_t                      *polygonbegin_model;
+       // indicates if polygonbegin should be interpreted as 2d
+       // (clearscene sets this to false, renderscene sets this to true, drawpic
+       //  also sets this to true)
+       // note that in FTEQW polygonbegin with 2 args is handled very differently,
+       // where the behavior is always 3D unless DRAWFLAG_2D is passed, but
+       // DRAWFLAG_2D conflicts with our DRAWFLAG_SCREEN.
+       qboolean                        polygonbegin_guess2d;
 
        // copies of some vars that were former read from sv
        int                                     num_edicts;
@@ -786,10 +758,10 @@ void PRVM_ExecuteProgram (prvm_prog_t *prog, func_t fnum, const char *errormessa
 #define PRVM_Free(buffer) Mem_Free(buffer)
 
 void PRVM_Profile (prvm_prog_t *prog, int maxfunctions, double mintime, int sortby);
-void PRVM_Profile_f (void);
-void PRVM_ChildProfile_f (void);
-void PRVM_CallProfile_f (void);
-void PRVM_PrintFunction_f (void);
+void PRVM_Profile_f(cmd_state_t *cmd);
+void PRVM_ChildProfile_f(cmd_state_t *cmd);
+void PRVM_CallProfile_f(cmd_state_t *cmd);
+void PRVM_PrintFunction_f(cmd_state_t *cmd);
 
 void PRVM_PrintState(prvm_prog_t *prog, int stack_index);
 void PRVM_Crash(prvm_prog_t *prog);
@@ -859,7 +831,7 @@ extern      int             prvm_type_size[8]; // for consistency : I think a goal of this sub-p
 
 void PRVM_Init_Exec(prvm_prog_t *prog);
 
-void PRVM_ED_PrintEdicts_f (void);
+void PRVM_ED_PrintEdicts_f(cmd_state_t *cmd);
 void PRVM_ED_PrintNum (prvm_prog_t *prog, int ent, const char *wildcard_fieldname);
 
 const char *PRVM_GetString(prvm_prog_t *prog, int num);
@@ -884,7 +856,7 @@ Set up the fields marked with [INIT] in the prog struct
 Load a program with LoadProgs
 */
 // Load expects to be called right after Reset
-void PRVM_Prog_Init(prvm_prog_t *prog);
+void PRVM_Prog_Init(prvm_prog_t *prog, cmd_state_t *cmd);
 void PRVM_Prog_Load(prvm_prog_t *prog, const char *filename, unsigned char *data, fs_offset_t size, int numrequiredfunc, const char **required_func, int numrequiredfields, prvm_required_field_t *required_field, int numrequiredglobals, prvm_required_field_t *required_global);
 void PRVM_Prog_Reset(prvm_prog_t *prog);