source: abuse/trunk/src/view.hpp @ 126

Last change on this file since 126 was 126, checked in by Sam Hocevar, 14 years ago
  • Implement game_object::set_tint, get_tint, set_team and get_team, as well as the corresponding set_object_tint, get_object_tint, set_object_team and get_object_team LISP functions. They'll be useful for CTF mode.

Inspired by Abuse Win32 changelog from February 18, 2001:

  • Changed lisp function (set_player_color x) to

(set_object_tint x)

  • Added lisp function (get_object_tint)

Inspired by Abuse Win32 changelog from February 17, 2001:

  • Added lisp function (set_player_color x) to switch player

to color number x
see chat.lsp for details

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