mirror of https://github.com/bgiraudr/Adoranda.git
Characters can have longer dialog separate by ;
This commit is contained in:
parent
788e5cfd1a
commit
0f16d9545e
|
@ -27,6 +27,7 @@ set(SOURCES
|
|||
src/character.c
|
||||
src/player.c
|
||||
src/map.c
|
||||
src/util.c
|
||||
)
|
||||
|
||||
set(ASSETS_cg
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
37
|
||||
32
|
||||
Tituya
|
||||
J'ai toujours aimé ce pont
|
||||
J'ai toujours aimé ce pont;Pas toi ?
|
||||
|
|
|
@ -54,8 +54,7 @@ def convert_map(input, output, params, target):
|
|||
pass
|
||||
|
||||
#Extract from the json the width, height and layers of the map
|
||||
w = data["layers"][0]["width"]
|
||||
h = data["layers"][0]["height"]
|
||||
w, h = data["width"], data["height"]
|
||||
nblayer = len(data["layers"])
|
||||
|
||||
o = fxconv.ObjectData()
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
#pragma once
|
||||
|
||||
void wait_for_input(int input);
|
|
@ -4,6 +4,7 @@
|
|||
#include "character.h"
|
||||
#include "engine.h"
|
||||
#include "map.h"
|
||||
#include "util.h"
|
||||
|
||||
struct Character character_default = {
|
||||
.x = 0,
|
||||
|
@ -14,19 +15,18 @@ struct Character character_default = {
|
|||
|
||||
/*draw the dialog of a specified character*/
|
||||
void draw_dialog(struct Character *character) {
|
||||
drect(20,10,370,80,C_WHITE);
|
||||
dprint(25,20, C_BLACK, "(%d,%d)", character->x, character->y);
|
||||
dprint(25,40, C_BLACK, "%s", character->name);
|
||||
dprint(25,60, C_BLACK, "%s", character->dialog);
|
||||
dupdate();
|
||||
int buffer = 1;
|
||||
while(1) {
|
||||
clearevents();
|
||||
if(keydown(KEY_SHIFT)) {
|
||||
if(buffer) buffer = 0;
|
||||
else break;
|
||||
}
|
||||
while(keydown(KEY_SHIFT)) clearevents();
|
||||
const char *delim = ";";
|
||||
|
||||
char *str = strdup(character->dialog);
|
||||
char *curr_line = strtok(str, delim);
|
||||
|
||||
while(curr_line != NULL) {
|
||||
drect(20,10,370,80,C_WHITE);
|
||||
dprint(25,20, C_BLACK, "%s", character->name);
|
||||
dprint(25,40, C_BLACK, "%s", curr_line);
|
||||
dupdate();
|
||||
curr_line = strtok(NULL, delim);
|
||||
wait_for_input(KEY_SHIFT);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
#include <gint/keyboard.h>
|
||||
#include "util.h"
|
||||
|
||||
void wait_for_input(int input) {
|
||||
int buffer = 1;
|
||||
while(1) {
|
||||
clearevents();
|
||||
if(keydown(input)) {
|
||||
if(buffer) buffer = 0;
|
||||
else break;
|
||||
}
|
||||
while(keydown(input)) clearevents();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue