Add files via upload

This commit is contained in:
MaZaHa-Ka 2024-09-27 13:16:51 +03:00 committed by GitHub
parent d6264d22ea
commit a66ec511de
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 1132 additions and 15 deletions

View file

@ -221,6 +221,7 @@ CEntity::GetBoundRect(void)
CRect rect;
CVector v;
CColModel *col = CModelInfo::GetColModel(m_modelIndex);
assert(col);
rect.ContainPoint(GetMatrix() * col->boundingBox.min);
rect.ContainPoint(GetMatrix() * col->boundingBox.max);
@ -520,10 +521,15 @@ CEntity::IsVisibleComplex(void)
return m_rwObject && bIsVisible && GetIsOnScreenComplex();
}
__declspec(noinline)
bool
CEntity::GetIsOnScreen(void)
{
return TheCamera.IsSphereVisible(GetBoundCentre(), GetBoundRadius());
//return TheCamera.IsSphereVisible(GetBoundCentre(), GetBoundRadius());
if(!CModelInfo::GetColModel(m_modelIndex)) { return false; }
auto a = GetBoundCentre();
auto b = GetBoundRadius();
return TheCamera.IsSphereVisible(a, b);
}
bool
@ -697,7 +703,7 @@ CEntity::GetDistanceFromCentreOfMassToBaseOfModel(void)
return -CModelInfo::GetColModel(m_modelIndex)->boundingBox.min.z;
}
void
/*void
CEntity::SetupBigBuilding(void)
{
CSimpleModelInfo *mi;
@ -718,6 +724,24 @@ CEntity::SetupBigBuilding(void)
m_level = LEVEL_GENERIC;
// else if(m_level == LEVEL_GENERIC)
// printf("%s isn't in a level\n", mi->GetModelName());
}*/
void
CEntity::SetupBigBuilding(void)
{
CSimpleModelInfo *mi;
mi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(m_modelIndex);
bIsBIGBuilding = true;
bStreamingDontDelete = true;
bUsesCollision = false;
m_level = CTheZones::GetLevelFromPosition(&GetPosition());
if(mi->m_lodDistances[0] <= 2000.0f)
bStreamBIGBuilding = true;
if(mi->m_lodDistances[0] > 2500.0f || mi->m_ignoreDrawDist)
m_level = LEVEL_GENERIC;
else if(m_level == LEVEL_GENERIC)
printf("%s isn't in a level\n", mi->GetModelName());
}
float WindTabel[] = {

View file

@ -113,6 +113,10 @@ CPhysical::Add(void)
assert(xend < NUMSECTORS_X);
assert(ystart >= 0);
assert(yend < NUMSECTORS_Y);
//debug("mi %d\n", GetModelIndex());
//debug("Bounds: left = %f, right = %f, top = %f, bottom = %f\n", bounds.left, bounds.right, bounds.top, bounds.bottom);
//debug("CPhysical::Add &&&%d, %d, %d, %d\n", xstart, xend, ystart, yend);
//debug("CPhysical::pos &&&%d, %d, %d\n", GetPosition().x, GetPosition().y, GetPosition().z);
for(y = ystart; y <= yend; y++)
for(x = xstart; x <= xend; x++){
@ -165,7 +169,7 @@ CPhysical::Remove(void)
}
}
static void
/*static void
MoveVehicleToSafety(CVehicle* pVehicle)
{
if (pVehicle->VehicleCreatedBy != MISSION_VEHICLE) {
@ -194,9 +198,9 @@ MovePedToSafety(CPed* pPed)
pPed->Teleport(nodePos + CVector(0.0f, 0.0f, pPed->GetDistanceFromCentreOfMassToBaseOfModel()));
CTheScripts::ClearSpaceForMissionEntity(nodePos, pPed);
}
}
}*/
void
/*void
CPhysical::RemoveAndAdd(void)
{
int x, xstart, xmid, xend;
@ -312,7 +316,85 @@ CPhysical::RemoveAndAdd(void)
node->list->DeleteNode(node->listnode);
m_entryInfoList.DeleteNode(node);
}
}*/
void
CPhysical::RemoveAndAdd(void)
{
int x, xstart, xmid, xend;
int y, ystart, ymid, yend;
CSector *s;
CPtrList *list;
CRect bounds = GetBoundRect();
xstart = CWorld::GetSectorIndexX(bounds.left);
xend = CWorld::GetSectorIndexX(bounds.right);
xmid = CWorld::GetSectorIndexX((bounds.left + bounds.right)/2.0f);
ystart = CWorld::GetSectorIndexY(bounds.top);
yend = CWorld::GetSectorIndexY(bounds.bottom);
ymid = CWorld::GetSectorIndexY((bounds.top + bounds.bottom)/2.0f);
assert(xstart >= 0);
assert(xend < NUMSECTORS_X);
assert(ystart >= 0);
assert(yend < NUMSECTORS_Y);
//debug("mi %d\n", GetModelIndex());
//debug("Bounds: left = %f, right = %f, top = %f, bottom = %f\n", bounds.left, bounds.right, bounds.top, bounds.bottom);
//debug("CPhysical::RemoveAndAdd &&&%d, %d, %d, %d\n", xstart, xend, ystart, yend);
//debug("CPhysical::RemoveAndAdd &&&%d, %d, %d\n", GetPosition().x, GetPosition().y, GetPosition().z);
//[DBG]: Bounds: left = -1.250000, right = 1.250000, top = -1.250000, bottom = 1.250000
//[DBG]: CPhysical::Add &&&49, 50, 49, 50
//[DBG]: CPhysical::RemoveAndAdd &&&0.000000, 0.000000, 0.000000
// we'll try to recycle nodes from here
CEntryInfoNode *next = m_entryInfoList.first;
for(y = ystart; y <= yend; y++)
for(x = xstart; x <= xend; x++){
s = CWorld::GetSector(x, y);
if(x == xmid && y == ymid) switch(m_type){
case ENTITY_TYPE_VEHICLE:
list = &s->m_lists[ENTITYLIST_VEHICLES];
break;
case ENTITY_TYPE_PED:
list = &s->m_lists[ENTITYLIST_PEDS];
break;
case ENTITY_TYPE_OBJECT:
list = &s->m_lists[ENTITYLIST_OBJECTS];
break;
}else switch(m_type){
case ENTITY_TYPE_VEHICLE:
list = &s->m_lists[ENTITYLIST_VEHICLES_OVERLAP];
break;
case ENTITY_TYPE_PED:
list = &s->m_lists[ENTITYLIST_PEDS_OVERLAP];
break;
case ENTITY_TYPE_OBJECT:
list = &s->m_lists[ENTITYLIST_OBJECTS_OVERLAP];
break;
}
if(next){
// If we still have old nodes, use them
next->list->RemoveNode(next->listnode);
list->InsertNode(next->listnode);
next->list = list;
next->sector = s;
next = next->next;
}else{
CPtrNode *node = list->InsertItem(this);
m_entryInfoList.InsertItem(list, node, s);
}
}
// Remove old nodes we no longer need
CEntryInfoNode *node;
for(node = next; node; node = next){
next = node->next;
node->list->DeleteNode(node->listnode);
m_entryInfoList.DeleteNode(node);
}
}
CRect
CPhysical::GetBoundRect(void)

