diff --git a/assets/entities/pickup_health.symtres b/assets/entities/pickup_health.symtres index b766722..6302c3b 100644 --- a/assets/entities/pickup_health.symtres +++ b/assets/entities/pickup_health.symtres @@ -3,9 +3,9 @@ Entity type : 11 scale : 1.000 1.000 1.000 rotation : 0.000 0.000 0.000 1.000 - pickup_spin_speed : 45.0000 - active : true - position : 13.000 3.000 -13.000 + pickup_spin_speed : 120.0000 + position : -40.000 3.000 -14.000 + flags : 1 pickup_type : 1 pickup_health : 25 name : Pickup_Health @@ -19,8 +19,8 @@ Entity scale : 3.000 3.000 2.000 rotation : 0.000 0.000 0.000 1.000 trigger_mask : 1 - active : true position : 0.000 0.000 0.000 + flags : 9 trigger_type : 0 name : Pickup_Health_Trigger bounding_box_min : -0.500 -0.500 -0.500 @@ -32,17 +32,16 @@ Entity type : 6 scale : 1.000 1.000 1.000 material : 1 - rotation : 0.000 0.000 0.000 1.000 + rotation : 0.000 0.974 0.000 0.227 diffuse_color : 0.686 0.000 0.027 1.000 geometry : pickup_health.symbres - active : true diffuse_texture : white.tga position : 0.000 0.000 0.000 + flags : 137 name : Pickup_Health_Mesh uv_scale : 1.000 1.000 } - Entity { type : 7 @@ -52,8 +51,8 @@ Entity rotation : 0.000 0.000 0.000 1.000 loop : false sound_min_distance : 0.0000 - active : true position : 0.000 0.000 0.000 + flags : 9 source_filename : sounds/pickup_health.wav sound_type : 1 sound_max_distance : 30.0000 @@ -62,4 +61,5 @@ Entity sound_attenuation_type : 2 paused : true bounding_box_max : 0.500 0.500 0.500 -} \ No newline at end of file +} + diff --git a/assets/entities/pickup_key_blue.symtres b/assets/entities/pickup_key_blue.symtres index f3a4102..11280c1 100644 --- a/assets/entities/pickup_key_blue.symtres +++ b/assets/entities/pickup_key_blue.symtres @@ -4,11 +4,11 @@ Entity scale : 1.000 1.000 1.000 pickup_key_type : 4 rotation : 0.000 0.000 0.000 1.000 - pickup_spin_speed : 40.0000 - active : true + pickup_spin_speed : 120.0000 position : -39.000 2.000 -56.000 + flags : 1 pickup_type : 0 - name : Pickup_Key_Blue + name : Pickup_Key_Green bounding_box_min : -0.500 -0.500 -0.500 bounding_box_max : 0.500 0.500 0.500 } @@ -16,11 +16,11 @@ Entity Entity { type : 9 - scale : 3.00 3 3 + scale : 3.000 3.000 3.000 rotation : 0.000 0.000 0.000 1.000 trigger_mask : 1 - active : true position : 0.000 0.000 0.000 + flags : 9 trigger_type : 0 name : Pickup_Key_Blue_Trigger bounding_box_min : -0.500 -0.500 -0.500 @@ -33,11 +33,11 @@ Entity scale : 1.000 1.000 1.000 material : 1 rotation : 0.000 0.000 0.000 1.000 - diffuse_color : 0.530 0.670 0.280 1.000 + diffuse_color : 0.470 0.670 0.890 1.000 geometry : pickup_key.symbres - active : true diffuse_texture : white.tga position : 0.000 0.000 0.000 + flags : 137 name : Pickup_Key_Blue_Mesh uv_scale : 1.000 1.000 } @@ -51,8 +51,8 @@ Entity rotation : 0.000 0.000 0.000 1.000 loop : false sound_min_distance : 0.0000 - active : true position : 0.000 0.000 0.000 + flags : 9 source_filename : sounds/pickup_key.wav sound_type : 1 sound_max_distance : 30.0000 @@ -61,4 +61,5 @@ Entity sound_attenuation_type : 2 paused : true bounding_box_max : 0.500 0.500 0.500 -} \ No newline at end of file +} + diff --git a/assets/entities/pickup_key_green.symtres b/assets/entities/pickup_key_green.symtres index 56fa7e5..9cee89f 100644 --- a/assets/entities/pickup_key_green.symtres +++ b/assets/entities/pickup_key_green.symtres @@ -4,9 +4,9 @@ Entity scale : 1.000 1.000 1.000 pickup_key_type : 2 rotation : 0.000 0.000 0.000 1.000 - pickup_spin_speed : 5.0000 - active : true - position : -37.000 2.000 -74.000 + pickup_spin_speed : 120.0000 + position : -9.000 2.000 -68.000 + flags : 1 pickup_type : 0 name : Pickup_Key_Green bounding_box_min : -0.500 -0.500 -0.500 @@ -19,8 +19,8 @@ Entity scale : 1.000 1.000 1.000 rotation : 0.000 0.000 0.000 1.000 trigger_mask : 1 - active : true position : 0.000 0.000 0.000 + flags : 9 trigger_type : 0 name : Pickup_Key_Green_Trigger bounding_box_min : -0.500 -0.500 -0.500 @@ -33,11 +33,11 @@ Entity scale : 1.000 1.000 1.000 material : 1 rotation : 0.000 0.000 0.000 1.000 - diffuse_color : 0.870 0.320 0.400 1.000 + diffuse_color : 0.530 0.670 0.280 1.000 geometry : pickup_key.symbres - active : true diffuse_texture : white.tga position : 0.000 0.000 0.000 + flags : 137 name : Pickup_Key_Green_Mesh uv_scale : 1.000 1.000 } @@ -51,8 +51,8 @@ Entity rotation : 0.000 0.000 0.000 1.000 loop : false sound_min_distance : 0.0000 - active : true position : 0.000 0.000 0.000 + flags : 9 source_filename : sounds/pickup_key.wav sound_type : 1 sound_max_distance : 30.0000 @@ -61,4 +61,5 @@ Entity sound_attenuation_type : 2 paused : true bounding_box_max : 0.500 0.500 0.500 -} \ No newline at end of file +} + diff --git a/assets/entities/pickup_key_red.symtres b/assets/entities/pickup_key_red.symtres index 89335f9..a70bbed 100644 --- a/assets/entities/pickup_key_red.symtres +++ b/assets/entities/pickup_key_red.symtres @@ -1,14 +1,16 @@ Entity { - type : 11 + type : 11 scale : 1.000 1.000 1.000 + pickup_key_type : 1 rotation : 0.000 0.000 0.000 1.000 - active : true - position : 0.000 0.000 0.000 + pickup_spin_speed : 120.0000 + position : -37.000 2.000 -74.000 + flags : 1 + pickup_type : 0 name : Pickup_Key_Red - pickup_type : 0 - pickup_key_type : 1 - pickup_spin_speed : 5.000 + bounding_box_min : -0.500 -0.500 -0.500 + bounding_box_max : 0.500 0.500 0.500 } Entity @@ -17,8 +19,8 @@ Entity scale : 1.000 1.000 1.000 rotation : 0.000 0.000 0.000 1.000 trigger_mask : 1 - active : true position : 0.000 0.000 0.000 + flags : 9 trigger_type : 0 name : Pickup_Key_Red_Trigger bounding_box_min : -0.500 -0.500 -0.500 @@ -31,11 +33,11 @@ Entity scale : 1.000 1.000 1.000 material : 1 rotation : 0.000 0.000 0.000 1.000 - diffuse_color : 1.000 1.000 1.000 1.000 + diffuse_color : 0.870 0.320 0.400 1.000 geometry : pickup_key.symbres - active : true diffuse_texture : white.tga position : 0.000 0.000 0.000 + flags : 137 name : Pickup_Key_Red_Mesh uv_scale : 1.000 1.000 } @@ -49,8 +51,8 @@ Entity rotation : 0.000 0.000 0.000 1.000 loop : false sound_min_distance : 0.0000 - active : true position : 0.000 0.000 0.000 + flags : 9 source_filename : sounds/pickup_key.wav sound_type : 1 sound_max_distance : 30.0000 @@ -59,4 +61,5 @@ Entity sound_attenuation_type : 2 paused : true bounding_box_max : 0.500 0.500 0.500 -} \ No newline at end of file +} + diff --git a/assets/scenes/scene_1.symtres b/assets/scenes/scene_1.symtres index 9743e99..0aa6809 100755 --- a/assets/scenes/scene_1.symtres +++ b/assets/scenes/scene_1.symtres @@ -19,10 +19,10 @@ Player { type : 2 scale : 1.000 1.000 1.000 - rotation : 0.000 -0.482 0.000 0.877 - active : true + rotation : 0.000 -0.488 0.000 0.873 player_key_mask : 0 position : -55.691 2.167 -8.502 + flags : 1 player_health : 100 name : Player bounding_box_min : -1.500 -1.500 -1.000 @@ -122,7 +122,7 @@ Scene_Entity_Entry Scene_Entity_Entry { - scale : 51.000 11.000 1.000 + scale : 51.000 11.000 0.750 rotation : 0.000 -0.707 0.000 0.707 position : 18.000 6.000 -55.000 filename : cube_uv @@ -195,9 +195,9 @@ Scene_Entity_Entry Scene_Entity_Entry { scale : 1.000 1.000 1.000 - rotation : 0.000 0.707 0.000 0.707 - position : 18.000 1.000 -84.000 - filename : door + rotation : 0.000 -0.707 0.000 0.707 + position : 18.000 1.000 -83.000 + filename : door_rgb name : Door } diff --git a/build/genie.lua b/build/genie.lua index 509ffe9..6a61718 100644 --- a/build/genie.lua +++ b/build/genie.lua @@ -60,7 +60,7 @@ solution "Symmetry" description = "Generate version.h from git revision number", execute = function() local major_version = 0 - local minor_version = 1 + local minor_version = 2 local revision_number = os.outputof("git rev-list --count HEAD") local branch = os.outputof("git rev-parse --abbrev-ref HEAD") diff --git a/src/common/version.h b/src/common/version.h index 0d1bca2..1426ccd 100755 --- a/src/common/version.h +++ b/src/common/version.h @@ -3,8 +3,8 @@ /* Auto generated version file. DO NOT MODIFY */ #define SYMMETRY_VERSION_MAJOR 0 -#define SYMMETRY_VERSION_MINOR 1 -#define SYMMETRY_VERSION_REVISION 357 +#define SYMMETRY_VERSION_MINOR 2 +#define SYMMETRY_VERSION_REVISION 358 #define SYMMETRY_VERSION_BRANCH "dev" #endif \ No newline at end of file diff --git a/src/game/editor.c b/src/game/editor.c index 4b9bf2b..21bdfec 100755 --- a/src/game/editor.c +++ b/src/game/editor.c @@ -119,8 +119,8 @@ void editor_init(struct Editor* editor) editor->window_settings_renderer = 0; editor->window_settings_editor = 0; editor->window_settings_scene = 0; - editor->window_property_inspector = 0; - editor->window_scene_heirarchy = 0; + editor->window_property_inspector = 1; + editor->window_scene_heirarchy = 1; editor->window_scene_dialog = 0; editor->window_entity_dialog = 0; editor->camera_looking_around = 0; @@ -380,7 +380,7 @@ void editor_update(struct Editor* editor, float dt) nk_layout_row_begin(context, NK_DYNAMIC, editor->top_panel_height - 5, 8); nk_layout_row_push(context, 0.03f); - if(nk_menu_begin_label(context, "File", NK_TEXT_ALIGN_LEFT | NK_TEXT_ALIGN_MIDDLE, nk_vec2(150, 150))) + if(nk_menu_begin_label(context, "File", NK_TEXT_ALIGN_LEFT | NK_TEXT_ALIGN_MIDDLE, nk_vec2(150, 250))) { nk_layout_row_dynamic(context, row_height, 1); if(nk_menu_item_label(context, "New Scene", NK_TEXT_ALIGN_MIDDLE | NK_TEXT_ALIGN_LEFT)) @@ -416,10 +416,8 @@ void editor_update(struct Editor* editor, float dt) } if(nk_menu_item_label(context, "Back to Game", NK_TEXT_ALIGN_LEFT | NK_TEXT_ALIGN_MIDDLE)) - { - game_state->game_mode = GAME_MODE_GAME; - game_state->scene->active_camera_index = CAM_GAME; - } + game_mode_set(GAME_MODE_GAME); + nk_menu_end(context); } @@ -1718,52 +1716,59 @@ void editor_window_scene_hierarchy(struct nk_context* context, struct Editor* ed nk_tree_pop(context); } - if(nk_tree_push(context, NK_TREE_TAB, "Lights", NK_MAXIMIZED)) + if(nk_tree_push(context, NK_TREE_TAB, "Doors", NK_MAXIMIZED)) { - for(int i = 0; i < MAX_SCENE_LIGHTS; i++) - editor_show_entity_in_list(editor, context, scene, &scene->lights[i]); + for(int i = 0; i < MAX_SCENE_DOORS; i++) + editor_show_entity_in_list(editor, context, scene, &scene->doors[i]); nk_tree_pop(context); } - if(nk_tree_push(context, NK_TREE_TAB, "Static Meshes", NK_MAXIMIZED)) + if(nk_tree_push(context, NK_TREE_TAB, "Enemies", NK_MAXIMIZED)) { - for(int i = 0; i < MAX_SCENE_STATIC_MESHES; i++) - editor_show_entity_in_list(editor, context, scene, &scene->static_meshes[i]); + for(int i = 0; i < MAX_SCENE_ENEMIES; i++) + editor_show_entity_in_list(editor, context, scene, &scene->enemies[i]); nk_tree_pop(context); } - if(nk_tree_push(context, NK_TREE_TAB, "Sound Sources", NK_MAXIMIZED)) + if(nk_tree_push(context, NK_TREE_TAB, "Entities", NK_MAXIMIZED)) { - for(int i = 0; i < MAX_SCENE_SOUND_SOURCES; i++) - editor_show_entity_in_list(editor, context, scene, &scene->sound_sources[i]); + for(int i = 0; i < MAX_SCENE_ENTITIES; i++) + editor_show_entity_in_list(editor, context, scene, &scene->entities[i]); nk_tree_pop(context); } - if(nk_tree_push(context, NK_TREE_TAB, "Enemies", NK_MAXIMIZED)) + if(nk_tree_push(context, NK_TREE_TAB, "Lights", NK_MAXIMIZED)) { - for(int i = 0; i < MAX_SCENE_ENEMIES; i++) - editor_show_entity_in_list(editor, context, scene, &scene->enemies[i]); + for(int i = 0; i < MAX_SCENE_LIGHTS; i++) + editor_show_entity_in_list(editor, context, scene, &scene->lights[i]); nk_tree_pop(context); } - if(nk_tree_push(context, NK_TREE_TAB, "Triggers", NK_MAXIMIZED)) + if(nk_tree_push(context, NK_TREE_TAB, "Pickups", NK_MAXIMIZED)) { - for(int i = 0; i < MAX_SCENE_TRIGGERS; i++) - editor_show_entity_in_list(editor, context, scene, &scene->triggers[i]); + for(int i = 0; i < MAX_SCENE_PICKUPS; i++) + editor_show_entity_in_list(editor, context, scene, &scene->pickups[i]); nk_tree_pop(context); } - if(nk_tree_push(context, NK_TREE_TAB, "Doors", NK_MAXIMIZED)) + if(nk_tree_push(context, NK_TREE_TAB, "Static Meshes", NK_MAXIMIZED)) { - for(int i = 0; i < MAX_SCENE_DOORS; i++) - editor_show_entity_in_list(editor, context, scene, &scene->doors[i]); + for(int i = 0; i < MAX_SCENE_STATIC_MESHES; i++) + editor_show_entity_in_list(editor, context, scene, &scene->static_meshes[i]); nk_tree_pop(context); } - if(nk_tree_push(context, NK_TREE_TAB, "Entities", NK_MAXIMIZED)) + if(nk_tree_push(context, NK_TREE_TAB, "Sound Sources", NK_MAXIMIZED)) { - for(int i = 0; i < MAX_SCENE_ENTITIES; i++) - editor_show_entity_in_list(editor, context, scene, &scene->entities[i]); + for(int i = 0; i < MAX_SCENE_SOUND_SOURCES; i++) + editor_show_entity_in_list(editor, context, scene, &scene->sound_sources[i]); + nk_tree_pop(context); + } + + if(nk_tree_push(context, NK_TREE_TAB, "Triggers", NK_MAXIMIZED)) + { + for(int i = 0; i < MAX_SCENE_TRIGGERS; i++) + editor_show_entity_in_list(editor, context, scene, &scene->triggers[i]); nk_tree_pop(context); } @@ -1818,10 +1823,24 @@ void editor_window_property_inspector(struct nk_context* context, struct Editor* copy_entity_name = true; } - nk_layout_row_dynamic(context, row_height, 2); nk_label(context, "ID", NK_TEXT_ALIGN_LEFT); nk_labelf(context, NK_TEXT_ALIGN_RIGHT, "%d", entity->id); - nk_layout_row_dynamic(context, row_height, 2); nk_label(context, "Selected", NK_TEXT_ALIGN_LEFT); nk_labelf(context, NK_TEXT_ALIGN_RIGHT, "%s", (entity->flags & EF_SELECTED_IN_EDITOR) ? "True" : "False"); - nk_layout_row_dynamic(context, row_height, 2); nk_label(context, "Entity Type", NK_TEXT_ALIGN_LEFT); nk_labelf(context, NK_TEXT_ALIGN_RIGHT, "%s", entity_type_name_get(entity)); - nk_layout_row_dynamic(context, row_height, 2); nk_label(context, "Archetype", NK_TEXT_ALIGN_LEFT); nk_label(context, entity->archetype_index == -1 ? "None" : scene->entity_archetypes[entity->archetype_index], NK_TEXT_ALIGN_RIGHT); + nk_layout_row_dynamic(context, row_height, 2); + nk_label(context, "ID", NK_TEXT_ALIGN_LEFT); nk_labelf(context, NK_TEXT_ALIGN_RIGHT, "%d", entity->id); + nk_label(context, "Selected", NK_TEXT_ALIGN_LEFT); nk_labelf(context, NK_TEXT_ALIGN_RIGHT, "%s", (entity->flags & EF_SELECTED_IN_EDITOR) ? "True" : "False"); + nk_label(context, "Entity Type", NK_TEXT_ALIGN_LEFT); nk_labelf(context, NK_TEXT_ALIGN_RIGHT, "%s", entity_type_name_get(entity)); + nk_label(context, "Archetype", NK_TEXT_ALIGN_LEFT); nk_label(context, entity->archetype_index == -1 ? "None" : scene->entity_archetypes[entity->archetype_index], NK_TEXT_ALIGN_RIGHT); + + if(nk_tree_push(context, NK_TREE_NODE, "Flags", NK_MINIMIZED)) + { + nk_layout_row_dynamic(context, row_height, 1); + nk_checkbox_flags_label(context, "Active", &entity->flags, EF_ACTIVE); + nk_checkbox_flags_label(context, "Transient", &entity->flags, EF_TRANSIENT); + nk_checkbox_flags_label(context, "Hide in Editor", &entity->flags, EF_HIDE_IN_EDITOR_SCENE_HIERARCHY); + nk_checkbox_flags_label(context, "Skip Render", &entity->flags, EF_SKIP_RENDER); + nk_checkbox_flags_label(context, "Ignore Raycast", &entity->flags, EF_IGNORE_RAYCAST); + nk_checkbox_flags_label(context, "Ignore Collision", &entity->flags, EF_IGNORE_COLLISION); + nk_tree_pop(context); + } + nk_layout_row_dynamic(context, row_height + 5, 2); nk_label(context, "Parent Name", NK_TEXT_ALIGN_LEFT); static char parent_name[MAX_ENTITY_NAME_LEN]; @@ -2437,6 +2456,37 @@ void editor_window_property_inspector(struct nk_context* context, struct Editor* } } + /* Pickups */ + if(entity->type == ET_PICKUP) + { + struct Pickup* pickup = (struct Pickup*)entity; + if(nk_tree_push(context, NK_TREE_TAB, "Pickup", NK_MAXIMIZED)) + { + float combo_width = nk_widget_width(context), combo_height = row_height * PICKUP_MAX; + pickup->type = nk_combo_string(context, "Key\0Health", pickup->type, PICKUP_MAX, row_height, nk_vec2(combo_width, combo_height)); + switch(pickup->type) + { + case PICKUP_KEY: + nk_layout_row_dynamic(context, row_height, 3); + if(nk_check_label(context, "Red", pickup->key_type == DOOR_KEY_MASK_RED ? 1 : 0)) pickup->key_type = DOOR_KEY_MASK_RED; + if(nk_check_label(context, "Green", pickup->key_type == DOOR_KEY_MASK_GREEN ? 1 : 0)) pickup->key_type = DOOR_KEY_MASK_GREEN; + if(nk_check_label(context, "Blue", pickup->key_type == DOOR_KEY_MASK_BLUE ? 1 : 0)) pickup->key_type = DOOR_KEY_MASK_BLUE; + break; + case PICKUP_HEALTH: + nk_layout_row_dynamic(context, row_height, 1); + nk_property_int(context, "Health Amount", 5, &pickup->health, 100, 5, 5); + break; + } + nk_layout_row_dynamic(context, row_height, 1); + nk_property_float(context, "Spin Speed", 0.f, &pickup->spin_speed, 1000.f, 1.f, 1.f); + if(nk_button_label(context, "Select Mesh")) editor_entity_select(editor, pickup->mesh); + if(nk_button_label(context, "Select Sound Source")) editor_entity_select(editor, pickup->sound); + if(nk_button_label(context, "Select Trigger")) editor_entity_select(editor, pickup->trigger); + + nk_tree_pop(context); + } + } + /* Player */ if(entity->type == ET_PLAYER) { diff --git a/src/game/entity.c b/src/game/entity.c index 9d42372..76ef101 100755 --- a/src/game/entity.c +++ b/src/game/entity.c @@ -115,7 +115,6 @@ bool entity_write(struct Entity* entity, struct Parser_Object* object, bool writ hashmap_str_set(entity_data, "name", entity->name); hashmap_int_set(entity_data, "type", entity->type); - hashmap_bool_set(entity_data, "active", entity->flags & EF_ACTIVE ? true : false); /* Transform */ hashmap_vec3_set(entity_data, "position", &entity->transform.position); @@ -128,6 +127,9 @@ bool entity_write(struct Entity* entity, struct Parser_Object* object, bool writ hashmap_vec3_set(entity_data, "bounding_box_max", &entity->bounding_box.max); } + uint flags = entity->flags & ~(EF_SELECTED_IN_EDITOR | EF_MARKED_FOR_DELETION); // Unset flags only used during run-time + hashmap_uint_set(entity_data, "flags", flags); + switch(entity->type) { case ET_CAMERA: @@ -528,6 +530,8 @@ struct Entity* entity_read(struct Parser_Object* object, struct Entity* parent_e if(hashmap_value_exists(object->data, "bounding_box_max")) new_entity->bounding_box.max = hashmap_vec3_get(object->data, "bounding_box_max"); } + if(hashmap_value_exists(object->data, "flags")) new_entity->flags = hashmap_uint_get(object->data, "flags"); + transform_update_transmat(new_entity); return new_entity; diff --git a/src/game/entity.h b/src/game/entity.h index 3a6f862..3871605 100755 --- a/src/game/entity.h +++ b/src/game/entity.h @@ -63,7 +63,8 @@ enum Entity_Flags EF_TRANSIENT = 1 << 3, // Do not save the entity when saving the scene. The entity will still be saved if it is individually saved to file EF_HIDE_IN_EDITOR_SCENE_HIERARCHY = 1 << 4, EF_SKIP_RENDER = 1 << 5, - EF_IGNORE_RAYCAST = 1 << 6 + EF_IGNORE_RAYCAST = 1 << 6, + EF_IGNORE_COLLISION = 1 << 7 }; enum Pickup_Type @@ -129,7 +130,7 @@ struct Entity int id; int type; int archetype_index; - uchar flags; + uint flags; char name[MAX_ENTITY_NAME_LEN]; struct Bounding_Box bounding_box; struct Bounding_Box derived_bounding_box; diff --git a/src/game/gui_game.c b/src/game/gui_game.c index 43decf0..9204845 100644 --- a/src/game/gui_game.c +++ b/src/game/gui_game.c @@ -122,7 +122,7 @@ void gui_game_show_door_locked_dialog(struct Game_Gui* game_gui, struct Door* do { struct Player* player = &game_state->scene->player; int label_flags = NK_TEXT_ALIGN_CENTERED | NK_TEXT_ALIGN_MIDDLE; - int key_needed_gui_width = 300; + int key_needed_gui_width = 350; int key_needed_gui_height = 48; int display_width = 0; int display_height = 0; @@ -175,14 +175,12 @@ void gui_game_show_door_locked_dialog(struct Game_Gui* game_gui, struct Door* do { nk_layout_row_push(context, 0.15f); nk_label_colored(context, "GREEN", label_flags, nk_rgba_fv(&KEY_INDICATOR_COLOR_GREEN)); - keys_needed++; } if(blue_needed) { nk_layout_row_push(context, 0.15f); nk_label_colored(context, "BLUE", label_flags, nk_rgba_fv(&KEY_INDICATOR_COLOR_BLUE)); - keys_needed++; } nk_layout_row_push(context, 0.25f); diff --git a/src/game/pickup.c b/src/game/pickup.c index 4926b1c..d31a131 100644 --- a/src/game/pickup.c +++ b/src/game/pickup.c @@ -117,14 +117,18 @@ void pickup_update(struct Pickup* pickup, float dt) void pickup_on_trigger(struct Event* event, void* pickup_ptr, void* trigger_ptr) { struct Pickup* pickup = (struct Pickup*) pickup_ptr; - switch(event->trigger.triggering_entity->type) + if(!pickup->picked_up) { - case ET_PLAYER: player_on_pickup(event->trigger.triggering_entity, pickup); break; - case ET_ENEMY: - // Handle this if we add enemies that can move around - break; - } + switch(event->trigger.triggering_entity->type) + { + case ET_PLAYER: player_on_pickup(event->trigger.triggering_entity, pickup); break; + case ET_ENEMY: + // Handle this if we add enemies that can move around + break; + } - sound_source_play(game_state_get()->sound, pickup->sound); - pickup->picked_up = true; + sound_source_play(game_state_get()->sound, pickup->sound); + pickup->mesh->base.flags |= EF_SKIP_RENDER; // Hide mesh to ensure effect is instantaneous + pickup->picked_up = true; + } } \ No newline at end of file diff --git a/src/game/player.c b/src/game/player.c index 008e5eb..001cae8 100755 --- a/src/game/player.c +++ b/src/game/player.c @@ -205,6 +205,10 @@ void player_update_physics(struct Player* player, struct Scene* scene, float fix for(int i = 0; i < ray_result.num_entities_intersected; i++) { struct Entity* colliding_entity = ray_result.entities_intersected[i]; + + if(colliding_entity->flags & EF_IGNORE_COLLISION) + continue; + float distance = bv_distance_ray_bounding_box(&forward_ray, &colliding_entity->derived_bounding_box); if(distance > 0.f && distance <= player->min_forward_distance && colliding_entity != player->mesh) { @@ -241,8 +245,12 @@ void player_update_physics(struct Player* player, struct Scene* scene, float fix for(int i = 0; i < down_ray_result.num_entities_intersected; i++) { struct Entity* colliding_entity = down_ray_result.entities_intersected[i]; + if(colliding_entity == player->mesh) continue; + if(colliding_entity->flags & EF_IGNORE_COLLISION) + continue; + float distance = bv_distance_ray_bounding_box(&downward_ray, &colliding_entity->derived_bounding_box); if(distance > 0.f && distance <= player->min_downward_distance && !jumping) { diff --git a/todo.txt b/todo.txt index ebf7880..67966db 100644 --- a/todo.txt +++ b/todo.txt @@ -11,7 +11,6 @@ Todo: - Color grading - Shadow mapping - Cube mapping for sky dome etc - - Implement flag for ignoring collisions with certain entities - Implement game gui either with a separate nuklear context or as part of existing context - Fix rotate gizmo's origin not being set to the selected entity - Ambient/Background music @@ -428,4 +427,5 @@ Done: * Win/fail States * In-Game Gui * Pickups - * Pickup sounds \ No newline at end of file + * Pickup sounds + * Implemented flag for ignoring collisions with certain entities \ No newline at end of file