static int SelectClosestHostage() { int start=0; while ( !hostage_is_valid( CurrentHostageIndex ) ) { CurrentHostageIndex++; if ( CurrentHostageIndex >= MAX_HOSTAGES ) CurrentHostageIndex = 0; start++; if ( start > MAX_HOSTAGES ) break; } if (hostage_is_valid( CurrentHostageIndex ) ) { Cur_object_index = Hostages[CurrentHostageIndex].objnum; } else { CurrentHostageIndex =-1; } return CurrentHostageIndex; }
void hostage_compress_all() { int i,newslot; for (i=0; i<MAX_HOSTAGES; i++ ) { if ( hostage_is_valid(i) ) { newslot = hostage_get_next_slot(); if ( newslot < i ) { Hostages[newslot] = Hostages[i]; Objects[Hostages[newslot].objnum].id = newslot; Hostages[i].objnum = -1; i = 0; // start over } } } for (i=0; i<MAX_HOSTAGES; i++ ) { if ( hostage_is_valid(i) ) ; } }
int PlayHostageSound() { int sound_num; if (!hostage_is_valid( CurrentHostageIndex ) ) return 0; sound_num = Hostage_face_clip[Hostages[CurrentHostageIndex].vclip_num].sound_num; if ( sound_num > -1 ) { digi_play_sample( sound_num, F1_0 ); } return 1; }
int SelectPrevFace() { int start = Hostages[CurrentHostageIndex].vclip_num; if (!hostage_is_valid( CurrentHostageIndex ) ) return 0; do { Hostages[CurrentHostageIndex].vclip_num--; if ( Hostages[CurrentHostageIndex].vclip_num < 0) Hostages[CurrentHostageIndex].vclip_num = MAX_HOSTAGES-1; if (Hostages[CurrentHostageIndex].vclip_num == start) return 0; } while (Hostage_face_clip[Hostages[CurrentHostageIndex].vclip_num].num_frames == 0); return 1; }
int SelectNextFace() { int start = Hostages[CurrentHostageIndex].vclip_num; if (!hostage_is_valid( CurrentHostageIndex ) ) return 0; do { Hostages[CurrentHostageIndex].vclip_num++; if ( Hostages[CurrentHostageIndex].vclip_num >= MAX_HOSTAGES) Hostages[CurrentHostageIndex].vclip_num = 0; if (Hostages[CurrentHostageIndex].vclip_num == start) return 0; } while (Hostage_face_clip[Hostages[CurrentHostageIndex].vclip_num].num_frames == 0); return 1; }
int hostage_object_is_valid( int objnum ) { if ( objnum < 0 ) return 0; if ( objnum > Highest_object_index ) return 0; if ( Objects[objnum].type != OBJ_HOSTAGE ) return 0; return hostage_is_valid(Objects[objnum].id); }