From 5c67f95edd0ae0d8f2f69ba6cbe2f99f0c63780c Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 26 Apr 2022 07:34:53 +0900 Subject: [PATCH] [qwaq] Set the world model to an empty world The goal is to have somewhere to put entities so they can be rendered. I suspect I could have used a bsp tree to partition space for frustum culling, but it's probably not worth it at this stage (but shouldn't require any changes to the engine: just the model). --- ruamoko/qwaq/builtins/graphics.c | 38 ++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/ruamoko/qwaq/builtins/graphics.c b/ruamoko/qwaq/builtins/graphics.c index 1d6841998..0e272a07a 100644 --- a/ruamoko/qwaq/builtins/graphics.c +++ b/ruamoko/qwaq/builtins/graphics.c @@ -86,6 +86,40 @@ static progs_t *bi_rprogs; static pr_func_t qc2d; static int event_handler_id; +static mleaf_t empty_leafs[] = { + [1] = { + .contents = CONTENTS_EMPTY, + .mins = {-INFINITY, -INFINITY, -INFINITY}, + .maxs = { INFINITY, INFINITY, INFINITY}, + }, +}; + +static mnode_t *empty_leaf_parents[] = { + [1] = 0, +}; + +static int empty_leaf_flags[] = { + [1] = 0, +}; + +static char empty_entities[] = { 0 }; + +static model_t empty_world = { + .type = mod_brush, + .radius = INFINITY, + .mins = {-INFINITY, -INFINITY, -INFINITY}, + .maxs = { INFINITY, INFINITY, INFINITY}, + .brush = { + .modleafs = 2, + .visleafs = 1, + .nodes = (mnode_t *) &empty_leafs[1], + .leafs = empty_leafs, + .entities = empty_entities, + .leaf_parents = empty_leaf_parents, + .leaf_flags = empty_leaf_flags, + }, +}; + static void bi_2d (void) { @@ -196,4 +230,8 @@ BI_Graphics_Init (progs_t *pr) //CDAudio_Init (); Con_NewMap (); basetime = Sys_DoubleTime (); + if (mod_funcs->Mod_ProcessTexture) { + mod_funcs->Mod_ProcessTexture (&empty_world, 0); + } + r_funcs->R_NewMap (&empty_world, 0, 0); }