virtual void PhDataUpdate(dReal step) { int num=dBodyGetNumJoints(m_body); for(int i=0;i<num;i++) { dJointID joint=dBodyGetJoint(m_body,i); if(dJointGetType(joint)==dJointTypeContact) { dJointFeedback* feedback=dJointGetFeedback(joint); R_ASSERT2(feedback,"Feedback was not set!!!"); dxJoint* b_joint=(dxJoint*) joint; dBodyID other_body=b_joint->node[1].body; bool b_body_second=(b_joint->node[1].body==m_body); dReal* self_force=feedback->f1; dReal* self_torque=feedback->t1; dReal* othrers_force=feedback->f2; dReal* othrers_torque=feedback->t2; if(b_body_second) { other_body=b_joint->node[0].body; self_force=feedback->f2; self_torque=feedback->t2; othrers_force=feedback->f1; othrers_torque=feedback->t1; } save_max(m_max_force_self,_sqrt(dDOT( self_force,self_force))); save_max(m_max_torque_self,_sqrt(dDOT( self_torque,self_torque))); save_max(m_max_force_self_y,_abs(self_force[1])); save_max(m_max_force_self_sd,_sqrt(self_force[0]*self_force[0]+self_force[2]*self_force[2])); if(other_body) { dVector3 shoulder;dVectorSub(shoulder,dJointGetPositionContact(joint),dBodyGetPosition(other_body)); dReal shoulder_lenght=_sqrt(dDOT(shoulder,shoulder)); save_max(m_max_force_others,_sqrt(dDOT( othrers_force,othrers_force))); if(!fis_zero(shoulder_lenght)) save_max(m_max_torque_others,_sqrt(dDOT( othrers_torque,othrers_torque))/shoulder_lenght); } } } }
void CSE_ALifeInventoryBox::add_online (const bool &update_registries) { CSE_ALifeDynamicObjectVisual *object = (this); NET_Packet tNetPacket; ClientID clientID; clientID.set (object->alife().server().GetServerClient() ? object->alife().server().GetServerClient()->ID.value() : 0); ALife::OBJECT_IT I = object->children.begin(); ALife::OBJECT_IT E = object->children.end(); for ( ; I != E; ++I) { CSE_ALifeDynamicObject *l_tpALifeDynamicObject = ai().alife().objects().object(*I); CSE_ALifeInventoryItem *l_tpALifeInventoryItem = smart_cast<CSE_ALifeInventoryItem*>(l_tpALifeDynamicObject); R_ASSERT2 (l_tpALifeInventoryItem,"Non inventory item object has parent?!"); l_tpALifeInventoryItem->base()->s_flags.or(M_SPAWN_UPDATE); CSE_Abstract *l_tpAbstract = smart_cast<CSE_Abstract*>(l_tpALifeInventoryItem); object->alife().server().entity_Destroy(l_tpAbstract); #ifdef DEBUG // if (psAI_Flags.test(aiALife)) // Msg ("[LSS] Spawning item [%s][%s][%d]",l_tpALifeInventoryItem->base()->name_replace(),*l_tpALifeInventoryItem->base()->s_name,l_tpALifeDynamicObject->ID); Msg ( "[LSS][%d] Going online [%d][%s][%d] with parent [%d][%s] on '%s'", Device.dwFrame, Device.dwTimeGlobal, l_tpALifeInventoryItem->base()->name_replace(), l_tpALifeInventoryItem->base()->ID, ID, name_replace(), "*SERVER*" ); #endif l_tpALifeDynamicObject->o_Position = object->o_Position; l_tpALifeDynamicObject->m_tNodeID = object->m_tNodeID; object->alife().server().Process_spawn (tNetPacket,clientID,FALSE,l_tpALifeInventoryItem->base()); l_tpALifeDynamicObject->s_flags.and (u16(-1) ^ M_SPAWN_UPDATE); l_tpALifeDynamicObject->m_bOnline = true; } CSE_ALifeDynamicObjectVisual::add_online(update_registries); }
void CSE_ActorMP::UPDATE_Read (NET_Packet &packet) { flags = 0; m_u16NumItems = 1; velocity.set (0.f,0.f,0.f); if (get_health() <= 0) { actor_mp_state_holder tmp_state_holder; tmp_state_holder.read (packet); return; } m_state_holder.read (packet); R_ASSERT2(valid_pos(m_state_holder.state().position,phBoundaries), "read bad position"); m_AliveState.quaternion = m_state_holder.state().physics_quaternion; m_AliveState.angular_vel = m_state_holder.state().physics_angular_velocity; m_AliveState.linear_vel = m_state_holder.state().physics_linear_velocity; m_AliveState.force = m_state_holder.state().physics_force; m_AliveState.torque = m_state_holder.state().physics_torque; m_AliveState.position = m_state_holder.state().physics_position; o_Position = m_state_holder.state().position; accel = m_state_holder.state().logic_acceleration; o_model = m_state_holder.state().model_yaw; o_torso.yaw = m_state_holder.state().camera_yaw; o_torso.pitch = m_state_holder.state().camera_pitch; o_torso.roll = m_state_holder.state().camera_roll; timestamp = m_state_holder.state().time; weapon = m_state_holder.state().inventory_active_slot; mstate = m_state_holder.state().body_state_flags; set_health ( m_state_holder.state().health ); fRadiation = m_state_holder.state().radiation; m_AliveState.enabled = m_state_holder.state().physics_state_enabled; m_ready_to_update = true; //Msg("* Client 0x%08x UPDATE_Read, health is: %2.04f", this->ID, m_state_holder.state().health); }
void CUICaption::addCustomMessage(const shared_str& msg_name, float x, float y, float font_size, CGameFont *pFont, CGameFont::EAligment al, u32 color, LPCSTR def_str) { // R_ASSERT2( (m_indices.find(msg_name) == m_indices.end()),"message already defined !!!" ); R_ASSERT2( u32(-1)==findIndexOf_(msg_name),"message already defined !!!" ); SinglePhrase * sp = AddPhrase(); sp->outX = x; sp->outY = y; sp->effect.SetFontSize(font_size); sp->effect.SetFont(pFont); sp->effect.SetTextColor(color); sp->effect.SetFontAlignment(al); sp->str = *CStringTable().translate(def_str); sp->key = msg_name; // m_indices[msg_name] = m_vPhrases.size()-1; }
void CSE_ALifeInventoryItem::UPDATE_Write (NET_Packet &tNetPacket) { if (!m_u8NumItems) { tNetPacket.w_u8 (0); return; } mask_num_items num_items; num_items.mask = 0; num_items.num_items = m_u8NumItems; R_ASSERT2 ( num_items.num_items < (u8(1) << 5), make_string("%d",num_items.num_items) ); if (State.enabled) num_items.mask |= inventory_item_state_enabled; if (fis_zero(State.angular_vel.square_magnitude())) num_items.mask |= inventory_item_angular_null; if (fis_zero(State.linear_vel.square_magnitude())) num_items.mask |= inventory_item_linear_null; tNetPacket.w_u8 (num_items.common); tNetPacket.w_vec3 (State.position); tNetPacket.w_float_q8 (State.quaternion.x,0.f,1.f); tNetPacket.w_float_q8 (State.quaternion.y,0.f,1.f); tNetPacket.w_float_q8 (State.quaternion.z,0.f,1.f); tNetPacket.w_float_q8 (State.quaternion.w,0.f,1.f); if (!check(num_items.mask,inventory_item_angular_null)) { tNetPacket.w_float_q8 (State.angular_vel.x,0.f,10*PI_MUL_2); tNetPacket.w_float_q8 (State.angular_vel.y,0.f,10*PI_MUL_2); tNetPacket.w_float_q8 (State.angular_vel.z,0.f,10*PI_MUL_2); } if (!check(num_items.mask,inventory_item_linear_null)) { tNetPacket.w_float_q8 (State.linear_vel.x,-32.f,32.f); tNetPacket.w_float_q8 (State.linear_vel.y,-32.f,32.f); tNetPacket.w_float_q8 (State.linear_vel.z,-32.f,32.f); } };
void CSE_ALifeInventoryItem::UPDATE_Read (NET_Packet &tNetPacket) { tNetPacket.r_u8 (m_u8NumItems); if (!m_u8NumItems) { return; } mask_num_items num_items; num_items.common = m_u8NumItems; m_u8NumItems = num_items.num_items; R_ASSERT2 ( m_u8NumItems < (u8(1) << 5), make_string("%d",m_u8NumItems) ); tNetPacket.r_vec3 (State.position); tNetPacket.r_float_q8 (State.quaternion.x,0.f,1.f); tNetPacket.r_float_q8 (State.quaternion.y,0.f,1.f); tNetPacket.r_float_q8 (State.quaternion.z,0.f,1.f); tNetPacket.r_float_q8 (State.quaternion.w,0.f,1.f); State.enabled = check(num_items.mask,inventory_item_state_enabled); if (!check(num_items.mask,inventory_item_angular_null)) { tNetPacket.r_float_q8 (State.angular_vel.x,0.f,10*PI_MUL_2); tNetPacket.r_float_q8 (State.angular_vel.y,0.f,10*PI_MUL_2); tNetPacket.r_float_q8 (State.angular_vel.z,0.f,10*PI_MUL_2); } else State.angular_vel.set (0.f,0.f,0.f); if (!check(num_items.mask,inventory_item_linear_null)) { tNetPacket.r_float_q8 (State.linear_vel.x,-32.f,32.f); tNetPacket.r_float_q8 (State.linear_vel.y,-32.f,32.f); tNetPacket.r_float_q8 (State.linear_vel.z,-32.f,32.f); } else State.linear_vel.set (0.f,0.f,0.f); };
void xrServer::Process_update(NET_Packet& P, ClientID sender) { xrClientData* CL = ID_to_client(sender); R_ASSERT2 (CL,"Process_update client not found"); if (g_Dump_Update_Read) Msg("---- UPDATE_Read --- "); R_ASSERT(CL->flags.bLocal); // while has information while (!P.r_eof()) { // find entity u16 ID; u8 size; P.r_u16 (ID); P.r_u8 (size); u32 _pos = P.r_tell(); CSE_Abstract *E = ID_to_entity(ID); if (E) { //Msg ("sv_import: %d '%s'",E->ID,E->name_replace()); E->net_Ready = TRUE; E->UPDATE_Read (P); u32 cp = P.r_tell(); if (g_Dump_Update_Read) Msg("* %s : %d - %d", E->name(), size, cp - _pos); if ((cp - _pos) != size) { string16 tmp; CLSID2TEXT (E->m_tClassID,tmp); Msg("* size = %d, start read = %d, end read = %d", size, _pos, cp); Debug.fatal (DEBUG_INFO,"Beer from the creator of '%s', version of object = %d", tmp, E->m_wVersion); } } else P.r_advance (size); } if (g_Dump_Update_Read) Msg("-------------------- "); }
void CUIGameCTA::ShowBuyMenu() { if (Level().IsDemoPlay()) return; R_ASSERT2(m_pCurBuyMenu, "buy menu not initialized"); if (!m_pCurBuyMenu->IsShown()) { m_pCurBuyMenu->IgnoreMoneyAndRank(m_game->InWarmUp()); m_pCurBuyMenu->ResetItems(); m_pCurBuyMenu->SetupPlayerItemsBegin(); SetPlayerItemsToBuyMenu(); SetPlayerParamsToBuyMenu(); m_pCurBuyMenu->SetupPlayerItemsEnd(); m_pCurBuyMenu->ShowDialog(true); m_game->OnBuyMenuOpen(); } }
void CPhysicObject::RunStartupAnim(CSE_Abstract *D) { if(Visual()&&smart_cast<IKinematics*>(Visual())) { // CSE_PHSkeleton *po = smart_cast<CSE_PHSkeleton*>(D); IKinematicsAnimated* PKinematicsAnimated=NULL; R_ASSERT (Visual()&&smart_cast<IKinematics*>(Visual())); PKinematicsAnimated =smart_cast<IKinematicsAnimated*>(Visual()); if(PKinematicsAnimated) { CSE_Visual *visual = smart_cast<CSE_Visual*>(D); R_ASSERT (visual); R_ASSERT2 (*visual->startup_animation,"no startup animation"); VERIFY2( (!!PKinematicsAnimated->LL_MotionID( visual->startup_animation.c_str() ) .valid() ) , ( make_string(" animation %s not faund ",visual->startup_animation.c_str() ) + dbg_object_base_dump_string( this )).c_str() ); m_anim_blend = m_anim_script_callback.play_cycle( PKinematicsAnimated, visual->startup_animation ); } smart_cast<IKinematics*>(Visual())->CalculateBones_Invalidate(); smart_cast<IKinematics*>(Visual())->CalculateBones (TRUE); } }
void message_filter::check_new_data (NET_Packet & packet) { u32 tmp_old_pos = packet.r_tell(); msg_type_subtype_t packet_mtype; packet_mtype.import (packet); if (packet_mtype.msg_type == M_EVENT_PACK) { NET_Packet tmp_packet; while (!packet.r_eof()) { tmp_packet.B.count = packet.r_u8(); packet.r (tmp_packet.B.data, tmp_packet.B.count); packet_mtype.import(tmp_packet); R_ASSERT2(packet_mtype.msg_type != M_EVENT_PACK, "M_EVENT_PACK in M_EVENT_PACK"); dbg_print_msg (tmp_packet, packet_mtype); filters_map_t::iterator tmp_iter = m_filters.find(packet_mtype); if (tmp_iter != m_filters.end()) { tmp_iter->second(packet_mtype.msg_type, packet_mtype.msg_subtype, tmp_packet); } } } else { dbg_print_msg (packet, packet_mtype); filters_map_t::iterator tmp_iter = m_filters.find(packet_mtype); if (tmp_iter != m_filters.end()) { tmp_iter->second(packet_mtype.msg_type, packet_mtype.msg_subtype, packet); } } packet.r_seek (tmp_old_pos); }
void CEngine::Initialize(void) { // Other stuff string_path fn; strconcat (sizeof(fn),fn,UI->EditorName(),".log"); FS.update_path (fn,_local_root_,fn); #ifdef _EDITOR // Bind PSGP ZeroMemory (&PSGP,sizeof(PSGP)); hPSGP = LoadLibrary("xrCPU_Pipe.dll"); R_ASSERT2 (hPSGP,"Can't find 'xrCPU_Pipe.dll'"); xrBinder* bindCPU = (xrBinder*)GetProcAddress(hPSGP,"xrBind_PSGP"); R_ASSERT(bindCPU); bindCPU (&PSGP, CPU::ID.feature /*& CPU::ID.os_support*/); // for compliance with editor PSGP.skin1W = xrSkin1W_x86; PSGP.skin2W = xrSkin2W_x86; #endif ReloadSettings (); }
void CUIBagWnd::OnBackClick(){ int iGroup; switch (GetMenuLevel()) { case mlRoot: R_ASSERT2(false,"error: CUIBagWnd on level <mlRoot> can't handle OnBackClick"); break; case mlBoxes: ShowSectionEx(-1); break; case mlWpnSubType: iGroup = GetCurrentGroupIndex(); if (iGroup >= GROUP_31 && iGroup <= GROUP_34 ) ShowSectionEx(GROUP_BOXES); else ShowSectionEx(-1); break; default: NODEFAULT; } }
void* FileDecompress(const char* fn, const char* sign, u32* size) { MARK M, F; mk_mark(M, sign); int H = open(fn, O_BINARY | O_RDONLY); R_ASSERT2(H > 0, fn); _read(H, &F, 8); if (strncmp(M, F, 8) != 0) { F[8] = 0; Msg("FATAL: signatures doesn't match, file(%s) / requested(%s)", F, sign); } R_ASSERT(strncmp(M, F, 8) == 0); void* ptr = 0; u32 SZ; SZ = _readLZ(H, ptr, filelength(H) - 8); _close(H); if (size) *size = SZ; return ptr; }
const CUILine* CUILine::CutWord(CGameFont* pFont, float length){ xr_delete(m_tmpLine); m_tmpLine = xr_new<CUILine>(); float len = 0; for (u32 i= 0; i<m_subLines[0].m_text.length(); i++) { float ll = pFont->SizeOf_(m_subLines[0].m_text[i]); UI()->ClientToScreenScaledWidth(ll); len += ll; if (len>length){ m_tmpLine->AddSubLine(m_subLines[0].Cut2Pos((i?i:1)-1)); return m_tmpLine; } } R_ASSERT2(false, "meaningless call of CUILine::CutWord() ):"); return m_tmpLine; }
void CWeaponPistol::OnShot () { PlaySound (m_sSndShotCurrent.c_str(),get_LastFP()); AddShotEffector (); PlayAnimShoot (); // Shell Drop Fvector vel; PHGetLinearVell(vel); OnShellDrop (get_LastSP(), vel); // ќгонь из ствола StartFlameParticles (); R_ASSERT2(!m_pFlameParticles || !m_pFlameParticles->IsLooped(), "can't set looped particles system for shoting with pistol"); //дым из ствола StartSmokeParticles (get_LastFP(), vel); }
CGameSpy_Browser::CGameSpy_Browser() #ifdef PROFILE_CRITICAL_SECTIONS :m_refresh_lock(MUTEX_PROFILE_ID(CGameSpy_Browser::m_refresh_lock)) #endif // PROFILE_CRITICAL_SECTIONS { //------------------------- m_hGameSpyDLL = NULL; m_pQR2 = NULL; m_pGSBrowser = NULL; m_pServerList = NULL; //------------------------- LPCSTR g_name = "xrGameSpy.dll"; Log ("Loading DLL:",g_name); m_hGameSpyDLL = LoadLibrary (g_name); if (0==m_hGameSpyDLL) R_CHK (GetLastError()); R_ASSERT2 (m_hGameSpyDLL,"GameSpy DLL raised exception during loading or there is no game DLL at all"); //------------------------- LoadGameSpy(m_hGameSpyDLL); //------------------------- InitInternalData(m_hGameSpyDLL); };
void engine::expand_class ( cs::lua_debugger::backend& backend, cs::lua_debugger::value_to_expand& value, lua_State* const state ) { int start = lua_gettop(state); luabind::detail::class_rep *class_object = static_cast<luabind::detail::class_rep*>(lua_touserdata(state,-1)); R_ASSERT2 (class_object, "invalid class userdata"); fill_class_data (backend, value, state); luabind::detail::object_rep *object = luabind::detail::is_class_object(state,-2); if (!object) lua_pushnil (state); if (lua_gettop(state) <= start + 1) return; lua_pop_value (state,1); }
void CPortal::Setup (Fvector* V, int vcnt, CSector* face, CSector* back) { // calc sphere Fbox BB; BB.invalidate (); for (int v=0; v<vcnt; v++) BB.modify (V[v]); BB.getsphere (S.P,S.R); // poly.assign (V,vcnt); pFace = face; pBack = back; marker = 0xffffffff; Fvector N,T; N.set (0,0,0); FPU::m64r(); u32 _cnt = 0; for (int i=2; i<vcnt; i++) { T.mknormal_non_normalized (poly[0],poly[i-1],poly[i]); float m = T.magnitude (); if (m>EPS_S) { N.add (T.div(m)) ; _cnt ++ ; } } R_ASSERT2 (_cnt, "Invalid portal detected"); N.div (float(_cnt)); P.build (poly[0],N); FPU::m24r (); /* if (_abs(1-P.n.magnitude())<EPS) xrDebug::Fatal (DEBUG_INFO,"Degenerated portal found at {%3.2f,%3.2f,%3.2f}.",VPUSH(poly[0])); */ }
void CObjectActionShow::initialize () { inherited::initialize (); VERIFY (m_item); u32 slot = m_item->GetSlot(); R_ASSERT2 (slot < (u8)NO_ACTIVE_SLOT, m_item->Name()); CInventory &inv = object().inventory(); PIItem item = inv.m_slots[slot].m_pIItem; if (item) inv.Ruck (item); //. object().inventory().SetActiveSlot(NO_ACTIVE_SLOT); inv.Slot (m_item); /* bool result = object().inventory().Activate (m_item->GetSlot()); VERIFY (result); */ if (!m_weapon) return; }
float CGameGraphBuilder::path_distance (const u32 &game_vertex_id0, const u32 &game_vertex_id1) { // return (graph().vertex(game_vertex_id0)->data().level_point().distance_to(graph().vertex(game_vertex_id1)->data().level_point())); VERIFY (m_graph_engine); graph_type::CVertex &vertex0 = *graph().vertex(game_vertex_id0); graph_type::CVertex &vertex1 = *graph().vertex(game_vertex_id1); typedef GraphEngineSpace::CStraightLineParams CStraightLineParams; CStraightLineParams parameters(vertex0.data().level_point(),vertex1.data().level_point()); float pure_distance = vertex0.data().level_point().distance_to_xz(vertex1.data().level_point()); // float pure_distance = vertex0.data().level_point().distance_to(vertex1.data().level_point()); VERIFY (pure_distance < parameters.max_range); u32 level_vertex_id = level_graph().check_position_in_direction(vertex0.data().level_vertex_id(),vertex0.data().level_point(),vertex1.data().level_point()); if (level_graph().valid_vertex_id(level_vertex_id)) return (pure_distance); bool successfull = m_graph_engine->search( level_graph(), vertex0.data().level_vertex_id(), vertex1.data().level_vertex_id(), &m_path, parameters ); if (successfull) return (parameters.m_distance); Msg ("Cannot build path from [%d] to [%d]",game_vertex_id0,game_vertex_id1); Msg ("Cannot build path from [%f][%f][%f] to [%f][%f][%f]",VPUSH(vertex0.data().level_point()),VPUSH(vertex1.data().level_point())); R_ASSERT2 (false,"Cannot build path, check AI map"); return (flt_max); }
void CTextConsole::CreateConsoleWnd() { HINSTANCE hInstance = (HINSTANCE)GetModuleHandle(0); //---------------------------------- RECT cRc; GetClientRect(*m_pMainWnd, &cRc); INT lX = cRc.left; INT lY = cRc.top; INT lWidth = cRc.right - cRc.left; INT lHeight = cRc.bottom - cRc.top; //---------------------------------- const char* wndclass ="TEXT_CONSOLE"; // Register the windows class WNDCLASS wndClass = { 0, TextConsole_WndProc, 0, 0, hInstance, NULL, LoadCursor( hInstance, IDC_ARROW ), GetStockBrush(GRAY_BRUSH), NULL, wndclass }; RegisterClass( &wndClass ); // Set the window's initial style u32 dwWindowStyle = WS_OVERLAPPED | WS_CHILD | WS_VISIBLE;// | WS_CLIPSIBLINGS;// | WS_CLIPCHILDREN; // Set the window's initial width RECT rc; SetRect ( &rc, lX, lY, lWidth, lHeight ); // AdjustWindowRect( &rc, dwWindowStyle, FALSE ); // Create the render window m_hConsoleWnd = CreateWindow( wndclass, "XRAY Text Console", dwWindowStyle, lX, lY, lWidth, lHeight, *m_pMainWnd, 0, hInstance, 0L ); //--------------------------------------------------------------------------- R_ASSERT2(m_hConsoleWnd, "Unable to Create TextConsole Window!"); };
void CLevel::cl_Process_Spawn(NET_Packet& P) { // Begin analysis shared_str s_name; P.r_stringZ (s_name); // Create DC (xrSE) CSE_Abstract* E = F_entity_Create (*s_name); R_ASSERT2(E, *s_name); E->Spawn_Read (P); if (E->s_flags.is(M_SPAWN_UPDATE)) E->UPDATE_Read (P); if (!E->match_configuration()) { F_entity_Destroy(E); return; } //------------------------------------------------- //. Msg ("M_SPAWN - %s[%d][%x] - %d %d", *s_name, E->ID, E,E->ID_Parent, Device.dwFrame); //------------------------------------------------- //force object to be local for server client if (OnServer()) { E->s_flags.set(M_SPAWN_OBJECT_LOCAL, TRUE); }; /* game_spawn_queue.push_back(E); if (g_bDebugEvents) ProcessGameSpawns(); /*/ g_sv_Spawn (E); F_entity_Destroy (E); //*/ };
void CUIPdaListItem::Init(float x, float y, float width, float height) { inherited::Init (x, y, width, height); CUIXml uiXml; bool xml_result = uiXml.Init (CONFIG_PATH, UI_PATH, PDA_CONTACT_CHAR); R_ASSERT2 (xml_result, "xml file not found"); CUIXmlInit xml_init; UIInfo = xr_new<CUICharacterInfo> (); UIInfo->SetAutoDelete (true); AttachChild (UIInfo); UIInfo->Init (0, 0, width, height, PDA_CONTACT_CHAR); if (uiXml.NavigateToNode ("mask_frame_window", 0)) { UIMask = xr_new<CUIFrameWindow> (); UIMask->SetAutoDelete (true); xml_init.InitFrameWindow (uiXml, "mask_frame_window", 0, UIMask); UIInfo->UIIcon().SetMask (UIMask); } xml_init.InitAutoStaticGroup (uiXml,"pda_char_auto_statics", 0, this); }
void CCharacterPhysicsSupport::CreateSkeleton(CPhysicsShell* &pShell) { R_ASSERT2(!pShell,"pShell already initialized!!"); if (!m_EntityAlife.Visual()) return; #ifdef DEBUG CTimer t;t.Start(); #endif pShell = P_create_Shell(); pShell->preBuild_FromKinematics(smart_cast<CKinematics*>(m_EntityAlife.Visual())); pShell->mXFORM.set(mXFORM); pShell->SetAirResistance(skel_airr_lin_factor,skel_airr_ang_factor); pShell->SmoothElementsInertia(0.3f); pShell->set_PhysicsRefObject(&m_EntityAlife); SAllDDOParams disable_params; disable_params.Load(smart_cast<CKinematics*>(m_EntityAlife.Visual())->LL_UserData()); pShell->set_DisableParams(disable_params); pShell->Build(); #ifdef DEBUG Msg("shell for %s[%d] created in %f ms",*m_EntityAlife.cName(),m_EntityAlife.ID(),t.GetElapsed_sec()*1000.f); #endif }
void CLevelSpawnConstructor::update_artefact_spawn_positions () { u32 level_point_count = m_game_spawn_constructor->level_point_count(); SPAWN_STORAGE::iterator I = m_spawns.begin(); SPAWN_STORAGE::iterator E = m_spawns.end(); for ( ; I != E; ++I) { CSE_Abstract *abstract = *I; CSE_ALifeObject *alife_object = smart_cast<CSE_ALifeObject*>(abstract); // R_ASSERT3 (level_graph().valid_vertex_id(alife_object->m_tNodeID),"Invalid node for object ",alife_object->name_replace()); R_ASSERT2 (alife_object,"Non-ALife object!"); VERIFY (game_graph().vertex(alife_object->m_tGraphID)->level_id() == m_level.id()); // alife_object->m_spawn_control = ""; CSE_ALifeAnomalousZone *zone = smart_cast<CSE_ALifeAnomalousZone*>(abstract); if (zone) { zone->m_artefact_position_offset = level_point_count; level_point_count += zone->m_artefact_spawn_count; // Msg ("%s %f [%f][%f][%f] : artefact spawn positions",zone->name_replace(),zone->m_fRadius,VPUSH(zone->o_Position)); // for (u32 i=zone->m_artefact_position_offset; i<level_point_count; ++i) // Msg (" [%f][%f][%f] : %f",VPUSH(m_level_points[i].tPoint),zone->o_Position.distance_to(m_level_points[i].tPoint)); } } m_game_spawn_constructor->add_level_points (m_level_points); }
void CUISkinSelectorWnd::Init(const char* strSectionName) { R_ASSERT(0 != strSectionName[0]); m_strSection = strSectionName; CUIXml xml_doc; bool xml_result = xml_doc.Init(CONFIG_PATH, UI_PATH, "skin_selector.xml"); R_ASSERT2(xml_result, "xml file not found"); CUIXmlInit::InitWindow(xml_doc,"skin_selector", 0, this); CUIXmlInit::InitStatic(xml_doc,"skin_selector:caption", 0, m_pCaption); CUIXmlInit::InitStatic(xml_doc,"skin_selector:background", 0, m_pBackground); CUIXmlInit::InitStatic(xml_doc,"skin_selector:image_frames",0, m_pFrames); CUIXmlInit::Init3tButton(xml_doc,"skin_selector:image_frames:btn_left", 0, m_pButtons[0]); CUIXmlInit::Init3tButton(xml_doc,"skin_selector:image_frames:btn_right",0, m_pButtons[1]); CUIXmlInit::InitAnimatedStatic(xml_doc,"skin_selector:image_frames:a_static_1", 0, m_pAnims[0]); CUIXmlInit::InitAnimatedStatic(xml_doc,"skin_selector:image_frames:a_static_2", 0, m_pAnims[1]); CUIXmlInit::Init3tButton(xml_doc,"skin_selector:btn_spectator", 0,m_pBtnSpectator); CUIXmlInit::Init3tButton(xml_doc,"skin_selector:btn_autoselect",0,m_pBtnAutoSelect); CUIXmlInit::Init3tButton(xml_doc,"skin_selector:btn_back", 0,m_pBtnBack); if (xml_doc.NavigateToNode("skin_selector:skin_shader",0)) m_shader = xml_doc.Read("skin_selector:skin_shader",0,""); InitSkins(); string64 buff; for (int i = 0; i<4; i++) { sprintf_s(buff,"skin_selector:image_%d",i); CUIXmlInit::InitStatic(xml_doc,buff,0,m_pImage[i]); } UpdateSkins(); }
CScriptGameObject::CScriptGameObject (CGameObject *game_object) { m_game_object = game_object; m_lua_state = NULL; R_ASSERT2 (m_game_object,"Null actual object passed!"); }
void CEngineAPI::Initialize(void) { ////////////////////////////////////////////////////////////////////////// // render LPCSTR r1_name = "xrRender_R1.dll"; #ifndef DEDICATED_SERVER LPCSTR r2_name = "xrRender_R2.dll"; LPCSTR r3_name = "xrRender_R3.dll"; if (psDeviceFlags.test(rsR3)) { // try to initialize R3 Log ("Loading DLL:", r3_name); hRender = LoadLibrary (r3_name); if (0==hRender) { // try to load R1 Msg ("! ...Failed - incompatible hardware/pre-Vista OS."); psDeviceFlags.set (rsR2,TRUE); } } if (psDeviceFlags.test(rsR2)) { // try to initialize R2 psDeviceFlags.set (rsR3,FALSE); Log ("Loading DLL:", r2_name); hRender = LoadLibrary (r2_name); if (0==hRender) { // try to load R1 Msg ("! ...Failed - incompatible hardware."); } } #endif if (0==hRender) { // try to load R1 psDeviceFlags.set (rsR3,FALSE); psDeviceFlags.set (rsR2,FALSE); renderer_value = 0; //con cmd Log ("Loading DLL:", r1_name); hRender = LoadLibrary (r1_name); if (0==hRender) R_CHK (GetLastError()); R_ASSERT (hRender); } Device.ConnectToRender(); // game { LPCSTR g_name = "xrGame.dll"; Log ("Loading DLL:",g_name); hGame = LoadLibrary (g_name); if (0==hGame) R_CHK (GetLastError()); R_ASSERT2 (hGame,"Game DLL raised exception during loading or there is no game DLL at all"); pCreate = (Factory_Create*) GetProcAddress(hGame,"xrFactory_Create" ); R_ASSERT(pCreate); pDestroy = (Factory_Destroy*) GetProcAddress(hGame,"xrFactory_Destroy" ); R_ASSERT(pDestroy); } ////////////////////////////////////////////////////////////////////////// // vTune tune_enabled = FALSE; if (strstr(Core.Params,"-tune")) { LPCSTR g_name = "vTuneAPI.dll"; Log ("Loading DLL:",g_name); hTuner = LoadLibrary (g_name); if (0==hTuner) R_CHK (GetLastError()); R_ASSERT2 (hTuner,"Intel vTune is not installed"); tune_enabled = TRUE; tune_pause = (VTPause*) GetProcAddress(hTuner,"VTPause" ); R_ASSERT(tune_pause); tune_resume = (VTResume*) GetProcAddress(hTuner,"VTResume" ); R_ASSERT(tune_resume); } }
CTrade* CInventoryOwner::GetTrade() { R_ASSERT2(m_pTrade, "trade for object does not init yet"); return m_pTrade; }
void CRender::level_Load(IReader* fs) { R_ASSERT (0!=g_pGameLevel); R_ASSERT (!b_loaded); // Begin pApp->LoadBegin (); dxRenderDeviceRender::Instance().Resources->DeferredLoad (TRUE); IReader* chunk; // Shaders // g_pGamePersistent->LoadTitle ("st_loading_shaders"); g_pGamePersistent->LoadTitle (); { chunk = fs->open_chunk (fsL_SHADERS); R_ASSERT2 (chunk,"Level doesn't builded correctly."); u32 count = chunk->r_u32 (); Shaders.resize (count); for(u32 i=0; i<count; i++) // skip first shader as "reserved" one { string512 n_sh,n_tlist; LPCSTR n = LPCSTR(chunk->pointer()); chunk->skip_stringZ (); if (0==n[0]) continue; xr_strcpy (n_sh,n); LPSTR delim = strchr(n_sh,'/'); *delim = 0; xr_strcpy (n_tlist,delim+1); Shaders[i] = dxRenderDeviceRender::Instance().Resources->Create(n_sh,n_tlist); } chunk->close(); } // Components Wallmarks = xr_new<CWallmarksEngine> (); Details = xr_new<CDetailManager> (); if (!g_dedicated_server) { // VB,IB,SWI // g_pGamePersistent->LoadTitle("st_loading_geometry"); g_pGamePersistent->LoadTitle(); { CStreamReader *geom = FS.rs_open("$level$","level.geom"); R_ASSERT2 (geom, "level.geom"); LoadBuffers (geom,FALSE); LoadSWIs (geom); FS.r_close (geom); } //...and alternate/fast geometry { CStreamReader *geom = FS.rs_open("$level$","level.geomx"); R_ASSERT2 (geom, "level.geomX"); LoadBuffers (geom,TRUE); FS.r_close (geom); } // Visuals // g_pGamePersistent->LoadTitle("st_loading_spatial_db"); g_pGamePersistent->LoadTitle(); chunk = fs->open_chunk(fsL_VISUALS); LoadVisuals (chunk); chunk->close (); // Details // g_pGamePersistent->LoadTitle("st_loading_details"); g_pGamePersistent->LoadTitle(); Details->Load (); } // Sectors // g_pGamePersistent->LoadTitle("st_loading_sectors_portals"); g_pGamePersistent->LoadTitle(); LoadSectors (fs); // 3D Fluid Load3DFluid (); // HOM HOM.Load (); // Lights // pApp->LoadTitle ("Loading lights..."); LoadLights (fs); // End pApp->LoadEnd (); // sanity-clear lstLODs.clear (); lstLODgroups.clear (); mapLOD.clear (); // signal loaded b_loaded = TRUE ; }