| 1024 | } |
| 1025 | |
| 1026 | xAnimTransition* xAnimTableNewTransition(xAnimTable* table, const char* source, const char* dest, |
| 1027 | xAnimTransitionConditionalCallback conditional, |
| 1028 | xAnimTransitionCallback callback, U32 flags, U32 userFlags, |
| 1029 | F32 srcTime, F32 destTime, U16 priority, U16 queuePriority, |
| 1030 | F32 blendRecip, U16* blendOffset) |
| 1031 | { |
| 1032 | xAnimTransition* tran; |
| 1033 | if (gxAnimUseGrowAlloc) |
| 1034 | { |
| 1035 | tran = (xAnimTransition*)xMemGrowAllocSize(sizeof(xAnimTransition)); |
| 1036 | } |
| 1037 | else |
| 1038 | { |
| 1039 | tran = (xAnimTransition*)xMemAllocSize(sizeof(xAnimTransition)); |
| 1040 | } |
| 1041 | |
| 1042 | if (blendRecip != 0.0f) |
| 1043 | { |
| 1044 | blendRecip = 1.0f / blendRecip; |
| 1045 | } |
| 1046 | |
| 1047 | tran->Next = table->TransitionList; |
| 1048 | table->TransitionList = tran; |
| 1049 | |
| 1050 | U8 isComplex = FALSE; |
| 1051 | if (dest == NULL || *dest == NULL) |
| 1052 | { |
| 1053 | tran->Dest = NULL; |
| 1054 | } |
| 1055 | else |
| 1056 | { |
| 1057 | for (S32 i = 0; dest[i] != NULL; ++i) |
| 1058 | { |
| 1059 | if (dest[i] == '@' || dest[i] == '~') |
| 1060 | { |
| 1061 | isComplex = true; |
| 1062 | break; |
| 1063 | } |
| 1064 | } |
| 1065 | tran->Dest = isComplex ? NULL : xAnimTableGetState(table, dest); |
| 1066 | } |
| 1067 | |
| 1068 | tran->Conditional = conditional; |
| 1069 | tran->Callback = callback; |
| 1070 | tran->Flags = flags; |
| 1071 | tran->UserFlags = userFlags; |
| 1072 | tran->SrcTime = srcTime; |
| 1073 | tran->DestTime = destTime; |
| 1074 | tran->Priority = priority; |
| 1075 | tran->QueuePriority = queuePriority; |
| 1076 | |
| 1077 | tran->BlendRecip = blendOffset != NULL ? CalcRecipBlendMax(blendOffset) : blendRecip; |
| 1078 | tran->BlendOffset = blendOffset; |
| 1079 | |
| 1080 | _xAnimTableAddTransition(table, tran, source, isComplex ? dest : NULL); |
| 1081 | |
| 1082 | return tran; |
| 1083 | } |