Skip to content

Commit

Permalink
Updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Danilo1301 committed Dec 24, 2024
1 parent d89df55 commit f369e80
Show file tree
Hide file tree
Showing 17 changed files with 61 additions and 27 deletions.
20 changes: 9 additions & 11 deletions GiroflexVSL/Mod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ extern RpClump* (*RpClumpForAllAtomics)(RpClump* clump, RpAtomicCallBack callbac
extern RpGeometry* (*RpGeometryForAllMaterials)(RpGeometry* geometry, RpMaterialCallBack fpCallBack, void* pData);
extern char* (*GetFrameNodeName)(RwFrame* frame);

const char* Mod::m_Version = "3.9.0";
const char* Mod::m_Version = "3.9.1";

bool canTurnSirenOn = true;
bool canTurnPanelOn = true;
Expand All @@ -35,6 +35,8 @@ Vehicle* testedVehicle = NULL;

void Mod::Update(int dt)
{
Log::Level(LOG_LEVEL::LOG_UPDATE) << "* Mod.Update" << std::endl;

while (Draw::m_DrawItems.size() > 0)
{
auto dw = Draw::m_DrawItems[0];
Expand All @@ -44,7 +46,7 @@ void Mod::Update(int dt)

//

Log::Level(LOG_LEVEL::LOG_UPDATE) << "> Vehicles --------------" << std::endl;
Log::Level(LOG_LEVEL::LOG_UPDATE) << "Vehicles" << std::endl;

Vehicles::TryFindNewVehicles();

Expand Down Expand Up @@ -106,30 +108,26 @@ void Mod::Update(int dt)
}
}

//Log::Level(LOG_LEVEL::LOG_UPDATE) << "SoundPanelSystem" << std::endl;

//SoundPanelSystem::Update(dt);

Log::Level(LOG_LEVEL::LOG_UPDATE) << "> Menu" << std::endl;
Log::Level(LOG_LEVEL::LOG_UPDATE) << "Menu" << std::endl;

Menu::Update(dt);

Log::Level(LOG_LEVEL::LOG_UPDATE) << "> WindowSettings" << std::endl;
Log::Level(LOG_LEVEL::LOG_UPDATE) << "WindowSettings/SoundPanel" << std::endl;

WindowSettings::Update(dt);
WindowSettings::Draw();

Log::Level(LOG_LEVEL::LOG_UPDATE) << "> WindowSoundPanel" << std::endl;

WindowSoundPanel::Draw();
WindowSoundPanel::Update(dt);

WindowPanel::Update();
WindowPanel::Draw();

Menu::Draw();
Log::Level(LOG_LEVEL::LOG_UPDATE) << "Menu/Input/Widgets" << std::endl;

Log::Level(LOG_LEVEL::LOG_UPDATE) << "> Input" << std::endl;
Menu::Draw();

Input::Update(dt);
Widgets::Update(dt);
Expand Down Expand Up @@ -177,7 +175,7 @@ void Mod::Update(int dt)
Menu::ShowCredits(6, 5000);
}

Log::Level(LOG_LEVEL::LOG_UPDATE) << "> end" << std::endl;
Log::Level(LOG_LEVEL::LOG_UPDATE) << "* Mod.Update end" << std::endl;
}

