Flyable::Flyable(AbstractKart *kart, PowerupManager::PowerupType type, float mass) : Moveable(), TerrainInfo() { // get the appropriate data from the static fields m_speed = m_st_speed[type]; m_extend = m_st_extend[type]; m_max_height = m_st_max_height[type]; m_min_height = m_st_min_height[type]; m_average_height = (m_min_height+m_max_height)/2.0f; m_force_updown = m_st_force_updown[type]; m_owner = kart; m_type = type; m_has_hit_something = false; m_shape = NULL; m_mass = mass; m_adjust_up_velocity = true; m_time_since_thrown = 0; m_position_offset = Vec3(0,0,0); m_owner_has_temporary_immunity = true; m_do_terrain_info = true; m_max_lifespan = -1; // Add the graphical model setNode(irr_driver->addMesh(m_st_model[type], StringUtils::insertValues("flyable_%i", (int)type))); irr_driver->applyObjectPassShader(getNode()); #ifdef DEBUG std::string debug_name("flyable: "); debug_name += type; getNode()->setName(debug_name.c_str()); #endif } // Flyable
Item::Item(ItemType type, const Vec3& xyz, const Vec3& normal, scene::IMesh* mesh, scene::IMesh* lowres_mesh) { assert(type != ITEM_TRIGGER); // use other constructor for that m_distance_2 = 1.2f; initItem(type, xyz); m_original_rotation = shortestArcQuat(Vec3(0, 1, 0), normal); m_rotation_angle = 0.0f; m_original_mesh = mesh; m_original_lowmesh = lowres_mesh; m_listener = NULL; LODNode* lodnode = new LODNode("item", irr_driver->getSceneManager()->getRootSceneNode(), irr_driver->getSceneManager()); scene::IMeshSceneNode* meshnode = irr_driver->addMesh(mesh, StringUtils::insertValues("item_%i", (int)type)); if (lowres_mesh != NULL) { lodnode->add(35, meshnode, true); scene::IMeshSceneNode* meshnode = irr_driver->addMesh(lowres_mesh, StringUtils::insertValues("item_lo_%i", (int)type)); lodnode->add(100, meshnode, true); } else { lodnode->add(100, meshnode, true); } m_node = lodnode; //m_node = irr_driver->addMesh(mesh); #ifdef DEBUG std::string debug_name("item: "); debug_name += m_type; m_node->setName(debug_name.c_str()); #endif World::getWorld()->getTrack()->adjustForFog(m_node); m_node->setAutomaticCulling(scene::EAC_FRUSTUM_BOX); m_node->setPosition(xyz.toIrrVector()); Vec3 hpr; hpr.setHPR(m_original_rotation); m_node->setRotation(hpr.toIrrHPR()); m_node->grab(); } // Item(type, xyz, normal, mesh, lowres_mesh)
/** Constructor for an item. * \param type Type of the item. * \param xyz Location of the item. * \param normal The normal upon which the item is placed (so that it can * be aligned properly with the ground). * \param mesh The mesh to be used for this item. * \param owner 'Owner' of this item, i.e. the kart that drops it. This is * used to deactivate this item for the owner, i.e. avoid that a kart * 'collects' its own bubble gum. NULL means no owner, and the item * can be collected immediatley by any kart. */ Item::Item(ItemType type, const Vec3& xyz, const Vec3& normal, scene::IMesh* mesh, scene::IMesh* lowres_mesh, const AbstractKart *owner) : ItemState(type, owner) { m_was_available_previously = true; m_distance_2 = 1.2f; initItem(type, xyz, normal); m_graphical_type = getGrahpicalType(); LODNode* lodnode = new LODNode("item", irr_driver->getSceneManager()->getRootSceneNode(), irr_driver->getSceneManager()); scene::ISceneNode* meshnode = irr_driver->addMesh(mesh, StringUtils::insertValues("item_%i", (int)type)); if (lowres_mesh != NULL) { lodnode->add(35, meshnode, true); scene::ISceneNode* meshnode = irr_driver->addMesh(lowres_mesh, StringUtils::insertValues("item_lo_%i", (int)type)); lodnode->add(100, meshnode, true); } else { lodnode->add(100, meshnode, true); } m_node = lodnode; setType(type); handleNewMesh(getGrahpicalType()); #ifdef DEBUG std::string debug_name("item: "); debug_name += getType(); m_node->setName(debug_name.c_str()); #endif m_node->setAutomaticCulling(scene::EAC_FRUSTUM_BOX); m_node->setPosition(xyz.toIrrVector()); Vec3 hpr; hpr.setHPR(getOriginalRotation()); m_node->setRotation(hpr.toIrrHPR()); m_node->grab(); } // Item(type, xyz, normal, mesh, lowres_mesh)
bool _cdecl app_preinit( const wchar_t *cmdl ) { #if defined _DEBUG || defined _CRASH_HANDLER ts::exception_operator_c::set_unhandled_exception_filter(); #endif sodium_init(); if (!parsecmdl(cmdl)) return false; if (!check_autoupdate()) return false; #ifdef _FINAL if (g_commandline.checkinstance) if (!check_instance()) return false; #endif // _FINAL #if defined _DEBUG || defined _CRASH_HANDLER ts::exception_operator_c::dump_filename = ts::fn_change_name_ext(ts::get_exe_full_name(), ts::wstr_c(CONSTWSTR(APPNAME)).append_char('.').append(ts::to_wstr(application_c::appver())).as_sptr(), CONSTWSTR("dmp")); #endif ts::tsfileop_c::setup<fileop_c>(); ts::CHARz_copy( g_sysconf.name, CONSTWSTR(APPNAME) .s ); #ifndef _FINAL debug_name(); dotests0(); #endif TSNEW(application_c, cmdl); // not a memory leak! see SEV_EXIT handler return true; }