… | |
… | |
51 | |
51 | |
52 | static f_plug_api gethook; |
52 | static f_plug_api gethook; |
53 | static f_plug_api registerGlobalEvent; |
53 | static f_plug_api registerGlobalEvent; |
54 | static f_plug_api unregisterGlobalEvent; |
54 | static f_plug_api unregisterGlobalEvent; |
55 | static f_plug_api systemDirectory; |
55 | static f_plug_api systemDirectory; |
56 | static f_plug_api reCmp; |
|
|
57 | |
56 | |
58 | typedef struct |
57 | typedef struct |
59 | { |
58 | { |
60 | object* who; |
59 | object* who; |
61 | object* activator; |
60 | object* activator; |
… | |
… | |
332 | printf (PLUGIN_VERSION " post init\n"); |
331 | printf (PLUGIN_VERSION " post init\n"); |
333 | |
332 | |
334 | registerGlobalEvent = gethook (&rtype, hooktype, "cfapi_system_register_global_event"); |
333 | registerGlobalEvent = gethook (&rtype, hooktype, "cfapi_system_register_global_event"); |
335 | unregisterGlobalEvent = gethook (&rtype, hooktype, "cfapi_system_unregister_global_event"); |
334 | unregisterGlobalEvent = gethook (&rtype, hooktype, "cfapi_system_unregister_global_event"); |
336 | systemDirectory = gethook (&rtype, hooktype, "cfapi_system_directory"); |
335 | systemDirectory = gethook (&rtype, hooktype, "cfapi_system_directory"); |
337 | reCmp = gethook (&rtype, hooktype, "cfapi_system_re_cmp"); |
|
|
338 | cf_init_plugin (gethook); |
336 | cf_init_plugin (gethook); |
339 | |
337 | |
340 | /* Pick the global events you want to monitor from this plugin */ |
338 | /* Pick the global events you want to monitor from this plugin */ |
341 | registerGlobalEvent (NULL, EVENT_BORN, PLUGIN_NAME, globalEventListener); |
339 | registerGlobalEvent (NULL, EVENT_BORN, PLUGIN_NAME, globalEventListener); |
342 | registerGlobalEvent (NULL, EVENT_CLOCK, PLUGIN_NAME, globalEventListener); |
340 | registerGlobalEvent (NULL, EVENT_CLOCK, PLUGIN_NAME, globalEventListener); |
… | |
… | |
357 | char *argv[] = { |
355 | char *argv[] = { |
358 | "", |
356 | "", |
359 | "-e" |
357 | "-e" |
360 | "BEGIN {" |
358 | "BEGIN {" |
361 | " cf->bootstrap;" |
359 | " cf->bootstrap;" |
362 | " unshift @INC, cf::maps_directory ('perl');" |
360 | " unshift @INC, cf::datadir ();" |
363 | "}" |
361 | "}" |
364 | "" |
362 | "" |
365 | "use cf;" |
363 | "use cf;" |
366 | }; |
364 | }; |
367 | |
365 | |
368 | perl = perl_alloc (); |
366 | perl = perl_alloc (); |
369 | perl_construct (perl); |
367 | perl_construct (perl); |
370 | |
368 | |
371 | if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) |
369 | if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) || perl_run (perl)) |
372 | || perl_run (perl)) |
|
|
373 | { |
370 | { |
374 | printf ("unable to initialize perl-interpreter, continuing without.\n"); |
371 | printf ("unable to initialize perl-interpreter, continuing without.\n"); |
375 | |
372 | |
376 | perl_destruct (perl); |
373 | perl_destruct (perl); |
377 | perl_free (perl); |
374 | perl_free (perl); |
… | |
… | |
999 | |
996 | |
1000 | char * |
997 | char * |
1001 | cf_get_maps_directory (char *path) |
998 | cf_get_maps_directory (char *path) |
1002 | ALIAS: maps_directory = 0 |
999 | ALIAS: maps_directory = 0 |
1003 | |
1000 | |
|
|
1001 | char * |
|
|
1002 | mapdir () |
|
|
1003 | ALIAS: |
|
|
1004 | mapdir = 0 |
|
|
1005 | uniquedir = 1 |
|
|
1006 | tmpdir = 2 |
|
|
1007 | confdir = 3 |
|
|
1008 | localdir = 4 |
|
|
1009 | playerdir = 5 |
|
|
1010 | datadir = 6 |
|
|
1011 | CODE: |
|
|
1012 | { |
|
|
1013 | int unused_type; |
|
|
1014 | RETVAL = (char *)systemDirectory (&unused_type, ix); |
|
|
1015 | } |
|
|
1016 | OUTPUT: |
|
|
1017 | RETVAL |
|
|
1018 | |
1004 | int |
1019 | int |
1005 | cf_find_animation (char *text) |
1020 | cf_find_animation (char *text) |
1006 | |
1021 | |
1007 | MODULE = cf PACKAGE = cf::object PREFIX = cf_object_ |
1022 | MODULE = cf PACKAGE = cf::object PREFIX = cf_object_ |
1008 | |
1023 | |