Added notification display in editor

dev
Shariq Shah 5 years ago
parent 4846124a29
commit e7022af69f
  1. 24
      assets/entities/fill_light.symtres
  2. 18
      assets/entities/floor_tile.symtres
  3. 18
      assets/entities/wall_tile.symtres
  4. BIN
      assets/models/floor_tile.symbres
  5. BIN
      assets/models/wall_tile.symbres
  6. 340
      assets/scenes/scene_1.symtres
  7. 2
      src/common/limits.h
  8. 2
      src/common/version.h
  9. 38
      src/game/editor.c
  10. 6
      src/game/editor.h
  11. 5
      src/game/entity.c
  12. 1
      src/game/event.c
  13. 7
      src/game/event.h
  14. 5
      src/game/gui_game.c
  15. 15
      src/game/scene.c
  16. 11
      todo.txt

@ -0,0 +1,24 @@
Entity
{
type : 5
scale : 1.000 1.000 1.000
inner_angle : 20.0000
falloff : 1.5000
light_type : 1
depth_bias : 0.0005
rotation : -0.156 -0.705 -0.150 0.675
cast_shadow : false
intensity : 0.2500
color : 0.149 0.314 0.376
radius : 20.0000
position : 0.000 11.000 0.000
flags : 1
outer_angle : 30.0000
name : Fill_Light
archetype : fill_light
bounding_box_min : -0.500 -0.500 -0.500
pcf_enabled : false
valid : true
bounding_box_max : 0.500 0.500 0.500
}

@ -0,0 +1,18 @@
Entity
{
type : 6
scale : 1.000 1.000 1.000
material : 0
rotation : 0.000 0.000 0.000 1.000
diffuse_color : 1.000 1.000 1.000 1.000
geometry : floor_tile.symbres
specular : 0.4000
diffuse_texture : white.tga
diffuse : 1.0000
position : -2.000 0.000 10.000
flags : 1
specular_strength : 62.0000
name : Floor_Tile
uv_scale : 0.300 0.200
}

@ -0,0 +1,18 @@
Entity
{
type : 6
scale : 1.000 3.000 1.000
material : 0
rotation : 0.000 0.000 0.000 1.000
diffuse_color : 1.000 1.000 1.000 1.000
geometry : wall_tile.symbres
specular : 0.4000
diffuse_texture : white.tga
diffuse : 1.0000
position : 26.000 6.000 2.000
flags : 1
specular_strength : 62.0000
name : Wall_Tile
uv_scale : 0.300 0.200
}

Binary file not shown.

Binary file not shown.

