[49] | 1 | #ifndef _VIEW_HPP_ |
---|
| 2 | #define _VIEW_HPP_ |
---|
| 3 | |
---|
| 4 | #include "light.hpp" |
---|
| 5 | #include "jwindow.hpp" |
---|
| 6 | |
---|
| 7 | |
---|
| 8 | class object_node; |
---|
| 9 | class game_object; |
---|
| 10 | class area_controller; |
---|
| 11 | |
---|
| 12 | struct suggest_struct |
---|
| 13 | { |
---|
| 14 | long cx1,cy1,cx2,cy2,shift_down,shift_right,pan_x,pan_y; |
---|
| 15 | long new_weapon; |
---|
| 16 | uchar send_view,send_weapon_change; |
---|
| 17 | } ; |
---|
| 18 | |
---|
| 19 | |
---|
| 20 | class view; |
---|
| 21 | |
---|
| 22 | |
---|
| 23 | class view |
---|
| 24 | { |
---|
| 25 | uchar keymap[512/8]; |
---|
| 26 | char chat_buf[60]; |
---|
| 27 | public : |
---|
| 28 | int key_down(int key) { return keymap[key/8]&(1<<(key%8)); } |
---|
| 29 | void set_key_down(int key, int x) { if (x) keymap[key/8]|=(1<<(key%8)); else keymap[key/8]&=~(1<<(key%8)); } |
---|
| 30 | void reset_keymap() { memset(keymap,0,sizeof(keymap)); } |
---|
| 31 | void add_chat_key(int key); |
---|
| 32 | |
---|
| 33 | char name[100]; |
---|
| 34 | struct suggest_struct suggest; |
---|
| 35 | long cx1,cy1,cx2,cy2, // view area to show |
---|
| 36 | shift_down,shift_right; // shift of view |
---|
| 37 | |
---|
| 38 | int god; // :) if you believe in such things |
---|
| 39 | int player_number; |
---|
| 40 | |
---|
| 41 | int draw_solid; // -1 if don't draw solid |
---|
| 42 | |
---|
| 43 | long *weapons; // [0..total_weapons-1] |
---|
| 44 | long *last_weapons; // last history of above array (for updating statbar) |
---|
| 45 | long current_weapon; |
---|
| 46 | |
---|
| 47 | |
---|
| 48 | game_object *focus; // object we are focusing on (player) |
---|
| 49 | int x_suggestion, // input from the player at the current time |
---|
| 50 | y_suggestion, |
---|
| 51 | b1_suggestion, |
---|
| 52 | b2_suggestion, |
---|
| 53 | b3_suggestion, |
---|
| 54 | b4_suggestion, |
---|
| 55 | pointer_x, |
---|
| 56 | pointer_y, |
---|
| 57 | freeze_time; |
---|
| 58 | |
---|
| 59 | |
---|
| 60 | short ambient; // ambient lighting setting, used by draw |
---|
| 61 | long pan_x,pan_y,no_xleft,no_xright,no_ytop,no_ybottom, |
---|
| 62 | last_x,last_y,last_last_x,last_last_y,view_percent; |
---|
| 63 | |
---|
| 64 | long last_left,last_right,last_up,last_down, // how many frames ago were these pressed (<=0) |
---|
| 65 | last_b1,last_b2,last_b3,last_b4,last_hp,last_ammo,last_type; |
---|
| 66 | long secrets,kills,tsecrets,tkills; |
---|
| 67 | |
---|
| 68 | view(game_object *Focus, view *Next, int number); |
---|
| 69 | void draw_character_damage(); // draws the characters 'status' on the viewer |
---|
| 70 | |
---|
| 71 | long x_center(); // center of attention |
---|
| 72 | long y_center(); |
---|
| 73 | long xoff(); // top left and right corner of the screen |
---|
| 74 | long interpolated_xoff(); |
---|
| 75 | long yoff(); |
---|
| 76 | long interpolated_yoff(); |
---|
| 77 | int drawable(); // network viewables are not drawable |
---|
| 78 | int local_player(); // just in case I ever need non-viewable local players. |
---|
| 79 | |
---|
| 80 | view *next; // next viewable player (singly linked list) |
---|
| 81 | void get_input(); |
---|
| 82 | int process_input(char cmd, uchar *&pk); |
---|
| 83 | |
---|
| 84 | void add_ammo (int weapon_type, int total); |
---|
| 85 | int has_weapon (int weapon_type) { return god || (weapons[weapon_type]!=-1); } |
---|
| 86 | void give_weapon(int weapontype); |
---|
| 87 | int weapon_total(int weapon_type); |
---|
| 88 | |
---|
| 89 | void note_upkey(); |
---|
| 90 | void note_downkey(); |
---|
| 91 | int handle_event(event &ev); |
---|
| 92 | void update_scroll(); |
---|
| 93 | void draw_hp(); |
---|
| 94 | void draw_ammo(); |
---|
| 95 | void draw_logo(); |
---|
| 96 | void resize_view(long Cx1, long Cy1, long Cx2, long Cy2); |
---|
| 97 | void set_input(int cx, int cy, int b1, int b2, int b3, int b4, int px, int py); |
---|
| 98 | int view_changed() { return suggest.send_view; } |
---|
| 99 | int weapon_changed() { return suggest.send_weapon_change; } |
---|
| 100 | |
---|
| 101 | void next_weapon(); |
---|
| 102 | void last_weapon(); |
---|
| 103 | |
---|
| 104 | void reset_player(); |
---|
| 105 | int receive_failed() { return focus==NULL; } |
---|
| 106 | long get_view_var_value(int num); |
---|
| 107 | long set_view_var_value(int num, long x); |
---|
| 108 | void configure_for_area(area_controller *a); |
---|
| 109 | ~view(); |
---|
| 110 | } ; |
---|
| 111 | |
---|
| 112 | extern view *player_list; |
---|
| 113 | void set_local_players(int total); |
---|
| 114 | int total_local_players(); |
---|
| 115 | void recalc_local_view_space(); |
---|
| 116 | |
---|
| 117 | void process_packet_commands(uchar *pk, int size); |
---|
| 118 | |
---|
| 119 | object_node *make_player_onodes(int player_num=-1); |
---|
| 120 | int total_view_vars(); |
---|
| 121 | char *get_view_var_name(int num); |
---|
| 122 | ushort make_sync(); |
---|
| 123 | |
---|
| 124 | #endif |
---|
| 125 | |
---|
| 126 | |
---|
| 127 | |
---|
| 128 | |
---|
| 129 | |
---|