Skip to content

Commit

Permalink
Merge pull request #73 from AlphaKeks/refactor
Browse files Browse the repository at this point in the history
Replace CRLF with LF
  • Loading branch information
AlphaKeks authored Jan 3, 2024
2 parents 261d1e1 + 6336f6b commit 70868ff
Show file tree
Hide file tree
Showing 47 changed files with 5,548 additions and 5,539 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# https://editorconfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = tab
196 changes: 98 additions & 98 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,98 +1,98 @@
WIP

Protobuf compiler and most utils stuff is based on [CS2Fixes](https://github.com/Source2ZE/CS2Fixes/)

TODO list: (italic means I'm working on it)

Utilities:
- [x] Print functions (chat, alert, center)
- [x] Add functionalities to MovementPlayer class
- [x] Add chat listener
- [ ] *Add commands to chat listener*

KZ-specific:
- [ ] General
- [x] Extends MovementPlayer to KZPlayer
- [x] Add MovementAPI stuff with callback registering for KZ modules
- [x] Disable player collisions
- [ ] Player transparency
- [x] Make players invincible
- [ ] Gameplay
- [ ] Add MOD (requires finished CVar RE)
- [ ] Buff jump height to 128t values
- [ ] Interpolate 64t AA to 128
- [ ] Disable subticks (maybe)
- [ ] Add mode toggling
- [ ] !ssp
- [x] Checkpoints
- [x] Add basic checkpoints
- [x] Add ladder checkpoints
- [ ] Timers
- [x] Trigger touching logic
- [ ] *Jumpstats*
- [x] Distbug
- [x] Split jump types
- [ ] *Console print*
- [ ] HUD
- [x] Speed panel
- [x] Add prespeed and keys
- [x] Add print to the top center bar (with game events)
- [ ] TP Menu (impossible...?)
- [ ] Quiet
- [ ] !hide
- [x] Hide player models
- [ ] Hide player sounds
- [ ] Sound volumes
- [ ] !goto
- [ ] !measure
- [ ] Trace functionalities
- [ ] Draw beams for clients
- [ ] Paint
- [ ] Add welcome message and help commands
- [ ] Saveloc
- [ ] Local DB/Ranks
- [ ] Global integration (if API exists)
- [ ] HTTP Requests
- [ ] UDP listener (partially done)
- [x] Add linux sigs
- [ ] Docs
- [ ] Code style (different naming schemes for RE structs, sdk, third party libs, project code)
Requirements: Metamod plugin

Compilation:
- Remember to *recursively* clone the plugin!
- [AMBuild](https://github.com/alliedmodders/ambuild/) needs to be installed for compilation.

- For each platform:

Windows (ambuild/msvc):
```
mkdir build
cd build
python3 ../configure.py
ambuild
```

For windows debugging with VS, build the project then add the following command at the end:
```
python3 ../configure.py --gen=vs --vs-version 17
```

Linux (ambuild/clang):
```
mkdir build
cd build
python3 ../configure.py
ambuild
```

Linux (Docker w/ Valve SDK Image):
```
mkdir build
docker build -t cs2kz-linux-builder .
docker run --rm -v ./build:/app/build cs2kz-linux-builder
```

Note: does not work with gcc!

Copy the contents of `build/package/` to your server's `csgo/` directory.
WIP

Protobuf compiler and most utils stuff is based on [CS2Fixes](https://github.com/Source2ZE/CS2Fixes/)

TODO list: (italic means I'm working on it)

Utilities:
- [x] Print functions (chat, alert, center)
- [x] Add functionalities to MovementPlayer class
- [x] Add chat listener
- [ ] *Add commands to chat listener*

KZ-specific:
- [ ] General
- [x] Extends MovementPlayer to KZPlayer
- [x] Add MovementAPI stuff with callback registering for KZ modules
- [x] Disable player collisions
- [ ] Player transparency
- [x] Make players invincible
- [ ] Gameplay
- [ ] Add MOD (requires finished CVar RE)
- [ ] Buff jump height to 128t values
- [ ] Interpolate 64t AA to 128
- [ ] Disable subticks (maybe)
- [ ] Add mode toggling
- [ ] !ssp
- [x] Checkpoints
- [x] Add basic checkpoints
- [x] Add ladder checkpoints
- [ ] Timers
- [x] Trigger touching logic
- [ ] *Jumpstats*
- [x] Distbug
- [x] Split jump types
- [ ] *Console print*
- [ ] HUD
- [x] Speed panel
- [x] Add prespeed and keys
- [x] Add print to the top center bar (with game events)
- [ ] TP Menu (impossible...?)
- [ ] Quiet
- [ ] !hide
- [x] Hide player models
- [ ] Hide player sounds
- [ ] Sound volumes
- [ ] !goto
- [ ] !measure
- [ ] Trace functionalities
- [ ] Draw beams for clients
- [ ] Paint
- [ ] Add welcome message and help commands
- [ ] Saveloc
- [ ] Local DB/Ranks
- [ ] Global integration (if API exists)
- [ ] HTTP Requests
- [ ] UDP listener (partially done)
- [x] Add linux sigs
- [ ] Docs
- [ ] Code style (different naming schemes for RE structs, sdk, third party libs, project code)
Requirements: Metamod plugin

Compilation:
- Remember to *recursively* clone the plugin!
- [AMBuild](https://github.com/alliedmodders/ambuild/) needs to be installed for compilation.

- For each platform:

Windows (ambuild/msvc):
```
mkdir build
cd build
python3 ../configure.py
ambuild
```

For windows debugging with VS, build the project then add the following command at the end:
```
python3 ../configure.py --gen=vs --vs-version 17
```

Linux (ambuild/clang):
```
mkdir build
cd build
python3 ../configure.py
ambuild
```

Linux (Docker w/ Valve SDK Image):
```
mkdir build
docker build -t cs2kz-linux-builder .
docker run --rm -v ./build:/app/build cs2kz-linux-builder
```

Note: does not work with gcc!

Copy the contents of `build/package/` to your server's `csgo/` directory.
96 changes: 48 additions & 48 deletions src/common.h
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
#pragma once
// Suppress HL2SDK related warnings, comment these out if something goes wrong
#ifdef _WIN32
#pragma warning (disable: 4099 4005 4267 5033)
#endif

#include <ISmmPlugin.h>
#include <igameevents.h>
#include <sh_vector.h>
#include <stdint.h>

#include "entity2/entitysystem.h"
#define MAXPLAYERS 64

#define ENGINE_FIXED_TICK_INTERVAL 0.015625f
#define ENGINE_FIXED_TICK_RATE (1.0f / ENGINE_FIXED_TICK_INTERVAL)
#define EPSILON 0.000001f

extern CEntitySystem *g_pEntitySystem;

#ifdef _WIN32
#define ROOTBIN "/bin/win64/"
#define GAMEBIN "/csgo/bin/win64/"
#else
#define ROOTBIN "/bin/linuxsteamrt64/"
#define GAMEBIN "/csgo/bin/linuxsteamrt64/"
#endif

PLUGIN_GLOBALVARS();

// these are for searchability, because static behaves differently in different scopes.
#define internal static // static functions & static global variables
#define local_persist static // static local variables
#define static_global static // static class functions

typedef int8_t i8;
typedef int16_t i16;
typedef int32_t i32;
typedef int64_t i64;
typedef i32 b32; // 32 bit boolean

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;

typedef float f32;
typedef double f64;
#pragma once
// Suppress HL2SDK related warnings, comment these out if something goes wrong
#ifdef _WIN32
#pragma warning (disable: 4099 4005 4267 5033)
#endif

#include <ISmmPlugin.h>
#include <igameevents.h>
#include <sh_vector.h>
#include <stdint.h>

#include "entity2/entitysystem.h"
#define MAXPLAYERS 64

#define ENGINE_FIXED_TICK_INTERVAL 0.015625f
#define ENGINE_FIXED_TICK_RATE (1.0f / ENGINE_FIXED_TICK_INTERVAL)
#define EPSILON 0.000001f

extern CEntitySystem *g_pEntitySystem;

#ifdef _WIN32
#define ROOTBIN "/bin/win64/"
#define GAMEBIN "/csgo/bin/win64/"
#else
#define ROOTBIN "/bin/linuxsteamrt64/"
#define GAMEBIN "/csgo/bin/linuxsteamrt64/"
#endif

PLUGIN_GLOBALVARS();

// these are for searchability, because static behaves differently in different scopes.
#define internal static // static functions & static global variables
#define local_persist static // static local variables
#define static_global static // static class functions

typedef int8_t i8;
typedef int16_t i16;
typedef int32_t i32;
typedef int64_t i64;
typedef i32 b32; // 32 bit boolean

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;

typedef float f32;
typedef double f64;
82 changes: 41 additions & 41 deletions src/cs2kz.h
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
#pragma once

#include "common.h"
#include "networksystem/inetworkserializer.h"
#include "inetchannel.h"

class KZPlugin : public ISmmPlugin, public IMetamodListener
{
public:
bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late);
bool Unload(char *error, size_t maxlen);
bool Pause(char *error, size_t maxlen);
bool Unpause(char *error, size_t maxlen);
void AllPluginsLoaded();
public:
const char *GetAuthor();
const char *GetName();
const char *GetDescription();
const char *GetURL();
const char *GetLicense();
const char *GetVersion();
const char *GetDate();
const char *GetLogTag();

virtual void *OnMetamodQuery(const char *iface, int *ret) override;
};

extern KZPlugin g_KZPlugin;

internal void Hook_ClientCommand(CPlayerSlot slot, const CCommand &args);
internal void Hook_GameFrame(bool simulating, bool bFirstTick, bool bLastTick);
internal int Hook_ProcessUsercmds_Pre(CPlayerSlot slot, bf_read *buf, int numcmds, bool ignore, bool paused);
internal int Hook_ProcessUsercmds_Post(CPlayerSlot slot, bf_read *buf, int numcmds, bool ignore, bool paused);
internal void Hook_CEntitySystem_Spawn_Post(int nCount, const EntitySpawnInfo_t *pInfo);
internal void Hook_CheckTransmit(CCheckTransmitInfo **pInfo, int, CBitVec<16384> &, const Entity2Networkable_t **pNetworkables, const uint16 *pEntityIndicies, int nEntities);
internal void Hook_ClientPutInServer(CPlayerSlot slot, char const *pszName, int type, uint64 xuid);
internal void Hook_StartupServer(const GameSessionConfiguration_t &config, ISource2WorldSession *, const char *);
internal bool Hook_FireEvent(IGameEvent *event, bool bDontBroadcast);
internal void Hook_DispatchConCommand(ConCommandHandle cmd, const CCommandContext &ctx, const CCommand &args);
internal void Hook_PostEvent(CSplitScreenSlot nSlot, bool bLocalOnly, int nClientCount, const uint64 *clients,
INetworkSerializable *pEvent, const void *pData, unsigned long nSize, NetChannelBufType_t bufType);
#pragma once

#include "common.h"
#include "networksystem/inetworkserializer.h"
#include "inetchannel.h"

class KZPlugin : public ISmmPlugin, public IMetamodListener
{
public:
bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late);
bool Unload(char *error, size_t maxlen);
bool Pause(char *error, size_t maxlen);
bool Unpause(char *error, size_t maxlen);
void AllPluginsLoaded();
public:
const char *GetAuthor();
const char *GetName();
const char *GetDescription();
const char *GetURL();
const char *GetLicense();
const char *GetVersion();
const char *GetDate();
const char *GetLogTag();

virtual void *OnMetamodQuery(const char *iface, int *ret) override;
};

extern KZPlugin g_KZPlugin;

internal void Hook_ClientCommand(CPlayerSlot slot, const CCommand &args);
internal void Hook_GameFrame(bool simulating, bool bFirstTick, bool bLastTick);
internal int Hook_ProcessUsercmds_Pre(CPlayerSlot slot, bf_read *buf, int numcmds, bool ignore, bool paused);
internal int Hook_ProcessUsercmds_Post(CPlayerSlot slot, bf_read *buf, int numcmds, bool ignore, bool paused);
internal void Hook_CEntitySystem_Spawn_Post(int nCount, const EntitySpawnInfo_t *pInfo);
internal void Hook_CheckTransmit(CCheckTransmitInfo **pInfo, int, CBitVec<16384> &, const Entity2Networkable_t **pNetworkables, const uint16 *pEntityIndicies, int nEntities);
internal void Hook_ClientPutInServer(CPlayerSlot slot, char const *pszName, int type, uint64 xuid);
internal void Hook_StartupServer(const GameSessionConfiguration_t &config, ISource2WorldSession *, const char *);
internal bool Hook_FireEvent(IGameEvent *event, bool bDontBroadcast);
internal void Hook_DispatchConCommand(ConCommandHandle cmd, const CCommandContext &ctx, const CCommand &args);
internal void Hook_PostEvent(CSplitScreenSlot nSlot, bool bLocalOnly, int nClientCount, const uint64 *clients,
INetworkSerializable *pEvent, const void *pData, unsigned long nSize, NetChannelBufType_t bufType);
2 changes: 1 addition & 1 deletion src/kz/anticheat/kz_anticheat.cpp
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#include "../kz.h"
#include "../kz.h"
#include "kz_anticheat.h"
Loading

0 comments on commit 70868ff

Please sign in to comment.