2163 lines
66 KiB
C
2163 lines
66 KiB
C
|
|
DEFINE_SCRIPT(APP_GetUserFileName,
|
|
CATEGORY(Application) PARAM_STRING(Filter) PARAM_STRING_OPT(SubDirectory, "") PARAM_INT_OPT(saveMode, 0),
|
|
"Filter define the type of file : exemple (Script file|*.TXT;*.FOU;*.LUA)",
|
|
{
|
|
char Name[2048];
|
|
memset(Name, 0, sizeof(Name));
|
|
extern HWND hWnd;
|
|
ulLockMode = 1;
|
|
if (*SubDirectory)
|
|
CDLG_USR_GetFileName(Name, Filter,hWnd,0,SubDirectory, saveMode);
|
|
else
|
|
CDLG_USR_GetFileName(Name, Filter,hWnd,1, NULL, saveMode);
|
|
ulLockMode = 0;
|
|
RETURN_STRING(Name);
|
|
})
|
|
DEFINE_SCRIPT(APP_GetUserFileDir,
|
|
CATEGORY(Application) PARAM_STRING_OPT(SubDirectory, ""),
|
|
"Filter define the type of file : exemple (Script file|*.TXT;*.FOU;*.LUA)",
|
|
{
|
|
char Name[2048];
|
|
memset(Name, 0, sizeof(Name));
|
|
extern HWND hWnd;
|
|
ulLockMode = 1;
|
|
if (*SubDirectory)
|
|
CDLG_USR_GetDirName(Name,hWnd,SubDirectory);
|
|
else
|
|
CDLG_USR_GetDirName(Name,hWnd, NULL);
|
|
ulLockMode = 0;
|
|
RETURN_STRING(Name);
|
|
})
|
|
|
|
DEFINE_SCRIPT(APP_GetExePath,
|
|
CATEGORY(Application),
|
|
"Get exe path",
|
|
{
|
|
char CurrentDir[2049];
|
|
GetModuleFileName(NULL,CurrentDir,2048);
|
|
RETURN_STRING(CurrentDir);
|
|
})
|
|
|
|
DEFINE_SCRIPT(APP_GetFreeDiskSpace,
|
|
CATEGORY(Application) PARAM_STRING_OPT(directory, ""),
|
|
"Get free disk space in MB",
|
|
{
|
|
ULARGE_INTEGER freeBytes;
|
|
ULARGE_INTEGER totalBytes;
|
|
if (*directory)
|
|
{
|
|
GetDiskFreeSpaceEx(directory, &freeBytes, &totalBytes, NULL);
|
|
} else
|
|
{
|
|
GetDiskFreeSpaceEx(NULL, &freeBytes, &totalBytes, NULL);
|
|
}
|
|
RETURN_INT((int)(freeBytes.QuadPart/(1024*1024)));
|
|
})
|
|
DEFINE_SCRIPT(APP_ScriptLuaPush,
|
|
CATEGORY(Application) PARAM_STRING(scriptName),
|
|
"Load lua script addinig it on script stack, call APP_PopLuaScript() to return to previous script",
|
|
{
|
|
if ((currentScript+1) < MAX_SCRIPTS)
|
|
{
|
|
LuaScriptManage = 2;
|
|
sprintf(ScriptNameStack[currentScript+1],"%s", scriptName);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(APP_ScriptLuaPop,
|
|
CATEGORY(Application),
|
|
"return to previous script",
|
|
{
|
|
LuaScriptManage = -1;
|
|
})
|
|
DEFINE_SCRIPT(APP_ScriptLuaRestart,
|
|
CATEGORY(Application),
|
|
"restart current script",
|
|
{
|
|
LuaScriptManage = 1;
|
|
})
|
|
DEFINE_SCRIPT(APP_ScriptLuaLoad,
|
|
CATEGORY(Application) PARAM_STRING(scriptName) PARAM_INT_OPT(ClearAll, 0),
|
|
"load script, if ClearAll is set, it works like the changeScript menu, else, juste change current script",
|
|
{
|
|
if (ClearAll)
|
|
{
|
|
LuaScriptManage = 255;
|
|
sprintf(ScriptNameStack[0],"%s", scriptName);
|
|
} else
|
|
{
|
|
LuaScriptManage = 1;
|
|
sprintf(ScriptNameStack[currentScript],"%s", scriptName);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT_REN(SCN_ObjectCameraSet, SetCameraObject,
|
|
CATEGORY(Small Scene) PARAM_SCENE(Smsc) PARAM_STRING(ObjectName),
|
|
"",
|
|
{
|
|
char ObjectNameOBJ[2048];
|
|
|
|
sprintf(ObjectNameOBJ,"%s.OBJ",ObjectName);
|
|
UnicID ObjectREF;
|
|
ObjectREF = Smsc->ObjectNameDico.IsExist(ObjectNameOBJ);
|
|
if (ObjectREF != -1)
|
|
{
|
|
MATRIX M2S;
|
|
ObjectREF = Smsc->ObjectNameDico.mpst_Dico[ObjectREF].AssociatedValue;
|
|
/* Set the camera */
|
|
ComputeSmallSceneHierarchie(Smsc);
|
|
Smsc->CameraPosition = Smsc->ObjectsPtrs[ObjectREF]->GlobalMatrix;
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(SCN_CameraGet,
|
|
CATEGORY(Small Scene) PARAM_SCENE(Smsc),
|
|
"",
|
|
{
|
|
RETURN_MATRIX(&Smsc->CameraPosition);
|
|
})
|
|
DEFINE_SCRIPT(SCN_CameraSet,
|
|
CATEGORY(Small Scene) PARAM_SCENE(Smsc) PARAM_MATRIX(Matrix),
|
|
"",
|
|
{
|
|
Smsc->CameraPosition = Matrix;
|
|
})
|
|
DEFINE_SCRIPT(SCN_ObjectCount,
|
|
CATEGORY(Small Scene) PARAM_SCENE(Smsc),
|
|
"Get number of object in scene",
|
|
{
|
|
RETURN_INT(Smsc->ulNumberOfObjects)
|
|
})
|
|
|
|
DEFINE_SCRIPT(SCN_ObjectNameByIndex,
|
|
CATEGORY(Small Scene) PARAM_SCENE(Smsc) PARAM_INT(Index),
|
|
"Get object name by index - LUA Mode, index begins at 1",
|
|
{
|
|
if (Index > 0 && Index <= Smsc->ulNumberOfObjects)
|
|
{
|
|
RETURN_STRING((char *)Smsc->ObjectsPtrs[Index-1]->pObjectName)
|
|
}
|
|
})
|
|
|
|
DEFINE_SCRIPT(SCN_SetAutoReinit,
|
|
CATEGORY(Small Scene) PARAM_SCENE(Smsc) PARAM_INT(Enable),
|
|
"This will set the option for automatic reset pos.Default is 1 (auto reinit)",
|
|
{
|
|
if (Enable)
|
|
Smsc->NoAutoReinit = 0;
|
|
else
|
|
Smsc->NoAutoReinit = 1;
|
|
})
|
|
|
|
DEFINE_SCRIPT_REN(SCN_ObjectPosGet, GetPosObject,
|
|
CATEGORY(Small Scene) PARAM_SCENE(Smsc) PARAM_STRING(ObjectName),
|
|
"",
|
|
{
|
|
char ObjectNameOBJ[2048];
|
|
|
|
sprintf(ObjectNameOBJ,"%s.OBJ",ObjectName);
|
|
UnicID ObjectREF;
|
|
ObjectREF = Smsc->ObjectNameDico.IsExist(ObjectNameOBJ);
|
|
if (ObjectREF != -1)
|
|
{
|
|
MATRIX M2S;
|
|
ObjectREF = Smsc->ObjectNameDico.mpst_Dico[ObjectREF].AssociatedValue;
|
|
/* Set the camera */
|
|
RETURN_MATRIX(&Smsc->ObjectsPtrs[ObjectREF]->LocalMatrix);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT_REN(SCN_ObjectPosAbsoluteGet, GetPosObjectAbsolute,
|
|
CATEGORY(Small Scene) PARAM_SCENE(Smsc) PARAM_STRING(ObjectName),
|
|
"",
|
|
{
|
|
char ObjectNameOBJ[2048];
|
|
|
|
sprintf(ObjectNameOBJ,"%s.OBJ",ObjectName);
|
|
UnicID ObjectREF;
|
|
ObjectREF = Smsc->ObjectNameDico.IsExist(ObjectNameOBJ);
|
|
if (ObjectREF != -1)
|
|
{
|
|
MATRIX M2S;
|
|
ObjectREF = Smsc->ObjectNameDico.mpst_Dico[ObjectREF].AssociatedValue;
|
|
/* Set the camera */
|
|
ComputeSmallSceneHierarchie(Smsc, ObjectREF);
|
|
RETURN_MATRIX(&Smsc->ObjectsPtrs[ObjectREF]->GlobalMatrix);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT_REN(SCN_ObjectPosSet, SetPosObject,
|
|
CATEGORY(Small Scene) PARAM_SCENE(Smsc) PARAM_STRING(ObjectName) PARAM_MATRIX(Position) PARAM_INT_OPT(TimeStart,-1) PARAM_INT_OPT(TimeEnd,-1),
|
|
"if TimeStart and TimeEnd are specified, then it will move smoothly to the specified Position",
|
|
{
|
|
char ObjectNameOBJ[2048];
|
|
UnicID ObjectREF;
|
|
|
|
sprintf(ObjectNameOBJ,"%s.OBJ",ObjectName);
|
|
ObjectREF = Smsc->ObjectNameDico.IsExist(ObjectNameOBJ);
|
|
if (ObjectREF != -1)
|
|
{
|
|
ObjectREF = Smsc->ObjectNameDico.mpst_Dico[ObjectREF].AssociatedValue;
|
|
if (TimeStart != -1)
|
|
{
|
|
MATRIX Blended;
|
|
Blended = Smsc->ObjectsPtrs[ObjectREF]->LocalMatrix;
|
|
if (TimeEnd != TimeStart)
|
|
Blended.Blend(Position,(float)(timeGetTime() - TimeStart) / (float)(TimeEnd - TimeStart));
|
|
else
|
|
Blended = Position;
|
|
Smsc->ObjectsPtrs[ObjectREF]->LocalMatrix = Blended;
|
|
} else
|
|
Smsc->ObjectsPtrs[ObjectREF]->LocalMatrix = Position;
|
|
}
|
|
})
|
|
DEFINE_SCRIPT_REN(SCN_ObjectPosAbsoluteSet, SetPosObjectAbsolute,
|
|
CATEGORY(Small Scene) PARAM_SCENE(Smsc) PARAM_STRING(ObjectName) PARAM_MATRIX(Position) PARAM_INT_OPT(TimeStart,-1) PARAM_INT_OPT(TimeEnd,-1),
|
|
"if TimeStart and TimeEnd are specified, then it will move smoothly to the specified Position",
|
|
{
|
|
char ObjectNameOBJ[2048];
|
|
UnicID ObjectREF;
|
|
|
|
sprintf(ObjectNameOBJ,"%s.OBJ",ObjectName);
|
|
ObjectREF = Smsc->ObjectNameDico.IsExist(ObjectNameOBJ);
|
|
ComputeSmallSceneHierarchie(Smsc);
|
|
if (ObjectREF != -1)
|
|
{
|
|
ObjectREF = Smsc->ObjectNameDico.mpst_Dico[ObjectREF].AssociatedValue;
|
|
if (TimeStart != -1)
|
|
{
|
|
MATRIX Blended;
|
|
Blended = Smsc->ObjectsPtrs[ObjectREF]->GlobalMatrix;
|
|
if (TimeEnd != TimeStart)
|
|
Blended.Blend(Position,(float)(timeGetTime() - TimeStart) / (float)(TimeEnd - TimeStart));
|
|
else
|
|
Blended = Position;
|
|
Smsc->ObjectsPtrs[ObjectREF]->GlobalMatrix = Blended;
|
|
} else
|
|
Smsc->ObjectsPtrs[ObjectREF]->GlobalMatrix = Position;
|
|
ComputeSmallSceneHierarchie_Local(Smsc, ObjectREF);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(SCN_ObjectBVMinGet,
|
|
CATEGORY(Small Scene) PARAM_SCENE(Smsc) PARAM_STRING(ObjectName),
|
|
"Get Object Bounding Volume min point, in local object coords",
|
|
{
|
|
char ObjectNameOBJ[2048];
|
|
|
|
sprintf(ObjectNameOBJ,"%s.OBJ",ObjectName);
|
|
UnicID ObjectREF;
|
|
ObjectREF = Smsc->ObjectNameDico.IsExist(ObjectNameOBJ);
|
|
if (ObjectREF != -1)
|
|
{
|
|
ObjectREF = Smsc->ObjectNameDico.mpst_Dico[ObjectREF].AssociatedValue;
|
|
/* Set the camera */
|
|
ComputeSmallSceneHierarchie(Smsc, ObjectREF);
|
|
ComputeSmallSceneBV(Smsc);
|
|
|
|
if (Smsc->ObjectsPtrs[ObjectREF]->BVMin.SqrNorm() != 0 ||
|
|
Smsc->ObjectsPtrs[ObjectREF]->BVMax.SqrNorm())
|
|
{
|
|
RETURN_VECTOR(&Smsc->ObjectsPtrs[ObjectREF]->BVMin);
|
|
}
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(SCN_ObjectBVMaxGet,
|
|
CATEGORY(Small Scene) PARAM_SCENE(Smsc) PARAM_STRING(ObjectName),
|
|
"Get Object Bounding Volume max point, in local object coords",
|
|
{
|
|
char ObjectNameOBJ[2048];
|
|
|
|
sprintf(ObjectNameOBJ,"%s.OBJ",ObjectName);
|
|
UnicID ObjectREF;
|
|
ObjectREF = Smsc->ObjectNameDico.IsExist(ObjectNameOBJ);
|
|
if (ObjectREF != -1)
|
|
{
|
|
ObjectREF = Smsc->ObjectNameDico.mpst_Dico[ObjectREF].AssociatedValue;
|
|
/* Set the camera */
|
|
ComputeSmallSceneHierarchie(Smsc, ObjectREF);
|
|
ComputeSmallSceneBV(Smsc);
|
|
|
|
if (Smsc->ObjectsPtrs[ObjectREF]->BVMin.SqrNorm() != 0 ||
|
|
Smsc->ObjectsPtrs[ObjectREF]->BVMax.SqrNorm())
|
|
{
|
|
RETURN_VECTOR(&Smsc->ObjectsPtrs[ObjectREF]->BVMax);
|
|
}
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(SCN_ObjectBVAbsoluteMinGet,
|
|
CATEGORY(Small Scene) PARAM_SCENE(Smsc) PARAM_STRING(ObjectName),
|
|
"Get Object Bounding Volume min point, in scene coords",
|
|
{
|
|
char ObjectNameOBJ[2048];
|
|
|
|
sprintf(ObjectNameOBJ,"%s.OBJ",ObjectName);
|
|
UnicID ObjectREF;
|
|
ObjectREF = Smsc->ObjectNameDico.IsExist(ObjectNameOBJ);
|
|
if (ObjectREF != -1)
|
|
{
|
|
ObjectREF = Smsc->ObjectNameDico.mpst_Dico[ObjectREF].AssociatedValue;
|
|
/* Set the camera */
|
|
ComputeSmallSceneHierarchie(Smsc, ObjectREF);
|
|
ComputeSmallSceneBV(Smsc);
|
|
|
|
if (Smsc->ObjectsPtrs[ObjectREF]->BVMin.SqrNorm() != 0 ||
|
|
Smsc->ObjectsPtrs[ObjectREF]->BVMax.SqrNorm())
|
|
{
|
|
Vector BVMin = Smsc->ObjectsPtrs[ObjectREF]->BVMin;
|
|
Vector BVMax = Smsc->ObjectsPtrs[ObjectREF]->BVMax;
|
|
GetBVSon(&Smsc->ObjectsPtrs[ObjectREF]->GlobalMatrix, &BVMin, &BVMax);
|
|
RETURN_VECTOR(&BVMin);
|
|
}
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(SCN_ObjectBVAbsoluteMaxGet,
|
|
CATEGORY(Small Scene) PARAM_SCENE(Smsc) PARAM_STRING(ObjectName),
|
|
"Get Object Bounding Volume max point, in scene coords",
|
|
{
|
|
char ObjectNameOBJ[2048];
|
|
|
|
sprintf(ObjectNameOBJ,"%s.OBJ",ObjectName);
|
|
UnicID ObjectREF;
|
|
ObjectREF = Smsc->ObjectNameDico.IsExist(ObjectNameOBJ);
|
|
if (ObjectREF != -1)
|
|
{
|
|
ObjectREF = Smsc->ObjectNameDico.mpst_Dico[ObjectREF].AssociatedValue;
|
|
/* Set the camera */
|
|
ComputeSmallSceneHierarchie(Smsc, ObjectREF);
|
|
ComputeSmallSceneBV(Smsc);
|
|
|
|
if (Smsc->ObjectsPtrs[ObjectREF]->BVMin.SqrNorm() != 0 ||
|
|
Smsc->ObjectsPtrs[ObjectREF]->BVMax.SqrNorm())
|
|
{
|
|
Vector BVMin = Smsc->ObjectsPtrs[ObjectREF]->BVMin;
|
|
Vector BVMax = Smsc->ObjectsPtrs[ObjectREF]->BVMax;
|
|
GetBVSon(&Smsc->ObjectsPtrs[ObjectREF]->GlobalMatrix, &BVMin, &BVMax);
|
|
RETURN_VECTOR(&BVMax);
|
|
}
|
|
}
|
|
})
|
|
DEFINE_SCRIPT_REN(SCN_ObjectFatherSet, SetObjectFather,
|
|
CATEGORY(Small Scene) PARAM_SCENE(Smsc) PARAM_STRING(ObjectName) PARAM_STRING(FatherName),
|
|
"",
|
|
{
|
|
char ObjectNameOBJ[2048];
|
|
char FatherNameOBJ[2048];
|
|
sprintf(ObjectNameOBJ,"%s.OBJ",ObjectName);
|
|
sprintf(FatherNameOBJ,"%s.OBJ",FatherName);
|
|
UnicID ObjectREF;
|
|
UnicID FatherREF;
|
|
ObjectREF = Smsc->ObjectNameDico.IsExist(ObjectNameOBJ);
|
|
FatherREF = Smsc->ObjectNameDico.IsExist(FatherNameOBJ);
|
|
if (ObjectREF != -1 && FatherREF != -1)
|
|
{
|
|
MATRIX M2S;
|
|
u32 Counter;
|
|
ObjectREF = Smsc->ObjectNameDico.mpst_Dico[ObjectREF].AssociatedValue;
|
|
FatherREF = Smsc->ObjectNameDico.mpst_Dico[FatherREF].AssociatedValue;
|
|
Smsc->ObjectsPtrs[ObjectREF]->FatherIndex = FatherREF;
|
|
ComputeLastSon(Smsc);
|
|
}
|
|
})
|
|
|
|
DEFINE_SCRIPT(SCN_ObjectFatherGet,
|
|
CATEGORY(Small Scene) PARAM_SCENE(Smsc) PARAM_STRING(ObjectName),
|
|
"Get the object father",
|
|
{
|
|
char ObjectNameOBJ[2048];
|
|
sprintf(ObjectNameOBJ,"%s.OBJ",ObjectName);
|
|
|
|
UnicID ObjectREF;
|
|
ObjectREF = Smsc->ObjectNameDico.IsExist(ObjectNameOBJ);
|
|
if (ObjectREF != -1)
|
|
{
|
|
MATRIX M2S;
|
|
u32 Counter;
|
|
ObjectREF = Smsc->ObjectNameDico.mpst_Dico[ObjectREF].AssociatedValue;
|
|
if (ObjectREF != -1 && Smsc->ObjectsPtrs[ObjectREF]->FatherIndex != -1)
|
|
{
|
|
RETURN_STRING((char *)Smsc->ObjectsPtrs[Smsc->ObjectsPtrs[ObjectREF]->FatherIndex]->pObjectName);
|
|
}
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(SCN_ObjectScaleSet,
|
|
CATEGORY(Small Scene) PARAM_SCENE(Smsc) PARAM_STRING(ObjectName) PARAM_FLOAT_OPT(commonScale, 1) PARAM_VECTOR_OPT(specificScale, Vector(1.0f, 1.0f, 1.0f)),
|
|
"Change object I,J,K scale",
|
|
{
|
|
char ObjectNameOBJ[2048];
|
|
UnicID ObjectREF;
|
|
|
|
sprintf(ObjectNameOBJ,"%s.OBJ",ObjectName);
|
|
ObjectREF = Smsc->ObjectNameDico.IsExist(ObjectNameOBJ);
|
|
if (ObjectREF != -1)
|
|
{
|
|
ObjectREF = Smsc->ObjectNameDico.mpst_Dico[ObjectREF].AssociatedValue;
|
|
Smsc->ObjectsPtrs[ObjectREF]->LocalMatrix.I.Normalize();
|
|
Smsc->ObjectsPtrs[ObjectREF]->LocalMatrix.I *= commonScale*specificScale.x;
|
|
Smsc->ObjectsPtrs[ObjectREF]->LocalMatrix.J.Normalize();
|
|
Smsc->ObjectsPtrs[ObjectREF]->LocalMatrix.J *= commonScale*specificScale.y;
|
|
Smsc->ObjectsPtrs[ObjectREF]->LocalMatrix.K.Normalize();
|
|
Smsc->ObjectsPtrs[ObjectREF]->LocalMatrix.K *= commonScale*specificScale.z;
|
|
}
|
|
})
|
|
|
|
DEFINE_SCRIPT_REN(SCN_ObjectCameraTagetSet, SetCameraObjectTarget,
|
|
CATEGORY(Small Scene) PARAM_SCENE(Smsc) PARAM_STRING(ObjectName),
|
|
"",
|
|
{
|
|
char ObjectNameOBJ[2048];
|
|
sprintf(ObjectNameOBJ,"%s.OBJ",ObjectName);
|
|
UnicID ObjectREF;
|
|
ObjectREF = Smsc->ObjectNameDico.IsExist(ObjectNameOBJ);
|
|
if (ObjectREF != -1)
|
|
{
|
|
MATRIX M2S;
|
|
ObjectREF = Smsc->ObjectNameDico.mpst_Dico[ObjectREF].AssociatedValue;
|
|
/* Set the camera */
|
|
ComputeSmallSceneHierarchie(Smsc);
|
|
|
|
Vector CP;
|
|
Quat NewRot;
|
|
CP = (Smsc->CameraPosition.T) - (Smsc->ObjectsPtrs[ObjectREF]->GlobalMatrix.T);
|
|
if (CP.SqrNorm())
|
|
{
|
|
MATRIX Id;
|
|
CP.Normalize();
|
|
Smsc->CameraPosition.K = CP;
|
|
Smsc->CameraPosition.J = Vector(0,0,1);
|
|
Smsc->CameraPosition.I = Smsc->CameraPosition.J ^ Smsc->CameraPosition.K;
|
|
Smsc->CameraPosition.I.Normalize();
|
|
Smsc->CameraPosition.J = Smsc->CameraPosition.K ^ Smsc->CameraPosition.I;
|
|
}
|
|
}
|
|
})
|
|
|
|
#ifndef SKIMMED_NET
|
|
#ifndef USER_MODE
|
|
DEFINE_SCRIPT(NET_SendScript,
|
|
CATEGORY(Network) PARAM_STRING(ExecString),
|
|
"[String to execute on the other side]",
|
|
{
|
|
char *LinePtr = ExecString;
|
|
OneBuf Output;
|
|
u32 Lenght;
|
|
char Modified[2048];
|
|
Lenght=0;
|
|
while (*LinePtr)
|
|
{
|
|
if(luaScriptTable[currentScript] || *LinePtr != '"')
|
|
Modified[Lenght++] = *LinePtr;
|
|
LinePtr++;
|
|
}
|
|
Modified[Lenght++] = 0;
|
|
Lenght = strlen(Modified)+1;
|
|
|
|
*((u32 *)Output.BufDATA) = 'CODE';
|
|
|
|
if (Lenght > MTU_USED - 8) Lenght = MTU_USED - 8;
|
|
Output.SetIP(NET_IO_IP_WORLD);
|
|
Output.SetBufPort(NetObj->MyPort);
|
|
memcpy(&Output.BufDATA[4],Modified,Lenght);
|
|
Output.Size = Lenght+4;
|
|
NetObj->NET_DataSend(&Output);
|
|
})
|
|
#endif
|
|
#endif
|
|
|
|
DEFINE_SCRIPT(MAT_Redir,
|
|
CATEGORY(Material) PARAM_SCENE(Smsc) PARAM_STRING(MatToReplace) PARAM_STRING(MatToUse),
|
|
"Work only with material (not with mmt)",
|
|
{
|
|
char MatToReplaceStr[2048];
|
|
UnicID MatToReplaceID;
|
|
char MatToUseStr[2048];
|
|
UnicID MatToUseID;
|
|
|
|
sprintf(MatToReplaceStr, "%s.MAT", MatToReplace);
|
|
sprintf(MatToUseStr, "%s.MAT", MatToUse);
|
|
|
|
MatToReplaceID = Smsc->MaterialNameDico.IsExist(MatToReplaceStr);
|
|
MatToUseID = Smsc->MaterialNameDico.IsExist(MatToUseStr);
|
|
if ((MatToReplaceID != -1) &&
|
|
(MatToReplaceID = Smsc->MaterialNameDico.mpst_Dico[MatToReplaceID].AssociatedValue) != -1 &&
|
|
(MatToUseID != -1) &&
|
|
(MatToUseID = Smsc->MaterialNameDico.mpst_Dico[MatToUseID].AssociatedValue) != -1 &&
|
|
Smsc->MaterialsPtrs[MatToUseID] && Smsc->MaterialsPtrs[MatToReplaceID])
|
|
{
|
|
Smsc->MaterialsRedirs[MatToReplaceID] = MatToUseID;
|
|
}
|
|
})
|
|
|
|
/*********************************************************************************************************************************/
|
|
/* SCENE MATERIAL ACCESS *********************************************************************************************************/
|
|
/*********************************************************************************************************************************/
|
|
DEFINE_SCRIPT(MAT_OVRL_Reset, CATEGORY(Material overload), "Reset all material overload",
|
|
{
|
|
ResetMaterialOverload();
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_OVRL_LightedSet, CATEGORY(Material overload) PARAM_INT_OPT(YesNo,1), "Force material Lighted",
|
|
{
|
|
MaterialAnd.RenderState.LIGHTED = 0;
|
|
MaterialOr.RenderState.LIGHTED = YesNo;
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_OVRL_WiredSet, CATEGORY(Material overload) PARAM_INT_OPT(YesNo,1), "Force material Wired",
|
|
{
|
|
MaterialAnd.RenderState.WIRED = 0;
|
|
MaterialOr.RenderState.WIRED = YesNo;
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_OVRL_BackfaceSet, CATEGORY(Material overload) PARAM_INT_OPT(YesNo,1), "Force material Backface",
|
|
{
|
|
MaterialAnd.RenderState.BACKFACE = 0;
|
|
MaterialOr.RenderState.BACKFACE = YesNo;
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_OVRL_BackfaceInvertSet, CATEGORY(Material overload) PARAM_INT_OPT(YesNo,1), "Force material Backface Invert",
|
|
{
|
|
MaterialAnd.RenderState.BACKFACE_INVERT = 0;
|
|
MaterialOr.RenderState.BACKFACE_INVERT = YesNo;
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_OVRL_NoZWriteSet, CATEGORY(Material overload) PARAM_INT_OPT(YesNo,1), "Force material No Z Write",
|
|
{
|
|
MaterialAnd.RenderState.NOZWRITE = 0;
|
|
MaterialOr.RenderState.NOZWRITE = YesNo;
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_OVRL_NoZTestSet, CATEGORY(Material overload) PARAM_INT_OPT(YesNo,1), "Force material No Z Test",
|
|
{
|
|
MaterialAnd.RenderState.NOZTEST = 0;
|
|
MaterialOr.RenderState.NOZTEST = YesNo;
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_OVRL_ZEqualSet, CATEGORY(Material overload) PARAM_INT_OPT(YesNo,1), "Force material ZEqual",
|
|
{
|
|
MaterialAnd.RenderState.ZEQUAL = 0;
|
|
MaterialOr.RenderState.ZEQUAL = YesNo;
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_OVRL_TexturedSet, CATEGORY(Material overload) PARAM_INT_OPT(YesNo,1), "Force material Textured",
|
|
{
|
|
MaterialAnd.RenderState.TEXTURED = 0;
|
|
MaterialOr.RenderState.TEXTURED = YesNo;
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_OVRL_HideColorSet, CATEGORY(Material overload) PARAM_INT_OPT(YesNo,1), "Force material Hide Color",
|
|
{
|
|
MaterialAnd.RenderState.HIDECOLOR = 0;
|
|
MaterialOr.RenderState.HIDECOLOR = YesNo;
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_OVRL_HideAlphaSet, CATEGORY(Material overload) PARAM_INT_OPT(YesNo,1), "Force material Hide Alpha",
|
|
{
|
|
MaterialAnd.RenderState.HIDEALPHA = 0;
|
|
MaterialOr.RenderState.HIDEALPHA = YesNo;
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_OVRL_UseVertexColorSet, CATEGORY(Material overload) PARAM_INT_OPT(YesNo,1), "Force use of vertex color",
|
|
{
|
|
MaterialAnd.RenderState.USEVERTEXCOLORS = 0;
|
|
MaterialOr.RenderState.USEVERTEXCOLORS = YesNo;
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_OVRL_SecondPassSet, CATEGORY(Material overload) PARAM_INT_OPT(YesNo,1), "Force material Second Pass",
|
|
{
|
|
MaterialAnd.RenderState.SECONDPASS = 0;
|
|
MaterialOr.RenderState.SECONDPASS = YesNo;
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_OVRL_InvertAlphaSet, CATEGORY(Material overload) PARAM_INT_OPT(YesNo,1), "Force material Invert Alpha",
|
|
{
|
|
MaterialAnd.RenderState.INVERTALPHA = 0;
|
|
MaterialOr.RenderState.INVERTALPHA = YesNo;
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_OVRL_BlendingModeSet, CATEGORY(Material overload) PARAM_INT_OPT(Blending,0), "Force material Blending Mode",
|
|
{
|
|
MaterialAnd.RenderState.BlendingMode = 0;
|
|
MaterialOr.RenderState.BlendingMode = Blending;
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_OVRL_MappingModeSet, CATEGORY(Material overload) PARAM_INT_OPT(Mapping,0), "Force material Mapping Mode",
|
|
{
|
|
MaterialAnd.RenderState.MappingMode = 0;
|
|
MaterialOr.RenderState.MappingMode = Mapping;
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_OVRL_AlphaThresholdSet, CATEGORY(Material overload) PARAM_INT_OPT(AlphaThreshold,0), "Force material Alpha Threshold",
|
|
{
|
|
MaterialAnd.RenderState.AlphaThreshold = 0;
|
|
MaterialOr.RenderState.AlphaThreshold = AlphaThreshold;
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_OVRL_NormalExtractionSet, CATEGORY(Material overload) PARAM_FLOAT_OPT(NormalExtraction,0), "Force material Normal Extraction",
|
|
{
|
|
MaterialAnd.RenderState.NormalExtraction = 0;
|
|
MaterialOr.RenderState.NormalExtraction = NormalExtraction;
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_OVRL_PickableSet, CATEGORY(Material overload) PARAM_INT_OPT(YesNo,1), "Force material Invert Alpha",
|
|
{
|
|
MaterialAnd.RenderState.PICKABLE = 0;
|
|
MaterialOr.RenderState.PICKABLE = YesNo;
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_OVRL_PickableNoTransparencySet, CATEGORY(Material overload) PARAM_INT_OPT(YesNo,1), "Force Consider material opaque for piking",
|
|
{
|
|
MaterialAnd.RenderState.PICKABLE_NO_TRANSPARENCY = 0;
|
|
MaterialOr.RenderState.PICKABLE_NO_TRANSPARENCY = YesNo;
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_OVRL_TextureBilinearSet, CATEGORY(Material overload) PARAM_INT_OPT(YesNo,1), "Force bilinear filtering on/off",
|
|
{
|
|
MaterialAnd.RenderState.TEXTUREBILINEAR = 0;
|
|
MaterialOr.RenderState.TEXTUREBILINEAR = YesNo;
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_OVRL_TextureRepeatUSet, CATEGORY(Material overload) PARAM_INT_OPT(YesNo,1), "Force tiling U",
|
|
{
|
|
MaterialAnd.RenderState.TEXTUREREPEAT_U = 0;
|
|
MaterialOr.RenderState.TEXTUREREPEAT_U = YesNo;
|
|
})
|
|
DEFINE_SCRIPT(MAT_OVRL_TextureRepeatVSet, CATEGORY(Material overload) PARAM_INT_OPT(YesNo,1), "Force tiling V",
|
|
{
|
|
MaterialAnd.RenderState.TEXTUREREPEAT_V = 0;
|
|
MaterialOr.RenderState.TEXTUREREPEAT_V = YesNo;
|
|
})
|
|
|
|
|
|
DEFINE_SCRIPT(MAT_OVRL_SkipLayerSet, CATEGORY(Material overload) PARAM_INT_OPT(YesNo,1), "Force skipping layers ...",
|
|
{
|
|
MaterialAnd.RenderState.SKIPLAYER = 0;
|
|
MaterialOr.RenderState.SKIPLAYER = YesNo;
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_OVRL_UVMatrixSet, CATEGORY(Material overload) PARAM_LIST_FLOAT(UVMatrix), "Force material UV MATRIX",
|
|
{
|
|
for (int i=0; i<NbUVMatrix; i++)
|
|
{
|
|
MaterialAnd.RenderState.UVMATRIX[i] = 0;
|
|
MaterialOr.RenderState.UVMATRIX[i] = UVMatrix[i];
|
|
}
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_OVRL_AnimNbXSet, CATEGORY(Material overload) PARAM_INT_OPT(animNbX,1), "Force material number of anim X",
|
|
{
|
|
MaterialAnd.RenderState.AnimNbX = 0;
|
|
MaterialOr.RenderState.AnimNbX = animNbX;
|
|
})
|
|
DEFINE_SCRIPT(MAT_OVRL_AnimNbYSet, CATEGORY(Material overload) PARAM_INT_OPT(animNbY,1), "Force material number of anim Y",
|
|
{
|
|
MaterialAnd.RenderState.AnimNbY = 0;
|
|
MaterialOr.RenderState.AnimNbY = animNbY;
|
|
})
|
|
DEFINE_SCRIPT(MAT_OVRL_AnimFPSSet, CATEGORY(Material overload) PARAM_FLOAT_OPT(animFPS,0), "Force material anim FPS",
|
|
{
|
|
MaterialAnd.RenderState.AnimFPS = 0;
|
|
MaterialOr.RenderState.AnimFPS = animFPS;
|
|
})
|
|
DEFINE_SCRIPT(MAT_OVRL_AnimTimeSet, CATEGORY(Material overload) PARAM_INT_OPT(animTime,0), "Force material anim begin time - 0 no anim",
|
|
{
|
|
MaterialAnd.RenderState.AnimTime = 0;
|
|
MaterialOr.RenderState.AnimTime = animTime;
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_OVRL_MediaSet, CATEGORY(Material overload) PARAM_MEDIA(MediaIndex), "Force use of specific texture",
|
|
{
|
|
MaterialAnd.TextureMediaIndex = 0;
|
|
MaterialOr.TextureMediaIndex = MediaDico.IsExist((char*)ID_MEDIA[MediaIndex]->MediaName);
|
|
if (MaterialOr.TextureMediaIndex != -1 && MediaDico.mpst_Dico[MaterialOr.TextureMediaIndex].AssociatedValue != -1)
|
|
MaterialOr.TextureMediaIndex = ID_MEDIA[MediaDico.mpst_Dico[MaterialOr.TextureMediaIndex].AssociatedValue]->ulAssociatedTextureIndex;
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_OVRL_ColorMultiplierSet, CATEGORY(Material overload) PARAM_COLOR(color), "Force use of color multiplier",
|
|
{
|
|
MaterialAnd.ColorMultiplier = 0;
|
|
MaterialOr.ColorMultiplier = color;
|
|
})
|
|
|
|
|
|
/*********************************************************************************************************************************/
|
|
/* SCENE MATERIAL ACCESS *********************************************************************************************************/
|
|
/*********************************************************************************************************************************/
|
|
DEFINE_SCRIPT(MAT_MediaSet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer) PARAM_MEDIA(MediaIndex),
|
|
"Set media of a material",
|
|
{
|
|
MyDebug(L);
|
|
int TextureMediaIndex;
|
|
int Mi = -1;
|
|
ID_MEDIA[MediaIndex]->nbReferences++;
|
|
TextureMediaIndex = MediaDico.IsExist((char*)ID_MEDIA[MediaIndex]->MediaName);
|
|
if (Layer->TextureMediaIndex != -1)
|
|
Mi = MediaDico.mpst_Dico[Layer->TextureMediaIndex].AssociatedValue;
|
|
Layer->TextureMediaIndex = TextureMediaIndex;
|
|
Layer->TextureID = TextureMediaIndex;
|
|
if (Mi != -1)
|
|
DestroyMedia(Mi);
|
|
})
|
|
DEFINE_SCRIPT(MAT_MediaGet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer),
|
|
"Set media of a material",
|
|
{
|
|
int MediaIndex = Layer->TextureMediaIndex;
|
|
if (MediaIndex != -1)
|
|
MediaIndex = MediaDico.mpst_Dico[MediaIndex].AssociatedValue;
|
|
if (MediaIndex != -1 && ID_MEDIA[MediaIndex])
|
|
{
|
|
RETURN_STRING((char*)ID_MEDIA[MediaIndex]->MediaName);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(MAT_ColorMultiplierSet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer) PARAM_COLOR_OPT(color,0),
|
|
"Set material RGBA Multiplier",
|
|
{
|
|
color = ARGB2ABGR(color);
|
|
Layer->ColorMultiplier = color;
|
|
})
|
|
DEFINE_SCRIPT(MAT_ColorMultiplierGet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer),
|
|
"Get material RGBA Multiplier",
|
|
{
|
|
u32 color = ARGB2ABGR(Layer->ColorMultiplier);
|
|
RETURN_COLOR(color)
|
|
})
|
|
DEFINE_SCRIPT(MAT_UseVertexColorSet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer) PARAM_INT_OPT(useVC, 1),
|
|
"Set material use of vertex color",
|
|
{
|
|
Layer->RenderState.USEVERTEXCOLORS = useVC;
|
|
})
|
|
DEFINE_SCRIPT(MAT_UseVertexColorGet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer),
|
|
"Get material use of vertex color",
|
|
{
|
|
RETURN_INT(Layer->RenderState.USEVERTEXCOLORS);
|
|
})
|
|
DEFINE_SCRIPT(MAT_LayerNameSet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer) PARAM_STRING_OPT(name,""),
|
|
"Set material RGBA Multiplier",
|
|
{
|
|
memset(Layer->LayerName, 0, sizeof(Layer->LayerName));
|
|
if (*name)
|
|
strncpy((char *)Layer->LayerName, name, 255);
|
|
else
|
|
sprintf((char *)Layer->LayerName, "Layer %d" , Layer - Material->Layers);
|
|
})
|
|
DEFINE_SCRIPT(MAT_LayerNameGet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer),
|
|
"Get material RGBA Multiplier",
|
|
{
|
|
RETURN_STRING((char *)Layer->LayerName)
|
|
})
|
|
DEFINE_SCRIPT(MAT_LightedSet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer) PARAM_INT_OPT(YesNo,1),
|
|
"Set material Lighted",
|
|
{
|
|
Layer->RenderState.LIGHTED = YesNo;
|
|
})
|
|
DEFINE_SCRIPT(MAT_LightedGet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer),
|
|
"Get material Lighted",
|
|
{
|
|
RETURN_INT(Layer->RenderState.LIGHTED);
|
|
})
|
|
DEFINE_SCRIPT(MAT_WiredSet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer) PARAM_INT_OPT(YesNo,1),
|
|
"Set material Wired",
|
|
{
|
|
Layer->RenderState.WIRED = YesNo;
|
|
})
|
|
DEFINE_SCRIPT(MAT_WiredGet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer),
|
|
"Get material Wired",
|
|
{
|
|
RETURN_INT(Layer->RenderState.WIRED);
|
|
})
|
|
DEFINE_SCRIPT(MAT_BackfaceSet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer) PARAM_INT_OPT(YesNo,1),
|
|
"Set material Backface",
|
|
{
|
|
Layer->RenderState.BACKFACE = YesNo;
|
|
})
|
|
DEFINE_SCRIPT(MAT_BackfaceGet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer),
|
|
"Get material Backface",
|
|
{
|
|
RETURN_INT(Layer->RenderState.BACKFACE);
|
|
})
|
|
DEFINE_SCRIPT(MAT_BackfaceInvertSet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer) PARAM_INT_OPT(YesNo,1),
|
|
"Set material Backface Invert",
|
|
{
|
|
Layer->RenderState.BACKFACE_INVERT = YesNo;
|
|
})
|
|
DEFINE_SCRIPT(MAT_BackfaceInvertGet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer),
|
|
"Get material Backface Invert",
|
|
{
|
|
RETURN_INT(Layer->RenderState.BACKFACE_INVERT);
|
|
})
|
|
DEFINE_SCRIPT(MAT_NoZWriteSet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer) PARAM_INT_OPT(YesNo,1),
|
|
"Set material No Z Write",
|
|
{
|
|
Layer->RenderState.NOZWRITE = YesNo;
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_NoZWriteGet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer),
|
|
"Get material No Z Write",
|
|
{
|
|
RETURN_INT(Layer->RenderState.NOZWRITE);
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_ZEqualSet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer) PARAM_INT_OPT(YesNo,1),
|
|
"Set material ZEqual",
|
|
{
|
|
Layer->RenderState.ZEQUAL = YesNo;
|
|
})
|
|
DEFINE_SCRIPT(MAT_ZEqualGet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer),
|
|
"Get material ZEqual",
|
|
{
|
|
RETURN_INT(Layer->RenderState.ZEQUAL);
|
|
})
|
|
DEFINE_SCRIPT(MAT_NoZTestSet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer) PARAM_INT_OPT(YesNo,1),
|
|
"Set material No Z Test",
|
|
{
|
|
Layer->RenderState.NOZTEST = YesNo;
|
|
})
|
|
DEFINE_SCRIPT(MAT_NoZTestGet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer),
|
|
"Get material No Z Test",
|
|
{
|
|
RETURN_INT(Layer->RenderState.NOZTEST);
|
|
})
|
|
DEFINE_SCRIPT(MAT_TexturedSet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer) PARAM_INT_OPT(YesNo,1),
|
|
"Set material Textured",
|
|
{
|
|
Layer->RenderState.TEXTURED = YesNo;
|
|
})
|
|
DEFINE_SCRIPT(MAT_TexturedGet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer),
|
|
"Get material Textured",
|
|
{
|
|
RETURN_INT(Layer->RenderState.TEXTURED);
|
|
})
|
|
DEFINE_SCRIPT(MAT_HideColorSet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer) PARAM_INT_OPT(YesNo,1),
|
|
"Set material Hide Color",
|
|
{
|
|
Layer->RenderState.HIDECOLOR = YesNo;
|
|
})
|
|
DEFINE_SCRIPT(MAT_HideColorGet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer),
|
|
"Get material Hide Color",
|
|
{
|
|
RETURN_INT(Layer->RenderState.HIDECOLOR);
|
|
})
|
|
DEFINE_SCRIPT(MAT_HideAlphaSet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer) PARAM_INT_OPT(YesNo,1),
|
|
"Set material Hide Alpha",
|
|
{
|
|
Layer->RenderState.HIDEALPHA = YesNo;
|
|
})
|
|
DEFINE_SCRIPT(MAT_HideAlphaGet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer),
|
|
"Get material Hide Alpha",
|
|
{
|
|
RETURN_INT(Layer->RenderState.HIDEALPHA);
|
|
})
|
|
DEFINE_SCRIPT(MAT_SecondPassSet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer) PARAM_INT_OPT(YesNo,1),
|
|
"Set material Second Pass",
|
|
{
|
|
Layer->RenderState.SECONDPASS = YesNo;
|
|
})
|
|
DEFINE_SCRIPT(MAT_SecondPassGet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer),
|
|
"Get material Second Pass",
|
|
{
|
|
RETURN_INT(Layer->RenderState.SECONDPASS);
|
|
})
|
|
DEFINE_SCRIPT(MAT_InvertAlphaSet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer) PARAM_INT_OPT(YesNo,1),
|
|
"Set material Invert Alpha",
|
|
{
|
|
Layer->RenderState.INVERTALPHA = YesNo;
|
|
})
|
|
DEFINE_SCRIPT(MAT_InvertAlphaGet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer),
|
|
"Get material Invert Alpha",
|
|
{
|
|
RETURN_INT(Layer->RenderState.INVERTALPHA);
|
|
})
|
|
DEFINE_SCRIPT(MAT_BlendingModeSet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer) PARAM_INT_OPT(Blending,0),
|
|
"Set material Blending Mode",
|
|
{
|
|
Layer->RenderState.BlendingMode = Blending;
|
|
})
|
|
DEFINE_SCRIPT(MAT_BlendingModeGet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer),
|
|
"Get material Blending Mode",
|
|
{
|
|
RETURN_INT(Layer->RenderState.BlendingMode);
|
|
})
|
|
DEFINE_SCRIPT(MAT_MappingModeSet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer) PARAM_INT_OPT(Mapping,0),
|
|
"Set material Mapping Mode",
|
|
{
|
|
Layer->RenderState.MappingMode = Mapping;
|
|
})
|
|
DEFINE_SCRIPT(MAT_MappingModeGet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer),
|
|
"Get material Mapping Mode",
|
|
{
|
|
RETURN_INT(Layer->RenderState.MappingMode);
|
|
})
|
|
DEFINE_SCRIPT(MAT_AlphaThresholdSet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer) PARAM_INT_OPT(AlphaThreshold,0),
|
|
"Set material Alpha Threshold",
|
|
{
|
|
Layer->RenderState.AlphaThreshold = AlphaThreshold;
|
|
})
|
|
DEFINE_SCRIPT(MAT_AlphaThresholdGet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer),
|
|
"Get material Alpha Threshold",
|
|
{
|
|
RETURN_INT(Layer->RenderState.AlphaThreshold);
|
|
})
|
|
DEFINE_SCRIPT(MAT_NormalExtractionSet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer) PARAM_FLOAT_OPT(NormalExtraction,0),
|
|
"Set material Normal Extraction",
|
|
{
|
|
Layer->RenderState.NormalExtraction = NormalExtraction;
|
|
})
|
|
DEFINE_SCRIPT(MAT_NormalExtractionGet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer),
|
|
"Get material Normal Extraction",
|
|
{
|
|
RETURN_FLOAT(Layer->RenderState.NormalExtraction);
|
|
})
|
|
DEFINE_SCRIPT(MAT_PickableSet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer) PARAM_INT_OPT(YesNo,1),
|
|
"Set material Invert Alpha",
|
|
{
|
|
Layer->RenderState.PICKABLE = YesNo;
|
|
})
|
|
DEFINE_SCRIPT(MAT_PickableNoTransparencySet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer) PARAM_INT_OPT(YesNo,1),
|
|
"Set material Invert Alpha",
|
|
{
|
|
Layer->RenderState.PICKABLE_NO_TRANSPARENCY = YesNo;
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_TextureBilinearSet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer) PARAM_INT_OPT(YesNo,1),
|
|
"Set material bilinear filtering",
|
|
{
|
|
Layer->RenderState.TEXTUREBILINEAR = YesNo;
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_TextureRepeatUSet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer) PARAM_INT_OPT(YesNo,1),
|
|
"Set material tiling U",
|
|
{
|
|
Layer->RenderState.TEXTUREREPEAT_U = YesNo;
|
|
})
|
|
DEFINE_SCRIPT(MAT_TextureRepeatVSet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer) PARAM_INT_OPT(YesNo,1),
|
|
"Set material tiling V",
|
|
{
|
|
Layer->RenderState.TEXTUREREPEAT_V = YesNo;
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_AnimNbXSet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer) PARAM_INT_OPT(animNbX,1),
|
|
"Set material number of X on anim",
|
|
{
|
|
Layer->RenderState.AnimNbX = animNbX;
|
|
})
|
|
DEFINE_SCRIPT(MAT_AnimNbXGet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer),
|
|
"Get material number of X on anim",
|
|
{
|
|
RETURN_INT(Layer->RenderState.AnimNbX);
|
|
})
|
|
DEFINE_SCRIPT(MAT_AnimNbYSet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer) PARAM_INT_OPT(animNbY,1),
|
|
"Set material number of Y on anim",
|
|
{
|
|
Layer->RenderState.AnimNbY = animNbY;
|
|
})
|
|
DEFINE_SCRIPT(MAT_AnimNbYGet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer),
|
|
"Get material number of Y on anim",
|
|
{
|
|
RETURN_INT(Layer->RenderState.AnimNbY);
|
|
})
|
|
DEFINE_SCRIPT(MAT_AnimFPSSet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer) PARAM_FLOAT_OPT(animFPS,0),
|
|
"Set material FPS on anim",
|
|
{
|
|
Layer->RenderState.AnimFPS = animFPS;
|
|
})
|
|
DEFINE_SCRIPT(MAT_AnimFPSGet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer),
|
|
"Get material number of X on anim",
|
|
{
|
|
RETURN_FLOAT(Layer->RenderState.AnimFPS);
|
|
})
|
|
DEFINE_SCRIPT(MAT_AnimTimeSet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer) PARAM_INT_OPT(animTime,0),
|
|
"Set material number of Y on anim",
|
|
{
|
|
Layer->RenderState.AnimTime = animTime;
|
|
})
|
|
DEFINE_SCRIPT(MAT_AnimTimeGet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer),
|
|
"Get material number of Y on anim",
|
|
{
|
|
RETURN_INT(Layer->RenderState.AnimTime);
|
|
})
|
|
DEFINE_SCRIPT(MAT_SkipLayerSet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer) PARAM_INT_OPT(YesNo,1),
|
|
"Set skip layer",
|
|
{
|
|
Layer->RenderState.SKIPLAYER = YesNo;
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_SkipLayerGet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer),
|
|
"Get skip layer",
|
|
{
|
|
RETURN_INT(Layer->RenderState.SKIPLAYER);
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_PickableGet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer),
|
|
"Get material Invert Alpha",
|
|
{
|
|
RETURN_INT(Layer->RenderState.PICKABLE);
|
|
})
|
|
DEFINE_SCRIPT(MAT_PickableNoTransparencyGet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer),
|
|
"Set material Invert Alpha",
|
|
{
|
|
RETURN_INT(Layer->RenderState.PICKABLE_NO_TRANSPARENCY);
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_TextureBilinearGet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer),
|
|
"Return bilinear flag",
|
|
{
|
|
RETURN_INT(Layer->RenderState.TEXTUREBILINEAR);
|
|
})
|
|
DEFINE_SCRIPT(MAT_TextureRepeatUGet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer),
|
|
"Return tiling U flag",
|
|
{
|
|
RETURN_INT(Layer->RenderState.TEXTUREREPEAT_U);
|
|
})
|
|
DEFINE_SCRIPT(MAT_TextureRepeatVGet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer),
|
|
"Return tiling V flag",
|
|
{
|
|
RETURN_INT(Layer->RenderState.TEXTUREREPEAT_V);
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_UVMatrixSet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer) PARAM_LIST_FLOAT(UVMatrix),
|
|
"Set material number of layer",
|
|
{
|
|
for (int i=0; i<NbUVMatrix; i++)
|
|
Layer->RenderState.UVMATRIX[i] = UVMatrix[i];
|
|
})
|
|
DEFINE_SCRIPT(MAT_UVMatrixGet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL_LAYER(Smsc, Material, Layer),
|
|
"Get material number of layer",
|
|
{
|
|
RETURN_TABLE_FLOAT(Layer->RenderState.UVMATRIX, 6);
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_LayerNumberSet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL(Smsc, Material) PARAM_INT(LayerNumber) PARAM_INT_OPT(ResetLayers, 1),
|
|
"Set material number of layer",
|
|
{
|
|
MyDebug(L);
|
|
if (ResetLayers)
|
|
{
|
|
for (int i=LayerNumber; i<Material->NumberOfLayers; i++)
|
|
{
|
|
if (Material->Layers[i].TextureMediaIndex != -1)
|
|
{
|
|
int Mi = MediaDico.mpst_Dico[Material->Layers[i].TextureMediaIndex].AssociatedValue;
|
|
if (Mi != -1) DestroyMedia(Mi);
|
|
Material->Layers[i].ColorMultiplier = -1;
|
|
Material->Layers[i].TextureMediaIndex = -1;
|
|
}
|
|
}
|
|
for (int i=Material->NumberOfLayers; i<LayerNumber; i++)
|
|
{
|
|
GLOB_SetDefaultRS(&Material->Layers[i].RenderState);
|
|
Material->Layers[i].ColorMultiplier = -1;
|
|
Material->Layers[i].TextureMediaIndex = -1;
|
|
sprintf((char *)Material->Layers[i].LayerName, "Layer %d" , i);
|
|
}
|
|
}
|
|
Material->NumberOfLayers = LayerNumber;
|
|
})
|
|
DEFINE_SCRIPT(MAT_LayerNumberGet,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL(Smsc, Material),
|
|
"Get material number of layer",
|
|
{
|
|
RETURN_INT(Material->NumberOfLayers);
|
|
})
|
|
|
|
DEFINE_SCRIPT(MAT_ConcatMaterial,
|
|
CATEGORY(Material) PARAM_STRING(Smsc) PARAM_STRING(Material) PARAM_STRING(SmscToAdd) PARAM_STRING(MaterialToAdd),
|
|
"Concat material",
|
|
{
|
|
ConcatMaterial(Smsc, Material, SmscToAdd, MaterialToAdd);
|
|
})
|
|
#ifndef USER_MODE
|
|
DEFINE_SCRIPT(MAT_Explore,
|
|
CATEGORY(Material) PARAM_STRING(Smsc) PARAM_STRING(Material),
|
|
"Open MAT file",
|
|
{
|
|
char TEXT[2048];
|
|
char TEXT2[2048];
|
|
FILE *F;
|
|
sprintf(TEXT,".\\media\\%s\\MODIFIED\\%s", Smsc, Material);
|
|
F = CC_fopen(TEXT,"rb");
|
|
if (!F)
|
|
{
|
|
sprintf(TEXT2,".\\media\\%s\\%s", Smsc, Material);
|
|
F = CC_fopen(TEXT2,"rb");
|
|
if (F)
|
|
{
|
|
CC_fclose(F);
|
|
CopyFile(TEXT2, TEXT,0);
|
|
F = CC_fopen(TEXT,"rb");
|
|
}
|
|
}
|
|
if (F)
|
|
{
|
|
CC_fclose(F);
|
|
sprintf(TEXT2,"CMD /C START %s", TEXT);
|
|
WinExec(TEXT2,SW_HIDE);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(SCN_IKExplore,
|
|
CATEGORY(Small Scene) PARAM_STRING(Smsc),
|
|
"Open IK file",
|
|
{
|
|
char TEXT[2048];
|
|
char TEXT2[2048];
|
|
FILE *F;
|
|
sprintf(TEXT,".\\media\\%s\\MODIFIED\\SMSC.IKM", Smsc);
|
|
F = CC_fopen(TEXT,"rb");
|
|
if (!F)
|
|
{
|
|
sprintf(TEXT2,".\\media\\%s\\SMSC.IKM", Smsc);
|
|
F = CC_fopen(TEXT2,"rb");
|
|
if (F)
|
|
{
|
|
CC_fclose(F);
|
|
CopyFile(TEXT2, TEXT,0);
|
|
F = CC_fopen(TEXT,"rb");
|
|
}
|
|
}
|
|
if (F)
|
|
{
|
|
CC_fclose(F);
|
|
sprintf(TEXT2,"CMD /C START %s", TEXT);
|
|
WinExec(TEXT2,SW_HIDE);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(FILE_Explore,
|
|
CATEGORY(Material) PARAM_STRING(name),
|
|
"Open MAT file",
|
|
{
|
|
FILE *F;
|
|
F = CC_fopen(name,"rb");
|
|
if (F)
|
|
{
|
|
CC_fclose(F);
|
|
char TEXT[2048];
|
|
sprintf(TEXT,"CMD /C START %s", name);
|
|
WinExec(TEXT,SW_HIDE);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(APP_Exec,
|
|
CATEGORY(Application) PARAM_STRING(name),
|
|
"Execute command",
|
|
{
|
|
void LaunchExe(char *exe);
|
|
LaunchExe(name);
|
|
})
|
|
#endif
|
|
DEFINE_SCRIPT(SCN_ObjectDrawOrderSet,
|
|
CATEGORY(Small Scene) PARAM_SCENE(Smsc) PARAM_STRING(ObjectName) PARAM_INT(DrawOrder) ,
|
|
"Set a draw order (smallest = draw first , biggest = draw last)",
|
|
{
|
|
char ObjectNameOBJ[2048];
|
|
sprintf(ObjectNameOBJ,"%s.OBJ",ObjectName);
|
|
UnicID ObjectREF = Smsc->ObjectNameDico.IsExist(ObjectNameOBJ);
|
|
if (ObjectREF != -1)
|
|
{
|
|
ObjectREF = Smsc->ObjectNameDico.mpst_Dico[ObjectREF].AssociatedValue;
|
|
if (ObjectREF < Smsc->ulNumberOfObjects)
|
|
Smsc->ObjectsPtrs[ObjectREF]->DrawOrder = DrawOrder;
|
|
}
|
|
})
|
|
|
|
DEFINE_SCRIPT(SCN_ObjectDrawOrderGet,
|
|
CATEGORY(Small Scene) PARAM_SCENE(Smsc) PARAM_STRING(ObjectName) ,
|
|
"Get a draw order (smallest = draw first , biggest = draw last)",
|
|
{
|
|
char ObjectNameOBJ[2048];
|
|
sprintf(ObjectNameOBJ,"%s.OBJ",ObjectName);
|
|
UnicID ObjectREF = Smsc->ObjectNameDico.IsExist(ObjectNameOBJ);
|
|
if (ObjectREF != -1 && Smsc->ObjectNameDico.mpst_Dico[ObjectREF].AssociatedValue != -1)
|
|
{
|
|
ObjectREF = Smsc->ObjectNameDico.mpst_Dico[ObjectREF].AssociatedValue;
|
|
if (ObjectREF < Smsc->ulNumberOfObjects)
|
|
{ RETURN_INT(Smsc->ObjectsPtrs[ObjectREF]->DrawOrder); }
|
|
else
|
|
{ RETURN_INT(0); }
|
|
} else
|
|
{ RETURN_INT(0); }
|
|
})
|
|
|
|
|
|
DEFINE_SCRIPT(LIGHT_IndexGet,
|
|
CATEGORY(Light) PARAM_SCENE(Smsc) PARAM_STRING(LightName),
|
|
"Get light index from string - for optimisation in other functions, -1 if light not found",
|
|
{
|
|
RETURN_INT(LightNameToIndex(Smsc, LightName));
|
|
})
|
|
|
|
DEFINE_SCRIPT(LIGHT_TypeGet,
|
|
CATEGORY(Light) PARAM_SCENE(Smsc) PARAM_INT(LightNameIndex),
|
|
"Get Light Type // 0 = omni ; 1 = spot ; 2 = direct",
|
|
{
|
|
if (LightNameIndex != -1)
|
|
RETURN_INT(Smsc->LightsPtrs[LightNameIndex]->LightType);
|
|
})
|
|
DEFINE_SCRIPT(LIGHT_TypeSet,
|
|
CATEGORY(Light) PARAM_SCENE(Smsc) PARAM_INT(LightNameIndex) PARAM_INT(Type),
|
|
"Set Light Type // 0 = omni ; 1 = spot ; 2 = direct",
|
|
{
|
|
if (LightNameIndex != -1)
|
|
Smsc->LightsPtrs[LightNameIndex]->LightType = Type;
|
|
})
|
|
DEFINE_SCRIPT(LIGHT_NearGet,
|
|
CATEGORY(Light) PARAM_SCENE(Smsc) PARAM_INT(LightNameIndex),
|
|
"Get Light Type",
|
|
{
|
|
if (LightNameIndex != -1)
|
|
RETURN_FLOAT(Smsc->LightsPtrs[LightNameIndex]->Near);
|
|
})
|
|
DEFINE_SCRIPT(LIGHT_NearSet,
|
|
CATEGORY(Light) PARAM_SCENE(Smsc) PARAM_INT(LightNameIndex) PARAM_FLOAT(Near),
|
|
"Set Light Type",
|
|
{
|
|
if (LightNameIndex != -1)
|
|
Smsc->LightsPtrs[LightNameIndex]->Near = Near;
|
|
})
|
|
DEFINE_SCRIPT(LIGHT_FarGet,
|
|
CATEGORY(Light) PARAM_SCENE(Smsc) PARAM_INT(LightNameIndex),
|
|
"Get Light Type",
|
|
{
|
|
if (LightNameIndex != -1)
|
|
RETURN_FLOAT(Smsc->LightsPtrs[LightNameIndex]->Far);
|
|
})
|
|
DEFINE_SCRIPT(LIGHT_FarSet,
|
|
CATEGORY(Light) PARAM_SCENE(Smsc) PARAM_INT(LightNameIndex) PARAM_FLOAT(Far),
|
|
"Set Light Type",
|
|
{
|
|
if (LightNameIndex != -1)
|
|
Smsc->LightsPtrs[LightNameIndex]->Far = Far;
|
|
})
|
|
DEFINE_SCRIPT(LIGHT_SmallAlphaGet,
|
|
CATEGORY(Light) PARAM_SCENE(Smsc) PARAM_INT(LightNameIndex),
|
|
"Get Light Type",
|
|
{
|
|
if (LightNameIndex != -1)
|
|
RETURN_FLOAT(Smsc->LightsPtrs[LightNameIndex]->SmallAlpha);
|
|
})
|
|
DEFINE_SCRIPT(LIGHT_SmallAlphaSet,
|
|
CATEGORY(Light) PARAM_SCENE(Smsc) PARAM_INT(LightNameIndex) PARAM_FLOAT(SmallAlpha),
|
|
"Set Light Type",
|
|
{
|
|
if (LightNameIndex != -1)
|
|
Smsc->LightsPtrs[LightNameIndex]->SmallAlpha = SmallAlpha;
|
|
})
|
|
DEFINE_SCRIPT(LIGHT_BigAlphaGet,
|
|
CATEGORY(Light) PARAM_SCENE(Smsc) PARAM_INT(LightNameIndex),
|
|
"Get Light Type",
|
|
{
|
|
if (LightNameIndex != -1)
|
|
RETURN_FLOAT(Smsc->LightsPtrs[LightNameIndex]->BigAlpha);
|
|
})
|
|
DEFINE_SCRIPT(LIGHT_BigAlphaSet,
|
|
CATEGORY(Light) PARAM_SCENE(Smsc) PARAM_INT(LightNameIndex) PARAM_FLOAT(BigAlpha),
|
|
"Set Light Type",
|
|
{
|
|
if (LightNameIndex != -1)
|
|
Smsc->LightsPtrs[LightNameIndex]->BigAlpha = BigAlpha;
|
|
})
|
|
DEFINE_SCRIPT(LIGHT_LightColorGet,
|
|
CATEGORY(Light) PARAM_SCENE(Smsc) PARAM_INT(LightNameIndex),
|
|
"Get Light Type",
|
|
{
|
|
if (LightNameIndex != -1)
|
|
{
|
|
RETURN_VECTOR(&Smsc->LightsPtrs[LightNameIndex]->LightColor);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(LIGHT_LightColorSet,
|
|
CATEGORY(Light) PARAM_SCENE(Smsc) PARAM_INT(LightNameIndex) PARAM_VECTOR(LightColor),
|
|
"Set Light Type",
|
|
{
|
|
if (LightNameIndex != -1)
|
|
Smsc->LightsPtrs[LightNameIndex]->LightColor = LightColor;
|
|
})
|
|
DEFINE_SCRIPT(LIGHT_IsOnGet,
|
|
CATEGORY(Light) PARAM_SCENE(Smsc) PARAM_INT(LightNameIndex),
|
|
"Get Light Type",
|
|
{
|
|
if (LightNameIndex != -1)
|
|
RETURN_BOOL(Smsc->LightsPtrs[LightNameIndex]->IsOn);
|
|
})
|
|
DEFINE_SCRIPT(LIGHT_IsOnSet,
|
|
CATEGORY(Light) PARAM_SCENE(Smsc) PARAM_INT(LightNameIndex) PARAM_INT(IsOn),
|
|
"Set Light Type",
|
|
{
|
|
if (LightNameIndex != -1)
|
|
Smsc->LightsPtrs[LightNameIndex]->IsOn = IsOn;
|
|
})
|
|
|
|
DEFINE_SCRIPT(TOOLS_TrackTest,
|
|
CATEGORY(Tools) PARAM_MEDIA(Mi) PARAM_INT(PointIndex) PARAM_INT(X) PARAM_INT(Y) PARAM_INT_OPT(Force, 0) PARAM_INT_OPT(IsNewPass, 1) PARAM_INT_OPT(nbTrkPoint, 1) PARAM_INT_OPT(trkZone, 1) PARAM_INT_OPT(trkSearch, 48),
|
|
"Track Test",
|
|
{
|
|
int NewX = X;
|
|
int NewY = ID_MEDIA[Mi]->Image.SY - Y - 1;
|
|
int ZoneCompute(MAP *imageMap, int index, int *ptX, int *ptY, int forceReset, int newImage, int nbTrkPoint, int trkZone, int trkSearch);
|
|
if (ZoneCompute(&ID_MEDIA[Mi]->Image, PointIndex, &NewX, &NewY, Force, IsNewPass, nbTrkPoint, trkZone, trkSearch))
|
|
{
|
|
RETURN_POINT2(NewX,ID_MEDIA[Mi]->Image.SY - NewY - 1);
|
|
}
|
|
DI->UpdateTexture_BM_2_HW(ID_MEDIA[Mi]->ulAssociatedTextureIndex);
|
|
})
|
|
DEFINE_SCRIPT(SCN_RenderZPass,
|
|
CATEGORY(Small Scene) PARAM_STRING(SmallSceneName) PARAM_FLOAT_OPT(ZNear,0.0f) PARAM_FLOAT_OPT(ZFar,10.0f),
|
|
"Render Z",
|
|
{
|
|
START_RASTER(Rendering);
|
|
if (!(SkipFunctions & SKIP_RENDER))
|
|
{
|
|
DI->SetFog(1,ZNear, ZFar,0xffffffff);
|
|
RenderSmallScene(SmallSceneName,2);
|
|
DI->SetFog(0,ZNear, ZFar,0xffffffff);
|
|
}
|
|
STOP_RASTER(Rendering);
|
|
})
|
|
DEFINE_SCRIPT(SCN_RenderFlagsSet,
|
|
CATEGORY(Small Scene) PARAM_INT(FLAGS) ,
|
|
"VALUE 1 = FORCE_NO_Z_WRITE,VALUE 2 = FORCE_NO_Z_TEST,VALUE 8 = NO differencial RS (OPTIM = 0)",
|
|
{
|
|
DI->FORCE_RENDER_FLAG = FLAGS;
|
|
})
|
|
|
|
DEFINE_SCRIPT(SCN_RenderFlagsGet,
|
|
CATEGORY(Small Scene),
|
|
"return the previously SCN_RenderFlagsSet value",
|
|
{
|
|
RETURN_INT(DI->FORCE_RENDER_FLAG);
|
|
})
|
|
|
|
DEFINE_SCRIPT_REN(WND_Set, TrackerSetWindow,
|
|
CATEGORY(Window) PARAM_INT(XPos) PARAM_INT(YPos) PARAM_INT_OPT(Width, -1) PARAM_INT_OPT(Height, -1) PARAM_INT_OPT(Visible, -1) PARAM_INT_OPT(Showborder, -1) PARAM_STRING_OPT(PlaceAfter, ""),
|
|
"",
|
|
{
|
|
if (Width == -1) Width = XSize;
|
|
if (Height == -1) Height = YSize;
|
|
|
|
extern void TrackerSetWindow(s32 X,s32 Y,s32 Sizex , s32 SizeY , s32 Visible , s32 Border, HWND PlaceAfter);
|
|
if (*PlaceAfter)
|
|
{
|
|
if (!strcmp(PlaceAfter, "top"))
|
|
TrackerSetWindow(XPos,YPos,Width,Height,Visible,Showborder, 0);
|
|
else
|
|
TrackerSetWindow(XPos,YPos,Width,Height,Visible,Showborder, GetWindowByName(PlaceAfter));
|
|
} else
|
|
TrackerSetWindow(XPos,YPos,Width,Height,Visible,Showborder, (HWND)-1);
|
|
})
|
|
DEFINE_SCRIPT_REN(WND_ViewportSet, SetViewport,
|
|
CATEGORY(Window) PARAM_INT_OPT(X,0) PARAM_INT_OPT(Y,0) PARAM_INT_OPT(SizeX,0) PARAM_INT_OPT(SizeY,0),
|
|
"Set a viewport<br/>If no parrameters,Set to full screen",
|
|
{
|
|
if (SizeX == 0 || SizeY == 0)
|
|
DI->SetViewport(0,0,XSize,YSize);
|
|
else
|
|
DI->SetViewport(X,Y,SizeX,SizeY);
|
|
})
|
|
DEFINE_SCRIPT(WND_ClippingSet,
|
|
CATEGORY(Window) PARAM_INT_OPT(X,0) PARAM_INT_OPT(Y,0) PARAM_INT_OPT(SizeX,0) PARAM_INT_OPT(SizeY,0),
|
|
"Set a clipping quad<br/>If no parrameters,Set to full screen",
|
|
{
|
|
if (SizeX == 0 || SizeY == 0)
|
|
DI->SetClipping(0,0,XSize,YSize);
|
|
else
|
|
DI->SetClipping(X,Y,SizeX,SizeY);
|
|
})
|
|
DEFINE_SCRIPT(WND_ViewportGetCurrent,
|
|
CATEGORY(Window) ,
|
|
"Get a current(active) viewport",
|
|
{
|
|
RECT winRect;
|
|
DI->GetViewport((int*)&winRect.left,(int*)&winRect.top,(int*)&winRect.right,(int*)&winRect.bottom);
|
|
winRect.right += winRect.left;
|
|
winRect.bottom += winRect.top;
|
|
RETURN_RECTANGLE(&winRect);
|
|
})
|
|
DEFINE_SCRIPT_REN(WND_MouseGet, GetMouse,
|
|
CATEGORY(Window) PARAM_INT(DIR) PARAM_INT(Mode) PARAM_MEDIA_OPT(Medianame,-1) PARAM_INT_OPT(X,-1) PARAM_INT_OPT(Y,-1) PARAM_INT_OPT(SX,-1) PARAM_INT_OPT(SY,-1),
|
|
"GET the mouse position <br/> DIR: 1->X, 2->Y, 3->XY <br/>Modes: <br/>0- Client mouse pos<br/>1- Mouse position translated in the media, needs media definition<br/>2,3 - Mouse position in REVR plan! Need special config<br/>4- Mouse screen with environement rescale<br/>5- Mouse on total screen pos",
|
|
{
|
|
extern int mouseX;
|
|
extern int mouseY;
|
|
POINT MouseXY;
|
|
|
|
POINT GetMouse(int Mode, int MouseX, int MouseY, int XSize, int YSize, MAP *MediaPtr, int X, int Y, int SX, int SY);
|
|
if (Medianame != -1 && ID_MEDIA[Medianame])
|
|
//MouseXY = GetMouse(Mode, MouseX, MouseY, XSize, YSize, &ID_MEDIA[Medianame]->Image, X, Y, SX, SY);
|
|
MouseXY = GetMouse(Mode, mouseX, mouseY, XSize, YSize, &ID_MEDIA[Medianame]->Image, X, Y, SX, SY);
|
|
else
|
|
//MouseXY = GetMouse(Mode, MouseX, MouseY, XSize, YSize, NULL, X, Y, SX, SY);
|
|
MouseXY = GetMouse(Mode, mouseX, mouseY, XSize, YSize, NULL, X, Y, SX, SY);
|
|
if (DIR == 3)
|
|
{ RETURN_POINT(&MouseXY);}
|
|
else if (DIR & 1)
|
|
{ RETURN_INT(MouseXY.x);}
|
|
else if (DIR & 2)
|
|
{ RETURN_INT(MouseXY.y);}
|
|
})
|
|
DEFINE_SCRIPT_REN(WND_BoundsGet, GetWindowBounds,
|
|
CATEGORY(Window),
|
|
"return the window params",
|
|
{
|
|
RECT winRect;
|
|
|
|
extern BOOL GetDrawWindowRect(RECT *winRect, int XSize, int YSize);
|
|
if (GetDrawWindowRect(&winRect, XSize, YSize))
|
|
{
|
|
RETURN_RECTANGLE(&winRect);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(WND_RectGet,
|
|
CATEGORY(Window),
|
|
"return the window in screen bounds",
|
|
{
|
|
RECT winRect;
|
|
|
|
extern HWND hWnd;
|
|
GetWindowRect(hWnd, &winRect);
|
|
RETURN_RECTANGLE(&winRect);
|
|
})
|
|
DEFINE_SCRIPT(WND_ClientRectGet,
|
|
CATEGORY(Window),
|
|
"return the client window in screen bounds",
|
|
{
|
|
RECT winRect;
|
|
POINT Pt;
|
|
|
|
extern HWND hWnd;
|
|
GetClientRect(hWnd, &winRect);
|
|
Pt.x = winRect.left;
|
|
Pt.y = winRect.top;
|
|
ClientToScreen(hWnd , &Pt);
|
|
winRect.left= Pt.x ;
|
|
winRect.top = Pt.y;
|
|
|
|
Pt.x = winRect.right;
|
|
Pt.y = winRect.bottom;
|
|
ClientToScreen(hWnd , &Pt);
|
|
winRect.right = Pt.x ;
|
|
winRect.bottom = Pt.y;
|
|
|
|
RETURN_RECTANGLE(&winRect);
|
|
})
|
|
DEFINE_SCRIPT_REN(WND_ResolutionGet, GetResolution,
|
|
CATEGORY(Window) PARAM_INT_OPT(Info, 0),
|
|
"return the resolution info, Info is a mask value<br/>1: SX - 2: SY",
|
|
{
|
|
if (Info == 0 || Info == 3)
|
|
{ RETURN_POINT2(XSize, YSize);}
|
|
else
|
|
{
|
|
if (Info & 1)
|
|
{ RETURN_INT(XSize);}
|
|
else if (Info & 2)
|
|
{ RETURN_INT(YSize);}
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(WND_ScreenResolutionGet,
|
|
CATEGORY(Window) PARAM_INT_OPT(Info, 0),
|
|
"return the screen resolution info, Info is a mask value<br/>1: SX - 2: SY",
|
|
{
|
|
if (Info == 0 || Info == 3)
|
|
{ RETURN_POINT2(GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));}
|
|
else
|
|
{
|
|
if (Info & 1)
|
|
{ RETURN_INT(GetSystemMetrics(SM_CXSCREEN));}
|
|
else if (Info & 2)
|
|
{ RETURN_INT(GetSystemMetrics(SM_CYSCREEN));}
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(WND_FrameBufferUpdate,
|
|
CATEGORY(Window) PARAM_INT(YesNo),
|
|
"Force frame buffer update even if GDI not set",
|
|
{
|
|
if (YesNo)
|
|
{
|
|
ulMustUpdateFrameBufferResult++;
|
|
}
|
|
else
|
|
{
|
|
ulMustUpdateFrameBufferResult--;
|
|
if (ulMustUpdateFrameBufferResult < 0)
|
|
ulMustUpdateFrameBufferResult = 0;
|
|
}
|
|
})
|
|
|
|
DEFINE_SCRIPT(WND_DockToWindow,
|
|
CATEGORY(Window) PARAM_STRING_OPT(wndToDock, "") PARAM_INT_OPT(dockMask, 3) PARAM_INT_OPT(dockX, 0) PARAM_INT_OPT(dockY, 0) PARAM_INT_OPT(PutAfter, 0),
|
|
"Dock to specified window, if no windows is specified, dock to the windows with the focus",
|
|
{
|
|
HWND wnd;
|
|
|
|
if (*wndToDock)
|
|
wnd = GetWindowByName(wndToDock);
|
|
else
|
|
wnd = GetForegroundWindow();
|
|
if (wnd && wnd != OwnerHwnd)
|
|
DockToWindow(OwnerHwnd, wnd, dockMask, dockX, dockY, PutAfter);
|
|
})
|
|
|
|
DEFINE_SCRIPT(WND_NeerTest,
|
|
CATEGORY(Window) PARAM_STRING_OPT(wndToTest, "") PARAM_INT(deltaX) PARAM_INT(deltaY) PARAM_INT_OPT(maxPixels, 5),
|
|
"Verify if Window is neer",
|
|
{
|
|
HWND wnd;
|
|
int posX;
|
|
int posY;
|
|
|
|
if (*wndToTest)
|
|
wnd = GetWindowByName(wndToTest);
|
|
else
|
|
wnd = GetForegroundWindow();
|
|
if (wnd && wnd != OwnerHwnd)
|
|
{
|
|
IsWindowNeer(OwnerHwnd, wnd, maxPixels, deltaX, deltaY, &posX, &posY);
|
|
RETURN_INT(posX);
|
|
RETURN_INT(posY);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(WND_FocusWindowGet,
|
|
CATEGORY(Window),
|
|
"Get windows with the focus by name",
|
|
{
|
|
HWND wnd;
|
|
char name[512];
|
|
wnd = GetForegroundWindow();
|
|
GetWindowText(wnd, name, 512);
|
|
RETURN_STRING(name);
|
|
})
|
|
DEFINE_SCRIPT(WND_IsWindow,
|
|
CATEGORY(Window) PARAM_STRING(window) PARAM_INT_OPT(DeleteIfNotFound, 0),
|
|
"Verify is there is a windows with the specified name",
|
|
{
|
|
HWND wnd = GetWindowByName(window);
|
|
int isWnd = wnd && IsWindow(wnd);
|
|
if (!isWnd && DeleteIfNotFound)
|
|
RemoveWindowFromCache(window);
|
|
RETURN_BOOL(isWnd);
|
|
})
|
|
DEFINE_SCRIPT(WND_WindowCacheClear,
|
|
CATEGORY(Window) PARAM_STRING(window) PARAM_INT_OPT(DeleteIfNotFound, 0),
|
|
"Clear cache",
|
|
{
|
|
ClearCache();
|
|
})
|
|
DEFINE_SCRIPT(WND_IsWindowMinimized,
|
|
CATEGORY(Window) PARAM_STRING(window) PARAM_INT_OPT(DeleteIfNotFound, 0),
|
|
"Verify the windows is minimized",
|
|
{
|
|
HWND wnd = GetWindowByName(window);
|
|
if (wnd && IsWindow(wnd))
|
|
{
|
|
WINDOWPLACEMENT wndPlacement;
|
|
wndPlacement.length = sizeof(WINDOWPLACEMENT);
|
|
GetWindowPlacement(wnd, &wndPlacement);
|
|
RETURN_BOOL(wndPlacement.showCmd == SW_MINIMIZE ||
|
|
wndPlacement.showCmd == SW_SHOWMINIMIZED);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(WND_IsWindowMaximized,
|
|
CATEGORY(Window) PARAM_STRING(window) PARAM_INT_OPT(DeleteIfNotFound, 0),
|
|
"Verify the windows is maximized",
|
|
{
|
|
HWND wnd = GetWindowByName(window);
|
|
if (wnd && IsWindow(wnd))
|
|
{
|
|
WINDOWPLACEMENT wndPlacement;
|
|
wndPlacement.length = sizeof(WINDOWPLACEMENT);
|
|
GetWindowPlacement(wnd, &wndPlacement);
|
|
RETURN_BOOL(wndPlacement.showCmd == SW_MAXIMIZE ||
|
|
wndPlacement.showCmd == SW_SHOWMAXIMIZED);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(WND_RectExternGet,
|
|
CATEGORY(Window) PARAM_STRING_OPT(window, ""),
|
|
"Get external windo rect",
|
|
{
|
|
RECT winRect;
|
|
HWND wnd;
|
|
|
|
if (*window)
|
|
wnd = GetWindowByName(window);
|
|
else
|
|
wnd = GetForegroundWindow();
|
|
|
|
if (wnd)
|
|
{
|
|
GetWindowRect(wnd, &winRect);
|
|
RETURN_RECTANGLE(&winRect);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(WND_GetWindowsByExpr,
|
|
CATEGORY(Window) PARAM_STRING(expression),
|
|
"Get external windo rect",
|
|
{
|
|
char ** GetWindowsByExpression(char *expr, int *nbElmts);
|
|
int wndNum;
|
|
char ** wndList = GetWindowsByExpression(expression, &wndNum);
|
|
|
|
for (int i=0; i<wndNum; i++)
|
|
{
|
|
RETURN_STRING(wndList[i]);
|
|
CC_free(wndList[i]);
|
|
}
|
|
if (wndNum)
|
|
CC_free(wndList);
|
|
})
|
|
DEFINE_SCRIPT(WND_ComputeMessages,
|
|
CATEGORY(Window) ,
|
|
"Compute clip region",
|
|
{
|
|
MSG msg;
|
|
while (PeekMessage(&msg, NULL, 0, 0 ,PM_REMOVE) )
|
|
{
|
|
TranslateMessage(&msg);
|
|
DispatchMessage(&msg);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(WND_RegionCompute,
|
|
CATEGORY(Window) ,
|
|
"Compute clip region",
|
|
{
|
|
if (!wndRegion)
|
|
{
|
|
SetWindowRgn(OwnerHwnd, NULL, true);
|
|
} else
|
|
{
|
|
RECT region;
|
|
|
|
GetRgnBox(wndRegion, ®ion);
|
|
if (region.left != region.right && region.top != region.bottom)
|
|
SetWindowRgn(OwnerHwnd, wndRegion, true);
|
|
else
|
|
DeleteObject(wndRegion);
|
|
}
|
|
//{
|
|
// MSG msg;
|
|
// while (PeekMessage(&msg, NULL, 0, 0 ,PM_REMOVE) )
|
|
// {
|
|
// TranslateMessage(&msg);
|
|
// DispatchMessage(&msg);
|
|
// }
|
|
//}
|
|
wndRegion = NULL;
|
|
})
|
|
DEFINE_SCRIPT(WND_RegionClear,
|
|
CATEGORY(Window) ,
|
|
"Remove clip region",
|
|
{
|
|
wndRegion = NULL;
|
|
})
|
|
DEFINE_SCRIPT(WND_RegionSet,
|
|
CATEGORY(Window) PARAM_MEDIA_OPT(media, -1) PARAM_INT(Component) PARAM_INT(Threshhold) PARAM_INT_OPT(ForceReadPixels, 0) PARAM_FLOAT_OPT(scale, 1.0f),
|
|
"Use Specified media to define window region, if no media is set, use current frame buffer media <br/> Component set if the threshhold uses R,G,B or A element (0-4)",
|
|
{
|
|
HRGN GetRgnFromImage(MAP *imgPtr, int component, int threshhold, float scale);
|
|
if (media == -1)
|
|
{
|
|
if (ForceReadPixels)
|
|
ReadFrameBuffer();
|
|
wndRegion = GetRgnFromImage(&FrameBufferResult, Component, Threshhold, scale);
|
|
} else
|
|
{
|
|
wndRegion = GetRgnFromImage(&ID_MEDIA[media]->Image, Component, Threshhold, scale);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(WND_RegionGet,
|
|
CATEGORY(Window),
|
|
"get window region",
|
|
{
|
|
HRGN regCurrent = CreateRectRgn(0, 0, 0, 0);
|
|
RECT region;
|
|
|
|
GetWindowRgn(OwnerHwnd, regCurrent);
|
|
GetRgnBox(regCurrent, ®ion);
|
|
DeleteObject(regCurrent);
|
|
RETURN_RECTANGLE(®ion);
|
|
})
|
|
DEFINE_SCRIPT(WND_RegionAdd,
|
|
CATEGORY(Window) PARAM_MEDIA(media) PARAM_INT(Component) PARAM_INT(Threshhold) PARAM_INT_OPT(X, 0) PARAM_INT_OPT(Y, 0) PARAM_FLOAT_OPT(scale, 1.0f),
|
|
"Use Specified media to add window region",
|
|
{
|
|
HRGN GetRgnFromImage(MAP *imgPtr, int component, int threshhold, float scale);
|
|
|
|
RECT region;
|
|
HRGN reg = GetRgnFromImage(&ID_MEDIA[media]->Image, Component, Threshhold, scale);
|
|
|
|
if (!wndRegion)
|
|
{
|
|
wndRegion = CreateRectRgn(0, 0, 0, 0);
|
|
GetWindowRgn(OwnerHwnd, wndRegion);
|
|
}
|
|
|
|
OffsetRgn(reg, X, Y);
|
|
CombineRgn(wndRegion, wndRegion, reg, RGN_OR);
|
|
DeleteObject(reg);
|
|
})
|
|
DEFINE_SCRIPT(WND_RegionSub,
|
|
CATEGORY(Window) PARAM_MEDIA(media) PARAM_INT(Component) PARAM_INT(Threshhold) PARAM_INT_OPT(X, 0) PARAM_INT_OPT(Y, 0) PARAM_FLOAT_OPT(scale, 1.0f),
|
|
"Use Specified media to add window region",
|
|
{
|
|
HRGN GetRgnFromImage(MAP *imgPtr, int component, int threshhold, float scale);
|
|
|
|
RECT region;
|
|
HRGN reg = GetRgnFromImage(&ID_MEDIA[media]->Image, Component, Threshhold, scale);
|
|
|
|
if (!wndRegion)
|
|
{
|
|
wndRegion = CreateRectRgn(0, 0, 0, 0);
|
|
GetWindowRgn(OwnerHwnd, wndRegion);
|
|
}
|
|
|
|
OffsetRgn(reg, X, Y);
|
|
CombineRgn(wndRegion, wndRegion, reg, RGN_DIFF);
|
|
DeleteObject(reg);
|
|
})
|
|
DEFINE_SCRIPT(WND_RegionRectSet,
|
|
CATEGORY(Window) PARAM_INT(X) PARAM_INT(Y) PARAM_INT(SX) PARAM_INT(SY),
|
|
"Make Rect the current Region (on framebuffer window)",
|
|
{
|
|
if (wndRegion)
|
|
DeleteObject(wndRegion);
|
|
wndRegion = CreateRectRgn(X, Y, X+SX, Y+SY);
|
|
})
|
|
DEFINE_SCRIPT(WND_RegionRectAdd,
|
|
CATEGORY(Window) PARAM_INT(X) PARAM_INT(Y) PARAM_INT(SX) PARAM_INT(SY),
|
|
"Add to Region the specified Rect (on framebuffer window)",
|
|
{
|
|
RECT region;
|
|
HRGN reg = CreateRectRgn(X, Y, X+SX, Y+SY);
|
|
|
|
if (!wndRegion)
|
|
{
|
|
wndRegion = CreateRectRgn(0, 0, 0, 0);
|
|
GetWindowRgn(OwnerHwnd, wndRegion);
|
|
}
|
|
|
|
CombineRgn(wndRegion, wndRegion, reg, RGN_OR);
|
|
DeleteObject(reg);
|
|
})
|
|
DEFINE_SCRIPT(WND_RegionRectSub,
|
|
CATEGORY(Window) PARAM_INT(X) PARAM_INT(Y) PARAM_INT(SX) PARAM_INT(SY),
|
|
"Remove to Region the specified Rect (on framebuffer window)",
|
|
{
|
|
RECT region;
|
|
HRGN reg = CreateRectRgn(X, Y, X+SX, Y+SY);
|
|
|
|
if (!wndRegion)
|
|
{
|
|
wndRegion = CreateRectRgn(0, 0, 0, 0);
|
|
GetWindowRgn(OwnerHwnd, wndRegion);
|
|
}
|
|
|
|
CombineRgn(wndRegion, wndRegion, reg, RGN_DIFF);
|
|
DeleteObject(reg);
|
|
})
|
|
DEFINE_SCRIPT(WND_FrameDiffSet,
|
|
CATEGORY(Window) PARAM_MEDIA_OPT(media, -1),
|
|
"Set Frame buffer diff for gdi update",
|
|
{
|
|
FrameBufferMediaDiff = media + 1;
|
|
ulFullRefresh = true;
|
|
})
|
|
DEFINE_SCRIPT(WND_FrameRegionThresholdSet,
|
|
CATEGORY(Window) PARAM_INT(Threshold),
|
|
"Set Frame buffer diff for gdi update",
|
|
{
|
|
RegionThreshold = Threshold;
|
|
})
|
|
DEFINE_SCRIPT(WND_Transparent,
|
|
CATEGORY(Window) PARAM_INT_OPT(ON_OFF, -1) PARAM_INT_OPT(Force, 0),
|
|
"Transparent Mode Set/Remove",
|
|
{
|
|
void TransparentWindowSet(bool enable, bool force = false);
|
|
if (ON_OFF != -1)
|
|
{
|
|
TransparentWindowSet(ON_OFF, Force);
|
|
ulFullRefresh = true;
|
|
}
|
|
RETURN_INT(LayederWindow);
|
|
})
|
|
DEFINE_SCRIPT(WND_UseGDI,
|
|
CATEGORY(Window) PARAM_INT_OPT(ON_OFF, -1),
|
|
"UseGDI Mode Set/Remove",
|
|
{
|
|
if (ON_OFF != -1)
|
|
{
|
|
ChangeGDIMode(ON_OFF);
|
|
ulFullRefresh = true;
|
|
}
|
|
RETURN_INT(UseGDI);
|
|
})
|
|
DEFINE_SCRIPT(SUB_Load,
|
|
CATEGORY(Subtitles) PARAM_STRING(filename),
|
|
"Load a SRT file as subtitles",
|
|
{
|
|
extern void LoadSubtitle(char* file);
|
|
LoadSubtitle(filename);
|
|
})
|
|
|
|
DEFINE_SCRIPT(SUB_Save,
|
|
CATEGORY(Subtitles) PARAM_STRING(filename) PARAM_STRING(destination),
|
|
"Save current version of subtitles in a SRT file",
|
|
{
|
|
extern void SaveSubtitle(char* file, char* dest);
|
|
SaveSubtitle(filename, destination);
|
|
})
|
|
|
|
DEFINE_SCRIPT(SUB_Destroy,
|
|
CATEGORY(Subtitles) PARAM_STRING(filename),
|
|
"Destroy subtitle from memory",
|
|
{
|
|
extern void DestroySubtitle(char* filename);
|
|
DestroySubtitle(filename);
|
|
})
|
|
|
|
DEFINE_SCRIPT(SUB_Get,
|
|
CATEGORY(Subtitles) PARAM_STRING(filename) PARAM_FLOAT(time),
|
|
"Get the subtitle at second 'time' if there's one or NIL",
|
|
{
|
|
extern char* GetSubtitle(char* file, float sec);
|
|
char * text = GetSubtitle(filename, time);
|
|
if (text) RETURN_STRING(text);
|
|
})
|
|
|
|
DEFINE_SCRIPT(SUB_GetIndex,
|
|
CATEGORY(Subtitles) PARAM_STRING(filename) PARAM_FLOAT(time),
|
|
"Get the subtitle at second 'time' if there's one or NIL",
|
|
{
|
|
extern int GetSubtitleIndex(char * filename, float time);
|
|
RETURN_INT(GetSubtitleIndex(filename, time));
|
|
})
|
|
|
|
DEFINE_SCRIPT(SUB_GetByIndex,
|
|
CATEGORY(Subtitles) PARAM_STRING(filename) PARAM_INT(index),
|
|
"Get the subtitle at second 'time' if there's one or NIL",
|
|
{
|
|
extern char* GetSubtitleByIndex(char* file, int index);
|
|
char * text = GetSubtitleByIndex(filename, index);
|
|
if (text) RETURN_STRING(text);
|
|
})
|
|
|
|
DEFINE_SCRIPT(SUB_Set,
|
|
CATEGORY(Subtitles) PARAM_STRING(filename) PARAM_STRING(text) PARAM_FLOAT(time),
|
|
"Set the subtitle at second 'time'",
|
|
{
|
|
extern void SetSubtitle(char* file, char* newSub, float sec);
|
|
SetSubtitle(filename, text, time);
|
|
})
|
|
|
|
DEFINE_SCRIPT(SUB_MidToSub,
|
|
CATEGORY(Subtitles) PARAM_STRING(midiFile) PARAM_STRING(subFile),
|
|
"Set the subtitle at second 'time'",
|
|
{
|
|
extern void MidiTextToSubtitle(char *txtFile, char *subFile);
|
|
MidiTextToSubtitle(midiFile, subFile);
|
|
})
|
|
|
|
/* SHOTS BEGIN ****************************************************************************/
|
|
DEFINE_SCRIPT(SHOT_DrawInfo,
|
|
CATEGORY(SHOTS) PARAM_INT_OPT(Show, 1),
|
|
"Show or hide Shot infos",
|
|
{
|
|
SHOTS_CLASS::DrawShots = Show;
|
|
})
|
|
|
|
DEFINE_SCRIPT(SHOT_GetMatrix,
|
|
CATEGORY(SHOTS) PARAM_INT(SHOT_NUM),
|
|
"Return nil if shot is not here",
|
|
{
|
|
extern u32 SHOT_GetMatrix(u32 id , MATRIX *pDest);
|
|
MATRIX Result;
|
|
if (SHOT_GetMatrix(SHOT_NUM , &Result))
|
|
{
|
|
RETURN_MATRIX(&Result);
|
|
}
|
|
})
|
|
|
|
DEFINE_SCRIPT(SHOT_GetError,
|
|
CATEGORY(SHOTS) PARAM_INT(SHOT_NUM),
|
|
" Return error of the tag ",
|
|
{
|
|
extern float SHOT_GetError(u32 id );
|
|
RETURN_FLOAT(SHOT_GetError(SHOT_NUM));
|
|
})
|
|
|
|
DEFINE_SCRIPT(SHOT_ForceVerticalFactor,
|
|
CATEGORY(SHOTS) PARAM_FLOAT(Factor),
|
|
" Force Vertical Factor (between -1(force negativ) 0(flick artefact) 1(alway vertical)) ",
|
|
{
|
|
SHOTS_CLASS::FACTOR_ForceVDir = Factor;
|
|
})
|
|
|
|
DEFINE_SCRIPT(SCN_SetHoloGraphicPerspectiv,
|
|
CATEGORY(SHOTS) PARAM_SCENE(Smsc) PARAM_FLOAT(WindowWith) PARAM_VECTOR_OPT(UserPos,Vector(0,0,-1)) ,
|
|
"",
|
|
{
|
|
if(Smsc)
|
|
{
|
|
Smsc->HoloGraphicWindowWidth = WindowWith;
|
|
Smsc->HoloGraphicVector = UserPos;
|
|
}
|
|
})
|
|
/* SHOTS END ************************************************************************************/
|
|
/* FAST2D BEGIN ****************************************************************************/
|
|
DEFINE_SCRIPT(FAST2D_Compute, CATEGORY(FAST2D) PARAM_MEDIA(MediaIndex) PARAM_INT_OPT(DebugInfo,1),"compute all featureboxes on specified media. ",
|
|
{
|
|
if((ID_MEDIA[MediaIndex]->ulAssociatedTextureIndex != -1))
|
|
{
|
|
u32 Ret ;
|
|
if (ID_MEDIA[MediaIndex]->GetType() == IOtype_NATAL)
|
|
{
|
|
MAP16 ZMap;
|
|
void NATAL_GetZMap(INPUT_IO *pMedia,MAP16 *pZMap);
|
|
NATAL_GetZMap(ID_MEDIA[MediaIndex],&ZMap);
|
|
Ret = fast2D.Compute(&ID_MEDIA[MediaIndex]->Image,&ZMap,DebugInfo);
|
|
} else
|
|
Ret = fast2D.Compute(&ID_MEDIA[MediaIndex]->Image,NULL,DebugInfo);
|
|
if (DebugInfo && Ret) DI->UpdateTexture_BM_2_HW(ID_MEDIA[MediaIndex]->ulAssociatedTextureIndex);
|
|
RETURN_INT(Ret);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(FAST2D_FeatureBoxCreate, CATEGORY(FAST2D) PARAM_INT(Index) PARAM_INT(BX) PARAM_INT(BY) PARAM_INT(SX) PARAM_INT(SY) PARAM_FLOAT_OPT(ROTATION,0),"Create a featurebox with specified index.",
|
|
{
|
|
fast2D.CreateFeatureBox(Index,BX,BY,SX,SY,ROTATION);
|
|
})
|
|
DEFINE_SCRIPT(FAST2D_FeatureBoxDestroy, CATEGORY(FAST2D) PARAM_INT(Index),"",
|
|
{
|
|
fast2D.DestroyFeatureBox(Index);
|
|
})
|
|
DEFINE_SCRIPT(FAST2D_FeatureBoxGetXYS, CATEGORY(FAST2D) PARAM_INT(Index),"Return moving vector (delta X,delta Y,delta SCALE). Sould be called after FAST2D_Compute",
|
|
{
|
|
Vector Result;
|
|
fast2D.FeatureBoxGetXYS(Index,&Result);
|
|
RETURN_VECTOR(&Result);
|
|
})
|
|
DEFINE_SCRIPT(FAST2D_FeatureBoxGetScaleXY, CATEGORY(FAST2D) PARAM_INT(Index),"Return scale for X & Y . Sould be called after FAST2D_Compute",
|
|
{
|
|
Vector Result;
|
|
fast2D.FeatureBoxGetSXSY(Index,&Result);
|
|
RETURN_VECTOR(&Result);
|
|
})
|
|
DEFINE_SCRIPT(FAST2D_FeatureBoxGetRot, CATEGORY(FAST2D) PARAM_INT(Index),"Return moving vector (delta X,delta Y,delta SCALE). Sould be called after FAST2D_Compute",
|
|
{
|
|
float Result;
|
|
fast2D.FeatureBoxGetRot(Index,&Result);
|
|
RETURN_FLOAT(Result);
|
|
})
|
|
DEFINE_SCRIPT(FAST2D_FeatureBoxSetParam, CATEGORY(FAST2D) PARAM_INT(Index) PARAM_STRING(ParamName) PARAM_FLOAT(Value),"Set option for FAST2D.<br/>SCAL for scale activation.<br/>TURN for rotation activation.<br/>WIND for set tracking radius outside featurebox",
|
|
{
|
|
fast2D.FeatureBoxSetParam(Index,ParamName, Value);
|
|
})
|
|
|
|
DEFINE_SCRIPT(FAST2D_FeatureBoxGetPertinence,CATEGORY(FAST2D) PARAM_INT(Index),"Return quality of tracking between 0 and 1",
|
|
{
|
|
RETURN_FLOAT(fast2D.FeatureBoxGetPertinence(Index));
|
|
})
|
|
|
|
DEFINE_SCRIPT(FAST2D_FeatureBoxGetMATRIX,CATEGORY(FAST2D) PARAM_INT(Index),"Return full matrix affine transform",
|
|
{
|
|
MATRIX *M;
|
|
M = fast2D.FeatureBoxGetMatrix(Index);
|
|
if (M != NULL)
|
|
{
|
|
RETURN_MATRIX(M);
|
|
}
|
|
})
|
|
|
|
/* FAST2D END ************************************************************************************/
|
|
|
|
|
|
/* FACE DETECTOR ********************************************************************************/
|
|
DEFINE_SCRIPT(FACEDETCT_GetNumberOfFaces,CATEGORY(FACEDETECTOR) PARAM_MEDIA(Mi),"",
|
|
{
|
|
RETURN_INT(headDetector.GetNumberOfFace());
|
|
})
|
|
DEFINE_SCRIPT(FACEDETCT_DrawDetectedFaces,CATEGORY(FACEDETECTOR) PARAM_INT(Draw),"",
|
|
{
|
|
headDetector.DrawDetectedFaces(Draw);
|
|
})
|
|
|
|
DEFINE_SCRIPT(FACEDETCT_GetFaceCenter,CATEGORY(FACEDETECTOR) PARAM_INT(INdex),"",
|
|
{
|
|
Vector VECT;
|
|
Vector SIZE;
|
|
SIZE = VECT = Vector(0,0,0);
|
|
headDetector.GetFace(INdex, &VECT,&SIZE);
|
|
RETURN_VECTOR(&VECT);
|
|
})
|
|
|
|
DEFINE_SCRIPT(FACEDETCT_GetFaceSize,CATEGORY(FACEDETECTOR) PARAM_INT(INdex),"",
|
|
{
|
|
Vector VECT;
|
|
Vector SIZE;
|
|
SIZE = VECT = Vector(0,0,0);
|
|
headDetector.GetFace(INdex, &VECT,&SIZE);
|
|
RETURN_VECTOR(&SIZE);
|
|
})
|
|
|
|
DEFINE_SCRIPT(FACEDETCT_GetFaceFeature,CATEGORY(FACEDETECTOR) PARAM_INT(INdex) PARAM_INT(Feature),"0 Reye,1 Leye,2 Nose,3 RMouth,4 LMouth,5 UPMouth,6 DonwMouth. Z = 0 mean not found",
|
|
{
|
|
Vector VECT;
|
|
VECT = Vector(0,0,0);
|
|
headDetector.GetFaceFeature(INdex, Feature,&VECT);
|
|
RETURN_VECTOR(&VECT);
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
/* MAX INTERFACE BEGIN *************************************************************************************/
|
|
DEFINE_SCRIPT(SCN_New,
|
|
CATEGORY(Small Scene) PARAM_STRING(SceneName),
|
|
"Create a new scene. Touch nothing if already exist.",
|
|
{
|
|
SmallSceneNew(SceneName);
|
|
})
|
|
DEFINE_SCRIPT(SCN_ObjectNew,
|
|
CATEGORY(Small Scene) PARAM_STRING(SceneName) PARAM_STRING(ObjectName) PARAM_STRING_OPT(ObjectFather, "") PARAM_MATRIX_OPT(ObjectPos, MATRIX()),
|
|
"Create a new object in scene. Touch nothing if already exist.",
|
|
{
|
|
SmallSceneNewObject(SceneName,ObjectName, ObjectFather, &ObjectPos);
|
|
})
|
|
DEFINE_SCRIPT(SCN_OptimiseQuadRender,
|
|
CATEGORY(Small Scene) PARAM_INT_OPT(Optimize, 1),
|
|
"Use optizided quad render, Warning this only works with a good created quad 0-3-2-1",
|
|
{
|
|
DI->OptimiseQuadRender = Optimize;
|
|
})
|
|
DEFINE_SCRIPT(SCN_MeshNew,
|
|
CATEGORY(Small Scene Mesh) PARAM_STRING(SceneName) PARAM_STRING(ObjectName),
|
|
"Create a new mesh. Touch nothing if already exist.",
|
|
{
|
|
SmallSceneNewMesh(SceneName,ObjectName);
|
|
})
|
|
DEFINE_SCRIPT(SCN_MaterialNew,
|
|
CATEGORY(Small Scene Mesh) PARAM_STRING(SceneName) PARAM_STRING_OPT(ObjectName, "") PARAM_STRING(MaterialName) PARAM_MEDIA_OPT(MediaName,-1),
|
|
"Create a new material . Touch nothing if already exist.",
|
|
{
|
|
if (SmallSceneNewMaterial(SceneName,MaterialName,MediaName) != -1 && *ObjectName)
|
|
SmallSceneLinkObjectMaterial(SceneName, ObjectName, MaterialName);
|
|
})
|
|
DEFINE_SCRIPT(SCN_ObjectMaterialLink,
|
|
CATEGORY(Small Scene Mesh) PARAM_STRING(SceneName) PARAM_STRING(ObjectName) PARAM_STRING(MaterialName),
|
|
"Link material to object.",
|
|
{
|
|
SmallSceneLinkObjectMaterial(SceneName, ObjectName, MaterialName);
|
|
})
|
|
DEFINE_SCRIPT(SCN_ObjectMultiMatLink,
|
|
CATEGORY(Small Scene Mesh) PARAM_STRING(SceneName) PARAM_STRING(ObjectName) PARAM_STRING(MultiMatName),
|
|
"Link multi material to object.",
|
|
{
|
|
SmallSceneLinkObjectMultiMat(SceneName, ObjectName, MultiMatName);
|
|
})
|
|
DEFINE_SCRIPT(SCN_LightNew,
|
|
CATEGORY(Small Scene Mesh) PARAM_STRING(SceneName) PARAM_STRING(LightName) PARAM_STRING(ObjectName),
|
|
"Create a new light. Touch nothing if already exist.",
|
|
{
|
|
RETURN_INT(SmallSceneNewLight(SceneName,LightName, ObjectName));
|
|
})
|
|
|
|
DEFINE_SCRIPT(SCN_MeshTriangleSet,
|
|
CATEGORY(Small Scene Mesh) PARAM_STRING(SceneName) PARAM_STRING(ObjectName) PARAM_INT(TriangleIndex) PARAM_INT(i1) PARAM_INT(i2) PARAM_INT(i3) PARAM_INT_OPT(MatIndex, 0),
|
|
"",
|
|
{
|
|
Mesh *M = SmallSceneGetMesh(SceneName,ObjectName);
|
|
if (M)
|
|
{
|
|
M->SetFace(TriangleIndex,i1,i2,i3, MatIndex);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(SCN_OptimizeMesh,
|
|
CATEGORY(Small Scene Mesh) PARAM_BOOL(Optim),
|
|
"if true , do not perform mesh optimization for nexts loaded mesh",
|
|
{
|
|
SkipFunctions &= ~SKIP_MESHOPTIM;
|
|
if (!Optim) SkipFunctions |= SKIP_MESHOPTIM;
|
|
})
|
|
DEFINE_SCRIPT(SCN_MeshGet,
|
|
CATEGORY(Small Scene Mesh) PARAM_STRING(SceneName) PARAM_STRING(ObjectName),
|
|
"return the whole mesh in a table !! TAKE CARE, CAN BE HUGE !!",
|
|
{
|
|
extern int PushMeshLua(WORLD *pScene,lua_State *L, char *SceneName,char *ObjectName);
|
|
returnDone++;
|
|
if (PushMeshLua(this , L, SceneName,ObjectName))
|
|
ComputeReturn(L, returnDone);
|
|
else
|
|
returnDone--;
|
|
})
|
|
|
|
DEFINE_SCRIPT(SCN_MeshVectorSet,
|
|
CATEGORY(Small Scene Mesh) PARAM_STRING(SceneName) PARAM_STRING(ObjectName) PARAM_INT(VectorIndex) PARAM_VECTOR(Coord) PARAM_VECTOR(UV) PARAM_VECTOR(Normale) ,
|
|
"",
|
|
{
|
|
Mesh *M = SmallSceneGetMesh(SceneName,ObjectName);
|
|
if (M)
|
|
{
|
|
M->SetVertex(VectorIndex,&Coord,&UV,&Normale);
|
|
}
|
|
})
|
|
/* MAX INTERFACE END ***************************************************************************************/
|
|
/* APP_DBG ....*/
|
|
DEFINE_SCRIPT(DEBUG_BreakPoint,
|
|
CATEGORY(DEBUG),
|
|
"Break the application, even in run mode",
|
|
{
|
|
void APP_BreakPoint(WORLD *psc, lua_State *L);
|
|
APP_BreakPoint(this, L);
|
|
})
|