@ -21,9 +21,9 @@ Player
{
type : 2
scale : 1.000 1.000 1.000
rotation : 0.000 0.345 0.000 0.939
rotation : 0.000 0.721 0.000 0.692
player_key_mask : 0
position : -10.436 2.167 27.829
position : 48.866 2.167 7.616
flags : 1
player_health : 100
name : Player
@ -32,112 +32,304 @@ Player
bounding_box_max : 1.500 1.500 1.000
}
Scene_Entity_Entry
Entity
{
scale : 1.000 4.000 -10.000
type : 5
scale : 1.000 1.000 1.000
inner_angle : 20.0000
falloff : 1.5000
light_type : 2
depth_bias : 0.0005
rotation : 0.000 0.000 0.000 1.000
position : -29.000 3.000 25.000
filename : collision_default
name : Collision
cast_shadow : false
intensity : 1.0000
color : 0.247 0.533 0.686
radius : 20.0000
position : 46.000 5.000 7.000
flags : 1
outer_angle : 30.0000
name : Test_Light
archetype : Spot
bounding_box_min : -0.500 -0.500 -0.500
pcf_enabled : false
valid : true
bounding_box_max : 0.500 0.500 0.500
}
Scene_Entity_Entry
Entity
{
type : 5
scale : 1.000 1.000 1.000
inner_angle : 20.0000
falloff : 1.5000
light_type : 2
depth_bias : 0.0005
rotation : 0.000 0.000 0.000 1.000
position : 8.000 5.000 -20.000
filename : Spot
cast_shadow : false
intensity : 1.0000
color : 1.000 1.000 1.000
radius : 20.0000
position : -0.442 2.759 1.544
flags : 1
outer_angle : 30.0000
name : Test_Light
archetype : Spot
bounding_box_min : -0.500 -0.500 -0.500
pcf_enabled : false
valid : true
bounding_box_max : 0.500 0.500 0.500
}
Scene_Entity_Entry
Entity
{
type : 5
scale : 1.000 1.000 1.000
rotation : 0.000 0.000 0.000 1.000
position : -0.442 2.759 1.544
filename : Spot
name : Test_Light
inner_angle : 20.0000
falloff : 1.5000
light_type : 1
depth_bias : 0.0005
rotation : -0.156 -0.705 -0.150 0.675
cast_shadow : false
intensity : 0.2500
color : 0.149 0.314 0.376
radius : 20.0000
position : 0.000 11.000 0.000
flags : 1
outer_angle : 30.0000
name : Fill_Light
archetype : fill_light
bounding_box_min : -0.500 -0.500 -0.500
pcf_enabled : false
valid : true
bounding_box_max : 0.500 0.500 0.500
}
Scene_Entity_Entry
Entity
{
scale : 135.000 1.000 135.000
type : 6
scale : 32.000 1.000 32.000
material : 0
rotation : 0.000 0.000 0.000 1.000
position : -17.000 0.000 -20.000
filename : cube
name : Ground
diffuse_color : 1.000 1.000 1.000 1.000
geometry : floor_tile.symbres
specular : 0.4000
diffuse_texture : white.tga
diffuse : 1.0000
position : -2.000 0.000 10.000
flags : 1
specular_strength : 62.0000
name : Floor_Tile
archetype : floor_tile
uv_scale : 0.300 0.200
}
Scene_Entity_Entry
Entity
{
scale : 135.000 6.000 1.000
type : 6
scale : 7.000 3.000 1.000
material : 0
rotation : 0.000 0.000 0.000 1.000
position : -17.000 3.000 47.000
filename : cube_uv
name : Cube
diffuse_color : 1.000 1.000 1.000 1.000
geometry : wall_tile.symbres
specular : 0.4000
diffuse_texture : white.tga
diffuse : 1.0000
position : 48.000 6.000 2.000
flags : 1
specular_strength : 62.0000
name : Wall_Tile
archetype : wall_tile
uv_scale : 0.300 0.200
}
Scene_Entity_Entry
Entity
{
scale : 135.000 5.000 1.000
rotation : 0.000 0.707 0.000 0.707
position : 50.000 3.000 -20.000
filename : cube_uv
type : 6
scale : 65.000 11.000 1.000
material : 0
rotation : 0.000 0.000 0.000 1.000
diffuse_color : 1.000 1.000 1.000 1.000
geometry : cube.symbres
specular : 1.0000
diffuse_texture : default.tga
diffuse : 1.0000
position : 17.000 6.000 -30.000
flags : 1
specular_strength : 1.0000
name : Cube
archetype : cube_uv
uv_scale : 4.600 16.400
}
Scene_Entity_Entry
Entity
{
scale : 135.000 5.000 1.000
type : 6
scale : 51.000 11.000 0.750
material : 0
rotation : 0.000 -0.707 0.000 0.707
position : -84.000 3.000 -20.000
filename : cube_uv
diffuse_color : 1.000 1.000 1.000 1.000
geometry : cube.symbres
specular : 1.0000
diffuse_texture : default.tga
diffuse : 1.0000
position : 18.000 6.000 -55.000
flags : 1
specular_strength : 1.0000
name : Cube
archetype : cube_uv
uv_scale : 4.600 16.400
}
Scene_Entity_Entry
Entity
{
scale : 49.800 5.000 1.000
type : 6
scale : 6.880 2.880 0.880
material : 0
rotation : 0.000 0.000 0.000 1.000
position : -59.000 3.000 2.000
filename : cube_uv
name : Cube
diffuse_color : 1.000 1.000 1.000 1.000
geometry : wall_tile.symbres
specular : 0.4000
diffuse_texture : white.tga
diffuse : 1.0000
position : 48.000 6.000 14.000
flags : 1
specular_strength : 62.0000
name : Wall_Tile
archetype : wall_tile
uv_scale : 0.300 0.200
}
Scene_Entity_Entry
Entity
{
scale : 65.000 11.000 1.000
rotation : 0.000 0.000 0.000 1.000
position : 17.000 6.000 -30.000
filename : cube_uv
name : Cube
type : 6
scale : 33.000 3.000 1.000
material : 0
rotation : 0.000 -0.707 0.000 0.707
diffuse_color : 1.000 1.000 1.000 1.000
geometry : wall_tile.symbres
specular : 0.4000
diffuse_texture : white.tga
diffuse : 1.0000
position : 62.000 6.000 7.000
flags : 1
specular_strength : 62.0000
name : Wall_Tile
archetype : wall_tile
uv_scale : 0.300 0.200
}
Scene_Entity_Entry
Entity
{
type : 6
scale : 4.000 3.000 1.000
material : 0
rotation : 0.000 -0.707 0.000 0.707
diffuse_color : 1.000 1.000 1.000 1.000
geometry : wall_tile.symbres
specular : 0.4000
diffuse_texture : white.tga
diffuse : 1.0000
position : 34.000 6.000 19.000
flags : 1
specular_strength : 62.0000
name : Wall_Tile
archetype : wall_tile
uv_scale : 0.300 0.200
}
Entity
{
type : 6
scale : 10.000 3.000 1.000
material : 0
rotation : 0.000 -0.707 0.000 0.707
diffuse_color : 1.000 1.000 1.000 1.000
geometry : wall_tile.symbres
specular : 0.4000
diffuse_texture : white.tga
diffuse : 1.0000
position : 34.000 6.000 -15.000
flags : 1
specular_strength : 62.0000
name : Wall_Tile
archetype : wall_tile
uv_scale : 0.300 0.200
}
Entity
{
scale : 135.000 11.000 1.000
type : 6
scale : 7.000 3.000 1.000
material : 0
rotation : 0.000 0.000 0.000 1.000
position : -17.000 6.000 -87.000
filename : cube_uv
name : Cube
diffuse_color : 1.000 1.000 1.000 1.000
geometry : wall_tile.symbres
specular : 0.4000
diffuse_texture : white.tga
diffuse : 1.0000
position : 20.000 6.000 -6.000
flags : 1
specular_strength : 62.0000
name : Wall_Tile
archetype : wall_tile
uv_scale : 0.300 0.200
}
Scene_Entity_Entry
Entity
{
scale : 60.000 11.000 1.000
type : 6
scale : 7.000 3.000 1.000
material : 0
rotation : 0.000 0.000 0.000 1.000
position : -52.000 6.000 -30.000
filename : cube_uv
name : Cube
diffuse_color : 1.000 1.000 1.000 1.000
geometry : wall_tile.symbres
specular : 0.4000
diffuse_texture : white.tga
diffuse : 1.0000
position : 20.000 6.000 24.000
flags : 1
specular_strength : 62.0000
name : Wall_Tile
archetype : wall_tile
uv_scale : 0.300 0.200
}
Scene_Entity_Entry
Entity
{
scale : 51.000 11.000 0.750
type : 6
scale : 3.000 3.000 1.000
material : 0
rotation : 0.000 -0.707 0.000 0.707
position : 18.000 6.000 -55.000
filename : cube_uv
name : Cube
diffuse_color : 1.000 1.000 1.000 1.000
geometry : wall_tile.symbres
specular : 0.4000
diffuse_texture : white.tga
diffuse : 1.0000
position : 6.000 6.000 18.000
flags : 1
specular_strength : 62.0000
name : Wall_Tile
archetype : wall_tile
uv_scale : 0.300 0.200
}
Entity
{
type : 6
scale : 3.000 3.000 1.000
material : 0
rotation : 0.000 -0.707 0.000 0.707
diffuse_color : 1.000 1.000 1.000 1.000
geometry : wall_tile.symbres
specular : 0.4000
diffuse_texture : white.tga
diffuse : 1.0000
position : 6.000 6.000 -0.000
flags : 1
specular_strength : 62.0000
name : Wall_Tile
archetype : wall_tile
uv_scale : 0.300 0.200
}
Scene_Entity_Entry
@ -185,13 +377,19 @@ Scene_Entity_Entry
name : Turret
}
Scene_Entity_Entry
Entity
{
type : 9
scale : 30.500 11.000 55.000
rotation : 0.000 0.000 0.000 1.000
trigger_mask : 1
position : 34.000 6.000 -59.000
filename : trigger
flags : 1
trigger_type : 0
name : Scene_End_Trigger
archetype : trigger
bounding_box_min : -0.500 -0.500 -0.500
bounding_box_max : 0.500 0.500 0.500
}
Scene_Entity_Entry
@ -212,6 +410,24 @@ Scene_Entity_Entry
name : Door
}
Scene_Entity_Entry
{
scale : 1.000 1.000 1.000
rotation : 0.000 0.707 0.000 0.707
position : 34.000 1.000 8.000
filename : door
name : Door
}
Scene_Entity_Entry
{
scale : 1.000 1.000 1.000
rotation : 0.000 0.707 0.000 0.707
position : 6.000 1.000 9.000
filename : door_red
name : Door
}
Scene_Entity_Entry
{
scale : 1.000 1.000 1.000

@ -43,4 +43,6 @@
#define MAX_PLAYER_HEALTH 100
#define MAX_EDITOR_NOTIFICATION_MESSAGE_LEN 256
#endif

@ -4,7 +4,7 @@
/* Auto generated version file. DO NOT MODIFY */
#define SYMMETRY_VERSION_MAJOR 0
#define SYMMETRY_VERSION_MINOR 2
#define SYMMETRY_VERSION_REVISION 366
#define SYMMETRY_VERSION_REVISION 367
#define SYMMETRY_VERSION_BRANCH "dev"
#endif

@ -78,6 +78,8 @@ static void editor_on_mousebutton_release(const struct Event* event);
static void editor_on_mousemotion(const struct Event* event);
static void editor_on_key_release(const struct Event* event);
static void editor_on_key_press(const struct Event* event);
static void editor_on_scene_saved(const struct Event* event);
static void editor_on_scene_loaded(const struct Event* event);
static void editor_camera_update(struct Editor* editor, float dt);
static void editor_show_entity_in_list(struct Editor* editor, struct nk_context* context, struct Scene* scene, struct Entity* entity);
static void editor_widget_color_combov3(struct nk_context* context, vec3* color, int width, int height);
@ -153,6 +155,10 @@ void editor_init(struct Editor* editor)
editor->tool_translate_allowed = false;
editor->entity_operation_save = false;
editor->scene_operation_save = false;
editor->notification_timer = 0.f;
editor->notification_timer_speed = 1.f;
editor->notification_stay_time = 3.f;
memset(editor->notification_message, '\0', MAX_EDITOR_NOTIFICATION_MESSAGE_LEN);
vec4_fill(&editor->cursor_entity_color, 0.f, 1.f, 1.f, 0.5f);
vec4_fill(&editor->hovered_entity_color, 0.53, 0.87, 0.28, 0.2f);
@ -169,6 +175,8 @@ void editor_init(struct Editor* editor)
event_manager_subscribe(event_manager, EVT_MOUSEMOTION, &editor_on_mousemotion);
event_manager_subscribe(event_manager, EVT_KEY_PRESSED, &editor_on_key_press);
event_manager_subscribe(event_manager, EVT_KEY_RELEASED, &editor_on_key_release);
event_manager_subscribe(event_manager, EVT_SCENE_LOADED, &editor_on_scene_loaded);
event_manager_subscribe(event_manager, EVT_SCENE_SAVED, &editor_on_scene_saved);
}
void editor_init_entities(struct Editor* editor)
@ -363,9 +371,21 @@ void editor_render(struct Editor* editor, struct Camera * active_camera)
}
}
void editor_set_notification(struct Editor* editor, const char* message, ...)
{
va_list arg_list;
va_start(arg_list, message);
vsnprintf(editor->notification_message, MAX_EDITOR_NOTIFICATION_MESSAGE_LEN, message, arg_list);
va_end(arg_list);
editor->notification_timer = editor->notification_stay_time;
}
void editor_update(struct Editor* editor, float dt)
{
editor_camera_update(editor, dt);
if(editor->notification_timer > 0.f)
editor->notification_timer -= editor->notification_timer_speed * dt;
struct Game_State* game_state = game_state_get();
struct nk_context* context = &game_state->gui_editor->context;
@ -620,7 +640,10 @@ void editor_update(struct Editor* editor, float dt)
nk_labelf(context, NK_TEXT_ALIGN_LEFT | NK_TEXT_ALIGN_MIDDLE, "Grid Length: %d", editor->grid_num_lines);
nk_layout_row_push(context, 0.34f);
nk_spacing(context, 1);
if(editor->notification_timer > 0.f)
nk_label_colored(context, editor->notification_message, LABEL_FLAGS_ALIGN_LEFT, nk_rgba_fv(&editor->cursor_entity_color));
else
nk_spacing(context, 1);
nk_layout_row_push(context, 0.04f);
nk_labelf(context, NK_TEXT_ALIGN_RIGHT | NK_TEXT_ALIGN_MIDDLE, "v%d.%d.%d-%s", SYMMETRY_VERSION_MAJOR, SYMMETRY_VERSION_MINOR, SYMMETRY_VERSION_REVISION, SYMMETRY_VERSION_BRANCH);
@ -1352,6 +1375,16 @@ void editor_tool_reset(struct Editor* editor)
editor->picking_enabled = true;
}
void editor_on_scene_loaded(const struct Event* event)
{
editor_set_notification(game_state_get()->editor, "Scene %s Loaded", event->scene_load.filename);
}
void editor_on_scene_saved(const struct Event* event)
{
editor_set_notification(game_state_get()->editor, "Scene %s Saved", event->scene_save.filename);
}
void editor_on_key_press(const struct Event* event)
{
struct Game_State* game_state = game_state_get();
@ -1621,10 +1654,11 @@ void editor_cleanup(struct Editor* editor)
event_manager_unsubscribe(event_manager, EVT_MOUSEMOTION, &editor_on_mousemotion);
event_manager_unsubscribe(event_manager, EVT_KEY_PRESSED, &editor_on_key_press);
event_manager_unsubscribe(event_manager, EVT_KEY_RELEASED, &editor_on_key_release);
event_manager_unsubscribe(event_manager, EVT_SCENE_LOADED, &editor_on_scene_loaded);
event_manager_unsubscribe(event_manager, EVT_SCENE_SAVED, &editor_on_scene_saved);
}
bool editor_widget_v3(struct nk_context* context, vec3* value, const char* name_x, const char* name_y, const char* name_z, float min, float max, float step, float inc_per_pixel, int row_height)
{
bool changed = false;

@ -3,6 +3,7 @@
#include <stdbool.h>
#include "../common/linmath.h"
#include "../common/limits.h"
struct Camera;
struct Entity;
@ -58,6 +59,10 @@ struct Editor
bool picking_enabled;
bool scene_operation_save;
bool entity_operation_save;
float notification_timer;
float notification_timer_speed;
float notification_stay_time;
char notification_message[MAX_EDITOR_NOTIFICATION_MESSAGE_LEN];
};
void editor_init(struct Editor* editor_state);
@ -67,5 +72,6 @@ void editor_render(struct Editor* editor_state, struct Camera* active_camera);
void editor_update(struct Editor* editor_state, float dt);
void editor_post_update(struct Editor* editor);
void editor_cleanup(struct Editor* editor_state);
void editor_set_notification(struct Editor* editor, const char* message, ...);
#endif