View file

@ -0,0 +1,66 @@
// MIT ëèöåíçèÿ By MaZaHaKa
#pragma once
#include "../core/Camera.h"
#include "../core/Clock.h"
#include "../core/FileLoader.h"
#include "../core/FileMgr.h"
#include "../core/Frontend.h"
#include "../core/Pad.h"
#include "../core/World.h"
#include "../core/common.h"
#include "../entities/Entity.h"
#include "../extras/custompipes.h"
#include "../peds/CivilianPed.h"
#include "../peds/Ped.h"
#include "../peds/PlayerPed.h"
#include "../core/PlayerInfo.h"
#include "../renderer/Font.h"
#include "../audio/DMAudio.h"
#include "../audio/MusicManager.h"
#include "../audio/AudioManager.h"
#include "../audio/sampman.h"
#include "../rw/TxdStore.h"
#include "../utils/Utils.h"
#include "../vehicles/Vehicle.h"
#include "../vehicles/CarGen.h"
#include "../weapons/WeaponInfo.h"
//#include "../utils/Utils.h"
#include "../utils/ConsoleTools.h"
#include "Windows.h"
#include <iostream>
#include <string>
#include <sstream>
#include <cstring>
#include <vector>
namespace PLG_ClearExamplePlugin
{
//std::vector<HANDLE> g_threads;
void
PLG_OnStart()
{
// if(!gbIsConsoleOpened) { OpenConsole(); }
// std::cout << "PLG_OnStart()" << "\n";
}
void
PLG_OnInit()
{
}
void
PLG_OnDraw()
{
}
void
PLG_OnShutdown()
{
}
} // namespace PLG_ClearExamplePlugin

251
src/plugin/Helper.hpp Normal file
View file

