From 9c6c14ba3872bc4d292a61241265e3b460dfe54a Mon Sep 17 00:00:00 2001 From: iscanderoff Date: Wed, 3 Jul 2024 14:37:45 +0800 Subject: [PATCH 01/31] Add .vscode folder to .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 197610c..f6d4437 100644 --- a/.gitignore +++ b/.gitignore @@ -92,3 +92,5 @@ go.work .ionide # End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,go,c + +.vscode/ From 9b178f68aecacbdb197f9e9dea21dbe65ca493db Mon Sep 17 00:00:00 2001 From: iscanderoff Date: Wed, 3 Jul 2024 20:31:48 +0800 Subject: [PATCH 02/31] Expose ComponentEntryPoint --- component.cpp | 7 +++++++ component.go | 25 +++++++++++++++++++++++++ include/component.h | 18 ++++++++++++++++++ include/omp.h | 18 +++++++++++++++++- omp.cpp | 20 ++++++++++++++++++++ omp.go | 22 +++++++++++++++++++--- uid.go | 27 +++++++++++++++++++++++++++ 7 files changed, 133 insertions(+), 4 deletions(-) create mode 100644 component.cpp create mode 100644 component.go create mode 100644 include/component.h create mode 100644 uid.go diff --git a/component.cpp b/component.cpp new file mode 100644 index 0000000..e6c5eaa --- /dev/null +++ b/component.cpp @@ -0,0 +1,7 @@ +#include "include/component.h" + +extern "C" { + void* Component_Create(uint64_t uid, const char* name, struct ComponentVersion version, void* onReady, void* onReset, void* onFree) { + return call("Component_Create", uid, name, version, onReady, onReset, onFree); + } +} diff --git a/component.go b/component.go new file mode 100644 index 0000000..076b212 --- /dev/null +++ b/component.go @@ -0,0 +1,25 @@ +package omp + +// #include +// #include "include/component.h" +import "C" +import "unsafe" + +type ComponentVersion struct { + major, minor, patch uint8 + prerel uint16 +} + +func newComponent(uid uint64, name string, ver ComponentVersion, onReady, onReset, onFree unsafe.Pointer) unsafe.Pointer { + cName := C.CString(name) + defer C.free(unsafe.Pointer(cName)) + + cVer := C.struct_ComponentVersion{ + major: C.uchar(ver.major), + minor: C.uchar(ver.minor), + patch: C.uchar(ver.patch), + prerel: C.ushort(ver.prerel), + } + + return C.Component_Create(C.ulonglong(uid), cName, cVer, onReady, onReset, onFree) +} diff --git a/include/component.h b/include/component.h new file mode 100644 index 0000000..7e2c2f2 --- /dev/null +++ b/include/component.h @@ -0,0 +1,18 @@ +#include "omp.h" + +struct ComponentVersion { + uint8_t major; + uint8_t minor; + uint8_t patch; + uint16_t prerel; +}; + +#ifdef __cplusplus +extern "C" { +#endif + + void* Component_Create(uint64_t uid, const char* name, struct ComponentVersion version, void* onReady, void* onReset, void* onFree); + +#ifdef __cplusplus +} +#endif diff --git a/include/omp.h b/include/omp.h index ad46b68..cad5aa0 100644 --- a/include/omp.h +++ b/include/omp.h @@ -1,8 +1,9 @@ #ifndef GOMP_H #define GOMP_H -#include +#include #include +#include typedef struct { const char* buf; @@ -62,6 +63,11 @@ typedef struct { Vector3 velocity; } UnoccupiedVehicleUpdate; +struct EventArgs { + uint8_t size; + void** list; +}; + #ifdef __cplusplus extern "C" { #endif @@ -70,6 +76,16 @@ extern "C" { void unloadComponent(); void* findFunc(const char* name); + bool Event_AddHandler(const char* name, int priority, void* callback); + bool Event_RemoveHandler(const char* name, int priority, void* callback); + + void onReady(); + void onFree(); + + bool onGameModeInit(); + bool onGameModeExit(); + bool onPlayerConnect(struct EventArgs* args); + void freeArray(Array arr); uint8_t getWeaponSlotIndex(uint8_t weapon); unsigned char getVehicleModelInfo(int model, int type, Vector3* out); diff --git a/omp.cpp b/omp.cpp index 8bf0a7d..5982bcc 100644 --- a/omp.cpp +++ b/omp.cpp @@ -34,6 +34,26 @@ extern "C" { #endif } + bool Event_AddHandler(const char* name, int priority, void* callback) { + return call("Event_AddHandler", name, priority, callback); + } + + bool Event_RemoveHandler(const char* name, int priority, void* callback) { + return call("Event_RemoveHandler", name, priority, callback); + } + + void onReady() { + Event_AddHandler("onPlayerConnect", 0, (void*)onPlayerConnect); + + onGameModeInit(); + } + + void onFree() { + Event_RemoveHandler("onPlayerConnect", 0, (void*)onPlayerConnect); + + onGameModeExit(); + } + void freeArray(Array arr) { return call("freeArray", arr); } diff --git a/omp.go b/omp.go index 606a070..b46cb13 100644 --- a/omp.go +++ b/omp.go @@ -52,20 +52,31 @@ func handlePanic() { } } +//export ComponentEntryPoint +func ComponentEntryPoint() unsafe.Pointer { + ver := ComponentVersion{major: 0, minor: 0, patch: 0, prerel: 0} + + return newComponent(newUID(), "OmpGo", ver, C.onReady, nil, C.onFree) +} + //export onGameModeInit -func onGameModeInit() { +func onGameModeInit() C.bool { defer handlePanic() C.loadComponent() event.Dispatch(Events, EventTypeGameModeInit, &GameModeInitEvent{}) + + return true } //export onGameModeExit -func onGameModeExit() { +func onGameModeExit() C.bool { defer handlePanic() event.Dispatch(Events, EventTypeGameModeExit, &GameModeExitEvent{}) + + return true } // Actor events @@ -526,12 +537,17 @@ func onIncomingConnection(player unsafe.Pointer, ipAddress C.String, port C.usho } //export onPlayerConnect -func onPlayerConnect(player unsafe.Pointer) { +func onPlayerConnect(args *C.struct_EventArgs) C.bool { defer handlePanic() + handles := unsafe.Slice(args.list, args.size) + player := *(*unsafe.Pointer)(handles[0]) + event.Dispatch(Events, EventTypePlayerConnect, &PlayerConnectEvent{ Player: &Player{handle: player}, }) + + return true } //export onPlayerDisconnect diff --git a/uid.go b/uid.go new file mode 100644 index 0000000..a1a8d58 --- /dev/null +++ b/uid.go @@ -0,0 +1,27 @@ +package omp + +import ( + "crypto/rand" + "fmt" + "log" + "strconv" + "strings" +) + +func newUID() uint64 { + token := make([]byte, 8) + rand.Read(token) + + sb := &strings.Builder{} + + for _, t := range token { + sb.WriteString(fmt.Sprintf("%02X", t)) + } + + uid, err := strconv.ParseUint(sb.String(), 16, 64) + if err != nil { + log.Panicf("NewUID: %s\n", err.Error()) + } + + return uid +} From 21d74403c6e0fede3eabfc4fb302d537281e4d8b Mon Sep 17 00:00:00 2001 From: iscanderoff Date: Fri, 5 Jul 2024 01:46:09 +0800 Subject: [PATCH 03/31] Add omp-capi as a submodule --- .gitmodules | 3 +++ capi | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 capi diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..7e8a9b5 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "capi"] + path = capi + url = https://github.com/openmultiplayer/omp-capi.git diff --git a/capi b/capi new file mode 160000 index 0000000..854a0cb --- /dev/null +++ b/capi @@ -0,0 +1 @@ +Subproject commit 854a0cbc41deb70e40d4b9ade7f4f0e2401ffbf2 From c29cc59cdedbcbe8544651ab6273b626fe5b4db2 Mon Sep 17 00:00:00 2001 From: iscanderoff Date: Fri, 5 Jul 2024 03:17:29 +0800 Subject: [PATCH 04/31] Rewrite callbacks using capi --- class.cpp | 4 + include/class.h | 2 + include/component.h | 7 - include/omp.h | 8 +- omp.go | 1405 +++++++++++++++++++++++++------------------ 5 files changed, 831 insertions(+), 595 deletions(-) diff --git a/class.cpp b/class.cpp index ee69322..75042d4 100644 --- a/class.cpp +++ b/class.cpp @@ -20,4 +20,8 @@ extern "C" { ClassData class_getClass(void* class_) { return call("class_getClass", class_); } + + void* Class_FromID(int classid) { + return call("Class_FromID", classid); + } } diff --git a/include/class.h b/include/class.h index 071559c..a9fb8ba 100644 --- a/include/class.h +++ b/include/class.h @@ -26,6 +26,8 @@ extern "C" { void class_setClass(void* class_, ClassData* data); ClassData class_getClass(void* class_); + void* Class_FromID(int classid); + #ifdef __cplusplus } #endif diff --git a/include/component.h b/include/component.h index 7e2c2f2..b49cb06 100644 --- a/include/component.h +++ b/include/component.h @@ -1,12 +1,5 @@ #include "omp.h" -struct ComponentVersion { - uint8_t major; - uint8_t minor; - uint8_t patch; - uint16_t prerel; -}; - #ifdef __cplusplus extern "C" { #endif diff --git a/include/omp.h b/include/omp.h index cad5aa0..73ef009 100644 --- a/include/omp.h +++ b/include/omp.h @@ -4,6 +4,7 @@ #include #include #include +#include "capi/include/ompcapi.h" typedef struct { const char* buf; @@ -63,11 +64,6 @@ typedef struct { Vector3 velocity; } UnoccupiedVehicleUpdate; -struct EventArgs { - uint8_t size; - void** list; -}; - #ifdef __cplusplus extern "C" { #endif @@ -84,7 +80,7 @@ extern "C" { bool onGameModeInit(); bool onGameModeExit(); - bool onPlayerConnect(struct EventArgs* args); + bool onPlayerConnect(struct EventArgs_onPlayerConnect* args); void freeArray(Array arr); uint8_t getWeaponSlotIndex(uint8_t weapon); diff --git a/omp.go b/omp.go index b46cb13..70d4f53 100644 --- a/omp.go +++ b/omp.go @@ -2,6 +2,7 @@ package omp // #include // #include "include/omp.h" +// #include "include/class.h" import "C" import ( "fmt" @@ -65,156 +66,205 @@ func onGameModeInit() C.bool { C.loadComponent() - event.Dispatch(Events, EventTypeGameModeInit, &GameModeInitEvent{}) + result := event.Dispatch(Events, EventTypeGameModeInit, &GameModeInitEvent{}) - return true + return C.bool(result) } //export onGameModeExit func onGameModeExit() C.bool { defer handlePanic() - event.Dispatch(Events, EventTypeGameModeExit, &GameModeExitEvent{}) + result := event.Dispatch(Events, EventTypeGameModeExit, &GameModeExitEvent{}) - return true + return C.bool(result) } // Actor events //export onPlayerGiveDamageActor -func onPlayerGiveDamageActor(player, actor unsafe.Pointer, amount float32, weapon uint, part int) { +func onPlayerGiveDamageActor(args *C.struct_EventArgs_onPlayerGiveDamageActor) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypePlayerGiveDamageActor, &PlayerGiveDamageActorEvent{ - Player: &Player{handle: player}, - Actor: &Player{handle: actor}, - Amount: amount, - Weapon: weapon, - Part: BodyPart(part), + result := event.Dispatch(Events, EventTypePlayerGiveDamageActor, &PlayerGiveDamageActorEvent{ + Player: &Player{handle: *args.list.player}, + Actor: &Player{handle: *args.list.actor}, + Amount: float32(*args.list.amount), + Weapon: Weapon(*args.list.weapon), + BodyPart: BodyPart(*args.list.part), }) + + return C.bool(result) } //export onActorStreamOut -func onActorStreamOut(actor, forPlayer unsafe.Pointer) { +func onActorStreamOut(args *C.struct_EventArgs_onActorStreamOut) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypeActorStreamOut, &ActorStreamOutEvent{ - Actor: &Player{handle: actor}, - ForPlayer: &Player{handle: forPlayer}, + result := event.Dispatch(Events, EventTypeActorStreamOut, &ActorStreamOutEvent{ + Actor: &Player{handle: *args.list.actor}, + ForPlayer: &Player{handle: *args.list.forPlayer}, }) + + return C.bool(result) } //export onActorStreamIn -func onActorStreamIn(actor, forPlayer unsafe.Pointer) { +func onActorStreamIn(args *C.struct_EventArgs_onActorStreamIn) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypeActorStreamIn, &ActorStreamInEvent{ - Actor: &Player{handle: actor}, - ForPlayer: &Player{handle: forPlayer}, + result := event.Dispatch(Events, EventTypeActorStreamIn, &ActorStreamInEvent{ + Actor: &Player{handle: *args.list.actor}, + ForPlayer: &Player{handle: *args.list.forPlayer}, }) + + return C.bool(result) } // Checkpoint events //export onPlayerEnterCheckpoint -func onPlayerEnterCheckpoint(player unsafe.Pointer) { +func onPlayerEnterCheckpoint(args *C.struct_EventArgs_onPlayerEnterCheckpoint) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypePlayerEnterCheckpoint, &PlayerEnterCheckpointEvent{ - Player: &Player{handle: player}, + result := event.Dispatch(Events, EventTypePlayerEnterCheckpoint, &PlayerEnterCheckpointEvent{ + Player: &Player{handle: *args.list.player}, }) + + return C.bool(result) } //export onPlayerLeaveCheckpoint -func onPlayerLeaveCheckpoint(player unsafe.Pointer) { +func onPlayerLeaveCheckpoint(args *C.struct_EventArgs_onPlayerLeaveCheckpoint) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypePlayerLeaveCheckpoint, &PlayerLeaveCheckpointEvent{ - Player: &Player{handle: player}, + result := event.Dispatch(Events, EventTypePlayerLeaveCheckpoint, &PlayerLeaveCheckpointEvent{ + Player: &Player{handle: *args.list.player}, }) + + return C.bool(result) } //export onPlayerEnterRaceCheckpoint -func onPlayerEnterRaceCheckpoint(player unsafe.Pointer) { +func onPlayerEnterRaceCheckpoint(args *C.struct_EventArgs_onPlayerEnterRaceCheckpoint) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypePlayerEnterRaceCheckpoint, &PlayerEnterRaceCheckpointEvent{ - Player: &Player{handle: player}, + result := event.Dispatch(Events, EventTypePlayerEnterRaceCheckpoint, &PlayerEnterRaceCheckpointEvent{ + Player: &Player{handle: *args.list.player}, }) + + return C.bool(result) } //export onPlayerLeaveRaceCheckpoint -func onPlayerLeaveRaceCheckpoint(player unsafe.Pointer) { +func onPlayerLeaveRaceCheckpoint(args *C.struct_EventArgs_onPlayerLeaveRaceCheckpoint) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypePlayerLeaveRaceCheckpoint, &PlayerLeaveRaceCheckpointEvent{ - Player: &Player{handle: player}, + result := event.Dispatch(Events, EventTypePlayerLeaveRaceCheckpoint, &PlayerLeaveRaceCheckpointEvent{ + Player: &Player{handle: *args.list.player}, }) + + return C.bool(result) } // Class events //export onPlayerRequestClass -func onPlayerRequestClass(player, class unsafe.Pointer) bool { +func onPlayerRequestClass(args *C.struct_EventArgs_onPlayerRequestClass) C.bool { defer handlePanic() - return event.Dispatch(Events, EventTypePlayerRequestClass, &PlayerRequestClassEvent{ - Player: &Player{handle: player}, + class := C.Class_FromID(*args.list.classId) + + result := event.Dispatch(Events, EventTypePlayerRequestClass, &PlayerRequestClassEvent{ + Player: &Player{handle: *args.list.player}, Class: &Class{handle: class}, }) + + return C.bool(result) } // Console events. TODO //export onConsoleText -func onConsoleText(command C.String, parameters C.String) bool { +func onConsoleText(args *C.struct_EventArgs_onConsoleText) C.bool { defer handlePanic() - return event.Dispatch(Events, EventTypeConsoleText, &ConsoleTextEvent{ - Command: C.GoStringN(command.buf, C.int(command.length)), - Parameters: C.GoStringN(parameters.buf, C.int(parameters.length)), + cmd := *args.list.command + params := *args.list.parameters + + result := event.Dispatch(Events, EventTypeConsoleText, &ConsoleTextEvent{ + Command: C.GoStringN(cmd.data, C.int(cmd.len)), + Parameters: C.GoStringN(params.data, C.int(params.len)), }) + + return C.bool(result) } -//export onRconLoginAttempt -func onRconLoginAttempt(player unsafe.Pointer, password C.String, success bool) { - defer handlePanic() +// //export onRconLoginAttempt +// func onRconLoginAttempt(args *C.struct_EventArgs_onRconLoginAttempt) C.bool { +// defer handlePanic() - event.Dispatch(Events, EventTypeRconLoginAttempt, &RconLoginAttemptEvent{ - Player: &Player{handle: player}, - Password: C.GoStringN(password.buf, C.int(password.length)), - Success: success, - }) -} +// password := *args.list.password + +// result := event.Dispatch(Events, EventTypeRconLoginAttempt, &RconLoginAttemptEvent{ +// Player: &Player{handle: *args.list.player}, +// Password: C.GoStringN(password.data, C.int(password.len)), +// Success: bool(*args.list.success), +// }) + +// return C.bool(result) +// } + +// //export onTick +// func onTick(args *C.struct_EventArgs_onTick) C.bool { +// defer handlePanic() + +// result := event.Dispatch(Events, EventTypeTick, &TickEvent{ +// Elapsed: time.Duration(*args.list.elapsed) * time.Microsecond, +// Now: time.Unix(int64(*args.list.now), 0), +// }) + +// return C.bool(result) +// } // Custom model events //export onPlayerFinishedDownloading -func onPlayerFinishedDownloading(player unsafe.Pointer) { +func onPlayerFinishedDownloading(args *C.struct_EventArgs_onPlayerFinishedDownloading) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypePlayerFinishedDownloading, &PlayerFinishedDownloadingEvent{ - Player: &Player{handle: player}, + result := event.Dispatch(Events, EventTypePlayerFinishedDownloading, &PlayerFinishedDownloadingEvent{ + Player: &Player{handle: *args.list.player}, }) + + return C.bool(result) } //export onPlayerRequestDownload -func onPlayerRequestDownload(player unsafe.Pointer, _type uint8, checksum uint32) bool { +func onPlayerRequestDownload(args *C.struct_EventArgs_onPlayerRequestDownload) C.bool { defer handlePanic() - return event.Dispatch(Events, EventTypePlayerRequestDownload, &PlayerRequestDownloadEvent{ - Player: &Player{handle: player}, - Type: int(_type), - Checksum: int(checksum), + result := event.Dispatch(Events, EventTypePlayerRequestDownload, &PlayerRequestDownloadEvent{ + Player: &Player{handle: *args.list.player}, + Type: DownloadRequestType(*args.list._type), + Checksum: int(*args.list.checksum), }) + + return C.bool(result) } // Dialog events //export onDialogResponse -func onDialogResponse(player unsafe.Pointer, dialogID, response, listItem int, inputText C.String) { +func onDialogResponse(args *C.struct_EventArgs_onDialogResponse) C.bool { defer handlePanic() + player := *args.list.player + // dialogID := *args.list.dialogId + response := DialogResponse(*args.list.response) + listItem := int(*args.list.listItem) + inputText := *args.list.inputText + eventPlayer := &Player{handle: player} playerID := eventPlayer.ID() @@ -224,41 +274,43 @@ func onDialogResponse(player unsafe.Pointer, dialogID, response, listItem int, i } delete(activeDialogs, playerID) + var result bool + switch dialog := dialog.(type) { case *MessageDialog: - event.Dispatch(dialog.Dispatcher, EventTypeDialogResponse, &MessageDialogResponseEvent{ + result = event.Dispatch(dialog.Dispatcher, EventTypeDialogResponse, &MessageDialogResponseEvent{ Player: eventPlayer, - Response: DialogResponse(response), + Response: response, }) event.Dispatch(dialog.Dispatcher, EventTypeDialogHide, &DialogHideEvent{ Player: eventPlayer, }) case *InputDialog: - event.Dispatch(dialog.Dispatcher, EventTypeDialogResponse, &InputDialogResponseEvent{ + result = event.Dispatch(dialog.Dispatcher, EventTypeDialogResponse, &InputDialogResponseEvent{ Player: eventPlayer, - Response: DialogResponse(response), - InputText: C.GoStringN(inputText.buf, C.int(inputText.length)), + Response: response, + InputText: C.GoStringN(inputText.data, C.int(inputText.len)), }) event.Dispatch(dialog.Dispatcher, EventTypeDialogHide, &DialogHideEvent{ Player: eventPlayer, }) case *ListDialog: - event.Dispatch(dialog.Dispatcher, EventTypeDialogResponse, &ListDialogResponseEvent{ + result = event.Dispatch(dialog.Dispatcher, EventTypeDialogResponse, &ListDialogResponseEvent{ Player: eventPlayer, - Response: DialogResponse(response), + Response: response, ItemNumber: listItem, - Item: C.GoStringN(inputText.buf, C.int(inputText.length)), + Item: C.GoStringN(inputText.data, C.int(inputText.len)), }) event.Dispatch(dialog.Dispatcher, EventTypeDialogHide, &DialogHideEvent{ Player: eventPlayer, }) case *TabListDialog: - event.Dispatch(dialog.Dispatcher, EventTypeDialogResponse, &TabListDialogResponseEvent{ + result = event.Dispatch(dialog.Dispatcher, EventTypeDialogResponse, &TabListDialogResponseEvent{ Player: eventPlayer, - Response: DialogResponse(response), + Response: response, ItemNumber: listItem, Item: dialog.items[listItem], }) @@ -269,363 +321,456 @@ func onDialogResponse(player unsafe.Pointer, dialogID, response, listItem int, i default: panic("unknown dialog type") } + + return C.bool(result) } // GangZone events //export onPlayerEnterGangZone -func onPlayerEnterGangZone(player, gangzone unsafe.Pointer) { +func onPlayerEnterGangZone(args *C.struct_EventArgs_onPlayerEnterGangZone) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypePlayerEnterTurf, &PlayerEnterTurfEvent{ - Player: &Player{handle: player}, - Turf: &Turf{handle: gangzone}, + result := event.Dispatch(Events, EventTypePlayerEnterTurf, &PlayerEnterTurfEvent{ + Player: &Player{handle: *args.list.player}, + Turf: &Turf{handle: *args.list.zone}, }) + + return C.bool(result) } //export onPlayerEnterPlayerGangZone -func onPlayerEnterPlayerGangZone(player, gangzone unsafe.Pointer) { +func onPlayerEnterPlayerGangZone(args *C.struct_EventArgs_onPlayerEnterPlayerGangZone) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypePlayerEnterPlayerTurf, &PlayerEnterPlayerTurfEvent{ - Player: &Player{handle: player}, - Turf: &PlayerTurf{handle: gangzone}, + eventPlayer := &Player{handle: *args.list.player} + + result := event.Dispatch(Events, EventTypePlayerEnterPlayerTurf, &PlayerEnterPlayerTurfEvent{ + Player: eventPlayer, + Turf: &PlayerTurf{ + handle: *args.list.zone, + player: eventPlayer, + }, }) + + return C.bool(result) } //export onPlayerLeaveGangZone -func onPlayerLeaveGangZone(player, gangzone unsafe.Pointer) { +func onPlayerLeaveGangZone(args *C.struct_EventArgs_onPlayerLeaveGangZone) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypePlayerLeaveTurf, &PlayerLeaveTurfEvent{ - Player: &Player{handle: player}, - Turf: &Turf{handle: gangzone}, + result := event.Dispatch(Events, EventTypePlayerLeaveTurf, &PlayerLeaveTurfEvent{ + Player: &Player{handle: *args.list.player}, + Turf: &Turf{handle: *args.list.zone}, }) -} - -//export onPlayerLeavePlayerGangZone -func onPlayerLeavePlayerGangZone(player, gangzone unsafe.Pointer) { - defer handlePanic() - event.Dispatch(Events, EventTypePlayerLeavePlayerTurf, &PlayerLeavePlayerTurfEvent{ - Player: &Player{handle: player}, - Turf: &PlayerTurf{handle: gangzone}, - }) + return C.bool(result) } -//export onPlayerClickGangZone -func onPlayerClickGangZone(player, gangzone unsafe.Pointer) { - defer handlePanic() +// //export onPlayerLeavePlayerGangZone +// func onPlayerLeavePlayerGangZone(args *C.struct_EventArgs_onPlayerLeavePlayerGangZone) C.bool { +// defer handlePanic() - event.Dispatch(Events, EventTypePlayerClickTurf, &PlayerClickTurfEvent{ - Player: &Player{handle: player}, - Turf: &Turf{handle: gangzone}, - }) -} +// eventPlayer := &Player{ +// handle: *args.list.player, +// } -//export onPlayerClickPlayerGangZone -func onPlayerClickPlayerGangZone(player, gangzone unsafe.Pointer) { - defer handlePanic() +// result := event.Dispatch(Events, EventTypePlayerLeavePlayerTurf, &PlayerLeavePlayerTurfEvent{ +// Player: eventPlayer, +// Turf: &PlayerTurf{ +// handle: *args.list.zone, +// player: eventPlayer, +// }, +// }) - event.Dispatch(Events, EventTypePlayerClickPlayerTurf, &PlayerClickPlayerTurfEvent{ - Player: &Player{handle: player}, - Turf: &PlayerTurf{handle: gangzone}, - }) -} +// return C.bool(result) +// } -// Menu events - -//export onPlayerSelectedMenuRow -func onPlayerSelectedMenuRow(player unsafe.Pointer, menuRow uint8) { +//export onPlayerClickGangZone +func onPlayerClickGangZone(args *C.struct_EventArgs_onPlayerClickGangZone) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypePlayerSelectedMenuRow, &PlayerSelectedMenuRowEvent{ - Player: &Player{handle: player}, - MenuRow: menuRow, + result := event.Dispatch(Events, EventTypePlayerClickTurf, &PlayerClickTurfEvent{ + Player: &Player{handle: *args.list.player}, + Turf: &Turf{handle: *args.list.zone}, }) -} - -//export onPlayerExitedMenu -func onPlayerExitedMenu(player unsafe.Pointer) { - defer handlePanic() - event.Dispatch(Events, EventTypePlayerExitedMenu, &PlayerExitedMenuEvent{ - Player: &Player{handle: player}, - }) + return C.bool(result) } -// Object events +// //export onPlayerClickPlayerGangZone +// func onPlayerClickPlayerGangZone(args *C.struct_EventArgs_onPlayerClickPlayerGangZone) C.bool { +// defer handlePanic() -//export onObjectMoved -func onObjectMoved(object unsafe.Pointer) { - defer handlePanic() +// eventPlayer := &Player{handle: *args.list.player} - event.Dispatch(Events, EventTypeObjectMoved, &ObjectMovedEvent{ - Object: &Object{handle: object}, - }) -} +// result := event.Dispatch(Events, EventTypePlayerClickPlayerTurf, &PlayerClickPlayerTurfEvent{ +// Player: eventPlayer, +// Turf: &PlayerTurf{ +// handle: *args.list.zone, +// player: eventPlayer, +// }, +// }) -//export onPlayerObjectMoved -func onPlayerObjectMoved(player, object unsafe.Pointer) { - defer handlePanic() +// return C.bool(result) +// } - event.Dispatch(Events, EventTypePlayerObjectMoved, &PlayerObjectMovedEvent{ - Player: &Player{handle: player}, - Object: &PlayerObject{handle: object}, - }) -} +// Menu events -//export onObjectSelected -func onObjectSelected(player, object unsafe.Pointer, model int, pos C.Vector3) { +//export onPlayerSelectedMenuRow +func onPlayerSelectedMenuRow(args *C.struct_EventArgs_onPlayerSelectedMenuRow) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypeObjectSelected, &ObjectSelectedEvent{ - Player: &Player{handle: player}, - Object: &Object{handle: object}, - Model: model, - Position: Vector3{ - X: float32(pos.x), - Y: float32(pos.y), - Z: float32(pos.z), - }, + result := event.Dispatch(Events, EventTypePlayerSelectedMenuRow, &PlayerSelectedMenuRowEvent{ + Player: &Player{handle: *args.list.player}, + MenuRow: int(*args.list.row), }) -} - -//export onPlayerObjectSelected -func onPlayerObjectSelected(player, object unsafe.Pointer, model int, pos C.Vector3) { - defer handlePanic() - event.Dispatch(Events, EventTypePlayerObjectSelected, &PlayerObjectSelectedEvent{ - Player: &Player{handle: player}, - Object: &PlayerObject{handle: object}, - Model: model, - Position: Vector3{ - X: float32(pos.x), - Y: float32(pos.y), - Z: float32(pos.z), - }, - }) + return C.bool(result) } -//export onObjectEdited -func onObjectEdited(player, object unsafe.Pointer, response int, offset, rot C.Vector3) { +//export onPlayerExitedMenu +func onPlayerExitedMenu(args *C.struct_EventArgs_onPlayerExitedMenu) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypeObjectEdited, &ObjectEditedEvent{ - Player: &Player{handle: player}, - Object: &Object{handle: object}, - Response: ObjectEditResponse(response), - Offset: Vector3{ - X: float32(offset.x), - Y: float32(offset.y), - Z: float32(offset.z), - }, - Rotation: Vector3{ - X: float32(rot.x), - Y: float32(rot.y), - Z: float32(rot.z), - }, + result := event.Dispatch(Events, EventTypePlayerExitedMenu, &PlayerExitedMenuEvent{ + Player: &Player{handle: *args.list.player}, }) -} - -//export onPlayerObjectEdited -func onPlayerObjectEdited(player, object unsafe.Pointer, response int, offset, rot C.Vector3) { - defer handlePanic() - event.Dispatch(Events, EventTypePlayerObjectEdited, &PlayerObjectEditedEvent{ - Player: &Player{handle: player}, - Object: &PlayerObject{handle: object}, - Response: ObjectEditResponse(response), - Offset: Vector3{ - X: float32(offset.x), - Y: float32(offset.y), - Z: float32(offset.z), - }, - Rotation: Vector3{ - X: float32(rot.x), - Y: float32(rot.y), - Z: float32(rot.z), - }, - }) + return C.bool(result) } -//export onPlayerAttachedObjectEdited -func onPlayerAttachedObjectEdited(player unsafe.Pointer, index int, saved bool, data C.PlayerAttachedObject) { - defer handlePanic() +// Object events - event.Dispatch(Events, EventTypePlayerAttachmentEdited, &PlayerAttachmentEdited{ - Player: &Player{handle: player}, - Index: index, - Saved: saved, - Attachment: PlayerAttachment{ - ModelID: int(data.model), - Bone: PlayerBone(data.bone), - Offset: Vector3{ - X: float32(data.offset.x), - Y: float32(data.offset.y), - Z: float32(data.offset.z), - }, - Rot: Vector3{ - X: float32(data.rotation.x), - Y: float32(data.rotation.y), - Z: float32(data.rotation.z), - }, - Scale: Vector3{ - X: float32(data.scale.x), - Y: float32(data.scale.y), - Z: float32(data.scale.z), - }, - Color1: Color(data.colour1), - Color2: Color(data.colour2), - }, - }) -} +// //export onObjectMoved +// func onObjectMoved(args *C.struct_EventArgs_onObjectMoved) C.bool { +// defer handlePanic() + +// result := event.Dispatch(Events, EventTypeObjectMoved, &ObjectMovedEvent{ +// Object: &Object{handle: *args.list.object}, +// }) + +// return C.bool(result) +// } + +// //export onPlayerObjectMoved +// func onPlayerObjectMoved(args *C.struct_EventArgs_onPlayerObjectMoved) C.bool { +// defer handlePanic() + +// eventPlayer := &Player{handle: *args.list.player} + +// result := event.Dispatch(Events, EventTypePlayerObjectMoved, &PlayerObjectMovedEvent{ +// Player: eventPlayer, +// Object: &PlayerObject{ +// handle: *args.list.object, +// player: eventPlayer, +// }, +// }) + +// return C.bool(result) +// } + +// //export onObjectEdited +// func onObjectEdited(args *C.struct_EventArgs_onObjectEdited) C.bool { +// defer handlePanic() + +// result := event.Dispatch(Events, EventTypeObjectEdited, &ObjectEditedEvent{ +// Player: &Player{handle: *args.list.player}, +// Object: &Object{handle: *args.list.object}, +// Response: ObjectEditResponse(*args.list.response), +// Offset: Vector3{ +// X: float32(*args.list.offsetX), +// Y: float32(*args.list.offsetY), +// Z: float32(*args.list.offsetZ), +// }, +// Rotation: Vector3{ +// X: float32(*args.list.rotationX), +// Y: float32(*args.list.rotationY), +// Z: float32(*args.list.rotationZ), +// }, +// }) + +// return C.bool(result) +// } + +// //export onPlayerObjectEdited +// func onPlayerObjectEdited(args *C.struct_EventArgs_onPlayerObjectEdited) C.bool { +// defer handlePanic() + +// eventPlayer := &Player{handle: *args.list.player} + +// result := event.Dispatch(Events, EventTypePlayerObjectEdited, &PlayerObjectEditedEvent{ +// Player: eventPlayer, +// Object: &PlayerObject{ +// handle: *args.list.object, +// player: eventPlayer, +// }, +// Response: ObjectEditResponse(*args.list.response), +// Offset: Vector3{ +// X: float32(*args.list.offsetX), +// Y: float32(*args.list.offsetY), +// Z: float32(*args.list.offsetZ), +// }, +// Rotation: Vector3{ +// X: float32(*args.list.rotationX), +// Y: float32(*args.list.rotationY), +// Z: float32(*args.list.rotationZ), +// }, +// }) + +// return C.bool(result) +// } + +// //export onPlayerAttachedObjectEdited +// func onPlayerAttachedObjectEdited(args *C.struct_EventArgs_onPlayerAttachedObjectEdited) C.bool { +// defer handlePanic() + +// result := event.Dispatch(Events, EventTypePlayerAttachmentEdited, &PlayerAttachmentEdited{ +// Player: &Player{handle: *args.list.player}, +// Index: int(*args.list.index), +// Saved: bool(*args.list.saved), +// Attachment: PlayerAttachment{ +// ModelID: int(*args.list.model), +// Bone: PlayerBone(*args.list.bone), +// Offset: Vector3{ +// X: float32(*args.list.offsetX), +// Y: float32(*args.list.offsetY), +// Z: float32(*args.list.offsetZ), +// }, +// Rotation: Vector3{ +// X: float32(*args.list.rotationX), +// Y: float32(*args.list.rotationY), +// Z: float32(*args.list.rotationZ), +// }, +// Scale: Vector3{ +// X: float32(*args.list.scaleX), +// Y: float32(*args.list.scaleY), +// Z: float32(*args.list.scaleZ), +// }, +// Color1: Color(*args.list.color1), +// Color2: Color(*args.list.color2), +// }, +// }) + +// return C.bool(result) +// } + +// //export onObjectSelected +// func onObjectSelected(args *C.struct_EventArgs_onObjectSelected) C.bool { +// defer handlePanic() + +// result := event.Dispatch(Events, EventTypeObjectSelected, &ObjectSelectedEvent{ +// Player: &Player{handle: *args.list.player}, +// Object: &Object{handle: *args.list.object}, +// Model: int(*args.list.model), +// Position: Vector3{ +// X: float32(*args.list.x), +// Y: float32(*args.list.y), +// Z: float32(*args.list.z), +// }, +// }) + +// return C.bool(result) +// } + +// //export onPlayerObjectSelected +// func onPlayerObjectSelected(args *C.struct_EventArgs_onPlayerObjectSelected) C.bool { +// defer handlePanic() + +// eventPlayer := &Player{handle: *args.list.player} + +// result := event.Dispatch(Events, EventTypePlayerObjectSelected, &PlayerObjectSelectedEvent{ +// Player: eventPlayer, +// Object: &PlayerObject{ +// handle: *args.list.object, +// player: eventPlayer, +// }, +// Model: int(*args.list.model), +// Position: Vector3{ +// X: float32(*args.list.x), +// Y: float32(*args.list.y), +// Z: float32(*args.list.z), +// }, +// }) + +// return C.bool(result) +// } // Pickup events //export onPlayerPickUpPickup -func onPlayerPickUpPickup(player, pickup unsafe.Pointer) { +func onPlayerPickUpPickup(args *C.struct_EventArgs_onPlayerPickUpPickup) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypePlayerPickUpPickup, &PlayerPickUpPickupEvent{ - Player: &Player{handle: player}, - Pickup: &Pickup{handle: pickup}, + result := event.Dispatch(Events, EventTypePlayerPickUpPickup, &PlayerPickUpPickupEvent{ + Player: &Player{handle: *args.list.player}, + Pickup: &Pickup{handle: *args.list.pickup}, }) + + return C.bool(result) } -//export onPlayerPickUpPlayerPickup -func onPlayerPickUpPlayerPickup(player, pickup unsafe.Pointer) { - defer handlePanic() +// //export onPlayerPickUpPlayerPickup +// func onPlayerPickUpPlayerPickup(args *C.struct_EventArgs_onPlayerPickUpPlayerPickup) C.bool { +// defer handlePanic() - event.Dispatch(Events, EventTypePlayerPickUpPlayerPickup, &PlayerPickUpPlayerPickupEvent{ - Player: &Player{handle: player}, - Pickup: &PlayerPickup{handle: pickup}, - }) -} +// eventPlayer := &Player{handle: *args.list.player} + +// result := event.Dispatch(Events, EventTypePlayerPickUpPlayerPickup, &PlayerPickUpPlayerPickupEvent{ +// Player: eventPlayer, +// Pickup: &PlayerPickup{ +// handle: *args.list.pickup, +// player: eventPlayer, +// }, +// }) + +// return C.bool(result) +// } // Player spawn events //export onPlayerRequestSpawn -func onPlayerRequestSpawn(player unsafe.Pointer) bool { +func onPlayerRequestSpawn(args *C.struct_EventArgs_onPlayerRequestSpawn) C.bool { defer handlePanic() - return event.Dispatch(Events, EventTypePlayerRequestSpawn, &PlayerRequestSpawnEvent{ - Player: &Player{handle: player}, + result := event.Dispatch(Events, EventTypePlayerRequestSpawn, &PlayerRequestSpawnEvent{ + Player: &Player{handle: *args.list.player}, }) + + return C.bool(result) } //export onPlayerSpawn -func onPlayerSpawn(player unsafe.Pointer) { +func onPlayerSpawn(args *C.struct_EventArgs_onPlayerSpawn) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypePlayerSpawn, &PlayerSpawnEvent{ - Player: &Player{handle: player}, + result := event.Dispatch(Events, EventTypePlayerSpawn, &PlayerSpawnEvent{ + Player: &Player{handle: *args.list.player}, }) + + return C.bool(result) } // Player connect events //export onIncomingConnection -func onIncomingConnection(player unsafe.Pointer, ipAddress C.String, port C.ushort) { +func onIncomingConnection(args *C.struct_EventArgs_onIncomingConnection) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypeIncomingConnection, &IncomingConnectionEvent{ - Player: &Player{handle: player}, - IPAddress: C.GoStringN(ipAddress.buf, C.int(ipAddress.length)), - Port: int(port), + ipAddress := *args.list.ipAddress + + result := event.Dispatch(Events, EventTypeIncomingConnection, &IncomingConnectionEvent{ + Player: &Player{handle: *args.list.player}, + ipAddress: C.GoStringN(ipAddress.data, C.int(ipAddress.len)), + Port: int(*args.list.port), }) + + return C.bool(result) } //export onPlayerConnect -func onPlayerConnect(args *C.struct_EventArgs) C.bool { +func onPlayerConnect(args *C.struct_EventArgs_onPlayerConnect) C.bool { defer handlePanic() - handles := unsafe.Slice(args.list, args.size) - player := *(*unsafe.Pointer)(handles[0]) - - event.Dispatch(Events, EventTypePlayerConnect, &PlayerConnectEvent{ - Player: &Player{handle: player}, + result := event.Dispatch(Events, EventTypePlayerConnect, &PlayerConnectEvent{ + Player: &Player{handle: *args.list.player}, }) - return true + return C.bool(result) } //export onPlayerDisconnect -func onPlayerDisconnect(player unsafe.Pointer, reason int) { +func onPlayerDisconnect(args *C.struct_EventArgs_onPlayerDisconnect) C.bool { defer handlePanic() - eventPlayer := &Player{handle: player} + eventPlayer := &Player{handle: *args.list.player} - event.Dispatch(Events, EventTypePlayerDisconnect, &PlayerDisconnectEvent{ + result := event.Dispatch(Events, EventTypePlayerDisconnect, &PlayerDisconnectEvent{ Player: eventPlayer, - Reason: DisconnectReason(reason), + Reason: DisconnectReason(*args.list.reason), }) delete(activeDialogs, eventPlayer.ID()) + + return C.bool(result) } -//export onPlayerClientInit -func onPlayerClientInit(player unsafe.Pointer) { - defer handlePanic() +// //export onPlayerClientInit +// func onPlayerClientInit(args *C.struct_EventArgs_onPlayerClientInit) C.bool { +// defer handlePanic() - event.Dispatch(Events, EventTypePlayerClientInit, &PlayerClientInitEvent{ - Player: &Player{handle: player}, - }) -} +// result := event.Dispatch(Events, EventTypePlayerClientInit, &PlayerClientInitEvent{ +// Player: &Player{handle: *args.list.player}, +// }) + +// return C.bool(result) +// } // Player stream events //export onPlayerStreamIn -func onPlayerStreamIn(player, forPlayer unsafe.Pointer) { +func onPlayerStreamIn(args *C.struct_EventArgs_onPlayerStreamIn) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypePlayerStreamIn, &PlayerStreamInEvent{ - Player: &Player{handle: player}, - ForPlayer: &Player{handle: forPlayer}, + result := event.Dispatch(Events, EventTypePlayerStreamIn, &PlayerStreamInEvent{ + Player: &Player{handle: *args.list.player}, + ForPlayer: &Player{handle: *args.list.forPlayer}, }) + + return C.bool(result) } //export onPlayerStreamOut -func onPlayerStreamOut(player, forPlayer unsafe.Pointer) { +func onPlayerStreamOut(args *C.struct_EventArgs_onPlayerStreamOut) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypePlayerStreamOut, &PlayerStreamOutEvent{ - Player: &Player{handle: player}, - ForPlayer: &Player{handle: forPlayer}, + result := event.Dispatch(Events, EventTypePlayerStreamOut, &PlayerStreamOutEvent{ + Player: &Player{handle: *args.list.player}, + ForPlayer: &Player{handle: *args.list.forPlayer}, }) + + return C.bool(result) } // Player text events //export onPlayerText -func onPlayerText(player unsafe.Pointer, message *C.char) { +func onPlayerText(args *C.struct_EventArgs_onPlayerText) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypePlayerText, &PlayerTextEvent{ - Player: &Player{handle: player}, - Message: C.GoString(message), + text := *args.list.text + + result := event.Dispatch(Events, EventTypePlayerText, &PlayerTextEvent{ + Player: &Player{handle: *args.list.player}, + Message: C.GoStringN(text.data, C.int(text.len)), }) + + return C.bool(result) } //export onPlayerCommandText -func onPlayerCommandText(player unsafe.Pointer, message C.String) bool { +func onPlayerCommandText(args *C.struct_EventArgs_onPlayerCommandText) C.bool { defer handlePanic() - rawCmd := C.GoStringN(message.buf, C.int(message.length)) + player := *args.list.player + message := *args.list.command + + rawCmd := C.GoStringN(message.data, C.int(message.len)) tmp := strings.Fields(rawCmd) - name := strings.TrimPrefix(tmp[0], "/") - args := tmp[1:] + cmdName := strings.TrimPrefix(tmp[0], "/") + cmdArgs := tmp[1:] - exists := Commands.Has(name) + exists := Commands.Has(cmdName) if !exists { return false } - Commands.run(name, &Command{ + Commands.run(cmdName, &Command{ Sender: &Player{handle: player}, - Name: name, - Args: args, + Name: cmdName, + Args: cmdArgs, RawValue: rawCmd, }) @@ -634,498 +779,594 @@ func onPlayerCommandText(player unsafe.Pointer, message C.String) bool { // Player shot events -//export onPlayerShotMissed -func onPlayerShotMissed(player unsafe.Pointer, bulletData C.PlayerBulletData) bool { - defer handlePanic() - - return event.Dispatch(Events, EventTypePlayerShotMissed, &PlayerShotMissedEvent{ - Player: &Player{handle: player}, - Bullet: PlayerBullet{ - Origin: Vector3{ - X: float32(bulletData.origin.x), - Y: float32(bulletData.origin.y), - Z: float32(bulletData.origin.z), - }, - HitPos: Vector3{ - X: float32(bulletData.hitPos.x), - Y: float32(bulletData.hitPos.y), - Z: float32(bulletData.hitPos.z), - }, - Offset: Vector3{ - X: float32(bulletData.offset.x), - Y: float32(bulletData.offset.y), - Z: float32(bulletData.offset.z), - }, - Weapon: Weapon(bulletData.weapon), - }, - }) -} - -//export onPlayerShotPlayer -func onPlayerShotPlayer(player, target unsafe.Pointer, bulletData C.PlayerBulletData) bool { - defer handlePanic() - - return event.Dispatch(Events, EventTypePlayerShotPlayer, &PlayerShotPlayerEvent{ - Player: &Player{handle: player}, - Target: &Player{handle: target}, - Bullet: PlayerBullet{ - Origin: Vector3{ - X: float32(bulletData.origin.x), - Y: float32(bulletData.origin.y), - Z: float32(bulletData.origin.z), - }, - HitPos: Vector3{ - X: float32(bulletData.hitPos.x), - Y: float32(bulletData.hitPos.y), - Z: float32(bulletData.hitPos.z), - }, - Offset: Vector3{ - X: float32(bulletData.offset.x), - Y: float32(bulletData.offset.y), - Z: float32(bulletData.offset.z), - }, - Weapon: Weapon(bulletData.weapon), - }, - }) -} - -//export onPlayerShotVehicle -func onPlayerShotVehicle(player, target unsafe.Pointer, bulletData C.PlayerBulletData) bool { - defer handlePanic() - - return event.Dispatch(Events, EventTypePlayerShotVehicle, &PlayerShotVehicleEvent{ - Player: &Player{handle: player}, - Target: &Vehicle{handle: target}, - Bullet: PlayerBullet{ - Origin: Vector3{ - X: float32(bulletData.origin.x), - Y: float32(bulletData.origin.y), - Z: float32(bulletData.origin.z), - }, - HitPos: Vector3{ - X: float32(bulletData.hitPos.x), - Y: float32(bulletData.hitPos.y), - Z: float32(bulletData.hitPos.z), - }, - Offset: Vector3{ - X: float32(bulletData.offset.x), - Y: float32(bulletData.offset.y), - Z: float32(bulletData.offset.z), - }, - Weapon: Weapon(bulletData.weapon), - }, - }) -} - -//export onPlayerShotObject -func onPlayerShotObject(player, target unsafe.Pointer, bulletData C.PlayerBulletData) bool { - defer handlePanic() +// //export onPlayerShotMissed +// func onPlayerShotMissed(args *C.struct_EventArgs_onPlayerShotMissed) C.bool { +// defer handlePanic() + +// result := event.Dispatch(Events, EventTypePlayerShotMissed, &PlayerShotMissedEvent{ +// Player: &Player{handle: *args.list.player}, +// Bullet: PlayerBullet{ +// Origin: Vector3{ +// X: float32(*args.list.originX), +// Y: float32(*args.list.originY), +// Z: float32(*args.list.originZ), +// }, +// HitPosition: Vector3{ +// X: float32(*args.list.hitPosX), +// Y: float32(*args.list.hitPosY), +// Z: float32(*args.list.hitPosZ), +// }, +// Offset: Vector3{ +// X: float32(*args.list.offsetX), +// Y: float32(*args.list.offsetY), +// Z: float32(*args.list.offsetZ), +// }, +// Weapon: Weapon(*args.list.weapon), +// }, +// }) + +// return C.bool(result) +// } + +// //export onPlayerShotPlayer +// func onPlayerShotPlayer(args *C.struct_EventArgs_onPlayerShotPlayer) C.bool { +// defer handlePanic() + +// result := event.Dispatch(Events, EventTypePlayerShotPlayer, &PlayerShotPlayerEvent{ +// Player: &Player{handle: *args.list.player}, +// Target: &Player{handle: *args.list.target}, +// Bullet: PlayerBullet{ +// Origin: Vector3{ +// X: float32(*args.list.originX), +// Y: float32(*args.list.originY), +// Z: float32(*args.list.originZ), +// }, +// HitPosition: Vector3{ +// X: float32(*args.list.hitPosX), +// Y: float32(*args.list.hitPosY), +// Z: float32(*args.list.hitPosZ), +// }, +// Offset: Vector3{ +// X: float32(*args.list.offsetX), +// Y: float32(*args.list.offsetY), +// Z: float32(*args.list.offsetZ), +// }, +// Weapon: Weapon(*args.list.weapon), +// }, +// }) + +// return C.bool(result) +// } + +// //export onPlayerShotVehicle +// func onPlayerShotVehicle(args *C.struct_EventArgs_onPlayerShotVehicle) C.bool { +// defer handlePanic() + +// result := event.Dispatch(Events, EventTypePlayerShotVehicle, &PlayerShotVehicleEvent{ +// Player: &Player{handle: *args.list.player}, +// Target: &Vehicle{handle: *args.list.target}, +// Bullet: PlayerBullet{ +// Origin: Vector3{ +// X: float32(*args.list.originX), +// Y: float32(*args.list.originY), +// Z: float32(*args.list.originZ), +// }, +// HitPosition: Vector3{ +// X: float32(*args.list.hitPosX), +// Y: float32(*args.list.hitPosY), +// Z: float32(*args.list.hitPosZ), +// }, +// Offset: Vector3{ +// X: float32(*args.list.offsetX), +// Y: float32(*args.list.offsetY), +// Z: float32(*args.list.offsetZ), +// }, +// Weapon: Weapon(*args.list.weapon), +// }, +// }) + +// return C.bool(result) +// } + +// //export onPlayerShotObject +// func onPlayerShotObject(args *C.struct_EventArgs_onPlayerShotObject) C.bool { +// defer handlePanic() + +// result := event.Dispatch(Events, EventTypePlayerShotObject, &PlayerShotObjectEvent{ +// Player: &Player{handle: *args.list.player}, +// Target: &Object{handle: *args.list.target}, +// Bullet: PlayerBullet{ +// Origin: Vector3{ +// X: float32(*args.list.originX), +// Y: float32(*args.list.originY), +// Z: float32(*args.list.originZ), +// }, +// HitPosition: Vector3{ +// X: float32(*args.list.hitPosX), +// Y: float32(*args.list.hitPosY), +// Z: float32(*args.list.hitPosZ), +// }, +// Offset: Vector3{ +// X: float32(*args.list.offsetX), +// Y: float32(*args.list.offsetY), +// Z: float32(*args.list.offsetZ), +// }, +// Weapon: Weapon(*args.list.weapon), +// }, +// }) + +// return C.bool(result) +// } + +// //export onPlayerShotPlayerObject +// func onPlayerShotPlayerObject(args *C.struct_EventArgs_onPlayerShotPlayerObject) C.bool { +// defer handlePanic() + +// eventPlayer := &Player{handle: *args.list.player} + +// result := event.Dispatch(Events, EventTypePlayerShotPlayerObject, &PlayerShotPlayerObjectEvent{ +// Player: eventPlayer, +// Target: &PlayerObject{ +// handle: *args.list.target, +// player: eventPlayer, +// }, +// Bullet: PlayerBullet{ +// Origin: Vector3{ +// X: float32(*args.list.originX), +// Y: float32(*args.list.originY), +// Z: float32(*args.list.originZ), +// }, +// HitPosition: Vector3{ +// X: float32(*args.list.hitPosX), +// Y: float32(*args.list.hitPosY), +// Z: float32(*args.list.hitPosZ), +// }, +// Offset: Vector3{ +// X: float32(*args.list.offsetX), +// Y: float32(*args.list.offsetY), +// Z: float32(*args.list.offsetZ), +// }, +// Weapon: Weapon(*args.list.weapon), +// }, +// }) + +// return C.bool(result) +// } - return event.Dispatch(Events, EventTypePlayerShotObject, &PlayerShotObjectEvent{ - Player: &Player{handle: player}, - Target: &Object{handle: target}, - Bullet: PlayerBullet{ - Origin: Vector3{ - X: float32(bulletData.origin.x), - Y: float32(bulletData.origin.y), - Z: float32(bulletData.origin.z), - }, - HitPos: Vector3{ - X: float32(bulletData.hitPos.x), - Y: float32(bulletData.hitPos.y), - Z: float32(bulletData.hitPos.z), - }, - Offset: Vector3{ - X: float32(bulletData.offset.x), - Y: float32(bulletData.offset.y), - Z: float32(bulletData.offset.z), - }, - Weapon: Weapon(bulletData.weapon), - }, - }) -} +// Player change events -//export onPlayerShotPlayerObject -func onPlayerShotPlayerObject(player, target unsafe.Pointer, bulletData C.PlayerBulletData) bool { - defer handlePanic() +// //export onPlayerScoreChange +// func onPlayerScoreChange(args *C.struct_EventArgs_onPlayerScoreChange) C.bool { +// defer handlePanic() - return event.Dispatch(Events, EventTypePlayerShotPlayerObject, &PlayerShotPlayerObjectEvent{ - Player: &Player{handle: player}, - Target: &PlayerObject{handle: target}, - Bullet: PlayerBullet{ - Origin: Vector3{ - X: float32(bulletData.origin.x), - Y: float32(bulletData.origin.y), - Z: float32(bulletData.origin.z), - }, - HitPos: Vector3{ - X: float32(bulletData.hitPos.x), - Y: float32(bulletData.hitPos.y), - Z: float32(bulletData.hitPos.z), - }, - Offset: Vector3{ - X: float32(bulletData.offset.x), - Y: float32(bulletData.offset.y), - Z: float32(bulletData.offset.z), - }, - Weapon: Weapon(bulletData.weapon), - }, - }) -} +// result := event.Dispatch(Events, EventTypePlayerScoreChange, &PlayerScoreChangeEvent{ +// Player: &Player{handle: *args.list.player}, +// Score: int(*args.list.score), +// }) -// Player change events +// return C.bool(result) +// } -//export onPlayerScoreChange -func onPlayerScoreChange(player unsafe.Pointer, score int) { - defer handlePanic() +// //export onPlayerNameChange +// func onPlayerNameChange(args *C.struct_EventArgs_onPlayerNameChange) C.bool { +// defer handlePanic() - event.Dispatch(Events, EventTypePlayerScoreChange, &PlayerScoreChangeEvent{ - Player: &Player{handle: player}, - Score: score, - }) -} +// oldName := *args.list.oldName -//export onPlayerNameChange -func onPlayerNameChange(player unsafe.Pointer, oldName C.String) { - defer handlePanic() +// result := event.Dispatch(Events, EventTypePlayerNameChange, &PlayerNameChangeEvent{ +// Player: &Player{handle: *args.list.player}, +// OldName: C.GoStringN(oldName.data, C.int(oldName.len)), +// }) - event.Dispatch(Events, EventTypePlayerNameChange, &PlayerNameChangeEvent{ - Player: &Player{handle: player}, - OldName: C.GoStringN(oldName.buf, C.int(oldName.length)), - }) -} +// return C.bool(result) +// } //export onPlayerInteriorChange -func onPlayerInteriorChange(player unsafe.Pointer, newInterior, oldInterior uint) { +func onPlayerInteriorChange(args *C.struct_EventArgs_onPlayerInteriorChange) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypePlayerInteriorChange, &PlayerInteriorChangeEvent{ - Player: &Player{handle: player}, - NewInterior: newInterior, - OldInterior: oldInterior, + result := event.Dispatch(Events, EventTypePlayerInteriorChange, &PlayerInteriorChangeEvent{ + Player: &Player{handle: *args.list.player}, + NewInterior: int(*args.list.newInterior), + OldInterior: int(*args.list.oldInterior), }) + + return C.bool(result) } //export onPlayerStateChange -func onPlayerStateChange(player unsafe.Pointer, newState, oldState int) { +func onPlayerStateChange(args *C.struct_EventArgs_onPlayerStateChange) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypePlayerStateChange, &PlayerStateChangeEvent{ - Player: &Player{handle: player}, - NewState: PlayerState(newState), - OldState: PlayerState(oldState), + result := event.Dispatch(Events, EventTypePlayerStateChange, &PlayerStateChangeEvent{ + Player: &Player{handle: *args.list.player}, + NewState: PlayerState(*args.list.newState), + OldState: PlayerState(*args.list.oldState), }) + + return C.bool(result) } //export onPlayerKeyStateChange -func onPlayerKeyStateChange(player unsafe.Pointer, newKeys, oldKeys uint) { +func onPlayerKeyStateChange(args *C.struct_EventArgs_onPlayerKeyStateChange) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypePlayerKeyStateChange, &PlayerKeyStateChangeEvent{ - Player: &Player{handle: player}, - NewKeys: newKeys, - OldKeys: oldKeys, + result := event.Dispatch(Events, EventTypePlayerKeyStateChange, &PlayerKeyStateChangeEvent{ + Player: &Player{handle: *args.list.player}, + NewKeys: int(*args.list.newKeys), + OldKeys: int(*args.list.oldKeys), }) + + return C.bool(result) } // Player damage events //export onPlayerDeath -func onPlayerDeath(player, killer unsafe.Pointer, reason int) { +func onPlayerDeath(args *C.struct_EventArgs_onPlayerDeath) C.bool { defer handlePanic() + player := *args.list.player + killer := *args.list.killer + reason := int(*args.list.reason) + eventKiller := &Player{handle: killer} + if killer == nil { eventKiller = nil } - event.Dispatch(Events, EventTypePlayerDeath, &PlayerDeathEvent{ + result := event.Dispatch(Events, EventTypePlayerDeath, &PlayerDeathEvent{ Player: &Player{handle: player}, Killer: eventKiller, Reason: reason, }) + + return C.bool(result) } //export onPlayerTakeDamage -func onPlayerTakeDamage(player, from unsafe.Pointer, amount float32, weapon uint, part int) { +func onPlayerTakeDamage(args *C.struct_EventArgs_onPlayerTakeDamage) C.bool { defer handlePanic() + player := *args.list.player + from := *args.list.from + amount := float32(*args.list.amount) + weapon := Weapon(*args.list.weapon) + bodyPart := BodyPart(*args.list.bodypart) + eventFrom := &Player{handle: from} if from == nil { eventFrom = nil } - event.Dispatch(Events, EventTypePlayerTakeDamage, &PlayerTakeDamageEvent{ + result := event.Dispatch(Events, EventTypePlayerTakeDamage, &PlayerTakeDamageEvent{ Player: &Player{handle: player}, From: eventFrom, Amount: amount, - Weapon: Weapon(weapon), - Part: BodyPart(part), + Weapon: weapon, + Part: bodyPart, }) + + return C.bool(result) } //export onPlayerGiveDamage -func onPlayerGiveDamage(player, to unsafe.Pointer, amount float32, weapon uint, part int) { +func onPlayerGiveDamage(args *C.struct_EventArgs_onPlayerGiveDamage) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypePlayerGiveDamage, &PlayerGiveDamageEvent{ - Player: &Player{handle: player}, - To: &Player{handle: to}, - Amount: amount, - Weapon: Weapon(weapon), - Part: BodyPart(part), + result := event.Dispatch(Events, EventTypePlayerGiveDamage, &PlayerGiveDamageEvent{ + Player: &Player{handle: *args.list.player}, + To: &Player{handle: *args.list.to}, + Amount: float32(*args.list.amount), + Weapon: Weapon(*args.list.weapon), + BodyPart: BodyPart(*args.list.bodypart), }) + + return C.bool(result) } // Player click events //export onPlayerClickMap -func onPlayerClickMap(player unsafe.Pointer, pos C.Vector3) { +func onPlayerClickMap(args *C.struct_EventArgs_onPlayerClickMap) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypePlayerClickMap, &PlayerClickMapEvent{ - Player: &Player{handle: player}, + result := event.Dispatch(Events, EventTypePlayerClickMap, &PlayerClickMapEvent{ + Player: &Player{handle: *args.list.player}, Position: Vector3{ - X: float32(pos.x), - Y: float32(pos.y), - Z: float32(pos.z), + X: float32(*args.list.x), + Y: float32(*args.list.y), + Z: float32(*args.list.z), }, }) + + return C.bool(result) } //export onPlayerClickPlayer -func onPlayerClickPlayer(player, clicked unsafe.Pointer, source int) { +func onPlayerClickPlayer(args *C.struct_EventArgs_onPlayerClickPlayer) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypePlayerClickPlayer, &PlayerClickPlayerEvent{ - Player: &Player{handle: player}, - Clicked: &Player{handle: clicked}, - Source: PlayerClickSource(source), + result := event.Dispatch(Events, EventTypePlayerClickPlayer, &PlayerClickPlayerEvent{ + Player: &Player{handle: *args.list.player}, + Target: &Player{handle: *args.list.clicked}, + Source: PlayerClickSource(*args.list.source), }) + + return C.bool(result) } // Player check events -//export onClientCheckResponse -func onClientCheckResponse(player unsafe.Pointer, actionType, address, results int) { - defer handlePanic() +// //export onClientCheckResponse +// func onClientCheckResponse(args *C.struct_EventArgs_onClientCheckResponse) C.bool { +// defer handlePanic() - event.Dispatch(Events, EventTypeClientCheckResponse, &ClientCheckResponseEvent{ - Player: &Player{handle: player}, - ActionType: actionType, - Address: address, - Results: results, - }) -} +// result := event.Dispatch(Events, EventTypeClientCheckResponse, &ClientCheckResponseEvent{ +// Player: &Player{handle: *args.list.player}, +// ActionType: int(*args.list.actionType), +// Address: int(*args.list.address), +// Results: int(*args.list.result), +// }) + +// return C.bool(result) +// } // Player update event -//export onPlayerUpdate -func onPlayerUpdate(player unsafe.Pointer, now C.longlong) bool { - defer handlePanic() +// //export onPlayerUpdate +// func onPlayerUpdate(args *C.struct_EventArgs_onPlayerUpdate) C.bool { +// defer handlePanic() - return event.Dispatch(Events, EventTypePlayerUpdate, &PlayerUpdateEvent{ - Player: &Player{handle: player}, - Now: time.Unix(0, int64(now)*int64(time.Millisecond)), - }) -} +// result := event.Dispatch(Events, EventTypePlayerUpdate, &PlayerUpdateEvent{ +// Player: &Player{handle: *args.list.player}, +// Now: time.Unix(int64(*args.list.now), 0), +// }) + +// return C.bool(result) +// } // Textdraw events //export onPlayerClickTextDraw -func onPlayerClickTextDraw(player, textdraw unsafe.Pointer) { +func onPlayerClickTextDraw(args *C.struct_EventArgs_onPlayerClickTextDraw) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypePlayerClickTextDraw, &PlayerClickTextDrawEvent{ - Player: &Player{handle: player}, - Textdraw: &Textdraw{handle: textdraw}, + result := event.Dispatch(Events, EventTypePlayerClickTextDraw, &PlayerClickTextDrawEvent{ + Player: &Player{handle: *args.list.player}, + Textdraw: &Textdraw{handle: *args.list.textdraw}, }) + + return C.bool(result) } //export onPlayerClickPlayerTextDraw -func onPlayerClickPlayerTextDraw(player, textdraw unsafe.Pointer) { +func onPlayerClickPlayerTextDraw(args *C.struct_EventArgs_onPlayerClickPlayerTextDraw) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypePlayerClickPlayerTextDraw, &PlayerClickPlayerTextDrawEvent{ - Player: &Player{handle: player}, - Textdraw: &PlayerTextdraw{handle: textdraw}, + eventPlayer := &Player{handle: *args.list.player} + + result := event.Dispatch(Events, EventTypePlayerClickPlayerTextDraw, &PlayerClickPlayerTextDrawEvent{ + Player: eventPlayer, + Textdraw: &PlayerTextdraw{ + handle: *args.list.textdraw, + player: eventPlayer, + }, }) + + return C.bool(result) } //export onPlayerCancelTextDrawSelection -func onPlayerCancelTextDrawSelection(player unsafe.Pointer) bool { +func onPlayerCancelTextDrawSelection(args *C.struct_EventArgs_onPlayerCancelTextDrawSelection) C.bool { defer handlePanic() - return event.Dispatch(Events, EventTypePlayerCancelTextDrawSelection, &PlayerCancelTextDrawSelectionEvent{ - Player: &Player{handle: player}, + result := event.Dispatch(Events, EventTypePlayerCancelTextDrawSelection, &PlayerCancelTextDrawSelectionEvent{ + Player: &Player{handle: *args.list.player}, }) + + return C.bool(result) } //export onPlayerCancelPlayerTextDrawSelection -func onPlayerCancelPlayerTextDrawSelection(player unsafe.Pointer) bool { +func onPlayerCancelPlayerTextDrawSelection(args *C.struct_EventArgs_onPlayerCancelPlayerTextDrawSelection) C.bool { defer handlePanic() - return event.Dispatch(Events, EventTypePlayerCancelPlayerTextDrawSelection, &PlayerCancelPlayerTextDrawSelectionEvent{ - Player: &Player{handle: player}, + result := event.Dispatch(Events, EventTypePlayerCancelPlayerTextDrawSelection, &PlayerCancelPlayerTextDrawSelectionEvent{ + Player: &Player{handle: *args.list.player}, }) + + return C.bool(result) } // Vehicle events //export onVehicleStreamIn -func onVehicleStreamIn(vehicle, player unsafe.Pointer) { +func onVehicleStreamIn(args *C.struct_EventArgs_onVehicleStreamIn) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypeVehicleStreamIn, &VehicleStreamInEvent{ - Vehicle: &Vehicle{handle: vehicle}, - ForPlayer: &Player{handle: player}, + result := event.Dispatch(Events, EventTypeVehicleStreamIn, &VehicleStreamInEvent{ + Vehicle: &Vehicle{handle: *args.list.vehicle}, + ForPlayer: &Player{handle: *args.list.player}, }) + + return C.bool(result) } //export onVehicleStreamOut -func onVehicleStreamOut(vehicle, player unsafe.Pointer) { +func onVehicleStreamOut(args *C.struct_EventArgs_onVehicleStreamOut) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypeVehicleStreamOut, &VehicleStreamOutEvent{ - Vehicle: &Vehicle{handle: vehicle}, - ForPlayer: &Player{handle: player}, + result := event.Dispatch(Events, EventTypeVehicleStreamOut, &VehicleStreamOutEvent{ + Vehicle: &Vehicle{handle: *args.list.vehicle}, + ForPlayer: &Player{handle: *args.list.player}, }) + + return C.bool(result) } //export onVehicleDeath -func onVehicleDeath(vehicle, killer unsafe.Pointer) { +func onVehicleDeath(args *C.struct_EventArgs_onVehicleDeath) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypeVehicleDeath, &VehicleDeathEvent{ - Vehicle: &Vehicle{handle: vehicle}, - Killer: &Player{handle: killer}, + result := event.Dispatch(Events, EventTypeVehicleDeath, &VehicleDeathEvent{ + Vehicle: &Vehicle{handle: *args.list.vehicle}, + Killer: &Player{handle: *args.list.player}, }) + + return C.bool(result) } //export onPlayerEnterVehicle -func onPlayerEnterVehicle(player, vehicle unsafe.Pointer, isPassenger int) { +func onPlayerEnterVehicle(args *C.struct_EventArgs_onPlayerEnterVehicle) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypePlayerEnterVehicle, &PlayerEnterVehicleEvent{ - Player: &Player{handle: player}, - Vehicle: &Vehicle{handle: vehicle}, - IsPassenger: isPassenger != 0, + result := event.Dispatch(Events, EventTypePlayerEnterVehicle, &PlayerEnterVehicleEvent{ + Player: &Player{handle: *args.list.player}, + Vehicle: &Vehicle{handle: *args.list.vehicle}, + IsPassenger: bool(*args.list.passenger), }) + + return C.bool(result) } //export onPlayerExitVehicle -func onPlayerExitVehicle(player, vehicle unsafe.Pointer) { +func onPlayerExitVehicle(args *C.struct_EventArgs_onPlayerExitVehicle) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypePlayerExitVehicle, &PlayerExitVehicleEvent{ - Player: &Player{handle: player}, - Vehicle: &Vehicle{handle: vehicle}, + result := event.Dispatch(Events, EventTypePlayerExitVehicle, &PlayerExitVehicleEvent{ + Player: &Player{handle: *args.list.player}, + Vehicle: &Vehicle{handle: *args.list.vehicle}, }) + + return C.bool(result) } //export onVehicleDamageStatusUpdate -func onVehicleDamageStatusUpdate(vehicle, player unsafe.Pointer) { +func onVehicleDamageStatusUpdate(args *C.struct_EventArgs_onVehicleDamageStatusUpdate) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypeVehicleDamageStatusUpdate, &VehicleDamageStatusUpdateEvent{ - Vehicle: &Vehicle{handle: vehicle}, - Player: &Player{handle: player}, + result := event.Dispatch(Events, EventTypeVehicleDamageStatusUpdate, &VehicleDamageStatusUpdateEvent{ + Vehicle: &Vehicle{handle: *args.list.vehicle}, + Player: &Player{handle: *args.list.player}, }) + + return C.bool(result) } //export onVehiclePaintJob -func onVehiclePaintJob(player, vehicle unsafe.Pointer, paintJob int) { +func onVehiclePaintJob(args *C.struct_EventArgs_onVehiclePaintJob) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypeVehiclePaintJob, &VehiclePaintJobEvent{ - Player: &Player{handle: player}, - Vehicle: &Vehicle{handle: vehicle}, - PaintJob: paintJob, + result := event.Dispatch(Events, EventTypeVehiclePaintJob, &VehiclePaintJobEvent{ + Player: &Player{handle: *args.list.player}, + Vehicle: &Vehicle{handle: *args.list.vehicle}, + PaintJob: int(*args.list.paintJob), }) + + return C.bool(result) } //export onVehicleMod -func onVehicleMod(player, vehicle unsafe.Pointer, component int) { +func onVehicleMod(args *C.struct_EventArgs_onVehicleMod) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypeVehicleMod, &VehicleModEvent{ - Player: &Player{handle: player}, - Vehicle: &Vehicle{handle: vehicle}, - Component: component, + result := event.Dispatch(Events, EventTypeVehicleMod, &VehicleModEvent{ + Player: &Player{handle: *args.list.player}, + Vehicle: &Vehicle{handle: *args.list.vehicle}, + Component: int(*args.list.component), }) + + return C.bool(result) } //export onVehicleRespray -func onVehicleRespray(player, vehicle unsafe.Pointer, color1, color2 int) { +func onVehicleRespray(args *C.struct_EventArgs_onVehicleRespray) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypeVehicleRespray, &VehicleResprayEvent{ - Player: &Player{handle: player}, - Vehicle: &Vehicle{handle: vehicle}, - Color: VehicleColor{Primary: color1, Secondary: color2}, + result := event.Dispatch(Events, EventTypeVehicleRespray, &VehicleResprayEvent{ + Player: &Player{handle: *args.list.player}, + Vehicle: &Vehicle{handle: *args.list.vehicle}, + Color: VehicleColor{ + Primary: int(*args.list.color1), + Secondary: int(*args.list.color2), + }, }) + + return C.bool(result) } -//export onEnterExitModShop -func onEnterExitModShop(player unsafe.Pointer, enterexit bool, interiorID int) { - defer handlePanic() +// //export onEnterExitModShop +// func onEnterExitModShop(args *C.struct_EventArgs_onEnterExitModShop) C.bool { +// defer handlePanic() - event.Dispatch(Events, EventTypeEnterExitModShop, &EnterExitModShopEvent{ - Player: &Player{handle: player}, - EnterExit: enterexit, - InteriorID: interiorID, - }) -} +// result := event.Dispatch(Events, EventTypeEnterExitModShop, &EnterExitModShopEvent{ +// Player: &Player{handle: *args.list.player}, +// EnterExit: bool(*args.list.enterexit), +// InteriorID: int(*args.list.interiorId), +// }) + +// return C.bool(result) +// } //export onVehicleSpawn -func onVehicleSpawn(vehicle unsafe.Pointer) { +func onVehicleSpawn(args *C.struct_EventArgs_onVehicleSpawn) C.bool { defer handlePanic() - event.Dispatch(Events, EventTypeVehicleSpawn, &VehicleSpawnEvent{ - Vehicle: &Vehicle{handle: vehicle}, + result := event.Dispatch(Events, EventTypeVehicleSpawn, &VehicleSpawnEvent{ + Vehicle: &Vehicle{handle: *args.list.vehicle}, }) + + return C.bool(result) } //export onUnoccupiedVehicleUpdate -func onUnoccupiedVehicleUpdate(vehicle, player unsafe.Pointer, updateData C.UnoccupiedVehicleUpdate) bool { +func onUnoccupiedVehicleUpdate(args *C.struct_EventArgs_onUnoccupiedVehicleUpdate) C.bool { defer handlePanic() - return event.Dispatch(Events, EventTypeUnoccupiedVehicleUpdate, &UnoccupiedVehicleUpdateEvent{ - Vehicle: &Vehicle{handle: vehicle}, - Player: &Player{handle: player}, + result := event.Dispatch(Events, EventTypeUnoccupiedVehicleUpdate, &UnoccupiedVehicleUpdateEvent{ + Vehicle: &Vehicle{handle: *args.list.vehicle}, + Player: &Player{handle: *args.list.player}, Update: UnoccupiedVehicleUpdate{ - Seat: int(updateData.seat), + Seat: int(*args.list.seat), Position: Vector3{ - X: float32(updateData.position.x), - Y: float32(updateData.position.y), - Z: float32(updateData.position.z), + X: float32(*args.list.posX), + Y: float32(*args.list.posY), + Z: float32(*args.list.posZ), }, Velocity: Vector3{ - X: float32(updateData.velocity.x), - Y: float32(updateData.velocity.y), - Z: float32(updateData.velocity.z), + X: float32(*args.list.velocityX), + Y: float32(*args.list.velocityY), + Z: float32(*args.list.velocityZ), }, }, }) + + return C.bool(result) } //export onTrailerUpdate -func onTrailerUpdate(player, vehicle unsafe.Pointer) bool { +func onTrailerUpdate(args *C.struct_EventArgs_onTrailerUpdate) C.bool { defer handlePanic() - return event.Dispatch(Events, EventTypeTrailerUpdate, &TrailerUpdateEvent{ - Player: &Player{handle: player}, - Vehicle: &Vehicle{handle: vehicle}, + result := event.Dispatch(Events, EventTypeTrailerUpdate, &TrailerUpdateEvent{ + Player: &Player{handle: *args.list.player}, + Trailer: &Vehicle{handle: *args.list.trailer}, }) + + return C.bool(result) } //export onVehicleSirenStateChange -func onVehicleSirenStateChange(player, vehicle unsafe.Pointer, sirenState uint8) bool { +func onVehicleSirenStateChange(args *C.struct_EventArgs_onVehicleSirenStateChange) C.bool { defer handlePanic() - return event.Dispatch(Events, EventTypeVehicleSirenStateChange, &VehicleSirenStateChangeEvent{ - Player: &Player{handle: player}, - Vehicle: &Vehicle{handle: vehicle}, - SirenState: int(sirenState), + result := event.Dispatch(Events, EventTypeVehicleSirenStateChange, &VehicleSirenStateChangeEvent{ + Player: &Player{handle: *args.list.player}, + Vehicle: &Vehicle{handle: *args.list.vehicle}, + SirenState: int(*args.list.sirenState), }) + + return C.bool(result) } From c7e8830cabcfaf21befbc8c21c22d27ee7b11f4e Mon Sep 17 00:00:00 2001 From: iscanderoff Date: Fri, 5 Jul 2024 03:18:19 +0800 Subject: [PATCH 05/31] Changes for v1 --- event.go | 74 ++++++++++++++++++++++++++++++++++--------------------- player.go | 16 ++++++------ 2 files changed, 54 insertions(+), 36 deletions(-) diff --git a/event.go b/event.go index 8959b5d..451d92b 100644 --- a/event.go +++ b/event.go @@ -59,13 +59,22 @@ const ( ObjectEditResponseUpdate ) +type DownloadRequestType int + +const ( + DownloadRequestTypeUnknown DownloadRequestType = iota - 1 + DownloadRequestTypeEmpty + DownloadRequestTypeModelFile + DownloadRequestTypeTextureFile +) + type PlayerBullet struct { - Origin Vector3 - HitPos Vector3 - Offset Vector3 - Weapon Weapon - HitType int - HitID int + Origin Vector3 + HitPosition Vector3 + Offset Vector3 + Weapon Weapon + HitType int + HitID int } type UnoccupiedVehicleUpdate struct { @@ -96,6 +105,9 @@ const ( EventTypeConsoleText event.Type = "consoleText" EventTypeRconLoginAttempt event.Type = "rconLoginAttempt" + // Core events + EventTypeTick event.Type = "tick" + // Custom model events EventTypePlayerFinishedDownloading event.Type = "playerFinishedDownloading" EventTypePlayerRequestDownload event.Type = "playerRequestDownload" @@ -208,11 +220,11 @@ type GameModeExitEvent struct { // Actor events type PlayerGiveDamageActorEvent struct { - Player *Player - Actor *Player - Amount float32 - Weapon uint - Part BodyPart + Player *Player + Actor *Player + Amount float32 + Weapon Weapon + BodyPart BodyPart } type ActorStreamInEvent struct { @@ -263,6 +275,11 @@ type RconLoginAttemptEvent struct { Success bool } +type TickEvent struct { + Elapsed time.Duration + Now time.Time +} + // Custom model events type PlayerFinishedDownloadingEvent struct { @@ -270,8 +287,9 @@ type PlayerFinishedDownloadingEvent struct { } type PlayerRequestDownloadEvent struct { - Player *Player - Type, Checksum int + Player *Player + Type DownloadRequestType + Checksum int } // Dialog events @@ -345,7 +363,7 @@ type PlayerClickPlayerTurfEvent struct { type PlayerSelectedMenuRowEvent struct { Player *Player - MenuRow uint8 + MenuRow int } type PlayerExitedMenuEvent struct { @@ -426,7 +444,7 @@ type PlayerSpawnEvent struct { type IncomingConnectionEvent struct { Player *Player - IPAddress string + ipAddress string Port int } @@ -507,8 +525,8 @@ type PlayerNameChangeEvent struct { type PlayerInteriorChangeEvent struct { Player *Player - NewInterior uint - OldInterior uint + NewInterior int + OldInterior int } type PlayerStateChangeEvent struct { @@ -519,8 +537,8 @@ type PlayerStateChangeEvent struct { type PlayerKeyStateChangeEvent struct { Player *Player - NewKeys uint - OldKeys uint + NewKeys int + OldKeys int } // Player damage events @@ -540,11 +558,11 @@ type PlayerTakeDamageEvent struct { } type PlayerGiveDamageEvent struct { - Player *Player - To *Player - Amount float32 - Weapon Weapon - Part BodyPart + Player *Player + To *Player + Amount float32 + Weapon Weapon + BodyPart BodyPart } // Player click events @@ -555,9 +573,9 @@ type PlayerClickMapEvent struct { } type PlayerClickPlayerEvent struct { - Player *Player - Clicked *Player - Source PlayerClickSource + Player *Player + Target *Player + Source PlayerClickSource } // Player check events @@ -665,7 +683,7 @@ type UnoccupiedVehicleUpdateEvent struct { type TrailerUpdateEvent struct { Player *Player - Vehicle *Vehicle + Trailer *Vehicle } type VehicleSirenStateChangeEvent struct { diff --git a/player.go b/player.go index 2eb9c43..a71a7df 100644 --- a/player.go +++ b/player.go @@ -169,10 +169,10 @@ const ( ) type PlayerAttachment struct { - ModelID int - Bone PlayerBone - Offset, Rot, Scale Vector3 - Color1, Color2 Color + ModelID int + Bone PlayerBone + Offset, Rotation, Scale Vector3 + Color1, Color2 Color } type PlayerBone int @@ -1385,9 +1385,9 @@ func (p *Player) SetAttachment(slotIdx int, attachment PlayerAttachment) { C.float(attachment.Offset.X), C.float(attachment.Offset.Y), C.float(attachment.Offset.Z), - C.float(attachment.Rot.X), - C.float(attachment.Rot.Y), - C.float(attachment.Rot.Z), + C.float(attachment.Rotation.X), + C.float(attachment.Rotation.Y), + C.float(attachment.Rotation.Z), C.float(attachment.Scale.X), C.float(attachment.Scale.Y), C.float(attachment.Scale.Z), @@ -1408,7 +1408,7 @@ func (p *Player) Attachment(slotIdx int) PlayerAttachment { Y: float32(obj.offset.y), Z: float32(obj.offset.z), }, - Rot: Vector3{ + Rotation: Vector3{ X: float32(obj.rotation.x), Y: float32(obj.rotation.y), Z: float32(obj.rotation.z), From eb4f94292553e721384c1d26f1aa783ea0980f18 Mon Sep 17 00:00:00 2001 From: iscanderoff Date: Fri, 5 Jul 2024 14:37:50 +0800 Subject: [PATCH 06/31] Comment onPlayerEnterPlayerGangZone callback --- omp.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/omp.go b/omp.go index 70d4f53..4ba7f0e 100644 --- a/omp.go +++ b/omp.go @@ -339,22 +339,22 @@ func onPlayerEnterGangZone(args *C.struct_EventArgs_onPlayerEnterGangZone) C.boo return C.bool(result) } -//export onPlayerEnterPlayerGangZone -func onPlayerEnterPlayerGangZone(args *C.struct_EventArgs_onPlayerEnterPlayerGangZone) C.bool { - defer handlePanic() +// //export onPlayerEnterPlayerGangZone +// func onPlayerEnterPlayerGangZone(args *C.struct_EventArgs_onPlayerEnterPlayerGangZone) C.bool { +// defer handlePanic() - eventPlayer := &Player{handle: *args.list.player} +// eventPlayer := &Player{handle: *args.list.player} - result := event.Dispatch(Events, EventTypePlayerEnterPlayerTurf, &PlayerEnterPlayerTurfEvent{ - Player: eventPlayer, - Turf: &PlayerTurf{ - handle: *args.list.zone, - player: eventPlayer, - }, - }) +// result := event.Dispatch(Events, EventTypePlayerEnterPlayerTurf, &PlayerEnterPlayerTurfEvent{ +// Player: eventPlayer, +// Turf: &PlayerTurf{ +// handle: *args.list.zone, +// player: eventPlayer, +// }, +// }) - return C.bool(result) -} +// return C.bool(result) +// } //export onPlayerLeaveGangZone func onPlayerLeaveGangZone(args *C.struct_EventArgs_onPlayerLeaveGangZone) C.bool { From 5be814d0f26b01e5724110c31d183f284d01bcfd Mon Sep 17 00:00:00 2001 From: iscanderoff Date: Fri, 5 Jul 2024 14:58:26 +0800 Subject: [PATCH 07/31] Remove C wrapper files. Will generate them from capi/apidocs/api.json --- actor.cpp | 79 ----- checkpoint.cpp | 83 ------ class.cpp | 27 -- component.cpp | 7 - config.cpp | 35 --- console.cpp | 7 - include/actor.h | 46 --- include/checkpoint.h | 33 --- include/class.h | 33 --- include/component.h | 11 - include/config.h | 18 -- include/console.h | 11 - include/menu.h | 26 -- include/model.h | 14 - include/object.h | 127 -------- include/pickup.h | 30 -- include/player.h | 243 ---------------- include/server.h | 18 -- include/textdraw.h | 97 ------- include/textlabel.h | 60 ---- include/turf.h | 36 --- include/vehicle.h | 91 ------ menu.cpp | 67 ----- model.cpp | 19 -- object.cpp | 223 -------------- pickup.cpp | 67 ----- player.cpp | 679 ------------------------------------------- server.cpp | 27 -- textdraw.cpp | 343 ---------------------- textlabel.cpp | 159 ---------- turf.cpp | 85 ------ vehicle.cpp | 243 ---------------- 32 files changed, 3044 deletions(-) delete mode 100644 actor.cpp delete mode 100644 checkpoint.cpp delete mode 100644 class.cpp delete mode 100644 component.cpp delete mode 100644 config.cpp delete mode 100644 console.cpp delete mode 100644 include/actor.h delete mode 100644 include/checkpoint.h delete mode 100644 include/class.h delete mode 100644 include/component.h delete mode 100644 include/config.h delete mode 100644 include/console.h delete mode 100644 include/menu.h delete mode 100644 include/model.h delete mode 100644 include/object.h delete mode 100644 include/pickup.h delete mode 100644 include/player.h delete mode 100644 include/server.h delete mode 100644 include/textdraw.h delete mode 100644 include/textlabel.h delete mode 100644 include/turf.h delete mode 100644 include/vehicle.h delete mode 100644 menu.cpp delete mode 100644 model.cpp delete mode 100644 object.cpp delete mode 100644 pickup.cpp delete mode 100644 player.cpp delete mode 100644 server.cpp delete mode 100644 textdraw.cpp delete mode 100644 textlabel.cpp delete mode 100644 turf.cpp delete mode 100644 vehicle.cpp diff --git a/actor.cpp b/actor.cpp deleted file mode 100644 index b3d5734..0000000 --- a/actor.cpp +++ /dev/null @@ -1,79 +0,0 @@ -#include "include/actor.h" - -extern "C" { - void* actor_create(int skin, float posX, float posY, float posZ, float angle) { - return call("actor_create", skin, posX, posY, posZ, angle); - } - - void actor_release(void* actor) { - return call("actor_release", actor); - } - - void actor_setSkin(void* actor, int skin) { - return call("actor_setSkin", actor, skin); - } - - int actor_getSkin(void* actor) { - return call("actor_getSkin", actor); - } - - void actor_applyAnimation(void* actor, float delta, unsigned char loop, unsigned char lockX, unsigned char lockY, unsigned char freeze, uint32_t time, String lib, String name) { - return call("actor_applyAnimation", actor, delta, loop, lockX, lockY, freeze, time, lib, name); - } - - CAnimationData actor_getAnimation(void* actor) { - return call("actor_getAnimation", actor); - } - - void actor_clearAnimations(void* actor) { - return call("actor_clearAnimations", actor); - } - - void actor_setHealth(void* actor, float health) { - return call("actor_setHealth", actor, health); - } - - float actor_getHealth(void* actor) { - return call("actor_getHealth", actor); - } - - void actor_setInvulnerable(void* actor, unsigned char invuln) { - return call("actor_setInvulnerable", actor, invuln); - } - - unsigned char actor_isInvulnerable(void* actor) { - return call("actor_isInvulnerable", actor); - } - - unsigned char actor_isStreamedInForPlayer(void* actor, void* player) { - return call("actor_isStreamedInForPlayer", actor, player); - } - - ActorSpawnData actor_getSpawnData(void* actor) { - return call("actor_getSpawnData", actor); - } - - void actor_setPosition(void* actor, float posX, float posY, float posZ) { - return call("actor_setPosition", actor, posX, posY, posZ); - } - - Vector3 actor_getPosition(void* actor) { - return call("actor_getPosition", actor); - } - - void actor_setVirtualWorld(void* actor, int vw) { - return call("actor_setVirtualWorld", actor, vw); - } - - int actor_getVirtualWorld(void* actor) { - return call("actor_getVirtualWorld", actor); - } - - void actor_setFacingAngle(void* actor, float angle) { - return call("actor_setFacingAngle", actor, angle); - } - - float actor_getFacingAngle(void* actor) { - return call("actor_getFacingAngle", actor); - } -} diff --git a/checkpoint.cpp b/checkpoint.cpp deleted file mode 100644 index b0a64bf..0000000 --- a/checkpoint.cpp +++ /dev/null @@ -1,83 +0,0 @@ -#include "include/checkpoint.h" - -extern "C" { - void* checkpoint_setPosition(void* checkpoint, float posX, float posY, float posZ) { - return call("checkpoint_setPosition", checkpoint, posX, posY, posZ); - } - - Vector3 checkpoint_getPosition(void* checkpoint) { - return call("checkpoint_getPosition", checkpoint); - } - - void checkpoint_setRadius(void* checkpoint, float radius) { - return call("checkpoint_setRadius", checkpoint, radius); - } - - float checkpoint_getRadius(void* checkpoint) { - return call("checkpoint_getRadius", checkpoint); - } - - unsigned char checkpoint_isPlayerInside(void* checkpoint) { - return call("checkpoint_isPlayerInside", checkpoint); - } - - void checkpoint_enable(void* checkpoint) { - return call("checkpoint_enable", checkpoint); - } - - void checkpoint_disable(void* checkpoint) { - return call("checkpoint_disable", checkpoint); - } - - unsigned char checkpoint_isEnabled(void* checkpoint) { - return call("checkpoint_isEnabled", checkpoint); - } - - void* raceCheckpoint_setPosition(void* checkpoint, float posX, float posY, float posZ) { - return call("raceCheckpoint_setPosition", checkpoint, posX, posY, posZ); - } - - Vector3 raceCheckpoint_getPosition(void* checkpoint) { - return call("raceCheckpoint_getPosition", checkpoint); - } - - void raceCheckpoint_setRadius(void* checkpoint, float radius) { - return call("raceCheckpoint_setRadius", checkpoint, radius); - } - - float raceCheckpoint_getRadius(void* checkpoint) { - return call("raceCheckpoint_getRadius", checkpoint); - } - - unsigned char raceCheckpoint_isPlayerInside(void* checkpoint) { - return call("raceCheckpoint_isPlayerInside", checkpoint); - } - - void raceCheckpoint_enable(void* checkpoint) { - return call("raceCheckpoint_enable", checkpoint); - } - - void raceCheckpoint_disable(void* checkpoint) { - return call("raceCheckpoint_disable", checkpoint); - } - - unsigned char raceCheckpoint_isEnabled(void* checkpoint) { - return call("raceCheckpoint_isEnabled", checkpoint); - } - - void raceCheckpoint_setType(void* checkpoint, int type) { - return call("raceCheckpoint_setType", checkpoint, type); - } - - int raceCheckpoint_getType(void* checkpoint) { - return call("raceCheckpoint_getType", checkpoint); - } - - void raceCheckpoint_setNextPosition(void* checkpoint, float posX, float posY, float posZ) { - return call("raceCheckpoint_setNextPosition", checkpoint, posX, posY, posZ); - } - - Vector3 raceCheckpoint_getNextPosition(void* checkpoint) { - return call("raceCheckpoint_getNextPosition", checkpoint); - } -} diff --git a/class.cpp b/class.cpp deleted file mode 100644 index 75042d4..0000000 --- a/class.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include "include/class.h" - -extern "C" { - void* class_create(ClassData* data) { - return call("class_create", data); - } - - void class_release(void* _class) { - return call("class_release", _class); - } - - int class_getID(void* class_) { - return call("class_getID", class_); - } - - void class_setClass(void* class_, ClassData* data) { - return call("class_setClass", class_, data); - } - - ClassData class_getClass(void* class_) { - return call("class_getClass", class_); - } - - void* Class_FromID(int classid) { - return call("Class_FromID", classid); - } -} diff --git a/component.cpp b/component.cpp deleted file mode 100644 index e6c5eaa..0000000 --- a/component.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "include/component.h" - -extern "C" { - void* Component_Create(uint64_t uid, const char* name, struct ComponentVersion version, void* onReady, void* onReset, void* onFree) { - return call("Component_Create", uid, name, version, onReady, onReset, onFree); - } -} diff --git a/config.cpp b/config.cpp deleted file mode 100644 index 611797e..0000000 --- a/config.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include "include/config.h" - -extern "C" { - void config_setFloat(String key, float value) { - return call("config_setFloat", key, value); - } - - void config_setInt(String key, int value) { - return call("config_setInt", key, value); - } - - void config_setBool(String key, unsigned char value) { - return call("config_setBool", key, value); - } - - int config_getType(String key) { - return call("config_getType", key); - } - - float config_getFloat(String key) { - return call("config_getFloat", key); - } - - int config_getInt(String key) { - return call("config_getInt", key); - } - - unsigned char config_getBool(String key) { - return call("config_getBool", key); - } - - unsigned char config_isBanned(String ip) { - return call("config_isBanned", ip); - } -} diff --git a/console.cpp b/console.cpp deleted file mode 100644 index 69d5cb4..0000000 --- a/console.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "include/console.h" - -extern "C" { - void console_send(String command) { - return call("console_send", command); - } -} diff --git a/include/actor.h b/include/actor.h deleted file mode 100644 index 9d65dd6..0000000 --- a/include/actor.h +++ /dev/null @@ -1,46 +0,0 @@ -#include "omp.h" - -#ifdef __cplusplus -extern "C" { -#endif - - typedef struct { - float delta; - unsigned char loop; - unsigned char lockX; - unsigned char lockY; - unsigned char freeze; - uint32_t time; - String lib; - String name; - } CAnimationData; - - typedef struct { - Vector3 position; - float facingAngle; - int skin; - } ActorSpawnData; - - void* actor_create(int skin, float posX, float posY, float posZ, float angle); - void actor_release(void* actor); - void actor_setSkin(void* actor, int skin); - int actor_getSkin(void* actor); - void actor_applyAnimation(void* actor, float delta, unsigned char loop, unsigned char lockX, unsigned char lockY, unsigned char freeze, uint32_t time, String lib, String name); - CAnimationData actor_getAnimation(void* actor); - void actor_clearAnimations(void* actor); - void actor_setHealth(void* actor, float health); - float actor_getHealth(void* actor); - void actor_setInvulnerable(void* actor, unsigned char invuln); - unsigned char actor_isInvulnerable(void* actor); - unsigned char actor_isStreamedInForPlayer(void* actor, void* player); - ActorSpawnData actor_getSpawnData(void* actor); - void actor_setPosition(void* actor, float posX, float posY, float posZ); - Vector3 actor_getPosition(void* actor); - void actor_setVirtualWorld(void* actor, int vw); - int actor_getVirtualWorld(void* actor); - void actor_setFacingAngle(void* actor, float angle); - float actor_getFacingAngle(void* actor); - -#ifdef __cplusplus -} -#endif diff --git a/include/checkpoint.h b/include/checkpoint.h deleted file mode 100644 index 6df34d1..0000000 --- a/include/checkpoint.h +++ /dev/null @@ -1,33 +0,0 @@ -#include "omp.h" - -#ifdef __cplusplus -extern "C" { -#endif - - void* checkpoint_setPosition(void* checkpoint, float posX, float posY, float posZ); - Vector3 checkpoint_getPosition(void* checkpoint); - void checkpoint_setRadius(void* checkpoint, float radius); - float checkpoint_getRadius(void* checkpoint); - unsigned char checkpoint_isPlayerInside(void* checkpoint); - void checkpoint_enable(void* checkpoint); - void checkpoint_disable(void* checkpoint); - unsigned char checkpoint_isEnabled(void* checkpoint); - - // race checkpoint - - void* raceCheckpoint_setPosition(void* checkpoint, float posX, float posY, float posZ); - Vector3 raceCheckpoint_getPosition(void* checkpoint); - void raceCheckpoint_setRadius(void* checkpoint, float radius); - float raceCheckpoint_getRadius(void* checkpoint); - unsigned char raceCheckpoint_isPlayerInside(void* checkpoint); - void raceCheckpoint_enable(void* checkpoint); - void raceCheckpoint_disable(void* checkpoint); - unsigned char raceCheckpoint_isEnabled(void* checkpoint); - void raceCheckpoint_setType(void* checkpoint, int type); - int raceCheckpoint_getType(void* checkpoint); - void raceCheckpoint_setNextPosition(void* checkpoint, float posX, float posY, float posZ); - Vector3 raceCheckpoint_getNextPosition(void* checkpoint); - -#ifdef __cplusplus -} -#endif diff --git a/include/class.h b/include/class.h deleted file mode 100644 index a9fb8ba..0000000 --- a/include/class.h +++ /dev/null @@ -1,33 +0,0 @@ -#include "omp.h" - -#ifdef __cplusplus -extern "C" { -#endif - - typedef struct ClassData - { - int team; - int skin; - float spawnX; - float spawnY; - float spawnZ; - float angle; - uint8_t weapon1; - uint32_t ammo1; - uint8_t weapon2; - uint32_t ammo2; - uint8_t weapon3; - uint32_t ammo3; - } ClassData; - - void* class_create(ClassData* data); - void class_release(void* _class); - int class_getID(void* class_); - void class_setClass(void* class_, ClassData* data); - ClassData class_getClass(void* class_); - - void* Class_FromID(int classid); - -#ifdef __cplusplus -} -#endif diff --git a/include/component.h b/include/component.h deleted file mode 100644 index b49cb06..0000000 --- a/include/component.h +++ /dev/null @@ -1,11 +0,0 @@ -#include "omp.h" - -#ifdef __cplusplus -extern "C" { -#endif - - void* Component_Create(uint64_t uid, const char* name, struct ComponentVersion version, void* onReady, void* onReset, void* onFree); - -#ifdef __cplusplus -} -#endif diff --git a/include/config.h b/include/config.h deleted file mode 100644 index a40c622..0000000 --- a/include/config.h +++ /dev/null @@ -1,18 +0,0 @@ -#include "omp.h" - -#ifdef __cplusplus -extern "C" { -#endif - - void config_setFloat(String key, float value); - void config_setInt(String key, int value); - void config_setBool(String key, unsigned char value); - int config_getType(String key); - float config_getFloat(String key); - int config_getInt(String key); - unsigned char config_getBool(String key); - unsigned char config_isBanned(String ip); - -#ifdef __cplusplus -} -#endif diff --git a/include/console.h b/include/console.h deleted file mode 100644 index c8feb73..0000000 --- a/include/console.h +++ /dev/null @@ -1,11 +0,0 @@ -#include "omp.h" - -#ifdef __cplusplus -extern "C" { -#endif - - void console_send(String command); - -#ifdef __cplusplus -} -#endif diff --git a/include/menu.h b/include/menu.h deleted file mode 100644 index 02cd287..0000000 --- a/include/menu.h +++ /dev/null @@ -1,26 +0,0 @@ -#include "omp.h" - -#ifdef __cplusplus -extern "C" { -#endif - - void* menu_create(String title, float posX, float posY, uint8_t columns, float col1Width, float col2Width); - void menu_release(void* menu); - void menu_setColumnHeader(void* menu, String header, uint8_t column); - void menu_addCell(void* menu, String itemText, uint8_t column); - void menu_disableRow(void* menu, uint8_t row); - unsigned char menu_isRowEnabled(void* menu, uint8_t row); - void menu_disable(void* menu); - unsigned char menu_isEnabled(void* menu); - Vector2 menu_getPosition(void* menu); - int menu_getRowCount(void* menu, uint8_t column); - int menu_getColumnCount(void* menu); - Vector2 menu_getColumnWidths(void* menu); - String menu_getColumnHeader(void* menu, uint8_t column); - String menu_getCell(void* menu, uint8_t column, uint8_t row); - void menu_showForPlayer(void* menu, void* player); - void menu_hideForPlayer(void* menu, void* player); - -#ifdef __cplusplus -} -#endif diff --git a/include/model.h b/include/model.h deleted file mode 100644 index 65ac2f0..0000000 --- a/include/model.h +++ /dev/null @@ -1,14 +0,0 @@ -#include "omp.h" - -#ifdef __cplusplus -extern "C" { -#endif - - unsigned char model_add(uint8_t type, int32_t id, int32_t baseId, String dffName, String txdName, int32_t virtualWorld, uint8_t timeOn, uint8_t timeOff); - String model_getNameFromCheckSum(uint32_t crc); - unsigned char model_isValid(int32_t modelId); - unsigned char model_getPath(int32_t modelId, String* dffPath, String* txdPath); - -#ifdef __cplusplus -} -#endif diff --git a/include/object.h b/include/object.h deleted file mode 100644 index fb22487..0000000 --- a/include/object.h +++ /dev/null @@ -1,127 +0,0 @@ -#include "omp.h" - -#ifdef __cplusplus -extern "C" { -#endif - - typedef struct { - Vector3 targetPos; - Vector3 targetRot; - float speed; - } ObjectMoveData; - - typedef struct { - uint8_t type; - unsigned char syncRotation; - int ID; - Vector3 offset; - Vector3 rotation; - } ObjectAttachmentData; - - typedef enum { - ObjectMaterialSize_32x32 = 10, - ObjectMaterialSize_64x32 = 20, - ObjectMaterialSize_64x64 = 30, - ObjectMaterialSize_128x32 = 40, - ObjectMaterialSize_128x64 = 50, - ObjectMaterialSize_128x128 = 60, - ObjectMaterialSize_256x32 = 70, - ObjectMaterialSize_256x64 = 80, - ObjectMaterialSize_256x128 = 90, - ObjectMaterialSize_256x256 = 100, - ObjectMaterialSize_512x64 = 110, - ObjectMaterialSize_512x128 = 120, - ObjectMaterialSize_512x256 = 130, - ObjectMaterialSize_512x512 = 140 - } ObjectMaterialSize; - - typedef enum { - ObjectMaterialTextAlign_Left, - ObjectMaterialTextAlign_Center, - ObjectMaterialTextAlign_Right - } ObjectMaterialTextAlign; - - typedef struct { - int model; - String textureLibrary; - String textureName; - uint32_t colour; - } ObjectMaterial; - - typedef struct { - String text; - uint8_t materialSize; - String fontFace; - uint8_t fontSize; - unsigned char bold; - uint32_t fontColour; - uint32_t backgroundColour; - uint8_t alignment; - } ObjectMaterialText; - - void* object_create(int modelId, float posX, float posY, float posZ, float rotX, float rotY, float rotZ, float drawDistance); - void object_release(void* object); - void* object_getByID(int id); - void object_setDefaultCameraCollision(unsigned char set); - void object_setDrawDistance(void* object, float drawDistance); - float object_getDrawDistance(void* object); - void object_setModel(void* object, int model); - int object_getModel(void* object); - void object_setCameraCollision(void* object, unsigned char set); - unsigned char object_getCameraCollision(void* object); - int object_move(void* object, float posX, float posY, float posZ, float rotX, float rotY, float rotZ, float speed); - unsigned char object_isMoving(void* object); - void object_stop(void* object); - ObjectMoveData object_getMovingData(void* object); - void object_attachToVehicle(void* object, void* vehicle, float offsetX, float offsetY, float offsetZ, float rotX, float rotY, float rotZ); - void object_resetAttachment(void* object); - ObjectAttachmentData object_getAttachmentData(void* object); - unsigned char object_isMaterialSlotUsed(void* object, uint32_t materialIndex); - unsigned char object_getMaterial(void* object, uint32_t materialIndex, const ObjectMaterial* out); - unsigned char object_getMaterialText(void* object, uint32_t materialIndex, const ObjectMaterialText* out); - void object_setMaterial(void* object, uint32_t materialIndex, int model, String textureLibrary, String textureName, uint32_t colour); - void object_setMaterialText(void* object, uint32_t materialIndex, String text, ObjectMaterialSize materialSize, String fontFace, int fontSize, unsigned char bold, uint32_t fontColour, uint32_t backgroundColour, ObjectMaterialTextAlign align); - void object_attachToPlayer(void* object, void* player, float offsetX, float offsetY, float offsetZ, float rotX, float rotY, float rotZ); - void object_attachToObject(void* object, void* other, float offsetX, float offsetY, float offsetZ, float rotX, float rotY, float rotZ, unsigned char syncRotation); - - // entity - void object_setPosition(void* object, float posX, float posY, float posZ); - Vector3 object_getPosition(void* object); - void object_setRotation(void* object, float rotX, float rotY, float rotZ); - Vector3 object_getRotation(void* object); - - // PlayerObject - void* playerObject_create(void* player, int modelId, float posX, float posY, float posZ, float rotX, float rotY, float rotZ, float drawDistance); - void playerObject_release(void* object, void* player); - void* playerObject_getByID(void* player, int id); - void playerObject_setDrawDistance(void* object, float drawDistance); - float playerObject_getDrawDistance(void* object); - void playerObject_setModel(void* object, int model); - int playerObject_getModel(void* object); - void playerObject_setCameraCollision(void* object, unsigned char set); - unsigned char playerObject_getCameraCollision(void* object); - int playerObject_move(void* object, float posX, float posY, float posZ, float rotX, float rotY, float rotZ, float speed); - unsigned char playerObject_isMoving(void* object); - void playerObject_stop(void* object); - ObjectMoveData playerObject_getMovingData(void* object); - void playerObject_attachToVehicle(void* object, void* vehicle, float offsetX, float offsetY, float offsetZ, float rotX, float rotY, float rotZ); - void playerObject_resetAttachment(void* object); - ObjectAttachmentData playerObject_getAttachmentData(void* object); - unsigned char playerObject_isMaterialSlotUsed(void* object, uint32_t materialIndex); - unsigned char playerObject_getMaterial(void* object, uint32_t materialIndex, ObjectMaterial* out); - unsigned char playerObject_getMaterialText(void* object, uint32_t materialIndex, ObjectMaterialText* out); - void playerObject_setMaterial(void* object, uint32_t materialIndex, int model, String textureLibrary, String textureName, uint32_t colour); - void playerObject_setMaterialText(void* object, uint32_t materialIndex, String text, ObjectMaterialSize materialSize, String fontFace, int fontSize, unsigned char bold, uint32_t fontColour, uint32_t backgroundColour, ObjectMaterialTextAlign align); - void playerObject_attachToPlayer(void* object, void* player, float offsetX, float offsetY, float offsetZ, float rotX, float rotY, float rotZ); - void playerObject_attachToObject(void* object, void* other, float offsetX, float offsetY, float offsetZ, float rotX, float rotY, float rotZ); - - // entity - - void playerObject_setPosition(void* object, float posX, float posY, float posZ); - Vector3 playerObject_getPosition(void* object); - void playerObject_setRotation(void* object, float rotX, float rotY, float rotZ); - Vector3 playerObject_getRotation(void* object); - -#ifdef __cplusplus -} -#endif diff --git a/include/pickup.h b/include/pickup.h deleted file mode 100644 index 05c17ae..0000000 --- a/include/pickup.h +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include "omp.h" - -#ifdef __cplusplus -extern "C" { -#endif - - void* pickup_create(int modelId, uint8_t type, float posX, float posY, float posZ, uint32_t virtualWorld, int isStatic); - void pickup_release(void* pickup); - int pickup_getID(void* pickup); - void pickup_setType(void* pickup, uint8_t type); - uint8_t pickup_getType(void* pickup); - void pickup_setModel(void* pickup, int model); - int pickup_getModel(void* pickup); - unsigned char pickup_isStreamedInForPlayer(void* pickup, void* player); - void pickup_setPickupHiddenForPlayer(void* pickup, void* player, unsigned char hidden); - unsigned char pickup_isPickupHiddenForPlayer(void* pickup, void* player); - - // entity - void pickup_setPosition(void* pickup, float posX, float posY, float posZ); - Vector3 pickup_getPosition(void* pickup); - void pickup_setVirtualWorld(void* pickup, int vw); - int pickup_getVirtualWorld(void* pickup); - - void* playerPickup_create(void* player, int modelId, uint8_t type, float posX, float posY, float posZ, uint32_t virtualWorld, int isStatic); - void playerPickup_release(void* pickup, void* player); - -#ifdef __cplusplus -} -#endif diff --git a/include/player.h b/include/player.h deleted file mode 100644 index e29de37..0000000 --- a/include/player.h +++ /dev/null @@ -1,243 +0,0 @@ -#include "omp.h" - -#ifdef __cplusplus -extern "C" { -#endif - - typedef struct { - Vector3 camFrontVector; - Vector3 camPos; - float aimZ; - float camZoom; - float aspectRatio; - int8_t weaponState; - uint8_t camMode; - } PlayerAimData; - - typedef struct { - uint8_t id; - uint32_t ammo; - } WeaponSlotData; - - typedef struct { - int hours; - int minutes; - } Time; - - typedef struct { - uint16_t ID; - uint16_t flags; - } PlayerAnimationData; - - typedef struct { - uint32_t keys; - int16_t upDown; - int16_t leftRight; - } PlayerKeyData; - - typedef struct { - unsigned char spectating; - int spectateID; - int type; - } CPlayerSpectateData; - - typedef enum { - PlayerAnimationSyncType_NoSync, - PlayerAnimationSyncType_Sync, - PlayerAnimationSyncType_SyncOthers - } PlayerAnimationSyncType; - - void* player_getByID(int id); - Array player_getAll(); - void player_sendDeathMessageToAll(void* killer, void* killee, int weapon); - void player_sendEmptyDeathMessageToAll(); - void player_sendGameTextToAll(String msg, int time, int style); - - int player_getID(void* player); - - void player_kick(void* player); - void player_ban(void* player, String reason); - int player_isBot(void* player); - unsigned player_getPing(void* player); - void player_spawn(void* player); - int player_isSpawned(void* player); - uint8_t player_getClientVersion(void* player); - String player_getClientVersionName(void* player); - void player_setPositionFindZ(void* player, float x, float y, float z); - void player_setCameraPosition(void* player, float x, float y, float z); - Vector3 player_getCameraPosition(void* player); - void player_setCameraLookAt(void* player, float x, float y, float z, int cutType); - Vector3 player_getCameraLookAt(void* player); - void player_setCameraBehind(void* player); - void player_interpolateCameraPosition(void* player, float fromX, float fromY, float fromZ, float toX, float toY, float toZ, int time, int cutType); - void player_interpolateCameraLookAt(void* player, float fromX, float fromY, float fromZ, float toX, float toY, float toZ, int time, int cutType); - void player_attachCameraToObject(void* player, void* object); - int player_setName(void* player, String name); - String player_getName(void* player); - String player_getSerial(void* player); - void player_giveWeapon(void* player, uint8_t id, uint32_t ammo); - void player_removeWeapon(void* player, uint8_t weapon); - void player_setWeaponAmmo(void* player, uint8_t id, uint32_t ammo); - Array* player_getWeapons(void* player); - WeaponSlotData player_getWeaponSlot(void* player, int slot); - void player_resetWeapons(void* player); - void player_setArmedWeapon(void* player, uint32_t weapon); - uint32_t player_getArmedWeapon(void* player); - uint32_t player_getArmedWeaponAmmo(void* player); - void player_setShopName(void* player, String name); - String player_getShopName(void* player); - void player_setDrunkLevel(void* player, int level); - int player_getDrunkLevel(void* player); - void player_setColour(void* player, uint32_t colour); - uint32_t player_getColour(void* player); - void player_setOtherColour(void* player, void* other, uint32_t colour); - int player_getOtherColour(void* player, void* other, uint32_t* colour); - void player_setControllable(void* player, int controllable); - int player_getControllable(void* player); - void player_setSpectating(void* player, int spectating); - void player_setWantedLevel(void* player, unsigned level); - unsigned player_getWantedLevel(void* player); - void player_playSound(void* player, uint32_t sound, float posX, float posY, float posZ); - uint32_t player_lastPlayedSound(void* player); - void player_playAudio(void* player, String url, unsigned char usePos, float posX, float posY, float posZ, float distance); - int player_playerCrimeReport(void* player, void* suspect, int crime); - void player_stopAudio(void* player); - String player_lastPlayedAudio(void* player); - void player_createExplosion(void* player, float vecX, float vecY, float vecZ, int type, float radius); - void player_sendDeathMessage(void* player, void* killee, void* killer, int weapon); - void player_sendEmptyDeathMessage(void* player); - void player_removeDefaultObjects(void* player, unsigned model, float posX, float posY, float posZ, float radius); - void player_forceClassSelection(void* player); - void player_setMoney(void* player, int money); - void player_giveMoney(void* player, int money); - void player_resetMoney(void* player); - int player_getMoney(void* player); - void player_setMapIcon(void* player, int id, float posX, float posY, float posZ, int type, uint32_t colour, int style); - void player_unsetMapIcon(void* player, int id); - void player_useStuntBonuses(void* player, int enable); - void player_toggleOtherNameTag(void* player, void* other, int toggle); - void player_setTime(void* player, int hr, int min); - Time player_getTime(void* player); - void player_useClock(void* player, int enable); - int player_hasClock(void* player); - void player_useWidescreen(void* player, int enable); - int player_hasWidescreen(void* player); - void player_setHealth(void* player, float health); - float player_getHealth(void* player); - void player_setScore(void* player, int score); - int player_getScore(void* player); - void player_setArmour(void* player, float armour); - float player_getArmour(void* player); - void player_setGravity(void* player, float gravity); - float player_getGravity(void* player); - void player_setWorldTime(void* player, int time); - void player_applyAnimation(void* player, float delta, unsigned char loop, unsigned char lockX, unsigned char lockY, unsigned char freeze, uint32_t time, String lib, String name, int syncType); - void player_clearAnimations(void* player, int syncType); - PlayerAnimationData player_getAnimationData(void* player); - int player_isStreamedInForPlayer(void* player, void* other); - int player_getState(void* player); - void player_setTeam(void* player, int team); - int player_getTeam(void* player); - void player_setSkin(void* player, int skin, int send); - int player_getSkin(void* player); - void player_setChatBubble(void* player, String text, uint32_t colour, float drawDist, int expire); - void player_sendClientMessage(void* player, uint32_t colour, String message); - void player_sendChatMessage(void* player, void* sender, String message); - void player_sendGameText(void* player, String message, int time, int style); - void player_hideGameText(void* player, int style); - int player_hasGameText(void* player, int style); - int player_getGameText(void* player, int style, String* message, int* time, int* remaining); - void player_setWeather(void* player, int weatherID); - int player_getWeather(void* player); - void player_setWorldBounds(void* player, float x, float y, float z, float w); - Vector4 player_getWorldBounds(void* player); - void player_setFightingStyle(void* player, int style); - int player_getFightingStyle(void* player); - void player_setSkillLevel(void* player, int skill, int level); - void player_setAction(void* player, int action); - int player_getAction(void* player); - void player_setVelocity(void* player, float velX, float velY, float velZ); - Vector3 player_getVelocity(void* player); - void player_setInterior(void* player, unsigned interior); - unsigned player_getInterior(void* player); - PlayerKeyData player_getKeyData(void* player); - const PlayerAimData* player_getAimData(void* player); - const PlayerBulletData* player_getBulletData(void* player); - void player_useCameraTargeting(void* player, int enable); - unsigned char player_hasCameraTargeting(void* player); - void player_removeFromVehicle(void* player, unsigned char force); - void* player_getCameraTargetPlayer(void* player); - void* player_getCameraTargetVehicle(void* player); - void* player_getCameraTargetObject(void* player); - void* player_getCameraTargetActor(void* player); - void* player_getTargetPlayer(void* player); - void* player_getTargetActor(void* player); - void player_setRemoteVehicleCollisions(void* player, int collide); - void player_spectatePlayer(void* player, void* target, int mode); - void player_spectateVehicle(void* player, void* target, int mode); - CPlayerSpectateData player_getSpectateData(void* player); - void player_sendClientCheck(void* player, int actionType, int address, int offset, int count); - void player_toggleGhostMode(void* player, int toggle); - int player_isGhostModeEnabled(void* player); - int player_getDefaultObjectsRemoved(void* player); - void player_clearTasks(void* player, PlayerAnimationSyncType syncType); - void player_allowWeapons(void* player, int allow); - int player_areWeaponsAllowed(void* player); - void player_allowTeleport(void* player, int allow); - int player_isTeleportAllowed(void* player); - int player_isUsingOfficialClient(void* player); - - // entity - void player_setPosition(void* player, float posX, float posY, float posZ); - Vector3 player_getPosition(void* player); - Vector4 player_getRotation(void* player); - void player_setVirtualWorld(void* player, int vw); - int player_getVirtualWorld(void* player); - - // console data - void player_setConsoleAccessibility(void* player, int set); - int player_hasConsoleAccess(void* player); - - // checkpoint data - void* player_getCheckpoint(void* player); - void* player_getRaceCheckpoint(void* player); - - // custom models data - int player_getCustomSkin(void* player); - unsigned char player_redirectDownload(void* player, String url); - - // dialog data - void player_showDialog(void* player, int id, int style, String title, String body, String button1, String button2); - void player_hideDialog(void* player); - - // network data - String player_getIp(void* player); - uint32_t player_getRawIp(void* player); - - // vehicle data - void* player_getVehicle(void* player); - int player_getSeat(void* player); - int player_isInModShop(void* player); - - // object data - void player_beginObjectEditing(void* player, void* object); - void player_endObjectEditing(void* player); - unsigned char player_isEditingObject(void* player); - void player_beginObjectSelecting(void* player); - unsigned char player_isSelectingObject(void* player); - void player_setAttachedObject(void* player, int index, int modelId, int bone, float offsetX, float offsetY, float offsetZ, float rotX, float rotY, float rotZ, float scaleX, float scaleY, float scaleZ, uint32_t colour1, uint32_t colour2); - PlayerAttachedObject player_getAttachedObject(void* player, int index); - void player_removeAttachedObject(void* player, int index); - void player_editAttachedObject(void* player, int index); - unsigned char player_hasAttachedObject(void* player, int index); - - // misc - - float player_getDistanceFromPoint(void* player, float pX, float pY, float pZ); - void player_setFacingAngle(void* player, float angle); - float player_getFacingAngle(void* player); - unsigned char player_isInRangeOfPoint(void* player, float range, float pX, float pY, float pZ); - -#ifdef __cplusplus -} -#endif diff --git a/include/server.h b/include/server.h deleted file mode 100644 index 1cf9669..0000000 --- a/include/server.h +++ /dev/null @@ -1,18 +0,0 @@ -#include "omp.h" - -#ifdef __cplusplus -extern "C" { -#endif - - void server_printLnU8(const char* fmt); - void server_logLnU8(int logLevel, const char* fmt); - - void server_setWeather(int weather); - void server_setWorldTime(int hours); - void server_enableStuntBonuses(); - - void server_setData(int type, String data); - -#ifdef __cplusplus -} -#endif diff --git a/include/textdraw.h b/include/textdraw.h deleted file mode 100644 index a2aa00b..0000000 --- a/include/textdraw.h +++ /dev/null @@ -1,97 +0,0 @@ -#include "omp.h" - -#ifdef __cplusplus -extern "C" { -#endif - - void* textDraw_create(float posX, float posY, String text); - void textDraw_release(void* textdraw); - int textDraw_getID(void* textdraw); - void textDraw_setPosition(void* textdraw, float posX, float posY); - Vector2 textDraw_getPosition(void* textdraw); - void textDraw_setText(void* textdraw, String text); - String textDraw_getText(void* textdraw); - void textDraw_setLetterSize(void* textdraw, float sizeX, float sizeY); - Vector2 textDraw_getLetterSize(void* textdraw); - void textDraw_setTextSize(void* textdraw, float sizeX, float sizeY); - Vector2 textDraw_getTextSize(void* textdraw); - void textDraw_setAlignment(void* textdraw, int alignment); - int textDraw_getAlignment(void* textdraw); - void textDraw_setColour(void* textdraw, uint32_t colour); - int textDraw_getLetterColour(void* textdraw); - void textDraw_useBox(void* textdraw, int use); - int textDraw_hasBox(void* textdraw); - void textDraw_setBoxColour(void* textdraw, uint32_t colour); - int textDraw_getBoxColour(void* textdraw); - void textDraw_setShadow(void* textdraw, int size); - int textDraw_getShadow(void* textdraw); - void textDraw_setOutline(void* textdraw, int size); - int textDraw_getOutline(void* textdraw); - void textDraw_setBackgroundColour(void* textdraw, uint32_t colour); - int textDraw_getBackgroundColour(void* textdraw); - void textDraw_setStyle(void* textdraw, int style); - int textDraw_getStyle(void* textdraw); - void textDraw_setProportional(void* textdraw, int set); - int textDraw_isProportional(void* textdraw); - void textDraw_setSelectable(void* textdraw, int set); - int textDraw_isSelectable(void* textdraw); - void textDraw_setPreviewModel(void* textdraw, int model); - int textDraw_getPreviewModel(void* textdraw); - void textDraw_setPreviewRotation(void* textdraw, float rotX, float rotY, float rotZ); - Vector3 textDraw_getPreviewRotation(void* textdraw); - void textDraw_setPreviewVehicleColour(void* textdraw, int col1, int col2); - VehicleColour textDraw_getPreviewVehicleColour(void* textdraw); - void textDraw_setPreviewZoom(void* textdraw, float zoom); - float textDraw_getPreviewZoom(void* textdraw); - void textDraw_showForPlayer(void* textdraw, void* player); - void textDraw_hideForPlayer(void* textdraw, void* player); - int textDraw_isShownForPlayer(void* textdraw, void* player); - void textDraw_setTextForPlayer(void* textdraw, void* player, String text); - - // PlayerTextDraw - void* playerTextDraw_create(void* player, float posX, float posY, String text); - void playerTextDraw_release(void* textdraw, void* player); - int playerTextDraw_getID(void* textdraw); - void playerTextDraw_setPosition(void* textdraw, float posX, float posY); - Vector2 playerTextDraw_getPosition(void* textdraw); - void playerTextDraw_setText(void* textdraw, String text); - String playerTextDraw_getText(void* textdraw); - void playerTextDraw_setLetterSize(void* textdraw, float sizeX, float sizeY); - Vector2 playerTextDraw_getLetterSize(void* textdraw); - void playerTextDraw_setTextSize(void* textdraw, float sizeX, float sizeY); - Vector2 playerTextDraw_getTextSize(void* textdraw); - void playerTextDraw_setAlignment(void* textdraw, int alignment); - int playerTextDraw_getAlignment(void* textdraw); - void playerTextDraw_setColour(void* textdraw, uint32_t colour); - int playerTextDraw_getLetterColour(void* textdraw); - void playerTextDraw_useBox(void* textdraw, int use); - int playerTextDraw_hasBox(void* textdraw); - void playerTextDraw_setBoxColour(void* textdraw, uint32_t colour); - int playerTextDraw_getBoxColour(void* textdraw); - void playerTextDraw_setShadow(void* textdraw, int size); - int playerTextDraw_getShadow(void* textdraw); - void playerTextDraw_setOutline(void* textdraw, int size); - int playerTextDraw_getOutline(void* textdraw); - void playerTextDraw_setBackgroundColour(void* textdraw, uint32_t colour); - int playerTextDraw_getBackgroundColour(void* textdraw); - void playerTextDraw_setStyle(void* textdraw, int style); - int playerTextDraw_getStyle(void* textdraw); - void playerTextDraw_setProportional(void* textdraw, int set); - int playerTextDraw_isProportional(void* textdraw); - void playerTextDraw_setSelectable(void* textdraw, int set); - int playerTextDraw_isSelectable(void* textdraw); - void playerTextDraw_setPreviewModel(void* textdraw, int model); - int playerTextDraw_getPreviewModel(void* textdraw); - void playerTextDraw_setPreviewRotation(void* textdraw, float rotX, float rotY, float rotZ); - Vector3 playerTextDraw_getPreviewRotation(void* textdraw); - void playerTextDraw_setPreviewVehicleColour(void* textdraw, int col1, int col2); - VehicleColour playerTextDraw_getPreviewVehicleColour(void* textdraw); - void playerTextDraw_setPreviewZoom(void* textdraw, float zoom); - float playerTextDraw_getPreviewZoom(void* textdraw); - void playerTextDraw_show(void* textdraw); - void playerTextDraw_hide(void* textdraw); - int playerTextDraw_isShown(void* textdraw); - -#ifdef __cplusplus -} -#endif diff --git a/include/textlabel.h b/include/textlabel.h deleted file mode 100644 index 4319016..0000000 --- a/include/textlabel.h +++ /dev/null @@ -1,60 +0,0 @@ -#include "omp.h" - -#ifdef __cplusplus -extern "C" { -#endif - - typedef struct { - int playerID; - int vehicleID; - } TextLabelAttachmentData; - - void* textLabel_create(String text, uint32_t colour, float posX, float posY, float posZ, float drawDist, int vw, unsigned char los); - void textLabel_release(void* textLabel); - void textLabel_setText(void* textLabel, String text); - String textLabel_getText(void* textLabel); - void textLabel_setColour(void* textLabel, uint32_t colour); - uint32_t textLabel_getColour(void* textLabel); - void textLabel_setDrawDistance(void* textLabel, float drawDist); - float textLabel_getDrawDistance(void* textLabel); - void textLabel_attachToPlayer(void* textLabel, void* player, float offsetX, float offsetY, float offsetZ); - void textLabel_attachToVehicle(void* textLabel, void* vehicle, float offsetX, float offsetY, float offsetZ); - TextLabelAttachmentData textLabel_getAttachmentData(void* textLabel); - void textLabel_detachFromPlayer(void* textLabel, float posX, float posY, float posZ); - void textLabel_detachFromVehicle(void* textLabel, float posX, float posY, float posZ); - void textLabel_setTestLOS(void* textLabel, unsigned char status); - unsigned char textLabel_getTestLOS(void* textLabel); - unsigned char textLabel_isStreamedInForPlayer(void* textLabel, void* player); - void textLabel_setPosition(void* textLabel, float posX, float posY, float posZ); - Vector3 textLabel_getPosition(void* textLabel); - void textLabel_setVirtualWorld(void* textLabel, int vw); - int textLabel_getVirtualWorld(void* textLabel); - - // PlayerTextLabel - - void* playerTextLabel_create(void* player, String text, uint32_t colour, float posX, float posY, float posZ, float drawDistance, unsigned char los); - void playerTextLabel_release(void* textLabel, void* player); - void playerTextLabel_setText(void* textLabel, String text); - String playerTextLabel_getText(void* textLabel); - void playerTextLabel_setColour(void* textLabel, uint32_t colour); - uint32_t playerTextLabel_getColour(void* textLabel); - void playerTextLabel_setDrawDistance(void* textLabel, float drawDist); - float playerTextLabel_getDrawDistance(void* textLabel); - void playerTextLabel_attachToPlayer(void* textLabel, void* player, float offsetX, float offsetY, float offsetZ); - void playerTextLabel_attachToVehicle(void* textLabel, void* vehicle, float offsetX, float offsetY, float offsetZ); - TextLabelAttachmentData playerTextLabel_getAttachmentData(void* textLabel); - void playerTextLabel_detachFromPlayer(void* textLabel, float posX, float posY, float posZ); - void playerTextLabel_detachFromVehicle(void* textLabel, float posX, float posY, float posZ); - void playerTextLabel_setTestLOS(void* textLabel, unsigned char status); - unsigned char playerTextLabel_getTestLOS(void* textLabel); - - // entity - - void playerTextLabel_setPosition(void* textLabel, float posX, float posY, float posZ); - Vector3 playerTextLabel_getPosition(void* textLabel); - void playerTextLabel_setVirtualWorld(void* textLabel, int vw); - int playerTextLabel_getVirtualWorld(void* textLabel); - -#ifdef __cplusplus -} -#endif diff --git a/include/turf.h b/include/turf.h deleted file mode 100644 index 6abd687..0000000 --- a/include/turf.h +++ /dev/null @@ -1,36 +0,0 @@ -#include "omp.h" - -#ifdef __cplusplus -extern "C" { -#endif - - typedef struct { - Vector2 min; - Vector2 max; - } TurfPos; - - void* turf_create(float minX, float minY, float maxX, float maxY); - void turf_release(void* turf); - void turf_useCheck(void* turf, unsigned char use); - unsigned char turf_isShownForPlayer(void* turf, void* player); - unsigned char turf_isFlashingForPlayer(void* turf, void* player); - void turf_showForPlayer(void* turf, void* player, uint32_t colour); - void turf_showForAll(void* turf, uint32_t colour); - void turf_hideForPlayer(void* turf, void* player); - void turf_hideForAll(void* turf); - void turf_flashForPlayer(void* turf, void* player, uint32_t colour); - void turf_flashForAll(void* turf, uint32_t colour); - void turf_stopFlashForPlayer(void* turf, void* player); - void turf_stopFlashForAll(void* turf); - TurfPos turf_getPosition(void* turf); - void turf_setPosition(void* turf, float minX, float minY, float maxX, float maxY); - unsigned char turf_isPlayerInside(void* turf, void* player); - uint32_t turf_getFlashingColourForPlayer(void* turf, void* player); - uint32_t turf_getColourForPlayer(void* turf, void* player); - - void* playerTurf_create(void* player, float minX, float minY, float maxX, float maxY); - void playerTurf_release(void* gangZone, void* player); - -#ifdef __cplusplus -} -#endif diff --git a/include/vehicle.h b/include/vehicle.h deleted file mode 100644 index bbdf819..0000000 --- a/include/vehicle.h +++ /dev/null @@ -1,91 +0,0 @@ -#include "omp.h" - -#ifdef __cplusplus -extern "C" { -#endif - - typedef struct { - int8_t engine; - int8_t lights; - int8_t alarm; - int8_t doors; - int8_t bonnet; - int8_t boot; - int8_t objective; - int8_t siren; - int8_t doorDriver; - int8_t doorPassenger; - int8_t doorBackLeft; - int8_t doorBackRight; - int8_t windowDriver; - int8_t windowPassenger; - int8_t windowBackLeft; - int8_t windowBackRight; - } VehicleParams; - - void* vehicle_create(int isStatic, int modelId, float x, float y, float z, float angle, int colour1, int colour2, int respawnDelay, unsigned char addSiren); - void vehicle_release(void* vehicle); - void* vehicle_getByID(int id); - int vehicle_isStreamedInForPlayer(void* vehicle, void* player); - void vehicle_setColour(void* vehicle, int col1, int col2); - VehicleColour vehicle_getColour(void* vehicle); - void vehicle_setHealth(void* vehicle, float health); - float vehicle_getHealth(void* vehicle); - void* vehicle_getDriver(void* vehicle); - Array vehicle_getPassengers(void* vehicle); - void vehicle_setPlate(void* vehicle, String plate); - String vehicle_getPlate(void* vehicle); - void vehicle_setDamageStatus(void* vehicle, int PanelStatus, int DoorStatus, uint8_t LightStatus, uint8_t TyreStatus, void* vehicleUpdater); - void vehicle_getDamageStatus(void* vehicle, int* PanelStatus, int* DoorStatus, int* LightStatus, int* TyreStatus); - void vehicle_setPaintjob(void* vehicle, int paintjob); - int vehicle_getPaintjob(void* vehicle); - void vehicle_addComponent(void* vehicle, int component); - int vehicle_getComponentInSlot(void* vehicle, int slot); - void vehicle_removeComponent(void* vehicle, int component); - void vehicle_putPlayer(void* vehicle, void* player, int seatID); - void vehicle_setZAngle(void* vehicle, float angle); - float vehicle_getZAngle(void* vehicle); - void vehicle_setParams(void* vehicle, VehicleParams* params); - void vehicle_setParamsForPlayer(void* vehicle, void* player, VehicleParams* params); - VehicleParams vehicle_getParams(void* vehicle); - int vehicle_isDead(void* vehicle); - void vehicle_respawn(void* vehicle); - void vehicle_setRespawnDelay(void* vehicle, int delay); - long long vehicle_getRespawnDelay(void* vehicle); - int vehicle_isRespawning(void* vehicle); - void vehicle_setInterior(void* vehicle, int interiorID); - int vehicle_getInterior(void* vehicle); - void vehicle_attachTrailer(void* vehicle, void* trailer); - void vehicle_detachTrailer(void* vehicle); - int vehicle_isTrailer(void* vehicle); - void* vehicle_getTrailer(void* vehicle); - void* vehicle_getCab(void* vehicle); - void vehicle_repair(void* vehicle); - void vehicle_setVelocity(void* vehicle, float x, float y, float z); - Vector3 vehicle_getVelocity(void* vehicle); - void vehicle_setAngularVelocity(void* vehicle, float x, float y, float z); - Vector3 vehicle_getAngularVelocity(void* vehicle); - int vehicle_getModel(void* vehicle); - uint8_t vehicle_getLandingGearState(void* vehicle); - int vehicle_hasBeenOccupied(void* vehicle); - long vehicle_getLastOccupiedTime(void* vehicle); - long vehicle_getLastSpawnTime(void* vehicle); - int vehicle_isOccupied(void* vehicle); - void vehicle_setSiren(void* vehicle, int status); - uint8_t vehicle_getSirenState(void* vehicle); - uint32_t vehicle_getHydraThrustAngle(void* vehicle); - float vehicle_getTrainSpeed(void* vehicle); - int vehicle_getLastDriverPoolID(void* vehicle); - - Vector3 vehicle_getPosition(void* vehicle); - void vehicle_setPosition(void* vehicle, float x, float y, float z); - Vector4 vehicle_getRotation(void* vehicle); - void vehicle_setVirtualWorld(void* vehicle, int vw); - int vehicle_getVirtualWorld(void* vehicle); - - float vehicle_getDistanceFromPoint(void* vehicle, float pX, float pY, float pZ); - int vehicle_isInRangeOfPoint(void* vehicle, float range, float pX, float pY, float pZ); - -#ifdef __cplusplus -} -#endif diff --git a/menu.cpp b/menu.cpp deleted file mode 100644 index 2b03ce2..0000000 --- a/menu.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include "include/menu.h" - -extern "C" { - void* menu_create(String title, float posX, float posY, uint8_t columns, float col1Width, float col2Width) { - return call("menu_create", title, posX, posY, columns, col1Width, col2Width); - } - - void menu_release(void* menu) { - return call("menu_release", menu); - } - - void menu_setColumnHeader(void* menu, String header, uint8_t column) { - return call("menu_setColumnHeader", menu, header, column); - } - - void menu_addCell(void* menu, String itemText, uint8_t column) { - return call("menu_addCell", menu, itemText, column); - } - - void menu_disableRow(void* menu, uint8_t row) { - return call("menu_disableRow", menu, row); - } - - unsigned char menu_isRowEnabled(void* menu, uint8_t row) { - return call("menu_isRowEnabled", menu, row); - } - - void menu_disable(void* menu) { - return call("menu_disable", menu); - } - - unsigned char menu_isEnabled(void* menu) { - return call("menu_isEnabled", menu); - } - - Vector2 menu_getPosition(void* menu) { - return call("menu_getPosition", menu); - } - - int menu_getRowCount(void* menu, uint8_t column) { - return call("menu_getRowCount", menu, column); - } - - int menu_getColumnCount(void* menu) { - return call("menu_getColumnCount", menu); - } - - Vector2 menu_getColumnWidths(void* menu) { - return call("menu_getColumnWidths", menu); - } - - String menu_getColumnHeader(void* menu, uint8_t column) { - return call("menu_getColumnHeader", menu, column); - } - - String menu_getCell(void* menu, uint8_t column, uint8_t row) { - return call("menu_getCell", menu, column, row); - } - - void menu_showForPlayer(void* menu, void* player) { - return call("menu_showForPlayer", menu, player); - } - - void menu_hideForPlayer(void* menu, void* player) { - return call("menu_hideForPlayer", menu, player); - } -} diff --git a/model.cpp b/model.cpp deleted file mode 100644 index 727d39b..0000000 --- a/model.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "include/model.h" - -extern "C" { - unsigned char model_add(uint8_t type, int32_t id, int32_t baseId, String dffName, String txdName, int32_t virtualWorld, uint8_t timeOn, uint8_t timeOff) { - return call("customModel_add", type, id, baseId, dffName, txdName, virtualWorld, timeOn, timeOff); - } - - String model_getNameFromCheckSum(uint32_t checksum) { - return call("customModel_getNameFromCheckSum", checksum); - } - - unsigned char model_isValid(int32_t modelId) { - return call("customModel_isValid", modelId); - } - - unsigned char model_getPath(int32_t modelId, String* dffPath, String* txdPath) { - return call("customModel_getPath", modelId, dffPath, txdPath); - } -} diff --git a/object.cpp b/object.cpp deleted file mode 100644 index 7b141fb..0000000 --- a/object.cpp +++ /dev/null @@ -1,223 +0,0 @@ -#include "include/object.h" - -extern "C" { - void* object_create(int modelId, float posX, float posY, float posZ, float rotX, float rotY, float rotZ, float drawDistance) { - return call("object_create", modelId, posX, posY, posZ, rotX, rotY, rotZ, drawDistance); - } - - void object_release(void* object) { - return call("object_release", object); - } - - void* object_getByID(int id) { - return call("object_getByID", id); - } - - void object_setDefaultCameraCollision(unsigned char set) { - return call("object_setDefaultCameraCollision", set); - } - - void object_setDrawDistance(void* object, float drawDistance) { - return call("object_setDrawDistance", object, drawDistance); - } - - float object_getDrawDistance(void* object) { - return call("object_getDrawDistance", object); - } - - void object_setModel(void* object, int model) { - return call("object_setModel", object, model); - } - - int object_getModel(void* object) { - return call("object_getModel", object); - } - - void object_setCameraCollision(void* object, unsigned char set) { - return call("object_setCameraCollision", object, set); - } - - unsigned char object_getCameraCollision(void* object) { - return call("object_getCameraCollision", object); - } - - int object_move(void* object, float posX, float posY, float posZ, float rotX, float rotY, float rotZ, float speed) { - return call("object_move", object, posX, posY, posZ, rotX, rotY, rotZ, speed); - } - - unsigned char object_isMoving(void* object) { - return call("object_isMoving", object); - } - - void object_stop(void* object) { - return call("object_stop", object); - } - - ObjectMoveData object_getMovingData(void* object) { - return call("object_getMovingData", object); - } - - void object_attachToVehicle(void* object, void* vehicle, float offsetX, float offsetY, float offsetZ, float rotX, float rotY, float rotZ) { - return call("object_attachToVehicle", object, vehicle, offsetX, offsetY, offsetZ, rotX, rotY, rotZ); - } - - void object_resetAttachment(void* object) { - return call("object_resetAttachment", object); - } - - ObjectAttachmentData object_getAttachmentData(void* object) { - return call("object_getAttachmentData", object); - } - - unsigned char object_isMaterialSlotUsed(void* object, uint32_t materialIndex) { - return call("object_isMaterialSlotUsed", object, materialIndex); - } - - unsigned char object_getMaterial(void* object, uint32_t materialIndex, const ObjectMaterial* out) { - return call("object_getMaterial", object, materialIndex, out); - } - - unsigned char object_getMaterialText(void* object, uint32_t materialIndex, const ObjectMaterialText* out) { - return call("object_getMaterialText", object, materialIndex, out); - } - - void object_setMaterial(void* object, uint32_t materialIndex, int model, String textureLibrary, String textureName, uint32_t colour) { - return call("object_setMaterial", object, materialIndex, model, textureLibrary, textureName, colour); - } - - void object_setMaterialText(void* object, uint32_t materialIndex, String text, ObjectMaterialSize materialSize, String fontFace, int fontSize, unsigned char bold, uint32_t fontColour, uint32_t backgroundColour, ObjectMaterialTextAlign align) { - return call("object_setMaterialText", object, materialIndex, text, materialSize, fontFace, fontSize, bold, fontColour, backgroundColour, align); - } - - void object_attachToPlayer(void* object, void* player, float offsetX, float offsetY, float offsetZ, float rotX, float rotY, float rotZ) { - return call("object_attachToPlayer", object, player, offsetX, offsetY, offsetZ, rotX, rotY, rotZ); - } - - void object_attachToObject(void* object, void* other, float offsetX, float offsetY, float offsetZ, float rotX, float rotY, float rotZ, unsigned char syncRotation) { - return call("object_attachToObject", object, other, offsetX, offsetY, offsetZ, rotX, rotY, rotZ, syncRotation); - } - - void object_setPosition(void* object, float posX, float posY, float posZ) { - return call("object_setPosition", object, posX, posY, posZ); - } - - Vector3 object_getPosition(void* object) { - return call("object_getPosition", object); - } - - void object_setRotation(void* object, float rotX, float rotY, float rotZ) { - return call("object_setRotation", object, rotX, rotY, rotZ); - } - - Vector3 object_getRotation(void* object) { - return call("object_getRotation", object); - } - - void* playerObject_create(void* player, int modelId, float posX, float posY, float posZ, float rotX, float rotY, float rotZ, float drawDistance) { - return call("playerObject_create", player, modelId, posX, posY, posZ, rotX, rotY, rotZ, drawDistance); - } - - void playerObject_release(void* object, void* player) { - return call("playerObject_release", object, player); - } - - void* playerObject_getByID(void* player, int id) { - return call("playerObject_getByID", player, id); - } - - void playerObject_setDrawDistance(void* object, float drawDistance) { - return call("playerObject_setDrawDistance", object, drawDistance); - } - - float playerObject_getDrawDistance(void* object) { - return call("playerObject_getDrawDistance", object); - } - - void playerObject_setModel(void* object, int model) { - return call("playerObject_setModel", object, model); - } - - int playerObject_getModel(void* object) { - return call("playerObject_getModel", object); - } - - void playerObject_setCameraCollision(void* object, unsigned char set) { - return call("playerObject_setCameraCollision", object, set); - } - - unsigned char playerObject_getCameraCollision(void* object) { - return call("playerObject_getCameraCollision", object); - } - - int playerObject_move(void* object, float posX, float posY, float posZ, float rotX, float rotY, float rotZ, float speed) { - return call("playerObject_move", object, posX, posY, posZ, rotX, rotY, rotZ, speed); - } - - unsigned char playerObject_isMoving(void* object) { - return call("playerObject_isMoving", object); - } - - void playerObject_stop(void* object) { - return call("playerObject_stop", object); - } - - ObjectMoveData playerObject_getMovingData(void* object) { - return call("playerObject_getMovingData", object); - } - - void playerObject_attachToVehicle(void* object, void* vehicle, float offsetX, float offsetY, float offsetZ, float rotX, float rotY, float rotZ) { - return call("playerObject_attachToVehicle", object, vehicle, offsetX, offsetY, offsetZ, rotX, rotY, rotZ); - } - - void playerObject_resetAttachment(void* object) { - return call("playerObject_resetAttachment", object); - } - - ObjectAttachmentData playerObject_getAttachmentData(void* object) { - return call("playerObject_getAttachmentData", object); - } - - unsigned char playerObject_isMaterialSlotUsed(void* object, uint32_t materialIndex) { - return call("playerObject_isMaterialSlotUsed", object, materialIndex); - } - - unsigned char playerObject_getMaterial(void* object, uint32_t materialIndex, ObjectMaterial* out) { - return call("playerObject_getMaterial", object, materialIndex, out); - } - - unsigned char playerObject_getMaterialText(void* object, uint32_t materialIndex, ObjectMaterialText* out) { - return call("playerObject_getMaterialText", object, materialIndex, out); - } - - void playerObject_setMaterial(void* object, uint32_t materialIndex, int model, String textureLibrary, String textureName, uint32_t colour) { - return call("playerObject_setMaterial", object, materialIndex, model, textureLibrary, textureName, colour); - } - - void playerObject_setMaterialText(void* object, uint32_t materialIndex, String text, ObjectMaterialSize materialSize, String fontFace, int fontSize, unsigned char bold, uint32_t fontColour, uint32_t backgroundColour, ObjectMaterialTextAlign align) { - return call("playerObject_setMaterialText", object, materialIndex, text, materialSize, fontFace, fontSize, bold, fontColour, backgroundColour, align); - } - - void playerObject_attachToPlayer(void* object, void* player, float offsetX, float offsetY, float offsetZ, float rotX, float rotY, float rotZ) { - return call("playerObject_attachToPlayer", object, player, offsetX, offsetY, offsetZ, rotX, rotY, rotZ); - } - - void playerObject_attachToObject(void* object, void* other, float offsetX, float offsetY, float offsetZ, float rotX, float rotY, float rotZ) { - return call("playerObject_attachToObject", object, other, offsetX, offsetY, offsetZ, rotX, rotY, rotZ); - } - - void playerObject_setPosition(void* object, float posX, float posY, float posZ) { - return call("playerObject_setPosition", object, posX, posY, posZ); - } - - Vector3 playerObject_getPosition(void* object) { - return call("playerObject_getPosition", object); - } - - void playerObject_setRotation(void* object, float rotX, float rotY, float rotZ) { - return call("playerObject_setRotation", object, rotX, rotY, rotZ); - } - - Vector3 playerObject_getRotation(void* object) { - return call("playerObject_getRotation", object); - } -} diff --git a/pickup.cpp b/pickup.cpp deleted file mode 100644 index 313ee60..0000000 --- a/pickup.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include "include/pickup.h" - -extern "C" { - void* pickup_create(int modelId, uint8_t type, float posX, float posY, float posZ, uint32_t virtualWorld, int isStatic) { - return call("pickup_create", modelId, type, posX, posY, posZ, virtualWorld, isStatic); - } - - void pickup_release(void* pickup) { - return call("pickup_release", pickup); - } - - int pickup_getID(void* pickup) { - return call("pickup_getID", pickup); - } - - void pickup_setType(void* pickup, uint8_t type) { - return call("pickup_setType", pickup, type); - } - - uint8_t pickup_getType(void* pickup) { - return call("pickup_getType", pickup); - } - - void pickup_setModel(void* pickup, int model) { - return call("pickup_setModel", pickup, model); - } - - int pickup_getModel(void* pickup) { - return call("pickup_getModel", pickup); - } - - unsigned char pickup_isStreamedInForPlayer(void* pickup, void* player) { - return call("pickup_isStreamedInForPlayer", pickup, player); - } - - void pickup_setPickupHiddenForPlayer(void* pickup, void* player, unsigned char hidden) { - return call("pickup_setPickupHiddenForPlayer", pickup, player, hidden); - } - - unsigned char pickup_isPickupHiddenForPlayer(void* pickup, void* player) { - return call("pickup_isPickupHiddenForPlayer", pickup, player); - } - - void pickup_setPosition(void* pickup, float posX, float posY, float posZ) { - return call("pickup_setPosition", pickup, posX, posY, posZ); - } - - Vector3 pickup_getPosition(void* pickup) { - return call("pickup_getPosition", pickup); - } - - void pickup_setVirtualWorld(void* pickup, int vw) { - return call("pickup_setVirtualWorld", pickup, vw); - } - - int pickup_getVirtualWorld(void* pickup) { - return call("pickup_getVirtualWorld", pickup); - } - - void* playerPickup_create(void* player, int modelId, uint8_t type, float posX, float posY, float posZ, uint32_t virtualWorld, int isStatic) { - return call("playerPickup_create", player, modelId, type, posX, posY, posZ, virtualWorld, isStatic); - } - - void playerPickup_release(void* pickup, void* player) { - return call("playerPickup_release", pickup, player); - } -} diff --git a/player.cpp b/player.cpp deleted file mode 100644 index 56cb1a1..0000000 --- a/player.cpp +++ /dev/null @@ -1,679 +0,0 @@ -#include "include/player.h" - -extern "C" { - void* player_getByID(int id) { - return call("player_getByID", id); - } - - Array player_getAll() { - return call("player_getAll"); - } - - void player_sendDeathMessageToAll(void* killer, void* killee, int weapon) { - return call("player_sendDeathMessageToAll", killer, killee, weapon); - } - - void player_sendEmptyDeathMessageToAll() { - return call("player_sendEmptyDeathMessageToAll"); - } - - void player_sendGameTextToAll(String msg, int time, int style) { - return call("player_sendGameTextToAll", msg, time, style); - } - - int player_getID(void* player) { - return call("player_getID", player); - } - - void player_kick(void* player) { - return call("player_kick", player); - } - - void player_ban(void* player, String reason) { - return call("player_ban", player, reason); - } - - int player_isBot(void* player) { - return call("player_isBot", player); - } - - unsigned player_getPing(void* player) { - return call("player_getPing", player); - } - - void player_spawn(void* player) { - return call("player_spawn", player); - } - - int player_isSpawned(void* player) { - return call("player_isSpawned", player); - } - - uint8_t player_getClientVersion(void* player) { - return call("player_getClientVersion", player); - } - - String player_getClientVersionName(void* player) { - return call("player_getClientVersionName", player); - } - - void player_setPositionFindZ(void* player, float x, float y, float z) { - return call("player_setPositionFindZ", player, x, y, z); - } - - void player_setCameraPosition(void* player, float x, float y, float z) { - return call("player_setCameraPosition", player, x, y, z); - } - - Vector3 player_getCameraPosition(void* player) { - return call("player_getCameraPosition", player); - } - - void player_setCameraLookAt(void* player, float x, float y, float z, int cutType) { - return call("player_setCameraLookAt", player, x, y, z, cutType); - } - - Vector3 player_getCameraLookAt(void* player) { - return call("player_getCameraLookAt", player); - } - - void player_setCameraBehind(void* player) { - return call("player_setCameraBehind", player); - } - - void player_interpolateCameraPosition(void* player, float fromX, float fromY, float fromZ, float toX, float toY, float toZ, int time, int cutType) { - return call("player_interpolateCameraPosition", player, fromX, fromY, fromZ, toX, toY, toZ, time, cutType); - } - - void player_interpolateCameraLookAt(void* player, float fromX, float fromY, float fromZ, float toX, float toY, float toZ, int time, int cutType) { - return call("player_interpolateCameraLookAt", player, fromX, fromY, fromZ, toX, toY, toZ, time, cutType); - } - - void player_attachCameraToObject(void* player, void* object) { - return call("player_attachCameraToObject", player, object); - } - - int player_setName(void* player, String name) { - return call("player_setName", player, name); - } - - String player_getName(void* player) { - return call("player_getName", player); - } - - String player_getSerial(void* player) { - return call("player_getSerial", player); - } - - void player_giveWeapon(void* player, uint8_t id, uint32_t ammo) { - return call("player_giveWeapon", player, id, ammo); - } - - void player_removeWeapon(void* player, uint8_t weapon) { - return call("player_removeWeapon", player, weapon); - } - - void player_setWeaponAmmo(void* player, uint8_t id, uint32_t ammo) { - return call("player_setWeaponAmmo", player, id, ammo); - } - - Array* player_getWeapons(void* player) { - return call("player_getWeapons", player); - } - - WeaponSlotData player_getWeaponSlot(void* player, int slot) { - return call("player_getWeaponSlot", player, slot); - } - - void player_resetWeapons(void* player) { - return call("player_resetWeapons", player); - } - - void player_setArmedWeapon(void* player, uint32_t weapon) { - return call("player_setArmedWeapon", player, weapon); - } - - uint32_t player_getArmedWeapon(void* player) { - return call("player_getArmedWeapon", player); - } - - uint32_t player_getArmedWeaponAmmo(void* player) { - return call("player_getArmedWeaponAmmo", player); - } - - void player_setShopName(void* player, String name) { - return call("player_setShopName", player, name); - } - - String player_getShopName(void* player) { - return call("player_getShopName", player); - } - - void player_setDrunkLevel(void* player, int level) { - return call("player_setDrunkLevel", player, level); - } - - int player_getDrunkLevel(void* player) { - return call("player_getDrunkLevel", player); - } - - void player_setColour(void* player, uint32_t colour) { - return call("player_setColour", player, colour); - } - - uint32_t player_getColour(void* player) { - return call("player_getColour", player); - } - - void player_setOtherColour(void* player, void* other, uint32_t colour) { - return call("player_setOtherColour", player, other, colour); - } - - int player_getOtherColour(void* player, void* other, uint32_t* colour) { - return call("player_getOtherColour", player, other, colour); - } - - void player_setControllable(void* player, int controllable) { - return call("player_setControllable", player, controllable); - } - - int player_getControllable(void* player) { - return call("player_getControllable", player); - } - - void player_setSpectating(void* player, int spectating) { - return call("player_setSpectating", player, spectating); - } - - void player_setWantedLevel(void* player, unsigned level) { - return call("player_setWantedLevel", player, level); - } - - unsigned player_getWantedLevel(void* player) { - return call("player_getWantedLevel", player); - } - - void player_playSound(void* player, uint32_t sound, float posX, float posY, float posZ) { - return call("player_playSound", player, sound, posX, posY, posZ); - } - - uint32_t player_lastPlayedSound(void* player) { - return call("player_lastPlayedSound", player); - } - - void player_playAudio(void* player, String url, unsigned char usePos, float posX, float posY, float posZ, float distance) { - return call("player_playAudio", player, url, usePos, posX, posY, posZ, distance); - } - - int player_playerCrimeReport(void* player, void* suspect, int crime) { - return call("player_playerCrimeReport", player, suspect, crime); - } - - void player_stopAudio(void* player) { - return call("player_stopAudio", player); - } - - String player_lastPlayedAudio(void* player) { - return call("player_lastPlayedAudio", player); - } - - void player_createExplosion(void* player, float vecX, float vecY, float vecZ, int type, float radius) { - return call("player_createExplosion", player, vecX, vecY, vecZ, type, radius); - } - - void player_sendDeathMessage(void* player, void* killee, void* killer, int weapon) { - return call("player_sendDeathMessage", player, killee, killer, weapon); - } - - void player_sendEmptyDeathMessage(void* player) { - return call("player_sendEmptyDeathMessage", player); - } - - void player_removeDefaultObjects(void* player, unsigned model, float posX, float posY, float posZ, float radius) { - return call("player_removeDefaultObjects", player, model, posX, posY, posZ, radius); - } - - void player_forceClassSelection(void* player) { - return call("player_forceClassSelection", player); - } - - void player_setMoney(void* player, int money) { - return call("player_setMoney", player, money); - } - - void player_giveMoney(void* player, int money) { - return call("player_giveMoney", player, money); - } - - void player_resetMoney(void* player) { - return call("player_resetMoney", player); - } - - int player_getMoney(void* player) { - return call("player_getMoney", player); - } - - void player_setMapIcon(void* player, int id, float posX, float posY, float posZ, int type, uint32_t colour, int style) { - return call("player_setMapIcon", player, id, posX, posY, posZ, type, colour, style); - } - - void player_unsetMapIcon(void* player, int id) { - return call("player_unsetMapIcon", player, id); - } - - void player_useStuntBonuses(void* player, int enable) { - return call("player_useStuntBonuses", player, enable); - } - - void player_toggleOtherNameTag(void* player, void* other, int toggle) { - return call("player_toggleOtherNameTag", player, other, toggle); - } - - void player_setTime(void* player, int hr, int min) { - return call("player_setTime", player, hr, min); - } - - Time player_getTime(void* player) { - return call