1 #include "client_dll.h"
2 
3 /*
4 	Title:	 r1q2 client DLL interface
5 	Author:	 R1CH (r1ch@r1ch.net)
6 	Version: 1.0
7 
8 	Description:
9 	My r1q2 client provides support for a client side DLL that handles
10 	messages from the server such as s.event, s.effects, svc_tempentity, etc.
11 	By providing the client dll, each mod can have their own events, tempents,
12 	etc. providing a much more customisable experience without the need to edit
13 	the EXE. The server exports some functions to this DLL that allow you to
14 	do pretty much whatever you want: create new entities, spawn models, play
15 	sounds, execute commands, open/close files, etc. The raw interface to the
16 	renderer is provided allowing you to basically do anything you could do
17 	from the client in the exe, without the need to edit the exe. Of course,
18 	this dll requires r1q2 to work - something that I hope people take to using
19 	as there are numerous security holes, bugs, etc. in the default quake2.exe
20 	and in an ideal world I'd lile r1q2 to superceed idq2, and providing this
21 	DLL is one reason to use it instead of having 101 different exes floating
22 	around, each one mod-specific and perhaps not having all the needed bug
23 	and security fixes that others do, etc...
24 
25 	A warning though, this is still under development as I continue to develop
26 	the Quake II engine. The client DLL api version might change at some point
27 	as I find the need to export more functions for example - this will make
28 	all older client_dll.dll files incompatible with the new exe - so be sure
29 	to keep up to date on what's happening...
30 */
31 
32 
33 /*
34 ==============
35 CLDLL_Init
36 ==============
37 This is called when the client DLL is loaded from the executable.
38 The ci (client import) is set up at this point so you can print
39 status messages, check that the DLL is being called from the right
40 FS_GameDir(), etc. Return -1 on failure to signal the game to error
41 out.
42 */
CLDLL_Init(void * hInstance)43 int CLDLL_Init ( void *hInstance)
44 {
45 	ci.Com_Printf ( "r1q2 client dll v1.0 initialized.\n"
46 					"This DLL is to be used with generic mods that\n"
47 					"do not have their own client_dll because they\n"
48 					"were not designed for r1q2.\n");
49 
50 	return 1;
51 }
52 
53 /*
54 =============
55 CLDLL_Shutdown
56 =============
57 This is called by the engine when it's about to unload the client DLL
58 from memory. Use this to ci.Z_Free() any memory you allocated, clean up
59 anything lying around basically. All memory allocated via ci.Z_Alloc()
60 will be nuked after this function exits.
61 */
CLDLL_Shutdown(void)62 void CLDLL_Shutdown (void)
63 {
64 }
65 
66 /*
67 ============
68 GetClAPI
69 ============
70 This exposes the client DLL functions to the engine and also gets the
71 exported engine functions passed to it. This is the only visibly
72 exported function in the actualy .DLL file. The remainder are done via
73 the pointer interfaces on the import/export structures. You should not
74 ever need to edit this function. Return NULL on error.
75 */
GetClAPI(climport_t cimp)76 CLIENT_DLL_API clexport_t GetClAPI (climport_t cimp )
77 {
78 	clexport_t	ce;
79 
80 	ci = cimp;
81 
82 	ce.api_version = CLIENT_DLL_API_VERSION;
83 
84 	ce.Init = CLDLL_Init;
85 	ce.Shutdown = CLDLL_Shutdown;
86 	ce.CLParseTempEnt = CLParseTempEnt;
87 
88 	return ce;
89 }
90 
91 /*
92 ============
93 CLParseTempEnt
94 ============
95 Parse a temp ent. Return false on an unhandled tempent, the engine
96 will then crash the client :)
97 */
CLParseTempEnt(int type)98 qboolean CLParseTempEnt(int type)
99 {
100 	switch (type)
101 	{
102 
103 	}
104 
105 	return false;
106 }
107