@ -110,11 +110,14 @@ bool entity_write(struct Entity* entity, struct Parser_Object* object, bool writ
return false;
}
struct Scene* scene = game_state_get()->scene;
/* First write all properties common to all entity types */
struct Hashmap* entity_data = object->data;
hashmap_str_set(entity_data, "name", entity->name);
hashmap_int_set(entity_data, "type", entity->type);
if(entity->archetype_index != -1) hashmap_str_set(entity_data, "archetype", scene->entity_archetypes[entity->archetype_index]);
/* Transform */
hashmap_vec3_set(entity_data, "position", &entity->transform.position);
@ -304,7 +307,6 @@ struct Entity* entity_read(struct Parser_Object* object, struct Entity* parent_e
const char* name = hashmap_str_get(object->data, "name");
int type = hashmap_int_get(object->data, "type");
if(!name)
{
log_error("entity:read", "No entity name provided");
@ -537,6 +539,7 @@ struct Entity* entity_read(struct Parser_Object* object, struct Entity* parent_e
if(hashmap_value_exists(object->data, "flags")) new_entity->flags = hashmap_uint_get(object->data, "flags");
transform_update_transmat(new_entity);
if(hashmap_value_exists(object->data, "archetype")) new_entity->archetype_index = scene_entity_archetype_add(scene, hashmap_str_get(object->data, "archetype"));
return new_entity;
}

@ -340,6 +340,7 @@ const char* event_name_get(int event_type)
case EVT_WINDOW_RESIZED: return "Window Resized";
case EVT_TEXT_INPUT: return "Text Input";
case EVT_SCENE_LOADED: return "Scene Loaded";
case EVT_SCENE_SAVED: return "Scene Saved";
case EVT_TRIGGER: return "Trigger Activated";
case EVT_INPUT_MAP_PRESSED: return "Input Map Pressed";
case EVT_INPUT_MAP_RELEASED: return "Input Map Released";

@ -26,6 +26,7 @@ enum Event_Types
EVT_WINDOW_RESIZED,
EVT_TEXT_INPUT,
EVT_SCENE_LOADED,
EVT_SCENE_SAVED,
EVT_TRIGGER,
EVT_INPUT_MAP_PRESSED,
EVT_INPUT_MAP_RELEASED,
@ -98,6 +99,11 @@ struct Scene_Loaded_Event
char filename[MAX_FILENAME_LEN];
};
struct Scene_Saved_Event
{
char filename[MAX_FILENAME_LEN];
};
struct Trigger_Event
{
struct Trigger* sender;
@ -128,6 +134,7 @@ struct Event
struct Text_Input_Event text_input;
struct Window_Resized_Event window_resize;
struct Scene_Loaded_Event scene_load;
struct Scene_Saved_Event scene_save;
struct Trigger_Event trigger;
struct Input_Map_Event input_map;
struct Player_Death_Event player_death;

@ -138,6 +138,7 @@ void gui_game_show_door_locked_dialog(struct Game_Gui* game_gui, struct Door* do
struct Game_State* game_state = game_state_get();
if(game_state->game_mode == GAME_MODE_GAME)
{
context->style.window.fixed_background = game_gui->skin.hud_background;
struct Player* player = &game_state->scene->player;
int label_flags = NK_TEXT_ALIGN_CENTERED | NK_TEXT_ALIGN_MIDDLE;
int key_needed_gui_width = 350;
@ -388,8 +389,8 @@ void gui_game_end_dialog(struct nk_context* context)
int row_height = 30;
int popup_x = 0;
int popup_y = 0;
int popup_width = 300;
int popup_height = 200;
int popup_width = 350;
int popup_height = 250;
int display_width = 0;
int display_height = 0;
int popup_flags = NK_WINDOW_TITLE | NK_WINDOW_BORDER;

@ -382,7 +382,7 @@ bool scene_save(struct Scene* scene, const char* filename, int directory_type)
hashmap_bool_set(scene_data, "debug_draw_physics", render_settings->debug_draw_physics);
if(scene->init) hashmap_str_set(scene_data, "init_func", scene->init_func_name);
if(scene->cleanup) hashmap_str_set(scene_data, "cleanup_func", scene->cleanup_func_name);
hashmap_str_set(scene_data, "next_scene", scene->next_level_filename != '\0' ? scene->next_level_filename : "NONE");
hashmap_str_set(scene_data, "next_scene", strnlen(scene->next_level_filename, MAX_FILENAME_LEN) != 0 ? scene->next_level_filename : "NONE");
hashmap_str_set(scene_data, "background_music_filename", scene->background_music_buffer->filename);
hashmap_float_set(scene_data, "background_music_volume", scene->background_music_volume);
@ -409,6 +409,13 @@ bool scene_save(struct Scene* scene, const char* filename, int directory_type)
parser_free(parser);
fclose(scene_file);
struct Event_Manager* event_manager = game_state_get()->event_manager;
struct Event* scene_saved_event = event_manager_create_new_event(event_manager);
scene_saved_event->type = EVT_SCENE_SAVED;
strncpy(scene_saved_event->scene_save.filename, filename, MAX_FILENAME_LEN);
event_manager_send_event(event_manager, scene_saved_event);
return true;
}
@ -475,7 +482,7 @@ void scene_write_entity_list(struct Scene* scene, int entity_type, struct Parser
if(!(entity->flags & EF_TRANSIENT) && (entity->flags & EF_ACTIVE))
{
if(entity->archetype_index != -1)
if(entity->archetype_index != -1 && array_len(entity->transform.children) != 0)
{
scene_write_entity_entry(scene, entity, parser);
}
@ -1523,7 +1530,7 @@ struct Entity* scene_entity_duplicate(struct Scene* scene, struct Entity* entity
assert(scene && entity);
struct Entity* new_entity = NULL;
if(entity->archetype_index != -1)
if(entity->archetype_index != -1 && array_len(entity->transform.children) > 0)
{
new_entity = entity_load(scene->entity_archetypes[entity->archetype_index], DIRT_INSTALL, true);
if(new_entity) scene_entity_parent_set(scene, new_entity, entity->transform.parent);
@ -1566,7 +1573,6 @@ struct Entity* scene_entity_duplicate(struct Scene* scene, struct Entity* entity
return new_entity;
memcpy(new_mesh->model.material_params, mesh->model.material_params, sizeof(struct Variant) * MMP_MAX);
new_entity = &new_mesh->base;
//Handle collision related information here!
}
break;
case ET_SOUND_SOURCE:
@ -1596,6 +1602,7 @@ struct Entity* scene_entity_duplicate(struct Scene* scene, struct Entity* entity
}
transform_copy(new_entity, entity, false);
new_entity->archetype_index = entity->archetype_index;
for(int i = 0; i < array_len(entity->transform.children); i++)
{

@ -1,6 +1,5 @@
Todo:
- Game End
- Save NONE when next_scene is not set and the scene is being saved
- Add player start entity that specifies where the player must start at the beginning of every level
- Don't save parent entity's transform when saving entity archetype. Only save the transformation values for children
- Save case sensitive file names when scene entity entries
- Disbale all player actions when scene cleared dialog or scene restart dialog are active
@ -17,12 +16,6 @@ Todo:
- Sky Cube maps
- Scrolling textures
- Apply the selected entity's transformation when duplicating an entity that has an entity archetype
- Gameplay level features:
- Each scene should always have a directional light that serves as the main source of light when there are no other lights
- Each scene should always have a texture cube that serves as the sky
x Triggers
x Basic Enemy
? Split this todo into gameplay/engine todos
? Write entity flags to scene file or when saving entity to file?
? Add scene init/de-init function hashmap that maps a function that should be called when scene is loaded and unloaded. Save this to file for every scene or map functions based on the name of the scene?
- Release mouse when window loses focus and limit fps
@ -436,3 +429,5 @@ Done:
* Enemies getting hit by bullets
* Fixed crash when default entity type is loaded from file
* Memory utils that provide allocation tracking
* Game End
* Save NONE when next_scene is not set and the scene is being saved
Loading…
Cancel
Save