class ent_list(Structure):
#{
- _fields_ = [("entity_ref_start",c_uint32),
- ("entity_ref_count",c_uint32)]
+ _fields_ = [("entity_ref_start",c_uint16),("entity_ref_count",c_uint16)]
#}
# used in ent_list
class file_entity_ref(Structure):
#{
- _fields_ = [("index",c_uint32)]
+ _fields_ = [("entity_id",c_uint32)]
#}
class ent_checkpoint(Structure):
sr_functions = { 0: 'view' }
#}
-class ent_list(Structure):#{
- _fields_ = [("start",c_uint16),("count",c_uint16)]
-#}
-
class ent_glider(Structure):#{
_fields_ = [("transform",mdl_transform),
("flags",c_uint32),
_fields_ = [("transform",mdl_transform),
("pstr_alias",c_uint32),
("flags",c_uint32),
- ("target",c_uint32),
- ("target_event",c_int32),
+ ("on_activate_id",c_uint32),
+ ("on_activate_event",c_int32),
("reset",c_uint32),
("reset_event",c_int32),
- ("first",c_uint32),
- ("camera",c_uint32),
+ ("first_objective_id",c_uint32),
+ ("camera_id",c_uint32),
("status",c_uint32),
- ("visible_when_unlocked_id",c_uint32)] #runtime
+ ("visible_when_unlocked_id",c_uint32)]
sr_functions = { 0: 'unlock',
1: 'view',
-1: 'unview' }
camera: bpy.props.PointerProperty( \
type=bpy.types.Object, name="Camera", \
- poll=lambda self,obj: sr_filter_ent_type(obj,['ent_camera','ent_objective']))
+ poll=lambda self,obj: sr_filter_ent_type(obj,['ent_camera']))
visible_when_unlocked: bpy.props.PointerProperty( \
type=bpy.types.Object, name="Visibile when unlocked", \
- poll=lambda self,obj: sr_filter_ent_type(obj,['ent_objective','ent_prop','ent_list']))
+ poll=lambda self,obj: sr_filter_ent_type(obj,['ent_list']))
@staticmethod
def sr_inspector( layout, data ):
layout.prop( data[0], 'time_limit' )
layout.prop( data[0], 'is_story' )
SR_OBJECT_ENT_VOLUME.inspect_target( layout, data, 'target', text=("On Activate" if data[0].is_story else "On Complete") )
- SR_OBJECT_ENT_VOLUME.inspect_target( layout, data, 'reset', text=("On Finish" if data[0].is_story else "On Reset") )
+ SR_OBJECT_ENT_VOLUME.inspect_target( layout, data, 'reset', text="On Reset" )
#}
#}
obj_data = obj.SR_data.ent_challenge[0]
compile_obj_transform( obj, challenge.transform )
challenge.pstr_alias = _af_pack_string( obj_data.alias )
- challenge.target = sr_entity_id( obj_data.target )
- challenge.target_event = obj_data.target_event
- challenge.reset = sr_entity_id( obj_data.reset )
- challenge.reset_event = obj_data.reset_event
- challenge.first = sr_entity_id( obj_data.first )
- challenge.visible_when_unlocked_id = sr_entity_id( obj_data.visible_when_unlocked )
challenge.flags = 0x00
- challenge.camera = sr_entity_id( obj_data.camera )
if obj_data.time_limit: challenge.flags |= 0x01
if obj_data.is_story: challenge.flags |= 0x02
+ challenge.on_activate_id = sr_entity_id( obj_data.target )
+ challenge.on_activate_event = obj_data.target_event
+ challenge.reset = sr_entity_id( obj_data.reset )
+ challenge.reset_event = obj_data.reset_event
+ challenge.first_objective_id = sr_entity_id( obj_data.first )
+ challenge.camera_id = sr_entity_id( obj_data.camera )
challenge.status = 0
+ challenge.visible_when_unlocked_id = sr_entity_id( obj_data.visible_when_unlocked )
sr_ent_push( challenge )
#}
elif ent_type == 'ent_list':
if obj_data.entities[k]:
#{
list_entry = file_entity_ref()
- list_entry.index = sr_entity_id( obj_data.entities[k].target )
+ list_entry.entity_id = sr_entity_id( obj_data.entities[k].target )
sr_ent_push( list_entry )
- list.entity_ref_count += 1
+ lista.entity_ref_count += 1
#}
#}
sr_ent_push( lista )
void ent_challenge_visibility( ent_challenge *challenge, bool visible )
{
world_instance *world = &_world.main;
- if( challenge->indicator_prop_id )
+ if( challenge->visible_when_unlocked_id )
{
- ent_prop *prop = af_arritm( &world->ent_prop, mdl_entity_id_id( challenge->indicator_prop_id ) );
+ ent_list *list = af_arritm( &world->ent_list, mdl_entity_id_id( challenge->visible_when_unlocked_id ) );
- if( visible ) prop->flags &= ~((u32)k_prop_flag_hidden);
- else prop->flags |= k_prop_flag_hidden;
- }
+ for( u32 i=0; i<list->entity_ref_count; i ++ )
+ {
+ u32 ref_index = list->entity_ref_start + i;
+
+ file_entity_ref *ref = af_arritm( &world->file_entity_ref, ref_index );
- if( challenge->objective_id )
- {
- ent_objective *objective = af_arritm( &world->ent_objective, mdl_entity_id_id( challenge->objective_id ) );
+ u32 type = mdl_entity_id_type( ref->entity_id ),
+ index = mdl_entity_id_id( ref->entity_id );
+
+ if( type == k_ent_objective )
+ {
+ ent_objective *objective = af_arritm( &world->ent_objective, index );
- if( visible ) objective->flags &= ~((u32)k_ent_objective_hidden);
- else objective->flags |= k_ent_objective_hidden;
+ if( visible ) objective->flags &= ~((u32)k_ent_objective_hidden);
+ else objective->flags |= k_ent_objective_hidden;
+ }
+ else if( type == k_ent_prop )
+ {
+ ent_prop *prop = af_arritm( &world->ent_prop, index );
+
+ if( visible ) prop->flags &= ~((u32)k_prop_flag_hidden);
+ else prop->flags |= k_prop_flag_hidden;
+ }
+ }
}
}
void ent_challenge_update(void)
{
world_instance *world = &_world.main;
- for( u32 i=0; i<af_arrcount( &world->ent_challenge); i ++ )
- {
- ent_challenge *challenge = af_arritm( &world->ent_challenge, i );
- if( challenge->flags & k_ent_challenge_is_story )
- {
- if( challenge->indicator_prop_id )
- {
- ent_prop *prop = af_arritm( &world->ent_prop, mdl_entity_id_id( challenge->indicator_prop_id ) );
- q_axis_angle( prop->transform.q, (v3f){0,1,0}, vg.time );
- }
- }
- }
if( _world.event != k_world_event_challenge )
return;
--- /dev/null
+#include "ent_prop.h"
+
+void ent_prop_update( world_instance *world )
+{
+ for( u32 i=0; i<af_arrcount( &world->ent_prop ); i ++ )
+ {
+ ent_prop *prop = af_arritm( &world->ent_prop, i );
+ if( prop->flags & k_prop_flag_hidden ) continue;
+
+ if( prop->flags & k_prop_flag_spinning )
+ q_axis_angle( prop->transform.q, (v3f){0,1,0}, vg.time );
+ }
+}
--- /dev/null
+#pragma once
+#include "world.h"
+void ent_prop_update( world_instance *world );
#include "ent_miniworld.h"
#include "ent_region.h"
#include "ent_glider.h"
+#include "ent_prop.h"
#include "world_water.h"
#include <string.h>
k_ent_cubemap = 21,
k_ent_miniworld = 22,
k_ent_prop = 23,
- k_ent_UNUSED0 = 24,
+ k_ent_list = 24,
k_ent_region = 25,
k_ent_glider = 26,
k_ent_npc = 27,
struct ent_list
{
- u32 entity_ref_start, entity_ref_count;
+ u16 entity_ref_start, entity_ref_count;
};
struct file_entity_ref
{
- u32 index;
+ u32 entity_id;
};
/* v102+ */
u32 reset;
i32 reset_event;
- union
- {
- u32 first_objective_id,
- indicator_prop_id;
- };
-
- union
- {
- u32 camera_id,
- objective_id;
- };
+ u32 first_objective_id;
+ u32 camera_id;
u32 status;
+ u32 visible_when_unlocked_id;
};
struct ent_relay {
#include "ent_skateshop.c"
#include "ent_tornado.c"
#include "ent_traffic.c"
+#include "ent_prop.c"
#include "freecam.c"
#include "menu.c"
#include "network.c"
world_volumes_update( world, pos );
ent_skateshop_update();
ent_challenge_update();
+ ent_prop_update( world );
}
void world_gui( ui_context *ctx, world_instance *world )