aboutsummaryrefslogtreecommitdiff
path: root/api.h
blob: 086ef4678876dc2823f8a6569196e9654a738dd4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// SPDX-License-Identifier: ISC
// SPDX-FileCopyrightText: 2024 Matthew Wozniak <me@woz.blue>

#ifndef ENGINEAPI_H
#define ENGINEAPI_H

#define INTERFACEVERSION_VENGINESERVER "VEngineServer021"
#define VENGINE_CLIENT_INTERFACE_VERSION "VEngineClient013"

#include "intdef.h"

typedef void * (*createinterface_func)(const char *name, int *ret);

struct engserver {
	struct {
		usize _pad[36];
		void (*__thiscall server_command)(struct engserver *this, const char *str);
	} *vt;
};

struct engclient {
	struct {
		usize _pad[75];
		void (*__thiscall is_playing_demo)(struct engclient *this);
	} *vt;
};

struct demoplayer {
	struct {
		void *_destructor;
		void * (*__thiscall get_demo_file)(struct demoplayer *this);
		int (*__thiscall get_playback_tick)(struct demoplayer *this);
		int (*__thiscall get_total_ticks)(struct demoplayer *this);
		void *_whatisthisihavenoidea;
		bool (*__thiscall start_playback)(struct demoplayer *this,
				const char *filename, bool as_time_demo);
		bool (*__thiscall is_playing_back)(struct demoplayer *this);
		bool (*__thiscall is_playback_paused)(struct demoplayer *this);
		bool (*__thiscall is_playing_time_demo)(struct demoplayer *this);
		bool (*__thiscall is_skipping)(struct demoplayer *this);
		bool (*__thiscall can_skip_backwards)(struct demoplayer *this);
		void (*__thiscall set_playback_time_scale)(struct demoplayer *this,
				float timescale);
		float (*__thiscall get_playback_time_scale)(struct demoplayer *this);
		void (*__thiscall pause_playback)(struct demoplayer *this,
				float seconds);
		void (*__thiscall skip_to_tick)(struct demoplayer *this, int tick,
				bool relative, bool pause);
		void (*__thiscall resume_playback)(struct demoplayer *this);
		void (*__thiscall stop_playback)(struct demoplayer *this);
		void (*__thiscall interpolate_viewpoint)(struct demoplayer *this);
	} *vt;
};

#ifndef NO_EXTERNS
extern struct engserver *engserver;
extern struct engclient *engclient;
extern struct demoplayer *demoplayer;
extern void (*cbuf_addtext)(char *);
#endif

// initializes required engine apis. returns false on error.
bool api_init(void);

#endif

// vi: sw=4 ts=4 noet tw=80 cc=80