Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <cstdio>
- #include <stdlib.h>
- #include <time.h>
- #include <math.h>
- #include <Windows.h>
- #include <Xinput.h>
- using namespace std;
- #define KEY_PRESSED_MASK 0x1
- #define KEY_DOWN_MASK 0x8000
- #define REPLACED_CODE_SIZE 4
- #define PI 3.14159265
- #define TAU 6.28318530718
- #define distance(a, b, c) sqrt(a*a + b*b + c*c)
- #define distance2d(a, b) sqrt(a*a + b*b)
- void init();
- void hook();
- void hack();
- void unload();
- long messageDisplayTime = 0;
- wchar_t * message = (wchar_t*)0x0078B600;
- void gameMessage(long displayTime, const wchar_t * format, ...);
- void scrnprintf(int x, int y, bool shadow, const char * format, ...);
- void copy(LPVOID source, LPVOID dest, int count);
- void(*gameUpdate)() = (void(*)()) 0x004A42D0;
- unsigned int originalGameUpdateCall = 0x004A5C70 + 0x01;
- BYTE originalGameUpdateFunctionAddress[4];
- float vectorDistance3d(float x, float y, float z);
- float vectorDistance2d(float x, float y);
- RECT rect;
- HDC canvas;
- HWND window = 0;
- HFONT arial;
- HINSTANCE hDLL = NULL;
- DWORD oldAccess;
- BOOL WINAPI DllMain(
- HINSTANCE hinstDLL,
- DWORD fdwReason,
- LPVOID lpvReserved
- )
- {
- if (fdwReason == DLL_PROCESS_ATTACH)
- {
- hDLL = hinstDLL;
- //DisableThreadLibraryCalls(hDLL);
- //CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)hack, 0, NULL, NULL);
- unsigned int pHook = (unsigned int)&hook - originalGameUpdateCall - 0x04;
- DWORD old;
- unsigned char data[] = { 0, 0, 0, 0 };
- copy((LPVOID)&pHook, (LPVOID)data, sizeof(data));
- VirtualProtect((LPVOID)originalGameUpdateCall, sizeof(data), PAGE_EXECUTE_READWRITE, &old);
- copy((LPVOID)&originalGameUpdateCall, (LPVOID)originalGameUpdateFunctionAddress, sizeof(originalGameUpdateFunctionAddress));
- copy((LPVOID)data, (LPVOID)originalGameUpdateCall, sizeof(data));
- VirtualProtect((LPVOID)originalGameUpdateCall, sizeof(data), old, &old);
- }
- else if (fdwReason == DLL_PROCESS_DETACH)
- {
- }
- return TRUE;
- }
- void hook() {
- gameUpdate();
- hack();
- }
- bool initiated = false;
- int frames;
- long start;
- void init()
- {
- window = FindWindow(NULL, L"GTA: Vice City");
- //MessageBox(NULL, L"Success!", L"GTA: Vice City", MB_OK);
- VirtualProtect((LPVOID)0, 0x80000000, PAGE_EXECUTE_READWRITE, &oldAccess);
- LoadLibrary(L"XINPUT1_4.dll");
- initiated = true;
- start = GetTickCount64();
- srand(time(NULL));
- frames = 0;
- }
- void teleportEntity(unsigned int target, float x, float y, float z)
- {
- *(float*)(target + 0x34) = x;
- *(float*)(target + 0x38) = y;
- *(float*)(target + 0x3C) = z;
- //Reset all velocities (no coming in hot!)
- *(float*)(target + 0x70) = 0.0f;
- *(float*)(target + 0x74) = 0.0f;
- *(float*)(target + 0x78) = 0.0f;
- *(float*)(target + 0x7C) = 0.0f;
- *(float*)(target + 0x80) = 0.0f;
- *(float*)(target + 0x84) = 0.0f;
- }
- bool isValidID(unsigned short id) {
- return id > 0 && id != 0xFFFF;
- }
- bool isEntityCar(unsigned int id)
- {
- return id >= 0x5A && id <= 0x93;
- }
- bool isEntityPed(unsigned int id)
- {
- return id > 0x00 && id < 0x5A;
- }
- bool quit = false;
- bool hovercar = false;
- unsigned int lasttouch = 0;
- unsigned int enemies[] = { 0x01, 0x02, 0x03, 0x74, 0x75, 0x6B, 0x7B };
- bool enemyIsCar[] = { false, false, false, true, true, true };
- unsigned int weaponIDs[] = { 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x09, 0x0B, 0x08 }; //-0x0c
- unsigned int weaponAmmoOffsets[] = { 0x398, 0x3B0, 0x3C8, 0x3E0, 0x3F8, 0x410, 0x440, 0x470, 0x428 };
- unsigned int lowestCarAddress = 0xFFFFFFFF, highestCarAddress = 0x00000000;
- unsigned int lowestPedAddress = 0xFFFFFFFF, highestPedAddress = 0x00000000;
- WORD previousButtonState = 0;
- float leftStickX = 0.0f, leftStickY = 0.0f;
- float rightStickX = 0.0f, rightStickY = 0.0f;
- long bombTimer = MAXLONG;
- unsigned int bombTarget = 0;
- unsigned int lastCar = 0;
- void getStickInputs(XINPUT_STATE state)
- {
- float LX = state.Gamepad.sThumbLX;
- float LY = state.Gamepad.sThumbLY;
- //determine how far the controller is pushed
- float magnitude = sqrt(LX*LX + LY*LY);
- //determine the direction the controller is pushed
- float normalizedLX = LX / magnitude;
- float normalizedLY = LY / magnitude;
- float normalizedMagnitude = 0;
- //check if the controller is outside a circular dead zone
- if (magnitude > XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE)
- {
- //clip the magnitude at its expected maximum value
- if (magnitude > 32767) magnitude = 32767;
- //adjust magnitude relative to the end of the dead zone
- magnitude -= XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE;
- //optionally normalize the magnitude with respect to its expected range
- //giving a magnitude value of 0.0 to 1.0
- normalizedMagnitude = magnitude / (32767 - XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE);
- }
- else //if the controller is in the deadzone zero out the magnitude
- {
- magnitude = 0.0;
- normalizedMagnitude = 0.0;
- }
- }
- /* VICE CITY
- *************
- ~~~* PEDESTRIANS *~~~
- *************
- struct size 0x5A0 probably wrong
- 0x04 Right Vector
- 0x14 Forward Vector
- 0x24 Up Vector
- 0x108 pointer to touched item
- 0x354 Health
- 0x358 Armor
- **********
- ~~~* VEHICLES *~~~
- **********
- 0x04 Right Vector
- 0x14 Forward Vector
- 0x24 Up Vector
- 0x70 Velocity vector
- 0x7C Rotational velocity vector
- 0xB4 Mass
- 0x204 Health
- 0x4A4 wheels on ground
- */
- float maxVelocity = 2.0f;
- float acceleration = 0.1f;
- float friction = 0.1f;
- float forwardForce = 1.0f - friction;
- float gravity = 0.0f;
- float spin = 0.0f;
- float gravitySwap = 0.0f;
- long puntTimer = 0;
- unsigned char puntState = 0;
- float snapx, snapy, snapz;
- float snapvx, snapvy, snapvz;
- float snaprvx, snaprvy, snaprvz;
- float snapMass;
- float revertx, reverty, revertz;
- bool driveOnWalls = false;
- void hack()
- {
- if (!initiated)
- init();
- if (GetAsyncKeyState(VK_DELETE) & KEY_PRESSED_MASK) //CreateThread(0, 0, (LPTHREAD_START_ROUTINE)unload, 0, 0, 0);
- {
- CreateThread(0, 0, (LPTHREAD_START_ROUTINE)unload, 0, 0, 0);
- return;
- }
- unsigned int pplayer = *(unsigned int*)(0x00949D30); //0x7E3B94, 0x949D30, 0x78E864
- unsigned int pcar = 0;
- if (pplayer)
- pcar = *(unsigned int*)(0x009B5A88);
- unsigned int pobj = pcar ? pcar : pplayer;
- XINPUT_STATE state;
- ZeroMemory(&state, sizeof(XINPUT_STATE));
- bool gamepad = XInputGetState(0, &state) == ERROR_SUCCESS;
- WORD buttonsHeld = state.Gamepad.wButtons;
- WORD buttonsPressed = (~previousButtonState) & state.Gamepad.wButtons;
- WORD buttonsReleased = previousButtonState & (~state.Gamepad.wButtons);
- if (pplayer)
- {
- *(float*)(pplayer + 0x354) = 500.0f + (rand() % 100); //player health
- *(float*)(pplayer + 0x358) = 500.0f + (rand() % 100); //player armor
- if (!pcar)
- {
- if (gamepad)
- {
- if (buttonsHeld & XINPUT_GAMEPAD_X)
- {
- *(float*)(pplayer + 0x70) = *(float*)(pplayer + 0x14) * 0.2f;
- *(float*)(pplayer + 0x74) = *(float*)(pplayer + 0x18) * 0.2f;
- *(float*)(pplayer + 0x78) = 0.2f;
- }
- }
- else if (GetAsyncKeyState(VK_SPACE) & KEY_DOWN_MASK)
- {
- *(float*)(pplayer + 0x70) = *(float*)(pplayer + 0x14) * 0.2f;
- *(float*)(pplayer + 0x74) = *(float*)(pplayer + 0x18) * 0.2f;
- *(float*)(pplayer + 0x78) = 0.2f;
- }
- }
- //Toggle gravity
- if (GetAsyncKeyState(VK_NUMPAD2) & KEY_PRESSED_MASK) {
- float g = *(float*)0x0068E5F8; //0.00800000038
- *(float*)0x0068E5F8 = gravitySwap;
- gravitySwap = g;
- }
- }
- if (pcar)
- {
- if (pcar != lastCar)
- {
- //Undo invincibility if a new car is entered
- if (lastCar) {
- *(unsigned char*)(lastCar + 0x53) &= 0xF0;
- if (*(unsigned char*)(lastCar + 0x52) & 0x10)
- *(unsigned char*)(lastCar + 0x52) &= ~0x10;
- }
- }
- if (*(unsigned int*)(pcar + 0x4A4) && *(unsigned int*)(pcar + 0x4A8) && *(unsigned int*)(pcar + 0x4AC) && *(unsigned int*)(pcar + 0x4B0)) {
- revertx = *(float*)(pcar + 0x34); reverty = *(float*)(pcar + 0x38); revertz = *(float*)(pcar + 0x3C);
- }
- if (*(unsigned char*)(pcar + 0x54) & 0x04)
- {
- //Teleport car back to land
- *(float*)(pcar + 0x34) = revertx; *(float*)(pcar + 0x38) = reverty; *(float*)(pcar + 0x3C) = revertz;
- float fvx = *(float*)(pcar + 0x14); float fvy = *(float*)(pcar + 0x18);
- float fvd = distance(fvx, fvy, *(float*)(pcar + 0x1C));
- fvx /= fvd; fvy /= fvd;
- //Reset rotational matrix
- *(float*)(pcar + 0x04) = fvy; *(float*)(pcar + 0x08) = -fvx; *(float*)(pcar + 0x0C) = 0.0f;
- *(float*)(pcar + 0x14) = fvx; *(float*)(pcar + 0x18) = fvy; *(float*)(pcar + 0x1C) = 0.0f;
- *(float*)(pcar + 0x24) = 0.0f; *(float*)(pcar + 0x28) = 0; *(float*)(pcar + 0x2C) = 1.0f;
- //Reset velocities
- *(float*)(pcar + 0x70) = 0.0f; *(float*)(pcar + 0x74) = 0.0f; *(float*)(pcar + 0x78) = 0.0f;
- //Reset rotational velocities
- *(float*)(pcar + 0x7C) = 0.0f; *(float*)(pcar + 0x80) = 0.0f; *(float*)(pcar + 0x84) = 0.0f;
- }
- *(unsigned char*)(pcar + 0x53) |= 0x0F; //everything but rhino proof
- if (GetAsyncKeyState(VK_NUMPAD1) & KEY_PRESSED_MASK) //rhino proof toggle on Numpad 1 pressed
- *(unsigned char*)(pcar + 0x52) ^= 0x10;
- *(float*)(pcar + 0x204) = 10000.0f; //infinite health
- if (gamepad)
- {
- if (buttonsPressed & XINPUT_GAMEPAD_DPAD_DOWN)
- hovercar = !hovercar;
- if (hovercar)
- {
- float leftStickX = 0.0f, leftStickY = 0.0f;
- float rightStickX = 0.0f, rightStickY = 0.0f;
- if (abs(state.Gamepad.sThumbLX) > XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE)
- leftStickX = state.Gamepad.sThumbLX / (float)(32767 - XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE);
- if (abs(state.Gamepad.sThumbLY) > XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE)
- leftStickY = state.Gamepad.sThumbLY / (float)(32767 - XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE);
- if (abs(state.Gamepad.sThumbRX) > XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE)
- rightStickX = state.Gamepad.sThumbRX / (float)(32767 - XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE);
- if (abs(state.Gamepad.sThumbRY) > XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE)
- rightStickY = state.Gamepad.sThumbRY / (float)(32767 - XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE);
- float rx = *(float*)(pcar + 0x14);
- float ry = *(float*)(pcar + 0x18);
- float rv = sqrt(rx*rx + ry*ry);
- rx /= rv;
- ry /= rv;
- *(float*)(pcar + 0x14) = rx;
- *(float*)(pcar + 0x18) = ry;
- *(float*)(pcar + 0x1C) = 0.0f;
- *(float*)(pcar + 0x04) = ry; //cos(rot)
- *(float*)(pcar + 0x08) = -rx; //-sin(rot)
- *(float*)(pcar + 0x0C) = 0.0f;
- *(float*)(pcar + 0x24) = 0.0f;
- *(float*)(pcar + 0x28) = 0.0f;
- *(float*)(pcar + 0x2C) = 1.0f;
- *(float*)(pcar + 0x7C) = 0;
- *(float*)(pcar + 0x80) = 0;
- *(float*)(pcar + 0x84) = 0;
- if (buttonsHeld & XINPUT_GAMEPAD_A) {
- float vx = *(float*)(pcar + 0x70);
- float vy = *(float*)(pcar + 0x74);
- float v = vectorDistance2d(vx, vy);
- v = min(v, maxVelocity);
- *(float*)(pcar + 0x70) = *(float*)(pcar + 0x14) * v * forwardForce + *(float*)(pcar + 0x70) * friction + *(float*)(pcar + 0x14) * acceleration;
- *(float*)(pcar + 0x74) = *(float*)(pcar + 0x18) * v * forwardForce + *(float*)(pcar + 0x74) * friction + *(float*)(pcar + 0x18) * acceleration;
- }
- else if (buttonsHeld & XINPUT_GAMEPAD_X) {
- *(float*)(pcar + 0x70) = *(float*)(pcar + 0x14) * -0.8f;
- *(float*)(pcar + 0x74) = *(float*)(pcar + 0x18) * -0.8f;
- }
- else {
- *(float*)(pcar + 0x70) *= 0.9f;
- *(float*)(pcar + 0x74) *= 0.9f;
- }
- if (leftStickY != 0.0f)
- *(float*)(pcar + 0x78) = 0.4f * leftStickY; //-0.04 gravity
- else
- *(float*)(pcar + 0x78) = 0.00800000038f;
- *(float*)(pcar + 0x84) = 0.05f * -leftStickX; //5c3610
- }
- }
- else {
- if (GetAsyncKeyState(VK_SPACE) & KEY_DOWN_MASK)
- {
- *(float*)(pcar + 0x78) = 0.2f; //float up
- *(float*)(pcar + 0x7C) = 0.0f; //lock rotation
- *(float*)(pcar + 0x80) = 0.0f;
- *(float*)(pcar + 0x84) = 0.0f;
- }
- /* PUNT!! */
- if (GetAsyncKeyState(VK_NUMPAD8) & KEY_PRESSED_MASK && !puntState) {
- snapx = *(float*)(pcar + 0x34); snapy = *(float*)(pcar + 0x38); snapz = *(float*)(pcar + 0x3C);
- snapvx = *(float*)(pcar + 0x70); snapvy = *(float*)(pcar + 0x74); snapvz = *(float*)(pcar + 0x78);
- snaprvx = *(float*)(pcar + 0x7C); snaprvy = *(float*)(pcar + 0x80); snaprvz = *(float*)(pcar + 0x84);
- *(float*)(pcar + 0x70) += *(float*)(pcar + 0x14) * 5.0f;
- *(float*)(pcar + 0x74) += *(float*)(pcar + 0x18) * 5.0f;
- *(float*)(pcar + 0x78) += *(float*)(pcar + 0x1C) * 5.0f;
- *(float*)(pcar + 0xB4) *= 10;
- puntState = 1;
- }
- else if (puntState) {
- *(float*)(pcar + 0x34) = snapx + 2 * snapvx; *(float*)(pcar + 0x38) = snapy + 2 * snapvy; *(float*)(pcar + 0x3C) = snapz + 2 * snapvz;
- *(float*)(pcar + 0x70) = snapvx; *(float*)(pcar + 0x74) = snapvy; *(float*)(pcar + 0x78) = snapvz;
- *(float*)(pcar + 0x7C) = snaprvx; *(float*)(pcar + 0x80) = snaprvy; *(float*)(pcar + 0x84) = snaprvz;
- *(float*)(pcar + 0xB4) /= 10;
- puntState = 0;
- }
- if (GetAsyncKeyState(VK_NUMPAD0) & KEY_PRESSED_MASK)
- hovercar = !hovercar;
- if (hovercar)
- {
- float rx = *(float*)(pcar + 0x14);
- float ry = *(float*)(pcar + 0x18);
- float rv = sqrt(rx*rx + ry*ry);
- rx /= rv;
- ry /= rv;
- *(float*)(pcar + 0x14) = rx;
- *(float*)(pcar + 0x18) = ry;
- *(float*)(pcar + 0x1C) = 0.0f;
- *(float*)(pcar + 0x04) = ry; //cos(rot)
- *(float*)(pcar + 0x08) = -rx; //-sin(rot)
- *(float*)(pcar + 0x0C) = 0.0f;
- *(float*)(pcar + 0x24) = 0.0f;
- *(float*)(pcar + 0x28) = 0.0f;
- *(float*)(pcar + 0x2C) = 1.0f;
- *(float*)(pcar + 0x7C) = 0;
- *(float*)(pcar + 0x80) = 0;
- *(float*)(pcar + 0x84) = 0;
- if (GetAsyncKeyState('W') & KEY_DOWN_MASK) {
- float vx = *(float*)(pcar + 0x70);
- float vy = *(float*)(pcar + 0x74);
- float v = vectorDistance2d(vx, vy);
- v = min(v, maxVelocity);
- *(float*)(pcar + 0x70) = *(float*)(pcar + 0x14) * v * forwardForce + *(float*)(pcar + 0x70) * friction + *(float*)(pcar + 0x14) * acceleration;
- *(float*)(pcar + 0x74) = *(float*)(pcar + 0x18) * v * forwardForce + *(float*)(pcar + 0x74) * friction + *(float*)(pcar + 0x18) * acceleration;
- }
- else if (GetAsyncKeyState('S') & KEY_DOWN_MASK) {
- *(float*)(pcar + 0x70) = *(float*)(pcar + 0x14) * -0.8f;
- *(float*)(pcar + 0x74) = *(float*)(pcar + 0x18) * -0.8f;
- }
- else {
- *(float*)(pcar + 0x70) *= 0.9f;
- *(float*)(pcar + 0x74) *= 0.9f;
- }
- //Up and Down
- if (GetAsyncKeyState(VK_SPACE) & KEY_DOWN_MASK)
- *(float*)(pcar + 0x78) = 0.8f;
- else if (GetAsyncKeyState(VK_LCONTROL) & KEY_DOWN_MASK)
- *(float*)(pcar + 0x78) = -0.8f;
- else
- *(float*)(pcar + 0x78) = 0.0f;
- //Turning
- if (GetAsyncKeyState('A') & KEY_DOWN_MASK)
- *(float*)(pcar + 0x84) = 0.06f;
- else if(GetAsyncKeyState('D') & KEY_DOWN_MASK)
- *(float*)(pcar + 0x84) = -0.06f;
- }
- }
- if (GetAsyncKeyState(VK_NUMPAD3) & KEY_PRESSED_MASK) {
- driveOnWalls = !driveOnWalls;
- gameMessage(2000, L"Drive on walls %s", driveOnWalls ? L"ON":L"OFF");
- }
- if (driveOnWalls)
- {
- float g = *(float*)0x0068E5F8;
- *(float*)(pcar + 0x70) -= *(float*)(pcar + 0x24) * 0.00800000038;
- *(float*)(pcar + 0x74) -= *(float*)(pcar + 0x28) * 0.00800000038;
- *(float*)(pcar + 0x78) -= *(float*)(pcar + 0x2C) * 0.00800000038;
- *(float*)(pcar + 0x78) += g;
- }
- else {
- //auto flip
- if (*(float*)(pcar + 0x2C) < -0.2f) {
- if (*(float*)(pcar + 0x80) > 0)
- *(float*)(pcar + 0x80) = 0.05f;
- else
- *(float*)(pcar + 0x80) = -0.05f;
- }
- }
- lastCar = pcar;
- }
- if (pobj)
- {
- if (GetAsyncKeyState('7') & KEY_DOWN_MASK)
- teleportEntity(pobj, -1012.68f, -892.03f, 12.72f);
- unsigned int ptouch = *(unsigned int*)(pobj + 0x108);
- if (ptouch)
- gameMessage(200, L"0x%08X", ptouch);
- if (GetTickCount64() < messageDisplayTime) {
- *(unsigned int*)(0x0094CBD4) = 0x00000008;
- }
- else if (messageDisplayTime) {
- messageDisplayTime = 0;
- *(unsigned int*)(0x0094CBD4) = 0x00000000;
- wcscpy(message, L"");
- }
- /*canvas = GetDC(window);
- arial = CreateFont(16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_OUTLINE_PRECIS,
- CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY, VARIABLE_PITCH, TEXT("Arial"));
- SelectObject(canvas, arial);
- SetBkMode(canvas, TRANSPARENT);
- SetTextColor(canvas, RGB(255, 0, 140));
- scrnprintf(10, 26, true, "FPS %00.0f", frames / (float)((GetTickCount64() - start) / 1000));
- DeleteObject(arial);
- ReleaseDC(window, canvas);*/
- }
- previousButtonState = state.Gamepad.wButtons;
- frames++;
- }
- void unload()
- {
- //Undo the function call:
- /*DWORD old;
- VirtualProtect((LPVOID)0x007f9a01, 6, PAGE_EXECUTE_READWRITE, &old);
- copy((LPVOID)d3dCode, (LPVOID)0x007f9a01, 6);
- VirtualProtect((LPVOID)0x007f9a01, 6, old, &old);*/
- //Unload the DLL and kill the thread
- copy((LPVOID)originalGameUpdateFunctionAddress, (LPVOID)originalGameUpdateCall, sizeof(originalGameUpdateFunctionAddress));
- HMODULE h;
- GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, L"VCDevice.dll", &h);
- FreeLibraryAndExitThread(hDLL, 0);
- }
- void gameMessage(long displayTime, const wchar_t * format, ...) {
- wchar_t buffer[256];
- va_list args;
- va_start(args, format);
- vswprintf(buffer, 256, format, args);
- va_end(args);
- wcscpy(message, buffer);
- messageDisplayTime = GetTickCount64() + displayTime;
- }
- void scrnprintf(int x, int y, bool shadow, const char * format, ...)
- {
- if (!canvas)
- return;
- char buffer[256];
- va_list args;
- va_start(args, format);
- int count = vsprintf(buffer, format, args);
- va_end(args);
- rect.left = x;
- rect.top = y;
- rect.right = x + 800;
- rect.bottom = y + 20;
- if (shadow)
- {
- COLORREF color = GetTextColor(canvas);
- SetTextColor(canvas, (COLORREF)0);
- rect.left++;
- rect.top++;
- DrawTextA(canvas, buffer, count, &rect, DT_TOP | DT_LEFT);
- rect.left--;
- rect.top--;
- SetTextColor(canvas, color);
- }
- DrawTextA(canvas, buffer, count, &rect, DT_TOP | DT_LEFT);
- }
- void copy(LPVOID source, LPVOID dest, int count)
- {
- __asm
- {
- push ecx
- push edi
- push esi
- mov ecx, count
- mov esi, source
- mov edi, dest
- repe movsb
- pop esi
- pop edi
- pop ecx
- }
- }
- float vectorDistance3d(float x, float y, float z)
- {
- return sqrt(x*x + y*y + z*z);
- }
- float vectorDistance2d(float x, float y)
- {
- return sqrt(x*x + y*y);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement