Skip to content

Commit

Permalink
Merge pull request #37 from izawartka/development
Browse files Browse the repository at this point in the history
1.15.2
  • Loading branch information
izawartka authored Feb 21, 2023
2 parents 45fb51b + df0bbbe commit a1a7eae
Show file tree
Hide file tree
Showing 13 changed files with 498 additions and 432 deletions.
17 changes: 10 additions & 7 deletions ACSWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ float ACSWindow::GetFloatFromCEditVal(CEdit* element)

void ACSWindow::ExecuteACS()
{
int model = m_mainWindow->carids[m_model.GetCurSel()];
if (m_model.GetCurSel() < 0) return;
unsigned int model = cars[m_model.GetCurSel()].id;
int xPos = GetFloatFromCEditVal(&m_xPos) * 16384.0f;
int yPos = GetFloatFromCEditVal(&m_yPos) * 16384.0f;
int zPos = GetFloatFromCEditVal(&m_zPos) * 16384.0f;
Expand All @@ -62,6 +63,8 @@ void ACSWindow::ExecuteACS()
int ySize = GetFloatFromCEditVal(&m_ySize);
int xOffset = GetFloatFromCEditVal(&m_xOffset) * 16384.0f;
int yOffset = GetFloatFromCEditVal(&m_yOffset) * 16384.0f;
int vColors = ((CButton*)GetDlgItem(IDC_ACS_VCOLORS))->GetCheck();
short color = vColors == true ? -2 : -1;

for (int x = 0; x < xSize; x++)
{
Expand All @@ -72,7 +75,7 @@ void ACSWindow::ExecuteACS()
int targetX = xPos + x * xOffset;
int targetY = yPos + y * yOffset;

m_mainWindow->wtsCar[m_mainWindow->wtsCarSize] = WantToSpawn(targetX, targetY, zPos, rot, model);
m_mainWindow->wtsCar[m_mainWindow->wtsCarSize] = WantToSpawn{ targetX, targetY, zPos, rot, model, color };
m_mainWindow->wtsCarSize++;
}
}
Expand All @@ -91,8 +94,11 @@ void ACSWindow::ClearValues()
m_xOffset.SetWindowTextW(L"1");
m_yOffset.SetWindowTextW(L"1");
m_model.ResetContent();
for (int i = 0; i < 80; i++)
m_model.AddString(m_mainWindow->carnames[i]);
int carsCount = sizeof(cars) / sizeof(cars[0]);
for (int i = 0; i < carsCount; i++)
m_model.AddString(cars[i].name);

GetPlayerPos();
}

void ACSWindow::GetPlayerPos()
Expand All @@ -117,7 +123,4 @@ void ACSWindow::GetPlayerPos()

swprintf(buf, 256, L"%f", playerPed->gameObject->sprite->z / 16384.0f);
m_zPos.SetWindowTextW(buf);

swprintf(buf, 256, L"%i", playerPed->gameObject->sprite->rotation/4);
m_rot.SetWindowTextW(buf);
}
373 changes: 88 additions & 285 deletions MainWindow.cpp

Large diffs are not rendered by default.

208 changes: 116 additions & 92 deletions MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// MainWindow dialog
#include "gta2-helper.h"
#include "ACSWindow.h"
#include "WantToSpawn.h"

enum TIMER {
TIMER_CAPTURE_MOUSE,
Expand All @@ -14,10 +13,6 @@ class MainWindow : public CDialogEx
{
DECLARE_DYNAMIC(MainWindow)

public:
MainWindow(CWnd* pParent = nullptr); // standard constructor
virtual ~MainWindow();

// Dialog Data
#ifdef AFX_DESIGN_TIME
enum { IDD = IDD_DIALOG1 };
Expand All @@ -28,53 +23,33 @@ class MainWindow : public CDialogEx

DECLARE_MESSAGE_MAP()
public:
afx_msg void OnBnClickedExit();

afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
// consts //

ACSWindow* m_acsWindow;
const int emblemValues[9] = { 0, 294, 295, 296, 297, 298, 299, 300, 8 };

const wchar_t* emblemNames[9] = { L"None", L"Loonies", L"Yakuza", L"Zaibatsu", L"Rednecks", L"Scientists", L"Krishna", L"Russians", L"Bomb" };

LPCTSTR carnames[80] = { L"ALFA", L"ALLARD", L"AMDB4", L"APC", L"BANKVAN", L"BMW", L"BOXCAR", L"BOXTRUCK",
L"BUG", L"BUICK", L"BUS", L"COPCAR", L"DART", L"EDSEL", L"EDSELFBI", L"FIAT", L"FIRETRUK",
L"GRAHAM", L"GT24640", L"GTRUCK", L"GUNJEEP", L"HOTDOG", L"HOTDOG_D1",
L"HOTDOG_D2", L"HOTDOG_D3", L"HOTDOG_D4", L"ICECREAM", L"ISETLIMO", L"ISETTA", L"JEEP", L"JEFFREY", L"KRSNABUS",
L"LIMO", L"LIMO2", L"MEDICAR", L"MERC", L"MESSER", L"MIURA", L"MONSTER", L"MORGAN", L"MORRIS",
L"PICKUP", L"RTYPE", L"SPIDER", L"SPRITE", L"STINGRAY", L"STRATOS",
L"STRATOSB", L"STRIPETB", L"STYPE", L"STYPECAB", L"SWATVAN", L"T2000GT", L"TANK",
L"TANKER", L"TAXI", L"TBIRD", L"TOWTRUCK", /*L"TRAIN", L"TRAINCAB", L"TRAINFB",*/ L"TRANCEAM",
L"TRUKCAB1", L"TRUKCAB2", L"TRUKCONT", L"TRUKTRNS", L"TVVAN", L"VAN", L"VESPA", L"VTYPE",
L"WBTWIN", L"WRECK0", L"WRECK1", L"WRECK2", L"WRECK3", L"WRECK4", L"WRECK5",
L"WRECK6", L"WRECK7", L"WRECK8", L"WRECK9", L"XK120", L"ZCX5" };
// technical //
MainWindow(CWnd* pParent = nullptr); // standard constructor
virtual ~MainWindow();
bool firstPaint;
uint frames;
HWND m_gtaWindow;
ACSWindow* m_acsWindow;

int carids[80] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 84, 16, 17, 18, 19, 21, 22, 23,
24, 25, 26, 85, 27, 28, 29, 30, 31, 86, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48,
49, 50, 51, 52, 53, 54, 55, 56, 57, 58, /*59, 60, 61,*/ 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
74, 75, 76, 77, 78, 79, 80, 81, 82, 83 };
void OnPaint();
afx_msg void OnBnClickedExit();
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
void log(const WCHAR* fmt, ...);
afx_msg void OnHotKey(UINT nHotKeyId, UINT nKey1, UINT nKey2);
afx_msg void OnCommandsHello();

// UI //
HMENU ncHMenu;
HMENU oHMenu;
HMENU nHMenu;
bool firstPaint;
HWND m_gtaWindow;
void OnPaint();
void log(const WCHAR* fmt, ...);
CEdit m_log;
afx_msg void OnCommandsHello();
afx_msg void MouseControl();
bool captureMouse = 0;
void CaptureMouse();
afx_msg void OnSpawncarTank();
afx_msg void OnHotKey(UINT nHotKeyId, UINT nKey1, UINT nKey2);
afx_msg void OnSpawnCarClick(UINT nID);
afx_msg void OnSpawnObjectClick(UINT nID);
afx_msg void OnSpawnLastObjectClick();
afx_msg void OnGetWeaponClick(UINT nID);
afx_msg void OnGetCarWeaponClick(UINT nID);
afx_msg void OnPlayVocalClick(UINT nID);
afx_msg void OnNativeCheatClick(UINT nID);
afx_msg void OnSpawncarGunjeep();
uint frames;
CEdit m_pedX;
CEdit m_pedY;
CEdit m_pedZ;
Expand All @@ -99,74 +74,123 @@ class MainWindow : public CDialogEx
CEdit m_pedals[3];
CEdit m_gangRespect[3];
CEdit m_globalPedSpeeds[3];
void CarEngineOff();
bool starsLocked = 0;
short startCopValue = 0;
void LockStars();
bool noReloads = 0;
void NoReloads();
void KeepLockedValues();
void SetStars(UINT nID);
void TpToLastCar();
bool playerImmortal = 0;
void PlayerImmortal();
void GiveUnlimitedAmmo();
void FixCar();
void VisFixCar();
void VisBreakCar();
short startCarDamage = 0;
bool carDamageLocked = 0;
void LockCarDamage();
void PedInfo();
Car* currLastCar = 0;
Car* currLastCarOld = 0;
int pedXOld = 0, pedYOld = 0, pedZOld = 0, pedRotOld = 0;
int pedHOld = 1, pedAOld = 1, pedMOld = 1; // 1 not 0 because it has to be different than the actual value in the first tick
int globalPedSpeedsOld[3] = { 1,1,1 }; // same here

// features //

// car spawning
void SafeSpawnCars(WantToSpawn wtsArray[128], int* wtsArraySize);
WantToSpawn wtsCar[128];
int wtsCarSize = 0;
int lastSpawnedCarModel = -1;
afx_msg void SpawnCarHere(UINT nID);
afx_msg void OnSpawncarTank();
afx_msg void OnSpawncarGunjeep();

// object spawning
void SpawnObject(OBJECT_TYPE type);
afx_msg void OnSpawnObjectClick(UINT nID);
int wtSpawnObject = -1;
afx_msg void OnSpawnLastObjectClick();
int lastSpawnedObjectType = -1;
void TeleportAllPeds();

// other tabs
afx_msg void OnGetWeaponClick(UINT nID);
afx_msg void OnGetCarWeaponClick(UINT nID);
afx_msg void OnPlayVocalClick(UINT nID);
afx_msg void OnNativeCheatClick(UINT nID);

// currLastCar related
Car* currLastCar = 0;
Car* currLastCarOld = 0;
void CarEngineOff();
void TpToLastCar();
void PrintCarInfo();
void HijackTrain();

// currLastCar's color
afx_msg void CarColorReset();
afx_msg void CarColorPlus();
afx_msg void CarColorMinus();
void SyncTrailerColor();

// currLastCar's damage
void FixCar();
void LockCarDamage();
short startCarDamage = 0;
bool carDamageLocked = 0;

// currLastCar's visual damage
void VisFixCar();
void VisBreakCar();

// currLastCar's emblem
void CarEmblemPlus();
void CarEmblemMinus();
Roof* currLastCarEmblem = 0;
short currLastCarEmblemID = 0;
short currLastCarEmblemLPos = 0;
const int emblemValues[9] = { 0, 294, 295, 296, 297, 298, 299, 300, 8};
const wchar_t* emblemNames[9] = { L"None", L"Loonies", L"Yakuza", L"Zaibatsu", L"Rednecks", L"Scientists", L"Krishna", L"Russians", L"Bomb"};
Ped* selectedPed = 0;
bool watchPeds = false;
void WatchPeds();
void WatchNextPed();
int pedXPreHuman = 0, pedYPreHuman = 0, pedZPreHuman = 0;
void GangRespect(UINT nID);

// currLastCar's doors lock
void ToggleDoor(UINT nID);
bool doorOpen[4] = { 0,0,0,0 }; // 1 - force open
int currLastCarXOld = 0, currLastCarYOld = 0, currLastCarXYShift;
void FreeShopping();
void PrintCarInfo();
void SyncTrailerColor();
void CarEmblemPlus();
void CarEmblemMinus();
void CarColorPlus();
void CarColorMinus();
void CarColorReset();

// cop level
void SetStars(UINT nID);
void LockStars();
bool starsLocked = 0;
short startCopValue = 0;

// current weapon related
void GiveUnlimitedAmmo();
void NoReloads();
bool noReloads = 0;

// walking speed
void GoSlow();
int* walkingSpeed = nullptr;
void SetGlobalPedSpeeds();
int globalPedSpeedsOld[3] = { 1,1,1 }; // same here

// watch peds
void WatchPeds();
void WatchNextPed();
Ped* selectedPed = 0;
bool watchPeds = false;
int pedXPreWatch = 0, pedYPreWatch = 0, pedZPreWatch = 0;

// mouse control
afx_msg void MouseControl();
bool captureMouse = 0;
void CaptureMouse();

// ped clothes
void PedClothesPlus();
void FixCheckboxes();
void PedClothesMinus();
void PedShapePlus();
void PedShapeMinus();
void PedShapeClothesReset();
void ShowBigText();
void HijackTrain();
void GoSlow();
int* walkingSpeed = nullptr;

// player immortal
void PlayerImmortal();
bool playerImmortal = 0;

// other
void TeleportPlayer();
void SetHealthArmorMoney();
void SetGlobalPedSpeeds();
void SpawnCar(int x, int y, int z, int rot, CAR_MODEL model);
void SpawnObject(OBJECT_TYPE type);
void TeleportAllPeds();
void GangRespect(UINT nID);
void FreeShopping();
void ShowBigText();

// big functions
void FixCheckboxes();
void KeepLockedValues();
void PedInfo();
int currLastCarXOld = 0, currLastCarYOld = 0, currLastCarXYShift;
int pedXOld = 0, pedYOld = 0, pedZOld = 0, pedRotOld = 0;
int pedHOld = 1, pedAOld = 1, pedMOld = 1; // 1 not 0 because it has to be different than the actual value in the first tick

// important
void OnGTAGameTick(Game* game);
void NewFunction();
};
22 changes: 17 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
# gta2-trainer-cpp