@ -0,0 +1,251 @@
// MIT ëèöåíçèÿ By MaZaHaKa
#pragma once
#include "../audio/AudioManager.h"
#include "../audio/DMAudio.h"
#include "../audio/MusicManager.h"
#include "../audio/sampman.h"
#include "../core/Camera.h"
#include "../core/Clock.h"
#include "../core/FileLoader.h"
#include "../core/FileMgr.h"
#include "../core/Frontend.h"
#include "../core/Pad.h"
#include "../core/PlayerInfo.h"
#include "../core/Stats.h"
#include "../core/World.h"
#include "../core/common.h"
#include "../entities/Entity.h"
#include "../extras/custompipes.h"
#include "../peds/CivilianPed.h"
#include "../peds/Ped.h"
#include "../peds/PlayerPed.h"
#include "../renderer/Font.h"
#include "../renderer/Timecycle.h"
#include "../rw/TxdStore.h"
#include "../utils/Utils.h"
#include "../vehicles/CarGen.h"
#include "../control/Script.h"
#include "../vehicles/Vehicle.h"
#include "../weapons/WeaponInfo.h"
//#include "../utils/Utils.h"
#include "../utils/ConsoleTools.h"
#include "Windows.h"
#include <cstring>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
namespace PLG_HelperPlugin
{
// std::vector<HANDLE> g_threads;
void
PLG_OnStart()
{
// if(!gbIsConsoleOpened) { OpenConsole(); }
// std::cout << "PLG_OnStart()" << "\n";
}
void
PLG_OnInit()
{
}
void
DecryptCheatString(char *encryptedStr, char *decryptedStr)
{
#define decmp(n) decryptedStr[i] = encryptedStr[i] - n;
int i = 0;
while(encryptedStr[i]) {
switch(i) {
case 0: decmp(3); break;
case 1: decmp(5); break;
case 2: decmp(7); break;
case 3: decmp(1); break;
case 4: decmp(13); break;
case 5: decmp(27); break;
case 6: decmp(3); break;
case 7: decmp(7); break;
case 8: decmp(1); break;
case 9: decmp(11); break;
case 10: decmp(13); break;
case 11: decmp(8); break;
case 12: decmp(7); break;
case 13: decmp(32); break;
case 14: decmp(13); break;
case 15: decmp(6); break;
case 16: decmp(28); break;
case 17: decmp(19); break;
case 18: decmp(10); break;
case 19: decmp(3); break;
case 20: decmp(3); break;
case 21: decmp(5); break;
case 22: decmp(7); break;
case 23: decmp(1); break;
case 24: decmp(13); break;
case 25: decmp(27); break;
case 26: decmp(3); break;
case 27: decmp(7); break;
default: return;
}
i++;
}
#undef decmp
}
void
ProcessMaterialsFromClump(RpClump *clump)
{
// Ïðåäïîëîæèì, ÷òî RpClump èìååò ñïèñîê àòîìèêîâ (íàïðèìåð, linked list)
// çàìåíèì _list íà ïîëå èç ñòðóêòóðû, â êîòîðîì õðàíÿòñÿ àòîìèêè.
if(!clump) { return; }
FORLIST(lnk, clump->atomics)
{
RpAtomic *atomic = (RpAtomic *)lnk; // Ïîëó÷àåì àòîìèê èç òåêóùåé ññûëêè
if(!atomic) { continue; }
RpGeometry *geometry = RpAtomicGetGeometry(atomic);
if(geometry) {
//int numMaterials = RpGeometryGetNumMaterials(geometry);
int numMaterials = geometry->matList.numMaterials;
for(int i = 0; i < numMaterials; ++i) {
RpMaterial *material = RpGeometryGetMaterial(geometry, i);
// Çäåñü ìîæíî èçâëåêàòü è èñïîëüçîâàòü äàííûå ìàòåðèàëà
printf("Material: %s\n", material->texture->name);
}
}
}
}
__declspec(noinline)
void
dbg()
{
ProcessMaterialsFromClump(FindPlayerPed()->GetClump());
}
bool once = false;
bool draw = false;
bool hold = false;
int hlp = 0;
bool allow_hold = false;
void
PLG_OnDraw()
{
// if(!gbIsInitedExternalCargen)
{
// once = true;
// PLG_ExternalCargens::InitExternalCargens(); // twice
}
if(draw) {
// DrawRadioName("L Radio");
// TestDraw();
}
// bool ispress = CPad::GetPad(0)->GetChar(HotKeyStore_GetLiveRadioHotkey());
bool ispress = (GetAsyncKeyState('R') & 0x8000);
if(ispress && ((!hold && !allow_hold) || (allow_hold))) {
// DrawRadioName("AHAHAHHA");
// TestDraw();
// std::cout << "PrintText" << "\n";
if(!once) {
/*const char *ffmpeglib = "bass\\x64\\bass.dll";
HMODULE hBass = GetModuleHandleA(ffmpeglib);
if(!hBass) { hBass = LoadLibraryA(ffmpeglib); }
std::cout << "Loaded 0x" << hBass << "\n";*/
// setStation("https://online.kissfm.ua/KissFM_Deep_HD");
// setStation("C:\\Users\\Zver\\Desktop\\Any Act - Gypsy Man.mp3");
// setStation("https://air.unmixed.ru/lradio256");
// setVolume(10);
draw = true;
once = true;
// PLG_ExternalCargens::InitExternalCargens(); // twice
}
// std::cout << CTheScripts::pActiveScripts->m_abScriptName << "\n";
// std::cout << "cnt cargen: " << CTheCarGenerators::NumOfCarGenerators << "\n"; // 209
// std::cout << "CurrentActiveCount: " << (int)CTheCarGenerators::CurrentActiveCount << "\n"; // 193
// std::cout << "ProcessCounter: " << (int)CTheCarGenerators::ProcessCounter << "\n";
// CTheCarGenerators::CurrentActiveCount = 209;
// DMAudio.ResetTimers(CTimer::GetTimeInMilliseconds() - 5000);
// TryMuteVehRadio();
// CPlayerInfo *pPlayer = &CWorld::Players[CWorld::PlayerInFocus];
// pPlayer->m_nMoney = 0;
// std::cout << "rand: " << GetRandomNumInclude(0, 5) << "\n";
// std::cout << "randUn: " << GetRandomNumUnInclude(0, 5) << "\n";
// std::cout << "m_fMapSize: " << FrontEndMenuManager.m_fMapSize << "\n";
// std::cout << "m_fMapCenterX: " << FrontEndMenuManager.m_fMapCenterX << "\n";
// std::cout << "m_fMapCenterY: " << FrontEndMenuManager.m_fMapCenterY << "\n";
/*wchar *lastMissionPassed;
lastMissionPassed = TheText.Get(CStats::LastMissionPassedName[0] ? CStats::LastMissionPassedName : "ITBEG");
char* str = UnicodeToAscii(lastMissionPassed);
//debug("stats last: %s\n", *CStats::LastMissionPassedName); // vic1
debug("stats last: %s\n\n", str); // vic1
std::cout << "\n";*/
/*char encryptedStr[] = "SZUSb]";
char decryptedStr[sizeof(encryptedStr)] = {0};
DecryptCheatString(encryptedStr, decryptedStr);
std::cout << "Decrypted string: " << decryptedStr << std::endl;*/
std::string name = CModelInfo::GetModelInfo(FindPlayerPed()->GetModelIndex())->GetModelName();
std::cout << name << "\n";
return;
std::cout << "mission: " << CTheScripts::pActiveScripts[0].m_abScriptName << "\n";
std::cout << "player in veh: " << FindPlayerPed()->InVehicle() << "\n";
DumpAllScriptsOffsets();
dbg();
//std::cout << &([]() {});
// ReadDataFromBufferPointer(buf, CTimeCycle::m_ExtraColour);
// ReadDataFromBufferPointer(buf, CTimeCycle::m_bExtraColourOn);
// ReadDataFromBufferPointer(buf, CTimeCycle::m_ExtraColourInter);
////std::cout << "m_ExtraColour: " << (unsigned int)CTimeCycle::m_ExtraColour << "\n";
////std::cout << "m_bExtraColourOn: " << (unsigned int)CTimeCycle::m_bExtraColourOn << "\n";
////std::cout << "m_ExtraColourInter: " << (unsigned int)CTimeCycle::m_ExtraColourInter << "\n";
//std::cout << "pad: " << CPad::GetPad(0)->GetWeapon() << "\n";
/*CVehicle *pRandVehicle = GetRandomPoolVehicle();
CPlayerPed *pPlayer = FindPlayerPed();
if(pRandVehicle && pPlayer) {
pPlayer->SetCarJack(pRandVehicle);
}*/
hlp = hlp == 0 ? 1 : 0;
// CTimeCycle::m_bExtraColourOn = CTimeCycle::m_ExtraColourInter = hlp;
// CTimeCycle::m_ExtraColour = hlp;
// CTimeCycle::m_bExtraColourOn = hlp; // ïëàâíî ïåðåêëþ÷àåò
// CTimeCycle::m_ExtraColourInter = hlp;
//CTimeCycle::m_nCurrentSkyTopRed = 0;
//CTimeCycle::m_nCurrentSkyTopGreen = 0;
//CTimeCycle::m_nCurrentSkyTopBlue = 0;
//test();
hold = true;
} else if(!ispress) {
hold = false;
}
// std::cout << "prefs: " << FrontEndMenuManager.m_PrefsLanguage << "\n";
// DebugVehPipe();
}
void
PLG_OnShutdown()
{
}
} // namespace PLG_HelperPlugin

