add patreon links

This commit is contained in:
Grinch_ 2022-08-10 10:40:38 +06:00
parent a1be45cbf9
commit fc0e8ac739
10 changed files with 206 additions and 138 deletions

70
.vscode/tasks.json vendored
View File

@ -24,11 +24,12 @@
"shell": { "shell": {
"executable": "cmd.exe", "executable": "cmd.exe",
"args": [ "args": [
"/d", "/c" "/d",
"/c"
] ]
} }
} }
}, }
}, },
{ {
"label": "Build ReleaseSA", "label": "Build ReleaseSA",
@ -51,11 +52,12 @@
"shell": { "shell": {
"executable": "cmd.exe", "executable": "cmd.exe",
"args": [ "args": [
"/d", "/c" "/d",
"/c"
] ]
} }
} }
}, }
}, },
{ {
"label": "Build DebugVC", "label": "Build DebugVC",
@ -78,11 +80,12 @@
"shell": { "shell": {
"executable": "cmd.exe", "executable": "cmd.exe",
"args": [ "args": [
"/d", "/c" "/d",
"/c"
] ]
} }
} }
}, }
}, },
{ {
"label": "Build ReleaseVC", "label": "Build ReleaseVC",
@ -105,11 +108,12 @@
"shell": { "shell": {
"executable": "cmd.exe", "executable": "cmd.exe",
"args": [ "args": [
"/d", "/c" "/d",
"/c"
] ]
} }
} }
}, }
}, },
{ {
"label": "Build DebugIII", "label": "Build DebugIII",
@ -132,11 +136,12 @@
"shell": { "shell": {
"executable": "cmd.exe", "executable": "cmd.exe",
"args": [ "args": [
"/d", "/c" "/d",
"/c"
] ]
} }
} }
}, }
}, },
{ {
"label": "Build ReleaseIII", "label": "Build ReleaseIII",
@ -159,11 +164,12 @@
"shell": { "shell": {
"executable": "cmd.exe", "executable": "cmd.exe",
"args": [ "args": [
"/d", "/c" "/d",
"/c"
] ]
} }
} }
}, }
}, },
{ {
"label": "Build DebugAll", "label": "Build DebugAll",
@ -186,11 +192,12 @@
"shell": { "shell": {
"executable": "cmd.exe", "executable": "cmd.exe",
"args": [ "args": [
"/d", "/c" "/d",
"/c"
] ]
} }
} }
}, }
}, },
{ {
"label": "Build ReleaseAll", "label": "Build ReleaseAll",
@ -213,11 +220,12 @@
"shell": { "shell": {
"executable": "cmd.exe", "executable": "cmd.exe",
"args": [ "args": [
"/d", "/c" "/d",
"/c"
] ]
} }
} }
}, }
}, },
{ {
"label": "Package all", "label": "Package all",
@ -240,11 +248,12 @@
"shell": { "shell": {
"executable": "cmd.exe", "executable": "cmd.exe",
"args": [ "args": [
"/d", "/c" "/d",
"/c"
] ]
} }
} }
}, }
}, },
{ {
"label": "Format Code", "label": "Format Code",
@ -267,11 +276,32 @@
"shell": { "shell": {
"executable": "cmd.exe", "executable": "cmd.exe",
"args": [ "args": [
"/d", "/c" "/d",
"/c"
] ]
} }
} }
}, }
}, },
{
"type": "cppbuild",
"label": "C/C++: cl.exe build active file",
"command": "cl.exe",
"args": [
"/Zi",
"/EHsc",
"/nologo",
"/Fe${fileDirname}\\${fileBasenameNoExtension}.exe",
"${file}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$msCompile"
],
"group": "build",
"detail": "compiler: cl.exe"
}
] ]
} }

13
FUNDING.yml Normal file
View File

@ -0,0 +1,13 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: grinch_
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

View File

@ -168,7 +168,7 @@ FreecamBackwardKey = "Freecam backward"
FreecamForwardKey = "Freecam forward" FreecamForwardKey = "Freecam forward"
FreecamLeftKey = "Freecam left" FreecamLeftKey = "Freecam left"
FreecamRightKey = "Freecam right" FreecamRightKey = "Freecam right"
GitHubRepo = "GitHub repo" GitHubRepo = "GitHub"
GodModeKey = "Toggle god mode" GodModeKey = "Toggle god mode"
Hotkeys = "Hotkeys" Hotkeys = "Hotkeys"
InvalidComamnd = "Invalid Command" InvalidComamnd = "Invalid Command"
@ -185,6 +185,8 @@ OpenCMDKey = "Open/ close command window"
OpenCMDUsing = "Open or close command window using %s" OpenCMDUsing = "Open or close command window using %s"
OpenMenuKey = "Open/ close cheat menu" OpenMenuKey = "Open/ close cheat menu"
Overlay = "Overlay" Overlay = "Overlay"
Patreon = "Patreon"
PatreonText = "If you like my work, consider supporting :)"
Position = "Position" Position = "Position"
Remove = "Remove" Remove = "Remove"
Favourites = "Add to favourites" Favourites = "Add to favourites"

