source: abuse/trunk/src/dev.h @ 481

Last change on this file since 481 was 481, checked in by Sam Hocevar, 11 years ago

Fuck the history, I'm renaming all .hpp files to .h for my own sanity.

  • Property svn:keywords set to Id
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.h"
14#include "light.h"
15#include "console.h"
16#include "timing.h"
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;
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 search_forward();
88  void search_backward();
89  void toggle_toolbar();
90  void toggle_fgw();
91  void toggle_bgw();
92  void toggle_omenu();
93  void toggle_music_window();
94  void toggle_pmenu();
95  void toggle_show_menu();
96  void toggle_light_window();
97  void toggle_search_window();
98  void show_char_mem(char const *name);
99  void close_oedit_window();
100  void show_mem();
101  dev_controll();
102  void handle_event(event &ev);
103  void do_command(char const *st, event &ev);
104  int is_pal_win(Jwindow *win);
105  void dev_draw(view *v);
106  void load_stuff();
107  int repeat_key_mode();
108  int need_plus_minus();
109  int need_arrows();
110  void make_ai_window(game_object *o);
111  void close_ai_window();
112  void make_ambient();
113  int ok_to_scroll();
114  int32_t snap_x(int32_t x);
115  int32_t snap_y(int32_t y);
116  void area_handle_input(event &ev);
117  void pick_handle_input(event &ev);
118  void close_area_win(int read_values);
119  void notify_deleted_object(game_object *o);
120  void notify_deleted_light(light_source *l);
121  void set_state(int new_state);
122  ~dev_controll();
123} ;
124
125class dev_term : public shell_term
126{
127  dev_controll *dv;
128  public :
129  dev_term(int width, int height, dev_controll *dev) : shell_term(console_font, width, height, "dev")
130  {
131    dv = dev;
132  }
133  virtual ~dev_term() {};
134  virtual void execute(char *st);
135} ;
136
137extern dev_term *dev_console;
138
139extern dev_controll *dev_cont;
140
141
142#endif
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
Note: See TracBrowser for help on using the repository browser.