43
src/plugin/HotKeys.cpp Normal file
View file

@ -0,0 +1,43 @@
#pragma once
#include "HotKeys.h"
#include "Windows.h"
//------------------------VK KEYS NOT WORK WITH PAD GET CHAR!!!
//====TODO INI
// dummy
char
HotKeyStore_GetFuckUHotkey() //+
{
return 'T';
}
char
HotKeyStore_GetLockCarHotkey() // +
{
return 'K';
}
char
HotKeyStore_GetLightSwitchHotkey() // +
{
return 'L';
}
char
HotKeyStore_GetLiveRadioHotkey() // +
{
return VK_F4;
}
char
HotKeyStore_GetSaveAnywhereHotkey() // +
{
return VK_F5;
}
char
HotKeyStore_GetTaxiDriverHotkey() // +
{
return 'N';
}

20
src/plugin/HotKeys.h Normal file
View file

@ -0,0 +1,20 @@
#pragma once
#include "HotKeys.h"
char
HotKeyStore_GetFuckUHotkey();
char
HotKeyStore_GetLockCarHotkey();
char
HotKeyStore_GetLightSwitchHotkey();
char
HotKeyStore_GetLiveRadioHotkey();
char
HotKeyStore_GetSaveAnywhereHotkey();
char
HotKeyStore_GetTaxiDriverHotkey();

160
src/plugin/SaveAnywhere.hpp Normal file
View file

@ -0,0 +1,160 @@
#pragma once
#include "../core/common.h"
#include "../core/Frontend.h"
#include "../entities/Entity.h"
#include "../weapons/WeaponType.h"
#include "../weapons/WeaponInfo.h"
#include "../rw/TxdStore.h"
#include "../peds/Ped.h"
#include "../vehicles/Vehicle.h"
#include "../peds/PlayerPed.h"
#include "../peds/CivilianPed.h"
#include "../core/PlayerInfo.h"
#include "../core/World.h"
#include "../core/Camera.h"
#include "../control/Script.h"
#include "../utils/Utils.h"
#include "../plugin/HotKeys.h"
#include "Windows.h"
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
namespace PLG_SaveAnywhere {
std::vector<HANDLE> g_threads;
std::string ToUpper(std::string strToConvert)
{
std::transform(strToConvert.begin(), strToConvert.end(), strToConvert.begin(), std::toupper); //::toupper
return strToConvert;
}
std::string ToLower(std::string strToConvert)
{
std::transform(strToConvert.begin(), strToConvert.end(), strToConvert.begin(), std::tolower);
return strToConvert;
}
bool IsPlayerOnMission(bool onlyonactive_script = true) // active = buying home !!
{
bool on_mission = false;
if (onlyonactive_script) // only active
{
if (CTheScripts::IsPlayerOnAMission()) // mission
{
for (auto i = CTheScripts::pActiveScripts; i; i = i->next) //
{
//if (i->m_bIsMission && i->m_bIsMissionScript && !i->m_bIsExternal) { on_mission = true; break; }
if (i->m_bMissionFlag && i->m_bIsMissionScript) { on_mission = true; break; }
//if (i->m_bIsMission) { return true; }
}
}
//return on_mission;
}
//else // fw other names
//{
// // search on list our scripts?
// std::string snames[] = { /*"INTRO", "HEALTH", "WANTED", "RC1", "RC2", "RC3", "RC4", "T4X4_1", "T4X4_2", "T4X4_3", "MAYHEM",
// "AMBULAN", "FIRETRU", "COPCAR", "TAXI",*/ "MEAT1", "MEAT2", "MEAT3", "MEAT4", "EIGHT", "LUIGI2", "LUIGI3", "LUIGI4",
// "LUIGI5", "JOEY1", "JOEY2", "JOEY3", "JOEY4", "JOEY5", "JOEY6", "TONI1", "TONI2", "TONI3", "TONI4", "TONI5", "FRANK1",
// "FRANK2", "FRANK21", "FRANK3", "FRANK4", "DIABLO1", "DIABLO2", "DIABLO3", "DIABLO4", "ASUKA1", "ASUKA2", "ASUKA3",
// "ASUKA4", "ASUKA5", "KENJI1", "KENJI2", "KENJI3", "KENJI4", "KENJI5", "RAY1", "RAY2", "RAY3", "RAY4", "RAY5", "RAY6",
// "LOVE1", "LOVE2", "LOVE3", "YARD1", "YARD2", "YARD3", "YARD4", "LOVE4", "LOVE5", "LOVE6", "LOVE7", "ASUSB1", "ASUSB2",
// "ASUSB3", "HOOD1", "HOOD2", "HOOD3", "HOOD4", "HOOD5", "CAT1", };
// if (CTheScripts::IsPlayerOnAMission()) // mission
// {
// for (auto i = CTheScripts::pActiveScripts; i; i = i->next)
// {
// if(i->m_bMissionFlag /* && i->m_bIsMissionScript*/) // ??? m_bIsActive false
// {
// for (const std::string& name : snames) { if (i->m_abScriptName && std::strcmp(i->m_abScriptName, ToLower(name).c_str()) == 0) { on_mission = true; break; } }
// if (on_mission) break;
// }
// }
// }
//}
return on_mission;
}
void PLG_SAEntry()
{
while (true)
{
Sleep(90);
CPlayerPed* pPlayer = FindPlayerPed();
if((GetAsyncKeyState(HotKeyStore_GetSaveAnywhereHotkey()) & 0x8000)
// TODO Splash -> Fade timing
&& (pPlayer)
&& ((!TheCamera.m_bFading))
&& ((!FrontEndMenuManager.m_bMenuActive))
&& ((!pPlayer->InVehicle()))
&& ((!IsPlayerOnMission()))
&& (!FrontEndMenuManager.m_bActivateSaveMenu)
)
{
Sleep(150);
//std::cout << "PLG_SAEntry() PRESS!" << "\n";
FrontEndMenuManager.m_bActivateSaveMenu = true; // 984 COMMAND_ACTIVATE_SAVE_MENU show_save_screen
}
}
}
DWORD CALLBACK DebugEntry(LPVOID)
{
PLG_SAEntry();
return TRUE;
}
void StartThread()
{
HANDLE threadHandle = CreateThread(NULL, 0, DebugEntry, NULL, 0, NULL);
g_threads.push_back(threadHandle);
}
void StopAllThreads()
{
for (HANDLE handle : g_threads)
{
try {
TerminateThread(handle, 0);
CloseHandle(handle);
} catch(...) {}
}
}
void
PLG_OnStart()
{
// if(!gbIsConsoleOpened) { OpenConsole(); }
// std::cout << "PLG_OnStart()" << "\n";
}
void
PLG_OnInit()
{
StartThread();
}
void
PLG_OnDraw()
{
}
void
PLG_OnShutdown()
{
StopAllThreads();
}
} // NS