View File

@ -329,7 +329,6 @@ void CheatMenu::ShowWelcomePage()
ImGui::NewLine(); ImGui::NewLine();
ImGui::TextWrapped(TEXT("Menu.EnsureLatest")); ImGui::TextWrapped(TEXT("Menu.EnsureLatest"));
ImGui::NewLine();
if (ImGui::Button(TEXT("Menu.DiscordServer"), ImVec2(Widget::CalcSize(2)))) if (ImGui::Button(TEXT("Menu.DiscordServer"), ImVec2(Widget::CalcSize(2))))
{ {
OPEN_LINK(DISCORD_INVITE); OPEN_LINK(DISCORD_INVITE);
@ -341,6 +340,12 @@ void CheatMenu::ShowWelcomePage()
} }
ImGui::NewLine(); ImGui::NewLine();
ImGui::TextWrapped(TEXT("Menu.BugDisclaimer")); ImGui::TextWrapped(TEXT("Menu.BugDisclaimer"));
ImGui::Dummy(ImVec2(0, 20));
Widget::TextCentered(TEXT("Menu.PatreonText"));
if (ImGui::Button(TEXT("Menu.Patreon"), ImVec2(Widget::CalcSize(1))))
{
OPEN_LINK("https://www.patreon.com/grinch_");
}
ImGui::Dummy(ImVec2(0, 30)); ImGui::Dummy(ImVec2(0, 30));
Widget::TextCentered(TEXT("Menu.CopyrightDisclaimer")); Widget::TextCentered(TEXT("Menu.CopyrightDisclaimer"));
} }

View File

@ -0,0 +1,78 @@
#include "pch.h"
#include "cutscene_sa.h"
CutsceneMgr& Cutscene = *CutsceneMgr::Get();
CutsceneMgr::CutsceneMgr()
{
static CdeclEvent <AddressList<0x5B195F, H_JUMP>, PRIORITY_AFTER, ArgPickNone, void()> skipCutsceneEvent;
skipCutsceneEvent += [this]()
{
Stop();
};
}
void CutsceneMgr::Play(std::string& rootKey, std::string& cutsceneId, std::string& interior)
{
if (CCutsceneMgr::ms_running)
{
Util::SetMessage(TEXT("Animation.CutsceneRunning"));
return;
}
CPlayerPed* pPlayer = FindPlayerPed();
if (pPlayer)
{
m_pLastVeh = pPlayer->m_nPedFlags.bInVehicle ? pPlayer->m_pVehicle : nullptr;
m_nVehSeat = -1;
if (m_pLastVeh && m_pLastVeh->m_pDriver != pPlayer)
{
for (size_t i = 0; i != 8; ++i)
{
if (m_pLastVeh->m_apPassengers[i] == pPlayer)
{
m_nVehSeat = i;
break;
}
}
}
CCutsceneMgr::LoadCutsceneData(cutsceneId.c_str());
CCutsceneMgr::Update();
m_nInterior = pPlayer->m_nAreaCode;
pPlayer->m_nAreaCode = std::stoi(interior);
Command<Commands::SET_AREA_VISIBLE>(pPlayer->m_nAreaCode);
CutsceneMgr::m_bRunning = true;
CCutsceneMgr::StartCutscene();
}
}
void CutsceneMgr::Stop()
{
if (CutsceneMgr::m_bRunning)
{
CPlayerPed *pPlayer = FindPlayerPed();
int hPlayer = CPools::GetPedRef(pPlayer);
CCutsceneMgr::DeleteCutsceneData();
CutsceneMgr::m_bRunning = false;
pPlayer->m_nAreaCode = CutsceneMgr::m_nInterior;
CutsceneMgr::m_nInterior = 0;
Command<Commands::SET_AREA_VISIBLE>(pPlayer->m_nAreaCode);
// handle vehicle
if (CutsceneMgr::m_pLastVeh)
{
int hVeh = CPools::GetVehicleRef(CutsceneMgr::m_pLastVeh);
if (CutsceneMgr::m_nVehSeat == -1)
{
Command<Commands::WARP_CHAR_INTO_CAR>(hPlayer, hVeh);
}
else
{
Command<Commands::WARP_CHAR_INTO_CAR_AS_PASSENGER>(hPlayer, hVeh, CutsceneMgr::m_nVehSeat);
}
}
TheCamera.Fade(0, 1);
}
}

35
src/custom/cutscene_sa.h Normal file
View File

