Add features folder and bhop

This commit is contained in:
8dcc 2023-07-20 23:20:39 +02:00
parent 5849eb2ed3
commit 1f1df22414
3 changed files with 30 additions and 2 deletions

View File

@ -5,7 +5,7 @@ INCLUDES=-Isrc/include/sdk/common -Isrc/include/sdk/public -Isrc/include/sdk/pm_
CFLAGS=-Wall -Wextra -Wno-write-strings -m32 -fPIC $(INCLUDES) CFLAGS=-Wall -Wextra -Wno-write-strings -m32 -fPIC $(INCLUDES)
LDFLAGS= LDFLAGS=
OBJS=obj/main.c.o obj/globals.c.o obj/hooks.c.o OBJS=obj/main.c.o obj/globals.c.o obj/hooks.c.o obj/features/movement.c.o
BIN=libhlcheat.so BIN=libhlcheat.so
.PHONY: clean all inject .PHONY: clean all inject
@ -29,5 +29,5 @@ $(BIN): $(OBJS)
$(CC) $(CFLAGS) -shared -o $@ $(OBJS) $(LDFLAGS) $(CC) $(CFLAGS) -shared -o $@ $(OBJS) $(LDFLAGS)
$(OBJS): obj/%.c.o : src/%.c $(OBJS): obj/%.c.o : src/%.c
@mkdir -p obj/ @mkdir -p obj/features/
$(CC) $(CFLAGS) -c -o $@ $< $(LDFLAGS) $(CC) $(CFLAGS) -c -o $@ $< $(LDFLAGS)

View File

@ -0,0 +1,9 @@
#ifndef _MOVEMENT_H
#define _MOVEMENT_H
#include "../../include/sdk.h"
void bhop(usercmd_t* cmd);
#endif /* _MOVEMENT_H */

19
src/features/movement.c Normal file
View File

@ -0,0 +1,19 @@
#include <stdio.h>
#include "include/movement.h"
#include "../include/sdk.h"
#include "../include/globals.h"
void bhop(usercmd_t* cmd) {
/* TODO: Check !bhop_var */
if (false || i_pmove->movetype != MOVETYPE_WALK)
return;
static bool was_in_air = false;
if (was_in_air && !(i_pmove->flags & FL_ONGROUND))
cmd->buttons &= ~IN_JUMP;
was_in_air = (i_pmove->flags & FL_ONGROUND) == 0;
}