[56] | 1 | /* |
---|
| 2 | * Abuse - dark 2D side-scrolling platform game |
---|
| 3 | * Copyright (c) 1995 Crack dot Com |
---|
[494] | 4 | * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> |
---|
[56] | 5 | * |
---|
| 6 | * This software was released into the Public Domain. As with most public |
---|
[555] | 7 | * domain software, no warranty is made or implied by Crack dot Com, by |
---|
| 8 | * Jonathan Clark, or by Sam Hocevar. |
---|
[56] | 9 | */ |
---|
| 10 | |
---|
[2] | 11 | #ifndef __DEV_HPP_ |
---|
| 12 | #define __DEV_HPP_ |
---|
| 13 | |
---|
[481] | 14 | #include "game.h" |
---|
| 15 | #include "light.h" |
---|
| 16 | #include "console.h" |
---|
| 17 | #include "timing.h" |
---|
[2] | 18 | |
---|
[88] | 19 | /* Cleaned-up externs */ |
---|
| 20 | extern int confirm_quit(); |
---|
[2] | 21 | |
---|
[88] | 22 | |
---|
[2] | 23 | extern int scale_mult,scale_div; |
---|
| 24 | extern char level_file[100]; |
---|
| 25 | extern image *small_render; |
---|
| 26 | |
---|
| 27 | void dev_init(int argc, char **argv); |
---|
| 28 | void dev_cleanup(); |
---|
| 29 | void toggle_edit_mode(); |
---|
[39] | 30 | char const *symbol_str(char const *name); |
---|
[2] | 31 | |
---|
| 32 | class pal_win |
---|
| 33 | { |
---|
[16] | 34 | int32_t scale,w,h,x,y,last_selected; |
---|
[2] | 35 | unsigned short *pat; |
---|
| 36 | void draw(); |
---|
| 37 | |
---|
[124] | 38 | public : |
---|
[120] | 39 | Jwindow *me; |
---|
[2] | 40 | void close_window(); |
---|
| 41 | void open_window(); |
---|
| 42 | char *name; |
---|
| 43 | void handle_event(event &ev); |
---|
| 44 | pal_win(void *args); |
---|
| 45 | void resize(int xa, int ya); |
---|
| 46 | int get_pat(int x, int y) { return pat[y*w+x]; } |
---|
| 47 | int width() { return w; } |
---|
| 48 | int height() { return h; } |
---|
| 49 | void save(FILE *fp); |
---|
| 50 | ~pal_win(); |
---|
| 51 | } ; |
---|
| 52 | |
---|
[124] | 53 | enum dev_state { DEV_CREATE_OBJECT, |
---|
| 54 | DEV_MOVE_OBJECT, |
---|
| 55 | DEV_SELECT, |
---|
| 56 | DEV_MOUSE_RELEASE, |
---|
| 57 | DEV_MOVE_LIGHT, |
---|
| 58 | DEV_CREATE_LIGHT, |
---|
| 59 | DEV_DRAG_AREA_TOP, |
---|
| 60 | DEV_DRAG_AREA_BOTTOM }; |
---|
[2] | 61 | |
---|
| 62 | extern char backw_on,forew_on,show_menu_on,ledit_on,pmenu_on,omenu_on,commandw_on,tbw_on,searchw_on, |
---|
| 63 | small_render_on,interpolate_draw,disable_autolight,fps_on,profile_on,show_names,fg_reversed, |
---|
[124] | 64 | raise_all; |
---|
[2] | 65 | |
---|
| 66 | |
---|
| 67 | class dev_controll |
---|
| 68 | { |
---|
| 69 | game_object *edit_object,*selected_object,*ai_object,*search_object, |
---|
| 70 | *link_object; |
---|
| 71 | light_source *edit_light,*selected_light; |
---|
| 72 | pal_win **pal_wins; |
---|
| 73 | char **pwin_list; |
---|
| 74 | int total_pals; |
---|
| 75 | dev_state state; |
---|
| 76 | int area_x1,area_y1,area_x2,area_y2; |
---|
| 77 | area_controller *current_area; |
---|
| 78 | time_marker last_area_click; |
---|
| 79 | public : |
---|
[120] | 80 | Jwindow *backw,*forew,*commandw,*modew,*omenu,*oedit,*ledit, |
---|
[2] | 81 | *music_window,*pmenu,*show_menu,*lightw,*aiw,*ambw,*tbw,*area_win, |
---|
[129] | 82 | *search_window; |
---|
[2] | 83 | |
---|
| 84 | int fg_w,bg_w,fg_scale,bg_scale,yellow; |
---|
| 85 | void save(); |
---|
| 86 | void fg_fill(int color, int x, int y, pal_win *p); |
---|
| 87 | void add_palette(void *args); |
---|
| 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(); |
---|
[39] | 99 | void show_char_mem(char const *name); |
---|
[2] | 100 | void close_oedit_window(); |
---|
| 101 | void show_mem(); |
---|
| 102 | dev_controll(); |
---|
| 103 | void handle_event(event &ev); |
---|
[39] | 104 | void do_command(char const *st, event &ev); |
---|
[120] | 105 | int is_pal_win(Jwindow *win); |
---|
[2] | 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(); |
---|
[16] | 115 | int32_t snap_x(int32_t x); |
---|
| 116 | int32_t snap_y(int32_t y); |
---|
[2] | 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 | ~dev_controll(); |
---|
| 124 | } ; |
---|
| 125 | |
---|
| 126 | class dev_term : public shell_term |
---|
| 127 | { |
---|
| 128 | dev_controll *dv; |
---|
| 129 | public : |
---|
[106] | 130 | dev_term(int width, int height, dev_controll *dev) : shell_term(console_font, width, height, "dev") |
---|
[2] | 131 | { |
---|
[106] | 132 | dv = dev; |
---|
[2] | 133 | } |
---|
[494] | 134 | virtual ~dev_term() { }; |
---|
[2] | 135 | virtual void execute(char *st); |
---|
| 136 | } ; |
---|
| 137 | |
---|
| 138 | extern dev_term *dev_console; |
---|
| 139 | |
---|
| 140 | extern dev_controll *dev_cont; |
---|
| 141 | |
---|
| 142 | |
---|
| 143 | #endif |
---|
| 144 | |
---|
| 145 | |
---|
| 146 | |
---|
| 147 | |
---|
| 148 | |
---|
| 149 | |
---|
| 150 | |
---|
| 151 | |
---|
| 152 | |
---|
| 153 | |
---|
| 154 | |
---|
| 155 | |
---|
| 156 | |
---|
| 157 | |
---|
| 158 | |
---|
| 159 | |
---|
| 160 | |
---|