Constant line height, more training, todo

main
Cameron Murphy Reikes 2 years ago
parent 1f7b0efd6e
commit 45a3db587d

@ -30,12 +30,23 @@
"class":"",
"height":31.604938271605,
"id":1,
"name":"PLAYER",
"name":"MERCHANT",
"rotation":0,
"visible":true,
"width":29.9415204678363,
"x":97,
"y":96
"x":167,
"y":81.5
},
{
"class":"",
"height":31.6049,
"id":2,
"name":"PLAYER",
"rotation":0,
"visible":true,
"width":29.9415,
"x":68.02925,
"y":88.19755
}],
"opacity":1,
"type":"objectgroup",
@ -63,7 +74,7 @@
"y":0
}],
"nextlayerid":4,
"nextobjectid":2,
"nextobjectid":3,
"orientation":"orthogonal",
"renderorder":"right-down",
"tiledversion":"1.9.2",

@ -223,6 +223,8 @@ Entity *player = NULL; // up here, used in text backend callback
void make_space_and_append(Dialog *d, Sentence *s)
{
if(d->cur_index >= ARRLEN(d->data))
{
for(int remove_i = 0; remove_i < 2; remove_i++)
{
assert(ARRLEN(d->data) >= 1);
for(int i = 0; i < ARRLEN(d->data) - 1; i++)
@ -231,6 +233,7 @@ void make_space_and_append(Dialog *d, Sentence *s)
}
d->cur_index--;
}
}
BUFF_APPEND(d, *s);
}
@ -294,8 +297,6 @@ void request_do_damage(Entity *to, Vec2 from_point, float damage)
#include "prompts.gen.h"
// just straight up gpt generation function, calls to golang backend
char *get_ai_response(char* prompt);
void begin_text_input(); // called when player engages in dialog, must say something and fill text_input_buffer
// a callback, when 'text backend' has finished making text
void end_text_input(char *what_player_said)
@ -398,7 +399,7 @@ void end_text_input(char *what_player_said)
player->talking_to->gen_request_id = req_id;
#endif
#ifdef DESKTOP
add_new_npc_sentence(player->talking_to, "ALright. *moves*");
add_new_npc_sentence(player->talking_to, "......");
#endif
}
}
@ -687,6 +688,7 @@ AnimatedSprite death_idle =
};
sg_image image_font = {0};
float font_line_advance = 0.0f;
const float font_size = 32.0;
stbtt_bakedchar cdata[96]; // ASCII 32..126 is 95 glyphs
@ -787,7 +789,18 @@ void init(void)
.size = (size_t)(512 * 512 * 4),
}
} );
stbtt_fontinfo font;
stbtt_InitFont(&font, fontBuffer, 0);
int ascent = 0;
int descent = 0;
int lineGap = 0;
float scale = stbtt_ScaleForPixelHeight(&font, font_size);
stbtt_GetFontVMetrics(&font, &ascent, &descent, &lineGap);
font_line_advance = (float)(ascent - descent + lineGap) * scale * 0.75f;
free(font_bitmap_rgba);
free(fontBuffer);
}
state.bind.vertex_buffers[0] = sg_make_buffer(&(sg_buffer_desc)
@ -1578,7 +1591,8 @@ float draw_wrapped_text(bool dry_run, Vec2 at_point, float max_width, char *text
memcpy(line_to_draw, sentence_to_draw, chars_from_sentence);
memcpy(colors_to_draw, colors, chars_from_sentence*sizeof(Color));
float line_height = line_bounds.upper_left.Y - line_bounds.lower_right.Y;
//float line_height = line_bounds.upper_left.Y - line_bounds.lower_right.Y;
float line_height = font_line_advance * text_scale;
AABB drawn_bounds = draw_text((TextParams){true, dry_run, line_to_draw, AddV2(cursor, V2(0.0f, -line_height)), BLACK, text_scale, clip_to, colors_to_draw});
if(!dry_run) dbgrect(drawn_bounds);

@ -206,6 +206,27 @@ Death: "..."
Player: "move out of the way"
Death: "*moves*"
Player: "Can you help me fight?"
Death: ".....NO"
Player: "Why not?"
Death: ".....MOVE"
Player: "Move what"
Death: "...FORWARD"
Player: "Can I move?"
Death: "...ASIDE"
Player: "Yes"
Death: ".......ALLOW"
Player: "Allow what"
Death: "..."
Player: "hat"
Death: ".....ADVICE"
Player: "What advice"
Death: "...MOVE...FORWARD"
Player: "Move aside"
Death: "...FORWARD"
Player: "Move out of the way"
Death: "*moves*"
Player: "Get me off"
Death: "......NO"
Player: "No"

@ -1,10 +1,13 @@
DONE - make npcs resiliant to player asking for stuff
- ask death to come help you fight, new action
- Animate text characters coming in
- Space and e for attack and roll, tooltip
- Get rid of enters in javascript input box
- Get rid of enters and stars in javascript input box
DONE - Constant height for lines of text in dialog
- Sword improvements, deflect bullets, player knockback
- Escape exits typing
- Save every request and response
- Sound
- Don't flip player direction when you walk vertically
- Perfect dodge roll just after you roll, sound effect
and particles. Lets you keep momentum. Each dodge roll

Loading…
Cancel
Save