28 extern big_tr_type far t_d
;
29 extern short stat_window
,overall_mode
,dialog_answer
;
30 extern current_town_type far c_town
;
31 extern party_record_type far party
;
32 extern piles_of_stuff_dumping_type
*data_store
;
33 extern piles_of_stuff_dumping_type2
*data_store2
;
34 extern talking_record_type far talking
;
35 extern scenario_data_type far scenario
;
37 extern Boolean in_startup_mode
,play_sounds
,sys_7_avail
,give_intro_hint
;
40 extern short display_mode
,stat_screen_mode
,current_pc
;
41 extern long register_flag
;
42 extern long ed_flag
,ed_key
;
43 extern Boolean registered
,ed_reg
,save_maps
,give_delays
;
44 extern pc_record_type far adven
[6];
45 extern location center
;
46 extern HWND text_sbar
,item_sbar
,shop_sbar
;
47 extern Boolean modeless_exists
[18];
48 extern HWND modeless_dialogs
[18] ;
50 extern pascal Boolean
cd_event_filter();
51 extern Boolean dialog_not_toast
;
53 extern Boolean game_run_before
;
56 extern far PALETTEENTRY ape
[256];
57 extern HDC main_dc
,main_dc2
,main_dc3
;
58 extern Boolean cursor_shown
;
59 extern piles_of_stuff_dumping_type3
*data_store3
;
60 extern piles_of_stuff_dumping_type4
*data_store4
;
63 HBITMAP pcs_gworld
= NULL
;
65 short sign_mode
,person_graphic
,store_person_graphic
,store_sign_mode
;
66 long num_talk_entries
;
67 char null_string
[256] = "";
68 short store_tip_page_on
= 0;
71 word_rect_type far store_words
[50];
72 short store_pre_talk_mode
,store_personality
,store_personality_graphic
,shop_identify_cost
;
73 HBITMAP talk_gworld
= NULL
;
74 Boolean talk_end_forced
;
75 char far old_str1
[256];
76 char far old_str2
[256];
77 char far one_back1
[256];
78 char far one_back2
[256];
79 extern word_rect_type preset_words
[9];
80 RECT talk_area_rect
= {5,5,284,420}, word_place_rect
= {7,44,257,372},talk_help_rect
= {254,5,272,21};
82 char title_string
[50];
83 unsigned char store_monst_type
;
85 RECT dummy_rect
= {0,0,0,0};
86 hold_responses far store_resp
[83];
87 short strnum1
,strnum2
,oldstrnum1
,oldstrnum2
;
88 short store_talk_face_pic
,cur_town_talk_loaded
= -1;
92 // 1 - 499 ... regular items
95 // 700+ i - that healing
96 // 800 + - mage spells
97 // 900 + - priest spells
98 // n000 + i - magic store n item i
99 short far store_shop_items
[30];
100 short far store_shop_costs
[30];
101 // talk_area_rect and talk_help_rect used for this too
102 short store_shop_min
,store_shop_max
,store_pre_shop_mode
,store_cost_mult
;
103 char far store_store_name
[256];
104 // 0 - whole area, 1 - active area 2 - graphic 3 - item name
105 // 4 - item cost 5 - item extra str 6 - item help button
106 extern RECT shopping_rects
[8][7];
107 RECT bottom_help_rects
[4] = {{6,356,250,368},{6,374,270,386},{6,386,250,398},{6,398,250,410}};
108 RECT shop_name_str
= {6,44,200,56};
109 RECT shop_frame
= {10,62,269,352};
110 RECT shop_done_rect
= {212,388,275,411}; /**/
112 extern short store_shop_type
;
114 char far
*heal_types
[] = {"Heal Damage","Cure Poison","Cure Disease","Cure Paralysis",
115 "Uncurse Items","Cure Stoned Character","Raise Dead","Resurrection","Cure Dumbfounding"};
116 short heal_costs
[9] = {50,30,80,100,250,500,1000,3000,100};
117 long cost_mult
[7] = {5,7,10,13,16,20,25};
118 short cur_display_mode
;
120 short terrain_pic
[256];
122 scen_header_type scen_headers
[25];
124 short store_scen_page_on
,store_num_scen
;
138 void start_shop_mode(short shop_type
,short shop_min
,short shop_max
,short cost_adj
,char *store_name
)
142 if (shop_max
< shop_min
)
143 shop_max
= shop_min
; ////
144 store_cost_mult
= cost_adj
;
145 if (store_cost_mult
> 6)
147 store_shop_type
= shop_type
;
148 store_shop_min
= shop_min
;
149 store_shop_max
= shop_max
;
151 area_rect
= talk_area_rect
;
152 strcpy((char *) store_store_name
,store_name
);
154 OffsetRect(&area_rect
, -1 * area_rect
.left
,-1 * area_rect
.top
);
155 if (talk_gworld
== NULL
)
156 talk_gworld
= CreateCompatibleBitmap(main_dc
,area_rect
.right
,area_rect
.bottom
);
158 store_pre_shop_mode
= overall_mode
;
160 stat_screen_mode
= 1;
161 create_clip_region();
166 draw_shop_graphics(0,area_rect
);
168 put_item_screen(stat_window
,0);
174 RECT dummy_rect
= {0,0,0,0};
176 ShowScrollBar(shop_sbar
,SB_CTL
,FALSE
);
177 if (store_pre_shop_mode
== 20) {
178 sprintf((char *)old_str1
,"You conclude your business.");
179 sprintf((char *)old_str2
,"");
180 sprintf((char *)one_back1
,"You conclude your business.");
181 sprintf((char *)one_back2
,"");
183 strnum1
= strnum2
= oldstrnum1
= oldstrnum2
= 0;
184 place_talk_str((char *)old_str1
,"",0,dummy_rect
);
187 DisposeGWorld(talk_gworld
);
191 overall_mode
= store_pre_shop_mode
;
192 create_clip_region();
193 if (overall_mode
== 2)
195 if (overall_mode
== 1) {
196 center
= c_town
.p_loc
;
197 update_explored(center
);
199 stat_screen_mode
= 0;
200 put_item_screen(stat_window
,0);
205 void handle_shop_event(POINT p
,Boolean right_button
)
207 short i
,j
,get_pc
,store_what_picked
;
212 if (PtInRect(&talk_help_rect
,p
)) {
213 click_shop_rect(talk_help_rect
);
214 party
.help_received
[26] = 0;
218 if (PtInRect(&shop_done_rect
, p
)) {
219 click_shop_rect(shop_done_rect
);
224 for (i
= 0; i
< 8; i
++) {
225 store_what_picked
= i
+ GetScrollPos(shop_sbar
,SB_CTL
);
226 if ((PtInRect(&shopping_rects
[i
][1],p
)) && (store_shop_items
[store_what_picked
] >= 0)) {
227 click_shop_rect(shopping_rects
[i
][1]);
228 handle_sale(store_shop_items
[store_what_picked
],store_shop_costs
[store_what_picked
]);
230 if ((PtInRect(&shopping_rects
[i
][6],p
)) && (store_shop_items
[store_what_picked
] >= 0)
231 && (store_shop_type
!= 3) && (store_shop_type
!= 4)){
232 click_shop_rect(shopping_rects
[i
][6]);
233 handle_info_request(store_shop_items
[store_what_picked
]);
238 void handle_sale(short what_chosen
,short cost
)
240 item_record_type base_item
;
241 short what_magic_shop
,what_magic_shop_item
,i
,j
;
242 RECT dummy_rect
= {0,0,0,0};
244 switch (what_chosen
/ 100) {
245 case 0: case 1: case 2: case 3: case 4:
246 base_item
= get_stored_item(what_chosen
);
247 base_item
.item_properties
= base_item
.item_properties
| 1;
248 //cost = (base_item.charges == 0) ? base_item.value : base_item.value * base_item.charges;
249 switch (pc_ok_to_buy(current_pc
,cost
,base_item
)) {
250 case 1: play_sound(-38); give_to_pc(current_pc
,base_item
,TRUE
); break;
251 case 2: ASB("Can't carry any more items."); break;
252 case 3: ASB("Not enough cash."); break;
253 case 4: ASB("Item is too heavy."); break;
254 case 5: ASB("You own too many of this."); break;
258 base_item
= store_alchemy(what_chosen
- 500);
259 if (party
.alchemy
[base_item
.item_level
] == TRUE
)
260 ASB("You already know that recipe.");
261 else if (take_gold(cost
,FALSE
) == FALSE
)
262 ASB("Not enough gold.");
265 ASB("You buy an alchemical recipe.");
266 party
.alchemy
[base_item
.item_level
] = TRUE
;
271 if (take_gold(cost
,FALSE
) == FALSE
)
272 ASB("Not enough gold.");
274 ASB("You pay the healer.");
276 switch (what_chosen
) {
278 adven
[current_pc
].cur_health
= adven
[current_pc
].max_health
;
281 adven
[current_pc
].status
[2] = 0;
284 adven
[current_pc
].status
[7] = 0; break;
286 adven
[current_pc
].status
[12] = 0; break;
288 for (i
= 0; i
< 24; i
++)
289 if ((adven
[current_pc
].equip
[i
] == TRUE
) &&
290 (is_cursed(adven
[current_pc
].items
[i
])))
291 adven
[current_pc
].items
[i
].item_properties
=
292 adven
[current_pc
].items
[i
].item_properties
& 239;
294 case 5: case 6: case 7:
295 adven
[current_pc
].main_status
= 1; break;
297 adven
[current_pc
].status
[9] = 0; break;
302 base_item
= store_mage_spells(what_chosen
- 800 - 30);
303 if ((base_item
.item_level
< 0) || (base_item
.item_level
> 61)) {
304 SysBeep(50); ASB("Error 102: Report this!"); break;}
305 if (adven
[current_pc
].mage_spells
[base_item
.item_level
] == TRUE
)
306 ASB("You already have this spell.");
307 else if (take_gold(cost
,FALSE
) == FALSE
)
308 ASB("Not enough gold.");
311 ASB("You buy a spell.");
312 adven
[current_pc
].mage_spells
[base_item
.item_level
] = TRUE
;
317 base_item
= store_priest_spells(what_chosen
- 900 - 30);
318 if ((base_item
.item_level
< 0) || (base_item
.item_level
> 61)) {
319 SysBeep(50); ASB("Error 101: Report this!"); break;}
320 if (adven
[current_pc
].priest_spells
[base_item
.item_level
] == TRUE
)
321 ASB("You already have this spell.");
322 else if (take_gold(cost
,FALSE
) == FALSE
)
323 ASB("Not enough gold.");
326 ASB("You buy a spell.");
327 adven
[current_pc
].priest_spells
[base_item
.item_level
] = TRUE
;
332 what_magic_shop
= (what_chosen
/ 1000) - 1;
333 what_magic_shop_item
= what_chosen
% 1000;
334 base_item
= party
.magic_store_items
[what_magic_shop
][what_magic_shop_item
];
335 base_item
.item_properties
= base_item
.item_properties
| 1;
336 switch (pc_ok_to_buy(current_pc
,cost
,base_item
)) {
337 case 1: play_sound(-38); give_to_pc(current_pc
,base_item
,TRUE
);
338 party
.magic_store_items
[what_magic_shop
][what_magic_shop_item
].variety
= 0;
340 case 2: ASB("Can't carry any more items."); break;
341 case 3: ASB("Not enough cash."); break;
342 case 4: ASB("Item is too heavy."); break;
348 if (overall_mode
!= 21) {
350 ASB("Shop error 1. Report This!");
352 draw_shop_graphics(0,dummy_rect
);
355 put_item_screen(stat_window
,0);
359 void handle_info_request(short what_chosen
)
361 item_record_type base_item
;
362 short what_magic_shop
,what_magic_shop_item
;
364 switch (what_chosen
/ 100) {
365 case 0: case 1: case 2: case 3: case 4:
366 base_item
= get_stored_item(what_chosen
);
367 base_item
.item_properties
= base_item
.item_properties
| 1;
368 display_pc_item(6,0, base_item
,0);
374 base_item
= store_mage_spells(what_chosen
- 800 - 30);
375 display_spells(0,base_item
.item_level
,0);
378 base_item
= store_priest_spells(what_chosen
- 900 - 30);
379 display_spells(1,base_item
.item_level
,0);
382 what_magic_shop
= (what_chosen
/ 1000) - 1;
383 what_magic_shop_item
= what_chosen
% 1000;
384 base_item
= party
.magic_store_items
[what_magic_shop
][what_magic_shop_item
];
385 base_item
.item_properties
= base_item
.item_properties
| 1;
386 display_pc_item(6,0, base_item
,0);
391 void set_up_shop_array()
393 short i
,shop_pos
= 0;
394 Boolean cursed_item
= FALSE
;
395 item_record_type store_i
;
398 for (i
= 0; i
< 30; i
++)
399 store_shop_items
[i
] = -1;
400 switch (store_shop_type
) {
401 case 0: case 1: case 2:
402 for (i
= store_shop_min
; i
< store_shop_max
+ 1; i
++) {
403 store_shop_items
[shop_pos
] = i
;
404 store_i
= get_stored_item(store_shop_items
[shop_pos
]);
405 store_shop_costs
[shop_pos
] = (store_i
.charges
== 0) ?
406 store_i
.value
: store_i
.value
* store_i
.charges
;
411 if (adven
[current_pc
].cur_health
< adven
[current_pc
].max_health
) {
412 store_shop_items
[shop_pos
] = 700;
413 store_shop_costs
[shop_pos
] = heal_costs
[0];
416 if (adven
[current_pc
].status
[2] > 0) {
417 store_shop_items
[shop_pos
] = 701;
418 store_shop_costs
[shop_pos
] = heal_costs
[1];
421 if (adven
[current_pc
].status
[7] > 0) {
422 store_shop_items
[shop_pos
] = 702;
423 store_shop_costs
[shop_pos
] = heal_costs
[2];
426 if (adven
[current_pc
].status
[12] > 0) {
427 store_shop_items
[shop_pos
] = 703;
428 store_shop_costs
[shop_pos
] = heal_costs
[3];
431 if (adven
[current_pc
].status
[9] > 0) {
432 store_shop_items
[shop_pos
] = 708;
433 store_shop_costs
[shop_pos
] = heal_costs
[8];
436 for (i
= 0; i
< 24; i
++)
437 if ((adven
[current_pc
].equip
[i
] == TRUE
) && (is_cursed(adven
[current_pc
].items
[i
]) == TRUE
))
440 store_shop_items
[shop_pos
] = 704;
441 store_shop_costs
[shop_pos
] = heal_costs
[4];
444 if (adven
[current_pc
].main_status
== 4) {
445 store_shop_items
[shop_pos
] = 705;
446 store_shop_costs
[shop_pos
] = heal_costs
[5];
449 if (adven
[current_pc
].main_status
== 2){
450 store_shop_items
[shop_pos
] = 706;
451 store_shop_costs
[shop_pos
] = heal_costs
[6];
454 if (adven
[current_pc
].main_status
== 3){
455 store_shop_items
[shop_pos
] = 707;
456 store_shop_costs
[shop_pos
] = heal_costs
[7];
461 //for (i = store_shop_min; i < store_shop_max + 1; i++) {
462 // store_shop_items[shop_pos] = 600 + i;
463 // store_shop_costs[shop_pos] = food_types[i].value;
467 case 5: case 6: case 7: case 8: case 9:
468 for (i
= 0; i
< 10; i
++)
469 if (party
.magic_store_items
[store_shop_type
- 5][i
].variety
!= 0) {
470 store_shop_items
[shop_pos
] = (store_shop_type
- 4) * 1000 + i
;
471 store_i
= party
.magic_store_items
[store_shop_type
- 5][i
];
472 store_shop_costs
[shop_pos
] = (store_i
.charges
== 0) ?
473 store_i
.value
: store_i
.value
* store_i
.charges
;
478 for (i
= store_shop_min
; i
< store_shop_max
+ 1; i
++)
479 if (i
== minmax(0,31,i
)) {
480 store_i
= store_mage_spells(i
);
481 store_shop_costs
[shop_pos
] = store_i
.value
;
482 store_shop_items
[shop_pos
] = 800 + i
+ 30;
487 for (i
= store_shop_min
; i
< store_shop_max
+ 1; i
++)
488 if (i
== minmax(0,31,i
)) {
489 store_i
= store_priest_spells(i
);
490 store_shop_costs
[shop_pos
] = store_i
.value
;
491 store_shop_items
[shop_pos
] = 900 + i
+ 30;
496 for (i
= store_shop_min
; i
< store_shop_max
+ 1; i
++)
497 if (i
== minmax(0,19,i
)) {
498 store_i
= store_alchemy(i
);
499 store_shop_costs
[shop_pos
] = store_i
.value
;
500 store_shop_items
[shop_pos
] = 500 + i
;
505 for (i
= 0; i
< 30; i
++)
506 if (store_shop_items
[i
] >= 0) {
507 store_l
= store_shop_costs
[i
];
508 store_l
= (store_l
* cost_mult
[store_cost_mult
]) / 10;
509 store_shop_costs
[i
] = (short) store_l
;
511 i
= max(0,shop_pos
- 8);
512 SetScrollRange(shop_sbar
,SB_CTL
,0,i
,TRUE
);
516 void start_talk_mode(short m_num
,short personality
,unsigned char monst_type
,short store_face_pic
)////
519 char place_string1
[256] = "";
520 char place_string2
[256] = "";
523 store_personality
= personality
;
525 store_monst_type
= monst_type
;
527 store_talk_face_pic
= store_face_pic
; ////
528 area_rect
= talk_area_rect
;
529 OffsetRect(&area_rect
, -1 * area_rect
.left
,-1 * area_rect
.top
);
530 talk_gworld
= CreateCompatibleBitmap(main_dc
,area_rect
.right
,area_rect
.bottom
);
532 // first make sure relevant talk strs are loaded in
533 if (personality
/ 10 != cur_town_talk_loaded
)
534 load_town(personality
/ 10,1,0,NULL
);
536 // load all possible responses
539 // Dredge up critter's name
540 sprintf((char *) title_string
,"%s:",data_store3
->talk_strs
[personality
% 10]);
542 store_pre_talk_mode
= overall_mode
;
544 create_clip_region();
545 talk_end_forced
= FALSE
;
546 stat_screen_mode
= 1;
548 // Bring up and place first strings.
549 sprintf((char *) place_string1
,"%s",data_store3
->talk_strs
[personality
% 10 + 10]);
550 strnum1
= personality
% 10 + 10;
552 strcpy((char *) old_str1
,(char *) place_string1
);
553 strcpy((char *) old_str2
,(char *) place_string2
);
554 strcpy((char *) one_back1
,(char *) place_string1
);
555 strcpy((char *) one_back2
,(char *) place_string2
);
556 place_talk_str((char *) place_string1
,(char *) place_string2
,0,dummy_rect
);
558 put_item_screen(stat_window
,0);
565 DisposeGWorld(talk_gworld
);
568 overall_mode
= store_pre_talk_mode
;
569 create_clip_region();
570 if (overall_mode
== 2)
572 if (overall_mode
== 1) {
573 center
= c_town
.p_loc
;
574 update_explored(center
);
576 stat_screen_mode
= 0;
577 put_item_screen(stat_window
,0);
583 void handle_talk_event(POINT p
,Boolean right_button
)
585 short i
,j
,force_special
= 0,get_pc
,s1
= -1,s2
= -1,s3
= -1;
587 char place_string1
[256] = "";
588 char place_string2
[256] = "";
590 short a
,b
,c
,d
,per1
,per2
,ttype
,which_talk_entry
= -1;
591 char stra
[10],strb
[10];
593 long per1l
,ttypel
,al
,bl
,cl
,dl
,per2l
;
598 if (PtInRect(&talk_help_rect
,p
)) {
599 party
.help_received
[5] = 0;
604 for (i
= 0; i
< 9; i
++)
605 if ((PtInRect(&preset_words
[i
].word_rect
,p
)) && ((talk_end_forced
== FALSE
) || (i
== 6) || (i
== 5))) {
606 click_talk_rect((char *) old_str1
,(char *) old_str2
,preset_words
[i
].word_rect
);
608 case 0: case 1: case 2: case 7: case 8:
609 force_special
= i
+ 1;
612 force_special
= i
+ 1;
614 //asked[0] = 'p';asked[1] = 'u';asked[2] = 'r';asked[3] = 'c';
621 for (j
= 0; j
< 120; j
++)
622 if ((party
.talk_save
[j
].personality
== store_personality
) &&
623 (party
.talk_save
[j
].str1
== strnum1
) &&
624 (party
.talk_save
[j
].str2
== strnum2
)) {
625 ASB("This is already saved.");
629 for (j
= 0; j
< 120; j
++)
630 if (party
.talk_save
[j
].personality
<= 0) {
633 party
.talk_save
[j
].personality
= store_personality
;
634 party
.talk_save
[j
].town_num
= (unsigned char) c_town
.town_num
;
635 party
.talk_save
[j
].str1
= strnum1
;
636 party
.talk_save
[j
].str2
= strnum2
;
637 ASB("Noted in journal.");
642 ASB("No more room in talking journal.");
652 for (j
= 0; j
< 4; j
++)
653 asked
[j
] = preset_words
[i
].word
[j
];
659 for (i
= 0; i
< 50; i
++)
660 if ((PtInRect(&store_words
[i
].word_rect
,p
)) && (talk_end_forced
== FALSE
)) {
661 click_talk_rect((char *) old_str1
,(char *) old_str2
,store_words
[i
].word_rect
);
662 for (j
= 0; j
< 4; j
++)
663 asked
[j
] = store_words
[i
].word
[j
];
668 if (i
== 50) // no event
670 if (force_special
== 9) {
671 get_text_response(1017,place_string1
,0);
672 asked
[0] = place_string1
[0];
673 asked
[1] = place_string1
[1];
674 asked
[2] = place_string1
[2];
675 asked
[3] = place_string1
[3];
678 if ((asked
[0] == 'n') && (asked
[1] == 'a') &&(asked
[2] == 'm') &&(asked
[3] == 'a')) {
681 if ((asked
[0] == 'l') && (asked
[1] == 'o') &&(asked
[2] == 'o') &&(asked
[3] == 'k')) {
684 if (((asked
[0] == 'j') && (asked
[1] == 'o') &&(asked
[2] == 'b')) ||
685 ((asked
[0] == 'w') && (asked
[1] == 'o') &&(asked
[2] == 'r')&&(asked
[3] == 'k')) ) {
689 if (force_special
> 0) {
690 switch (force_special
) {
691 case 1: case 2: case 3:
692 get_str(place_string1
,120 + ((store_personality
- 1) / 10),
693 ((store_personality
- 1) % 10) * 3 + 10 + force_special
);
694 sprintf((char *) place_string1
,"%s",data_store3
->talk_strs
[store_personality
% 10 + 10 * force_special
]);
696 oldstrnum1
= strnum1
; oldstrnum2
= strnum2
;
697 strnum1
= store_personality
% 10 + 10 * force_special
;
699 strcpy((char *) one_back1
,(char *) old_str1
);
700 strcpy((char *) one_back2
,(char *) old_str2
);
701 strcpy((char *) old_str1
,(char *) place_string1
);
702 strcpy((char *) old_str2
,(char *) place_string2
);
703 place_talk_str((char *) place_string1
,(char *) place_string2
,0,dummy_rect
);
706 case 4: // buy button
707 asked
[0] = 'p';asked
[1] = 'u';asked
[2] = 'r';asked
[3] = 'c';
708 if (scan_for_response(asked
) >= 0)
710 asked
[0] = 's';asked
[1] = 'a';asked
[2] = 'l';asked
[3] = 'e';
711 if (scan_for_response(asked
) >= 0)
713 asked
[0] = 'h';asked
[1] = 'e';asked
[2] = 'a';asked
[3] = 'l';
714 if (scan_for_response(asked
) >= 0)
716 asked
[0] = 'i';asked
[1] = 'd';asked
[2] = 'e';asked
[3] = 'n';
717 if (scan_for_response(asked
) >= 0)
719 asked
[0] = 't';asked
[1] = 'r';asked
[2] = 'a';asked
[3] = 'i';
720 if (scan_for_response(asked
) >= 0)
723 case 5: // sell button
724 asked
[0] = 's';asked
[1] = 'e';asked
[2] = 'l';asked
[3] = 'l';
725 if (scan_for_response(asked
) >= 0)
729 strnum1
= oldstrnum1
; strnum2
= oldstrnum2
;
730 strcpy((char *) place_string1
,(char *) one_back1
);
731 strcpy((char *) place_string2
,(char *) one_back2
);
732 strcpy((char *) one_back1
,(char *) old_str1
);
733 strcpy((char *) one_back2
,(char *) old_str2
);
734 strcpy((char *) old_str1
,(char *) place_string1
);
735 strcpy((char *) old_str2
,(char *) place_string2
);
736 place_talk_str((char *) place_string1
,(char *) place_string2
,0,dummy_rect
);
742 which_talk_entry
= scan_for_response(asked
);
743 if ((which_talk_entry
< 0) || (which_talk_entry
> 59)) {
744 strcpy((char *) one_back1
,(char *) old_str1
);
745 strcpy((char *) one_back2
,(char *) old_str2
);
746 sprintf((char *) old_str2
,"");
747 sprintf((char *) old_str1
,"%s",data_store3
->talk_strs
[store_personality
% 10 + 160]);
748 if (strlen((char *) old_str1
) < 2)
749 sprintf((char *) old_str1
,"You get no response.");
750 place_talk_str((char *) old_str1
,(char *) old_str2
,0,dummy_rect
);
755 ttype
= talking
.talk_nodes
[which_talk_entry
].type
;
756 a
= talking
.talk_nodes
[which_talk_entry
].extras
[0];
757 b
= talking
.talk_nodes
[which_talk_entry
].extras
[1];
758 c
= talking
.talk_nodes
[which_talk_entry
].extras
[2];
759 d
= talking
.talk_nodes
[which_talk_entry
].extras
[3];
761 sprintf((char *) place_string1
,"%s",data_store3
->talk_strs
[40 + which_talk_entry
* 2]);
762 sprintf((char *) place_string2
,"%s",data_store3
->talk_strs
[40 + which_talk_entry
* 2 + 1]);
764 oldstrnum1
= strnum1
; oldstrnum2
= strnum2
;
765 strnum1
= 40 + which_talk_entry
* 2; strnum2
= 40 + which_talk_entry
* 2 + 1;
773 strcpy((char *) place_string1
,(char *) place_string2
);
775 sprintf((char *) place_string2
,"");
782 if (party
.gold
< a
) {
784 strcpy((char *) place_string1
,(char *) place_string2
);
787 talk_end_forced
= TRUE
;
791 restore_sp_party(25 * b
);
795 center
= c_town
.p_loc
;
798 sprintf((char *) place_string2
,"");
801 if (day_reached((unsigned char) a
,0) == TRUE
) {
803 strcpy((char *) place_string1
,(char *) place_string2
);
805 sprintf((char *) place_string2
,"");
809 if (day_reached((unsigned char) a
,(unsigned char) b
) == TRUE
) {
811 strcpy((char *) place_string1
,(char *) place_string2
);
813 sprintf((char *) place_string2
,"");
817 if (c_town
.town_num
!= a
) {
819 strcpy((char *) place_string1
,(char *) place_string2
);
821 sprintf((char *) place_string2
,"");
827 b
+ c
- 1,a
,(char *)place_string1
);
831 if ((get_pc
= char_select_pc(1,0,"Train who?")) < 6) {
833 spend_xp(get_pc
,1, 0);
835 sprintf((char *) place_string1
, "You conclude your training.");
838 case 9: case 10: case 11:
840 start_shop_mode(ttype
+ 1,b
,
841 b
+ c
- 1,a
,(char *)place_string1
);
845 start_shop_mode(3,c_town
.monst
.dudes
[store_m_num
].monst_start
.extra1
,
846 c_town
.monst
.dudes
[store_m_num
].monst_start
.extra2
,a
,(char *)place_string1
);
850 case 13: // sell weap
852 stat_screen_mode
= 3;
853 put_item_screen(stat_window
,1);
856 case 14: // sell armor
858 stat_screen_mode
= 4;
859 put_item_screen(stat_window
,1);
862 case 15: // sell misc
864 stat_screen_mode
= 5;
865 put_item_screen(stat_window
,1);
868 case 16: case 17: // ident enchant
870 stat_screen_mode
= (ttype
== 16) ? 2 : 6;
871 shop_identify_cost
= a
;
872 put_item_screen(stat_window
,1);
873 give_help(ttype
- 16 + 44,0,0);
876 if (party
.gold
< a
) {
878 strcpy((char *) place_string1
,(char *) place_string2
);
885 sprintf((char *) place_string2
,"");
889 if ((sd_legit(b
,c
) == TRUE
) && (PSD
[b
][c
] == d
)) {
890 sprintf((char *) place_string1
, "You've already learned that.");
893 else if (party
.gold
< a
) {
895 strcpy((char *) place_string1
,(char *) place_string2
);
900 if (sd_legit(b
,c
) == TRUE
)
902 else give_error("Invalid Stuff Done flag called in conversation.","",0);
905 sprintf((char *) place_string2
,"");
908 if (party
.gold
< a
) {
911 strcpy((char *) place_string1
,(char *) place_string2
);
912 sprintf((char *) place_string2
,"");
916 for (i
= b
; i
<= b
+ c
; i
++)
917 if ((i
>= 0) && (i
< 30) && (party
.boats
[i
].property
== TRUE
)) {
920 party
.boats
[i
].property
= FALSE
;
921 sprintf((char *) place_string2
,"");
928 sprintf((char *) place_string1
, "There are no boats left.");
929 sprintf((char *) place_string2
,"");
934 if (party
.gold
< a
) {
937 strcpy((char *) place_string1
,(char *) place_string2
);
938 sprintf((char *) place_string2
,"");
942 for (i
= b
; i
<= b
+ c
; i
++)
943 if ((i
>= 0) && (i
< 30) && (party
.horses
[i
].property
== TRUE
)) {
946 party
.horses
[i
].property
= FALSE
;
947 sprintf((char *) place_string2
,"");
954 sprintf((char *) place_string1
, "There are no horses left.");
955 sprintf((char *) place_string2
,"");
960 if (party
.spec_items
[a
] > 0) {
961 sprintf((char *) place_string1
, "You already have it.");
964 else if (party
.gold
< b
) {
965 strcpy((char *) place_string1
,(char *) place_string2
);
971 party
.spec_items
[a
] = 1;
974 sprintf((char *) place_string2
,"");
977 start_shop_mode(5 + b
,0,
978 9,a
,(char *)place_string1
);
982 if (party
.can_find_town
[b
] > 0) {
984 else if (party
.gold
< a
) {
986 strcpy((char *) place_string1
,(char *) place_string2
);
991 party
.can_find_town
[b
] = 1;
994 sprintf((char *) place_string2
,"");
997 talk_end_forced
= TRUE
;
1000 c_town
.monst
.dudes
[store_m_num
].attitude
= 1;
1001 c_town
.monst
.dudes
[store_m_num
].mobile
= 1;
1002 talk_end_forced
= TRUE
;
1005 make_town_hostile();
1006 talk_end_forced
= TRUE
;
1009 c_town
.monst
.dudes
[store_m_num
].active
= 0;
1010 // Special killing effects
1011 if (sd_legit(c_town
.monst
.dudes
[store_m_num
].monst_start
.spec1
,c_town
.monst
.dudes
[store_m_num
].monst_start
.spec2
) == TRUE
)
1012 party
.stuff_done
[c_town
.monst
.dudes
[store_m_num
].monst_start
.spec1
][c_town
.monst
.dudes
[store_m_num
].monst_start
.spec2
] = 1;
1013 talk_end_forced
= TRUE
;
1015 case 29: // town special
1016 run_special(7,2,a
,c_town
.p_loc
,&s1
,&s2
,&s3
);
1017 // check s1 & s2 to see if we got diff str, and, if so, munch old strs
1018 if ((s1
>= 0) || (s2
>= 0)) {
1021 sprintf((char *) place_string1
,"");
1022 sprintf((char *) place_string2
,"");
1024 get_strs((char *) place_string1
,(char *) place_string2
,2,s1
,s2
);
1027 if (s1
>= 0) strnum1
= 2000 + s1
;
1028 if (s2
>= 0) strnum2
= 2000 + s2
;
1030 put_item_screen(stat_window
,0);
1032 case 30: // scen special
1033 run_special(7,0,a
,c_town
.p_loc
,&s1
,&s2
,&s3
);
1034 // check s1 & s2 to see if we got diff str, and, if so, munch old strs
1035 if ((s1
>= 0) || (s2
>= 0)) {
1038 sprintf((char *) place_string1
,"");
1039 sprintf((char *) place_string2
,"");
1041 get_strs((char *) place_string1
,(char *) place_string2
,0,s1
,s2
);
1044 if (s1
>= 0) strnum1
= 3000 + s1
;
1045 if (s2
>= 0) strnum2
= 3000 + s2
;
1047 put_item_screen(stat_window
,0);
1054 strcpy((char *) one_back1
,(char *) old_str1
);
1055 strcpy((char *) one_back2
,(char *) old_str2
);
1056 strcpy((char *) old_str1
,(char *) place_string1
);
1057 strcpy((char *) old_str2
,(char *) place_string2
);
1058 place_talk_str((char *) old_str1
,(char *) old_str2
,0,dummy_rect
);
1062 void handle_talk_spec(short ttype
,char *place_string1
,char *place_string2
) ////
1064 short s1
= 1, s2
= 0,num_horns
= 0, num_items
= 0,i
,j
;
1065 item_record_type store_i
;
1067 strnum1
= 1000 + s1
;
1068 get_str(place_string1
,15,s1
);
1070 strnum2
= 1000 + s2
;
1071 get_str(place_string2
,15,s2
);
1079 void store_responses()
1084 void sign_event_filter (short item_hit
)
1086 dialog_not_toast
= FALSE
;
1089 void do_sign(short town_num
, short which_sign
, short sign_type
,location sign_loc
)
1090 //town_num; // Will be 0 - 200 for town, 200 - 290 for outdoors
1091 //short sign_type; // terrain type
1095 char sign_text
[256];
1098 view_loc
= (is_out()) ? party
.p_loc
: c_town
.p_loc
;
1099 make_cursor_sword();
1101 cd_create_dialog(1014,mainPtr
);
1103 store_sign_mode
= sign_type
;
1104 if (terrain_pic
[sign_type
] < 1000)
1105 csp(1014,3,terrain_pic
[sign_type
]);
1106 else csp(1014,3,94);
1108 if (town_num
>= 200) {
1110 load_outdoors(town_num
% scenario
.out_width
, town_num
/ scenario
.out_width
,party
.i_w_c
.x
,party
.i_w_c
.y
,
1111 1,which_sign
+ 100,(char *) sign_text
);
1114 sprintf((char *) sign_text
,"%s",data_store
->town_strs
[120 + which_sign
]);
1116 csit(1014,2,(char *) sign_text
);
1118 while (dialog_not_toast
)
1120 cd_kill_dialog(1014,0);
1125 void give_reg_info_event_filter (short item_hit
)
1128 char place_str
[256];
1132 dialog_not_toast
= FALSE
;
1137 void give_reg_info()
1142 char place_str
[256];
1145 make_cursor_sword();
1147 cd_create_dialog_parent_num(1073,0);
1149 while (dialog_not_toast
)
1150 ModalDialog(); cd_kill_dialog(1073,0);
1157 void do_registration_event_filter (short item_hit
)
1162 cd_get_text_edit_str(1075,(char *) get_text
);
1164 sscanf((char *) get_text
,"%d",&dialog_answer
);
1165 dialog_not_toast
= FALSE
;
1168 void do_registration()
1172 char sign_text
[256];
1175 make_cursor_sword();
1177 cd_create_dialog(1075,mainPtr
);
1179 cdsin(1075,7,(short) register_flag
);
1180 cd_set_edit_focus();
1182 while (dialog_not_toast
)
1184 cd_kill_dialog(1075,0);
1186 if (dialog_answer
== 1)
1189 if (dialog_answer
== (short) init_data(register_flag
)) {
1195 //check_pref_file();
1206 Boolean
prefs_event_filter (short item_hit
)
1208 Boolean done_yet
= FALSE
,did_cancel
= FALSE
;
1215 dialog_not_toast
= FALSE
;
1220 dialog_not_toast
= FALSE
;
1224 case 50: case 52: case 18: case 20: case 22: case 24: case 27: case 38: case 40: case 43: case 45:
1225 cd_set_led(1099,item_hit
,1 - cd_get_led(1099,item_hit
));
1229 cd_set_led(1099,29,1);
1232 case 32: case 34: case 36: case 47:
1233 cd_set_led(1099,32,(item_hit
== 32) ? 1 : 0);
1234 cd_set_led(1099,34,(item_hit
== 34) ? 1 : 0);
1235 cd_set_led(1099,36,(item_hit
== 36) ? 1 : 0);
1236 cd_set_led(1099,47,(item_hit
== 47) ? 1 : 0);
1241 cd_set_led(1099,4 + cur_display_mode
,0);
1242 cur_display_mode
= item_hit
- 4;
1243 cd_set_led(1099,4 + cur_display_mode
,1);
1246 if (done_yet
== TRUE
) {
1247 if (did_cancel
== FALSE
) {
1248 display_mode
= cur_display_mode
;
1249 party
.stuff_done
[306][0] = cd_get_led(1099,18);
1250 party
.stuff_done
[306][1] = cd_get_led(1099,20);
1251 play_sounds
= 1 - party
.stuff_done
[306][1];
1252 party
.stuff_done
[306][2] = cd_get_led(1099,22);
1253 party
.stuff_done
[306][3] = cd_get_led(1099,24);
1254 party
.stuff_done
[306][4] = cd_get_led(1099,27);
1255 party
.stuff_done
[306][7] = cd_get_led(1099,38);
1256 party
.stuff_done
[306][8] = cd_get_led(1099,40);
1257 party
.stuff_done
[306][9] = cd_get_led(1099,43);
1258 party
.stuff_done
[296][0] = cd_get_led(1099,45);
1259 party
.stuff_done
[305][6] = cd_get_led(1099,50);
1260 party
.stuff_done
[305][5] = cd_get_led(1099,52);
1261 if (cd_get_led(1099,32) == 1)
1263 if (cd_get_led(1099,34) == 1)
1265 if (cd_get_led(1099,36) == 1)
1267 if (cd_get_led(1099,47) == 1)
1269 if (cd_get_led(1099,29) == 1)
1270 for (i
= 0; i
< 120; i
++)
1271 party
.help_received
[i
] = 0;
1272 if (display_mode
< 5)
1273 max_window(mainPtr
);
1275 GetWindowRect(GetDesktopWindow(),&windRECT
);
1276 MoveWindow(mainPtr
,(windRECT
.right
- (588 + 10)) / 2,
1277 (windRECT
.bottom
- (425 + 52)) / 2 ,
1278 588 + 10,425 + 52,TRUE
);
1281 //play_sounds = 1 - party.stuff_done[306][1];
1282 save_maps
= 1 - party
.stuff_done
[306][0];
1283 give_delays
= party
.stuff_done
[306][2];
1290 void pick_preferences()
1294 cur_display_mode
= display_mode
;
1296 make_cursor_sword();
1298 cd_create_dialog(1099,mainPtr
);
1300 cd_set_led(1099,4 + cur_display_mode
,1);
1302 cd_set_led(1099,18,(party
.stuff_done
[306][0] != 0) ? 1 : 0);
1303 cd_set_led(1099,20,(play_sounds
== FALSE
) ? 1 : 0);
1304 cd_set_led(1099,22,(party
.stuff_done
[306][2] != 0) ? 1 : 0);
1305 cd_set_led(1099,24,(party
.stuff_done
[306][3] != 0) ? 1 : 0);
1306 cd_set_led(1099,27,(party
.stuff_done
[306][4] != 0) ? 1 : 0);
1307 cd_set_led(1099,38,(party
.stuff_done
[306][7] != 0) ? 1 : 0);
1308 cd_set_led(1099,40,(party
.stuff_done
[306][8] != 0) ? 1 : 0);
1309 cd_set_led(1099,43,(party
.stuff_done
[306][9] != 0) ? 1 : 0);
1310 cd_set_led(1099,45,(party
.stuff_done
[296][0] != 0) ? 1 : 0);
1311 cd_set_led(1099,50,(party
.stuff_done
[305][6] != 0) ? 1 : 0);
1312 cd_set_led(1099,52,(party
.stuff_done
[305][5] != 0) ? 1 : 0);
1313 cd_set_flag(1099,3,1);
1314 if (PSD
[306][6] == 3)
1315 cd_set_led(1099,47,1);
1316 else cd_set_led(1099,32 + PSD
[306][6] * 2,1);
1318 if (party
.help_received
[55] == 0) {
1319 cd_initial_draw(1099);
1320 give_help(55,0,1099);
1323 while (dialog_not_toast
)
1325 cd_kill_dialog(1099,0);
1326 adjust_window_mode();
1329 void put_party_stats()
1335 for (i
= 0; i
< 6; i
++) {
1336 if (adven
[i
].main_status
> 0) {
1337 cd_set_item_text(989,5 + 5 * i
,adven
[i
].name
);
1338 cd_activate_item(989,7 + 5 * i
,1);
1339 cd_activate_item(989,8 + 5 * i
,1);
1340 cd_set_flag(989,6 + 5 * i
,96);
1341 cd_activate_item(989,35 + i
,1);
1342 cd_activate_item(989,42 + i
,1);
1343 csp(989,42 + i
,800 + adven
[i
].which_graphic
);
1346 cd_set_item_text(989,5 + 5 * i
,"Empty.");
1347 cd_activate_item(989,7 + 5 * i
,0);
1348 cd_activate_item(989,8 + 5 * i
,0);
1349 cd_set_flag(989,6 + 5 * i
,98);
1350 cd_activate_item(989,35 + i
,0);
1351 cd_activate_item(989,42 + i
,0);
1357 void edit_party_event_filter (short item_hit
)
1359 short i
= 0,j
= 0,which_pc
;
1363 dialog_not_toast
= FALSE
;
1367 party
.help_received
[22] = 0;
1368 give_help(222,23,989);
1371 case 5: case 10: case 15: case 20: case 25: case 30:
1372 which_pc
= (item_hit
- 5) / 5;
1373 if (adven
[which_pc
].main_status
== 0) {
1374 //give_help(56,0,989);
1375 //create_pc(which_pc,989);
1376 //cd_initial_draw(989); // extra redraw, just in case
1378 else pick_pc_name(which_pc
,989);
1381 case 7: case 12: case 17: case 22: case 27: case 32:
1382 which_pc
= (item_hit
- 7) / 5;
1383 pick_race_abil(&adven
[which_pc
],0,989);
1386 case 8: case 13: case 18: case 23: case 28: case 33:
1387 which_pc
= (item_hit
- 8) / 5;
1388 spend_xp(which_pc
,0,989);
1391 case 35: case 36: case 37: case 38: case 39: case 40:
1392 which_pc
= item_hit
- 35;
1394 if (adven
[which_pc
].main_status
<= 0)
1396 if (adven
[which_pc
].main_status
!= 0)
1397 pick_pc_graphic(which_pc
,1,989);
1400 case 6: case 11: case 16: case 21: case 26: case 31:
1401 which_pc
= (item_hit
- 6) / 5;
1402 if (adven
[which_pc
].main_status
!= 0) {
1403 if (FCD(1053,989) == 2)
1404 adven
[which_pc
].main_status
= 0;
1408 give_help(56,0,989);
1409 create_pc(which_pc
,989);
1411 cd_initial_draw(989); // extra redraw, just in case
1414 // case 7: case 12: case 17: case 22: case 27: case 32:
1420 void edit_party(short can_create
,short can_cancel
)
1423 Boolean munch_pc_graphic
= FALSE
;
1425 make_cursor_sword();
1427 if (pcs_gworld
== NULL
) {
1428 munch_pc_graphic
= TRUE
;
1429 pcs_gworld
= load_pict(902,main_dc
);
1432 cd_create_dialog(989,mainPtr
);
1435 if (party
.help_received
[22] == 0) {
1436 cd_initial_draw(989);
1437 give_help(22,23,989);
1439 while (dialog_not_toast
)
1441 cd_kill_dialog(989,0);
1443 if (munch_pc_graphic
== TRUE
) {
1444 DisposeGWorld(pcs_gworld
);
1448 if (adven
[current_pc
].main_status
!= 1)
1449 current_pc
= first_active_pc();
1454 void tip_of_day_event_filter (short item_hit
)
1457 char place_str
[256];
1461 dialog_not_toast
= FALSE
;
1465 store_tip_page_on
++;
1466 if (store_tip_page_on
== NUM_HINTS
)
1467 store_tip_page_on
= 0;
1468 get_str(place_str
,12,50 + store_tip_page_on
);
1469 csit(958,3,(char *) place_str
);
1473 give_intro_hint
= 1 - give_intro_hint
;
1474 cd_set_led(958,7,give_intro_hint
);
1485 char place_str
[256];
1487 store_tip_page_on
= get_ran(1,0,NUM_HINTS
- 1);
1489 make_cursor_sword();
1491 cd_create_dialog_parent_num(958,0);
1493 get_str(place_str
,12,50 + store_tip_page_on
);
1494 csit(958,3,(char *) place_str
);
1496 cd_set_led(958,7,give_intro_hint
);
1498 while (dialog_not_toast
)
1501 cd_kill_dialog(958,0);
1506 void max_window(HWND window
)
1508 RECT main_rect
,wind_rect
;
1511 cursor_shown
= TRUE
;
1514 GetWindowRect(GetDesktopWindow(),&main_rect
);
1515 GetWindowRect(window
,&wind_rect
);
1516 width
= main_rect
.right
- main_rect
.left
;
1517 height
= main_rect
.bottom
- main_rect
.top
;
1518 MoveWindow(window
,0,0,width
,height
,TRUE
);
1522 void put_scen_info()
1525 char place_str
[256];
1526 char *ratings
[] = {"G","PG","R","NC-17"};
1527 char *difficulty
[] = {"Low","Medium","High","Very High"};
1529 for (i
= 0; i
< 3; i
++)
1530 if (scen_headers
[store_scen_page_on
* 3 + i
].flag1
!= 0) {
1531 cd_set_pict(947, 6 + i
* 3,1600 + scen_headers
[store_scen_page_on
* 3 + i
].intro_pic
);
1532 sprintf((char *) place_str
,
1533 "%s v%d.%d.%d - | Difficulty: %s, Rating: %s |%s |%s",
1534 data_store2
->scen_header_strs
[store_scen_page_on
* 3 + i
][0],
1535 (short) scen_headers
[store_scen_page_on
* 3 + i
].ver
[0],
1536 (short) scen_headers
[store_scen_page_on
* 3 + i
].ver
[1],
1537 (short) scen_headers
[store_scen_page_on
* 3 + i
].ver
[2],
1538 difficulty
[scen_headers
[store_scen_page_on
* 3 + i
].difficulty
],
1539 ratings
[scen_headers
[store_scen_page_on
* 3 + i
].default_ground
],
1540 data_store2
->scen_header_strs
[store_scen_page_on
* 3 + i
][1],
1541 data_store2
->scen_header_strs
[store_scen_page_on
* 3 + i
][2]);
1542 csit(947,7 + i
* 3,(char *) place_str
);
1543 cd_activate_item(947,8 + i
* 3,1);
1546 cd_set_pict(947, 6 + i
* 3,950);
1547 csit(947,7 + i
* 3,"");
1548 cd_activate_item(947,8 + i
* 3,0);
1552 void pick_a_scen_event_filter (short item_hit
)
1555 char place_str
[256];
1560 dialog_not_toast
= FALSE
;
1564 if (item_hit
== 3) {
1565 if (store_scen_page_on
== 0)
1566 store_scen_page_on
= (store_num_scen
- 1) / 3;
1567 else store_scen_page_on
--;
1570 if (store_scen_page_on
== (store_num_scen
- 1) / 3)
1571 store_scen_page_on
= 0;
1572 else store_scen_page_on
++;
1577 case 8: case 11: case 14:
1578 dialog_answer
= ((item_hit
- 8) / 3) + store_scen_page_on
* 3;
1579 dialog_not_toast
= FALSE
;
1590 char place_str
[256];
1592 build_scen_headers();
1595 for (i
= 0; i
< 25; i
++)
1596 if (scen_headers
[i
].flag1
!= 0)
1598 store_scen_page_on
= 0;
1600 if (store_num_scen
== 0) {
1604 make_cursor_sword();
1606 cd_create_dialog_parent_num(947,0);
1610 if (store_num_scen
<= 3) {
1611 cd_activate_item(947,3,0);
1612 cd_activate_item(947,4,0);
1614 while (dialog_not_toast
)
1616 cd_kill_dialog(947,0);
1617 return dialog_answer
;
1621 void pick_prefab_scen_event_filter (short item_hit
)
1624 char place_str
[256];
1629 dialog_not_toast
= FALSE
;
1632 case 6: case 9: case 12:
1633 dialog_answer
= ((item_hit
- 6) / 3);
1634 dialog_not_toast
= FALSE
;
1640 short pick_prefab_scen()
1645 char place_str
[256];
1647 make_cursor_sword();
1649 cd_create_dialog_parent_num(869,0);
1650 cd_activate_item(869,2,0);
1652 while (dialog_not_toast
)
1654 cd_kill_dialog(869,0);
1655 return dialog_answer
;
1658 void give_password_filter (short item_hit
)
1666 dialog_not_toast
= FALSE
;
1672 Boolean
enter_password()
1673 // ignore parent in Mac version
1675 short town_strs_hit
,i
,store_dialog_answer
;
1676 char temp_str
[256],str2
[256];
1678 cd_create_dialog_parent_num(823,0);
1680 cd_set_text_edit_str(823,"");
1682 while (dialog_not_toast
)
1685 cd_get_text_edit_str(823,(char *) temp_str
);
1686 i
= wd_to_pwd(temp_str
);
1688 cd_kill_dialog(823,0);
1693 short wd_to_pwd(char *str
)
1695 char pwd
[8] = "aaaaaa";
1697 long val
= 0,pow
[6] = {1,10,100,1000,9999,99999};
1699 for (i
= 0; i
< 6; i
++) {
1703 if ((str
[i
] >= 65) && (str
[i
] <= 90))
1704 pwd
[i
] = str
[i
] + 32;
1705 else if ((str
[i
] >= 48) && (str
[i
] <= 57))
1706 pwd
[i
] = str
[i
] + 49;
1707 else if ((str
[i
] >= 97) && (str
[i
] <= 122))
1711 for (i
= 0; i
< 6; i
++)
1712 val
= val
+ pow
[i
] * (long) (pwd
[i
] - 97);