struct async_workshop_filepath_info *info = call1->payload;
info->buf = path;
info->id = id;
- info->len = vg_list_size(path);
+ info->len = VG_ARRAY_LEN(path);
vg_async_dispatch( call1, async_workshop_get_filepath );
vg_async_stall(); /* too bad! */
void audio_init(void)
{
- audio_clip_loadn( audio_board, vg_list_size(audio_board), NULL );
- audio_clip_loadn( audio_taps, vg_list_size(audio_taps), NULL );
- audio_clip_loadn( audio_flips, vg_list_size(audio_flips), NULL );
- audio_clip_loadn( audio_hits, vg_list_size(audio_hits), NULL );
- audio_clip_loadn( audio_ambience, vg_list_size(audio_ambience), NULL );
+ audio_clip_loadn( audio_board, VG_ARRAY_LEN(audio_board), NULL );
+ audio_clip_loadn( audio_taps, VG_ARRAY_LEN(audio_taps), NULL );
+ audio_clip_loadn( audio_flips, VG_ARRAY_LEN(audio_flips), NULL );
+ audio_clip_loadn( audio_hits, VG_ARRAY_LEN(audio_hits), NULL );
+ audio_clip_loadn( audio_ambience, VG_ARRAY_LEN(audio_ambience), NULL );
audio_clip_loadn( &audio_splash, 1, NULL );
audio_clip_loadn( &audio_gate_pass, 1, NULL );
audio_clip_loadn( &audio_gate_lap, 1, NULL );
audio_clip_loadn( &audio_gate_ambient, 1, NULL );
- audio_clip_loadn( audio_jumps, vg_list_size(audio_jumps), NULL );
- audio_clip_loadn( audio_lands, vg_list_size(audio_lands), NULL );
- audio_clip_loadn( audio_water, vg_list_size(audio_water), NULL );
- audio_clip_loadn( audio_grass, vg_list_size(audio_grass), NULL );
- audio_clip_loadn( audio_footsteps, vg_list_size(audio_footsteps), NULL );
+ audio_clip_loadn( audio_jumps, VG_ARRAY_LEN(audio_jumps), NULL );
+ audio_clip_loadn( audio_lands, VG_ARRAY_LEN(audio_lands), NULL );
+ audio_clip_loadn( audio_water, VG_ARRAY_LEN(audio_water), NULL );
+ audio_clip_loadn( audio_grass, VG_ARRAY_LEN(audio_grass), NULL );
+ audio_clip_loadn( audio_footsteps, VG_ARRAY_LEN(audio_footsteps), NULL );
audio_clip_loadn( audio_footsteps_grass,
- vg_list_size(audio_footsteps_grass), NULL );
+ VG_ARRAY_LEN(audio_footsteps_grass), NULL );
audio_clip_loadn( audio_footsteps_wood,
- vg_list_size(audio_footsteps_wood), NULL );
- audio_clip_loadn( audio_rewind, vg_list_size(audio_rewind), NULL );
- audio_clip_loadn( audio_ui, vg_list_size(audio_ui), NULL );
- audio_clip_loadn( audio_challenge, vg_list_size(audio_challenge), NULL );
+ VG_ARRAY_LEN(audio_footsteps_wood), NULL );
+ audio_clip_loadn( audio_rewind, VG_ARRAY_LEN(audio_rewind), NULL );
+ audio_clip_loadn( audio_ui, VG_ARRAY_LEN(audio_ui), NULL );
+ audio_clip_loadn( audio_challenge, VG_ARRAY_LEN(audio_challenge), NULL );
audio_lock();
audio_set_lfo_wave( 0, k_lfo_polynomial_bipolar, 80.0f );
#include "player_remote.h"
#include "menu.h"
+const char* __asan_default_options() { return "detect_leaks=0"; }
+
struct game_client g_client =
{
.demo_mode = 1
int main( int argc, char *argv[] )
{
network_set_host( "skaterift.com", NULL );
- vg_mem.use_libc_malloc = 0;
+ vg_mem.use_libc_malloc = 1;
vg_set_mem_quota( 160*1024*1024 );
vg_enter( argc, argv, "Voyager Game Engine" );
return 0;
if( call->function == 0 )
{
- for( u32 i=0; i<vg_list_size(relay->targets); i++ )
+ for( u32 i=0; i<VG_ARRAY_LEN(relay->targets); i++ )
{
if( relay->targets[i][0] )
{
static void skateshop_render_boardshop( ent_skateshop *shop ){
world_instance *world = world_current_instance();
- u32 slot_count = vg_list_size(global_skateshop.shop_view_slots);
+ u32 slot_count = VG_ARRAY_LEN(global_skateshop.shop_view_slots);
ent_marker *mark_rack = mdl_arritm( &world->ent_marker,
mdl_entity_id_id(shop->boards.id_rack)),
if( !mark_rack )
continue;
- u32 slot_count = vg_list_size(global_skateshop.shop_view_slots);
+ u32 slot_count = VG_ARRAY_LEN(global_skateshop.shop_view_slots);
for( u32 i=0; i<slot_count; i++ )
{
struct player_board *board = &localplayer.fallback_board;
[k_ent_water] = ent_water_call,
};
- if( type >= vg_list_size(table) ){
+ if( type >= VG_ARRAY_LEN(table) ){
vg_error( "call to entity type: %u is out of range\n", type );
return;
}
}
static struct gui_helper *gui_new_helper( vg_input_op *bind, vg_str *out_text ){
- if( gui.helper_count >= vg_list_size(gui.helpers) ){
+ if( gui.helper_count >= VG_ARRAY_LEN(gui.helpers) ){
vg_error( "Too many helpers\n" );
return NULL;
}
static void gui_draw_icon( enum gui_icon icon, v2f co, f32 size )
{
- if( gui.icon_draw_count == vg_list_size(gui.icon_draw_buffer) )
+ if( gui.icon_draw_count == VG_ARRAY_LEN(gui.icon_draw_buffer) )
return;
struct icon_call *call = &gui.icon_draw_buffer[ gui.icon_draw_count ++ ];
if( menu.main_index == -1 )
menu.main_index ++;
- if( menu.main_index == vg_list_size(opts) )
+ if( menu.main_index == VG_ARRAY_LEN(opts) )
menu.main_index --;
audio_lock();
x += 32 + spacer;
}
- for( i32 i=0; i<vg_list_size(opts); i ++ )
+ for( i32 i=0; i<VG_ARRAY_LEN(opts); i ++ )
{
ui_rect box = { x, 0, ui_text_line_width(ctx, opts[i]) + 32, height };
static void mdl_load_fatal_corrupt( mdl_context *mdl )
{
+ vg_fatal_condition();
+ vg_file_error_info( mdl->file );
fclose( mdl->file );
- vg_file_print_invalid( mdl->file );
- vg_fatal_error( "Corrupt model" );
+ vg_fatal_exit();
}
/*
{
if( !info->pack_size )
{
- vg_warn( "path: %s\n", mdl_pstr( mdl, info->pstr_path ) );
- vg_fatal_error( "Packed file is only a header; it is not packed" );
+ vg_fatal_condition();
+ vg_info( "Packed file is only a header; it is not packed" );
+ vg_info( "path: %s\n", mdl_pstr( mdl, info->pstr_path ) );
+ vg_fatal_exit();
}
fseek( mdl->file, mdl->pack_base_offset+info->pack_offset, SEEK_SET );
if( !mdl->file )
{
- vg_error( "mdl_open('%s'): %s\n", path, strerror(errno) );
- vg_fatal_error( "see above for details" );
+ vg_fatal_condition();
+ vg_info( "mdl_open('%s'): %s\n", path, strerror(errno) );
+ vg_fatal_exit();
}
u64 l = fread( &mdl->info, sizeof(mdl_header), 1, mdl->file );
if( mdl->info.version < MDL_VERSION_MIN )
{
- vg_warn( "For model: %s\n", path );
- vg_warn( " version: %u (min: %u, current: %u)\n",
+ vg_fatal_condition();
+ vg_info( "Legacy model version incompatable" );
+ vg_info( "For model: %s\n", path );
+ vg_info( " version: %u (min: %u, current: %u)\n",
mdl->info.version, MDL_VERSION_MIN, MDL_VERSION_NR );
-
- vg_fatal_error( "Legacy model version incompatable" );
+ vg_fatal_exit();
}
mdl_load_array_file( mdl, &mdl->index, &mdl->info.index, lin_alloc,
stride, (void *)offsetof(mdl_vert, groups) );
glEnableVertexAttribArray( 5 );
- VG_CHECK_GL_ERR();
-
mesh->indice_count = indice_count;
mesh->loaded = 1;
}
}
else
{
- vg_fatal_error( "no vertex/indice data\n" );
+ vg_fatal_condition();
+ vg_info( "No vertex/indice data in model file\n" );
+ vg_fatal_exit();
}
}
if( SteamAPI_ISteamUser_GetEncryptedAppTicket( hSteamUser,
network_client.app_symmetric_key,
- vg_list_size(network_client.app_symmetric_key),
+ VG_ARRAY_LEN(network_client.app_symmetric_key),
&network_client.app_key_length )){
vg_success( " Loaded app ticket\n" );
}
network_client.remote = 0;
network_client.state = k_ESteamNetworkingConnectionState_None;
- for( int i=0; i<vg_list_size(netplayers.list); i++ ){
+ for( int i=0; i<VG_ARRAY_LEN(netplayers.list); i++ ){
netplayers.list[i].active = 0;
}
}
for( int i=0; i<10; i++ ){
len = SteamAPI_ISteamNetworkingSockets_ReceiveMessagesOnConnection(
hSteamNetworkingSockets, network_client.remote,
- messages, vg_list_size(messages));
+ messages, VG_ARRAY_LEN(messages));
if( len <= 0 )
return;
glVertexAttribPointer( 1, 4, GL_UNSIGNED_BYTE, GL_TRUE,
stride, (void *)offsetof(particle_vert, colour) );
glEnableVertexAttribArray( 1 );
-
- VG_CHECK_GL_ERR();
}
void particle_alloc( particle_system *sys, u32 max )
localplayer.boundary_hash ^= NETMSG_BOUNDARY_BIT;
- for( u32 i=0; i<vg_list_size(world_static.instances); i++ ){
+ for( u32 i=0; i<VG_ARRAY_LEN(world_static.instances); i++ ){
world_instance *instance = &world_static.instances[i];
if( instance->status == k_world_status_loaded ){
world_routes_clear( instance );
rigidbody _null = {0};
_null.inv_mass = 0.0f;
m3x3_zero( _null.iI );
- for( u32 i=0; i < vg_list_size(player_glide.parts); i ++ ){
+ for( u32 i=0; i < VG_ARRAY_LEN(player_glide.parts); i ++ ){
m4x3f mmdl;
m4x3_mul( rb->to_world, player_glide.parts[i].mdl, mmdl );
m3x3f I;
m3x3_zero( I );
- for( u32 i=0; i<vg_list_size(player_glide.parts); i ++ ){
+ for( u32 i=0; i<VG_ARRAY_LEN(player_glide.parts); i ++ ){
/* create part transform matrix */
v4f qp, qy, qr, q;
q_axis_angle( qp, (v3f){1,0,0}, player_glide.parts[i].euler[0] );
v3_copy( marker->transform.co,
player_glide.trail_positions[ player_glide.trail_count ++ ] );
- if( player_glide.trail_count == vg_list_size(trails_glider) )
+ if( player_glide.trail_count == VG_ARRAY_LEN(trails_glider) )
break;
}
/* allocate effects */
- for( u32 i=0; i<vg_list_size(trails_glider); i ++ )
+ for( u32 i=0; i<VG_ARRAY_LEN(trails_glider); i ++ )
{
trail_alloc( &trails_glider[i], 200 );
}
world_static.challenge_timer = 0.0f;
world_static.focused_entity = 0;
world_static.last_use = 0.0;
- for( u32 i=0; i<vg_list_size(world_static.instances); i++ ){
+ for( u32 i=0; i<VG_ARRAY_LEN(world_static.instances); i++ ){
world_instance *instance = &world_static.instances[i];
if( instance->status == k_world_status_loaded ){
world_routes_clear( instance );
if( !(bone->collider) )
continue;
- if( rd->part_count > vg_list_size(rd->parts) )
+ if( rd->part_count > VG_ARRAY_LEN(rd->parts) )
vg_fatal_error( "Playermodel has too many colliders" );
u32 part_id = rd->part_count;
*/
void relink_all_remote_player_worlds(void)
{
- for( u32 i=0; i<vg_list_size(netplayers.list); i++ ){
+ for( u32 i=0; i<VG_ARRAY_LEN(netplayers.list); i++ ){
struct network_player *player = &netplayers.list[i];
if( player->active )
relink_remote_player_worlds(i);
netmsg_playerjoin *playerjoin = msg->m_pData;
if( !packet_minsize( msg, sizeof(*playerjoin) )) return;
- if( playerjoin->index < vg_list_size(netplayers.list) ){
+ if( playerjoin->index < VG_ARRAY_LEN(netplayers.list) ){
struct network_player *player = &netplayers.list[ playerjoin->index ];
player_remote_clear( player );
player->active = 1;
struct interp_buffer *buf = &netplayers.interp_data[playerjoin->index];
buf->t = -99999999.9;
- for( u32 i=0; i<vg_list_size(buf->frames); i ++ ){
+ for( u32 i=0; i<VG_ARRAY_LEN(buf->frames); i ++ ){
buf->frames[i].active = 0;
}
netmsg_playerleave *playerleave = msg->m_pData;
if( !packet_minsize( msg, sizeof(*playerleave) )) return;
- if( playerleave->index < vg_list_size(netplayers.list) ){
+ if( playerleave->index < VG_ARRAY_LEN(netplayers.list) ){
struct network_player *player = &netplayers.list[ playerleave->index ];
player_remote_clear( player );
player->active = 0;
netmsg_playerusername *update = msg->m_pData;
if( !packet_minsize( msg, sizeof(*update) )) return;
- if( update->index < vg_list_size(netplayers.list) ){
+ if( update->index < VG_ARRAY_LEN(netplayers.list) ){
struct network_player *player = &netplayers.list[ update->index ];
network_msgstring( update->name, msg->m_cbSize, sizeof(*update),
netmsg_playerframe *frame = msg->m_pData;
- if( frame->client >= vg_list_size(netplayers.list) ){
+ if( frame->client >= VG_ARRAY_LEN(netplayers.list) ){
vg_error( "inetmsg_playerframe: player index out of range\n" );
return;
}
struct interp_frame *dest = NULL;
f64 min_time = INFINITY;
- for( u32 i=0; i<vg_list_size(ib->frames); i++ ){
+ for( u32 i=0; i<VG_ARRAY_LEN(ib->frames); i++ ){
struct interp_frame *ifr = &ib->frames[i];
if( !ifr->active ){
netmsg_playeritem *item = msg->m_pData;
if( !packet_minsize( msg, sizeof(*item)+1 )) return;
- if( item->client >= vg_list_size(netplayers.list) ){
+ if( item->client >= VG_ARRAY_LEN(netplayers.list) ){
vg_error( "inetmsg_playerframe: player index out of range\n" );
return;
}
netplayers.last_data_measurement = vg.time_real;
u32 total_down = 0;
- for( u32 i=0; i<vg_list_size(netplayers.list); i++ ){
+ for( u32 i=0; i<VG_ARRAY_LEN(netplayers.list); i++ ){
struct network_player *player = &netplayers.list[i];
if( player->active ){
total_down += player->down_bytes;
{ k_ESteamNetworkingConnectionState_Linger, "Linger" },
{ k_ESteamNetworkingConnectionState_Dead, "Dead" }
};
- for( u32 i=0; i<vg_list_size(states); i ++ )
+ for( u32 i=0; i<VG_ARRAY_LEN(states); i ++ )
{
if( states[i].state == network_client.state )
{
netplayers.up_kbs, netplayers.down_kbs );
ui_info( ctx, panel, buf );
- for( u32 i=0; i<vg_list_size(netplayers.list); i++ )
+ for( u32 i=0; i<VG_ARRAY_LEN(netplayers.list); i++ )
{
struct network_player *player = &netplayers.list[i];
if( player->active )
*abs_max_frame = NULL;
struct interp_buffer *buf = &netplayers.interp_data[index];
- for( u32 i=0; i<vg_list_size(buf->frames); i ++ ){
+ for( u32 i=0; i<VG_ARRAY_LEN(buf->frames); i ++ ){
struct interp_frame *ifr = &buf->frames[i];
if( ifr->active ){
*/
void animate_remote_players(void)
{
- for( u32 i=0; i<vg_list_size(netplayers.list); i ++ ){
+ for( u32 i=0; i<VG_ARRAY_LEN(netplayers.list); i ++ ){
struct network_player *player = &netplayers.list[i];
if( !player->active ) continue;
if( !absorb_by_keyframe && ui_click_down( ctx, UI_MOUSE_LEFT ) )
{
- u32 max = vg_list_size( player_replay.keyframes );
+ u32 max = VG_ARRAY_LEN( player_replay.keyframes );
if( player_replay.keyframe_count == max )
{
ui_start_modal( ctx, "Maximum keyframes reached", UI_MODAL_BAD );
{ &player_skate.anim_handplant, "handplant" },
};
- for( u32 i=0; i<vg_list_size(bindings); i++ )
+ for( u32 i=0; i<VG_ARRAY_LEN(bindings); i++ )
*bindings[i].anim = skeleton_get_anim( sk, bindings[i].name );
}
v2_normalize( sample->normal );
sample_count ++;
- if( sample_count == vg_list_size( samples ) )
+ if( sample_count == VG_ARRAY_LEN( samples ) )
goto too_many_samples;
}
}
0.75f,
0.75f };
- for( int i=0; i<vg_list_size(apply_to); i ++ ){
+ for( int i=0; i<VG_ARRAY_LEN(apply_to); i ++ ){
pose->keyframes[apply_to[i]-1].co[0] += animator->offset[0]*add_grab_mod;
pose->keyframes[apply_to[i]-1].co[2] += animator->offset[2]*add_grab_mod;
}
v3f origin;
v3_add( sk->bones[localplayer.id_hip].co, kf_hip->co, origin );
- for( int i=0; i<vg_list_size(apply_to); i ++ ){
+ for( int i=0; i<VG_ARRAY_LEN(apply_to); i ++ ){
mdl_keyframe *kf = &pose->keyframes[apply_to[i]-1];
keyframe_rotate_around( kf, origin, sk->bones[apply_to[i]].co,
animator->qfixuptotal );
v4f qskid;
q_axis_angle( qskid, (v3f){0,1,0}, -animator->steer[1]*0.2f );
- for( u32 i=0; i<vg_list_size(skidders); i ++ ){
+ for( u32 i=0; i<VG_ARRAY_LEN(skidders); i ++ ){
mdl_keyframe *kf = &pose->keyframes[ skidders[i]-1 ];
keyframe_rotate_around( kf,
(v3f){0,0,0.4f*(animator->z*2.0f-1.0f)*amt},
sizeof(float)*2, (void*)0 );
glEnableVertexAttribArray( 0 );
- VG_CHECK_GL_ERR();
-
glBindFramebuffer( GL_FRAMEBUFFER, 0 );
g_render.ready = 1;
}
stride, (void *)offsetof(scene_vert, uv) );
glEnableVertexAttribArray( 2 );
- VG_CHECK_GL_ERR();
-
mesh->indice_count = ctx->indice_count;
mesh->loaded = 1;
/* Draw world */
glEnable( GL_DEPTH_TEST );
- for( u32 i=0; i<vg_list_size(world_static.instances); i++ )
+ for( u32 i=0; i<VG_ARRAY_LEN(world_static.instances); i++ )
{
if( world_static.instances[i].status == k_world_status_loaded )
{
vg_info( "Achievements: \n" );
if( steam_ready && steam_stats_ready ){
- for( int i=0; i<vg_list_size(steam_achievement_names); i++ ){
+ for( int i=0; i<VG_ARRAY_LEN(steam_achievement_names); i++ ){
steamapi_bool set = 0;
const char *name = steam_achievement_names[i];
return 0;
}
else if( !strcmp( argv[0], "clearall" )){
- for( int i=0; i<vg_list_size(steam_achievement_names); i++ )
+ for( int i=0; i<VG_ARRAY_LEN(steam_achievement_names); i++ )
steam_clear_achievement( steam_achievement_names[i] );
steam_store_achievements();
/* TODO: On username update callback */
str_utf8_collapse( username, steam_username_at_startup,
- vg_list_size(steam_username_at_startup) );
+ VG_ARRAY_LEN(steam_username_at_startup) );
return 1;
}
/* 0: coordinates */
glVertexAttribPointer( 0, 4, GL_FLOAT, GL_FALSE, stride, (void*)0 );
glEnableVertexAttribArray( 0 );
-
- VG_CHECK_GL_ERR();
}
void trail_alloc( trail_system *sys, u32 max )
vg_strncpy( details.m_rgchDescription,
workshop_form.submission.description,
- vg_list_size( workshop_form.submission.description ),
+ VG_ARRAY_LEN( workshop_form.submission.description ),
k_strncpy_always_add_null );
vg_strncpy( details.m_rgchTitle,
workshop_form.submission.title,
- vg_list_size( workshop_form.submission.title ),
+ VG_ARRAY_LEN( workshop_form.submission.title ),
k_strncpy_always_add_null );
snprintf( workshop_form.addon_folder,
- vg_list_size( workshop_form.addon_folder ),
+ VG_ARRAY_LEN( workshop_form.addon_folder ),
"Steam Cloud ("PRINTF_U64")", details.m_nPublishedFileId );
workshop_form.submission.file_id = details.m_nPublishedFileId;
.change = workshop_changed_model_path
};
ui_textbox( ctx, content, buf, workshop_form.addon_folder,
- vg_list_size(workshop_form.addon_folder), 1, 0, &callbacks );
+ VG_ARRAY_LEN(workshop_form.addon_folder), 1, 0, &callbacks );
}
else
{
};
ui_textbox( ctx, file_entry, buf, workshop_form.addon_folder,
- vg_list_size(workshop_form.addon_folder), 1,
+ VG_ARRAY_LEN(workshop_form.addon_folder), 1,
0, &callbacks );
if( ui_button_text( ctx, file_button, "Load", 1 ) == 1 )
.change = workshop_changed_title
};
ui_textbox( ctx, content, str_title, workshop_form.submission.title,
- vg_list_size(workshop_form.submission.title), 1,
+ VG_ARRAY_LEN(workshop_form.submission.title), 1,
0, &callbacks );
}
.change = workshop_changed_description
};
ui_textbox( ctx, content, str_desc, workshop_form.submission.description,
- vg_list_size(workshop_form.submission.description), 4,
+ VG_ARRAY_LEN(workshop_form.submission.description), 4,
UI_TEXTBOX_MULTILINE|UI_TEXTBOX_WRAP, &callbacks );
}
{
localplayer.subsystem = k_player_subsystem_walk;
- if( index >= vg_list_size(world_static.instances) ){
+ if( index >= VG_ARRAY_LEN(world_static.instances) ){
vg_error( "Instance ID out of range (%u)\n", index );
return;
}
[ k_ent_npc ] = ent_npc_preupdate,
};
- if( (type > vg_list_size(table)) || (table[type] == NULL) )
+ if( (type > VG_ARRAY_LEN(table)) || (table[type] == NULL) )
{
vg_fatal_error( "No pre-update method set for entity (%u#%u)\n",
type, index );
{ k_ent_npc, &world->ent_npc }
};
- for( u32 i=0; i<vg_list_size(indexables); i++ )
+ for( u32 i=0; i<VG_ARRAY_LEN(indexables); i++ )
indexed_count += mdl_arrcount( indexables[i].array );
vg_info( "indexing %u entities\n", indexed_count );
vg_align8(indexed_count*sizeof(u32)));
u32 index=0;
- for( u32 i=0; i<vg_list_size(indexables); i++ ){
+ for( u32 i=0; i<VG_ARRAY_LEN(indexables); i++ ){
u32 type = indexables[i].type,
count = mdl_arrcount( indexables[i].array );
/* LEGACY: check if steam achievements can give us a medal */
if( steam_ready && steam_stats_ready ){
- for( u32 j=0; j<vg_list_size(track_infos); j ++ ){
+ for( u32 j=0; j<VG_ARRAY_LEN(track_infos); j ++ ){
struct track_info *inf = &track_infos[j];
if( !strcmp(inf->name,
mdl_pstr(&world->meta,route->pstr_name))){
const char *key = mdl_pstr( &world->meta, gate->key );
vg_info( "key: %s\n", key );
- for( u32 i=0; i<vg_list_size(world_static.instances); i++ ){
+ for( u32 i=0; i<VG_ARRAY_LEN(world_static.instances); i++ ){
world_instance *other = &world_static.instances[i];
if( other == world ) continue;
if( other->status != k_world_status_loaded ) continue;
const u32 indices[] = { 0,1,3, 0,3,2, 2,3,5, 2,5,4 };
- if( scene->vertex_count + vg_list_size(verts) > scene->max_vertices )
+ if( scene->vertex_count + VG_ARRAY_LEN(verts) > scene->max_vertices )
vg_fatal_error( "Scene vertex buffer overflow" );
- if( scene->indice_count + vg_list_size(indices) > scene->max_indices )
+ if( scene->indice_count + VG_ARRAY_LEN(indices) > scene->max_indices )
vg_fatal_error( "Scene index buffer overflow" );
scene_vert *dst_verts = &scene->arrvertices[ scene->vertex_count ];
scene_vert *ref = &world->scene_geo.arrvertices[ hit->tri[0] ];
- for( u32 i=0; i<vg_list_size(verts); i++ ){
+ for( u32 i=0; i<VG_ARRAY_LEN(verts); i++ ){
scene_vert *pvert = &dst_verts[ i ],
*src = &verts[ i ];
v2_copy( ref->uv, pvert->uv );
}
- for( u32 i=0; i<vg_list_size(indices); i++ )
+ for( u32 i=0; i<VG_ARRAY_LEN(indices); i++ )
dst_indices[i] = indices[i] + scene->vertex_count;
- scene->vertex_count += vg_list_size(verts);
- scene->indice_count += vg_list_size(indices);
+ scene->vertex_count += VG_ARRAY_LEN(verts);
+ scene->indice_count += VG_ARRAY_LEN(indices);
}
/*
u32 count = 0;
float influences[6] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
- const int N = vg_list_size( influences );
+ const int N = VG_ARRAY_LEN( influences );
for( u32 j=0; j<mdl_arrcount(&world->ent_light); j ++ ){
ent_light *light = mdl_arritm( &world->ent_light, j );
if( world->status != k_world_status_unloading ) return 0;
u8 world_id = (world - world_static.instances) + 1;
- for( u32 i=world_id; i<vg_list_size(world_static.instances); i++ ){
+ for( u32 i=world_id; i<VG_ARRAY_LEN(world_static.instances); i++ ){
if( world_static.instances[i].status != k_world_status_unloaded ){
return 0;
}
NULL, GL_DYNAMIC_DRAW );
glBindBufferBase( GL_UNIFORM_BUFFER, i, world->ubo_lighting );
- VG_CHECK_GL_ERR();
}
}
index = mdl_entity_id_id( id );
if( type == k_ent_objective ) {
- if( objective_count < vg_list_size(objective_list) )
+ if( objective_count < VG_ARRAY_LEN(objective_list) )
objective_list[ objective_count ++ ] = index;
}
else if( type == k_ent_challenge ){
- if( challenge_count < vg_list_size(challenge_list) )
+ if( challenge_count < VG_ARRAY_LEN(challenge_list) )
challenge_list[ challenge_count ++ ] = index;
}
}
if( type == k_ent_glider )
{
- if( glider_count < vg_list_size(glider_list) )
+ if( glider_count < VG_ARRAY_LEN(glider_list) )
glider_list[ glider_count ++ ] = index;
}
else if( type == k_ent_npc )
{
- if( npc_count < vg_list_size(npc_list) )
+ if( npc_count < VG_ARRAY_LEN(npc_list) )
npc_list[ npc_count ++ ] = index;
}
}
u32 cc = 0xffcccccc;
if( route->active_checkpoint != 0xffff ){
- cc = colours[i%vg_list_size(colours)];
+ cc = colours[i%VG_ARRAY_LEN(colours)];
}
for( int i=0; i<route->checkpoints_count; i++ ){
route->flags |= k_ent_route_flag_out_of_zone;
route->anon.official_track_id = 0xffffffff;
- for( u32 j=0; j<vg_list_size(track_infos); j ++ ){
+ for( u32 j=0; j<VG_ARRAY_LEN(track_infos); j ++ ){
if( !strcmp(track_infos[j].name,
mdl_pstr(&world->meta,route->pstr_name))){
route->anon.official_track_id = j;
goto next_volume;
if( world_static.active_trigger_volume_count >
- vg_list_size(world_static.active_trigger_volumes) ) continue;
+ VG_ARRAY_LEN(world_static.active_trigger_volumes) ) continue;
v3f local;
m4x3_mulv( volume->to_local, pos, local );