From 5aec003b400b102e3cf599f0149fe000939eb9e5 Mon Sep 17 00:00:00 2001 From: Cameron Murphy Reikes Date: Mon, 10 Jul 2023 21:13:13 -0700 Subject: [PATCH] Dialog bubble fades, more art panick update --- art/art.blend | 4 ++-- assets/dialog_bubble.png | 4 ++-- main.c | 20 ++++++++++++++++++-- tuning.h | 1 + 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/art/art.blend b/art/art.blend index 674dee8..7b8594e 100644 --- a/art/art.blend +++ b/art/art.blend @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:44a79326726295efd4403137a0a8406ec349ce1e22374dea6e43a6401946e34e -size 30742332 +oid sha256:9fb6d6dd9ed99b4e0cb4d5f391af5fb5648e4e2e408b26c110f9e0188d9b7ed6 +size 30828028 diff --git a/assets/dialog_bubble.png b/assets/dialog_bubble.png index d56f33a..bc9d902 100644 --- a/assets/dialog_bubble.png +++ b/assets/dialog_bubble.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8e1e7aa63a5629e94a496cbc56ccdf6c990c32ef9372e7f11f8340a6cf3a1734 -size 10845 +oid sha256:856bb91449cf0881a7cc51fab3d3e46a5c23c349122839534f836361a4c7aa52 +size 3562 diff --git a/main.c b/main.c index 39527c7..cebaf55 100644 --- a/main.c +++ b/main.c @@ -1855,6 +1855,9 @@ bool perform_action(Entity *from, Action a) MemoryContext context = {0}; context.author_npc_kind = from->npc_kind; + if(a.speech_length > 0) + from->dialog_fade = 1.0f; + if(from == gs.player && gete(from->talking_to)) { context.was_talking_to_somebody = true; @@ -5518,6 +5521,14 @@ void frame(void) dance_anim = keydown[SAPP_KEYCODE_U]; nervous_anim = keydown[SAPP_KEYCODE_I]; + if(keydown[SAPP_KEYCODE_O]) + { + ENTITIES_ITER(gs.entities) + { + it->standing = STANDING_INDIFFERENT; + } + } + Vec3 player_pos = V3(gs.player->pos.x, 0.0, gs.player->pos.y); //dbgline(V2(0,0), V2(500, 500)); const float vertical_to_horizontal_ratio = CAM_VERTICAL_TO_HORIZONTAL_RATIO; @@ -5871,6 +5882,10 @@ void frame(void) { // @Place(entity processing) + + if(it->dialog_fade > 0.0f) + it->dialog_fade -= dt/DIALOG_FADE_TIME; + if (it->gen_request_id != 0) { assert(it->gen_request_id > 0); @@ -6786,10 +6801,11 @@ void frame(void) Vec2 screen_pos = threedee_to_screenspace(bubble_pos); Vec2 size = V2(400.0f,400.0f); Vec2 bubble_center = AddV2(screen_pos, V2(-10.0f,40.0f)); + float dialog_alpha = bubble_factor * it->dialog_fade; draw_quad((DrawParams){ quad_centered(bubble_center, size), IMG(image_dialog_bubble), - blendalpha(WHITE, bubble_factor), + blendalpha(WHITE, dialog_alpha), .layer = LAYER_UI_FG, }); @@ -6802,7 +6818,7 @@ void frame(void) translate_words_by(placed, AddV2(placing_text_in.upper_left, V2(0, -get_vertical_dist_between_lines(text_scale)))); for(PlacedWord *cur = placed.first; cur; cur = cur->next) { - draw_text((TextParams){false, cur->text, cur->lower_left_corner, colhex(0xEEE6D2), text_scale}); + draw_text((TextParams){false, cur->text, cur->lower_left_corner, blendalpha(colhex(0xEEE6D2), dialog_alpha), text_scale}); } } } diff --git a/tuning.h b/tuning.h index 8f2fc19..c27669e 100644 --- a/tuning.h +++ b/tuning.h @@ -14,6 +14,7 @@ #define CAM_DISTANCE 15.0f #define CAM_VERTICAL_TO_HORIZONTAL_RATIO 0.95f +#define DIALOG_FADE_TIME 3.0f #define ARENA_SIZE (1024*1024*10) #define BIG_ARENA_SIZE (ARENA_SIZE * 8)