Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ScriptHook DotNet
- int SFHandle = 0;
- int Scaleform(char *scaleformID)
- {
- SFHandle = REQUEST_SCALEFORM_MOVIE(scaleformID);
- }
- void SFDispose()
- {
- if (HAS_SCALEFORM_MOVIE_LOADED(SFHandle))
- {
- SET_SCALEFORM_MOVIE_AS_NO_LONGER_NEEDED(&SFHandle);
- }
- }
- template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> //class T, /class T1,
- void SFCallFunction(char *function, T P0, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 p7, T8 P8)
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION(Handle, function);
- for (int i = 0; i < 9; i++)
- {
- switch (i)
- {
- case 0:
- if (typeid(T) == typeid(int))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_INT((int)P0);
- }
- else if (typeid(T) == typeid(char))
- {
- }
- else if (typeid(T) == typeid(char*))
- {
- _BEGIN_TEXT_COMPONENT("STRING");
- ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME((char *)P0);
- _END_TEXT_COMPONENT();
- }
- else if (typeid(T) == typeid(float))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_FLOAT((float)P0);
- }
- else if (typeid(T) == typeid(double))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_FLOAT((float)(double)P0);
- }
- else if (typeid(T) == typeid(bool))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_BOOL((bool)P0);
- }
- break;
- case 1:
- if (typeid(T1) == typeid(int))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_INT((int)P1);
- }
- else if (typeid(T1) == typeid(char))
- {
- }
- else if (typeid(T1) == typeid(char*))
- {
- _BEGIN_TEXT_COMPONENT("STRING");
- ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME((char *)P1);
- _END_TEXT_COMPONENT();
- }
- else if (typeid(T1) == typeid(float))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_FLOAT((float)P1);
- }
- else if (typeid(T1) == typeid(double))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_FLOAT((float)(double)P1);
- }
- else if (typeid(T1) == typeid(bool))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_BOOL((bool)P1);
- }
- break;
- case 2:
- if (typeid(T2) == typeid(int))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_INT((int)P2);
- }
- else if (typeid(T2) == typeid(char))
- {
- }
- else if (typeid(T2) == typeid(char*))
- {
- _BEGIN_TEXT_COMPONENT("STRING");
- ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME((char *)P2);
- _END_TEXT_COMPONENT();
- }
- else if (typeid(T2) == typeid(float))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_FLOAT((float)P2);
- }
- else if (typeid(T2) == typeid(double))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_FLOAT((float)(double)P2);
- }
- else if (typeid(T2) == typeid(bool))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_BOOL((bool)P2);
- }
- break;
- case 3:
- if (typeid(T3) == typeid(int))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_INT((int)P3);
- }
- else if (typeid(T3) == typeid(char))
- {
- }
- else if (typeid(T3) == typeid(char*))
- {
- _BEGIN_TEXT_COMPONENT("STRING");
- ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME((char *)P3);
- _END_TEXT_COMPONENT();
- }
- else if (typeid(T3) == typeid(float))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_FLOAT((float)P3);
- }
- else if (typeid(T3) == typeid(double))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_FLOAT((float)(double)P3);
- }
- else if (typeid(T3) == typeid(bool))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_BOOL((bool)P3);
- }
- break;
- case 4:
- if (typeid(T4) == typeid(int))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_INT((int)P4);
- }
- else if (typeid(T4) == typeid(char))
- {
- }
- else if (typeid(T4) == typeid(char*))
- {
- _BEGIN_TEXT_COMPONENT("STRING");
- ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME((char *)P4);
- _END_TEXT_COMPONENT();
- }
- else if (typeid(T4) == typeid(float))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_FLOAT((float)P4);
- }
- else if (typeid(T4) == typeid(double))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_FLOAT((float)(double)P4);
- }
- else if (typeid(T4) == typeid(bool))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_BOOL((bool)P4);
- }
- break;
- case 5:
- if (typeid(T5) == typeid(int))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_INT((int)P5);
- }
- else if (typeid(T5) == typeid(char))
- {
- }
- else if (typeid(T5) == typeid(char*))
- {
- _BEGIN_TEXT_COMPONENT("STRING");
- ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME((char *)P5);
- _END_TEXT_COMPONENT();
- }
- else if (typeid(T5) == typeid(float))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_FLOAT((float)P5);
- }
- else if (typeid(T5) == typeid(double))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_FLOAT((float)(double)P5);
- }
- else if (typeid(T5) == typeid(bool))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_BOOL((bool)P5);
- }
- break;
- case 6:
- if (typeid(T6) == typeid(int))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_INT((int)P6);
- }
- else if (typeid(T6) == typeid(char))
- {
- }
- else if (typeid(T6) == typeid(char*))
- {
- _BEGIN_TEXT_COMPONENT("STRING");
- ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME((char *)P6);
- _END_TEXT_COMPONENT();
- }
- else if (typeid(T6) == typeid(float))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_FLOAT((float)P6);
- }
- else if (typeid(T6) == typeid(double))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_FLOAT((float)(double)P6);
- }
- else if (typeid(T6) == typeid(bool))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_BOOL((bool)P6);
- }
- break;
- case 7:
- if (typeid(T7) == typeid(int))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_INT((int)P7);
- }
- else if (typeid(T7) == typeid(char))
- {
- }
- else if (typeid(T7) == typeid(char*))
- {
- _BEGIN_TEXT_COMPONENT("STRING");
- ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME((char *)P7);
- _END_TEXT_COMPONENT();
- }
- else if (typeid(T7) == typeid(float))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_FLOAT((float)P7);
- }
- else if (typeid(T7) == typeid(double))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_FLOAT((float)(double)P7);
- }
- else if (typeid(T7) == typeid(bool))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_BOOL((bool)P7);
- }
- break;
- case 8:
- if (typeid(T8) == typeid(int))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_INT((int)P8);
- }
- else if (typeid(T8) == typeid(char))
- {
- }
- else if (typeid(T8) == typeid(char*))
- {
- _BEGIN_TEXT_COMPONENT("STRING");
- ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME((char *)P8);
- _END_TEXT_COMPONENT();
- }
- else if (typeid(T8) == typeid(float))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_FLOAT((float)P8);
- }
- else if (typeid(T8) == typeid(double))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_FLOAT((float)(double)P8);
- }
- else if (typeid(T8) == typeid(bool))
- {
- _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_BOOL((bool)P8);
- }
- break;
- default:
- printf("invalid...\n");
- break;
- }
- }
- return 0;
- _POP_SCALEFORM_MOVIE_FUNCTION_VOID();
- }
- void SFRender2D()
- {
- DRAW_SCALEFORM_MOVIE_FULLSCREEN(SFHandle, 255, 255, 255, 255);
- }
- void SFRender2DScreenSpace(PointF location, PointF size)
- {
- static const int _WIDTH = 1280;
- static const int _HEIGHT = 720;
- float X = location.x / _WIDTH;
- float Y = location.y / _HEIGHT;
- float width = size.x / _WIDTH;
- float height = size.y / _HEIGHT;
- DRAW_SCALEFORM_MOVIE(SFHandle, X + (width / 2.0f), Y + (height / 2.0f), width, height, 255, 255, 255, 255);
- }
- void SFRender3D(Vector3 position, Vector3 rotation, Vector3 scale)
- {
- _DRAW_SCALEFORM_MOVIE_3D_NON_ADDITIVE(SFHandle, position.x, position.y, position.z, rotation.x, rotation.y, rotation.z, 2.0f, 2.0f, 1.0f, scale.x, scale.y, scale.z, 2);
- }
- void SFRender3DAdditive(Vector3 position, Vector3 rotation, Vector3 scale)
- {
- DRAW_SCALEFORM_MOVIE_3D(SFHandle, position.x, position.y, position.z, rotation.x, rotation.y, rotation.z, 2.0f, 2.0f, 1.0f, scale.x, scale.y, scale.z, 2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement