void put_bag_on_ground(int bag_x,int bag_y,int bag_id) { float x,y,z; int obj_3d_id; #ifdef NEW_SOUND int snd; #endif // NEW_SOUND //now, get the Z position if (!get_tile_valid(bag_x, bag_y)) { //Warn about this error: LOG_WARNING("A bag was placed OUTSIDE the map!\n"); return; } z = get_tile_height(bag_x, bag_y); //convert from height values to meters x=(float)bag_x/2; y=(float)bag_y/2; //center the object (slightly randomized) x = x + 0.25f; // + get_bag_offset_x(bag_x, bag_y, bag_id, tile_map_size_x, tile_map_size_y); y = y + 0.25f; // + get_bag_offset_y(bag_x, bag_y, bag_id, tile_map_size_x, tile_map_size_y); // DEBUG // printf("bag <%i> (%f,%f) rot %f tilt %f\n", bag_id, x, y, // get_bag_rotation(bag_x, bag_y, bag_id, tile_map_size_x, tile_map_size_y), // get_bag_tilt(bag_x, bag_y, bag_id, tile_map_size_x, tile_map_size_y)); //Launch the animation if (use_eye_candy) { ec_create_bag_drop(x, y, z, (poor_man ? 6 : 10)); #ifdef ONGOING_BAG_EFFECT // start an ongoing effect until the ongoing bag effect is coded bag_list[bag_id].ongoing_bag_effect_reference = ec_create_lamp(x, y, z, 0.0, 1.0, 0.75, (poor_man ? 6 : 10)); #endif // ONGOING_BAG_EFFECT } #ifdef NEW_SOUND if (your_actor && bag_x == your_actor->x_pos * 2 && bag_y == your_actor->y_pos * 2) { snd = get_sound_index_for_particle_file_name("./particles/bag_in.part"); if (snd >= 0) { add_sound_object (snd, bag_x, bag_y, 0); } } #endif // NEW_SOUND #ifdef OLD_MISC_OBJ_DIR obj_3d_id=add_e3d("./3dobjects/misc_objects/bag1.e3d", x, y, z, #else obj_3d_id=add_e3d("./3dobjects/bag1.e3d", x, y, z, #endif get_bag_tilt(bag_x, bag_y, bag_id, tile_map_size_x, tile_map_size_y), 0, get_bag_rotation(bag_x, bag_y, bag_id, tile_map_size_x, tile_map_size_y), 1 ,0 ,1.0f ,1.0f, 1.0f, 1); //now, find a place into the bags list, so we can destroy the bag properly bag_list[bag_id].x=bag_x; bag_list[bag_id].y=bag_y; bag_list[bag_id].obj_3d_id=obj_3d_id; }
void add_bags_from_list (const Uint8 *data) { Uint16 bags_no; int i; int bag_x,bag_y,my_offset; //bag_type unused? float x,y,z; int obj_3d_id, bag_id; bags_no=data[0]; if(bags_no > NUM_BAGS) { return;//something nasty happened } for(i=0;i<bags_no;i++) { my_offset=i*5+1; bag_x=SDL_SwapLE16(*((Uint16 *)(data+my_offset))); bag_y=SDL_SwapLE16(*((Uint16 *)(data+my_offset+2))); bag_id=*((Uint8 *)(data+my_offset+4)); if(bag_id >= NUM_BAGS) { continue; } //now, get the Z position if (!get_tile_valid(bag_x, bag_y)) { //Warn about this error! LOG_WARNING("A bag was located OUTSIDE the map!\n"); continue; } z = get_tile_height(bag_x, bag_y); //convert from height values to meters x=(float)bag_x/2; y=(float)bag_y/2; //center the object (slightly randomized) x = x + 0.25f; // + get_bag_offset_x(bag_x, bag_y, bag_id, tile_map_size_x, tile_map_size_y); y = y + 0.25f; // + get_bag_offset_y(bag_x, bag_y, bag_id, tile_map_size_x, tile_map_size_y); // DEBUG LOG_DEBUG_VERBOSE("bag <%i> (%f,%f) rot %f tilt %f\n", bag_id, x, y, get_bag_rotation(bag_x, bag_y, bag_id, tile_map_size_x, tile_map_size_y), get_bag_tilt(bag_x, bag_y, bag_id, tile_map_size_x, tile_map_size_y)); if (use_eye_candy) { #ifdef ONGOING_BAG_EFFECT // start an ongoing effect until the ongoing bag effect is coded bag_list[bag_id].ongoing_bag_effect_reference = ec_create_lamp(x, y, z, 0.0, 1.0, 0.75, (poor_man ? 6 : 10)); #endif // ONGOING_BAG_EFFECT } // Now, find a place into the bags list, so we can destroy the bag properly if (bag_list[bag_id].obj_3d_id != -1) { char buf[256]; // oops, slot already taken! safe_snprintf(buf, sizeof(buf), "Oops, trying to add an existing bag! id=%d\n", bag_id); LOG_ERROR(buf); return; } #ifdef OLD_MISC_OBJ_DIR obj_3d_id = add_e3d("./3dobjects/misc_objects/bag1.e3d", x, y, z, #else obj_3d_id = add_e3d("./3dobjects/bag1.e3d", x, y, z, #endif get_bag_tilt(bag_x, bag_y, bag_id, tile_map_size_x, tile_map_size_y), 0, get_bag_rotation(bag_x, bag_y, bag_id, tile_map_size_x, tile_map_size_y), 1, 0, 1.0f, 1.0f, 1.0f, 1); bag_list[bag_id].x=bag_x; bag_list[bag_id].y=bag_y; bag_list[bag_id].obj_3d_id=obj_3d_id; } }
int add_particle_sys (const char *file_name, float x_pos, float y_pos, float z_pos) #endif { if (use_eye_candy) { if (!strncmp("fou", file_name + 12, 3)) ec_create_fountain(x_pos, y_pos, z_pos + 0.15, 0.0, 1.0, (z_pos >= 0.8 ? z_pos - 0.8 : 0.0), 0, 1.0, (poor_man ? 6 : 10)); else if ((use_fancy_smoke) && (!strncmp("smo", file_name + 12, 3))) { if (file_name[17] == '1') ec_create_smoke(x_pos, y_pos, z_pos, 0.0, 1.0, 0.3, (poor_man ? 6 : 10)); else if (file_name[17] == '2') ec_create_smoke(x_pos, y_pos, z_pos, 0.0, 1.0, 0.45, (poor_man ? 6 : 10)); else if (file_name[17] == '3') ec_create_smoke(x_pos, y_pos, z_pos, 0.0, 1.0, 1.6, (poor_man ? 6 : 10)); else if (file_name[17] == '_') ec_create_smoke(x_pos, y_pos, z_pos, 0.0, 1.0, 1.1, (poor_man ? 6 : 10)); else ec_create_smoke(x_pos, y_pos, z_pos, 0.0, 1.0, 0.5, (poor_man ? 6 : 10)); } else if (!strncmp("tel", file_name + 12, 3)) { if (file_name[21] == 'i') { ec_create_selfmagic_teleport_to_the_portals_room(x_pos, y_pos, z_pos, (poor_man ? 6 : 10)); } else if (file_name[21] == 'o') { ec_create_selfmagic_teleport_to_the_portals_room(x_pos, y_pos, z_pos, (poor_man ? 6 : 10)); } else ec_create_teleporter(x_pos, y_pos, z_pos, 0.0, 1.0, 1.0, (poor_man ? 6 : 10)); } else if (!strncmp("fir", file_name + 12, 3)) { if (!strncmp("big", file_name + 17, 3)) ec_create_campfire(x_pos, y_pos, z_pos, 0.0, 1.0, (poor_man ? 6 : 10), 1.5); else if (!strncmp("for", file_name + 17, 3)) ec_create_campfire(x_pos, y_pos - 0.2, z_pos, 0.0, 1.0, (poor_man ? 6 : 10), 2.0); else if (!strncmp("min", file_name + 17, 3)) ec_create_campfire(x_pos, y_pos, z_pos, 0.0, 1.0, (poor_man ? 6 : 10), 0.4); else if (!strncmp("sma", file_name + 17, 3)) ec_create_campfire(x_pos, y_pos, z_pos, 0.0, 1.0, (poor_man ? 6 : 10), 0.6); else if (!strncmp("tor", file_name + 17, 3)) ec_create_lamp(x_pos, y_pos, z_pos, 0.0, 1.0, 1.6, (poor_man ? 6 : 10)); else { return -1; } } else if (!strncmp("can", file_name + 12, 3)) ec_create_candle(x_pos, y_pos, z_pos, 0.0, 1.0, 0.7, (poor_man ? 6 : 10)); else { return -1; } } // If we got here, the eye candy system handled this particle // system. Return an invalid particle ID to signal that nothing // was added to particles_list, but not -1 since this is not an // error. return -2; }