void Mod::ProcessMenuButtons(int dt)
Expand Down
2 changes: 2 additions & 0 deletions GiroflexVSL/ModConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ void ModConfig::SaveSettings()
soundPanelSection->AddIntFromBool("allow_multiple_sound", WindowSoundPanel::m_allowMultipleSounds);
soundPanelSection->AddIntFromBool("show_on_enter_vehicle", WindowSoundPanel::m_showOnEnterVehicle);
soundPanelSection->AddIntFromBool("show_button_toggle_lights", WindowSoundPanel::m_showButtonToggleLights);
soundPanelSection->AddIntFromBool("turn_off_siren_when_leave_car", WindowSoundPanel::m_turnOffSirenWhenLeaveCar);
soundPanelSection->AddCRGBA("button_color", WindowSoundPanel::m_buttonDefaultColor);
soundPanelSection->AddCRGBA("button_active_color", WindowSoundPanel::m_buttonActiveColor);
soundPanelSection->AddCRGBA("button_outline_color", WindowSoundPanel::m_buttonOutlineColor);
Expand Down Expand Up @@ -354,6 +355,7 @@ void ModConfig::LoadSettings()
soundPanelSection->GetBoolFromInt("allow_multiple_sound", &WindowSoundPanel::m_allowMultipleSounds);
soundPanelSection->GetBoolFromInt("show_on_enter_vehicle", &WindowSoundPanel::m_showOnEnterVehicle);
soundPanelSection->GetBoolFromInt("show_button_toggle_lights", &WindowSoundPanel::m_showButtonToggleLights);
soundPanelSection->GetBoolFromInt("turn_off_siren_when_leave_car", &WindowSoundPanel::m_turnOffSirenWhenLeaveCar);
soundPanelSection->GetCRGBA("button_color", &WindowSoundPanel::m_buttonDefaultColor);
soundPanelSection->GetCRGBA("button_active_color", &WindowSoundPanel::m_buttonActiveColor);
soundPanelSection->GetCRGBA("button_outline_color", &WindowSoundPanel::m_buttonOutlineColor);
Expand Down
2 changes: 1 addition & 1 deletion GiroflexVSL/Point.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class Point {
Json::Value rotateObjectValue = value["rotateObject"];
if(!rotateObjectValue.isNull())
{
rotateObject.speed = ValidateValue(rotateObjectValue["speed"], rotateObject.speed).asInt();
rotateObject.speed = ValidateValue(rotateObjectValue["speed"], rotateObject.speed).asFloat();
rotateObject.object = ValidateValue(rotateObjectValue["object"], rotateObject.object).asString();
rotateObject.axis = (eRotateObjectAxis)ValidateValue(rotateObjectValue["axis"], (int)rotateObject.axis).asInt();
rotateObject.rotateAlways = ValidateValue(rotateObjectValue["rotateAlways"], rotateObject.rotateAlways).asBool();
Expand Down
13 changes: 12 additions & 1 deletion GiroflexVSL/SirenSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include "Vehicles.h"
#include "Widgets.h"

#include "windows/WindowSoundPanel.h"

#include "iniconfig/INIFile.h"

std::string SirenSystem::m_DefaultGroupId = "";
Expand Down Expand Up @@ -456,9 +458,18 @@ void SirenSystem::Update(int dt)
}
}

if(!SirenSystem::ModelIdHasSirenGroup(modelId)) return;
//boomark1
if(WindowSoundPanel::m_turnOffSirenWhenLeaveCar)
{
if(vehicle->pDriver == NULL && sirenState)
{
ToggleSiren(false);
}
}

