mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 05:52:59 +00:00 
			
		
		
		
	dice values are now editable in Shift+G
This commit is contained in:
		| @@ -959,6 +959,8 @@ EX namespace dice { | |||||||
|   vector<die_structure*> die_list = {&d4, &d6, &d8, &d12, &d20}; |   vector<die_structure*> die_list = {&d4, &d6, &d8, &d12, &d20}; | ||||||
|      |      | ||||||
|   #if HDR |   #if HDR | ||||||
|  |   extern vector<struct die_structure*> die_list; | ||||||
|  |  | ||||||
|   struct die_data { |   struct die_data { | ||||||
|     struct die_structure *which; |     struct die_structure *which; | ||||||
|     int val; /* the current face value */ |     int val; /* the current face value */ | ||||||
| @@ -968,6 +970,10 @@ EX namespace dice { | |||||||
|     }; |     }; | ||||||
|   #endif |   #endif | ||||||
|    |    | ||||||
|  |   EX int shape_faces(die_structure *w) { return w->faces; } | ||||||
|  |    | ||||||
|  |   EX string die_name(die_structure *w) { return its(w->faces); } | ||||||
|  |  | ||||||
|   int die_data::happy() { |   int die_data::happy() { | ||||||
|     if(val == which->faces-1) return 1; |     if(val == which->faces-1) return 1; | ||||||
|     if(val == 0) return -1; |     if(val == 0) return -1; | ||||||
|   | |||||||
							
								
								
									
										32
									
								
								debug.cpp
									
									
									
									
									
								
							
							
						
						
									
										32
									
								
								debug.cpp
									
									
									
									
									
								
							| @@ -403,6 +403,38 @@ struct debugScreen { | |||||||
|           dialog::use_hexeditor(); |           dialog::use_hexeditor(); | ||||||
|           }); |           }); | ||||||
|         } |         } | ||||||
|  |       if(dice::on(what)) { | ||||||
|  |         dialog::addSelItem(XLAT("die shape"), dice::die_name(dice::data[what].which), 'A'); | ||||||
|  |         dialog::add_action_push([what] { | ||||||
|  |           dialog::init("die shape"); | ||||||
|  |           char key = 'a'; | ||||||
|  |           for(auto shape: dice::die_list) { | ||||||
|  |             dialog::addItem(dice::die_name(shape), key++); | ||||||
|  |             dialog::add_action([what, shape] { | ||||||
|  |               dice::data[what].which = shape; | ||||||
|  |               dice::data[what].val = 0; | ||||||
|  |               popScreen(); | ||||||
|  |               }); | ||||||
|  |             } | ||||||
|  |           dialog::display(); | ||||||
|  |           }); | ||||||
|  |         dialog::addSelItem(XLAT("die face"), its(dice::data[what].val), 'B'); | ||||||
|  |         dialog::add_action([what] { | ||||||
|  |           auto& dd = dice::data[what]; | ||||||
|  |           int maxv = shape_faces(dd.which)-1; | ||||||
|  |           dialog::editNumber(dd.val, 0, maxv, 1, 0, XLAT("die face"), ""); | ||||||
|  |           dialog::bound_low(0); | ||||||
|  |           dialog::bound_up(maxv); | ||||||
|  |           }); | ||||||
|  |         dialog::addSelItem(XLAT("die direction"), its(dice::data[what].dir), 'C'); | ||||||
|  |         dialog::add_action([what] { | ||||||
|  |           auto& dd = dice::data[what]; | ||||||
|  |           dialog::editNumber(dd.dir, 0, what->type-1, 1, dd.dir, XLAT("die direction"), ""); | ||||||
|  |           dialog::bound_low(0); | ||||||
|  |           dialog::bound_up(what->type-1); | ||||||
|  |           }); | ||||||
|  |         dialog::addBoolItem_action(XLAT("die mirror status"), dice::data[what].mirrored, 'D'); | ||||||
|  |         } | ||||||
|       dialog::addBreak(50); |       dialog::addBreak(50); | ||||||
|        |        | ||||||
|       if(show_debug_data) { |       if(show_debug_data) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue