record and replay dialog choices

This commit is contained in:
2024-08-30 00:08:49 -05:00
committed by Celtic Minstrel
parent 7791380a9a
commit 7a5c865779
7 changed files with 78 additions and 25 deletions

View File

@@ -710,37 +710,16 @@ static void show_job_bank(int which_bank, std::string title) {
job_dlg.run();
}
void handle_talk_event(location p, cFramerateLimiter& fps_limiter) {
void handle_talk_node(int which_talk_entry) {
if(which_talk_entry == TALK_DUNNO)
return;
short get_pc,s1 = -1,s2 = -1;
char asked[4];
short a,b,c,d;
eTalkNode ttype;
if(p.in(talk_help_rect)) {
if(!help_btn->handleClick(p, fps_limiter))
return;
give_help_and_record(205,6);
return;
}
p.x -= 5;
p.y -= 5;
int which_talk_entry = TALK_DUNNO;
for(word_rect_t& word : talk_words) {
if(word.node == -1) continue;
rectangle wordRect(word.rect);
wordRect.offset(talk_area_rect.topLeft());
wordRect.offset(-1, -10); // TODO: This corrects for the byzantine offsets that win_draw_string applies for some reason...
if(!p.in(wordRect)) continue;
click_talk_rect(word);
which_talk_entry = word.node;
break;
}
if(which_talk_entry == TALK_DUNNO)
return;
switch(which_talk_entry) {
case TALK_DUNNO:
SPECIAL_DUNNO:
@@ -1101,6 +1080,31 @@ void handle_talk_event(location p, cFramerateLimiter& fps_limiter) {
place_talk_str(save_talk_str1,save_talk_str2,0,dummy_rect);
}
void handle_talk_event(location p, cFramerateLimiter& fps_limiter) {
if(p.in(talk_help_rect)) {
if(!help_btn->handleClick(p, fps_limiter))
return;
give_help_and_record(205,6);
return;
}
p.x -= 5;
p.y -= 5;
int which_talk_entry = TALK_DUNNO;
for(word_rect_t& word : talk_words) {
if(word.node == -1) continue;
rectangle wordRect(word.rect);
wordRect.offset(talk_area_rect.topLeft());
wordRect.offset(-1, -10); // TODO: This corrects for the byzantine offsets that win_draw_string applies for some reason...
if(!p.in(wordRect)) continue;
click_talk_rect(word);
which_talk_entry = word.node;
break;
}
handle_talk_node(which_talk_entry);
}
//town_num; // Will be 0 - 200 for town, 200 - 290 for outdoors
//short sign_type; // terrain type
void do_sign(short town_num, short which_sign, short sign_type) {

View File

@@ -13,6 +13,7 @@ void handle_info_request(cShopItem item);
void set_up_shop_array();
void start_talk_mode(short m_num,short personality,mon_num_t monst_type,short store_face_pic);
void end_talk_mode();
void handle_talk_node(int which_talk_entry);
void handle_talk_event(location p, cFramerateLimiter& fps_limiter);
void handle_talk_spec(short ttype,char* place_string1,char* place_string2);
void store_responses();

View File

@@ -533,6 +533,10 @@ static void replay_next_action() {
handle_begin_talk(need_reprint);
}else if(t == "handle_talk"){
handle_talk(location_from_action(next_action), did_something, need_redraw, need_reprint);
}else if(t == "click_talk_rect"){
word_rect_t word_rect = word_rect_from_action(next_action);
click_talk_rect(word_rect);
handle_talk_node(word_rect.node);
}
// TODO some of these actions shouldn't call advance_time(). They should return

View File

@@ -31,6 +31,7 @@
#include "fileio/resmgr/res_image.hpp"
#include "tools/prefs.hpp"
#include "tools/enum_map.hpp"
#include "replay.hpp"
short monsters_faces[190] = {
0,1,2,3,4,5,6,7,8,9,
@@ -824,6 +825,10 @@ static void place_talk_face() {
}
void click_talk_rect(word_rect_t word) {
if(recording){
record_click_talk_rect(word, word.on == PRESET_WORD_ON);
}
rectangle talkRect(talk_gworld), wordRect(word.rect);
mainPtr.setActive();
rect_draw_some_item(talk_gworld.getTexture(),talkRect,mainPtr,talk_area_rect);

View File

@@ -5,6 +5,9 @@
#include "scenario/item.hpp"
#include "gfx/gfxsheets.hpp"
#ifndef BOE_NEWGRAPH_H
#define BOE_NEWGRAPH_H
struct word_rect_t {
std::string word;
rectangle rect;
@@ -64,3 +67,5 @@ void place_talk_str(std::string str_to_place,std::string str_to_place2,short col
short scan_for_response(const char *str);
void refresh_talking();
graf_pos calc_item_rect(int num,rectangle& to_rect);
#endif /* defined(BOE_NEWGRAPH_H) */