mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-21 03:01:15 +00:00
[ruamoko] Move emtpy_world into scene
And use it as the default worldmodel for new scenes. Since it's statically allocated, it shouldn't cause any harm so long as no one tries to free it.
This commit is contained in:
parent
d850285e3f
commit
95264b3a54
2 changed files with 47 additions and 46 deletions
|
@ -38,6 +38,7 @@
|
|||
#include "QF/mathlib.h"
|
||||
#include "QF/progs.h" // for PR_RESMAP
|
||||
#include "QF/sys.h"
|
||||
#include "QF/model.h"
|
||||
|
||||
#include "QF/scene/entity.h"
|
||||
#include "QF/scene/scene.h"
|
||||
|
@ -45,6 +46,40 @@
|
|||
|
||||
#include "scn_internal.h"
|
||||
|
||||
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,
|
||||
},
|
||||
};
|
||||
|
||||
scene_t *
|
||||
Scene_NewScene (void)
|
||||
{
|
||||
|
@ -55,6 +90,8 @@ Scene_NewScene (void)
|
|||
res = calloc (1, sizeof (scene_resources_t));
|
||||
*(scene_resources_t **)&scene->resources = res;
|
||||
|
||||
scene->worldmodel = &empty_world;
|
||||
|
||||
return scene;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,26 +41,20 @@ static __attribute__ ((used)) const char rcsid[] = "$Id$";
|
|||
#include <string.h>
|
||||
|
||||
#include "QF/cbuf.h"
|
||||
#include "QF/cdaudio.h"
|
||||
#include "QF/console.h"
|
||||
#include "QF/draw.h"
|
||||
#include "QF/dstring.h"
|
||||
#include "QF/input.h"
|
||||
#include "QF/model.h"
|
||||
#include "QF/plugin.h"
|
||||
#include "QF/progs.h"
|
||||
#include "QF/quakefs.h"
|
||||
#include "QF/render.h"
|
||||
#include "QF/ruamoko.h"
|
||||
#include "QF/screen.h"
|
||||
#include "QF/sound.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/vid.h"
|
||||
|
||||
#include "QF/input/event.h"
|
||||
|
||||
#include "QF/plugin/console.h"
|
||||
#include "QF/plugin/vid_render.h"
|
||||
|
||||
#include "rua_internal.h"
|
||||
|
||||
#include "ruamoko/qwaq/qwaq.h"
|
||||
|
||||
|
@ -86,40 +80,6 @@ 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)
|
||||
{
|
||||
|
@ -133,6 +93,13 @@ static SCR_Func bi_2dfuncs[] = {
|
|||
0,
|
||||
};
|
||||
|
||||
static void
|
||||
bi_newscene (progs_t *pr, void *_res)
|
||||
{
|
||||
pr_ulong_t scene_id = P_ULONG (pr, 0);
|
||||
SCR_NewScene (Scene_GetScene (pr, scene_id));
|
||||
}
|
||||
|
||||
static void
|
||||
bi_refresh (progs_t *pr, void *_res)
|
||||
{
|
||||
|
@ -162,6 +129,7 @@ bi_shutdown (progs_t *pr, void *_res)
|
|||
#define bi(x,n,np,params...) {#x, bi_##x, n, np, {params}}
|
||||
#define p(type) PR_PARAM(type)
|
||||
static builtin_t builtins[] = {
|
||||
bi(newscene, -1, 1, p(long)),
|
||||
bi(refresh, -1, 0),
|
||||
bi(refresh_2d, -1, 1, p(func)),
|
||||
bi(shutdown, -1, 0),
|
||||
|
@ -230,8 +198,4 @@ 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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue