19 extern short stat_window
,give_delays
,overall_mode
;
20 extern short current_spell_range
,town_type
,store_anim_type
;
21 extern Boolean in_startup_mode
,anim_onscreen
,play_sounds
,frills_on
,startup_loaded
,party_in_memory
;
22 extern short town_size
[3];
23 extern short anim_step
;
24 extern party_record_type far party
;
25 extern piles_of_stuff_dumping_type
*data_store
;
26 extern piles_of_stuff_dumping_type2
*data_store2
;
27 extern talking_record_type far talking
;
28 extern scenario_data_type far scenario
;
30 extern pc_record_type far adven
[6];
31 extern big_tr_type far t_d
;
32 extern outdoor_record_type far outdoors
[2][2];
33 extern current_town_type far c_town
;
34 extern town_item_list far t_i
;
35 extern unsigned char far out
[96][96];
36 extern unsigned char far out_e
[96][96];
37 extern unsigned char far combat_terrain
[64][64];
38 extern effect_pat_type current_pat
;
39 extern Boolean web
,crate
,barrel
,fire_barrier
,force_barrier
,quickfire
,force_wall
,fire_wall
,antimagic
,scloud
,ice_wall
,blade_wall
;
41 extern location pc_pos
[6],pc_dir
[6],center
;
42 extern short which_combat_type
,current_pc
;
43 extern Boolean monsters_going
,boom_anim_active
,cartoon_happening
;
44 extern short current_ground
;
45 extern short terrain_pic
[256];
46 extern short pc_moves
[6];
47 extern short num_targets_left
;
48 extern location spell_targets
[8];
49 extern short display_mode
;
50 extern HWND text_sbar
,item_sbar
,shop_sbar
;
51 extern RECT sbar_rect
,item_sbar_rect
,shop_sbar_rect
;
52 extern RECT talk_area_rect
, word_place_rect
,startup_top
;
53 extern HBRUSH map_brush
[25];
54 extern HBITMAP map_bitmap
[25];
55 extern POINT store_anim_ul
;
56 extern long register_flag
,last_redraw_time
;
57 extern long ed_flag
,ed_key
;
58 extern Boolean registered
,ed_reg
;
59 extern Boolean fast_bang
;
62 extern far PALETTEENTRY ape
[256];
63 extern HDC main_dc
,main_dc2
,main_dc3
;
65 extern HFONT fantasy_font
,font
,small_bold_font
,italic_font
,underline_font
,bold_font
;
66 extern HCURSOR arrow_curs
[3][3], sword_curs
, key_curs
, target_curs
,talk_curs
,look_curs
;
68 extern HANDLE store_hInstance
;
69 extern Boolean modeless_exists
[18],diff_depth_ok
;
70 extern short modeless_key
[18];
71 extern HWND modeless_dialogs
[18];
72 extern piles_of_stuff_dumping_type3
*data_store3
;
73 extern piles_of_stuff_dumping_type4
*data_store4
;
75 extern unsigned char m_pic_index
[200];
78 HBITMAP bg_bitmap
[14];
79 HBRUSH checker_brush
= NULL
;
80 HBITMAP checker_bitmap
= NULL
,bw_bitmap
;
81 HBITMAP startup_button_orig
,startup_button_g
,anim_mess
;
83 Boolean done_fancy_startup_once
= FALSE
;
85 extern Boolean fry_startup
;
89 //PaletteHandle new_palette,old_palette,wank_palette;
91 short terrain_there
[9][9]; // this is an optimization variabel. Keeps track of what terrain
92 // is in the terrain spot, so things don't get redrawn.
93 // 0 - 299 just terrain graphic in place
95 // -1 - nothign worth saving
97 extern long anim_ticks
;
99 // 0 - terrain 1 - buttons 2 - pc stats
100 // 3 - item stats 4 - text bar 5 - text area (not right)
101 RECT win_from_rects
[6] = {{0,0,279,351},{0,0,258,37},{0,0,288,115},{0,0,288,143},{0,0,279,21},{0,0,288,0}};
102 RECT win_to_rects
[6] = {{5,5,284,356},{5,383,263,420},{0,0,271,116},{0,0,271,144},{5,358,284,379},{0,0,256,138}};
104 // 0 - title 1 - button 2 - credits 3 - base button
105 RECT startup_from
[4] = {{0,0,602,274},{0,274,301,322},{301,0,579,67},{301,274,341,314}}; ////
106 extern RECT startup_button
[6];
108 RECT trim_rects
[8] = {{0,0,28,5},{0,31,28,36},{0,0,5,36},{24,0,28,36},
109 {0,0,5,5},{24,0,28,5},{24,31,28,36},{0,31,5,36}}; /**/
111 RECT top_left_rec
= {0,0,28,36};
112 short which_graphic_index
[6] = {50,50,50,50,50,50};
114 char combat_graphics
[5] = {28,29,36,79,2};
115 short debug_nums
[6] = {0,0,0,0,0,0};
116 short remember_tiny_text
= 300; // Remembers what's in the tiny text-bar, to prevent redrawing.
117 // 50 indicates area name, other number indicates which-rect.
118 // Add 200 if last mess. was in town
120 char light_area
[13][13];
121 char unexplored_area
[13][13];
123 // Declare the graphics
124 HBITMAP mixed_gworld
, pc_stats_gworld
, item_stats_gworld
, text_area_gworld
;
125 HBITMAP storage_gworld
,terrain_screen_gworld
,text_bar_gworld
,orig_text_bar_gworld
,buttons_gworld
;
126 HBITMAP party_template_gworld
,items_gworld
,tiny_obj_gworld
,fields_gworld
;
127 extern HBITMAP map_gworld
;
128 HBITMAP dlg_buttons_gworld
,missiles_gworld
,dlogpics_gworld
,small_temp_gworld
;
130 HBITMAP dialog_pattern_gworld
,pattern_gworld
,status_pattern_gworld
;
132 // Startup graphics, will die when play starts
133 HBITMAP startup_gworld
;
134 HPALETTE opening_palette
;
140 // Graphics storage vals
141 short far which_g_stored
[STORED_GRAPHICS
];
142 // 0 - 299 terrain graphic 300 + i monster graphic i, face right 600 + i face left
143 // 1000 + 100 * j + i anim i pos j 2300 + i combat monster graphic i, face right 2600 + i face left
144 short far wish_list
[STORED_GRAPHICS
];
145 short far storage_status
[STORED_GRAPHICS
]; // 0 - empty 1 - in use 2 - there, not in use
147 Boolean has_run_anim
= FALSE
,currently_loading_graphics
= FALSE
;
148 //short anim_step = 0;
149 //short overall_anim_step = 0;
151 RECT main_win_rect
= {0,0,250,410};
152 RECT main_win2_source_rect
= {0,0,265,410};
153 RECT main_win2_rect
= {250,0,515,410};
155 RECT tiny_world_1_source_rect
= {0,0,145,190},
156 tiny_world_1_rect
= {242,195,475,385};
158 RECT share_mess_source_rect
= {0,0,120,59},
159 share_mess_rect
= {384,120,504,179};
160 RECT start_buttons_source_rect
= {0,0,190,186},
161 start_buttons_rect
= {30,214,220,400}; /**/
163 // Variables to store trim. Makes game faster, but wastes 15K. We'll see how it works...
164 char far out_trim
[96][96];
165 char far town_trim
[64][64];
167 // Array to store which spots have been seen. Time-saver for drawing fields
168 char spot_seen
[9][9];
171 location anim_str_loc
;
172 short startup_anim_pos
= 43;
174 extern short combat_posing_monster
, current_working_monster
; // 0-5 PC 100 + x - monster x
175 Boolean supressing_some_spaces
= FALSE
;
176 location ok_space
[4] = {{0,0},{0,0},{0,0},{0,0}};
177 char combat_string
[100];
180 void adjust_window_mode()
184 create_clip_region();
186 if (overall_mode
!= 45) {
187 if (in_startup_mode
== TRUE
)
189 if (in_startup_mode
== FALSE
)
192 MoveWindow(text_sbar
,ulx
+ 547,uly
+ 283,15,138,TRUE
);
193 MoveWindow(item_sbar
,ulx
+ 547,uly
+ 147,15,107,TRUE
);
194 MoveWindow(shop_sbar
,ulx
+ 258,uly
+ 67,16,290,TRUE
);
198 void plop_fancy_startup()
200 HBITMAP pict_to_draw
= NULL
;
204 RECT screen_rect
= {0,0,613,448},from_rect
= {0,0,350,350},to_rect
,whole_window
;
208 RECT big_pic_from
= {2,48,641,434};
210 GetClientRect(mainPtr
,&whole_window
);
212 //from_rect = screen_rect;
213 //if (whole_window.right > 613)
214 // OffsetRect(&screen_rect,(whole_window.right - 613) / 2 - 4,0);
215 //if (whole_window.bottom > 448)
216 // OffsetRect(&screen_rect,0,(whole_window.bottom - 448) / 2 - 15);
218 if (done_fancy_startup_once
== FALSE
) {
219 // initialize buffers and rects
220 for (i
= 0; i
< STORED_GRAPHICS
; i
++) {
221 which_g_stored
[i
] = (i
< 50) ? i
: 0;
223 storage_status
[i
] = (i
< 50) ? 1 : 0;
225 for (i
= 0;i
< 8; i
++)
226 OffsetRect(&trim_rects
[i
],61,37);
227 for (i
= 0; i
< 9; i
++)
228 for (j
= 0; j
< 9; j
++)
229 terrain_there
[i
][j
] = -1;
231 OffsetRect(&win_to_rects
[5],TEXT_WIN_UL_X
,TEXT_WIN_UL_Y
);
232 OffsetRect(&win_to_rects
[2],PC_WIN_UL_X
,PC_WIN_UL_Y
);
233 OffsetRect(&win_to_rects
[3],ITEM_WIN_UL_X
,ITEM_WIN_UL_Y
);
235 main_dc
= GetDC(mainPtr
);
237 pict_to_draw
= ReadDib("blscened/SPIDLOGO.BMP",main_dc
);
239 SelectPalette(main_dc
,hpal
,0);
240 SelectObject(main_dc
,font
);
241 SetBkMode(main_dc
,TRANSPARENT
);
242 main_dc2
= CreateCompatibleDC(main_dc
);
243 SetMapMode(main_dc2
,GetMapMode(mainPtr
));
244 SelectPalette(main_dc2
,hpal
,0);
245 main_dc3
= CreateCompatibleDC(main_dc
);
246 SetMapMode(main_dc3
,GetMapMode(mainPtr
));
247 SelectPalette(main_dc3
,hpal
,0);
248 SetStretchBltMode(main_dc
,STRETCH_DELETESCANS
);
249 SetStretchBltMode(main_dc2
,STRETCH_DELETESCANS
);
250 SetStretchBltMode(main_dc3
,STRETCH_DELETESCANS
);
252 else pict_to_draw
= ReadDib("blscened/SPIDLOGO.BMP",main_dc
);
254 cur_time
= GetCurrentTime();
255 //gray_out_window(0);
256 old_brush
= SelectObject(main_dc
,GetStockObject(BLACK_BRUSH
));
257 Rectangle(main_dc
, whole_window
.left
,whole_window
.top
,
258 whole_window
.right
,whole_window
.bottom
);
259 SelectObject(main_dc
,old_brush
);
263 graphic_ul
.x
= (whole_window
.right
- 350) / 2 - ulx
;
264 graphic_ul
.y
= (whole_window
.bottom
- 350) / 2 - uly
- 10;
266 OffsetRect(&to_rect
,graphic_ul
.x
,graphic_ul
.y
);
267 rect_draw_some_item(pict_to_draw
,from_rect
,pict_to_draw
,to_rect
,0,1);
271 DeleteObject(pict_to_draw
);
272 if (done_fancy_startup_once
== FALSE
) {
273 done_fancy_startup_once
= TRUE
;
279 while (GetCurrentTime() - cur_time
< 3000) ;
281 old_brush
= SelectObject(main_dc
,GetStockObject(BLACK_BRUSH
));
282 Rectangle(main_dc
, whole_window
.left
,whole_window
.top
,
283 whole_window
.right
,whole_window
.bottom
);
284 SelectObject(main_dc
,old_brush
);
285 pict_to_draw
= ReadDib("blscened/START.BMP",main_dc
);
287 cur_time
= GetCurrentTime();
289 graphic_ul
.x
= (whole_window
.right
- 639) / 2 - ulx
;
290 graphic_ul
.y
= (whole_window
.bottom
- 486) / 2 - uly
+ 46;
291 from_rect
= big_pic_from
;
294 OffsetRect(&to_rect
,-1 * to_rect
.left
+ graphic_ul
.x
,-1 * to_rect
.top
+ graphic_ul
.y
);
295 rect_draw_some_item(pict_to_draw
,from_rect
,pict_to_draw
,to_rect
,0,1);
296 DeleteObject(pict_to_draw
);
299 while (GetCurrentTime() - cur_time
< 5000) ;
300 old_brush
= SelectObject(main_dc
,GetStockObject(BLACK_BRUSH
));
301 Rectangle(main_dc
, whole_window
.left
,whole_window
.top
,
302 whole_window
.right
,whole_window
.bottom
);
303 SelectObject(main_dc
,old_brush
);
307 void fancy_startup_delay()
310 RECT region_rect
,old_rect
= {0,0,0,0};
314 // insert gray out window here
321 COLORREF x
= RGB(204,204,204);
324 startup_loaded
= TRUE
;
326 c
= GetNearestPaletteIndex(hpal
,x
);
327 gbrush
= CreateSolidBrush(PALETTEINDEX(c
));
328 gpen
= CreatePen(PS_SOLID
,1,PALETTEINDEX(c
));
330 startup_gworld
= load_pict(830,main_dc
);
331 startup_button_orig
= load_pict(832,main_dc
);
332 startup_button_g
= load_pict(832,main_dc
);
333 anim_mess
= load_pict(831,main_dc
);
336 void draw_startup(short but_type
)
338 RECT to_rect
,write_rect
;
339 RECT r1
= {-1000,-1000,1000,5},r2
= {-1000,-1000,5,1000},r3
= {-1000,418,1000,2000},
340 r4
= {579,-1000,2500,1000};
344 if (startup_loaded
== FALSE
)
348 paint_pattern(NULL
,1,r1
,0);
350 paint_pattern(NULL
,1,r2
,0);
352 paint_pattern(NULL
,1,r3
,0);
354 paint_pattern(NULL
,1,r4
,0);
355 to_rect
= startup_from
[0];
356 OffsetRect(&to_rect
,5,5);
357 rect_draw_some_item(startup_gworld
,startup_from
[0],startup_gworld
,to_rect
,0,1);
359 // to_rect = startup_from[2];
360 // OffsetRect(&to_rect,306,(-1 * to_rect.top) + 356);
361 // rect_draw_some_item(startup_gworld,startup_from[2],startup_gworld,to_rect,0,1);
363 for (i
= 0; i
< 5; i
++) {
364 rect_draw_some_item(startup_gworld
,startup_from
[1],startup_gworld
,startup_button
[i
],0,1);
365 draw_start_button(i
,but_type
);
369 draw_startup_stats();
372 void draw_startup_stats()
374 RECT from_rect
,to_rect
,party_from
= {0,0,28,36},pc_rect
,frame_rect
;
377 COLORREF colors
[5] = {RGB(0,0,0),RGB(255,255,255),RGB(0,204,255),RGB(0,160,0),RGB(0,0,255)};
381 for (i
= 0; i
< 5; i
++)
382 c
[i
] = GetNearestPaletteIndex(hpal
,colors
[i
]);
383 to_rect
= startup_top
;
384 OffsetRect(&to_rect
, 20, 35);
385 hbrush
= CreateSolidBrush(PALETTEINDEX(c
[2]));
387 SetTextColor(main_dc
,PALETTEINDEX(c
[1]));
389 if (party_in_memory
== FALSE
) {
391 SelectObject(main_dc
,fantasy_font
);
392 OffsetRect(&to_rect
,175,40);
393 char_win_draw_string(main_dc
,to_rect
,
394 "No Party in Memory",0,18);
396 if (party_in_memory
== TRUE
) {
397 frame_rect
= startup_top
;
398 InflateRect(&frame_rect
,-50,-50);
399 frame_rect
.top
+= 30;
400 OffsetRect(&frame_rect
,ulx
,uly
+ 10);
401 FrameRect(main_dc
,&frame_rect
,hbrush
);
403 SelectObject(main_dc
,fantasy_font
);
404 OffsetRect(&to_rect
,213,25);
405 char_win_draw_string(main_dc
,to_rect
,
407 SelectObject(main_dc
,small_bold_font
);
408 for (i
= 0; i
< 6; i
++) {
409 pc_rect
= startup_top
;
410 pc_rect
.right
= pc_rect
.left
+ 300;
411 pc_rect
.bottom
= pc_rect
.top
+ 79;
412 OffsetRect(&pc_rect
,60 + 232 * (i
/ 3) + 25,95 + 45 * (i
% 3));
414 if (adven
[i
].main_status
> 0) {
415 from_rect
= party_from
;
416 OffsetRect(&from_rect
,56 * (i
/ 3),36 * (i
% 3));
417 to_rect
= party_from
,
418 OffsetRect(&to_rect
,pc_rect
.left
,pc_rect
.top
+ 2);
419 rect_draw_some_item(party_template_gworld
,from_rect
,
420 party_template_gworld
,to_rect
,0,1);
421 InflateRect(&to_rect
,1,1);
422 OffsetRect(&to_rect
,ulx
,uly
);
423 FrameRect(main_dc
,&to_rect
,hbrush
);
425 SelectObject(main_dc
,bold_font
);
426 OffsetRect(&pc_rect
,35,0);
427 char_win_draw_string(main_dc
,pc_rect
,
429 OffsetRect(&to_rect
,pc_rect
.left
+ 8,pc_rect
.top
+ 8);
433 OffsetRect(&pc_rect
,12,16);
434 SelectObject(main_dc
,small_bold_font
);
435 switch (adven
[i
].main_status
) {
437 switch (adven
[i
].race
) {
438 case 0: sprintf((char *) str
,"Level %d Human",adven
[i
].level
); break;
439 case 1: sprintf((char *) str
,"Level %d Nephilim",adven
[i
].level
); break;
440 case 2: sprintf((char *) str
,"Level %d Slithzerikai",adven
[i
].level
); break;
442 char_win_draw_string(main_dc
,pc_rect
,(char *) str
,0,18);
443 OffsetRect(&pc_rect
,0,13);
444 sprintf((char *) str
,"Health %d, Spell pts. %d",
445 adven
[i
].max_health
,adven
[i
].max_sp
);
446 char_win_draw_string(main_dc
,pc_rect
,(char *) str
,0,18);
449 char_win_draw_string(main_dc
,pc_rect
,"Dead",0,18);
452 char_win_draw_string(main_dc
,pc_rect
,"Dust",0,18);
455 char_win_draw_string(main_dc
,pc_rect
,"Stone",0,18);
461 SelectObject(main_dc
,small_bold_font
);
462 pc_rect
= startup_from
[0];
463 OffsetRect(&pc_rect
,5,5);
464 pc_rect
.top
= pc_rect
.bottom
- 28;
465 pc_rect
.left
= pc_rect
.right
- 275;
466 char_win_draw_string(main_dc
,pc_rect
,"Copyright 1997-8, All Rights Reserved, v1.0.1",0,18);
467 if (registered
== FALSE
) {
468 pc_rect
.left
= startup_from
[0].left
+ 22;
469 char_win_draw_string(main_dc
,pc_rect
,"Unregistered copy. To order, select How To Order.",0,18);
472 SetTextColor(main_dc
,PALETTEINDEX(c
[0]));
473 DeleteObject(hbrush
);
476 void draw_startup_anim()
478 RECT anim_to
= {1,4,276,44},anim_from
;
479 RECT anim_size
= {0,0,301,48};
482 OffsetRect(&anim_from
,-1,-4 + startup_anim_pos
);
483 startup_anim_pos
= (startup_anim_pos
+ 1) % 542;
484 rect_draw_some_item(startup_button_orig
,anim_size
,startup_button_g
,anim_size
,0,0);
485 rect_draw_some_item(anim_mess
,anim_from
,startup_button_g
,anim_to
,1,0);
486 rect_draw_some_item(startup_button_g
,anim_size
,startup_button_g
,startup_button
[5],0,1);
489 void draw_start_button(short which_position
,short which_button
)
491 RECT from_rect
,to_rect
;
492 char *button_labels
[] = {"Load Game","Make New Party","How To Order",
493 "Start Scenario","Custom Scenario","Quit"};
494 RECT button_from
= {172,0,202,30};
495 COLORREF colors
[5] = {RGB(0,0,0),RGB(255,0,0),RGB(255,255,255),RGB(0,255,255),RGB(0,0,255)};
500 for (i
= 0; i
< 5; i
++)
501 c
[i
] = GetNearestPaletteIndex(hpal
,colors
[i
]);
503 from_rect
= startup_from
[3];
504 OffsetRect(&from_rect
, (which_button
> 0) ? 40 : 0,0);
505 to_rect
= startup_button
[which_position
];
506 to_rect
.left
+= 4; to_rect
.top
+= 4;
507 to_rect
.right
= to_rect
.left
+ 40;
508 to_rect
.bottom
= to_rect
.top
+ 40;
509 from_rect
.top
+= 4; to_rect
.top
+= 4;
510 rect_draw_some_item(startup_gworld
,from_rect
,startup_gworld
,to_rect
,0,1);
512 //TextFont(dungeon_font_num);
515 to_rect
= startup_button
[which_position
];
516 //to_rect.left += 80;
517 OffsetRect(&to_rect
, 10, 0);
518 if (which_button
== 5)
520 if (which_button
== 0)
521 SetTextColor(main_dc
,PALETTEINDEX(c
[2]));
522 else SetTextColor(main_dc
,PALETTEINDEX(c
[2]));
523 SelectObject(main_dc
,fantasy_font
);
524 if (which_position
== 3)
525 OffsetRect(&to_rect
,-7,0);
526 SetTextColor(main_dc
,PALETTEINDEX(c
[0]));
527 OffsetRect(&to_rect
,0,1);
528 char_win_draw_string(main_dc
,to_rect
,
529 (char *) button_labels
[which_position
],1,18);
530 OffsetRect(&to_rect
,0,-2);
531 char_win_draw_string(main_dc
,to_rect
,
532 (char *) button_labels
[which_position
],1,18);
533 OffsetRect(&to_rect
,1,1);
534 char_win_draw_string(main_dc
,to_rect
,
535 (char *) button_labels
[which_position
],1,18);
536 OffsetRect(&to_rect
,-2,0);
537 char_win_draw_string(main_dc
,to_rect
,
538 (char *) button_labels
[which_position
],1,18);
539 OffsetRect(&to_rect
,1,0);
540 SetTextColor(main_dc
,PALETTEINDEX(c
[2]));
541 char_win_draw_string(main_dc
,to_rect
,
542 (char *) button_labels
[which_position
],1,18);
543 SelectObject(main_dc
,font
);
544 SetTextColor(main_dc
,PALETTEINDEX(c
[0]));
545 //ForeColor(blackColor);
546 //TextFont(geneva_font_num);
552 void main_button_click(short mode
,RECT button_rect
)
557 ClipRect(&button_rect
);
560 if (play_sounds
== TRUE
)
562 else Delay(5,&dummy
);
567 void arrow_button_click(RECT button_rect
)
571 ClipRect(&button_rect
);
573 refresh_stat_areas(1);
574 if (play_sounds
== TRUE
)
576 else Delay(5,&dummy
);
577 refresh_stat_areas(0);
581 void reload_startup()////
583 if (startup_loaded
== TRUE
)
586 DestroyWindow(modeless_dialogs
[5]);
587 modeless_exists
[5] = FALSE
;
588 if (text_sbar
!= NULL
) {
589 ShowScrollBar(text_sbar
,SB_CTL
,FALSE
);
590 ShowScrollBar(item_sbar
,SB_CTL
,FALSE
);
592 // SelectWindow(mainPtr);
596 startup_loaded
= TRUE
;
597 //load_main_screen();
602 if (startup_loaded
== FALSE
)
605 DeleteObject(startup_gworld
);
606 DeleteObject(startup_button_orig
);
607 DeleteObject(startup_button_g
);
608 DeleteObject(anim_mess
);
610 startup_loaded
= FALSE
;
614 // This loads the graphics at the top of the game.
617 RECT temp_rect
= {0,0,280,0},map_world_rect
;
618 RECT map_rect
= {0,0,384,384};
619 RECT pc_rect
= {0,0,113,216};
622 RECT mask_rect
= {0,0,308,396},r
= {0,0,280,180}; /**/
623 RECT bg_from
[9] = {{0,168,8,176},{23,206,31,214},{32,168,40,176},{102,174,110,182},
624 {173,191,181,199},{203,190,211,198},{273,183,281,191},{373,0,381,8},
626 RECT map_from_orig
= {372,0,380,8},map_from
,brush_to
= {0,0,8,8};
627 WORD patbits
[] = {0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55};
629 RECT pat_from
= {96,168,160,232}, pat_to_orig
= {0,0,64,64},pat_to
;
631 checker_bitmap
= CreateBitmap(8,8,1,1,(LPSTR
) patbits
);
632 checker_brush
= CreatePatternBrush(checker_bitmap
);
633 bw_bitmap
= CreateBitmap(72,72,1,1,NULL
);
635 temp_rect
.bottom
= (STORED_GRAPHICS
/ 10) * 36;
636 storage_gworld
= CreateCompatibleBitmap(main_dc
,temp_rect
.right
,temp_rect
.bottom
);
638 temp_gworld
= load_pict(800,main_dc
);
639 rect_draw_some_item(temp_gworld
,r
,storage_gworld
,r
,0,0);
640 DeleteObject(temp_gworld
);
642 terrain_screen_gworld
= load_pict(705,main_dc
);
644 party_template_gworld
= CreateCompatibleBitmap(main_dc
,pc_rect
.right
,pc_rect
.bottom
);
645 small_temp_gworld
= CreateCompatibleBitmap(main_dc
,28,36);
647 items_gworld
= load_pict(901,main_dc
);
648 tiny_obj_gworld
= load_pict(900,main_dc
);
649 fields_gworld
= load_pict(821,main_dc
);
650 missiles_gworld
= load_pict(880,main_dc
);
651 dlogpics_gworld
= load_pict(850,main_dc
);
652 mixed_gworld
= load_pict(903,main_dc
);
654 dialog_pattern_gworld
= CreateCompatibleBitmap(main_dc
,192,256);
655 pattern_gworld
= CreateCompatibleBitmap(main_dc
,192,256);
656 status_pattern_gworld
= CreateCompatibleBitmap(main_dc
,256,128);
657 for (i
= 0; i
< 4; i
++)
658 for (j
= 0; j
< 2; j
++) {
659 pat_to
= pat_to_orig
;
660 OffsetRect(&pat_to
,64 * i
, 64 * j
);
661 rect_draw_some_item(mixed_gworld
,pat_from
,status_pattern_gworld
,
666 dlg_buttons_gworld
= load_pict(2000,main_dc
);
668 map_gworld
= CreateCompatibleBitmap(main_dc
,map_rect
.right
,map_rect
.bottom
);
670 // Create and initialize map gworld
671 //err = NewGWorld(&map_gworld, 0,&map_rect, NIL, NIL, 0);
673 for (i
= 0; i
< 9; i
++) {
674 bg_bitmap
[i
] = CreateCompatibleBitmap(main_dc
,8,8);
675 rect_draw_some_item(mixed_gworld
,bg_from
[i
],bg_bitmap
[i
],brush_to
,0,0);
676 bg
[i
] = CreatePatternBrush(bg_bitmap
[i
]);
678 for (i
= 0; i
< 25; i
++) {
679 map_from
= map_from_orig
;
680 OffsetRect(&map_from
,8 * (i
/ 10),8 * (i
% 10));
681 map_bitmap
[i
] = CreateCompatibleBitmap(main_dc
,8,8);
682 rect_draw_some_item(mixed_gworld
,map_from
,map_bitmap
[i
],brush_to
,0,0);
683 map_brush
[i
] = CreatePatternBrush(map_bitmap
[i
]);
687 SetPort((GrafPtr) map_gworld);
688 map_world_rect = map_gworld->portRect;
689 ForeColor(whiteColor);
690 PaintRect(&map_world_rect);
691 ForeColor(blackColor);
697 void lose_graphics() {
700 if (startup_loaded
== TRUE
) {
701 DeleteObject(startup_gworld
);
704 DeleteObject(pc_stats_gworld
);
705 DeleteObject(item_stats_gworld
);
706 DeleteObject(text_area_gworld
);
707 DeleteObject(text_bar_gworld
);
708 DeleteObject(orig_text_bar_gworld
);
709 DeleteObject(buttons_gworld
);
711 DeleteObject(bw_bitmap
);
712 DeleteObject(dialog_pattern_gworld
);
713 DeleteObject(pattern_gworld
);
714 DeleteObject(status_pattern_gworld
);
716 DeleteObject(checker_bitmap
);
717 DeleteObject(checker_brush
);
718 DeleteObject(storage_gworld
);
719 DeleteObject(terrain_screen_gworld
);
720 DeleteObject(party_template_gworld
);
721 DeleteObject(items_gworld
);
722 DeleteObject(tiny_obj_gworld
);
723 DeleteObject(fields_gworld
);
724 DeleteObject(missiles_gworld
);
725 DeleteObject(dlogpics_gworld
);
726 DeleteObject(mixed_gworld
);
727 DeleteObject(dlg_buttons_gworld
);
728 DeleteObject(map_gworld
);
729 DeleteObject(small_temp_gworld
);
733 DeleteObject(opening_palette
);
738 DeleteObject(fantasy_font
);
739 // DeleteObject(small_bold_font);
740 DeleteObject(underline_font
);
741 DeleteObject(italic_font
);
742 DeleteObject(bold_font
);
743 for (i
= 0; i
< 9; i
++) {
744 DeleteObject(bg_bitmap
[i
]);
747 for (i
= 0; i
< 25; i
++) {
748 DeleteObject(map_bitmap
[i
]);
749 DeleteObject(map_brush
[i
]);
751 for (i
= 0; i
< 3; i
++)
752 for (j
= 0; j
< 3; j
++)
753 DeleteObject(arrow_curs
[i
][j
]);
754 DeleteObject(talk_curs
);
755 DeleteObject(sword_curs
);
756 DeleteObject( key_curs
);
757 DeleteObject( target_curs
);
758 DeleteObject( look_curs
);
759 DeleteObject(gbrush
);
766 void load_main_screen()
769 // tiny_map_graphics = load_pict(904);
771 RECT from_rect
= {0,0,271,116},to_rect
= {0,0,0,0};
773 // load in graphic with 3 right side status areas, and copy each of them into
774 // its own private HBITMAP
775 temp_gworld
= load_pict(700,main_dc
);
777 pc_stats_gworld
= CreateCompatibleBitmap(main_dc
,271,116);
778 to_rect
.right
= 271; to_rect
.bottom
= 116;
779 rect_draw_some_item(temp_gworld
,from_rect
,pc_stats_gworld
,to_rect
,0,0);
781 item_stats_gworld
= CreateCompatibleBitmap(main_dc
,271,144);
782 to_rect
.bottom
= 144;
783 from_rect
.top
= 116; from_rect
.bottom
= 260;
784 rect_draw_some_item(temp_gworld
,from_rect
,item_stats_gworld
,to_rect
,0,0);
786 text_area_gworld
= CreateCompatibleBitmap(main_dc
,256,138);
787 to_rect
.right
= 256; to_rect
.bottom
= 138;
788 from_rect
.top
= 260; from_rect
.bottom
= 398; from_rect
.right
= 256;
789 rect_draw_some_item(temp_gworld
,from_rect
,text_area_gworld
,to_rect
,0,0);
791 DeleteObject(temp_gworld
);
793 text_bar_gworld
= load_pict(703,main_dc
);
794 orig_text_bar_gworld
= load_pict(703,main_dc
);
795 buttons_gworld
= load_pict(704,main_dc
);
799 void create_clip_region()
802 RECT store_rect
= {0,0,2000,2000};
806 DeleteObject(clip_region
);
807 GetWindowRect(GetDesktopWindow(),&store_rect
);
808 clip_region
= CreateRectRgn(0,0,store_rect
.right
* 2,store_rect
.bottom
* 2);
811 for (i
= 0; i
< 6; i
++) {
812 store_rect
= win_to_rects
[i
];
813 OffsetRect(&store_rect
,ulx
,uly
);
814 if ((is_out()) || (is_town()) || (is_combat()) ||
815 (i
== 2) || (i
== 3) || (i
== 5)) {
816 temp_rgn
= CreateRectRgn(store_rect
.left
,store_rect
.top
,store_rect
.right
,store_rect
.bottom
);
817 CombineRgn(clip_region
,clip_region
,temp_rgn
,RGN_DIFF
);
818 DeleteObject(temp_rgn
);
821 if ((overall_mode
== 20) || (overall_mode
== 21) ){
822 scrollbar_rect
= talk_area_rect
;
823 OffsetRect(&scrollbar_rect
,ulx
,uly
);
824 temp_rgn
= CreateRectRgn(scrollbar_rect
.left
,scrollbar_rect
.top
,scrollbar_rect
.right
,scrollbar_rect
.bottom
);
825 CombineRgn(clip_region
,clip_region
,temp_rgn
,RGN_DIFF
);
826 DeleteObject(temp_rgn
);
828 scrollbar_rect
= sbar_rect
;
829 OffsetRect(&scrollbar_rect
,ulx
,uly
);
830 temp_rgn
= CreateRectRgn(scrollbar_rect
.left
,scrollbar_rect
.top
,scrollbar_rect
.right
,scrollbar_rect
.bottom
);
831 CombineRgn(clip_region
,clip_region
,temp_rgn
,RGN_DIFF
);
832 DeleteObject(temp_rgn
);
833 scrollbar_rect
= item_sbar_rect
;
834 OffsetRect(&scrollbar_rect
,ulx
,uly
);
835 temp_rgn
= CreateRectRgn(scrollbar_rect
.left
,scrollbar_rect
.top
,scrollbar_rect
.right
,scrollbar_rect
.bottom
);
836 CombineRgn(clip_region
,clip_region
,temp_rgn
,RGN_DIFF
);
837 DeleteObject(temp_rgn
);
841 // redraw_screen does the very first redraw, and any full redraw
842 void redraw_screen(short mode
)
844 if (text_sbar
== NULL
) {
845 text_sbar
= CreateWindow("scrollbar",NULL
,
846 WS_CHILD
| WS_TABSTOP
| SBS_VERT
| WS_VISIBLE
, sbar_rect
.left
,sbar_rect
.top
,sbar_rect
.right
,sbar_rect
.bottom
,
847 mainPtr
,1,store_hInstance
,NULL
);
848 SetScrollRange(text_sbar
,SB_CTL
,0,58,FALSE
);
849 item_sbar
= CreateWindow("scrollbar",NULL
,
850 WS_CHILD
| WS_TABSTOP
| SBS_VERT
| WS_VISIBLE
, item_sbar_rect
.left
,item_sbar_rect
.top
,item_sbar_rect
.right
,item_sbar_rect
.bottom
,
851 mainPtr
,2,store_hInstance
,NULL
);
852 SetScrollRange(item_sbar
,SB_CTL
,0,16,FALSE
);
853 ShowScrollBar(text_sbar
,SB_CTL
,TRUE
);
854 ShowScrollBar(item_sbar
,SB_CTL
,TRUE
);
855 MoveWindow(text_sbar
,ulx
+ 547,uly
+ 283,15,138,TRUE
);
856 MoveWindow(item_sbar
,ulx
+ 547,uly
+ 147,15,107,TRUE
);
859 ShowScrollBar(text_sbar
,SB_CTL
,TRUE
);
860 ShowScrollBar(item_sbar
,SB_CTL
,TRUE
);
862 //if (overall_mode == 21) {
863 // ShowScrollBar(shop_sbar,SB_CTL,TRUE);
865 // else ShowScrollBar(shop_sbar,SB_CTL,FALSE);
866 switch (overall_mode
) {
871 //draw_main_screen();
876 if ((overall_mode
== 10) && (current_pc
< 6))
877 draw_pcs(pc_pos
[current_pc
],1);
878 if (overall_mode
== 14)
879 draw_targets(center
);
887 put_item_screen(current_pc
,0);
894 void draw_main_screen()
896 if (overall_mode
== 20) {
901 rect_draw_some_item (terrain_screen_gworld
, win_from_rects
[0], terrain_screen_gworld
, win_to_rects
[0], 0, 1);
904 if ((current_pc
< 6) && (overall_mode
== 10))
905 draw_pcs(pc_pos
[current_pc
],1);
906 if (overall_mode
== 14)
907 draw_targets(center
);
910 //ShowScrollBar(text_sbar,SB_CTL,TRUE);
911 //ShowScrollBar(item_sbar,SB_CTL,TRUE);
912 if (text_sbar
== NULL
) {
913 text_sbar
= CreateWindow("scrollbar",NULL
,
914 WS_CHILD
| WS_TABSTOP
| SBS_VERT
| WS_VISIBLE
, sbar_rect
.left
,sbar_rect
.top
,sbar_rect
.right
,sbar_rect
.bottom
,
915 mainPtr
,1,store_hInstance
,NULL
);
916 SetScrollRange(text_sbar
,SB_CTL
,0,58,FALSE
);
917 item_sbar
= CreateWindow("scrollbar",NULL
,
918 WS_CHILD
| WS_TABSTOP
| SBS_VERT
| WS_VISIBLE
, item_sbar_rect
.left
,item_sbar_rect
.top
,item_sbar_rect
.right
,item_sbar_rect
.bottom
,
919 mainPtr
,2,store_hInstance
,NULL
);
920 SetScrollRange(item_sbar
,SB_CTL
,0,16,FALSE
);
921 ShowScrollBar(text_sbar
,SB_CTL
,TRUE
);
922 ShowScrollBar(item_sbar
,SB_CTL
,TRUE
);
923 MoveWindow(text_sbar
,ulx
+ 547,uly
+ 283,15,138,TRUE
);
924 MoveWindow(item_sbar
,ulx
+ 547,uly
+ 147,15,107,TRUE
);
926 //if (overall_mode == 21) {
927 // ShowScrollBar(shop_sbar,SB_CTL,TRUE);
929 // else ShowScrollBar(shop_sbar,SB_CTL,FALSE);
933 void refresh_screen(short mode
)
935 if (overall_mode
== 20) {
939 else if (overall_mode
== 21) {
946 if ((current_pc
< 6) && (overall_mode
== 10))
947 draw_pcs(pc_pos
[current_pc
],1);
948 if (overall_mode
== 14)
949 draw_targets(center
);
954 //ShowScrollBar(text_sbar,SB_CTL,TRUE);
955 //ShowScrollBar(item_sbar,SB_CTL,TRUE);
956 //if (overall_mode == 21) {
957 // ShowScrollBar(shop_sbar,SB_CTL,TRUE);
959 // else ShowScrollBar(shop_sbar,SB_CTL,FALSE);
963 void put_background()
965 HBRUSH bg_pict
,old_b
;
971 if (party
.outdoor_corner
.x
>= 7)
975 else if (is_combat()) {
976 if (party
.outdoor_corner
.x
>= 7)
981 if (party
.outdoor_corner
.x
>= 7)
986 SelectClipRgn(main_dc
,clip_region
);
987 GetClientRect(mainPtr
,&r
);
988 paint_pattern(mainPtr
, 1,r
,wp
);
991 //ShowScrollBar(text_sbar,SB_CTL,TRUE);
992 //ShowScrollBar(item_sbar,SB_CTL,TRUE);
1002 if (party
.outdoor_corner
.x
>= 7)
1006 else if (is_combat()) {
1007 if (party
.outdoor_corner
.x
>= 7)
1012 if ((party
.outdoor_corner
.x
>= 7) && (c_town
.town_num
!= 21))
1017 GetWindowRect(mainPtr
,&r
);
1018 paint_pattern(NULL
, 1,r
,wp
);
1021 void draw_buttons(short mode
)
1022 //mode; // 0 - regular 1 - button action
1024 RECT source_rect
= {0,0,258,37}, dest_rec
; /**/
1025 HBITMAP buttons_to_draw
;
1026 Boolean spec_draw
= FALSE
;
1027 RECT bg_rect
,base_rect
= {0,0,40,40};
1035 buttons_to_draw
= buttons_gworld
;
1037 source_rect
= win_to_rects
[1];
1038 OffsetRect(&source_rect
,-1 * source_rect
.left
, -1 * source_rect
.top
);
1040 source_rect
.top
+= 37;
1041 source_rect
.bottom
+= 37;
1044 source_rect
.top
+= 74;
1045 source_rect
.bottom
+= 74;
1048 dest_rec
= win_to_rects
[1];
1049 rect_draw_some_item(buttons_gworld
,source_rect
,buttons_gworld
,dest_rec
,(spec_draw
== TRUE
) ? 2 : 0,1);
1055 // In general, refreshes any area that has text in it, the stat areas, the text bar
1056 void draw_text_area(short mode
)
1059 refresh_stat_areas(0);
1064 void reset_text_bar()
1066 remember_tiny_text
= 300;
1070 void draw_text_bar(short mode
)
1071 //short mode; // 0 - no redraw 1 - forced
1073 short i
,num_rect
[3] = {12,10,4};
1076 loc
= (is_out()) ? global_to_local(party
.p_loc
) : c_town
.p_loc
;
1079 remember_tiny_text
= 500;
1080 if ((PSD
[305][0] > 0) || (PSD
[305][1] > 0) ||(PSD
[305][2] > 0) ||(PSD
[305][3] > 0) )
1081 remember_tiny_text
= 500;
1083 for (i
= 0; i
< 8; i
++)
1084 if (pt_in_rect(loc
,outdoors
[party
.i_w_c
.x
][party
.i_w_c
.y
].info_rect
[i
]))
1085 if ((remember_tiny_text
== i
) && (mode
== 0))
1088 put_text_bar(data_store4
->outdoor_text
[party
.i_w_c
.x
][party
.i_w_c
.y
].out_strs
[i
+ 1]);
1089 remember_tiny_text
= i
;
1092 if (remember_tiny_text
!= 50 + party
.i_w_c
.x
+ party
.i_w_c
.y
) {
1093 put_text_bar((char *) data_store4
->outdoor_text
[party
.i_w_c
.x
][party
.i_w_c
.y
].out_strs
[0]);
1094 remember_tiny_text
= 50 + party
.i_w_c
.x
+ party
.i_w_c
.y
;
1098 for (i
= 0; i
< num_rect
[town_type
]; i
++)
1099 if (pt_in_rect(loc
,t_d
.room_rect
[i
]))
1100 if ((remember_tiny_text
== 200 + i
) && (mode
== 0))
1103 put_text_bar(data_store
->town_strs
[i
+ 1]);
1104 remember_tiny_text
= 200 + i
;
1107 if (remember_tiny_text
!= 250) {
1108 put_text_bar((char *) data_store
->town_strs
[0]); ////
1109 remember_tiny_text
= 250;
1113 if ((is_combat()) && (current_pc
< 6) && (monsters_going
== FALSE
)) {
1114 sprintf((char *) combat_string
,"%s (ap: %d)",
1115 adven
[current_pc
].name
,pc_moves
[current_pc
]);
1116 put_text_bar((char *) combat_string
);
1117 remember_tiny_text
= 500;
1119 if ((is_combat()) && (monsters_going
== TRUE
)) // Print bar for 1st monster with >0 ap -
1120 // that is monster that is going
1121 for (i
= 0; i
< T_M
; i
++)
1122 if ((c_town
.monst
.dudes
[i
].active
> 0) && (c_town
.monst
.dudes
[i
].m_d
.ap
> 0)) {
1123 print_monster_going((char *) combat_string
,c_town
.monst
.dudes
[i
].number
,c_town
.monst
.dudes
[i
].m_d
.ap
);
1124 put_text_bar((char *) combat_string
);
1125 remember_tiny_text
= 500;
1130 void put_text_bar(char *str
)
1132 char status_str
[256];
1136 RECT text_rect
= {5,3,279,21};
1137 COLORREF x
= RGB(0,0,0),y
= RGB(255,255,255);
1140 rect_draw_some_item (orig_text_bar_gworld
, win_from_rects
[4], text_bar_gworld
, win_from_rects
[4], 0, 0);
1142 hdc
= CreateCompatibleDC(main_dc
);
1143 SelectPalette(hdc
,hpal
,0);
1144 SetBkMode(hdc
,TRANSPARENT
);
1145 SelectObject(hdc
,small_bold_font
);
1146 store_bmp
= SelectObject(hdc
,text_bar_gworld
);
1147 sprintf(status_str
,"%s",str
);
1148 c
= GetNearestPaletteIndex(hpal
,y
);
1149 SetTextColor(hdc
,PALETTEINDEX(c
));
1150 win_draw_string(hdc
,text_rect
,status_str
,2,9);
1151 c
= GetNearestPaletteIndex(hpal
,x
);
1152 SetTextColor(hdc
,PALETTEINDEX(c
));
1154 if (monsters_going
== FALSE
) {
1155 if (PSD
[305][0] > 0) {
1156 text_rect
.left
= xpos
;
1157 sprintf((char *) status_str
,"Stealth");
1158 win_draw_string(hdc
,text_rect
,status_str
,2,9);
1161 if (PSD
[305][1] > 0) {
1162 text_rect
.left
= xpos
;
1163 sprintf((char *) status_str
,"Flying");
1164 win_draw_string(hdc
,text_rect
,status_str
,2,9);
1167 if (PSD
[305][2] > 0) {
1168 text_rect
.left
= xpos
;
1169 sprintf((char *) status_str
,"Detect Life");
1170 win_draw_string(hdc
,text_rect
,status_str
,2,9);
1173 if (PSD
[305][3] > 0) {
1174 text_rect
.left
= xpos
;
1175 sprintf((char *) status_str
,"Firewalk");
1176 win_draw_string(hdc
,text_rect
,status_str
,2,9);
1181 SelectObject(hdc
,store_bmp
);
1183 rect_draw_some_item (text_bar_gworld
, win_from_rects
[4], text_bar_gworld
, win_to_rects
[4], 0, 1);
1186 // This is called when a new situation is entered. It figures out what graphics are needed,
1187 // sets up which_g_stored, and loads them.
1188 void load_area_graphics()
1192 currently_loading_graphics
= TRUE
;
1194 // Set all graphics as loseable
1195 for (i
= 50; i
< STORED_GRAPHICS
; i
++)
1196 if (storage_status
[i
] == 1)
1197 storage_status
[i
] = 2;
1198 for (i
= 0; i
< STORED_GRAPHICS
; i
++)
1203 load_outdoor_graphics();
1204 if ((is_town()) || (is_combat()))
1205 load_town_graphics();
1207 // Reserve all in wish list not taken
1208 for (i
= 0; i
< STORED_GRAPHICS
; i
++)
1209 if (wish_list
[i
] > 49)
1210 if (reserve_graphic_num_in_array(wish_list
[i
]) == TRUE
)
1213 // Place all graphics not found in array.
1214 for (i
= 0; i
< STORED_GRAPHICS
; i
++)
1215 if (wish_list
[i
] > 49) {
1216 place_graphic_num_in_array(wish_list
[i
]);
1220 // Finally, load graphics.
1221 put_graphics_in_template();
1223 currently_loading_graphics
= FALSE
;
1226 void add_to_wish_list(short which_g
)
1233 for (i
= 0; i
< STORED_GRAPHICS
; i
++) {
1234 if (wish_list
[i
] == which_g
)
1236 if (wish_list
[i
] == 0) {
1237 wish_list
[i
] = which_g
;
1241 add_string_to_buf("No room for graphic.");
1244 // Used to set up array. If graphic there, sets it to be saved, otherwise leaves.
1245 // Returns TRUE is already there
1246 Boolean
reserve_graphic_num_in_array(short which_g
)
1252 for (i
= 50; i
< STORED_GRAPHICS
; i
++)
1253 if (which_g_stored
[i
] == which_g
) {
1254 storage_status
[i
] = 1;
1260 // Otherwise, puts in array. Note ... if graphic is alreayd here and locked (i.e.
1261 // storage status is 1, this will add a new copy.
1262 void place_graphic_num_in_array(short which_g
)
1266 for (i
= 50; i
< STORED_GRAPHICS
; i
++)
1267 if ((storage_status
[i
] == 2) || (storage_status
[i
] == 0)) {
1268 which_g_stored
[i
] = which_g
;
1269 storage_status
[i
] = 3;
1272 // if we get here, couldn't find a space. Time to flush excess crap.
1274 if (currently_loading_graphics
== FALSE
)
1275 load_area_graphics(); // calling this is nice and fast, because game won't try to reload
1276 // graphics already there. It'll only purge the trash.
1279 for (i
= 50; i
< STORED_GRAPHICS
; i
++)
1280 if ((storage_status
[i
] == 2) || (storage_status
[i
] == 0)) {
1281 which_g_stored
[i
] = which_g
;
1282 storage_status
[i
] = 3;
1285 add_string_to_buf("No room for graphic.");
1286 print_nums(0,0,which_g
);
1289 void add_one_graphic(short which_g
)
1292 for (i
= 0; i
< STORED_GRAPHICS
; i
++)
1293 if (which_g_stored
[i
] == which_g
) {
1294 // Good. We got it. Now lock it and leave
1295 storage_status
[i
] = 1;
1299 // otherwise, load it in
1300 place_graphic_num_in_array(which_g
);
1301 put_graphics_in_template();
1305 void add_terrain_to_wish_list(unsigned char ter
)
1307 if (terrain_pic
[ter
] >= 1000)
1309 else if (terrain_pic
[ter
] >= 400) {
1310 add_to_wish_list(600 + terrain_pic
[ter
]);
1311 add_to_wish_list(700 + terrain_pic
[ter
]);
1312 add_to_wish_list(800 + terrain_pic
[ter
]);
1313 add_to_wish_list(900 + terrain_pic
[ter
]);
1315 else switch (terrain_pic
[ter
]) {
1318 add_to_wish_list(230);
1319 add_to_wish_list(143);
1322 add_to_wish_list(213);
1323 add_to_wish_list(214);
1327 add_to_wish_list(215);
1328 add_to_wish_list(218);
1329 add_to_wish_list(219);
1330 add_to_wish_list(220);
1331 add_to_wish_list(221);
1334 add_to_wish_list(216);
1335 add_to_wish_list(222);
1336 add_to_wish_list(223);
1337 add_to_wish_list(224);
1338 add_to_wish_list(225);
1341 add_to_wish_list(68);
1342 add_to_wish_list(69);
1345 add_to_wish_list(86);
1346 add_to_wish_list(87);
1350 add_to_wish_list((short) terrain_pic
[ter
]);
1355 void load_outdoor_graphics()
1360 for (i
= 0; i
< 96; i
++)
1361 for (j
= 0; j
< 96; j
++)
1362 add_terrain_to_wish_list(out
[i
][j
]);
1364 for (l
= 0; l
< 2; l
++)
1365 for (m
= 0; m
< 2; m
++)
1366 for (i
= 0; i
< 4; i
++) {
1367 for (j
= 0; j
< 7; j
++)
1368 if (outdoors
[l
][m
].wandering
[i
].monst
[j
] != 0) {
1369 pict
= get_monst_picnum(outdoors
[l
][m
].wandering
[i
].monst
[j
]);
1370 //add_monst_graphic(pict,0);
1371 add_monst_graphic(outdoors
[l
][m
].wandering
[i
].monst
[j
],0);
1375 for (j
= 0; j
< 7; j
++)
1376 if (outdoors
[l
][m
].special_enc
[i
].monst
[j
] != 0) {
1377 pict
= get_monst_picnum(outdoors
[l
][m
].special_enc
[i
].monst
[j
]);
1378 //add_monst_graphic(pict,0);
1379 add_monst_graphic(outdoors
[l
][m
].special_enc
[i
].monst
[j
],0);
1384 for (i
= 0; i
< 10; i
++)
1385 if (party
.out_c
[i
].exists
== TRUE
)
1386 for (j
= 0; j
< 7; j
++)
1387 if (party
.out_c
[i
].what_monst
.monst
[j
] != 0) {
1388 pict
= get_monst_picnum(party
.out_c
[i
].what_monst
.monst
[j
]);
1389 //add_monst_graphic(pict, 0);
1390 add_monst_graphic(party
.out_c
[i
].what_monst
.monst
[j
], 0);
1395 // Returns TRUE if the picture given is unneeded, and can be discarded.
1396 /*Boolean monster_pict_not_needed(m_pict)
1404 for (i = 0; i < T_M; i++)
1405 if ((c_town.monst.dudes[i].active > 0) && (c_town.monst.dudes[i].m_d.picture_num == m_pict))
1408 if ((is_town()) || ((is_combat()) && (which_combat_type == 1))) {
1409 for (i = 0; i < 4; i++)
1410 for (j = 0; j < 4; j++)
1411 if (get_monst_picnum(c_town.town.wandering[i].monst[j]) == m_pict)
1417 // returns 50 is no room, returns 60 is already there, OW returns spot to put in
1418 /*short add_monst_to_template(m_num)
1419 unsigned char m_num;
1423 p_num = get_monst_picnum(m_num);
1426 for (i = 0; i < 21; i++)
1427 if (monster_index[i] == p_num)
1429 for (i = 0; i < 21; i++)
1430 if ((monster_index[i] == 150) || (monster_pict_not_needed(monster_index[i]) == TRUE)) {
1431 monster_index[i] = p_num;
1438 void add_monst_graphic(unsigned char m
,short mode
)
1439 // mode 0 - just put in list, 1 - actually add graphics
1442 get_monst_dims(m
,&x
,&y
);
1443 for (i
= 0; i
< x
* y
; i
++) {
1444 pict
= get_monst_picnum(m
);
1445 if (pict
>= NUM_MONST_G
)
1447 pict
= m_pic_index
[pict
];
1449 add_to_wish_list(300 + pict
+ i
);
1450 add_to_wish_list(600 + pict
+ i
);
1451 add_to_wish_list(2300 + pict
+ i
);
1452 add_to_wish_list(2600 + pict
+ i
);
1455 add_one_graphic(300 + pict
+ i
);
1456 add_one_graphic(600 + pict
+ i
);
1457 add_one_graphic(2300 + pict
+ i
);
1458 add_one_graphic(2600 + pict
+ i
);
1463 void load_town_graphics() // Setting up town monsters takes some finess, due to the flexibility
1465 // This can be used for town or beginning out outdoor combat
1469 for (i
= 0; i
< town_size
[town_type
]; i
++)
1470 for (j
= 0; j
< town_size
[town_type
]; j
++)
1472 add_terrain_to_wish_list(combat_terrain
[i
][j
]);
1473 else add_terrain_to_wish_list(t_d
.terrain
[i
][j
]);
1475 for (i
= 0; i
< T_M
; i
++)
1476 if ((c_town
.monst
.dudes
[i
].number
!= 0) && (c_town
.monst
.dudes
[i
].active
> 0))
1477 add_monst_graphic(c_town
.monst
.dudes
[i
].number
,0);
1479 for (i
= 0; i
< 4; i
++)
1480 for (j
= 0; j
< 4; j
++) {
1481 add_monst_graphic(c_town
.town
.wandering
[i
].monst
[j
],0);
1485 void update_pc_graphics()
1488 HBITMAP temp_gworld
;
1489 RECT template_rect
= {0,0,28,36}; /**/
1492 if (party_in_memory
== FALSE
)
1495 temp_gworld
= load_pict(902,main_dc
);
1497 for (i
= 0; i
< 6; i
++)
1498 if (adven
[i
].main_status
> 0)
1499 if (adven
[i
].which_graphic
!= which_graphic_index
[i
]) {
1500 template_rect
.left
= (i
/ 3) * 56;
1501 template_rect
.right
= template_rect
.left
+ 56;
1502 template_rect
.top
= (i
% 3) * 36;
1503 template_rect
.bottom
= template_rect
.top
+ 36;
1505 source_rect
.left
= (adven
[i
].which_graphic
/ 8) * 56;
1506 source_rect
.right
= source_rect
.left
+ 56;
1507 source_rect
.top
= 36 * (adven
[i
].which_graphic
% 8);
1508 source_rect
.bottom
= 36 * (adven
[i
].which_graphic
% 8) + 36;
1510 rect_draw_some_item(temp_gworld
,source_rect
,party_template_gworld
,template_rect
,0,0);
1512 OffsetRect(&source_rect
,280,0);
1513 OffsetRect(&template_rect
,0,108);
1514 rect_draw_some_item(temp_gworld
,source_rect
,party_template_gworld
,template_rect
,0,0);
1516 which_graphic_index
[i
] = adven
[i
].which_graphic
;
1518 DeleteObject (temp_gworld
);
1523 // This one is complicated, but that's because it's optimized for efficiency.
1524 // Goes through, and loads graphics for anything with storage_status of 3
1525 void put_graphics_in_template()
1527 HBITMAP temp_gworld
;
1528 short picture_number
,i
,j
,which_position
,offset
;
1529 Boolean this_graphic_needed
= FALSE
;
1530 RECT from_rect
,to_rect
;
1532 // First, load all terrains
1533 for (j
= 1; j
< 6; j
++) {
1534 for (i
= 50; i
< STORED_GRAPHICS
; i
++)
1535 if ((which_g_stored
[i
] >= j
* 50) && (which_g_stored
[i
] < j
* 50 + 50) &&
1536 (storage_status
[i
] == 3)) {
1537 this_graphic_needed
= TRUE
;
1539 if (this_graphic_needed
== TRUE
) {
1540 temp_gworld
= load_pict(800 + j
,main_dc
);
1541 for (i
= 50; i
< STORED_GRAPHICS
; i
++)
1542 if ((which_g_stored
[i
] >= j
* 50) && (which_g_stored
[i
] < j
* 50 + 50) &&
1543 (storage_status
[i
] == 3)) {
1544 which_position
= which_g_stored
[i
] - j
* 50;
1545 from_rect
= calc_rect(which_position
% 10,which_position
/ 10);
1546 to_rect
= calc_rect(i
% 10,i
/ 10);
1548 rect_draw_some_item(temp_gworld
,from_rect
,storage_gworld
,to_rect
,0,0);
1549 storage_status
[i
] = 1;
1551 DisposeGWorld (temp_gworld
);
1553 this_graphic_needed
= FALSE
;
1556 // Now, load all monsters
1557 for (j
= 0; j
< 10; j
++) {
1558 for (i
= 50; i
< STORED_GRAPHICS
; i
++)
1559 if ((which_g_stored
[i
] >= 300 + j
* 20) && (which_g_stored
[i
] < 300 + j
* 20 + 20) &&
1560 (storage_status
[i
] == 3))
1561 this_graphic_needed
= TRUE
;
1562 for (i
= 50; i
< STORED_GRAPHICS
; i
++)
1563 if ((which_g_stored
[i
] >= 600 + j
* 20) && (which_g_stored
[i
] < 600 + j
* 20 + 20) &&
1564 (storage_status
[i
] == 3))
1565 this_graphic_needed
= TRUE
;
1567 if (this_graphic_needed
== TRUE
) {
1568 temp_gworld
= load_pict(1100 + j
,main_dc
);
1569 for (i
= 50; i
< STORED_GRAPHICS
; i
++)
1570 if ((which_g_stored
[i
] >= 300 + j
* 20) && (which_g_stored
[i
] < 300 + j
* 20 + 20) &&
1571 (storage_status
[i
] == 3)) {
1572 which_position
= which_g_stored
[i
] % 20;
1573 from_rect
= calc_rect((which_position
/ 10) * 2,which_position
% 10);
1574 to_rect
= calc_rect(i
% 10,i
/ 10);
1576 rect_draw_some_item(temp_gworld
,from_rect
,storage_gworld
,to_rect
,0,0);
1578 storage_status
[i
] = 1;
1580 for (i
= 50; i
< STORED_GRAPHICS
; i
++)
1581 if ((which_g_stored
[i
] >= 600 + j
* 20) && (which_g_stored
[i
] < 600 + j
* 20 + 20) &&
1582 (storage_status
[i
] == 3)) {
1583 which_position
= which_g_stored
[i
] % 20;
1584 from_rect
= calc_rect((which_position
/ 10) * 2 + 1,which_position
% 10);
1585 to_rect
= calc_rect(i
% 10,i
/ 10);
1587 rect_draw_some_item(temp_gworld
,from_rect
,storage_gworld
,to_rect
,0,0);
1589 storage_status
[i
] = 1;
1591 DisposeGWorld (temp_gworld
);
1593 this_graphic_needed
= FALSE
;
1596 // Now, load all monster combat poses
1597 for (j
= 0; j
< 10; j
++) {
1598 for (i
= 50; i
< STORED_GRAPHICS
; i
++)
1599 if ((which_g_stored
[i
] >= 2300 + j
* 20) && (which_g_stored
[i
] < 2300 + j
* 20 + 20) &&
1600 (storage_status
[i
] == 3))
1601 this_graphic_needed
= TRUE
;
1602 for (i
= 50; i
< STORED_GRAPHICS
; i
++)
1603 if ((which_g_stored
[i
] >= 2600 + j
* 20) && (which_g_stored
[i
] < 2600 + j
* 20 + 20) &&
1604 (storage_status
[i
] == 3))
1605 this_graphic_needed
= TRUE
;
1607 if (this_graphic_needed
== TRUE
) {
1608 temp_gworld
= load_pict(1200 + j
,main_dc
);
1609 for (i
= 50; i
< STORED_GRAPHICS
; i
++)
1610 if ((which_g_stored
[i
] >= 2300 + j
* 20) && (which_g_stored
[i
] < 2300 + j
* 20 + 20) &&
1611 (storage_status
[i
] == 3)) {
1612 which_position
= which_g_stored
[i
] % 20;
1613 from_rect
= calc_rect((which_position
/ 10) * 2 + 4,which_position
% 10);
1614 to_rect
= calc_rect(i
% 10,i
/ 10);
1616 rect_draw_some_item(temp_gworld
,from_rect
,storage_gworld
,to_rect
,0,0);
1618 storage_status
[i
] = 1;
1620 for (i
= 50; i
< STORED_GRAPHICS
; i
++)
1621 if ((which_g_stored
[i
] >= 2600 + j
* 20) && (which_g_stored
[i
] < 2600 + j
* 20 + 20) &&
1622 (storage_status
[i
] == 3)) {
1623 which_position
= which_g_stored
[i
] % 20;
1624 from_rect
= calc_rect((which_position
/ 10) * 2 + 5,which_position
% 10);
1625 to_rect
= calc_rect(i
% 10,i
/ 10);
1627 rect_draw_some_item(temp_gworld
,from_rect
,storage_gworld
,to_rect
,0,0);
1629 storage_status
[i
] = 1;
1631 DisposeGWorld (temp_gworld
);
1633 this_graphic_needed
= FALSE
;
1637 // Now, anim terrains
1638 for (i
= 50; i
< STORED_GRAPHICS
; i
++)
1639 if ((which_g_stored
[i
] >= 1000) && (which_g_stored
[i
] < 1400) &&
1640 (storage_status
[i
] == 3))
1641 this_graphic_needed
= TRUE
;
1642 if (this_graphic_needed
== TRUE
) {
1643 temp_gworld
= load_pict(820,main_dc
);
1644 for (i
= 50; i
< STORED_GRAPHICS
; i
++)
1645 if ((which_g_stored
[i
] >= 1000) && (which_g_stored
[i
] < 1400) &&
1646 (storage_status
[i
] == 3)) {
1647 which_position
= which_g_stored
[i
] % 100;
1648 offset
= (which_g_stored
[i
] - 1000) / 100;
1649 from_rect
= calc_rect(4 * (which_position
/ 5) + offset
,which_position
% 5);
1650 to_rect
= calc_rect(i
% 10,i
/ 10);
1652 rect_draw_some_item(temp_gworld
,from_rect
,storage_gworld
,to_rect
,0,0);
1654 storage_status
[i
] = 1;
1656 DisposeGWorld (temp_gworld
);
1660 // this is used for determinign whether to round off walkway corners
1661 // right now, trying a restrictive rule (just cave floor and grass, mainly)
1662 Boolean
is_nature(char x
, char y
)
1665 unsigned char ter_type
;
1667 ter_type
= coord_to_ter((short) x
,(short) y
);
1668 pic
= scenario
.ter_types
[ter_type
].picture
;
1669 if ((pic
>= 0) && (pic
<= 45))
1671 if ((pic
>= 67) && (pic
<= 73))
1673 if ((pic
>= 75) && (pic
<= 87))
1675 if ((pic
>= 121) && (pic
<= 122))
1677 if ((pic
>= 179) && (pic
<= 208))
1679 if ((pic
>= 211) && (pic
<= 212))
1681 if ((pic
>= 217) && (pic
<= 246))
1689 void draw_terrain(short mode
)
1690 //mode ... if 1, don't place on screen after redoing
1691 // if 2, only redraw over active monst
1694 RECT target
,str_rect
;
1695 location where_draw
;
1696 location sector_p_in
,view_loc
;
1698 unsigned char spec_terrain
;
1699 Boolean off_terrain
= FALSE
,draw_trim
= TRUE
;
1700 short i
,j
,short_spec_terrain
;
1702 COLORREF colors
[5] = {RGB(0,0,0),RGB(255,0,0),RGB(128,0,0),RGB(0,160,0),RGB(255,255,255)};
1709 if (current_working_monster
< 0) return;
1710 supressing_some_spaces
= TRUE
;
1711 for (i
= 0; i
< 4; i
++) ok_space
[i
].x
= -1;
1712 if (current_working_monster
>= 100) {
1713 for (i
= 0; i
< c_town
.monst
.dudes
[current_working_monster
- 100].m_d
.x_width
; i
++)
1714 for (j
= 0; j
< c_town
.monst
.dudes
[current_working_monster
- 100].m_d
.y_width
; j
++) {
1715 ok_space
[i
+ 2 * j
].x
= c_town
.monst
.dudes
[current_working_monster
- 100].m_loc
.x
+ i
;
1716 ok_space
[i
+ 2 * j
].y
= c_town
.monst
.dudes
[current_working_monster
- 100].m_loc
.y
+ j
;
1717 ok_space
[i
+ 2 * j
].x
= ok_space
[i
+ 2 * j
].x
- center
.x
+ 4;
1718 ok_space
[i
+ 2 * j
].y
= ok_space
[i
+ 2 * j
].y
- center
.y
+ 4;
1721 if (current_working_monster
< 6) {
1722 ok_space
[0] = pc_pos
[current_working_monster
];
1723 ok_space
[0].x
= ok_space
[0].x
- center
.x
+ 4;
1724 ok_space
[0].y
= ok_space
[0].y
- center
.y
+ 4;
1729 for (i
= 0; i
< 13; i
++)
1730 for (j
= 0; j
< 13; j
++) {
1731 light_area
[i
][j
] = 0;unexplored_area
[i
][j
] = 0;
1734 last_redraw_time
= GetCurrentTime();
1735 sector_p_in
.x
= party
.outdoor_corner
.x
+ party
.i_w_c
.x
;
1736 sector_p_in
.y
= party
.outdoor_corner
.y
+ party
.i_w_c
.y
;
1738 anim_onscreen
= FALSE
;
1741 view_loc
= c_town
.p_loc
;
1743 view_loc
= pc_pos
[(current_pc
< 6) ? current_pc
: first_active_pc()];
1745 for (i
= 0; i
< 13; i
++)
1746 for (j
= 0; j
< 13; j
++) {
1747 where_draw
= (is_out()) ? party
.p_loc
: center
;
1748 where_draw
.x
+= i
- 6;
1749 where_draw
.y
+= j
- 6;
1750 if (is_out() == FALSE
)
1751 light_area
[i
][j
] = (is_town()) ? pt_in_light(view_loc
,where_draw
) : combat_pt_in_light(where_draw
);
1752 if ((is_out() == FALSE
) && ((where_draw
.x
< 0) || (where_draw
.x
> town_size
[town_type
] - 1)
1753 || (where_draw
.y
< 0) || (where_draw
.y
> town_size
[town_type
] - 1)))
1754 unexplored_area
[i
][j
] = 0;
1755 else unexplored_area
[i
][j
] = 1 - is_explored(where_draw
.x
,where_draw
.y
);
1759 for (q
= 0; q
< 9; q
++) {
1760 for (r
= 0; r
< 9; r
++)
1762 where_draw
= (is_out()) ? party
.p_loc
: center
;
1763 where_draw
.x
+= q
- 4;
1764 where_draw
.y
+= r
- 4;
1765 off_terrain
= FALSE
;
1768 if ((is_out() == FALSE
) && ((where_draw
.x
< 0) || (where_draw
.x
> town_size
[town_type
] - 1)
1769 || (where_draw
.y
< 0) || (where_draw
.y
> town_size
[town_type
] - 1))) {
1771 // Warning - this section changes where_draw
1772 if (where_draw
.x
< 0)
1774 if (where_draw
.x
> town_size
[town_type
] - 1)
1775 where_draw
.x
= town_size
[town_type
];
1776 if (where_draw
.y
< 0)
1778 if (where_draw
.y
> town_size
[town_type
] - 1)
1779 where_draw
.y
= town_size
[town_type
];
1780 if (can_see(view_loc
,where_draw
,0) < 5)
1785 else if (is_out()) {
1786 if ((where_draw
.x
< 0) || (where_draw
.x
> 95)
1787 || (where_draw
.y
< 0) || (where_draw
.y
> 95))
1790 spec_terrain
= out
[where_draw
.x
][where_draw
.y
];
1791 can_draw
= out_e
[where_draw
.x
][where_draw
.y
];
1794 else if (is_combat()) {
1796 spec_terrain
= combat_terrain
[where_draw
.x
][where_draw
.y
];
1797 if (cartoon_happening
== TRUE
)
1799 else can_draw
= (((is_explored(where_draw
.x
,where_draw
.y
)) ||
1800 (which_combat_type
== 0) || (monsters_going
== TRUE
) || (overall_mode
!= 10))
1801 && (party_can_see(where_draw
) < 6)) ? 1 : 0;
1805 spec_terrain
= t_d
.terrain
[where_draw
.x
][where_draw
.y
];
1806 can_draw
= is_explored(where_draw
.x
,where_draw
.y
);
1809 if (pt_in_light(c_town
.p_loc
,where_draw
) == FALSE
)
1812 if ((overall_mode
== 36) && (can_draw
== 0))
1813 can_draw
= (party_can_see(where_draw
) < 6) ? 1 : 0;
1815 spot_seen
[q
][r
] = can_draw
;
1818 if ((can_draw
!= 0) && (overall_mode
!= 50)) { // if can see, not a pit, and not resting
1819 if ((is_combat()) && (cartoon_happening
== FALSE
)) {
1823 short_spec_terrain
= spec_terrain
;
1825 // Finally, draw this terrain spot
1827 switch (short_spec_terrain
) {
1828 case 82: // cave wway
1829 if (loc_off_act_area(where_draw
) == FALSE
) {
1830 if ((is_nature(where_draw
.x
- 1,where_draw
.y
)) &&
1831 (is_nature(where_draw
.x
,where_draw
.y
- 1) ))
1832 short_spec_terrain
= 10219;
1833 if ((is_nature(where_draw
.x
+ 1,where_draw
.y
) ) &&
1834 (is_nature(where_draw
.x
,where_draw
.y
- 1) ))
1835 short_spec_terrain
= 10220;
1836 if ((is_nature(where_draw
.x
+ 1,where_draw
.y
) ) &&
1837 (is_nature(where_draw
.x
,where_draw
.y
+ 1) ))
1838 short_spec_terrain
= 10221;
1839 if ((is_nature(where_draw
.x
- 1,where_draw
.y
) ) &&
1840 (is_nature(where_draw
.x
,where_draw
.y
+ 1) ))
1841 short_spec_terrain
= 10218;
1843 draw_one_terrain_spot(q
,r
,short_spec_terrain
,0);
1845 case 83: // ground wway
1846 if (loc_off_act_area(where_draw
) == FALSE
) {
1847 if ((is_nature(where_draw
.x
- 1,where_draw
.y
)) &&
1848 (is_nature(where_draw
.x
,where_draw
.y
- 1)) )
1849 short_spec_terrain
= 10223;
1850 if ((is_nature(where_draw
.x
+ 1,where_draw
.y
) ) &&
1851 (is_nature(where_draw
.x
,where_draw
.y
- 1) ))
1852 short_spec_terrain
= 10224;
1853 if ((is_nature(where_draw
.x
+ 1,where_draw
.y
) ) &&
1854 (is_nature(where_draw
.x
,where_draw
.y
+ 1) ))
1855 short_spec_terrain
= 10225;
1856 if ((is_nature(where_draw
.x
- 1,where_draw
.y
) ) &&
1857 (is_nature(where_draw
.x
,where_draw
.y
+ 1) ))
1858 short_spec_terrain
= 10222;
1860 draw_one_terrain_spot(q
,r
,short_spec_terrain
,0);
1863 case 79: case 80: case 81:
1864 if ((short_spec_terrain
== 81)
1865 && ((out
[where_draw
.x
][where_draw
.y
- 1] == 80) || (out
[where_draw
.x
][where_draw
.y
- 1] == 79)))
1866 short_spec_terrain
= 42;
1867 if ((short_spec_terrain
== 81)
1868 && ((out
[where_draw
.x
][where_draw
.y
+ 1] == 80) || (out
[where_draw
.x
][where_draw
.y
+ 1] == 79)))
1869 short_spec_terrain
= 38;
1870 if ((short_spec_terrain
== 81)
1871 && ((out
[where_draw
.x
- 1][where_draw
.y
] == 80) || (out
[where_draw
.x
- 1][where_draw
.y
] == 79)))
1872 short_spec_terrain
= 44;
1873 if ((short_spec_terrain
== 81)
1874 && ((out
[where_draw
.x
+ 1][where_draw
.y
] == 80) || (out
[where_draw
.x
+ 1][where_draw
.y
] == 79)))
1875 short_spec_terrain
= 40;
1876 /*if ((short_spec_terrain == 81)
1877 && ((out[where_draw.x][where_draw.y - 1] != 234) && (out[where_draw.x][where_draw.y - 1] != 81) &&
1878 ((out[where_draw.x][where_draw.y - 1] < 36) || (out[where_draw.x][where_draw.y - 1] > 49))))
1879 short_spec_terrain = 42;
1880 if ((short_spec_terrain == 81)
1881 && ((out[where_draw.x][where_draw.y + 1] != 234) && (out[where_draw.x][where_draw.y + 1] != 81) &&
1882 ((out[where_draw.x][where_draw.y + 1] < 36) || (out[where_draw.x][where_draw.y + 1] > 49))))
1883 short_spec_terrain = 38;
1884 if ((short_spec_terrain == 81)
1885 && ((out[where_draw.x - 1][where_draw.y] != 234) &&(out[where_draw.x - 1][where_draw.y] != 81) &&
1886 ((out[where_draw.x - 1][where_draw.y] < 36) || (out[where_draw.x - 1][where_draw.y] > 49))))
1887 short_spec_terrain = 44;
1888 if ((short_spec_terrain == 81)
1889 && ((out[where_draw.x + 1][where_draw.y] != 234) && (out[where_draw.x + 1][where_draw.y] != 81) &&
1890 ((out[where_draw.x + 1][where_draw.y] < 36) || (out[where_draw.x + 1][where_draw.y] > 49))))
1891 short_spec_terrain = 40;*/
1892 draw_one_terrain_spot(q
,r
,short_spec_terrain
,0);
1893 place_road(q
,r
,where_draw
);
1896 draw_one_terrain_spot(q
,r
,-1,0);
1899 if (short_spec_terrain
< 2)
1901 if ((short_spec_terrain
== 2) || (
1902 (short_spec_terrain
>= 22) && (short_spec_terrain
<= 49)))
1904 draw_one_terrain_spot(q
,r
,short_spec_terrain
,0);
1909 else { // Can't see. Place darkness.
1910 draw_one_terrain_spot(q
,r
,-1,0);
1913 if ((can_draw
!= 0) && (overall_mode
!= 50) && (frills_on
== TRUE
)
1914 && (draw_trim
== TRUE
) && (cartoon_happening
== FALSE
)) { // Place the trim
1915 place_trim((short) q
,(short) r
,where_draw
,spec_terrain
);
1920 if ((overall_mode
!= 50) && (!is_out()))
1924 if ((overall_mode
> 0) && (overall_mode
!= 35) && (overall_mode
!= 50))
1928 if ((overall_mode
!= 50) && (!is_out())) {
1933 // Not camping. Place misc. shit.
1934 if (overall_mode
!= 50) {
1936 draw_outd_boats(party
.p_loc
);
1937 else if ((is_town()) || (which_combat_type
== 1))
1938 draw_town_boat(center
);
1943 if ((overall_mode
< 10) || (overall_mode
== 35) || ((overall_mode
== 36) && (point_onscreen(c_town
.p_loc
,center
) == TRUE
))
1944 || (overall_mode
== 50))
1945 draw_party_symbol(mode
,center
);
1946 else if (overall_mode
!= 36)
1951 apply_unseen_mask();
1956 if (cartoon_happening
== FALSE
) {
1958 if ((overall_mode
> 9) && (overall_mode
!= 35) && (overall_mode
!= 36) && (overall_mode
!= 50))
1960 if (overall_mode
== 14)
1961 draw_targets(center
);
1968 supressing_some_spaces
= FALSE
;
1971 void place_trim(short q
,short r
,location where
,unsigned char ter_type
)
1973 Boolean at_top
= FALSE
,at_bot
= FALSE
,at_left
= FALSE
,at_right
= FALSE
;
1974 unsigned char store
,store2
,store3
,store1
;
1978 // FIrst quick check ... if a pit or barrier in outdoor combat, no trim
1979 if ((is_combat()) && (which_combat_type
== 0) && (ter_type
== 86))
1981 if (PSD
[296][0] > 0)
1986 if ((supressing_some_spaces
== TRUE
) &&
1987 (same_point(targ
,ok_space
[0]) == FALSE
) &&
1988 (same_point(targ
,ok_space
[1]) == FALSE
) &&
1989 (same_point(targ
,ok_space
[2]) == FALSE
) &&
1990 (same_point(targ
,ok_space
[3]) == FALSE
))
1998 if ((overall_mode
== 0) || (overall_mode
== 35)) {
2005 if (where
.x
== town_size
[town_type
])
2007 if (where
.y
== town_size
[town_type
])
2011 // First, trim for fluids
2012 if (((is_town()) || (is_combat())) && (town_trim
[where
.x
][where
.y
] != 0)) {
2014 if (town_trim
[where
.x
][where
.y
] & 1)
2016 if (town_trim
[where
.x
][where
.y
] & 2)
2018 if (town_trim
[where
.x
][where
.y
] & 4)
2020 if (town_trim
[where
.x
][where
.y
] & 8)
2022 if (town_trim
[where
.x
][where
.y
] & 16)
2024 if (town_trim
[where
.x
][where
.y
] & 32)
2026 if (town_trim
[where
.x
][where
.y
] & 64)
2028 if (town_trim
[where
.x
][where
.y
] & 128)
2031 if ((is_out()) && (out_trim
[where
.x
][where
.y
] != 0)) {
2032 if (out_trim
[where
.x
][where
.y
] & 1)
2034 if (out_trim
[where
.x
][where
.y
] & 2)
2036 if (out_trim
[where
.x
][where
.y
] & 4)
2038 if (out_trim
[where
.x
][where
.y
] & 8)
2040 if (out_trim
[where
.x
][where
.y
] & 16)
2042 if (out_trim
[where
.x
][where
.y
] & 32)
2044 if (out_trim
[where
.x
][where
.y
] & 64)
2046 if (out_trim
[where
.x
][where
.y
] & 128)
2051 if (((ter_type
>= 100) && (ter_type
<= 137)) && (at_top
== FALSE
) &&
2052 (at_bot
== FALSE
) && (at_left
== FALSE
) && (at_right
== FALSE
)) {
2053 store
= get_t_t(where
.x
- 1,where
.y
);
2054 store1
= get_t_t(where
.x
,where
.y
- 1);
2055 store2
= get_t_t(where
.x
+ 1,where
.y
);
2056 store3
= get_t_t(where
.x
,where
.y
+ 1);
2057 if ((is_wall(store
) == TRUE
)
2058 && (is_wall(store1
) == TRUE
) &&
2059 (is_ground(store2
) == TRUE
)
2060 && (is_ground(store3
) == TRUE
))
2063 if ((is_wall(store
) == TRUE
)
2064 && (is_wall(store3
) == TRUE
) &&
2065 (is_ground(store2
) == TRUE
)
2066 && (is_ground(store1
) == TRUE
))
2069 if ((is_wall(store2
) == TRUE
)
2070 && (is_wall(store1
) == TRUE
) &&
2071 (is_ground(store
) == TRUE
)
2072 && (is_ground(store3
) == TRUE
))
2075 if ((is_wall(store2
) == TRUE
)
2076 && (is_wall(store3
) == TRUE
) &&
2077 (is_ground(store
) == TRUE
)
2078 && (is_ground(store1
) == TRUE
))
2082 if ((is_ground(store
) == TRUE
)
2083 && (is_ground(store1
) == TRUE
) &&
2084 (is_ground(store2
) == TRUE
)
2085 && (is_wall(store3
) == TRUE
)) {
2090 if ((is_wall(store
) == TRUE
)
2091 && (is_ground(store3
) == TRUE
) &&
2092 (is_ground(store2
) == TRUE
)
2093 && (is_ground(store1
) == TRUE
)) {
2098 if ((is_ground(store2
) == TRUE
)
2099 && (is_wall(store1
) == TRUE
) &&
2100 (is_ground(store
) == TRUE
)
2101 && (is_ground(store3
) == TRUE
)) {
2106 if ((is_wall(store2
) == TRUE
)
2107 && (is_ground(store3
) == TRUE
) &&
2108 (is_ground(store
) == TRUE
)
2109 && (is_ground(store1
) == TRUE
)) {
2116 void draw_trim(short q
,short r
,short which_trim
,short which_mode
)
2117 //which_trim is 3 -> drawing wall trim -> might shift down if ground is grass
2118 //short which_mode; // 0 top 1 bottom 2 left 3 right 4 up left 5 up right 6 down right 7 down left
2120 RECT from_rect
= {0,0,28,36},to_rect
;
2123 if (frills_on
== FALSE
)
2126 // if current ground is grass, forget trim
2127 if ((current_ground
== 2) && (which_trim
< 3))
2130 terrain_there
[q
][r
] = -1;
2132 from_rect
.left
= 28 * which_trim
+ trim_rects
[which_mode
].left
;
2133 from_rect
.right
= 28 * which_trim
+ trim_rects
[which_mode
].right
;
2134 from_rect
.top
= trim_rects
[which_mode
].top
;
2135 from_rect
.bottom
= trim_rects
[which_mode
].bottom
;
2137 if ((which_trim
== 3) && (current_ground
== 2)) // trim corner walls with grass instead of cave floor
2138 OffsetRect(&from_rect
,0,36);
2139 to_rect
= coord_to_rect(q
,r
);
2140 to_rect
.right
= to_rect
.left
+ trim_rects
[which_mode
].right
;
2141 to_rect
.left
= to_rect
.left
+ trim_rects
[which_mode
].left
;
2142 to_rect
.bottom
= to_rect
.top
+ trim_rects
[which_mode
].bottom
;
2143 to_rect
.top
= to_rect
.top
+ trim_rects
[which_mode
].top
;
2144 OffsetRect(&to_rect
,-61,-37);
2146 rect_draw_some_item(mixed_gworld
,from_rect
,terrain_screen_gworld
,to_rect
,1,0);
2150 Boolean
extend_road_terrain(unsigned char ter
)
2153 short extend_pics
[39] = {61,62,63,64,65, 66,401,402,406,202,
2154 203,204,215,216,90, 91,92,93,102,103,
2155 104,105,112,113,114, 115,187,188,189,190,
2156 192,193,194,195,196, 197,191,200,201};
2158 for (i
= 0; i
< 39; i
++)
2159 if (scenario
.ter_types
[ter
].picture
== extend_pics
[i
])
2164 void place_road(short q
,short r
,location where
)
2169 RECT road_rects
[2] = {{112,76,125,80},{144,72,148,90}}; // 0 - rl partial 1 - ud partial
2170 RECT road_dest_rects
[4] = {{12,0,16,18},{15,16,28,20},{12,18,16,36},{0,16,13,20}}; // top right bottom left
2173 draw_loc
.x
= q
; draw_loc
.y
= r
;
2175 terrain_there
[q
][r
] = -1;
2178 ter
= coord_to_ter(where
.x
,where
.y
- 1);
2179 if ((where
.y
== 0) || (extend_road_terrain(ter
) == TRUE
)) {
2180 to_rect
= road_dest_rects
[0];
2181 OffsetRect(&to_rect
,13 + q
* 28,13 + r
* 36);
2182 rect_draw_some_item (fields_gworld
, road_rects
[1], terrain_screen_gworld
, to_rect
, 0, 0);
2185 if (((is_out()) && (where
.x
< 96)) || (!(is_out()) && (where
.x
< town_size
[town_type
] - 1)))
2186 ter
= coord_to_ter(where
.x
+ 1,where
.y
);
2187 if (((is_out()) && (where
.x
== 96)) || (!(is_out()) && (where
.x
== town_size
[town_type
] - 1))
2188 || (extend_road_terrain(ter
) == TRUE
)) {
2189 to_rect
= road_dest_rects
[1];
2190 OffsetRect(&to_rect
,13 + q
* 28,13 + r
* 36);
2191 rect_draw_some_item (fields_gworld
, road_rects
[0], terrain_screen_gworld
, to_rect
, 0, 0);
2194 if (((is_out()) && (where
.y
< 96)) || (!(is_out()) && (where
.y
< town_size
[town_type
] - 1)))
2195 ter
= coord_to_ter(where
.x
,where
.y
+ 1);
2196 if (((is_out()) && (where
.y
== 96)) || (!(is_out()) && (where
.y
== town_size
[town_type
] - 1))
2197 || (extend_road_terrain(ter
) == TRUE
)) {
2198 to_rect
= road_dest_rects
[2];
2199 OffsetRect(&to_rect
,13 + q
* 28,13 + r
* 36);
2200 rect_draw_some_item (fields_gworld
, road_rects
[1], terrain_screen_gworld
, to_rect
, 0, 0);
2204 ter
= coord_to_ter(where
.x
- 1,where
.y
);
2205 if ((where
.x
== 0) || (extend_road_terrain(ter
) == TRUE
)) {
2206 to_rect
= road_dest_rects
[3];
2207 OffsetRect(&to_rect
,13 + q
* 28,13 + r
* 36);
2208 rect_draw_some_item (fields_gworld
, road_rects
[0], terrain_screen_gworld
, to_rect
, 0, 0);
2213 void draw_rest_screen()
2217 store_mode
= overall_mode
;
2220 overall_mode
= store_mode
;
2223 void pre_boom_space(location where
,short mode
,short type
,short damage
,short sound
)
2224 // if mode is 100, force
2225 //short type; // 0 - flame 1 - magic 2 - poison 3 - blood 4 - cold
2226 // 10s digit indicates sound 0 - normal ouch 1 - small sword 2 - loud sword
2227 // 3 - pole 4 - club 5 - fireball hit 6 - squish 7 - cold
2228 // 8 - acid 9 - claw 10 - bite 11 - slime 12 - zap 13 - missile hit
2230 location where_draw
= {4,4};
2231 RECT source_rect
= {0,0,28,36},text_rect
,dest_rect
= {13,13,41,49},big_to
= {13,13,265,337},store_rect
;
2235 short del_len
,r1
,sound_key
;
2237 short x_adj
= 0,y_adj
= 0,which_m
;
2238 short sound_to_play
[20] = {97,69,70,71,72, 73,55,75,42,86,
2239 87,88,89,98,0, 0,0,0,0,0};
2240 RECT mixed_square
= {353,169,381,205};
2242 sound_key
= type
/ 10;
2245 // if ((cartoon_happening == TRUE) && (anim_step < 140))
2247 if ((cartoon_happening
== FALSE
) && ((mode
!= 100) && (party_can_see(where
) == 6)))
2249 if ((type
< 0) || (type
> 4))
2251 if ((boom_anim_active
== TRUE
) && (type
!= 3))
2253 if ((cartoon_happening
== FALSE
) && (PSD
[306][2] > 0) && (fast_bang
== TRUE
))
2258 // Redraw terrain in proper position
2259 if ((((point_onscreen(center
,where
) == FALSE
) && (overall_mode
>= 10)) || (overall_mode
== 0))
2261 play_sound(sound_to_play
[sound
]);
2265 else if (is_combat()) {
2266 if (which_combat_type
== 1)
2268 else draw_terrain(0);
2270 else if (fast_bang
< 2) {
2276 boom_space(where
,mode
,type
,damage
,sound
);
2279 void boom_space(location where
,short mode
,short type
,short damage
,short sound
)
2280 // if mode is 100, force
2281 //short type; // 0 - flame 1 - magic 2 - poison 3 - blood 4 - cold
2282 // 10s digit indicates sound 0 - normal ouch 1 - small sword 2 - loud sword
2283 // 3 - pole 4 - club 5 - fireball hit 6 - squish 7 - cold
2284 // 8 - acid 9 - claw 10 - bite 11 - slime 12 - zap 13 - missile hit
2286 location where_draw
= {4,4};
2287 RECT source_rect
= {0,0,28,36},text_rect
,dest_rect
= {13,13,41,49},big_to
= {13,13,265,337},store_rect
;
2291 short del_len
,r1
,sound_key
;
2293 short x_adj
= 0,y_adj
= 0,which_m
;
2294 RECT mixed_square
= {353,169,381,205};
2295 short sound_to_play
[20] = {97,69,70,71,72, 73,55,75,42,86,
2296 87,88,89,98,0, 0,0,0,0,0};
2298 sound_key
= type
/ 10;
2301 where_draw
.x
= where
.x
- center
.x
+ 4;
2302 where_draw
.y
= where
.y
- center
.y
+ 4;
2303 // source_rect.left += 28 * type;
2304 // source_rect.right += 28 * type;
2306 // adjust for possible big monster
2307 which_m
= monst_there(where
);
2309 x_adj
+= 14 * (c_town
.monst
.dudes
[which_m
].m_d
.x_width
- 1);
2310 y_adj
+= 18 * (c_town
.monst
.dudes
[which_m
].m_d
.y_width
- 1);
2312 OffsetRect(&dest_rect
,where_draw
.x
* 28,where_draw
.y
* 36);
2313 terrain_from
= dest_rect
;
2314 source_rect
= store_rect
= dest_rect
;
2315 OffsetRect(&dest_rect
,x_adj
,y_adj
);
2316 SectRect(&dest_rect
,&big_to
,&dest_rect
);
2318 if (cartoon_happening
== FALSE
)
2319 OffsetRect(&dest_rect
,win_to_rects
[0].left
,win_to_rects
[0].top
);
2320 else if (store_anim_type
== 0)
2321 OffsetRect(&dest_rect
,306,5);
2322 else OffsetRect(&dest_rect
,store_anim_ul
.x
,store_anim_ul
.y
);
2324 OffsetRect(&source_rect
,-1 * store_rect
.left
+ 28 * type
,-1 * store_rect
.top
);
2325 // rect_draw_some_item(fields_gworld,source_rect,terrain_screen_gworld,dest_rect,1,1);
2326 // print_nums(0,source_rect.left,source_rect.top);
2327 // print_nums(1,dest_rect.left,dest_rect.top);
2329 OffsetRect(&terrain_from
,x_adj
,y_adj
);
2330 rect_draw_some_item(terrain_screen_gworld
,terrain_from
,mixed_gworld
,mixed_square
,0,0);
2331 rect_draw_some_item(fields_gworld
,source_rect
,mixed_gworld
,mixed_square
,1,0);
2332 rect_draw_some_item(mixed_gworld
,mixed_square
,mixed_gworld
,dest_rect
,0,1);
2334 if ((cartoon_happening
== FALSE
) && (dest_rect
.right
- dest_rect
.left
>= 28)
2335 && (dest_rect
.bottom
- dest_rect
.top
>= 36)) {
2336 sprintf((char *) dam_str
,"%d",damage
);
2337 text_rect
= dest_rect
;
2338 text_rect
.top
+= 10;
2339 if ((damage
< 10) && (dest_rect
.right
- dest_rect
.left
> 19))
2340 text_rect
.left
+= 2;
2341 OffsetRect(&text_rect
,-4,-5);
2342 //char_win_draw_string(main_dc,text_rect,(char *) dam_str,1,10);
2343 if ((type
== 1) || (type
== 4))
2344 WinBlackDrawString(dam_str
,text_rect
.left
+ 12,text_rect
.top
+ 6);
2345 else WinDrawString(dam_str
,text_rect
.left
+ 12,text_rect
.top
+ 6);
2347 play_sound(sound_to_play
[sound
]);
2348 if ((sound
== 6) && (fast_bang
== 0))
2352 if (fast_bang
== 0) {
2353 del_len
= PSD
[306][6] * 3 + 4;
2354 if (play_sounds
== FALSE
)
2355 Delay(del_len
, &dummy
);
2358 if ((cartoon_happening
== FALSE
) && (overall_mode
> 9) && (overall_mode
!= 35) && (overall_mode
!= 36) && (overall_mode
!= 50))
2363 void draw_pointing_arrows()
2365 RECT sources
[4] = {{65,46,73,54},{56,46,64,54},{56,37,64,45},{65,37,73,45}};
2366 RECT dests
[8] = {{7,100,15,108},{7,170,15,178},{140,7,148,15},{212,7,220,15},
2367 {346,100,354,108},{346,170,354,178},{140,274,148,282},{212,274,220,282}};
2368 // rects modified below
2371 for (i
= 0; i
< 4; i
++)
2372 alter_rect(&sources
[i
]);
2373 for (i
= 0; i
< 8; i
++)
2374 alter_rect(&dests
[i
]);
2375 if ((monsters_going
== TRUE
) || (overall_mode
<= 1) || (overall_mode
<= 10)
2376 || (overall_mode
== 35))
2378 for (i
= 0; i
< 4; i
++) {
2379 rect_draw_some_item (mixed_gworld
,sources
[i
],mixed_gworld
,dests
[i
* 2],1,1);
2380 rect_draw_some_item (mixed_gworld
,sources
[i
],mixed_gworld
,dests
[i
* 2 + 1],1,1);
2384 void redraw_terrain()
2387 RECT ter_scrn_rect
= {0,0,279,351};
2389 if (cartoon_happening
== FALSE
)
2390 to_rect
= win_to_rects
[0];
2392 to_rect
= ter_scrn_rect
;
2393 if (store_anim_type
== 0)
2394 OffsetRect(&to_rect
,306,5);
2395 else OffsetRect(&to_rect
,store_anim_ul
.x
,store_anim_ul
.y
);
2397 rect_draw_some_item (terrain_screen_gworld
, win_from_rects
[0], terrain_screen_gworld
, to_rect
, 0, 1);
2401 draw_pointing_arrows();
2407 void draw_targets(location center
)
2409 RECT source_rect
= {36,74,47,85},dest_rect
; /**/
2410 location target
= {4,4};
2412 short dir_array
[8] = {0,3,3,3,2,1,1,1};
2414 if (party_toast() == TRUE
)
2417 for (i
= 0; i
< 8; i
++)
2418 if ((spell_targets
[i
].x
!= 120) && (point_onscreen(center
,spell_targets
[i
]) == TRUE
)) {
2419 dest_rect
= coord_to_rect(spell_targets
[i
].x
- center
.x
+ 4,spell_targets
[i
].y
- center
.y
+ 4);
2420 OffsetRect(&dest_rect
,5,5);
2421 InflateRect(&dest_rect
,-8,-12);
2422 rect_draw_some_item (mixed_gworld
,source_rect
,mixed_gworld
,dest_rect
,1,1);
2427 void draw_targeting_line(POINT where_curs
)
2429 location which_space
,store_loc
;
2432 RECT redraw_rect
,redraw_rect2
,terrain_rect
= {0,0,279,351},target_rect
;
2434 RECT on_screen_terrain_area
= {18, 18, 269,341};
2436 HPEN white_pen
,store_pen
;
2437 static LOGPEN white_pen_data
= {PS_SOLID
,2,2,RGB(255,255,255)};
2438 COLORREF colors
[2] = {RGB(0,0,0),RGB(255,255,255)},storec
;
2441 if (party
.stuff_done
[305][6] > 0)
2444 c
[0] = GetNearestPaletteIndex(hpal
,colors
[0]);
2445 c
[1] = GetNearestPaletteIndex(hpal
,colors
[1]);
2447 if (overall_mode
>= 10)
2448 from_loc
= pc_pos
[current_pc
];
2449 else from_loc
= c_town
.p_loc
;
2450 if ((overall_mode
== 11) || (overall_mode
== 12) || (overall_mode
== 13) || (overall_mode
== 14)
2451 || ((overall_mode
== 3) && (current_pat
.pattern
[4][4] != 0))) {
2453 OffsetRect(&on_screen_terrain_area
,ulx
,uly
);
2454 OffsetRect(&terrain_rect
,18,18);
2455 if (PtInRect (&on_screen_terrain_area
,where_curs
) == TRUE
) {
2456 // && (point_onscreen(center,pc_pos[current_pc]) == TRUE)){
2457 i
= (where_curs
.x
- 18 - ulx
) / 28;
2458 j
= (where_curs
.y
- 18 - uly
) / 36;
2459 which_space
.x
= center
.x
+ (short) i
- 4;
2460 which_space
.y
= center
.y
+ (short) j
- 4;
2462 k
= (short) (from_loc
.x
- center
.x
+ 4);
2463 l
= (short) (from_loc
.y
- center
.y
+ 4);
2464 k
= (k
* 28) + 32 ;//+ ulx;
2467 if ((loc_off_act_area(which_space
) == FALSE
) &&
2468 (can_see(from_loc
,which_space
,0) < 5)
2469 && (dist(from_loc
,which_space
) <= current_spell_range
)) {
2470 SetViewportOrg( main_dc
,ulx
,uly
);
2471 white_pen
= CreatePenIndirect(&white_pen_data
);
2472 store_pen
= SelectObject(main_dc
,white_pen
);
2474 //InsetRect(&terrain_rect,13,13);
2475 //OffsetRect(&terrain_rect,5 + ulx,5 + uly);
2476 OffsetRect(&on_screen_terrain_area
,-1 * ulx
,-1 * uly
);
2477 ClipRect(&on_screen_terrain_area
);
2478 MoveTo(main_dc
,where_curs
.x
- ulx
,where_curs
.y
- uly
);
2479 LineTo(main_dc
,k
,l
);
2481 redraw_rect
.left
= min(where_curs
.x
,k
) - 4;
2482 redraw_rect
.right
= max(where_curs
.x
,k
) + 4;
2483 redraw_rect
.top
= min(where_curs
.y
,l
) - 4;
2484 redraw_rect
.bottom
= max(where_curs
.y
,l
) + 4;
2485 //IntersectRect(&redraw_rect2,&redraw_rect,&terrain_rect);
2486 //OffsetRect(&on_screen_terrain_area,ulx,uly);
2487 IntersectRect(&redraw_rect2
,&redraw_rect
,&on_screen_terrain_area
);
2489 // Now place targeting pattern
2490 for (i
= 0; i
< 9; i
++)
2491 for (j
= 0; j
< 9; j
++) {
2492 store_loc
.x
= center
.x
+ i
- 4;
2493 store_loc
.y
= center
.y
+ j
- 4;
2494 if ((a_v(store_loc
.x
- which_space
.x
) <= 4) &&
2495 (a_v(store_loc
.y
- which_space
.y
) <= 4) &&
2496 (current_pat
.pattern
[store_loc
.x
- which_space
.x
+ 4][store_loc
.y
- which_space
.y
+ 4] != 0)) {
2497 target_rect
.left
= 13 + BITMAP_WIDTH
* i
+ 5;// + ulx;
2498 target_rect
.right
= target_rect
.left
+ BITMAP_WIDTH
;
2499 target_rect
.top
= 13 + BITMAP_HEIGHT
* j
+ 5;// + uly;
2500 target_rect
.bottom
= target_rect
.top
+ BITMAP_HEIGHT
;
2502 MoveTo(main_dc
,target_rect
.left
,target_rect
.top
);
2503 LineTo(main_dc
,target_rect
.right
,target_rect
.top
);
2504 LineTo(main_dc
,target_rect
.right
,target_rect
.bottom
);
2505 LineTo(main_dc
,target_rect
.left
,target_rect
.bottom
);
2506 LineTo(main_dc
,target_rect
.left
,target_rect
.top
);
2508 InflateRect(&target_rect
,5,5);
2509 UnionRect(&redraw_rect2
,&target_rect
,&redraw_rect2
);
2511 // Now place number of shots left, if drawing center of target
2512 if ((overall_mode
== 14) && (store_loc
.x
- which_space
.x
+ 4 == 4)
2513 && (store_loc
.y
- which_space
.y
+ 4 == 4)) {
2514 storec
= GetTextColor(main_dc
);
2515 SetTextColor(main_dc
,PALETTEINDEX(c
[1]));
2516 sprintf((char *) dam_str
,"%d ",num_targets_left
);
2517 DrawText(main_dc
,dam_str
,-1,&target_rect
,DT_SINGLELINE
| DT_VCENTER
| DT_CENTER
);
2518 //WinDrawString(dam_str,((target_rect.left + target_rect.right) / 2) - 3,
2519 // (target_rect.top + target_rect.bottom) / 2);
2520 SetTextColor(main_dc
,storec
);
2525 SelectObject(main_dc
,store_pen
);
2526 DeleteObject(white_pen
);
2530 InflateRect(&redraw_rect2
,5,5);
2531 redraw_partial_terrain(redraw_rect2
);
2535 else draw_party_symbol(0,center
);
2536 if (overall_mode
== 14)
2537 draw_targets(center
);
2544 Boolean
party_toast()
2548 for (i
= 0; i
< 6; i
++)
2549 if (adven
[i
].main_status
== 1)
2554 void redraw_partial_terrain(RECT redraw_rect
)
2558 from_rect
= redraw_rect
;
2559 //OffsetRect(&from_rect,-1 * ulx,-1 * uly);
2561 OffsetRect(&redraw_rect
,5, 5);
2563 rect_draw_some_item(terrain_screen_gworld
,from_rect
,terrain_screen_gworld
,redraw_rect
,0,1);
2568 // This tells the dialog engine to kill the dialog, and refreshes the screen
2569 // will probably need to be modified for windows
2570 void final_process_dialog(short which_dlog
)
2573 cd_kill_dialog(which_dlog
,0);
2575 if (in_startup_mode
== FALSE
)
2577 else draw_startup(0);