static void sigget(sprite_t *s, int signal, void *data) { float v[2] = {0,0}; sprite_t *p; float r[2]; int sigabs; switch(signal) { case SIGNAL_CANCONTROL: *(int *)data = !(s->state & PLANE_CRASHING); break; case SIGNAL_DAMAGE: ((mech_sprite_t *)s)->damage += *(int *)data; ((player_t*)s->owner)->damage=(100*((mech_sprite_t *)s)->damage)/hitpoints; break; case SIGNAL_LAST_ENNEMI: ((player_t*)s->owner)->lastEnnemi=(player_t*)data; break; case SIGNAL_ACCELERATE: s->state |= PLANE_ACCELERATING; break; case -SIGNAL_ACCELERATE: s->state &= ~PLANE_ACCELERATING; break; case SIGNAL_UP: s->state |= PLANE_UP; s->state &= ~PLANE_DOWN; break; case -SIGNAL_UP: s->state &= ~PLANE_UP; break; case SIGNAL_DOWN: s->state |= PLANE_DOWN; s->state &= ~PLANE_UP; break; case -SIGNAL_DOWN: s->state &= ~PLANE_DOWN; break; case SIGNAL_FIRE: /* create bullet */ if (sprite_timer_finished(((struct biplane*)s)->gun_timer) && !(s->state & PLANE_CRASHING)) { sound_effect(&sound_gunfire,s->x,s->y); p = sprite_create(((struct biplane*)s)->bullet_type,s->owner); //p->owner=s->owner; sprite_group_insert(bullet_group,p); r[0] = mech_heading((mech_sprite_t *)s)[0]; r[1] = mech_heading((mech_sprite_t *)s)[1]; vmul(r,21); /* Find start of bullet in clumsy way */ vrot(r,-9); sprite_set_pos(p,s->x + r[0],s->y + r[1]); sprite_get_vel(s,v); vmadd(v,200,mech_heading((mech_sprite_t *)s)); sprite_set_vel(p,v); /* cannot fire again in some time */ sprite_timer_set(&(((struct biplane*)s)->gun_timer),bullet_delay); } break; case SIGNAL_NUM0: /* create bomb */ if (sprite_timer_finished(((struct biplane*)s)->bomb_timer) && (!(s->state & PLANE_CRASHING)) && (((struct biplane*)s)->nr_bombs > 0)) { ((struct biplane*)s)->nr_bombs--; p = sprite_create(&bomb,s->owner); p->anim_p = s->anim_p; ((mech_sprite_t *)p)->angle = ((mech_sprite_t *)s)->angle; r[0] = mech_heading((mech_sprite_t *)s)[0]; r[1] = mech_heading((mech_sprite_t *)s)[1]; vmul(r,14); vrot(r,-80); sprite_set_pos(p,s->x + r[0],s->y + r[1]); sprite_get_vel(s,v); vmadd(v,5,r); sprite_set_vel(p,v); sprite_group_insert(bomb_group,p); sprite_timer_set(&(((struct biplane*)s)->bomb_timer), bomb_delay); } break; case SIGNAL_NUM1: /* jump ship */ if (sprite_timer_finished(((struct biplane*)s)->bomb_timer) && (!(s->state & PLANE_CRASHING))) { p = sprite_create(¶chute,NULL); r[0] = mech_heading((mech_sprite_t *)s)[0]; r[1] = mech_heading((mech_sprite_t *)s)[1]; vmul(r,14); vrot(r,80); sprite_set_pos(p,s->x + r[0],s->y + r[1]); sprite_get_vel(s,v); vmadd(v,5,r); sprite_set_vel(p,v); sprite_group_insert(mech_group,p); sprite_timer_set(&(((struct biplane*)s)->bomb_timer),bomb_delay); } break; case SIGNAL_KILL: create_effect(&explosion,s->x,s->y); sprite_kill(s); break; case SIGNAL_ISHARMLESS: if (s->state & PLANE_CRASHING) ((struct signal_reply *)data)->reply = 1; break; case SIGNAL_STATSTRING://TTODO : useless ? sprintf(data,"%i bombs",((struct biplane*)s)->nr_bombs); break; default: break; } }
void sound_effect( void *vo, int level, int dam, int target ) { if ( target == TARGET_CHAR ) { CHAR_DATA * victim = ( CHAR_DATA * ) vo; OBJ_DATA *obj, *obj_next; AFFECT_DATA af; if ( !victim->in_room ) return ; /* jesli ma uszy moze ogluchnac */ if ( IS_SET( race_table[ GET_RACE( victim ) ].parts, PART_EAR ) && !IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_MAGICAL ) && !is_undead( victim ) && !IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_CONSTRUCT ) && !IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_MIST ) && !IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_BLOB ) && !IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_DRAGON ) && !IS_AFFECTED( victim, AFF_DEAFNESS ) && !IS_AFFECTED( victim, AFF_PERFECT_SENSES ) ) { if ( number_percent() < dam - victim->resists[RESIST_SOUND] ) { af.where = TO_AFFECTS; af.type = 169; af.level = level; af.duration = 3; af.rt_duration = 0; af.location = APPLY_NONE; af.modifier = 0; af.bitvector = &AFF_DEAFNESS; affect_to_char( victim, &af, NULL, TRUE ); send_to_char( "Ból w uszach potêguje siê coraz bardziej, a g³osy wokó³ ciebie nagle milkn±.\n\r", victim ); act( "Z uszu $z wyp³ywa stru¿ka krwi.", victim, NULL, NULL, TO_ROOM ); } } if ( is_affected(victim, gsn_mirrorfall) ) { affect_strip(victim, gsn_mirrorfall); return; } for ( obj = victim->carrying; obj != NULL; obj = obj_next ) { OBJ_NEXT_CONTENT( obj, obj_next ); sound_effect( obj, level, dam, TARGET_OBJ ); } return ; } else if ( target == TARGET_OBJ ) { OBJ_DATA * obj = ( OBJ_DATA * ) vo; OBJ_DATA *t_obj, *n_obj; /* Tener: dodanie szansy na unikniêcie w zale¿no¶ci od poziomu czaru [20080512] */ //2008-11-20, Brohacz: wylaczam. Spelle powyzej 25 levela nie psuja przeciez przez to gratow! /*if ( URANGE( 1, number_range( 1, 30 - level ), 10 ) < 5 ) return;*/ if ( !check_item_resist( obj, RESIST_SOUND, dam+level ) ) return; if ( obj->carried_by != NULL ) { if( obj->liczba_mnoga) act( "$p rozpryskuj± siê na kawa³eczki.", obj->carried_by, obj, NULL, TO_ALL ); else act( "$p rozpryskuje siê na kawa³eczki.", obj->carried_by, obj, NULL, TO_ALL ); } else if ( obj->in_room != NULL && obj->in_room->people != NULL ) { if( obj->liczba_mnoga) act( "$p rozpryskuj± siê na kawa³eczki.", obj->carried_by, obj, NULL, TO_ALL ); else act( "$p rozpryskuje siê na kawa³eczki.", obj->carried_by, obj, NULL, TO_ALL ); } if ( obj->contains ) { for ( t_obj = obj->contains; t_obj != NULL; t_obj = n_obj ) { n_obj = t_obj->next_content; obj_from_obj( t_obj ); if ( obj->in_room != NULL ) obj_to_room( t_obj, obj->in_room ); else if ( obj->carried_by != NULL ) obj_to_room( t_obj, obj->carried_by->in_room ); else { /*artefact*/ if ( is_artefact( t_obj ) ) extract_artefact( t_obj ); if ( obj->contains ) extract_artefact_container( obj ); extract_obj( t_obj ); continue; } shock_effect( t_obj, level / 2, dam / 2, TARGET_OBJ ); } } /*artefact*/ if ( is_artefact( obj ) ) extract_artefact( obj ); if ( obj->contains ) extract_artefact_container( obj ); extract_obj( obj ); return ; } else if ( target == TARGET_ROOM ) { ROOM_INDEX_DATA * room = ( ROOM_INDEX_DATA * ) vo; OBJ_DATA *obj, *obj_next; for ( obj = room->contents; obj != NULL; obj = obj_next ) { OBJ_NEXT_CONTENT( obj, obj_next ); sound_effect( obj, level, dam, TARGET_OBJ ); } return ; } return; }