1 | /********************************************************************** <BR>
|
---|
2 | This file is part of Crack dot Com's free source code release of
|
---|
3 | Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
|
---|
4 | information about compiling & licensing issues visit this URL</a>
|
---|
5 | <PRE> If that doesn't help, contact Jonathan Clark at
|
---|
6 | golgotha_source@usa.net (Subject should have "GOLG" in it)
|
---|
7 | ***********************************************************************/
|
---|
8 |
|
---|
9 | #include "cwin_man.hh"
|
---|
10 | #include "resources.hh"
|
---|
11 | #include "controller.hh"
|
---|
12 | #include "border_frame.hh"
|
---|
13 | #include "map_view.hh"
|
---|
14 | #include "player.hh"
|
---|
15 | #include "image/image.hh"
|
---|
16 | #include "window/win_evt.hh"
|
---|
17 | #include "device/kernel.hh"
|
---|
18 | #include "window/style.hh"
|
---|
19 | #include "gui/deco_win.hh"
|
---|
20 | #include "map.hh"
|
---|
21 | #include "r1_win.hh"
|
---|
22 | #include "g1_render.hh"
|
---|
23 | #include "objs/stank.hh"
|
---|
24 | #include "saver.hh"
|
---|
25 | #include "math/pi.hh"
|
---|
26 | #include "device/key_man.hh"
|
---|
27 | #include "input.hh"
|
---|
28 | #include "map_man.hh"
|
---|
29 | #include "lisp/lisp.hh"
|
---|
30 |
|
---|
31 | g1_cwin_man_class *g1_cwin_man=0;
|
---|
32 |
|
---|
33 |
|
---|
34 |
|
---|
35 | void g1_change_key_context(w8 view_mode)
|
---|
36 | {
|
---|
37 | switch (view_mode)
|
---|
38 | {
|
---|
39 | case G1_EDIT_MODE :
|
---|
40 | i4_key_man.set_context("editor"); break;
|
---|
41 |
|
---|
42 | case G1_STRATEGY_MODE :
|
---|
43 | i4_key_man.set_context("strategy"); break;
|
---|
44 |
|
---|
45 | case G1_ACTION_MODE :
|
---|
46 | i4_key_man.set_context("action"); break;
|
---|
47 |
|
---|
48 | case G1_FOLLOW_MODE :
|
---|
49 | i4_key_man.set_context("follow"); break;
|
---|
50 |
|
---|
51 | case G1_WATCH_MODE :
|
---|
52 | i4_key_man.set_context("strategy"); break;
|
---|
53 | }
|
---|
54 | }
|
---|
55 |
|
---|
56 |
|
---|
57 |
|
---|
58 |
|
---|
59 | void g1_cwin_man_class::save_views(g1_saver_class *fp)
|
---|
60 | {
|
---|
61 | fp->mark_section("Game view setting V1");
|
---|
62 | view_state.save(fp);
|
---|
63 | }
|
---|
64 |
|
---|
65 | void g1_cwin_man_class::load_views(g1_loader_class *fp)
|
---|
66 | {
|
---|
67 | if (fp && !fp->goto_section("Game view setting V1"))
|
---|
68 | fp=0; // load defaults if not in file
|
---|
69 |
|
---|
70 | view_state.load(fp);
|
---|
71 | }
|
---|
72 |
|
---|
73 |
|
---|
74 | void g1_cwin_man_class::init(i4_parent_window_class *_parent,
|
---|
75 | i4_graphical_style_class *_style,
|
---|
76 | i4_image_class *_root_image,
|
---|
77 | i4_display_class *display,
|
---|
78 | i4_window_manager_class *wm)
|
---|
79 | {
|
---|
80 | style=_style;
|
---|
81 | parent=_parent;
|
---|
82 | root_image=_root_image;
|
---|
83 | pal=_root_image->get_pal();
|
---|
84 | }
|
---|
85 |
|
---|
86 | g1_cwin_man_class::g1_cwin_man_class()
|
---|
87 | {
|
---|
88 | parent=0;
|
---|
89 | root_image=0;
|
---|
90 | style=0;
|
---|
91 | }
|
---|
92 |
|
---|
93 | void g1_cwin_man_class::create_views()
|
---|
94 |
|
---|
95 | {
|
---|
96 | if (!g1_border.get())
|
---|
97 | {
|
---|
98 | g1_strategy_screen=new g1_strategy_screen_class();
|
---|
99 |
|
---|
100 | g1_border = new g1_border_frame_class();
|
---|
101 | // g1_current_controller->view=view_state;
|
---|
102 | parent->add_child(0,0,g1_border.get());
|
---|
103 |
|
---|
104 | }
|
---|
105 | }
|
---|
106 |
|
---|
107 |
|
---|
108 | void g1_cwin_man_class::destroy_views()
|
---|
109 | {
|
---|
110 | if (g1_border.get())
|
---|
111 | {
|
---|
112 | i4_kernel.delete_handler(g1_strategy_screen.get());
|
---|
113 | i4_kernel.delete_handler(g1_border.get());
|
---|
114 | }
|
---|
115 |
|
---|
116 | }
|
---|
117 |
|
---|
118 | void g1_cwin_man_class::receive_event(i4_event *ev)
|
---|
119 | {
|
---|
120 | // if (view.get())
|
---|
121 | // g1_input.receive_event(ev);
|
---|
122 | }
|
---|
123 |
|
---|
124 |
|
---|
125 | void g1_cwin_man_class::map_changed()
|
---|
126 | {
|
---|
127 | g1_player_type p=g1_default_player;
|
---|
128 | g1_radar_recalculate_backgrounds();
|
---|
129 | }
|
---|
130 |
|
---|