4 typedef struct rendermodule_s
6 int active; // set by start, cleared by shutdown
13 rendermodule_t rendermodule[64];
18 for (i = 0;i < 64;i++)
19 rendermodule[i].name = NULL;
22 void R_RegisterModule(char *name, void(*start)(), void(*shutdown)())
25 for (i = 0;i < 64;i++)
27 if (rendermodule[i].name == NULL)
29 if (!strcmp(name, rendermodule[i].name))
30 Sys_Error("R_RegisterModule: module \"%s\" registered twice\n", name);
33 Sys_Error("R_RegisterModule: ran out of renderer module slots (64)\n");
34 rendermodule[i].active = 0;
35 rendermodule[i].name = name;
36 rendermodule[i].start = start;
37 rendermodule[i].shutdown = shutdown;
40 void R_StartModules ()
43 for (i = 0;i < 64;i++)
45 if (rendermodule[i].name == NULL)
47 if (rendermodule[i].active)
48 Sys_Error("R_StartModules: module \"%s\" already active\n", rendermodule[i].name);
49 rendermodule[i].active = 1;
50 rendermodule[i].start();
54 void R_ShutdownModules ()
57 for (i = 0;i < 64;i++)
59 if (rendermodule[i].name == NULL)
61 if (!rendermodule[i].active)
63 rendermodule[i].active = 0;
64 rendermodule[i].shutdown();