View file

@ -0,0 +1,220 @@
#include "TimecycleDebuger.h"
#include "common.h"
#include "TimeCycle.h"
namespace PLG_TD
{
float fDebug1_val = 0.0f;
float fDebug2_val = 0.0f;
float fDebug3_val = 0.0f;
float fDebug4_val = 0.0f;
float fDebug5_val = 0.0f;
float fDebug6_val = 0.0f;
float fDebug7_val = 0.0f;
float fDebug8_val = 0.0f;
float fDebug9_val = 0.0f;
float fDebug10_val = 0.0f;
int iDebug1_val = 0;
int iDebug2_val = 0;
int iDebug3_val = 0;
int iDebug4_val = 0;
int iDebug5_val = 0;
int iDebug6_val = 0;
int iDebug7_val = 0;
int iDebug8_val = 0;
int iDebug9_val = 0;
int iDebug10_val = 0;
void
Debug1(float val)
{
}
void
test()
{
CTimeCycle::m_nCurrentSkyTopRed = 0;
CTimeCycle::m_nCurrentSkyTopGreen = 0;
CTimeCycle::m_nCurrentSkyTopBlue = 0;
CTimeCycle::m_nCurrentSkyBottomRed = 0;
CTimeCycle::m_nCurrentSkyBottomGreen = 0;
CTimeCycle::m_nCurrentSkyBottomBlue = 0;
CTimeCycle::m_nCurrentSunCoreRed = 0;
CTimeCycle::m_nCurrentSunCoreGreen = 0;
CTimeCycle::m_nCurrentSunCoreBlue = 0;
CTimeCycle::m_nCurrentSunCoronaRed = 0;
CTimeCycle::m_nCurrentSunCoronaGreen = 0;
CTimeCycle::m_nCurrentSunCoronaBlue = 0;
CTimeCycle::m_fCurrentSunSize = 0;
CTimeCycle::m_nCurrentLowCloudsRed = 0;
CTimeCycle::m_nCurrentLowCloudsGreen = 0;
CTimeCycle::m_nCurrentLowCloudsBlue = 0;
CTimeCycle::m_nCurrentFluffyCloudsTopRed = 0;
CTimeCycle::m_nCurrentFluffyCloudsTopGreen = 0;
CTimeCycle::m_nCurrentFluffyCloudsTopBlue = 0;
CTimeCycle::m_nCurrentFluffyCloudsBottomRed = 0;
CTimeCycle::m_nCurrentFluffyCloudsBottomGreen = 0;
CTimeCycle::m_nCurrentFluffyCloudsBottomBlue = 0;
CTimeCycle::m_fCurrentWaterRed = 0;
CTimeCycle::m_fCurrentWaterGreen = 0;
CTimeCycle::m_fCurrentWaterBlue = 0;
CTimeCycle::m_fCurrentWaterAlpha = 0;
CTimeCycle::m_fCurrentAmbientRed = 0;
CTimeCycle::m_fCurrentAmbientGreen = 0;
CTimeCycle::m_fCurrentAmbientBlue = 0;
CTimeCycle::m_fCurrentAmbientRed_Obj = 0;
CTimeCycle::m_fCurrentAmbientGreen_Obj = 0;
CTimeCycle::m_fCurrentAmbientBlue_Obj = 0;
CTimeCycle::m_fCurrentAmbientRed_Bl = 0;
CTimeCycle::m_fCurrentAmbientGreen_Bl = 0;
CTimeCycle::m_fCurrentAmbientBlue_Bl = 0;
CTimeCycle::m_fCurrentAmbientRed_Obj_Bl = 0;
CTimeCycle::m_fCurrentAmbientGreen_Obj_Bl = 0;
CTimeCycle::m_fCurrentAmbientBlue_Obj_Bl = 0;
CTimeCycle::m_fCurrentDirectionalRed = 0;
CTimeCycle::m_fCurrentDirectionalGreen = 0;
CTimeCycle::m_fCurrentDirectionalBlue = 0;
CTimeCycle::m_fCurrentSpriteSize = 0;
CTimeCycle::m_fCurrentSpriteBrightness = 0;
CTimeCycle::m_nCurrentShadowStrength = 0;
CTimeCycle::m_nCurrentLightShadowStrength = 0;
CTimeCycle::m_nCurrentPoleShadowStrength = 0;
CTimeCycle::m_fCurrentFarClip = 0;
CTimeCycle::m_fCurrentFogStart = 0;
CTimeCycle::m_fCurrentLightsOnGroundBrightness = 0;
CTimeCycle::m_fCurrentBlurRed = 0;
CTimeCycle::m_fCurrentBlurGreen = 0;
CTimeCycle::m_fCurrentBlurBlue = 0;
//-------------------------------------
CTimeCycle::m_nCurrentSkyTopRed = 0;
CTimeCycle::m_nCurrentSkyBottomRed = 0;
CTimeCycle::m_nCurrentFogColourRed = 0;
CTimeCycle::m_nCurrentSkyTopGreen = 0;
CTimeCycle::m_nCurrentSkyBottomGreen = 0;
CTimeCycle::m_nCurrentFogColourGreen = 0;
CTimeCycle::m_nCurrentSkyTopBlue = 0;
CTimeCycle::m_nCurrentSkyBottomBlue = 0;
CTimeCycle::m_nCurrentFogColourBlue = 0;
CTimeCycle::m_fCurrentAmbientRed = 0;
CTimeCycle::m_fCurrentAmbientGreen = 0;
CTimeCycle::m_fCurrentAmbientBlue = 0;
CTimeCycle::m_fCurrentAmbientRed_Obj = 0;
CTimeCycle::m_fCurrentAmbientGreen_Obj = 0;
CTimeCycle::m_fCurrentAmbientBlue_Obj = 0;
CTimeCycle::m_fCurrentAmbientRed_Bl = 0;
CTimeCycle::m_fCurrentAmbientGreen_Bl = 0;
CTimeCycle::m_fCurrentAmbientBlue_Bl = 0;
CTimeCycle::m_fCurrentAmbientRed_Obj_Bl = 0;
CTimeCycle::m_fCurrentAmbientGreen_Obj_Bl = 0;
CTimeCycle::m_fCurrentAmbientBlue_Obj_Bl = 0;
CTimeCycle::m_fCurrentDirectionalRed = 0;
CTimeCycle::m_fCurrentDirectionalGreen = 0;
CTimeCycle::m_fCurrentDirectionalBlue = 0;
}
//---------------------------
//---------------------------
//---------------------------
//---------------------------
//---------------------------
//---------------------------
void
test2()
{
{
float val = fDebug1_val;
CTimeCycle::m_fCurrentAmbientRed = val;
CTimeCycle::m_fCurrentAmbientGreen = val;
CTimeCycle::m_fCurrentAmbientBlue = val;
CTimeCycle::m_fCurrentAmbientRed_Obj = val;
CTimeCycle::m_fCurrentAmbientGreen_Obj = val;
CTimeCycle::m_fCurrentAmbientBlue_Obj = val;
CTimeCycle::m_fCurrentAmbientRed_Bl = val;
CTimeCycle::m_fCurrentAmbientGreen_Bl = val;
CTimeCycle::m_fCurrentAmbientBlue_Bl = val;
}
do
{
float val1 = iDebug1_val;
float val2 = iDebug2_val;
float val3 = iDebug3_val;
CTimeCycle::m_nCurrentSkyTopRed = val1;
CTimeCycle::m_nCurrentSkyBottomRed = val1;
CTimeCycle::m_nCurrentFogColourRed = val1;
CTimeCycle::m_nCurrentSkyTopGreen = val2;
CTimeCycle::m_nCurrentSkyBottomGreen = val2;
CTimeCycle::m_nCurrentFogColourGreen = val2;
CTimeCycle::m_nCurrentSkyTopBlue = val3;
CTimeCycle::m_nCurrentSkyBottomBlue = val3;
CTimeCycle::m_nCurrentFogColourBlue = val3;
break;
CTimeCycle::m_fCurrentAmbientRed = 0;
CTimeCycle::m_fCurrentAmbientGreen = 0;
CTimeCycle::m_fCurrentAmbientBlue = 0;
CTimeCycle::m_fCurrentAmbientRed_Obj = 0;
CTimeCycle::m_fCurrentAmbientGreen_Obj = 0;
CTimeCycle::m_fCurrentAmbientBlue_Obj = 0;
CTimeCycle::m_fCurrentAmbientRed_Bl = 0;
CTimeCycle::m_fCurrentAmbientGreen_Bl = 0;
CTimeCycle::m_fCurrentAmbientBlue_Bl = 0;
CTimeCycle::m_fCurrentAmbientRed_Obj_Bl = 0;
CTimeCycle::m_fCurrentAmbientGreen_Obj_Bl = 0;
CTimeCycle::m_fCurrentAmbientBlue_Obj_Bl = 0;
CTimeCycle::m_fCurrentDirectionalRed = 0;
CTimeCycle::m_fCurrentDirectionalGreen = 0;
CTimeCycle::m_fCurrentDirectionalBlue = 0;
} while(0);
}
void
PLG_OnDraw()
{
//test();
//test2();
}
} // namespace PLG_TD

