Added door properties to property inspector

dev
Shariq Shah 6 years ago
parent 833bfecf1d
commit 882880b7cf
  1. 2
      assets/entities/door.symtres
  2. 2
      src/common/version.h
  3. 3
      src/game/door.h
  4. 57
      src/game/editor.c
  5. 4
      todo.txt

@ -10,7 +10,7 @@ Entity
bounding_box_max : 0.500 0.500 0.500
door_speed : 6.000
door_state : 0
door_mask : 1
door_mask : 0
door_open_position : -7.000
door_close_position : 0.000
}

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

@ -12,7 +12,8 @@ enum Door_State
DOOR_CLOSED = 0,
DOOR_OPEN,
DOOR_CLOSING,
DOOR_OPENING
DOOR_OPENING,
DOOR_STATE_MAX
};
void door_init(struct Door* door, int mask);

@ -33,6 +33,7 @@
#include "debug_vars.h"
#include "../common/version.h"
#include "sound_source.h"
#include "door.h"
#include <stdio.h>
#include <stdlib.h>
@ -1747,6 +1748,13 @@ void editor_window_scene_hierarchy(struct nk_context* context, struct Editor* ed
nk_tree_pop(context);
}
if(nk_tree_push(context, NK_TREE_TAB, "Doors", NK_MAXIMIZED))
{
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, "Entities", NK_MAXIMIZED))
{
for(int i = 0; i < MAX_SCENE_ENTITIES; i++)
@ -2353,6 +2361,55 @@ void editor_window_property_inspector(struct nk_context* context, struct Editor*
nk_tree_pop(context);
}
}
/* Door */
if(entity->type == ET_DOOR)
{
struct Door* door = (struct Door*)entity;
if(nk_tree_push(context, NK_TREE_TAB, "Door", NK_MAXIMIZED))
{
nk_layout_row_dynamic(context, row_height, 2);
nk_label(context, "State", LABEL_FLAGS_ALIGN_LEFT);
float combo_width = nk_widget_width(context), combo_height = row_height * DOOR_STATE_MAX;
int state = nk_combo_string(context, "Closed\0Open\0Closing\0Opening", door->state, DOOR_STATE_MAX, row_height, nk_vec2(combo_width, combo_height));
nk_layout_row_dynamic(context, row_height, 1);
nk_label(context, "Key Mask", NK_TEXT_ALIGN_MIDDLE | NK_TEXT_ALIGN_CENTERED);
nk_layout_row_dynamic(context, row_height, 3);
nk_checkbox_flags_label(context, "Red", &door->mask, DOOR_KEY_MASK_RED);
nk_checkbox_flags_label(context, "Green", &door->mask, DOOR_KEY_MASK_GREEN);
nk_checkbox_flags_label(context, "Blue", &door->mask, DOOR_KEY_MASK_BLUE);
nk_layout_row_dynamic(context, row_height, 1);
nk_property_float(context, "Speed", -FLT_MAX, &door->speed, FLT_MAX, 0.1f, 0.1f);
nk_property_float(context, "Open Pos", -FLT_MAX, &door->open_position, FLT_MAX, 0.1f, 0.1f);
nk_property_float(context, "Close Pos", -FLT_MAX, &door->close_position, FLT_MAX, 0.1f, 0.1f);
if(nk_button_label(context, "Select Sound Source"))
{
editor_entity_select(editor, door->sound);
nk_tree_pop(context);
nk_end(context);
return;
}
if(nk_button_label(context, "Select Trigger"))
{
editor_entity_select(editor, door->trigger);
nk_tree_pop(context);
nk_end(context);
return;
}
if(nk_button_label(context, "Select Static Mesh"))
{
editor_entity_select(editor, door->mesh);
nk_tree_pop(context);
nk_end(context);
return;
}
nk_tree_pop(context);
}
}
}
else
{

@ -1,11 +1,10 @@
Todo:
- Add door properties to property inspector in editor
- Switch transformation in property inspector to show/modify local transform values by default and show absolute transform values as read-only.
- Doors that open using the red/green/blue keys only as a way of progressing the level or cordoing off certain sections
- RGB keys to progress to next level
- Player/enemies getting hit by bullets
- Win/fail States
- Remove excessive repitition in scene related code that handles multiple entity types
- Remove excessive repitition in scene and editor code that handles multiple entity types
- Allow switching to editor mode when game is in pause mode
- Rendering Additions:
- Color grading
@ -420,3 +419,4 @@ Done:
* Fixed console not working in game mode
* Pause sound when game is in pause mode
* Composite door entity made up of static mesh, sound entity and trigger. Door might require 0-3 keys in order to be opened.
* Add door properties to property inspector in editor
Loading…
Cancel
Save