record and replay buying and info of shop items
This commit is contained in:
@@ -246,17 +246,19 @@ void handle_shop_event(location p, cFramerateLimiter& fps_limiter) {
|
||||
|
||||
if(p.in(active_rect)) {
|
||||
click_shop_rect(active_rect);
|
||||
handle_sale(active_shop.getItem(what_picked), what_picked);
|
||||
set_up_shop_array();
|
||||
draw_shop_graphics(false, {});
|
||||
handle_sale(what_picked);
|
||||
} else if(p.in(item_help_rect)){
|
||||
click_shop_rect(item_help_rect);
|
||||
handle_info_request(active_shop.getItem(what_picked));
|
||||
handle_info_request(what_picked);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void handle_sale(cShopItem item, int i) {
|
||||
void handle_sale(int i) {
|
||||
if(recording){
|
||||
record_action("handle_sale", boost::lexical_cast<std::string>(i));
|
||||
}
|
||||
cShopItem item = active_shop.getItem(i);
|
||||
cItem base_item = item.item;
|
||||
short cost = item.getCost(active_shop.getCostAdjust());
|
||||
rectangle dummy_rect = {0,0,0,0};
|
||||
@@ -418,10 +420,18 @@ void handle_sale(cShopItem item, int i) {
|
||||
print_buf();
|
||||
put_pc_screen();
|
||||
put_item_screen(stat_window);
|
||||
|
||||
// This looks to be redundant, but I'm just preserving the previous behavior of the code.
|
||||
set_up_shop_array();
|
||||
draw_shop_graphics(false, {});
|
||||
}
|
||||
|
||||
|
||||
void handle_info_request(cShopItem item) {
|
||||
void handle_info_request(int what_picked) {
|
||||
if(recording){
|
||||
record_action("handle_info_request", boost::lexical_cast<std::string>(what_picked));
|
||||
}
|
||||
cShopItem item = active_shop.getItem(what_picked);
|
||||
cItem base_item = item.item;
|
||||
|
||||
switch(item.type) {
|
||||
|
@@ -8,8 +8,8 @@
|
||||
void start_shop_mode(short which,short cost_adj,std::string store_name);
|
||||
void end_shop_mode();
|
||||
void handle_shop_event(location p, cFramerateLimiter& fps_limiter);
|
||||
void handle_sale(cShopItem item, int i);
|
||||
void handle_info_request(cShopItem item);
|
||||
void handle_sale(int i);
|
||||
void handle_info_request(int what_picked);
|
||||
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();
|
||||
|
@@ -539,6 +539,9 @@ static void replay_next_action() {
|
||||
word_rect_t word_rect = word_rect_from_action(next_action);
|
||||
click_talk_rect(word_rect);
|
||||
handle_talk_node(word_rect.node);
|
||||
}else if(t == "click_shop_rect"){
|
||||
rectangle rect = boost::lexical_cast<rectangle>(next_action.GetText());
|
||||
click_shop_rect(rect);
|
||||
}else if(t == "end_shop_mode"){
|
||||
end_shop_mode();
|
||||
}else if(t == "scrollbar_setPosition"){
|
||||
@@ -554,6 +557,10 @@ static void replay_next_action() {
|
||||
show_item_info(boost::lexical_cast<short>(next_action.GetText()));
|
||||
}else if(t == "set_stat_window"){
|
||||
set_stat_window(static_cast<eItemWinMode>(boost::lexical_cast<int>(next_action.GetText())));
|
||||
}else if(t == "handle_sale"){
|
||||
handle_sale(boost::lexical_cast<int>(next_action.GetText()));
|
||||
}else if(t == "handle_info_request"){
|
||||
handle_info_request(boost::lexical_cast<int>(next_action.GetText()));
|
||||
}else{
|
||||
std::ostringstream sstr;
|
||||
sstr << "Couldn't replay action: " << next_action;
|
||||
|
@@ -32,6 +32,7 @@
|
||||
#include "tools/prefs.hpp"
|
||||
#include "tools/enum_map.hpp"
|
||||
#include "replay.hpp"
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
short monsters_faces[190] = {
|
||||
0,1,2,3,4,5,6,7,8,9,
|
||||
@@ -600,6 +601,9 @@ void do_explosion_anim(short /*sound_num*/,short special_draw, short snd) {
|
||||
}
|
||||
|
||||
void click_shop_rect(rectangle area_rect) {
|
||||
if(recording){
|
||||
record_action("click_shop_rect", boost::lexical_cast<std::string>(area_rect));
|
||||
}
|
||||
|
||||
draw_shop_graphics(1,area_rect);
|
||||
mainPtr.display();
|
||||
|
Reference in New Issue
Block a user