source: abuse/trunk/src/include/view.hpp @ 18

Last change on this file since 18 was 17, checked in by Sam Hocevar, 17 years ago
  • absolute shitloads of 64 bit fixes.
File size: 3.8 KB
Line 
1#ifndef _VIEW_HPP_
2#define _VIEW_HPP_
3
4#include "light.hpp"
5#include "jwindow.hpp"
6
7
8class object_node;
9class game_object;
10class area_controller;
11
12struct suggest_struct
13{
14  int32_t cx1,cy1,cx2,cy2,shift_down,shift_right,pan_x,pan_y;
15  int32_t new_weapon;
16  uint8_t send_view,send_weapon_change;
17} ;
18
19
20class view;
21
22
23class view
24{
25  uint8_t 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  int32_t 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  int32_t *weapons;                          // [0..total_weapons-1]
44  int32_t *last_weapons;                     // last history of above array (for updating statbar)
45  int32_t 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  int32_t 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  int32_t 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  int32_t 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  int32_t x_center();                        // center of attention
72  int32_t y_center();
73  int32_t xoff();                            // top left and right corner of the screen
74  int32_t interpolated_xoff();
75  int32_t yoff();
76  int32_t 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, uint8_t *&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(int32_t Cx1, int32_t Cy1, int32_t Cx2, int32_t 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  int32_t get_view_var_value(int num);
107  int32_t set_view_var_value(int num, int32_t x);
108  void configure_for_area(area_controller *a);
109  ~view();
110} ;
111
112extern view *player_list;
113void set_local_players(int total);
114int total_local_players();
115void recalc_local_view_space();
116
117void process_packet_commands(uint8_t *pk, int size);
118
119object_node *make_player_onodes(int player_num=-1);
120int total_view_vars();
121char *get_view_var_name(int num);
122ushort make_sync();
123
124#endif
125
126
127
128
129
Note: See TracBrowser for help on using the repository browser.