// LP addition: animator void animate_items() { object_data *object; ix object_index; for (object_index= 0, object= objects; object_index < MAXIMUM_OBJECTS_PER_MAP; ++object_index, ++object) { if (SLOT_IS_USED(object) && GET_OBJECT_OWNER(object)==_object_is_item && !OBJECT_IS_INVISIBLE(object)) { auto type = object->permutation; if (get_item_kind(type) != NONE) { item_definition *ItemDef = get_item_definition(type); // LP change: added idiot-proofing if (!ItemDef) continue; shape_descriptor shape = ItemDef->base_shape; shape_animation_data *animation= get_shape_animation_data(shape); if (!animation) continue; // Randomize if non-animated; do only once if (object->facing >= 0) { if (randomize_object_sequence(object_index,shape)) { object->facing = NONE; } } // Now the animation if (object->facing >= 0) animate_object(object_index); } } } }
void SoundManager::StopSound(short identifier, short sound_index) { if (active && total_channel_count > 0) { // if we're stopping everything... if (identifier == NONE && sound_index == NONE) { // can't fade to silence here // stop the ambient sound channels, too if (parameters.flags & _ambient_sound_flag) { for (short i = 0; i < MAXIMUM_AMBIENT_SOUND_CHANNELS; i++) { FreeChannel(channels[total_channel_count - i - 1]); } } } for (short i = 0; i < total_channel_count; i++) { if (SLOT_IS_USED(&channels[i]) && (channels[i].identifier == identifier || identifier == NONE) && (channels[i].sound_index == sound_index || sound_index == NONE)) { FreeChannel(channels[i]); } } } return; }
static bool Lua_Scenery_Valid(int32 index) { if (index < 0 || index >= MAXIMUM_OBJECTS_PER_MAP) return false; object_data *object = GetMemberWithBounds(objects, index, MAXIMUM_OBJECTS_PER_MAP); if (SLOT_IS_USED(object)) { if (GET_OBJECT_OWNER(object) == _object_is_scenery) return true; else if (GET_OBJECT_OWNER(object) == _object_is_normal) { // check to make sure it's not a player's legs or torso for (int player_index = 0; player_index < dynamic_world->player_count; player_index++) { player_data *player = get_player_data(player_index); monster_data *monster = get_monster_data(player->monster_index); if (monster->object_index == index) return false; else { object_data *object = get_object_data(monster->object_index); if (object->parasitic_object == index) return false; } } return true; } } return false; }
bool Lua_Item_Valid(int32 index) { if (index < 0 || index >= MAXIMUM_OBJECTS_PER_MAP) return false; object_data *object = GetMemberWithBounds(objects, index, MAXIMUM_OBJECTS_PER_MAP); return (SLOT_IS_USED(object) && GET_OBJECT_OWNER(object) == _object_is_item); }
bool Lua_Effect_Valid(int32 index) { if (index < 0 || index >= MAXIMUM_EFFECTS_PER_MAP) return false; effect_data *effect = GetMemberWithBounds(effects, index, MAXIMUM_EFFECTS_PER_MAP); return SLOT_IS_USED(effect); }
int Lua_Monster_Valid(int16 index) { if (index < 0 || index >= MAXIMUM_MONSTERS_PER_MAP) return false; monster_data *monster = GetMemberWithBounds(monsters, index, MAXIMUM_MONSTERS_PER_MAP); return (SLOT_IS_USED(monster)); }
projectile_data *get_projectile_data( const short projectile_index) { struct projectile_data *projectile = GetMemberWithBounds(projectiles,projectile_index,MAXIMUM_PROJECTILES_PER_MAP); vassert(projectile, csprintf(temporary, "projectile index #%d is out of range", projectile_index)); vassert(SLOT_IS_USED(projectile), csprintf(temporary, "projectile index #%d (%p) is unused", projectile_index, projectile)); return projectile; }
bool SoundManager::SoundIsPlaying(short sound_index) { bool sound_playing = false; if (active && total_channel_count > 0) { for (short i = 0; i < total_channel_count; i++) { if (SLOT_IS_USED(&channels[i]) && channels[i].sound_index == sound_index) { sound_playing = true; } } UnlockLockedSounds(); } return sound_playing; }
bool unretrieved_items_on_map() { bool found_item = false; object_data *object; short object_index; for (object_index= 0, object= objects; object_index<MAXIMUM_OBJECTS_PER_MAP; ++object_index, ++object) { if (SLOT_IS_USED(object) && GET_OBJECT_OWNER(object)==_object_is_item) { if (get_item_kind(object->permutation)==_item) { found_item= true; break; } } } return found_item; }