## Faeatures
Player ped controlling, Cars spawning n' fixing, Weapons giving, Vocals playing, Important info showing, Non-stop crashing ultimate GTA2 trainer with so many features, I can't list them all!!! (or i'm just too lazy nevermind)
## About
A tool for GTA2 allowing you to manipulate gameplay in real time (without exiting the game or loading saves).
Some of the main features are:
- Controlling your character's stats e.g. health, ammo, appearance, walking speed, wanted level, respect
- Teleporting
- Spawning any cars
- Spawning any objects (power-ups etc.)
- Playing vocals
- Giving yourself any weapons (including secret ones)
- Giving yourself any car weapons
- Using some of the built-in cheats without entering any cheat codes

## Fast install
Download latest release (gta2-trainer-X.XX.zip) from the panel at your right and copy its contents to your game root folder.
Then just run (in window mode) gta-trainer.exe instead of gta.exe and you should see the trainer window under the GTA2 window.
If you just want to play it, go to the [Releases tab](https://github.com/izawartka/gta2-trainer-cpp/releases) and download
the latest gta2-trainer-x.xx.zip. Then copy its contents to your game root folder. Now you just need to run (in windowed mode)
gta-trainer.exe file instead of gta.exe and you should see the trainer window under the GTA2 window.

If you're having problems with running the game make sure your system has [all needed VC++ Redistributables](https://www.techpowerup.com/download/visual-c-redistributable-runtime-package-all-in-one/) installed.

## Playing with the code
If you want to build it on your own, there is a VS solution prepared for you so it shouldn't be a problem to compile it.
If you want to build it on your own, there is a VS solution included in the repo.

Before you'll try to compile it for the first time, you have to change some settings though
1. Change the configuration to Release x86
Expand Down
Loading

0 comments on commit a1a7eae

Please sign in to comment.