source: abuse/trunk/src/dev.hpp @ 106

Last change on this file since 106 was 106, checked in by Sam Hocevar, 11 years ago
  • Rename the "eh" variable to "wm" because it's a window manager, not an event handler.
  • No longer pass the window manager to functions, there's only one.

Inspired by Win32 Abuse changelog for January 28, 2001:

  • Starting work on singleton code; will get rid of all

references to an arbitrary window_manager* because
there's only going to be one, and it's not ever
going to change.

File size: 3.5 KB
Line 
1/*
2 *  Abuse - dark 2D side-scrolling platform game
3 *  Copyright (c) 1995 Crack dot Com
4 *
5 *  This software was released into the Public Domain. As with most public
6 *  domain software, no warranty is made or implied by Crack dot Com or
7 *  Jonathan Clark.
8 */
9
10#ifndef __DEV_HPP_
11#define __DEV_HPP_
12
13#include "game.hpp"
14#include "light.hpp"
15#include "console.hpp"
16#include "timing.hpp"
17
18/* Cleaned-up externs */
19extern int confirm_quit();
20
21
22extern int scale_mult,scale_div;
23extern char level_file[100];
24extern image *small_render;
25
26void dev_init(int argc, char **argv);
27void dev_cleanup();
28void toggle_edit_mode();
29char const *symbol_str(char const *name);
30
31class pal_win
32{
33  int32_t scale,w,h,x,y,last_selected;
34  unsigned short *pat;
35  void draw();
36
37public :
38  jwindow *me;
39  void close_window();
40  void open_window();
41  char *name;
42  void handle_event(event &ev);
43  pal_win(void *args);
44  void resize(int xa, int ya);
45  int get_pat(int x, int y) { return pat[y*w+x]; }
46  int width() { return w; }
47  int height() { return h; }
48  void save(FILE *fp);
49  ~pal_win();
50} ;
51
52enum dev_state { DEV_CREATE_OBJECT,
53                 DEV_MOVE_OBJECT,
54                 DEV_SELECT,
55                 DEV_MOUSE_RELEASE,
56                 DEV_MOVE_LIGHT,
57                 DEV_CREATE_LIGHT,
58                 DEV_DRAG_AREA_TOP,
59                 DEV_DRAG_AREA_BOTTOM };
60
61extern char backw_on,forew_on,show_menu_on,ledit_on,pmenu_on,omenu_on,commandw_on,tbw_on,searchw_on,
62            small_render_on,interpolate_draw,disable_autolight,fps_on,profile_on,show_names,fg_reversed,
63            raise_all;
64
65
66class dev_controll
67{
68  game_object *edit_object,*selected_object,*ai_object,*search_object,
69              *link_object;
70  light_source *edit_light,*selected_light;
71  pal_win **pal_wins;
72  char **pwin_list;
73  int total_pals;
74  dev_state state;
75  int area_x1,area_y1,area_x2,area_y2;
76  area_controller *current_area;
77  time_marker last_area_click;
78public :
79  jwindow *backw,*forew,*commandw,*modew,*omenu,*oedit,*ledit,
80          *music_window,*pmenu,*show_menu,*lightw,*aiw,*ambw,*tbw,*area_win,
81          *search_window,*memprof;
82
83  int fg_w,bg_w,fg_scale,bg_scale,yellow;
84  void save();
85  void fg_fill(int color, int x, int y, pal_win *p);
86  void add_palette(void *args);
87  void toggle_memprof();
88  void search_forward();
89  void search_backward();
90  void toggle_toolbar();
91  void toggle_fgw();
92  void toggle_bgw();
93  void toggle_omenu();
94  void toggle_music_window();
95  void toggle_pmenu();
96  void toggle_show_menu();
97  void toggle_light_window();
98  void toggle_search_window();
99  void show_char_mem(char const *name);
100  void close_oedit_window();
101  void show_mem();
102  dev_controll();
103  void handle_event(event &ev);
104  void do_command(char const *st, event &ev);
105  int is_pal_win(jwindow *win);
106  void dev_draw(view *v);
107  void load_stuff();
108  int repeat_key_mode();
109  int need_plus_minus();
110  int need_arrows();
111  void make_ai_window(game_object *o);
112  void close_ai_window();
113  void make_ambient();
114  int ok_to_scroll();
115  int32_t snap_x(int32_t x);
116  int32_t snap_y(int32_t y);
117  void area_handle_input(event &ev);
118  void pick_handle_input(event &ev);
119  void close_area_win(int read_values);
120  void notify_deleted_object(game_object *o);
121  void notify_deleted_light(light_source *l);
122  void set_state(int new_state);
123  void update_memprof();   
124  ~dev_controll();
125} ;
126
127class dev_term : public shell_term
128{
129  dev_controll *dv;
130  public :
131  dev_term(int width, int height, dev_controll *dev) : shell_term(console_font, width, height, "dev")
132  {
133    dv = dev;
134  }
135  virtual ~dev_term() {};
136  virtual void execute(char *st);
137} ;
138
139extern dev_term *dev_console;
140
141extern dev_controll *dev_cont;
142
143
144#endif
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
Note: See TracBrowser for help on using the repository browser.