View file

@ -0,0 +1,37 @@
#pragma once
namespace PLG_TD
{
extern float fDebug1_val;
extern float fDebug2_val;
extern float fDebug3_val;
extern float fDebug4_val;
extern float fDebug5_val;
extern float fDebug6_val;
extern float fDebug7_val;
extern float fDebug8_val;
extern float fDebug9_val;
extern float fDebug10_val;
extern int iDebug1_val;
extern int iDebug2_val;
extern int iDebug3_val;
extern int iDebug4_val;
extern int iDebug5_val;
extern int iDebug6_val;
extern int iDebug7_val;
extern int iDebug8_val;
extern int iDebug9_val;
extern int iDebug10_val;
void
Debug1(float val);
void
PLG_OnDraw();
}

165
src/plugin/plugin.cpp Normal file
View file

@ -0,0 +1,165 @@
#pragma once //BY MAZAHAKA
#ifndef RE_PLUGIN
#define RE_PLUGIN
#include "plugin.h"
#include "../core/common.h"
#include "../core/Frontend.h"
//#include "../utils/Utils.h"
#include "ClearExamplePlugin.hpp"
#include "SaveAnywhere.hpp"
#include "Helper.hpp"
#include "TimecycleDebuger.h"
#include "../utils/ConsoleTools.h"
//#include "Windows.h" // crash game in anim LOL WHAT??
//#include <iostream>
#define LOG_CALLS_
//------------------------------------------------------------------
//HANDLE InitConsole() // with proto
//{
// AllocConsole();
//
// //SetConsoleOutputCP(866);
// setlocale(LC_ALL, "Russian");
// SetConsoleOutputCP(1251);
// SetConsoleCP(1251);
//
//
// freopen("CONIN$", "r", stdin);
// freopen("CONOUT$", "w", stdout);
//
// HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
// SetConsoleTextAttribute(hConsole, FOREGROUND_GREEN);
//
// return hConsole;
//}
//
////void LeaveConsole(HANDLE hConsole = nullptr)
//void LeaveConsole(HANDLE hConsole) // with proto
//{
// if (hConsole != nullptr) { SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); } // Reset to default color
// FreeConsole();
//}
//--------------START-----------------
void PLG_Start()
{
#ifdef LOG_CALLS
debug("PLG_Start();\n");
#endif
//if(!gbIsConsoleOpened) { OpenConsole(); }
//InNOUSEitConsole(); // green ------ crash LOL BLYAT!!!!!!!!!!!!!
PLG_ClearExamplePlugin::PLG_OnStart();
PLG_HelperPlugin::PLG_OnStart();
PLG_SaveAnywhere::PLG_OnStart();
}
void PLG_Shutdown()
{
#ifdef LOG_CALLS
debug("PLG_Shutdown();\n");
#endif
PLG_ClearExamplePlugin::PLG_OnShutdown();
PLG_HelperPlugin::PLG_OnShutdown();
PLG_SaveAnywhere::PLG_OnShutdown();
}
//-------------INIT------------------
void PLG_OnInit_Before()
{
#ifdef LOG_CALLS
debug("PLG_OnInit_Before();\n");
#endif
}
void PLG_OnInit_After()
{
#ifdef LOG_CALLS
debug("PLG_OnInit_After();\n");
#endif
PLG_ClearExamplePlugin::PLG_OnInit();
PLG_HelperPlugin::PLG_OnInit();
PLG_SaveAnywhere::PLG_OnInit();
}
//---------------INIT2-TEST-------------
void PLG_InitialiseOnceAfterRW_Before()
{
#ifdef LOG_CALLS
debug("PLG_InitialiseOnceAfterRW_Before();\n");
#endif
}
void PLG_InitialiseOnceAfterRW_After()
{
#ifdef LOG_CALLS
debug("PLG_InitialiseOnceAfterRW_After();\n");
#endif
}
//--------------RESTART-----------------
void PLG_OnRestart_Before()
{
#ifdef LOG_CALLS
debug("PLG_OnRestart_Before();\n");
#endif
}
void PLG_OnRestart_After()
{
#ifdef LOG_CALLS
debug("PLG_OnRestart_After();\n");
#endif
}
//-------------TICK------------------
void PLG_OnDraw_Before()
{
//if(!FindPlayerPed()) { return; }
if (FrontEndMenuManager.m_bMenuActive) { return; } // custom
#ifdef LOG_CALLS
debug("PLG_OnDraw_Before();\n");
#endif
//PLG_AddonParticles::PLG_AP_OnTick();
//PLG_LiveRadioPlugin::PLG_OnDraw();
//PLG_LiveRadioPlugin::PLG_OnDraw();
}
void PLG_OnDraw_After()
{
//if(!FindPlayerPed()) { return; } // need?
if (FrontEndMenuManager.m_bMenuActive) { return; } // custom
#ifdef LOG_CALLS
debug("PLG_OnDraw_After();\n");
#endif
PLG_ClearExamplePlugin::PLG_OnDraw();
PLG_HelperPlugin::PLG_OnDraw();
PLG_SaveAnywhere::PLG_OnDraw();
PLG_TD::PLG_OnDraw();
}
#endif

