Lean stuff (unfinished)
This commit is contained in:
parent
f6410370ac
commit
3e9d5779ca
2
deps/fmt
vendored
2
deps/fmt
vendored
@ -1 +1 @@
|
||||
Subproject commit 2bf59a97c6e65e4963913d9ba2f8d260e5c8fbf5
|
||||
Subproject commit f19d8f9655d550234f19c6c1f5a99c7eda798c0e
|
2
deps/mongoose
vendored
2
deps/mongoose
vendored
@ -1 +1 @@
|
||||
Subproject commit 8cdd19bcaed7f503de7902804d0d96ce51e95a34
|
||||
Subproject commit ff159bf30ac1a213c3dd0b0714c7cd07db616ad2
|
2
deps/protobuf
vendored
2
deps/protobuf
vendored
@ -1 +1 @@
|
||||
Subproject commit 4763e64eb1e72e628ab75a9872f4146fdd2cf765
|
||||
Subproject commit e3891655868a465ad0d17ddc2b1ea95dd0a39adf
|
@ -12,6 +12,7 @@ namespace Components
|
||||
Loader::Register(new Auth());
|
||||
Loader::Register(new Bans());
|
||||
Loader::Register(new Dvar());
|
||||
Loader::Register(new Lean());
|
||||
Loader::Register(new Maps());
|
||||
Loader::Register(new News());
|
||||
Loader::Register(new Node());
|
||||
|
@ -30,6 +30,7 @@ namespace Components
|
||||
#include "Modules\Auth.hpp"
|
||||
#include "Modules\Bans.hpp"
|
||||
#include "Modules\Dvar.hpp"
|
||||
#include "Modules\Lean.hpp"
|
||||
#include "Modules\Maps.hpp"
|
||||
#include "Modules\News.hpp"
|
||||
#include "Modules\Flags.hpp"
|
||||
|
@ -30,6 +30,8 @@ namespace Components
|
||||
const char* GetName() { return "Command"; };
|
||||
#endif
|
||||
|
||||
static Game::cmd_function_t* Allocate();
|
||||
|
||||
static void Add(const char* name, Callback* callback);
|
||||
static void AddSV(const char* name, Callback* callback);
|
||||
static void AddRaw(const char* name, void(*callback)());
|
||||
@ -43,7 +45,6 @@ namespace Components
|
||||
static std::map<std::string, wink::slot<Callback>> FunctionMap;
|
||||
static std::map<std::string, wink::slot<Callback>> FunctionMapSV;
|
||||
|
||||
static Game::cmd_function_t* Allocate();
|
||||
static void MainCallback();
|
||||
static void MainCallbackSV();
|
||||
};
|
||||
|
38
src/Components/Modules/Lean.cpp
Normal file
38
src/Components/Modules/Lean.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
#include "STDInclude.hpp"
|
||||
|
||||
namespace Components
|
||||
{
|
||||
Game::kbutton_t Lean::in_leanleft;
|
||||
Game::kbutton_t Lean::in_leanright;
|
||||
|
||||
void Lean::IN_LeanLeft_Up()
|
||||
{
|
||||
Game::IN_KeyUp(&Lean::in_leanleft);
|
||||
}
|
||||
|
||||
void Lean::IN_LeanLeft_Down()
|
||||
{
|
||||
Game::IN_KeyDown(&Lean::in_leanleft);
|
||||
}
|
||||
|
||||
void Lean::IN_LeanRight_Up()
|
||||
{
|
||||
Game::IN_KeyUp(&Lean::in_leanright);
|
||||
}
|
||||
|
||||
void Lean::IN_LeanRight_Down()
|
||||
{
|
||||
Game::IN_KeyDown(&Lean::in_leanright);
|
||||
}
|
||||
|
||||
Lean::Lean()
|
||||
{
|
||||
Game::Cmd_AddCommand("+leanleft", Lean::IN_LeanLeft_Down, Command::Allocate(), 1);
|
||||
Game::Cmd_AddCommand("-leanleft", Lean::IN_LeanLeft_Up, Command::Allocate(), 1);
|
||||
|
||||
Game::Cmd_AddCommand("+leanright", Lean::IN_LeanRight_Down, Command::Allocate(), 1);
|
||||
Game::Cmd_AddCommand("-leanright", Lean::IN_LeanRight_Up, Command::Allocate(), 1);
|
||||
|
||||
// TODO: Transmit correct button flags in CL_CmdButtons and more?
|
||||
}
|
||||
}
|
22
src/Components/Modules/Lean.hpp
Normal file
22
src/Components/Modules/Lean.hpp
Normal file
@ -0,0 +1,22 @@
|
||||
namespace Components
|
||||
{
|
||||
class Lean : public Component
|
||||
{
|
||||
public:
|
||||
Lean();
|
||||
|
||||
#ifdef DEBUG
|
||||
const char* GetName() { return "Lean"; };
|
||||
#endif
|
||||
|
||||
private:
|
||||
static Game::kbutton_t in_leanleft;
|
||||
static Game::kbutton_t in_leanright;
|
||||
|
||||
static void IN_LeanLeft_Up();
|
||||
static void IN_LeanLeft_Down();
|
||||
|
||||
static void IN_LeanRight_Up();
|
||||
static void IN_LeanRight_Down();
|
||||
};
|
||||
}
|
@ -430,4 +430,28 @@ namespace Game
|
||||
{
|
||||
Game::SV_GameSendServerCommand(clientNum, 0, Utils::String::VA("%c \"%s\"", 0x67, message.data()));
|
||||
}
|
||||
|
||||
void IN_KeyUp(kbutton_t* button)
|
||||
{
|
||||
__asm
|
||||
{
|
||||
push esi
|
||||
mov esi, button
|
||||
mov eax, 5A5580h
|
||||
call eax
|
||||
pop esi
|
||||
}
|
||||
}
|
||||
|
||||
void IN_KeyDown(kbutton_t* button)
|
||||
{
|
||||
__asm
|
||||
{
|
||||
push esi
|
||||
mov esi, button
|
||||
mov eax, 5A54E0h
|
||||
call eax
|
||||
pop esi
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ namespace Game
|
||||
typedef void(__cdecl * CL_SelectStringTableEntryInDvar_f_t)();
|
||||
extern CL_SelectStringTableEntryInDvar_f_t CL_SelectStringTableEntryInDvar_f;
|
||||
|
||||
typedef void(__cdecl * Cmd_AddCommand_t)(const char* name, void(*callback), cmd_function_t* data, char);
|
||||
typedef void(__cdecl * Cmd_AddCommand_t)(const char* cmdName, void(*function), cmd_function_t* allocedCmd, char);
|
||||
extern Cmd_AddCommand_t Cmd_AddCommand;
|
||||
|
||||
typedef void(__cdecl * Cmd_AddServerCommand_t)(const char* name, void(*callback), cmd_function_t* data);
|
||||
@ -512,4 +512,7 @@ namespace Game
|
||||
|
||||
void Scr_iPrintLn(int clientNum, std::string message);
|
||||
void Scr_iPrintLnBold(int clientNum, std::string message);
|
||||
|
||||
void IN_KeyUp(kbutton_t* button);
|
||||
void IN_KeyDown(kbutton_t* button);
|
||||
}
|
||||
|
@ -136,9 +136,20 @@ namespace Game
|
||||
const char *autoCompleteDir;
|
||||
const char *autoCompleteExt;
|
||||
void(__cdecl *function)();
|
||||
int pad;
|
||||
int unknown;
|
||||
} cmd_function_t;
|
||||
|
||||
#pragma pack(push, 4)
|
||||
struct kbutton_t
|
||||
{
|
||||
int down[2];
|
||||
unsigned int downtime;
|
||||
unsigned int msec;
|
||||
bool active;
|
||||
bool wasPressed;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char type;
|
||||
|
Loading…
Reference in New Issue
Block a user