Project

General

Profile

Revision 321

correcting some problems

View differences:

proj_func.c
96 96
}
97 97

  
98 98
void update_key_presses(void) {
99
    if (sz == 1) {
100
        switch(scancode[0]) {
99
    if (keyboard_get_size() == 1) {
100
        switch(keyboard_get_scancode()[0]) {
101 101
        case W_MAKE_CODE        : key_presses.w_pressed     = 1;        break;
102 102
        case W_BREAK_CODE       : key_presses.w_pressed     = 0;        break;
103 103
        case A_MAKE_CODE        : key_presses.a_pressed     = 1;        break;
......
154 154
    list_node_t *it = list_begin(shooter_list);
155 155
    while(it != list_end(shooter_list)){
156 156
        gunner_t *g = *(gunner_t**)list_node_val(it);
157
        if(gunner_get_type(g) & gunner_follow){
158
            float theta = 0.0;
157
        if(gunner_get_type(g) & GUNNER_FOLLOW){
158
            double theta = 0.0;
159 159
            map_where_to_follow(map, gunner_get_x(g), gunner_get_y(g), &theta);
160
            float c = fm_cos(theta), s = fm_sin(theta);
161
            float dx = ZOMBIE_SPEED*c, dy = -ZOMBIE_SPEED*s;
160
            double c = fm_cos(theta), s = fm_sin(theta);
161
            double dx = ZOMBIE_SPEED*c, dy = -ZOMBIE_SPEED*s;
162 162
            double x = gunner_get_x(g);
163 163
            double y = gunner_get_y(g);
164 164
            gunner_set_pos(g, x+dx, y+dy);
......
234 234
    list_node_t *it1 = list_begin(shooter_list);
235 235
    while(it1 != list_end(shooter_list)){
236 236
        gunner_t *s1 = *list_node_val(it1);
237
        if(!(gunner_get_type(s1) & gunner_melee)){ it1 = list_node_next(it1); continue; }
237
        if(!(gunner_get_type(s1) & GUNNER_MELEE)){ it1 = list_node_next(it1); continue; }
238 238
        list_node_t *it2 = list_begin(shooter_list);
239 239
        while(it2 != list_end(shooter_list)){
240 240
            gunner_t *s2 = *list_node_val(it2);
......
294 294
    last_minus = key_presses.minus_pressed;
295 295
}
296 296

  
297
static int32_t mouse_x = 0, mouse_y = 0;
297
static int16_t mouse_x = 0, mouse_y = 0;
298 298

  
299 299
void (update_mouse)(struct packet *p) {
300 300
    mouse_x = max(0, mouse_x + p->delta_x);
......
310 310
    return &key_presses;
311 311
}
312 312

  
313
int32_t* get_mouse_X(void) { return &mouse_x; }
313
int16_t* get_mouse_X(void) { return &mouse_x; }
314 314

  
315
int32_t* get_mouse_Y(void) { return &mouse_y; }
315
int16_t* get_mouse_Y(void) { return &mouse_y; }
316 316

  
317 317
double get_mouse_angle(gunner_t *p) {
318 318
    return atan2(gunner_get_y_screen(p) - mouse_y, mouse_x - gunner_get_x_screen(p));

Also available in: Unified diff