diff --git a/include/QF/GL/qf_rmain.h b/include/QF/GL/qf_rmain.h index a9aea8770..85048cb05 100644 --- a/include/QF/GL/qf_rmain.h +++ b/include/QF/GL/qf_rmain.h @@ -45,8 +45,8 @@ void gl_R_RotateForEntity (struct entity_s *e); struct model_s; struct entqueue_s; -void gl_R_NewMap (struct model_s *worldmodel, struct model_s **models, - int num_models); +struct scene_s; +void gl_R_NewScene (struct scene_s *scene); void gl_R_RenderView (void); void gl_R_RenderEntities (struct entqueue_s *queue); void gl_R_ClearState (void); diff --git a/include/QF/GLSL/qf_main.h b/include/QF/GLSL/qf_main.h index b194805fb..621c0b2af 100644 --- a/include/QF/GLSL/qf_main.h +++ b/include/QF/GLSL/qf_main.h @@ -29,8 +29,9 @@ #define __QF_GLSL_qf_main_h struct entqueue_s; +struct scene_s; -void glsl_R_NewMap (model_t *worldmodel, model_t **models, int num_models); +void glsl_R_NewScene (struct scene_s *scene); void glsl_R_RenderEntities (struct entqueue_s *queue); void glsl_R_RenderView (void); void glsl_R_ClearState (void); diff --git a/include/QF/Vulkan/qf_main.h b/include/QF/Vulkan/qf_main.h index b52b0a7f3..8d2da31d6 100644 --- a/include/QF/Vulkan/qf_main.h +++ b/include/QF/Vulkan/qf_main.h @@ -31,9 +31,9 @@ struct vulkan_ctx_s; struct qfv_renderframe_s; struct entqueue_s; +struct scene_s; -void Vulkan_NewMap (model_t *worldmodel, struct model_s **models, - int num_models, struct vulkan_ctx_s *ctx); +void Vulkan_NewScene (struct scene_s *scene, struct vulkan_ctx_s *ctx); void Vulkan_RenderView (struct qfv_renderframe_s *rFrame); void Vulkan_RenderEntities (struct entqueue_s *queue, struct qfv_renderframe_s *rFrame); diff --git a/include/QF/plugin/vid_render.h b/include/QF/plugin/vid_render.h index 0118df52f..1bcffe276 100644 --- a/include/QF/plugin/vid_render.h +++ b/include/QF/plugin/vid_render.h @@ -35,6 +35,7 @@ struct plitem_s; struct cvar_s; +struct scene_s; struct skin_s; struct mod_alias_ctx_s; @@ -105,7 +106,7 @@ typedef struct vid_render_funcs_s { void (*R_Init) (void); void (*R_ClearState) (void); void (*R_LoadSkys) (const char *); - void (*R_NewMap) (model_t *worldmodel, model_t **models, int num_models); + void (*R_NewScene) (struct scene_s *scene); void (*R_LineGraph) (int x, int y, int *h_vals, int count, int height); void (*begin_frame) (void); diff --git a/include/QF/scene/scene.h b/include/QF/scene/scene.h index b74c29955..66995bb9e 100644 --- a/include/QF/scene/scene.h +++ b/include/QF/scene/scene.h @@ -43,6 +43,9 @@ typedef struct scene_s { struct scene_resources_s *const resources; struct hierarchy_s *hierarchies; + struct model_s *worldmodel; + int num_models; + struct model_s **models; } scene_t; scene_t *Scene_NewScene (void); diff --git a/include/QF/screen.h b/include/QF/screen.h index 362cae41b..d53b1b1ee 100644 --- a/include/QF/screen.h +++ b/include/QF/screen.h @@ -29,6 +29,7 @@ #ifndef __QF_screen_h #define __QF_screen_h +struct scene_s; struct transform_s; struct tex_s; @@ -47,6 +48,8 @@ void SCR_SetFOV (float fov); void SCR_SetFullscreen (qboolean fullscreen); void SCR_SetBottomMargin (int lines); +void SCR_NewScene (struct scene_s *scene); + extern int hud_fps; extern int hud_time; extern int r_timegraph; diff --git a/include/client/world.h b/include/client/world.h index 191e313d8..ba67d9c35 100644 --- a/include/client/world.h +++ b/include/client/world.h @@ -43,7 +43,6 @@ typedef struct worldscene_s { struct scene_s *scene; struct plitem_s *edicts; struct plitem_s *worldspawn; - struct model_s *worldmodel; modelset_t models; } worldscene_t; diff --git a/include/r_internal.h b/include/r_internal.h index 8b43dac0a..2d8feccc4 100644 --- a/include/r_internal.h +++ b/include/r_internal.h @@ -45,7 +45,8 @@ struct psystem_s *glsl_ParticleSystem (void); struct psystem_s *sw_ParticleSystem (void); void R_RunParticles (float dT); -void R_NewMap (model_t *worldmodel, model_t **models, int num_models); +struct scene_s; +void R_NewScene (struct scene_s *scene); // LordHavoc: relative bmodel lighting void R_PushDlights (const vec3_t entorigin); diff --git a/include/r_local.h b/include/r_local.h index 486347f0d..4ea9d6795 100644 --- a/include/r_local.h +++ b/include/r_local.h @@ -202,8 +202,6 @@ extern void R_RotateBmodel (struct transform_s *transform); extern int c_faceclip; extern int r_polycount; -extern model_t *cl_worldmodel; - extern int *pfrustum_indexes[4]; // !!! if this is changed, it must be changed in asm_draw.h too !!! diff --git a/libs/client/cl_temp_entities.c b/libs/client/cl_temp_entities.c index 269a1c9ed..3be60f2bd 100644 --- a/libs/client/cl_temp_entities.c +++ b/libs/client/cl_temp_entities.c @@ -271,7 +271,7 @@ beam_setup (beam_t *b, qboolean transform, double time, TEntContext_t *ctx) } else { Transform_SetLocalPosition (tent->ent->transform, position); } - R_AddEfrags (&cl_world.worldmodel->brush, tent->ent); + R_AddEfrags (&cl_world.scene->worldmodel->brush, tent->ent); } } @@ -632,7 +632,7 @@ CL_UpdateExplosions (double time, TEntContext_t *ctx) ent->animation.frame = f; if (!ent->visibility.efrag) { - R_AddEfrags (&cl_world.worldmodel->brush, ent); + R_AddEfrags (&cl_world.scene->worldmodel->brush, ent); } } } @@ -721,7 +721,7 @@ CL_ParseProjectiles (qmsg_t *net_message, qboolean nail2, TEntContext_t *ctx) angles[2] = 0; CL_TransformEntity (tent->ent, 1, angles, position); - R_AddEfrags (&cl_world.worldmodel->brush, tent->ent); + R_AddEfrags (&cl_world.scene->worldmodel->brush, tent->ent); } *tail = cl_projectiles; diff --git a/libs/client/cl_world.c b/libs/client/cl_world.c index 436013f79..63f92ff5b 100644 --- a/libs/client/cl_world.c +++ b/libs/client/cl_world.c @@ -119,7 +119,7 @@ CL_ParseStatic (qmsg_t *msg, int version) CL_TransformEntity (ent, es.scale / 16.0, es.angles, es.origin); - R_AddEfrags (&cl_world.worldmodel->brush, ent); + R_AddEfrags (&cl_world.scene->worldmodel->brush, ent); } static void @@ -205,9 +205,14 @@ CL_LoadSky (const char *name) void CL_World_NewMap (const char *mapname, const char *skyname) { + model_t *worldmodel = cl_world.models.a[1]; + cl_world.scene->worldmodel = worldmodel; + cl_static_entities.size = 0; - r_funcs->R_NewMap (cl_world.worldmodel, - cl_world.models.a, cl_world.models.size); + + cl_world.scene->models = cl_world.models.a; + cl_world.scene->num_models = cl_world.models.size; + SCR_NewScene (cl_world.scene); if (cl_world.models.a[1] && cl_world.models.a[1]->brush.entities) { if (cl_world.edicts) { PL_Free (cl_world.edicts); diff --git a/libs/video/renderer/gl/gl_rmisc.c b/libs/video/renderer/gl/gl_rmisc.c index f7056bcfb..681ca0771 100644 --- a/libs/video/renderer/gl/gl_rmisc.c +++ b/libs/video/renderer/gl/gl_rmisc.c @@ -66,6 +66,7 @@ #include "QF/GL/qf_vid.h" #include "QF/scene/entity.h" +#include "QF/scene/scene.h" #include "mod_internal.h" #include "r_internal.h" @@ -152,7 +153,7 @@ register_textures (mod_brush_t *brush) } void -gl_R_NewMap (model_t *worldmodel, struct model_s **models, int num_models) +gl_R_NewScene (scene_t *scene) { texture_t *tex; mod_brush_t *brush; @@ -160,8 +161,8 @@ gl_R_NewMap (model_t *worldmodel, struct model_s **models, int num_models) for (int i = 0; i < 256; i++) d_lightstylevalue[i] = 264; // normal light value - r_refdef.worldmodel = worldmodel; - brush = &worldmodel->brush; + r_refdef.worldmodel = scene->worldmodel; + brush = &scene->worldmodel->brush; // clear out efrags in case the level hasn't been reloaded for (unsigned i = 0; i < brush->modleafs; i++) @@ -173,7 +174,7 @@ gl_R_NewMap (model_t *worldmodel, struct model_s **models, int num_models) R_ClearParticles (); - GL_BuildLightmaps (models, num_models); + GL_BuildLightmaps (scene->models, scene->num_models); // identify sky texture gl_R_ClearTextures (); @@ -189,13 +190,13 @@ gl_R_NewMap (model_t *worldmodel, struct model_s **models, int num_models) gl_R_InitSurfaceChains (brush); gl_R_AddTexture (r_notexture_mip); register_textures (brush); - for (int i = 0; i < num_models; i++) { - if (!models[i]) + for (int i = 0; i < scene->num_models; i++) { + if (!scene->models[i]) continue; - if (*models[i]->path == '*') + if (*scene->models[i]->path == '*') continue; - if (models[i] != r_refdef.worldmodel - && models[i]->type == mod_brush) - register_textures (&models[i]->brush); + if (scene->models[i] != r_refdef.worldmodel + && scene->models[i]->type == mod_brush) + register_textures (&scene->models[i]->brush); } } diff --git a/libs/video/renderer/glsl/glsl_main.c b/libs/video/renderer/glsl/glsl_main.c index ba5ef36f2..5ea42af56 100644 --- a/libs/video/renderer/glsl/glsl_main.c +++ b/libs/video/renderer/glsl/glsl_main.c @@ -46,6 +46,7 @@ #include "QF/sys.h" #include "QF/scene/entity.h" +#include "QF/scene/scene.h" #include "QF/GLSL/defines.h" #include "QF/GLSL/funcs.h" @@ -188,23 +189,23 @@ glsl_R_Init (void) } void -glsl_R_NewMap (model_t *worldmodel, struct model_s **models, int num_models) +glsl_R_NewScene (scene_t *scene) { int i; for (i = 0; i < 256; i++) d_lightstylevalue[i] = 264; // normal light value - r_refdef.worldmodel = worldmodel; + r_refdef.worldmodel = scene->worldmodel; // Force a vis update r_refdef.viewleaf = NULL; R_MarkLeaves (); R_ClearParticles (); - glsl_R_RegisterTextures (models, num_models); - glsl_R_BuildLightmaps (models, num_models); - glsl_R_BuildDisplayLists (models, num_models); + glsl_R_RegisterTextures (scene->models, scene->num_models); + glsl_R_BuildLightmaps (scene->models, scene->num_models); + glsl_R_BuildDisplayLists (scene->models, scene->num_models); } void diff --git a/libs/video/renderer/r_screen.c b/libs/video/renderer/r_screen.c index 188b0ed93..a199fa368 100644 --- a/libs/video/renderer/r_screen.c +++ b/libs/video/renderer/r_screen.c @@ -49,6 +49,7 @@ #include "QF/va.h" #include "QF/scene/entity.h" +#include "QF/scene/scene.h" #include "QF/scene/transform.h" #include "QF/ui/view.h" @@ -71,6 +72,7 @@ static framebuffer_t *warp_buffer; static float fov_x, fov_y; static float tan_fov_x, tan_fov_y; +static scene_t *scr_scene;//FIXME don't want this here static mat4f_t box_rotations[] = { [BOX_FRONT] = { @@ -505,3 +507,15 @@ SCR_Init (void) Cvar_AddListener (var, viewsize_listener, 0); update_vrect (); } + +void +SCR_NewScene (scene_t *scene) +{ + scr_scene = scene; + if (scene) { + r_funcs->set_fov (tan_fov_x, tan_fov_y); + r_funcs->R_NewScene (scene); + } else { + r_funcs->R_ClearState (); + } +} diff --git a/libs/video/renderer/sw/sw_rmain.c b/libs/video/renderer/sw/sw_rmain.c index e05755a80..9bd3c3f1c 100644 --- a/libs/video/renderer/sw/sw_rmain.c +++ b/libs/video/renderer/sw/sw_rmain.c @@ -49,6 +49,7 @@ #include "QF/sys.h" #include "QF/scene/entity.h" +#include "QF/scene/scene.h" #include "compat.h" #include "mod_internal.h" @@ -151,8 +152,9 @@ sw_R_Init (void) } void -R_NewMap (model_t *worldmodel, struct model_s **models, int num_models) +R_NewScene (scene_t *scene) { + model_t *worldmodel = scene->worldmodel; mod_brush_t *brush = &worldmodel->brush; r_refdef.worldmodel = worldmodel; diff --git a/libs/video/renderer/vid_render_gl.c b/libs/video/renderer/vid_render_gl.c index fa0c7738b..9d99ca43d 100644 --- a/libs/video/renderer/vid_render_gl.c +++ b/libs/video/renderer/vid_render_gl.c @@ -510,7 +510,7 @@ vid_render_funcs_t gl_vid_render_funcs = { gl_R_Init, gl_R_ClearState, gl_R_LoadSkys, - gl_R_NewMap, + gl_R_NewScene, gl_R_LineGraph, gl_begin_frame, gl_render_view, diff --git a/libs/video/renderer/vid_render_glsl.c b/libs/video/renderer/vid_render_glsl.c index 4c4aff0d3..132e1f062 100644 --- a/libs/video/renderer/vid_render_glsl.c +++ b/libs/video/renderer/vid_render_glsl.c @@ -454,7 +454,7 @@ vid_render_funcs_t glsl_vid_render_funcs = { glsl_R_Init, glsl_R_ClearState, glsl_R_LoadSkys, - glsl_R_NewMap, + glsl_R_NewScene, glsl_R_LineGraph, glsl_begin_frame, glsl_render_view, diff --git a/libs/video/renderer/vid_render_sw.c b/libs/video/renderer/vid_render_sw.c index 5d8c18f0c..a7d69ada7 100644 --- a/libs/video/renderer/vid_render_sw.c +++ b/libs/video/renderer/vid_render_sw.c @@ -474,7 +474,7 @@ vid_render_funcs_t sw_vid_render_funcs = { sw_R_Init, R_ClearState, R_LoadSkys, - R_NewMap, + R_NewScene, R_LineGraph, sw_begin_frame, sw_render_view, diff --git a/libs/video/renderer/vid_render_vulkan.c b/libs/video/renderer/vid_render_vulkan.c index 424363571..a52e3b7eb 100644 --- a/libs/video/renderer/vid_render_vulkan.c +++ b/libs/video/renderer/vid_render_vulkan.c @@ -64,6 +64,7 @@ #include "QF/ui/view.h" #include "QF/scene/entity.h" +#include "QF/scene/scene.h" #include "mod_internal.h" #include "r_internal.h" @@ -118,9 +119,9 @@ vulkan_R_LoadSkys (const char *skyname) } static void -vulkan_R_NewMap (model_t *worldmodel, model_t **models, int num_models) +vulkan_R_NewScene (scene_t *scene) { - Vulkan_NewMap (worldmodel, models, num_models, vulkan_ctx); + Vulkan_NewScene (scene, vulkan_ctx); } static void @@ -727,7 +728,7 @@ vid_render_funcs_t vulkan_vid_render_funcs = { vulkan_R_Init, vulkan_R_ClearState, vulkan_R_LoadSkys, - vulkan_R_NewMap, + vulkan_R_NewScene, vulkan_R_LineGraph, vulkan_begin_frame, vulkan_render_view, diff --git a/libs/video/renderer/vulkan/vulkan_main.c b/libs/video/renderer/vulkan/vulkan_main.c index 6acf30d09..17c74ec6b 100644 --- a/libs/video/renderer/vulkan/vulkan_main.c +++ b/libs/video/renderer/vulkan/vulkan_main.c @@ -46,6 +46,7 @@ #include "QF/sys.h" #include "QF/scene/entity.h" +#include "QF/scene/scene.h" #include "QF/Vulkan/qf_vid.h" #include "QF/Vulkan/qf_alias.h" @@ -130,8 +131,7 @@ Vulkan_RenderView (qfv_renderframe_t *rFrame) } void -Vulkan_NewMap (model_t *worldmodel, struct model_s **models, int num_models, - vulkan_ctx_t *ctx) +Vulkan_NewScene (scene_t *scene, vulkan_ctx_t *ctx) { int i; @@ -139,17 +139,17 @@ Vulkan_NewMap (model_t *worldmodel, struct model_s **models, int num_models, d_lightstylevalue[i] = 264; // normal light value } - r_refdef.worldmodel = worldmodel; + r_refdef.worldmodel = scene->worldmodel; // Force a vis update r_refdef.viewleaf = NULL; R_MarkLeaves (); R_ClearParticles (); - Vulkan_RegisterTextures (models, num_models, ctx); - //Vulkan_BuildLightmaps (models, num_models, ctx); - Vulkan_BuildDisplayLists (models, num_models, ctx); - Vulkan_LoadLights (worldmodel, worldmodel->brush.entities, ctx); + Vulkan_RegisterTextures (scene->models, scene->num_models, ctx); + //Vulkan_BuildLightmaps (scene->models, scene->num_models, ctx); + Vulkan_BuildDisplayLists (scene->models, scene->num_models, ctx); + Vulkan_LoadLights (scene->worldmodel, scene->worldmodel->brush.entities, ctx); } /*void diff --git a/nq/source/cl_demo.c b/nq/source/cl_demo.c index 510ea767c..538ed10bf 100644 --- a/nq/source/cl_demo.c +++ b/nq/source/cl_demo.c @@ -46,6 +46,8 @@ #include "QF/sys.h" #include "QF/va.h" +#include "QF/scene/scene.h" + #include "compat.h" #include "client/world.h" @@ -375,7 +377,7 @@ demo_default_name (const char *argv1) strftime (timestring, 19, "%Y-%m-%d-%H-%M", localtime (&tim)); // the leading path-name is to be removed from cl_world.worldmodel->name - mapname = QFS_SkipPath (cl_world.worldmodel->path); + mapname = QFS_SkipPath (cl_world.scene->worldmodel->path); // the map name is cut off after any "." because this would prevent // an extension being appended diff --git a/nq/source/cl_ents.c b/nq/source/cl_ents.c index 9d0a4d357..cdfbe644d 100644 --- a/nq/source/cl_ents.c +++ b/nq/source/cl_ents.c @@ -263,7 +263,7 @@ CL_RelinkEntities (void) if (ent->visibility.efrag) { R_RemoveEfrags (ent); } - R_AddEfrags (&cl_world.worldmodel->brush, ent); + R_AddEfrags (&cl_world.scene->worldmodel->brush, ent); } ent->old_origin = new->origin; } else { @@ -299,10 +299,10 @@ CL_RelinkEntities (void) = Transform_GetWorldPosition (ent->transform); if (!VectorCompare (org, ent->old_origin)) {//FIXME R_RemoveEfrags (ent); - R_AddEfrags (&cl_world.worldmodel->brush, ent); + R_AddEfrags (&cl_world.scene->worldmodel->brush, ent); } } else { - R_AddEfrags (&cl_world.worldmodel->brush, ent); + R_AddEfrags (&cl_world.scene->worldmodel->brush, ent); } } } diff --git a/nq/source/cl_main.c b/nq/source/cl_main.c index e05d98c7d..0d3f0864f 100644 --- a/nq/source/cl_main.c +++ b/nq/source/cl_main.c @@ -295,7 +295,7 @@ CL_ClearState (void) CL_ClearTEnts (); - r_funcs->R_ClearState (); + SCR_NewScene (0); CL_ClearEnts (); @@ -354,7 +354,7 @@ CL_Disconnect (void) Host_ShutdownServer (false); } - cl_world.worldmodel = NULL; + cl_world.scene->worldmodel = NULL; cl.intermission = 0; cl.viewstate.intermission = 0; } @@ -467,7 +467,7 @@ CL_NextDemo (void) static void pointfile_f (void) { - CL_LoadPointFile (cl_world.worldmodel); + CL_LoadPointFile (cl_world.scene->worldmodel); } static void diff --git a/nq/source/cl_parse.c b/nq/source/cl_parse.c index b9c1f0ac6..db35c61fd 100644 --- a/nq/source/cl_parse.c +++ b/nq/source/cl_parse.c @@ -252,10 +252,13 @@ CL_KeepaliveMessage (void) static void CL_NewMap (const char *mapname) { - Con_NewMap (); - Hunk_Check (0); // make sure nothing is hurt - Sbar_CenterPrint (0); CL_World_NewMap (mapname, 0); + cl.chasestate.worldmodel = cl_world.scene->worldmodel; + + Con_NewMap (); + Sbar_CenterPrint (0); + + Hunk_Check (0); // make sure nothing is hurt } static void @@ -349,9 +352,9 @@ CL_ParseServerInfo (void) strcpy (sound_precache[cl.numsounds], str); } - // now we try to load everything else until a cache allocation fails CL_MapCfg (model_precache[1]); + // now we try to load everything else until a cache allocation fails for (i = 1; i < nummodels; i++) { DARRAY_APPEND (&cl_world.models, Mod_ForName (model_precache[i], false)); @@ -368,16 +371,12 @@ CL_ParseServerInfo (void) } // local state - cl_world.worldmodel = cl_world.models.a[1]; - cl.chasestate.worldmodel = cl_world.worldmodel; if (!centerprint) centerprint = dstring_newstr (); else dstring_clearstr (centerprint); CL_NewMap (model_precache[1]); - Hunk_Check (0); // make sure nothing is hurt - noclip_anglehack = false; // noclip is turned off at start CL_ParticlesGravity (800); // Set up gravity for renderer effects done: diff --git a/nq/source/cl_screen.c b/nq/source/cl_screen.c index 4bbb1f9dd..bd2effd81 100644 --- a/nq/source/cl_screen.c +++ b/nq/source/cl_screen.c @@ -46,6 +46,7 @@ #include "QF/plugin/vid_render.h" +#include "QF/scene/scene.h" #include "QF/scene/transform.h" #include "QF/ui/view.h" @@ -79,10 +80,10 @@ SCR_CShift (void) mleaf_t *leaf; int contents = CONTENTS_EMPTY; - if (cls.state == ca_active && cl_world.worldmodel) { + if (cls.state == ca_active && cl_world.scene->worldmodel) { vec4f_t origin; origin = Transform_GetWorldPosition (cl.viewstate.camera_transform); - leaf = Mod_PointInLeaf ((vec_t*)&origin, cl_world.worldmodel);//FIXME + leaf = Mod_PointInLeaf ((vec_t*)&origin, cl_world.scene->worldmodel);//FIXME contents = leaf->contents; } V_SetContentsColor (&cl.viewstate, contents); diff --git a/nq/source/host.c b/nq/source/host.c index ca58afed5..b1cade921 100644 --- a/nq/source/host.c +++ b/nq/source/host.c @@ -54,6 +54,7 @@ #include "QF/plugin/console.h" #include "QF/plugin/vid_render.h" +#include "QF/scene/scene.h" #include "QF/scene/transform.h" #include "buildnum.h" @@ -740,7 +741,7 @@ Host_ClientFrame (void) vec4f_t origin; origin = Transform_GetWorldPosition (cl.viewstate.camera_transform); - l = Mod_PointInLeaf ((vec_t*)&origin, cl_world.worldmodel);//FIXME + l = Mod_PointInLeaf ((vec_t*)&origin, cl_world.scene->worldmodel);//FIXME if (l) asl = l->ambient_sound_level; S_Update (cl.viewstate.camera_transform, asl); diff --git a/qw/source/cl_demo.c b/qw/source/cl_demo.c index c7ede77e3..0026b72f5 100644 --- a/qw/source/cl_demo.c +++ b/qw/source/cl_demo.c @@ -54,6 +54,8 @@ #include "QF/sys.h" #include "QF/va.h" +#include "QF/scene/scene.h" + #include "compat.h" #include "client/world.h" @@ -669,8 +671,8 @@ demo_default_name (const char *argv1) time (&tim); strftime (timestring, 19, "%Y-%m-%d-%H-%M", localtime (&tim)); - // the leading path-name is to be removed from cl_world.worldmodel->name - mapname = QFS_SkipPath (cl_world.worldmodel->path); + // the leading path-name is to be removed from worldmodel->name + mapname = QFS_SkipPath (cl_world.scene->worldmodel->path); // the map name is cut off after any "." because this would prevent // an extension being appended diff --git a/qw/source/cl_entparse.c b/qw/source/cl_entparse.c index 26486ae41..d9ada8aa8 100644 --- a/qw/source/cl_entparse.c +++ b/qw/source/cl_entparse.c @@ -41,6 +41,8 @@ #include "QF/skin.h" #include "QF/sys.h" +#include "QF/scene/scene.h" + #include "compat.h" #include "client/temp_entities.h" @@ -530,7 +532,7 @@ CL_SetSolidEntities (void) frame_t *frame; packet_entities_t *pak; - pmove.physents[0].model = cl_world.worldmodel; + pmove.physents[0].model = cl_world.scene->worldmodel; VectorZero (pmove.physents[0].origin); VectorZero (pmove.physents[0].angles); pmove.physents[0].info = 0; diff --git a/qw/source/cl_ents.c b/qw/source/cl_ents.c index a4955c409..49ad77cc1 100644 --- a/qw/source/cl_ents.c +++ b/qw/source/cl_ents.c @@ -234,7 +234,7 @@ CL_LinkPacketEntities (void) if (ent->visibility.efrag) { R_RemoveEfrags (ent); } - R_AddEfrags (&cl_world.worldmodel->brush, ent); + R_AddEfrags (&cl_world.scene->worldmodel->brush, ent); } } else { vec4f_t delta = new->origin - old->origin; @@ -266,15 +266,15 @@ CL_LinkPacketEntities (void) = Transform_GetWorldPosition (ent->transform); if (!VectorCompare (org, ent->old_origin)) {//FIXME R_RemoveEfrags (ent); - R_AddEfrags (&cl_world.worldmodel->brush, ent); + R_AddEfrags (&cl_world.scene->worldmodel->brush, ent); } } else { - R_AddEfrags (&cl_world.worldmodel->brush, ent); + R_AddEfrags (&cl_world.scene->worldmodel->brush, ent); } } } if (!ent->visibility.efrag) { - R_AddEfrags (&cl_world.worldmodel->brush, ent); + R_AddEfrags (&cl_world.scene->worldmodel->brush, ent); } // rotate binary objects locally @@ -510,10 +510,10 @@ CL_LinkPlayers (void) } // stuff entity in map - R_AddEfrags (&cl_world.worldmodel->brush, ent); + R_AddEfrags (&cl_world.scene->worldmodel->brush, ent); if (player->flag_ent) { CL_UpdateFlagModels (ent, j); - R_AddEfrags (&cl_world.worldmodel->brush, player->flag_ent); + R_AddEfrags (&cl_world.scene->worldmodel->brush, player->flag_ent); } } } diff --git a/qw/source/cl_main.c b/qw/source/cl_main.c index bdb2ac24a..668208e6c 100644 --- a/qw/source/cl_main.c +++ b/qw/source/cl_main.c @@ -501,7 +501,7 @@ CL_Quit_f (void) static void pointfile_f (void) { - CL_LoadPointFile (cl_world.worldmodel); + CL_LoadPointFile (cl_world.scene->worldmodel); } static void @@ -794,7 +794,7 @@ CL_Disconnect (void) Info_Destroy (cl.players[i].userinfo); memset (&cl.players[i], 0, sizeof (cl.players[i])); } - cl_world.worldmodel = NULL; + cl_world.scene->worldmodel = NULL; cl.validsequence = 0; } @@ -1965,7 +1965,7 @@ Host_Frame (float time) vec4f_t origin; origin = Transform_GetWorldPosition (cl.viewstate.camera_transform); - l = Mod_PointInLeaf ((vec_t*)&origin, cl_world.worldmodel);//FIXME + l = Mod_PointInLeaf ((vec_t*)&origin, cl_world.scene->worldmodel);//FIXME if (l) asl = l->ambient_sound_level; S_Update (cl.viewstate.camera_transform, asl); diff --git a/qw/source/cl_parse.c b/qw/source/cl_parse.c index 5b58202ac..fa3c2075f 100644 --- a/qw/source/cl_parse.c +++ b/qw/source/cl_parse.c @@ -261,17 +261,19 @@ CL_CheckOrDownloadFile (const char *filename) static void CL_NewMap (const char *mapname) { - Team_NewMap (); - Con_NewMap (); - Hunk_Check (0); // make sure nothing is hurt - Sbar_CenterPrint (0); - const char *skyname = 0; // R_LoadSkys does the right thing with null pointers. if (cl.serverinfo) { skyname = Info_ValueForKey (cl.serverinfo, "sky"); } CL_World_NewMap (mapname, skyname); + cl.chasestate.worldmodel = cl_world.scene->worldmodel; + + Team_NewMap (); + Con_NewMap (); + Sbar_CenterPrint (0); + + Hunk_Check (0); // make sure nothing is hurt } static void @@ -353,8 +355,6 @@ Model_NextDownload (void) } // all done - cl_world.worldmodel = cl_world.models.a[1]; - cl.chasestate.worldmodel = cl_world.worldmodel; CL_NewMap (cl.model_name[1]); // done with modellist, request first of static signon messages @@ -362,7 +362,7 @@ Model_NextDownload (void) MSG_WriteByte (&cls.netchan.message, clc_stringcmd); MSG_WriteString (&cls.netchan.message, va (0, prespawn_name, cl.servercount, - cl_world.worldmodel->brush.checksum2)); + cl_world.scene->worldmodel->brush.checksum2)); } } diff --git a/qw/source/cl_screen.c b/qw/source/cl_screen.c index 82fd9b63d..54871dac5 100644 --- a/qw/source/cl_screen.c +++ b/qw/source/cl_screen.c @@ -44,6 +44,7 @@ #include "QF/pcx.h" #include "QF/screen.h" +#include "QF/scene/scene.h" #include "QF/scene/transform.h" #include "QF/ui/view.h" @@ -78,10 +79,10 @@ SCR_CShift (void) mleaf_t *leaf; int contents = CONTENTS_EMPTY; - if (cls.state == ca_active && cl_world.worldmodel) { + if (cls.state == ca_active && cl_world.scene->worldmodel) { vec4f_t origin; origin = Transform_GetWorldPosition (cl.viewstate.camera_transform); - leaf = Mod_PointInLeaf ((vec_t*)&origin, cl_world.worldmodel);//FIXME + leaf = Mod_PointInLeaf ((vec_t*)&origin, cl_world.scene->worldmodel);//FIXME contents = leaf->contents; } V_SetContentsColor (&cl.viewstate, contents); diff --git a/qw/source/sbar.c b/qw/source/sbar.c index ebc9d267e..d016aeb11 100644 --- a/qw/source/sbar.c +++ b/qw/source/sbar.c @@ -53,6 +53,8 @@ #include "QF/plugin/console.h" +#include "QF/scene/scene.h" + #include "QF/ui/view.h" #include "compat.h" @@ -1062,7 +1064,7 @@ Sbar_LogFrags (void) Qwrite (file, t, strlen (t)); Qprintf (file, "%s\n%s %s\n", cls.servername->str, - cl_world.worldmodel->path, cl.levelname); + cl_world.scene->worldmodel->path, cl.levelname); // scores Sbar_SortFrags (true); diff --git a/qw/source/teamplay.c b/qw/source/teamplay.c index 926093007..5bca2f58d 100644 --- a/qw/source/teamplay.c +++ b/qw/source/teamplay.c @@ -49,6 +49,8 @@ #include "QF/sys.h" #include "QF/teamplay.h" +#include "QF/scene/scene.h" + #include "compat.h" #include "client/locs.h" @@ -332,8 +334,8 @@ Team_NewMap (void) died = false; recorded_location = false; - mapname = strdup (cl_world.worldmodel->path); - t2 = malloc (sizeof (cl_world.worldmodel->path)); + mapname = strdup (cl_world.scene->worldmodel->path); + t2 = malloc (sizeof (cl_world.scene->worldmodel->path)); if (!mapname || !t2) Sys_Error ("Can't duplicate mapname!"); map_to_loc (mapname,t2); @@ -376,16 +378,16 @@ locs_loc (void) "parameter\n"); return; } - if (!cl_world.worldmodel) { + if (!cl_world.scene->worldmodel) { Sys_Printf ("No map loaded. Unable to work with location markers.\n"); return; } if (Cmd_Argc () >= 3) desc = Cmd_Args (2); - mapname = malloc (sizeof (cl_world.worldmodel->path)); + mapname = malloc (sizeof (cl_world.scene->worldmodel->path)); if (!mapname) Sys_Error ("Can't duplicate mapname!"); - map_to_loc (cl_world.worldmodel->path, mapname); + map_to_loc (cl_world.scene->worldmodel->path, mapname); snprintf (locfile, sizeof (locfile), "%s/%s", qfs_gamedir->dir.def, mapname); free (mapname); diff --git a/ruamoko/qwaq/builtins/graphics.c b/ruamoko/qwaq/builtins/graphics.c index 0e272a07a..6b1737906 100644 --- a/ruamoko/qwaq/builtins/graphics.c +++ b/ruamoko/qwaq/builtins/graphics.c @@ -233,5 +233,5 @@ BI_Graphics_Init (progs_t *pr) if (mod_funcs->Mod_ProcessTexture) { mod_funcs->Mod_ProcessTexture (&empty_world, 0); } - r_funcs->R_NewMap (&empty_world, 0, 0); + //r_funcs->R_NewMap (&empty_world, 0, 0); }