Project

General

Profile

Revision 342

identified error

View differences:

proj.c
192 192
static void multiplayer_process(const uint8_t *p, const size_t sz) {
193 193
    void *dest = NULL;
194 194
    hltp_type tp = hltp_interpret(p, sz, &dest);
195
    if (dest == NULL) return;
195 196
    switch(tp){
196 197
        case hltp_type_host:
197
            host_info_dtor(host_info);
198 198
            host_info = (host_info_t*)dest;
199 199
            break;
200 200
        case hltp_type_remote:
201
            remote_info_dtor(remote_info);
202 201
            remote_info = (remote_info_t*)dest;
203 202
            break;
204 203
        case hltp_type_bullet:
205
            bullet_info_dtor(bullet_info);
206 204
            bullet_info = (bullet_info_t*)dest;
207 205
            break;
208 206
        case hltp_type_invalid: break;
......
326 324
                switch (i) {
327 325
                    case TIMER0_IRQ:
328 326
                    if (timer_get_no_interrupts() % 60 == 0) timer_update(in_game_timer);
329

  
330 327
                    update_movement(map1, shooter1, keys, shooter_list);
331 328
                    update_movement(map1, shooter2, &(remote_info->remote_keys_pressed), shooter_list);
332 329

  
......
348 345
                                   gunner_get_y(shooter1)-ent_get_YLength()/2.0);
349 346

  
350 347
                    gunner_set_angle(shooter2, remote_info->remote_angle);
348
                    if (timer_get_no_interrupts() % 6 == 0) {
349
                        build_host_structure(host_info, shooter1, shooter2);
351 350

  
352
                    build_host_structure(host_info, shooter1, shooter2, bullet_list);
351
                        hltp_send_host_info(host_info);
352
                    }
353 353

  
354

  
355

  
356
                    hltp_send_host_info(host_info);
357

  
358 354
                    graph_clear_screen();
359 355
                    map_draw   (map1);
360 356
                    bullet_draw_list(bullet_list);
......
468 464

  
469 465
                    build_remote_structure(remote_info, keys, angle);
470 466

  
467

  
471 468
                    //hltp_send_remote_info(remote_info);
472

  
473 469
                    gunner_set_pos(shooter1, (double)host_info->remote_x, (double)host_info->remote_y);
474 470
                    gunner_set_angle(shooter1, (double)host_info->remote_angle);
475 471
                    gunner_set_health(shooter1, (double)host_info->remote_health);
......
483 479
                    ent_set_origin(gunner_get_x(shooter1)-ent_get_XLength()/2.0,
484 480
                                   gunner_get_y(shooter1)-ent_get_YLength()/2.0);
485 481

  
482
                    /*
486 483
                    for (size_t j = 0; j < host_info->no_bullets; j++) {
487 484
                        if (host_info->bullets_shooter[j]) { // remote
488 485
                            bullet_t *bullet = bullet_ctor(shooter1, bsp_bullet, (double)host_info->bullets_x[j], (double)host_info->bullets_y[j], (double)host_info->bullets_vx[j], (double)host_info->bullets_vy[j]);
......
491 488
                            bullet_t *bullet = bullet_ctor(shooter2, bsp_bullet, (double)host_info->bullets_x[j], (double)host_info->bullets_y[j], (double)host_info->bullets_vx[j], (double)host_info->bullets_vy[j]);
492 489
                            list_insert(bullet_list, list_end(bullet_list), bullet);
493 490
                        }
494
                    }
491
                    }*/
495 492

  
496 493
                    graph_clear_screen();
497 494
                    map_draw   (map1);
......
503 500
                    sprite_set_pos(sp_crosshair, *get_mouse_X(), *get_mouse_Y());
504 501
                    sprite_draw(sp_crosshair);
505 502
                    graph_draw();
506

  
503
                    /*
507 504
                    while(list_size(bullet_list) > 0){
508 505
                        bullet_t *p = (bullet_t*)list_erase(bullet_list, list_begin(bullet_list));
509 506
                        bullet_dtor(p);
510 507
                    }
508
                    */
511 509

  
512 510
                    break;
513 511
                    case KBC_IRQ:
......
528 526
                    }
529 527
                    break;
530 528

  
531
                    case COM1_IRQ: nctp_ih(); break;
529
                    case COM1_IRQ:
530
                        nctp_ih();
531
                        break;
532 532
                }
533 533
            }
534 534
        }

Also available in: Unified diff