/*
//if(!SirenSystem::ModelIdHasSirenGroup(modelId)) return;
auto siren = sirens[0];
if(siren->GetState() == -1)
{
Expand Down
20 changes: 15 additions & 5 deletions GiroflexVSL/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// ---------------------------------------

//MYMODCFG(net.danilo1301.giroflexVSL, GiroflexVSL, Mod::m_Version, Danilo1301) //whoops
MYMODCFG(net.danilo1301.giroflexVSL, GiroflexVSL, 3.9.0, Danilo1301)
MYMODCFG(net.danilo1301.giroflexVSL, GiroflexVSL, 3.9.1, Danilo1301)

// ---------------------------------------

Expand Down Expand Up @@ -101,6 +101,8 @@ void SaveCfg()

DECL_HOOK(void*, UpdateGameLogic, uintptr_t a1)
{
Log::Level(LOG_LEVEL::LOG_UPDATE) << "UpdateGameLogic" << std::endl;

if(BASS) {
soundsys->Update();
}
Expand All @@ -112,16 +114,22 @@ DECL_HOOK(void*, UpdateGameLogic, uintptr_t a1)
vehicle->OnUpdateGameLogic();
}

Log::Level(LOG_LEVEL::LOG_UPDATE) << "UpdateGameLogic end" << std::endl;

return UpdateGameLogic(a1);
}

DECL_HOOKv(RenderVehicle, void* self)
{
Log::Level(LOG_LEVEL::LOG_UPDATE) << "RenderVehicle" << std::endl;

CVehicle* vehicle = (CVehicle*)self;

Vehicles::RenderBefore(vehicle);
RenderVehicle(self);
Vehicles::RenderAfter(vehicle);

Log::Level(LOG_LEVEL::LOG_UPDATE) << "RenderVehicle end" << std::endl;
}

#include "sdk/Image.h"
Expand Down Expand Up @@ -206,11 +214,11 @@ unsigned short* textGxt = new unsigned short[0xFF];

CSprite2d sprite;

DECL_HOOKv(CHud_Draw, void* self)
{
//DECL_HOOKv(CHud_Draw, void* self)
//{
//Log::Level(LOG_LEVEL::LOG_BOTH) << "CHud_Draw" << std::endl;

CHud_Draw(self);
//CHud_Draw(self);

/*
CSprite2d_DrawRect(CRect(300, 300, 400, 400), CRGBA(0, 0, 255));
Expand All @@ -235,7 +243,7 @@ DECL_HOOKv(CHud_Draw, void* self)
CFont_PrintString(300, 300, textGxt);
RenderFontBuffer();
*/
}
//}


//
Expand Down Expand Up @@ -346,6 +354,8 @@ void LoadSymbols()
HOOKPLT(UpdateGameLogic, gameAddr + 0x66FE58);

HOOK(RenderVehicle, aml->GetSym(hGTASA, "_ZN8CVehicle6RenderEv"));


//HOOK(CHud_Draw, aml->GetSym(hGTASA, "_ZN4CHud4DrawEv"));

//
Expand Down
1 change: 1 addition & 0 deletions GiroflexVSL/windows/WindowSoundPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ std::vector<AudioStreamData> WindowSoundPanel::m_audioStreamData;
bool WindowSoundPanel::m_allowMultipleSounds = false;
bool WindowSoundPanel::m_showOnEnterVehicle = true;
bool WindowSoundPanel::m_showButtonToggleLights = true;
bool WindowSoundPanel::m_turnOffSirenWhenLeaveCar = false;
CRGBA WindowSoundPanel::m_buttonDefaultColor = { 109, 167, 100, 255 };
CRGBA WindowSoundPanel::m_buttonActiveColor = { 255, 131, 131, 255 };
CRGBA WindowSoundPanel::m_buttonOutlineColor = { 46, 77, 51, 255 };
Expand Down
1 change: 1 addition & 0 deletions GiroflexVSL/windows/WindowSoundPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class WindowSoundPanel {
static bool m_allowMultipleSounds;
static bool m_showOnEnterVehicle;
static bool m_showButtonToggleLights;
static bool m_turnOffSirenWhenLeaveCar;
static CRGBA m_buttonDefaultColor;
static CRGBA m_buttonActiveColor;
static CRGBA m_buttonOutlineColor;
Expand Down
2 changes: 2 additions & 0 deletions GiroflexVSL/windows/WindowSoundPanelSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ void WindowSoundPanelSettings::Create()

window->AddCheckbox(87, &WindowSoundPanel::m_showButtonToggleLights);

window->AddCheckbox(115, &WindowSoundPanel::m_turnOffSirenWhenLeaveCar);

auto button_position = window->AddButton(9);
button_position->onClick = [window]() {
Menu::AddPosition2DWindow(window, &WindowSoundPanel::m_position, -10000.0f, 10000.0f, 0.5f, []() {
Expand Down
Binary file modified cleo/giroflex v3/GiroflexVSL.csa
Binary file not shown.
5 changes: 3 additions & 2 deletions cleo/giroflex v3/GiroflexVSL.fxt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ DGFX2 ~1~, ~1~
DGFX3 ~1~, ~1~, ~1~
DGFX4 <
DGFX5 >
DGFX6 Giroflex VSL v3.9.0 (by ~y~Danilo1301~w~)
DGFX6 Giroflex VSL v3.9.1 (by ~y~Danilo1301~w~)
DGFX7 Fechar
DGFX8 Voltar
DGFX9 Editar posicao
Expand Down Expand Up @@ -111,4 +111,5 @@ DGFX110 Direcao das luzes
DGFX111 FRENTE
DGFX112 AMBOS
DGFX113 TRAS
DGFX114 LADOS
DGFX114 LADOS
DGFX115 Desligar sirene ao sair
14 changes: 9 additions & 5 deletions cleo/giroflex v3/GiroflexVSL.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const

VAR_DeltaTime = 29@

Clock = 30@
CurrClock = 30@
PrevClock = 31@

VAR_VelX = 32@
Expand All @@ -129,7 +129,7 @@ var
MenuOffsetX : Float = 0.0

PrevClock : Int = 0
Clock : Int = 0
CurrClock: Int = 0

VAR_DeltaTime : Int = 0

Expand Down Expand Up @@ -387,13 +387,13 @@ return

VAR_Integer1 = 1

01BD: Clock = current_time_in_ms
01BD: CurrClock = current_time_in_ms

if PrevClock == Clock
if PrevClock == CurrClock
then
else
VAR_Integer1 = 0
VAR_Integer1 = Clock
VAR_Integer1 = CurrClock
VAR_Integer1 -= PrevClock
VAR_DeltaTime = VAR_Integer1
01BD: PrevClock = current_time_in_ms
Expand Down Expand Up @@ -1114,4 +1114,8 @@ if VAR_GxtId == 114
then
VAR_STR_1 = "DGFX114"
end
if VAR_GxtId == 115
then
VAR_STR_1 = "DGFX115"
end
return
5 changes: 3 additions & 2 deletions cleo/giroflex v3/GiroflexVSL_en.fxt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ DGFX2 ~1~, ~1~
DGFX3 ~1~, ~1~, ~1~
DGFX4 <
DGFX5 >
DGFX6 Giroflex VSL v3.9.0 (by ~y~Danilo1301~w~)
DGFX6 Giroflex VSL v3.9.1 (by ~y~Danilo1301~w~)
DGFX7 Close
DGFX8 Back
DGFX9 Edit position
Expand Down Expand Up @@ -111,4 +111,5 @@ DGFX110 Lights direction
DGFX111 FRONT
DGFX112 BOTH
DGFX113 BACK
DGFX114 SIDES
DGFX114 SIDES
DGFX115 Turn off siren on exit
Binary file modified files/versions/3.9.0/GiroflexVSL-3.9.0__en.zip
Binary file not shown.
Binary file modified files/versions/3.9.0/GiroflexVSL-3.9.0__pt-br.zip
Binary file not shown.
Binary file added files/versions/3.9.1/GiroflexVSL-3.9.1__en.zip
Binary file not shown.
Binary file added files/versions/3.9.1/GiroflexVSL-3.9.1__pt-br.zip
Binary file not shown.
3 changes: 3 additions & 0 deletions info.txt
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@ OBS: I also found a bug that detects a lightpanel button press before the panel
[3.9.0]
[X] ADD: lights rotate with object

[3.9.1]
[X] ADD: option to disable siren when leaving car

[ ] BUG: delay nas luzes q giram, acho q to pegando posição errada do objectWorldPosition

-----------------------
Expand Down

0 comments on commit f369e80

Please sign in to comment.