@ -0,0 +1,35 @@
#pragma once
#include "utils/resourcestore.h"
#include "interface/icheat.hpp"
extern class CVehicle;
/*
Cutscene Player Class for SA
Plays mission cutscenes
*/
class CutsceneMgr : public ICheat<CutsceneMgr>
{
private:
bool m_bRunning; // is cutscene currently running
// backup data
int m_nInterior; // interior player was in
CVehicle *m_pLastVeh; // vehicle player was in
int m_nVehSeat; // seat id of player vehicle
friend class ICheat;
CutsceneMgr();
CutsceneMgr(const CutsceneMgr&);
public:
ResourceStore m_Data{ "cutscenes", eResourceType::TYPE_TEXT }; // names
// Plays a cutscene
void Play(std::string& cat, std::string& key, std::string& val);
// Stops a running cutscene
void Stop();
};
extern CutsceneMgr& Cutscene;

View File

@ -19,81 +19,7 @@
#ifdef GTASA #ifdef GTASA
#include "utils/overlay.h" #include "utils/overlay.h"
#include "custom/cutscene_sa.h"
void Cutscene::Init()
{
static CdeclEvent <AddressList<0x5B195F, H_JUMP>, PRIORITY_AFTER, ArgPickNone, void()> skipCutsceneEvent;
skipCutsceneEvent += []()
{
Stop();
};
}
void Cutscene::Play(std::string& rootKey, std::string& cutsceneId, std::string& interior)
{
if (CCutsceneMgr::ms_running)
{
Util::SetMessage(TEXT("Animation.CutsceneRunning"));
return;
}
CPlayerPed* pPlayer = FindPlayerPed();
if (pPlayer)
{
m_pLastVeh = pPlayer->m_nPedFlags.bInVehicle ? pPlayer->m_pVehicle : nullptr;
m_nVehSeat = -1;
if (m_pLastVeh && m_pLastVeh->m_pDriver != pPlayer)
{
for (size_t i = 0; i != 8; ++i)
{
if (m_pLastVeh->m_apPassengers[i] == pPlayer)
{
m_nVehSeat = i;
break;
}
}
}
CCutsceneMgr::LoadCutsceneData(cutsceneId.c_str());
CCutsceneMgr::Update();
m_nInterior = pPlayer->m_nAreaCode;
pPlayer->m_nAreaCode = std::stoi(interior);
Command<Commands::SET_AREA_VISIBLE>(pPlayer->m_nAreaCode);
Cutscene::m_bRunning = true;
CCutsceneMgr::StartCutscene();
}
}
void Cutscene::Stop()
{
if (Cutscene::m_bRunning)
{
CPlayerPed *pPlayer = FindPlayerPed();
int hPlayer = CPools::GetPedRef(pPlayer);
CCutsceneMgr::DeleteCutsceneData();
Cutscene::m_bRunning = false;
pPlayer->m_nAreaCode = Cutscene::m_nInterior;
Cutscene::m_nInterior = 0;
Command<Commands::SET_AREA_VISIBLE>(pPlayer->m_nAreaCode);
// handle vehicle
if (Cutscene::m_pLastVeh)
{
int hVeh = CPools::GetVehicleRef(Cutscene::m_pLastVeh);
if (Cutscene::m_nVehSeat == -1)
{
Command<Commands::WARP_CHAR_INTO_CAR>(hPlayer, hVeh);
}
else
{
Command<Commands::WARP_CHAR_INTO_CAR_AS_PASSENGER>(hPlayer, hVeh, Cutscene::m_nVehSeat);
}
}
TheCamera.Fade(0, 1);
}
}
void Particle::Play(std::string& cat, std::string& name, std::string& particle) void Particle::Play(std::string& cat, std::string& name, std::string& particle)
{ {
@ -273,7 +199,6 @@ void Animation::Play(std::string& cat, std::string& anim, std::string& ifp)
void Animation::Init() void Animation::Init()
{ {
#ifdef GTASA #ifdef GTASA
Cutscene::Init();
Events::processScriptsEvent += [] Events::processScriptsEvent += []
{ {
CPlayerPed* pPlayer = FindPlayerPed(); CPlayerPed* pPlayer = FindPlayerPed();
@ -434,14 +359,14 @@ void Animation::ShowPage()
ImGui::Spacing(); ImGui::Spacing();
if (ImGui::Button(TEXT("Animation.StopCutscene"), Widget::CalcSize())) if (ImGui::Button(TEXT("Animation.StopCutscene"), Widget::CalcSize()))
{ {
Cutscene::Stop(); Cutscene.Stop();
} }
ImGui::Spacing(); ImGui::Spacing();
if (ImGui::BeginChild("Cutscene Child")) if (ImGui::BeginChild("Cutscene Child"))
{ {
ImGui::Spacing(); ImGui::Spacing();
Widget::DataList(Cutscene::m_Data, Cutscene::Play); Widget::DataList(Cutscene.m_Data, [](std::string& a, std::string& b, std::string& c){Cutscene.Play(a, b, c);});
ImGui::EndChild(); ImGui::EndChild();
} }
ImGui::EndTabItem(); ImGui::EndTabItem();

View File

@ -2,35 +2,7 @@
#include "pch.h" #include "pch.h"
#ifdef GTASA #ifdef GTASA
/*
Cutscene Player Class for SA
Plays mission cutscenes
*/
class Cutscene
{
private:
static inline bool m_bRunning; // is cutscene currently running
// backup data
static inline int m_nInterior; // interior player was in
static inline CVehicle *m_pLastVeh; // vehicle player was in
static inline int m_nVehSeat; // seat id of player vehicle
public:
static inline ResourceStore m_Data{ "cutscenes", eResourceType::TYPE_TEXT }; // names
Cutscene() = delete;
Cutscene(const Cutscene&) = delete;
// Initializes hooks, vars etc.
static void Init();
// Plays a cutscene
static void Play(std::string& cat, std::string& key, std::string& val);
// Stops a running cutscene
static void Stop();
};
/* /*
Particle Player Class for SA Particle Player Class for SA

View File

@ -285,24 +285,29 @@ void Menu::ShowPage()
{ {
ImGui::Spacing(); ImGui::Spacing();
if (ImGui::Button(TEXT("Menu.CheckUpdate"), ImVec2(Widget::CalcSize(3)))) if (ImGui::Button(TEXT("Menu.CheckUpdate"), ImVec2(Widget::CalcSize(2))))
{ {
Updater::CheckUpdate(); Updater::CheckUpdate();
} }
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button(TEXT("Menu.DiscordServer"), ImVec2(Widget::CalcSize(3)))) if (ImGui::Button(TEXT("Menu.DiscordServer"), ImVec2(Widget::CalcSize(2))))
{ {
OPEN_LINK(DISCORD_INVITE); OPEN_LINK(DISCORD_INVITE);
} }
ImGui::SameLine(); if (ImGui::Button(TEXT("Menu.GitHubRepo"), ImVec2(Widget::CalcSize(2))))
if (ImGui::Button(TEXT("Menu.GitHubRepo"), ImVec2(Widget::CalcSize(3))))
{ {
OPEN_LINK(GITHUB_LINK); OPEN_LINK(GITHUB_LINK);
} }
ImGui::SameLine();
if (ImGui::Button(TEXT("Menu.Patreon"), ImVec2(Widget::CalcSize(2))))
{
OPEN_LINK("https://www.patreon.com/grinch_");
}
ImGui::Spacing(); ImGui::Spacing();
if (ImGui::BeginChild("AboutChild")) if (ImGui::BeginChild("AboutChild"))
@ -320,6 +325,9 @@ void Menu::ShowPage()
ImGui::Dummy(ImVec2(0, 10)); ImGui::Dummy(ImVec2(0, 10));
ImGui::TextWrapped(TEXT("Menu.BugDisclaimer")); ImGui::TextWrapped(TEXT("Menu.BugDisclaimer"));
ImGui::Spacing();
Widget::TextCentered(TEXT("Menu.PatreonText"));
ImGui::Dummy(ImVec2(0, 10)); ImGui::Dummy(ImVec2(0, 10));
Widget::TextCentered(TEXT("Menu.CopyrightDisclaimer")); Widget::TextCentered(TEXT("Menu.CopyrightDisclaimer"));

View File

@ -6,7 +6,6 @@
#include <d3d11Shader.h> #include <d3d11Shader.h>
#include <filesystem> #include <filesystem>
#include <fstream> #include <fstream>
#include <functional>
#include <memory> #include <memory>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
@ -78,11 +77,12 @@ enum eRenderer
extern eRenderer gRenderer; extern eRenderer gRenderer;
extern DataStore gConfig; extern DataStore gConfig;
typedef void(*ArgCallback3)(std::string&, std::string&, std::string&); typedef std::string str;
typedef void(*ArgCallback)(std::string&); typedef void(*ArgCallback3)(str&, str&, str&);
typedef void(*ArgCallback)(str&);
typedef void(*ArgCallbackNone)(); typedef void(*ArgCallbackNone)();
typedef std::string(*ArgCallbackRtn)(std::string&); typedef std::string(*ArgCallbackRtn)(str&);
typedef bool(*ArgCallbackRtnBool)(std::string&); typedef bool(*ArgCallbackRtnBool)(str&);
#ifdef GTASA #ifdef GTASA
extern const char* taskNames[1802]; extern const char* taskNames[1802];