| 1026 | } |
| 1027 | |
| 1028 | void afxConstraintMgr::initConstraintDefs(Vector<afxConstraintDef>& all_defs, bool on_server, F32 scoping_dist) |
| 1029 | { |
| 1030 | mInitialized = true; |
| 1031 | mOn_server = on_server; |
| 1032 | |
| 1033 | if (scoping_dist > 0.0) |
| 1034 | mScoping_dist_sq = scoping_dist*scoping_dist; |
| 1035 | else |
| 1036 | { |
| 1037 | SceneManager* sg = (on_server) ? gServerSceneGraph : gClientSceneGraph; |
| 1038 | F32 vis_dist = (sg) ? sg->getVisibleDistance() : 1000.0f; |
| 1039 | mScoping_dist_sq = vis_dist*vis_dist; |
| 1040 | } |
| 1041 | |
| 1042 | if (all_defs.size() < 1) |
| 1043 | return; |
| 1044 | |
| 1045 | // find effect ghost constraints |
| 1046 | if (!on_server) |
| 1047 | { |
| 1048 | Vector<afxConstraintDef> ghost_defs; |
| 1049 | |
| 1050 | for (S32 i = 0; i < all_defs.size(); i++) |
| 1051 | if (all_defs[i].mDef_type == afxConstraintDef::CONS_GHOST && all_defs[i].mCons_src_name != ST_NULLSTRING) |
| 1052 | ghost_defs.push_back(all_defs[i]); |
| 1053 | |
| 1054 | if (ghost_defs.size() > 0) |
| 1055 | { |
| 1056 | // sort the defs |
| 1057 | if (ghost_defs.size() > 1) |
| 1058 | dQsort(ghost_defs.address(), ghost_defs.size(), sizeof(afxConstraintDef), cmp_cons_defs); |
| 1059 | |
| 1060 | S32 last = 0; |
| 1061 | defineConstraint(OBJECT_CONSTRAINT, ghost_defs[0].mCons_src_name); |
| 1062 | |
| 1063 | for (S32 i = 1; i < ghost_defs.size(); i++) |
| 1064 | { |
| 1065 | if (ghost_defs[last].mCons_src_name != ghost_defs[i].mCons_src_name) |
| 1066 | { |
| 1067 | defineConstraint(OBJECT_CONSTRAINT, ghost_defs[i].mCons_src_name); |
| 1068 | last++; |
| 1069 | } |
| 1070 | } |
| 1071 | } |
| 1072 | } |
| 1073 | |
| 1074 | Vector<afxConstraintDef> defs; |
| 1075 | |
| 1076 | // collect defs that run here (server or client) |
| 1077 | if (on_server) |
| 1078 | { |
| 1079 | for (S32 i = 0; i < all_defs.size(); i++) |
| 1080 | if (all_defs[i].mRuns_on_server) |
| 1081 | defs.push_back(all_defs[i]); |
| 1082 | } |
| 1083 | else |
| 1084 | { |
| 1085 | for (S32 i = 0; i < all_defs.size(); i++) |
no test coverage detected