Ejemplo n.º 1
0
static void fire_at_player(game_object *o, game_object *b)
{
  int32_t firex=o->x+(o->direction>0?15:-15),firey=o->y-15,
          playerx=b->x+b->xvel()*8,playery=b->y-15+b->yvel()*2;
  if (can_see(o,o->x,o->y,firex,firey) && can_see(o,firex,firey,playerx,playery))
  {
    int angle=lisp_atan2(firey-playery,playerx-firex);
    void *call_list=NULL;
    PtrRef r1(call_list);
    push_onto_list(LPointer::Create(b),call_list);
    push_onto_list(LNumber::Create(angle),call_list);
    push_onto_list(LNumber::Create(firey),call_list);
    push_onto_list(LNumber::Create(firex),call_list);
    push_onto_list(LNumber::Create(o->aitype()),call_list);
    push_onto_list(LPointer::Create(o),call_list);
    ((LSymbol *)l_fire_object)->EvalUserFunction((LList *)call_list);
    o->set_state((character_state)S_weapon_fire);
  }
}
Ejemplo n.º 2
0
static void fire_at_player(game_object *o, game_object *b)
{
  long firex=o->x+(o->direction>0?15:-15),firey=o->y-15,
       playerx=b->x+b->xvel()*8,playery=b->y-15+b->yvel()*2;
  if (can_see(o,o->x,o->y,firex,firey) && can_see(o,firex,firey,playerx,playery))
  {
    int angle=lisp_atan2(firey-playery,playerx-firex);
    void *call_list=NULL;
    p_ref r1(call_list);
    push_onto_list(new_lisp_pointer(b),call_list);
    push_onto_list(new_lisp_number(angle),call_list);
    push_onto_list(new_lisp_number(firey),call_list);
    push_onto_list(new_lisp_number(firex),call_list);
    push_onto_list(new_lisp_number(o->aitype()),call_list);
    push_onto_list(new_lisp_pointer(o),call_list);
    eval_user_fun((lisp_symbol *)l_fire_object,call_list);
    o->set_state((character_state)S_weapon_fire);
  }
}