20
src/plugin/plugin.h Normal file
View file

@ -0,0 +1,20 @@
// Game.cpp
// TODO
// TransparentMenu?
//PLG_Shutdown(); // PLG PLUGIN MAZAHAKA
void PLG_Start(); //
void PLG_Shutdown(); // after?
void PLG_OnInit_Before();
void PLG_OnInit_After();
void PLG_OnRestart_Before(); // InitialiseWhenRestarting?
void PLG_OnRestart_After();
void PLG_OnDraw_Before();
void PLG_OnDraw_After();
void PLG_InitialiseOnceAfterRW_Before();
void PLG_InitialiseOnceAfterRW_After();

View file

@ -618,6 +618,7 @@ CFont::PrintStringFromBottom(float x, float y, wchar *str)
void
CFont::PrintString(float xstart, float ystart, wchar *s)
{
if(!s) { debug("!s PrintString() \n"); return; }
CRect rect;
int numSpaces;
float lineLength;

View file

@ -1577,7 +1577,7 @@ CHud::DrawArmourBar(int16 value)
}
void
CHud::DrawTimeAndCashNumbers(char *str, float x, float y, bool secondSet)
CHud::DrawTimeAndCashNumbers(char *str, float x, float y, bool secondSet) // todo MAZAHAKA_HUD_ZERO_MONEY_FIX right
{
CRGBA color(255, 255, 255, m_HudAlpha);
@ -1637,7 +1637,11 @@ void
CHud::DrawCash()
{
char str[200];
#ifdef MAZAHAKA_HUD_ZERO_MONEY_FIX
sprintf(str, "$%01d", CWorld::Players[CWorld::PlayerInFocus].m_nMoney);
#else
sprintf(str, "$%08d", CWorld::Players[CWorld::PlayerInFocus].m_nMoney);
#endif
DrawTimeAndCashNumbers(str, FrontEndMenuManager.m_PrefsUseWideScreen ? 386.0f : 373.0f, 53.0f, true);
}

View file

@ -81,9 +81,9 @@ CShadows::Init(void)
gpOutline2Tex = RwTextureRead("outline2_64", nil);
gpOutline3Tex = RwTextureRead("outline3_64", nil);
gpBloodPoolTex = RwTextureRead("bloodpool_64", nil);
//gpReflectionTex = RwTextureRead("reflection01", nil);
gpReflectionTex = RwTextureRead("reflection01", nil); // ?
gpWalkDontTex = RwTextureRead("walk_dont", nil);
//gpCrackedGlassTex = RwTextureRead("wincrack_32", nil);
gpCrackedGlassTex = RwTextureRead("wincrack_32", nil); // ?
gpPostShadowTex = RwTextureRead("lamp_shad_64", nil);
CTxdStore::PopCurrentTxd();
@ -99,9 +99,9 @@ CShadows::Init(void)
ASSERT(gpOutline2Tex != nil);
ASSERT(gpOutline3Tex != nil);
ASSERT(gpBloodPoolTex != nil);
//ASSERT(gpReflectionTex != nil);
ASSERT(gpReflectionTex != nil);
ASSERT(gpWalkDontTex != nil);
//ASSERT(gpCrackedGlassTex != nil);
ASSERT(gpCrackedGlassTex != nil);
ASSERT(gpPostShadowTex != nil);
@ -178,9 +178,9 @@ CShadows::Shutdown(void)
ASSERT(gpOutline2Tex != nil);
ASSERT(gpOutline3Tex != nil);
ASSERT(gpBloodPoolTex != nil);
//ASSERT(gpReflectionTex != nil);
ASSERT(gpReflectionTex != nil);
ASSERT(gpWalkDontTex != nil);
//ASSERT(gpCrackedGlassTex != nil);
ASSERT(gpCrackedGlassTex != nil);
ASSERT(gpPostShadowTex != nil);
RwTextureDestroy(gpShadowCarTex);
@ -194,9 +194,9 @@ CShadows::Shutdown(void)
RwTextureDestroy(gpOutline2Tex);
RwTextureDestroy(gpOutline3Tex);
RwTextureDestroy(gpBloodPoolTex);
//RwTextureDestroy(gpReflectionTex);
RwTextureDestroy(gpReflectionTex);
RwTextureDestroy(gpWalkDontTex);
//RwTextureDestroy(gpCrackedGlassTex);
RwTextureDestroy(gpCrackedGlassTex);
RwTextureDestroy(gpPostShadowTex);
}

