예제 #1
0
        static unsafe void DrawRect(float x, float y, int width, int height, Color color)
        {
            float w    = (float)(width) / BASE_WIDTH;
            float h    = (float)(height) / BASE_HEIGHT;
            float xNew = (x / BASE_WIDTH) + w * 0.5f;
            float yNew = (y / BASE_HEIGHT) + h * 0.5f;

            NativeFunc.Invoke(0x3A618A217E5154F0ul /*DRAW_RECT*/, *(ulong *)&xNew, *(ulong *)&yNew, *(ulong *)&w, *(ulong *)&h, (ulong)color.R, (ulong)color.G, (ulong)color.B, (ulong)color.A);
        }
예제 #2
0
        static unsafe void DisableControlsThisFrame()
        {
            NativeFunc.Invoke(0x5F4B6931816E599Bul /*DISABLE_ALL_CONTROL_ACTIONS*/, 0ul);

            // LookLeftRight .. LookRightOnly
            for (int i = 1; i <= 6; i++)
            {
                NativeFunc.Invoke(0x351220255D64C155ul /*ENABLE_CONTROL_ACTION*/, 0ul, (ulong)i, 0ul);
            }
        }
예제 #3
0
        public static void Call(Hash hash, params InputArgument[] arguments)
        {
            ulong[] args = new ulong[arguments.Length];
            for (int i = 0; i < arguments.Length; ++i)
            {
                args[i] = arguments[i].data;
            }

            var task = new SHVDN.NativeFunc((ulong)hash, args);

            SHVDN.ScriptDomain.CurrentDomain.ExecuteTask(task);
        }
예제 #4
0
        static unsafe void DrawText(float x, float y, string text, Color color)
        {
            float xNew = (x / BASE_WIDTH);
            float yNew = (y / BASE_HEIGHT);

            NativeFunc.Invoke(0x66E0276CC5F6B9DAul /*SET_TEXT_FONT*/, 0ul);             // Chalet London :>
            NativeFunc.Invoke(0x07C837F9A01C34C9ul /*SET_TEXT_SCALE*/, 0x3eb33333ul /*0.35f*/, 0x3eb33333ul /*0.35f*/);
            NativeFunc.Invoke(0xBE6B23FFA53FB442ul /*SET_TEXT_COLOUR*/, (ulong)color.R, (ulong)color.G, (ulong)color.B, (ulong)color.A);
            NativeFunc.Invoke(0x25FBB336DF1804CBul /*BEGIN_TEXT_COMMAND_DISPLAY_TEXT*/, (ulong)NativeMemory.CellEmailBcon.ToInt64());
            PushLongString(text);
            NativeFunc.Invoke(0xCD015E5BB0D96A57ul /*END_TEXT_COMMAND_DISPLAY_TEXT*/, *(ulong *)&xNew, *(ulong *)&yNew);
        }
예제 #5
0
        static unsafe void PushLongString(string str)
        {
            int size = System.Text.Encoding.UTF8.GetByteCount(str);

            if (size <= 99)
            {
                NativeFunc.Invoke(0x6C188BE134E074AAul /*ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME*/,
                                  (ulong)ScriptDomain.CurrentDomain.PinString(str).ToInt64());
                return;
            }

            int startPos             = 0;
            int currentUtf8StrLength = 0;

            for (int currentPos = 0; currentPos < str.Length; currentPos++)
            {
                int codePointSize = GetUtf8CodePointSize(str, currentPos);

                if (currentUtf8StrLength + codePointSize > 99)
                {
                    NativeFunc.Invoke(0x6C188BE134E074AAul /*ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME*/,
                                      (ulong)ScriptDomain.CurrentDomain.PinString(str.Substring(startPos, currentPos - startPos)).ToInt64());

                    currentUtf8StrLength = 0;
                    startPos             = currentPos;
                }
                else
                {
                    currentUtf8StrLength += codePointSize;
                }

                if (codePointSize == 4)
                {
                    currentPos++;                     // If the code point size is 4, additional increment is needed
                }
            }

            NativeFunc.Invoke(0x6C188BE134E074AAul /*ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME*/,
                              (ulong)ScriptDomain.CurrentDomain.PinString(str.Substring(startPos, str.Length - startPos)).ToInt64());
        }