Skip to content

Commit

Permalink
fix character transform
Browse files Browse the repository at this point in the history
fix ui
  • Loading branch information
aaronkirkham committed Jan 2, 2019
1 parent 1d32a2f commit 38b452b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 45 deletions.
4 changes: 1 addition & 3 deletions src/commands/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class EventCommand : public ICommand
{
public:
std::array<const char*, 15> m_Hints = {
std::array<const char*, 13> m_Hints = {
"__showfps",
"__reload_world",
"ply.invulnerable",
Expand All @@ -16,8 +16,6 @@ class EventCommand : public ICommand
"ply.pause",
"ply.unpause",
"ply.vehicle.burn",
"moon_gravity_on",
"moon_gravity_off",
"debug.vehicle.incrementtint",
"vocals.rico.enable",
"vocals.rico.disable",
Expand Down
4 changes: 0 additions & 4 deletions src/commands/spawn.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ class SpawnCommand : public ICommand
auto transform = local_player->m_character->m_transform;
auto &aimpos = local_player->m_aimControl->m_aimPos;

transform.m[1].x = 0.0f;
transform.m[1].y = 1.0f;
transform.m[1].z = 0.0f;

transform.m[3].x = aimpos.x;
transform.m[3].y = aimpos.y + 1.0f;
transform.m[3].z = aimpos.z;
Expand Down
2 changes: 1 addition & 1 deletion src/game/character.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace jc
class CCharacter
{
public:
char _pad[0x2828];
char _pad[0x2830];
CMatrix4f m_transform;
};
}; // namespace jc
Expand Down
28 changes: 3 additions & 25 deletions src/game/ui_manager.h
Original file line number Diff line number Diff line change
@@ -1,41 +1,19 @@
#pragma once

#include <cstdint>

#pragma pack(push, 1)
namespace jc
{
class CUIBase
{
public:
char _pad[0x140];
uint8_t m_state;
char _pad2[0x7];
std::string m_name;
uint32_t m_nameHash;
};

class CUIManager
{
public:
static CUIManager& instance()
{
return **(CUIManager**)0x142A630F8;
}

CUIBase* GetUI(uint32_t name_hash)
{
auto it = std::find_if(m_uis.begin(), m_uis.end(),
[name_hash](const CUIBase* ui) { return ui->m_nameHash == name_hash; });
return (it != m_uis.end()) ? (*it) : nullptr;
return **(CUIManager**)0x142E2B700;
}

public:
char _pad[0x29A];
bool m_enabled;
bool m_debugTextEnabled;
char _pad2[0xCC];
std::vector<CUIBase*> m_uis;
char _pad[0x213];
bool m_active;
};
}; // namespace jc
#pragma pack(pop)
15 changes: 3 additions & 12 deletions src/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,10 @@ void Input::EnableInput(bool toggle)
m_selectedHint = -1;
m_hintPage = 0;

#if 0
// toggle hud which might get in the way (bottomleft)
auto &ui_manager = jc::CUIManager::instance();
auto hud_vehicle = ui_manager.GetUI(0x8AC05ABA);
auto hud_bottom_left = ui_manager.GetUI(0x5F62FEDF);

if (hud_vehicle && hud_bottom_left) {
hud_vehicle->m_state = toggle ? 1 : 2;
hud_bottom_left->m_state = toggle ? 1 : 2;
}
#endif
// toggle hud
jc::CUIManager().instance().m_active = !toggle;

// freeze input
// freeze input
*(bool *)((char *)input_thingy + 0x70) = !toggle;
}

Expand Down

0 comments on commit 38b452b

Please sign in to comment.