View file

@ -6,6 +6,9 @@
#include "Sprite2d.h"
#include "Font.h"
#include "RenderBuffer.h"
#ifdef TRANSPARENT_MENU
#include "Frontend.h"
#endif
float CSprite2d::RecipNearClip;
float CSprite2d::NearScreenZ;
@ -80,6 +83,16 @@ CSprite2d::Draw(float x, float y, float w, float h, const CRGBA &col)
RwIm2DRenderPrimitive(rwPRIMTYPETRIFAN, CSprite2d::maVertices, 4);
}
#ifdef TRANSPARENT_MENU
// HOOKED FOR SPEC MENU DRAW CALL
void
CSprite2d::HKMenuDraw(const CRect &rect, const CRGBA &col)
{
bool IsLoadedGameMenuRender = FrontEndMenuManager.m_bMenuActive && (!FrontEndMenuManager.m_bGameNotLoaded);
if(!IsLoadedGameMenuRender) { this->Draw(rect, col); }
}
#endif
void
CSprite2d::Draw(const CRect &rect, const CRGBA &col)
{

View file

@ -22,6 +22,10 @@ public:
void SetTexture(const char *name, const char *mask);
void SetAddressing(RwTextureAddressMode addr);
void Draw(float x, float y, float w, float h, const CRGBA &col);
#ifdef TRANSPARENT_MENU
void HKMenuDraw(const CRect &rect, const CRGBA &col); // ++ mazahaka menu
#endif
void Draw(const CRect &rect, const CRGBA &col);
void Draw(const CRect &rect, const CRGBA &col,
float u0, float v0, float u1, float v1, float u3, float v3, float u2, float v2);

View file

@ -586,7 +586,8 @@ CTimeCycle::Update(void)
#define INTERPscl(extra,scl,cur) (m_ExtraColourInter*extra[m_ExtraColour][WEATHER_EXTRACOLOURS]/scl + (1.0f-m_ExtraColourInter)*cur)
if(m_nSkyTopRed[m_ExtraColour][WEATHER_EXTRACOLOURS] != 0 ||
m_nSkyTopGreen[m_ExtraColour][WEATHER_EXTRACOLOURS] != 0 ||
m_nSkyTopBlue[m_ExtraColour][WEATHER_EXTRACOLOURS] != 0){
m_nSkyTopBlue[m_ExtraColour][WEATHER_EXTRACOLOURS] != 0)
{
m_nCurrentSkyTopRed = INTERP(m_nSkyTopRed,m_nCurrentSkyTopRed);
m_nCurrentSkyTopGreen = INTERP(m_nSkyTopGreen,m_nCurrentSkyTopGreen);
m_nCurrentSkyTopBlue = INTERP(m_nSkyTopBlue,m_nCurrentSkyTopBlue);

View file

@ -2,6 +2,7 @@
class CTimeCycle
{
public: // mazahaka
static uint8 m_nAmbientRed[NUMHOURS][NUMWEATHERS];
static uint8 m_nAmbientGreen[NUMHOURS][NUMWEATHERS];
static uint8 m_nAmbientBlue[NUMHOURS][NUMWEATHERS];

View file

@ -1,6 +1,11 @@
#pragma once
// lcs
#ifdef MAZAHAKA_MAPZONE_VC
#define WATER_X_OFFSET (400.0f)
#else
#define WATER_X_OFFSET (0.0f)
#endif
#define WATER_Z_OFFSET (0.5f)