projects
/
carveJwlIkooP6JGAAIwe30JlM.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
isolate world code
[carveJwlIkooP6JGAAIwe30JlM.git]
/
skaterift.c
diff --git
a/skaterift.c
b/skaterift.c
index 4c531a4736f66dee33740b3cb13905db8e9777c9..9e162b2c322af6695a7857e08275c1c726910744 100644
(file)
--- a/
skaterift.c
+++ b/
skaterift.c
@@
-19,31
+19,18
@@
#include "audio.h"
#include "world.h"
#include "audio.h"
#include "world.h"
-#if 0
-#include "player.h"
-#else
+
#include "player.h"
VG_STATIC player_instance localplayer;
#include "player.h"
VG_STATIC player_instance localplayer;
+VG_STATIC struct player_avatar localplayer_avatar;
+VG_STATIC glmesh localplayer_meshes[3];
+vg_tex2d localplayer_texture = { .path = "textures/ch_gradient.qoi" };
-#if 0
-#include "player_interface.h"
-#include "player_device_walk.h"
-#include "player_device_skate.h"
-#include "player_device_dead.h"
-#include "player_model.h"
-/* temp */
-VG_STATIC player_interface localplayer;
-#endif
-VG_STATIC struct player_avatar localplayer_avatar;
-VG_STATIC glmesh localplayer_meshes[3];
-vg_tex2d localplayer_texture = { .path = "textures/ch_gradient.qoi" };
-
-#endif
#include "network.h"
#include "network.h"
@@
-87,11
+74,13
@@
VG_STATIC int __respawn( int argc, const char *argv[] )
{
struct respawn_point *rp = NULL, *r;
{
struct respawn_point *rp = NULL, *r;
+ world_instance *world = get_active_world();
+
if( argc == 1 )
{
if( argc == 1 )
{
- for( int i=0; i<world
.
spawn_count; i++ )
+ for( int i=0; i<world
->
spawn_count; i++ )
{
{
- r = &world
.
spawns[i];
+ r = &world
->
spawns[i];
if( !strcmp( r->name, argv[0] ) )
{
rp = r;
if( !strcmp( r->name, argv[0] ) )
{
rp = r;
@@
-107,9
+96,9
@@
VG_STATIC int __respawn( int argc, const char *argv[] )
{
float min_dist = INFINITY;
{
float min_dist = INFINITY;
- for( int i=0; i<world
.
spawn_count; i++ )
+ for( int i=0; i<world
->
spawn_count; i++ )
{
{
- r = &world
.
spawns[i];
+ r = &world
->
spawns[i];
float d = v3_dist2( r->co, localplayer.rb.co );
vg_info( "Dist %s : %f\n", r->name, d );
float d = v3_dist2( r->co, localplayer.rb.co );
vg_info( "Dist %s : %f\n", r->name, d );
@@
-125,10
+114,10
@@
VG_STATIC int __respawn( int argc, const char *argv[] )
{
vg_error( "No spawn found\n" );
{
vg_error( "No spawn found\n" );
- if( !world
.
spawn_count )
+ if( !world
->
spawn_count )
return 0;
return 0;
- rp = &world
.
spawns[0];
+ rp = &world
->
spawns[0];
}
player__spawn( &localplayer, rp );
}
player__spawn( &localplayer, rp );
@@
-268,9
+257,13
@@
VG_STATIC void vg_load(void)
world_audio_init();
/* 'systems' are completely loaded now */
world_audio_init();
/* 'systems' are completely loaded now */
+#if 0
strcpy( world.world_name, "maps/mp_mtzero.mdl" );
strcpy( world.world_name, "maps/mp_gridmap.mdl" );
strcpy( world.world_name, "maps/mp_mtzero.mdl" );
strcpy( world.world_name, "maps/mp_gridmap.mdl" );
- world_load();
+#endif
+
+ /* load home world */
+ world_load( &world_global.worlds[0], "maps/mp_home.mdl" );
vg_console_load_autos();
}
vg_console_load_autos();
}
@@
-301,7
+294,7
@@
VG_STATIC void vg_update(void)
#endif
player__pre_update( &localplayer );
#endif
player__pre_update( &localplayer );
- world_update( localplayer.rb.co );
+ world_update(
get_active_world(),
localplayer.rb.co );
}
}
}
}
@@
-417,9
+410,9
@@
VG_STATIC void render_scene(void)
/* Draw world */
glEnable( GL_DEPTH_TEST );
/* Draw world */
glEnable( GL_DEPTH_TEST );
- render_world( &main_camera );
-
+ world_instance *world = get_active_world();
+ render_world( world, &main_camera );
int player_transparent = 1,
player_draw = 1;
int player_transparent = 1,
player_draw = 1;
@@
-433,10
+426,11
@@
VG_STATIC void render_scene(void)
if( !player_transparent && player_draw )
player__render( &main_camera, &localplayer );
if( !player_transparent && player_draw )
player__render( &main_camera, &localplayer );
- render_water_texture( &main_camera );
+
+ render_water_texture( world, &main_camera );
render_fb_bind( gpipeline.fb_main );
render_fb_bind( gpipeline.fb_main );
- render_water_surface( &main_camera );
- render_world_gates( &main_camera );
+ render_water_surface(
world,
&main_camera );
+ render_world_gates(
world,
&main_camera );
if( player_transparent && player_draw )
render_player_transparent();
if( player_transparent && player_draw )
render_player_transparent();
@@
-535,11
+529,13
@@
VG_STATIC void run_light_widget( struct light_widget *lw );
VG_STATIC void vg_ui(void)
{
player__im_gui( &localplayer );
VG_STATIC void vg_ui(void)
{
player__im_gui( &localplayer );
+ world_instance *world = get_active_world();
#if 0
menu_crap_ui();
#endif
#if 0
menu_crap_ui();
#endif
+#if 0
if( cl_light_edit )
{
vg_uictx.cursor[0] = 10;
if( cl_light_edit )
{
vg_uictx.cursor[0] = 10;
@@
-574,11
+570,12
@@
VG_STATIC void vg_ui(void)
render_update_lighting_ub();
}
render_update_lighting_ub();
}
+#endif
//glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
if( cl_ui )
{
//glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
if( cl_ui )
{
- render_world_routes_ui();
+ render_world_routes_ui(
world
);
}
//glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
}
//glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );