1 |
root |
1.1 |
/*****************************************************************************/ |
2 |
root |
1.7 |
/* CrossFire, A Multiplayer game for the X Window System */ |
3 |
root |
1.1 |
/* */ |
4 |
|
|
/*****************************************************************************/ |
5 |
|
|
|
6 |
root |
1.7 |
/* |
7 |
|
|
* This code is placed under the GNU General Public Licence (GPL) |
8 |
|
|
* |
9 |
|
|
* Copyright (C) 2001-2005 by Chachkoff Yann |
10 |
|
|
* Copyright (C) 2006 by Marc Lehmann <cf@schmorpd.e> |
11 |
|
|
* |
12 |
|
|
* This program is free software; you can redistribute it and/or modify |
13 |
|
|
* it under the terms of the GNU General Public License as published by |
14 |
|
|
* the Free Software Foundation; either version 2 of the License, or |
15 |
|
|
* (at your option) any later version. |
16 |
|
|
* |
17 |
|
|
* This program is distributed in the hope that it will be useful, |
18 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
19 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
20 |
|
|
* GNU General Public License for more details. |
21 |
|
|
* |
22 |
|
|
* You should have received a copy of the GNU General Public License |
23 |
|
|
* along with this program; if not, write to the Free Software |
24 |
|
|
* Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
25 |
|
|
*/ |
26 |
|
|
|
27 |
root |
1.1 |
#include <EXTERN.h> |
28 |
|
|
#include <perl.h> |
29 |
|
|
#include <XSUB.h> |
30 |
|
|
|
31 |
|
|
#undef save_long // clashes with libproto.h |
32 |
|
|
|
33 |
|
|
#define PLUGIN_NAME "cfperl" |
34 |
|
|
#define PLUGIN_VERSION "cfperl 0.0" |
35 |
|
|
|
36 |
|
|
#ifndef __CEXTRACT__ |
37 |
|
|
#include <plugin.h> |
38 |
|
|
#endif |
39 |
|
|
|
40 |
|
|
#undef MODULEAPI |
41 |
|
|
#ifdef WIN32 |
42 |
|
|
#else |
43 |
|
|
#define MODULEAPI |
44 |
|
|
#endif |
45 |
|
|
|
46 |
|
|
#include <plugin_common.h> |
47 |
|
|
|
48 |
|
|
#include <stdarg.h> |
49 |
|
|
|
50 |
|
|
#include "perlxsi.c" |
51 |
|
|
|
52 |
|
|
static f_plug_api gethook; |
53 |
|
|
static f_plug_api registerGlobalEvent; |
54 |
|
|
static f_plug_api unregisterGlobalEvent; |
55 |
|
|
static f_plug_api systemDirectory; |
56 |
root |
1.10 |
static f_plug_api object_set_property; |
57 |
root |
1.11 |
static f_plug_api map_get_map; |
58 |
root |
1.1 |
|
59 |
|
|
typedef struct |
60 |
|
|
{ |
61 |
|
|
object* who; |
62 |
|
|
object* activator; |
63 |
|
|
object* third; |
64 |
|
|
char message[1024]; |
65 |
|
|
int fix; |
66 |
|
|
int event_code; |
67 |
|
|
char options[1024]; |
68 |
|
|
int returnvalue; |
69 |
|
|
} CFPContext; |
70 |
|
|
|
71 |
|
|
//static int current_command = -999; |
72 |
|
|
|
73 |
|
|
static PerlInterpreter *perl; |
74 |
|
|
|
75 |
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
76 |
|
|
|
77 |
|
|
static SV * |
78 |
|
|
newSVptr (void *ptr, const char *klass) |
79 |
|
|
{ |
80 |
|
|
if (!ptr) |
81 |
|
|
return &PL_sv_undef; |
82 |
|
|
|
83 |
|
|
HV *hv = newHV (); |
84 |
|
|
sv_magic ((SV *)hv, 0, PERL_MAGIC_ext, (char *)ptr, 0); |
85 |
|
|
return sv_bless (newRV_noinc ((SV *)hv), gv_stashpv (klass, 1)); |
86 |
|
|
} |
87 |
|
|
|
88 |
|
|
static void |
89 |
|
|
clearSVptr (SV *sv) |
90 |
|
|
{ |
91 |
|
|
if (SvROK (sv)) |
92 |
|
|
sv = SvRV (sv); |
93 |
|
|
|
94 |
|
|
hv_clear ((HV *)sv); |
95 |
|
|
sv_unmagic (sv, PERL_MAGIC_ext); |
96 |
|
|
} |
97 |
|
|
|
98 |
|
|
static long |
99 |
|
|
SvPTR (SV *sv, const char *klass) |
100 |
|
|
{ |
101 |
|
|
if (!sv_derived_from (sv, klass)) |
102 |
|
|
croak ("object of type %s expected", klass); |
103 |
|
|
|
104 |
|
|
MAGIC *mg = mg_find (SvRV (sv), PERL_MAGIC_ext); |
105 |
|
|
|
106 |
|
|
if (!mg) |
107 |
|
|
croak ("perl code used %s object, but C object is already destroyed, caught", klass); |
108 |
|
|
|
109 |
|
|
return (long)mg->mg_ptr; |
110 |
|
|
} |
111 |
|
|
|
112 |
|
|
SV * |
113 |
|
|
newSVcfapi (int type, ...) |
114 |
|
|
{ |
115 |
|
|
SV *sv; |
116 |
|
|
|
117 |
|
|
va_list args; |
118 |
|
|
va_start (args, type); |
119 |
|
|
|
120 |
|
|
switch (type) |
121 |
|
|
{ |
122 |
|
|
case CFAPI_INT: |
123 |
|
|
sv = newSViv (*va_arg (args, int *)); |
124 |
|
|
break; |
125 |
|
|
|
126 |
|
|
case CFAPI_LONG: |
127 |
|
|
sv = newSViv (*va_arg (args, long *)); |
128 |
|
|
break; |
129 |
|
|
|
130 |
|
|
case CFAPI_DOUBLE: |
131 |
|
|
sv = newSViv (*va_arg (args, double *)); |
132 |
|
|
break; |
133 |
|
|
|
134 |
|
|
case CFAPI_STRING: |
135 |
root |
1.7 |
{ |
136 |
|
|
char *str = va_arg (args, char *); |
137 |
|
|
sv = str ? newSVpv (str, 0) : &PL_sv_undef; |
138 |
|
|
} |
139 |
root |
1.1 |
break; |
140 |
|
|
|
141 |
|
|
case CFAPI_POBJECT: |
142 |
|
|
{ |
143 |
|
|
object *obj = va_arg (args, object *); |
144 |
|
|
|
145 |
|
|
if (!obj) |
146 |
|
|
sv = &PL_sv_undef; |
147 |
|
|
else |
148 |
|
|
switch (*(int *)cf_object_get_property (obj, CFAPI_OBJECT_PROP_TYPE)) |
149 |
|
|
{ |
150 |
|
|
case MAP: |
151 |
|
|
sv = newSVptr (obj, "cf::object::map"); |
152 |
|
|
break; |
153 |
|
|
|
154 |
|
|
case PLAYER: |
155 |
|
|
sv = newSVptr (obj, "cf::object::player"); |
156 |
|
|
break; |
157 |
|
|
|
158 |
|
|
default: |
159 |
|
|
sv = newSVptr (obj, "cf::object"); |
160 |
|
|
break; |
161 |
|
|
} |
162 |
|
|
} |
163 |
|
|
break; |
164 |
|
|
|
165 |
|
|
case CFAPI_PMAP: |
166 |
root |
1.6 |
sv = newSVptr (va_arg (args, mapstruct *), "cf::map"); |
167 |
root |
1.1 |
break; |
168 |
|
|
|
169 |
|
|
case CFAPI_PPLAYER: |
170 |
root |
1.6 |
sv = newSVptr (va_arg (args, player *), "cf::player"); |
171 |
root |
1.1 |
break; |
172 |
|
|
|
173 |
|
|
case CFAPI_PARCH: |
174 |
root |
1.6 |
sv = newSVptr (va_arg (args, archetype *), "cf::arch"); |
175 |
root |
1.1 |
break; |
176 |
|
|
|
177 |
|
|
case CFAPI_PPARTY: |
178 |
root |
1.6 |
sv = newSVptr (va_arg (args, partylist *), "cf::party"); |
179 |
root |
1.1 |
break; |
180 |
|
|
|
181 |
|
|
case CFAPI_PREGION: |
182 |
root |
1.6 |
sv = newSVptr (va_arg (args, region *), "cf::region"); |
183 |
root |
1.1 |
break; |
184 |
|
|
|
185 |
|
|
default: |
186 |
|
|
assert (("unhandled type in newSVcfapi", 0)); |
187 |
|
|
} |
188 |
|
|
|
189 |
|
|
va_end (args); |
190 |
|
|
|
191 |
|
|
return sv; |
192 |
|
|
} |
193 |
|
|
|
194 |
|
|
///////////////////////////////////////////////////////////////////////////// |
195 |
|
|
|
196 |
|
|
void |
197 |
|
|
inject_event (CFPContext *context) |
198 |
|
|
{ |
199 |
|
|
dSP; |
200 |
|
|
|
201 |
|
|
ENTER; |
202 |
|
|
SAVETMPS; |
203 |
|
|
|
204 |
|
|
PUSHMARK (SP); |
205 |
|
|
|
206 |
|
|
EXTEND (SP, 2); |
207 |
|
|
//PUSHs (sv_2mortal (newSViv (type))); |
208 |
|
|
|
209 |
|
|
HV *hv = newHV (); |
210 |
|
|
#define hv_context(type,addr,expr) hv_store (hv, #expr, sizeof (#expr) - 1, newSVcfapi (type, addr context->expr), 0) |
211 |
|
|
hv_context (CFAPI_POBJECT, ,who); |
212 |
|
|
hv_context (CFAPI_POBJECT, ,activator); |
213 |
|
|
hv_context (CFAPI_POBJECT, ,third); |
214 |
|
|
hv_context (CFAPI_STRING , ,message); |
215 |
|
|
hv_context (CFAPI_INT ,&,fix); |
216 |
|
|
hv_context (CFAPI_INT ,&,event_code); |
217 |
|
|
hv_context (CFAPI_STRING , ,options); |
218 |
|
|
|
219 |
|
|
PUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); |
220 |
|
|
|
221 |
|
|
PUTBACK; |
222 |
|
|
int count = call_pv ("cf::inject_event", G_SCALAR | G_EVAL); |
223 |
|
|
SPAGAIN; |
224 |
|
|
|
225 |
root |
1.6 |
if (SvTRUE (ERRSV)) |
226 |
|
|
LOG (llevError, "event '%d' callback evaluation error: %s", context->event_code, SvPV_nolen (ERRSV)); |
227 |
|
|
|
228 |
root |
1.1 |
context->returnvalue = count > 0 ? POPi : 0; |
229 |
|
|
|
230 |
|
|
PUTBACK; |
231 |
|
|
FREETMPS; |
232 |
|
|
LEAVE; |
233 |
|
|
} |
234 |
|
|
|
235 |
|
|
///////////////////////////////////////////////////////////////////////////// |
236 |
|
|
|
237 |
|
|
int |
238 |
|
|
initPlugin (const char *iversion, f_plug_api gethooksptr) |
239 |
|
|
{ |
240 |
|
|
gethook = gethooksptr; |
241 |
|
|
printf (PLUGIN_VERSION " init\n"); |
242 |
|
|
|
243 |
|
|
return 0; |
244 |
|
|
} |
245 |
|
|
|
246 |
|
|
static CommArray_s rtn_cmd; |
247 |
|
|
|
248 |
|
|
int |
249 |
|
|
runPluginCommand (object *obj, char *params) |
250 |
|
|
{ |
251 |
|
|
dSP; |
252 |
|
|
|
253 |
|
|
ENTER; |
254 |
|
|
SAVETMPS; |
255 |
|
|
|
256 |
|
|
PUSHMARK (SP); |
257 |
|
|
|
258 |
|
|
EXTEND (SP, 3); |
259 |
|
|
PUSHs (sv_2mortal (newSVpv (rtn_cmd.name, 0))); |
260 |
|
|
PUSHs (sv_2mortal (newSVcfapi (CFAPI_POBJECT, obj))); |
261 |
|
|
|
262 |
|
|
if (params) |
263 |
|
|
PUSHs (sv_2mortal (newSVpv (params, 0))); |
264 |
|
|
|
265 |
|
|
PUTBACK; |
266 |
|
|
int count = call_pv ("cf::inject_command", G_SCALAR | G_EVAL); |
267 |
|
|
SPAGAIN; |
268 |
|
|
|
269 |
root |
1.6 |
if (SvTRUE (ERRSV)) |
270 |
|
|
LOG (llevError, "command '%s' callback evaluation error: %s", rtn_cmd.name, SvPV_nolen (ERRSV)); |
271 |
|
|
|
272 |
root |
1.1 |
int returnvalue = count > 0 ? POPi : -1; |
273 |
|
|
|
274 |
|
|
PUTBACK; |
275 |
|
|
FREETMPS; |
276 |
|
|
LEAVE; |
277 |
|
|
|
278 |
|
|
return returnvalue; |
279 |
|
|
} |
280 |
|
|
|
281 |
|
|
void * |
282 |
|
|
getPluginProperty (int *type, ...) |
283 |
|
|
{ |
284 |
|
|
va_list args; |
285 |
|
|
char *propname; |
286 |
|
|
int i; |
287 |
|
|
va_start (args, type); |
288 |
|
|
propname = va_arg (args, char *); |
289 |
|
|
//printf ("Property name: %s\n", propname); |
290 |
root |
1.3 |
|
291 |
root |
1.1 |
if (!strcmp (propname, "command?")) |
292 |
|
|
{ |
293 |
root |
1.3 |
if (!perl) |
294 |
|
|
return NULL; |
295 |
|
|
|
296 |
root |
1.1 |
const char *cmdname = va_arg (args, const char *); |
297 |
|
|
HV *hv = get_hv ("cf::COMMAND", 1); |
298 |
|
|
SV **svp = hv_fetch (hv, cmdname, strlen (cmdname) + 1, 0); |
299 |
|
|
|
300 |
|
|
va_end (args); |
301 |
|
|
|
302 |
|
|
if (svp) |
303 |
|
|
{ |
304 |
|
|
// this is totaly broken, should stash it into %COMMAND |
305 |
|
|
rtn_cmd.name = cmdname; |
306 |
|
|
rtn_cmd.time = SvNV (*svp); |
307 |
|
|
rtn_cmd.func = runPluginCommand; |
308 |
|
|
|
309 |
|
|
return &rtn_cmd; |
310 |
|
|
} |
311 |
|
|
} |
312 |
|
|
else if (!strcmp (propname, "Identification")) |
313 |
|
|
{ |
314 |
|
|
va_end (args); |
315 |
|
|
return PLUGIN_NAME; |
316 |
|
|
} |
317 |
|
|
else if (!strcmp (propname, "FullName")) |
318 |
|
|
{ |
319 |
|
|
va_end (args); |
320 |
|
|
return PLUGIN_VERSION; |
321 |
|
|
} |
322 |
|
|
else |
323 |
|
|
va_end (args); |
324 |
|
|
|
325 |
|
|
return NULL; |
326 |
|
|
} |
327 |
|
|
|
328 |
|
|
void *globalEventListener (int *type, ...); |
329 |
|
|
|
330 |
|
|
int |
331 |
|
|
postInitPlugin () |
332 |
|
|
{ |
333 |
|
|
int hooktype = 1; |
334 |
|
|
int rtype = 0; |
335 |
|
|
|
336 |
|
|
printf (PLUGIN_VERSION " post init\n"); |
337 |
|
|
|
338 |
|
|
registerGlobalEvent = gethook (&rtype, hooktype, "cfapi_system_register_global_event"); |
339 |
|
|
unregisterGlobalEvent = gethook (&rtype, hooktype, "cfapi_system_unregister_global_event"); |
340 |
|
|
systemDirectory = gethook (&rtype, hooktype, "cfapi_system_directory"); |
341 |
root |
1.10 |
object_set_property = gethook (&rtype, hooktype, "cfapi_object_set_property"); |
342 |
root |
1.11 |
map_get_map = gethook (&rtype, hooktype, "cfapi_map_get_map"); |
343 |
|
|
|
344 |
root |
1.1 |
cf_init_plugin (gethook); |
345 |
|
|
|
346 |
|
|
/* Pick the global events you want to monitor from this plugin */ |
347 |
|
|
registerGlobalEvent (NULL, EVENT_BORN, PLUGIN_NAME, globalEventListener); |
348 |
|
|
registerGlobalEvent (NULL, EVENT_CLOCK, PLUGIN_NAME, globalEventListener); |
349 |
|
|
//registerGlobalEvent (NULL, EVENT_CRASH, PLUGIN_NAME, globalEventListener); |
350 |
|
|
registerGlobalEvent (NULL, EVENT_PLAYER_DEATH, PLUGIN_NAME, globalEventListener); |
351 |
|
|
registerGlobalEvent (NULL, EVENT_GKILL, PLUGIN_NAME, globalEventListener); |
352 |
|
|
registerGlobalEvent (NULL, EVENT_LOGIN, PLUGIN_NAME, globalEventListener); |
353 |
|
|
registerGlobalEvent (NULL, EVENT_LOGOUT, PLUGIN_NAME, globalEventListener); |
354 |
|
|
registerGlobalEvent (NULL, EVENT_MAPENTER, PLUGIN_NAME, globalEventListener); |
355 |
|
|
registerGlobalEvent (NULL, EVENT_MAPLEAVE, PLUGIN_NAME, globalEventListener); |
356 |
|
|
registerGlobalEvent (NULL, EVENT_MAPRESET, PLUGIN_NAME, globalEventListener); |
357 |
|
|
registerGlobalEvent (NULL, EVENT_REMOVE, PLUGIN_NAME, globalEventListener); |
358 |
|
|
registerGlobalEvent (NULL, EVENT_SHOUT, PLUGIN_NAME, globalEventListener); |
359 |
|
|
registerGlobalEvent (NULL, EVENT_TELL, PLUGIN_NAME, globalEventListener); |
360 |
|
|
registerGlobalEvent (NULL, EVENT_MUZZLE, PLUGIN_NAME, globalEventListener); |
361 |
|
|
registerGlobalEvent (NULL, EVENT_KICK, PLUGIN_NAME, globalEventListener); |
362 |
|
|
|
363 |
|
|
char *argv[] = { |
364 |
|
|
"", |
365 |
|
|
"-e" |
366 |
|
|
"BEGIN {" |
367 |
|
|
" cf->bootstrap;" |
368 |
root |
1.5 |
" unshift @INC, cf::datadir ();" |
369 |
root |
1.1 |
"}" |
370 |
|
|
"" |
371 |
|
|
"use cf;" |
372 |
|
|
}; |
373 |
|
|
|
374 |
|
|
perl = perl_alloc (); |
375 |
|
|
perl_construct (perl); |
376 |
|
|
|
377 |
root |
1.5 |
if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) || perl_run (perl)) |
378 |
root |
1.1 |
{ |
379 |
|
|
printf ("unable to initialize perl-interpreter, continuing without.\n"); |
380 |
|
|
|
381 |
|
|
perl_destruct (perl); |
382 |
|
|
perl_free (perl); |
383 |
|
|
perl = 0; |
384 |
|
|
} |
385 |
|
|
|
386 |
|
|
return 0; |
387 |
|
|
} |
388 |
|
|
|
389 |
|
|
void * |
390 |
|
|
globalEventListener (int *type, ...) |
391 |
|
|
{ |
392 |
|
|
va_list args; |
393 |
|
|
static int rv = 0; |
394 |
|
|
CFPContext context; |
395 |
|
|
char *buf; |
396 |
|
|
player *pl; |
397 |
|
|
object *op; |
398 |
|
|
|
399 |
|
|
if (!perl) |
400 |
|
|
return; |
401 |
|
|
|
402 |
|
|
memset (&context, 0, sizeof (context)); |
403 |
|
|
|
404 |
|
|
va_start (args, type); |
405 |
|
|
context.event_code = va_arg (args, int); |
406 |
|
|
|
407 |
|
|
switch (context.event_code) |
408 |
|
|
{ |
409 |
|
|
case EVENT_CRASH: |
410 |
|
|
printf ("Unimplemented for now\n"); |
411 |
|
|
break; |
412 |
|
|
|
413 |
|
|
case EVENT_BORN: |
414 |
|
|
context.activator = va_arg (args, object *); |
415 |
|
|
break; |
416 |
|
|
|
417 |
|
|
case EVENT_PLAYER_DEATH: |
418 |
|
|
context.who = va_arg (args, object *); |
419 |
|
|
break; |
420 |
|
|
|
421 |
|
|
case EVENT_GKILL: |
422 |
|
|
context.who = va_arg (args, object *); |
423 |
|
|
context.activator = va_arg (args, object *); |
424 |
|
|
break; |
425 |
|
|
|
426 |
|
|
case EVENT_LOGIN: |
427 |
|
|
pl = va_arg (args, player *); |
428 |
|
|
context.activator = pl->ob; |
429 |
|
|
buf = va_arg (args, char *); |
430 |
|
|
if (buf != 0) |
431 |
|
|
strcpy (context.message, buf); |
432 |
|
|
break; |
433 |
|
|
|
434 |
|
|
case EVENT_LOGOUT: |
435 |
|
|
pl = va_arg (args, player *); |
436 |
|
|
context.activator = pl->ob; |
437 |
|
|
buf = va_arg (args, char *); |
438 |
|
|
if (buf != 0) |
439 |
|
|
strcpy (context.message, buf); |
440 |
|
|
break; |
441 |
|
|
|
442 |
|
|
case EVENT_REMOVE: |
443 |
|
|
context.activator = va_arg (args, object *); |
444 |
|
|
break; |
445 |
|
|
|
446 |
|
|
case EVENT_SHOUT: |
447 |
|
|
context.activator = va_arg (args, object *); |
448 |
|
|
buf = va_arg (args, char *); |
449 |
|
|
if (buf != 0) |
450 |
|
|
strcpy (context.message, buf); |
451 |
|
|
break; |
452 |
|
|
|
453 |
|
|
case EVENT_MUZZLE: |
454 |
|
|
context.activator = va_arg (args, object *); |
455 |
|
|
buf = va_arg (args, char *); |
456 |
|
|
if (buf != 0) |
457 |
|
|
strcpy (context.message, buf); |
458 |
|
|
break; |
459 |
|
|
|
460 |
|
|
case EVENT_KICK: |
461 |
|
|
context.activator = va_arg (args, object *); |
462 |
|
|
buf = va_arg (args, char *); |
463 |
|
|
if (buf != 0) |
464 |
|
|
strcpy (context.message, buf); |
465 |
|
|
break; |
466 |
|
|
|
467 |
|
|
case EVENT_MAPENTER: |
468 |
|
|
context.activator = va_arg (args, object *); |
469 |
|
|
break; |
470 |
|
|
|
471 |
|
|
case EVENT_MAPLEAVE: |
472 |
|
|
context.activator = va_arg (args, object *); |
473 |
|
|
break; |
474 |
|
|
|
475 |
|
|
case EVENT_CLOCK: |
476 |
|
|
break; |
477 |
|
|
|
478 |
|
|
case EVENT_MAPRESET: |
479 |
|
|
buf = va_arg (args, char *); |
480 |
|
|
if (buf != 0) |
481 |
|
|
strcpy (context.message, buf); |
482 |
|
|
break; |
483 |
|
|
|
484 |
|
|
case EVENT_TELL: |
485 |
|
|
break; |
486 |
|
|
} |
487 |
|
|
|
488 |
|
|
va_end (args); |
489 |
|
|
|
490 |
|
|
inject_event (&context); |
491 |
|
|
|
492 |
|
|
rv = context.returnvalue; |
493 |
|
|
|
494 |
|
|
return &rv; |
495 |
|
|
} |
496 |
|
|
|
497 |
|
|
void * |
498 |
|
|
eventListener (int *type, ...) |
499 |
|
|
{ |
500 |
|
|
static int rv = 0; |
501 |
|
|
va_list args; |
502 |
|
|
char *buf; |
503 |
|
|
CFPContext context; |
504 |
|
|
|
505 |
|
|
if (!perl) |
506 |
|
|
return; |
507 |
|
|
|
508 |
|
|
memset (&context, 0, sizeof (context)); |
509 |
|
|
|
510 |
|
|
va_start (args, type); |
511 |
|
|
|
512 |
|
|
context.who = va_arg (args, object *); |
513 |
|
|
context.event_code = va_arg (args, int); |
514 |
|
|
context.activator = va_arg (args, object *); |
515 |
|
|
context.third = va_arg (args, object *); |
516 |
|
|
buf = va_arg (args, char *); |
517 |
|
|
|
518 |
|
|
if (buf != 0) |
519 |
|
|
strcpy (context.message, buf); |
520 |
|
|
|
521 |
|
|
context.fix = va_arg (args, int); |
522 |
|
|
strcpy (context.options, va_arg (args, char *)); |
523 |
|
|
context.returnvalue = 0; |
524 |
|
|
va_end (args); |
525 |
|
|
|
526 |
|
|
inject_event (&context); |
527 |
|
|
|
528 |
|
|
rv = context.returnvalue; |
529 |
|
|
return &rv; |
530 |
|
|
} |
531 |
|
|
|
532 |
|
|
int |
533 |
|
|
closePlugin () |
534 |
|
|
{ |
535 |
|
|
printf (PLUGIN_VERSION " closing\n"); |
536 |
|
|
|
537 |
|
|
if (perl) |
538 |
|
|
{ |
539 |
|
|
perl_destruct (perl); |
540 |
|
|
perl_free (perl); |
541 |
|
|
perl = 0; |
542 |
|
|
} |
543 |
|
|
|
544 |
|
|
return 0; |
545 |
|
|
} |
546 |
|
|
|
547 |
|
|
MODULE = cf PACKAGE = cf PREFIX = cf_ |
548 |
|
|
|
549 |
|
|
BOOT: |
550 |
|
|
{ |
551 |
|
|
HV *stash = gv_stashpv ("cf", 1); |
552 |
|
|
|
553 |
root |
1.9 |
static const struct { |
554 |
root |
1.1 |
const char *name; |
555 |
|
|
IV iv; |
556 |
|
|
} *civ, const_iv[] = { |
557 |
|
|
# define const_iv(name) { # name, (IV)name }, |
558 |
|
|
const_iv (llevError) |
559 |
|
|
const_iv (llevInfo) |
560 |
|
|
const_iv (llevDebug) |
561 |
|
|
const_iv (llevMonster) |
562 |
|
|
|
563 |
|
|
const_iv (PLAYER) |
564 |
|
|
const_iv (ROD) |
565 |
|
|
const_iv (TREASURE) |
566 |
|
|
const_iv (POTION) |
567 |
|
|
const_iv (FOOD) |
568 |
|
|
const_iv (POISON) |
569 |
|
|
const_iv (BOOK) |
570 |
|
|
const_iv (CLOCK) |
571 |
|
|
const_iv (LIGHTNING) |
572 |
|
|
const_iv (ARROW) |
573 |
|
|
const_iv (BOW) |
574 |
|
|
const_iv (WEAPON) |
575 |
|
|
const_iv (ARMOUR) |
576 |
|
|
const_iv (PEDESTAL) |
577 |
|
|
const_iv (ALTAR) |
578 |
|
|
const_iv (CONFUSION) |
579 |
|
|
const_iv (LOCKED_DOOR) |
580 |
|
|
const_iv (SPECIAL_KEY) |
581 |
|
|
const_iv (MAP) |
582 |
|
|
const_iv (DOOR) |
583 |
|
|
const_iv (KEY) |
584 |
|
|
const_iv (TIMED_GATE) |
585 |
|
|
const_iv (TRIGGER) |
586 |
|
|
const_iv (GRIMREAPER) |
587 |
|
|
const_iv (MAGIC_EAR) |
588 |
|
|
const_iv (TRIGGER_BUTTON) |
589 |
|
|
const_iv (TRIGGER_ALTAR) |
590 |
|
|
const_iv (TRIGGER_PEDESTAL) |
591 |
|
|
const_iv (SHIELD) |
592 |
|
|
const_iv (HELMET) |
593 |
|
|
const_iv (HORN) |
594 |
|
|
const_iv (MONEY) |
595 |
|
|
const_iv (CLASS) |
596 |
|
|
const_iv (GRAVESTONE) |
597 |
|
|
const_iv (AMULET) |
598 |
|
|
const_iv (PLAYERMOVER) |
599 |
|
|
const_iv (TELEPORTER) |
600 |
|
|
const_iv (CREATOR) |
601 |
|
|
const_iv (SKILL) |
602 |
|
|
const_iv (EXPERIENCE) |
603 |
|
|
const_iv (EARTHWALL) |
604 |
|
|
const_iv (GOLEM) |
605 |
|
|
const_iv (THROWN_OBJ) |
606 |
|
|
const_iv (BLINDNESS) |
607 |
|
|
const_iv (GOD) |
608 |
|
|
const_iv (DETECTOR) |
609 |
|
|
const_iv (TRIGGER_MARKER) |
610 |
|
|
const_iv (DEAD_OBJECT) |
611 |
|
|
const_iv (DRINK) |
612 |
|
|
const_iv (MARKER) |
613 |
|
|
const_iv (HOLY_ALTAR) |
614 |
|
|
const_iv (PLAYER_CHANGER) |
615 |
|
|
const_iv (BATTLEGROUND) |
616 |
|
|
const_iv (PEACEMAKER) |
617 |
|
|
const_iv (GEM) |
618 |
|
|
const_iv (FIREWALL) |
619 |
|
|
const_iv (ANVIL) |
620 |
|
|
const_iv (CHECK_INV) |
621 |
|
|
const_iv (MOOD_FLOOR) |
622 |
|
|
const_iv (EXIT) |
623 |
|
|
const_iv (ENCOUNTER) |
624 |
|
|
const_iv (SHOP_FLOOR) |
625 |
|
|
const_iv (SHOP_MAT) |
626 |
|
|
const_iv (RING) |
627 |
|
|
const_iv (FLOOR) |
628 |
|
|
const_iv (FLESH) |
629 |
|
|
const_iv (INORGANIC) |
630 |
|
|
const_iv (SKILL_TOOL) |
631 |
|
|
const_iv (LIGHTER) |
632 |
|
|
const_iv (TRAP_PART) |
633 |
|
|
const_iv (WALL) |
634 |
|
|
const_iv (LIGHT_SOURCE) |
635 |
|
|
const_iv (MISC_OBJECT) |
636 |
|
|
const_iv (MONSTER) |
637 |
|
|
const_iv (SPAWN_GENERATOR) |
638 |
|
|
const_iv (LAMP) |
639 |
|
|
const_iv (DUPLICATOR) |
640 |
|
|
const_iv (TOOL) |
641 |
|
|
const_iv (SPELLBOOK) |
642 |
|
|
const_iv (BUILDFAC) |
643 |
|
|
const_iv (CLOAK) |
644 |
|
|
const_iv (SPINNER) |
645 |
|
|
const_iv (GATE) |
646 |
|
|
const_iv (BUTTON) |
647 |
|
|
const_iv (CF_HANDLE) |
648 |
|
|
const_iv (HOLE) |
649 |
|
|
const_iv (TRAPDOOR) |
650 |
|
|
const_iv (SIGN) |
651 |
|
|
const_iv (BOOTS) |
652 |
|
|
const_iv (GLOVES) |
653 |
|
|
const_iv (SPELL) |
654 |
|
|
const_iv (SPELL_EFFECT) |
655 |
|
|
const_iv (CONVERTER) |
656 |
|
|
const_iv (BRACERS) |
657 |
|
|
const_iv (POISONING) |
658 |
|
|
const_iv (SAVEBED) |
659 |
|
|
const_iv (POISONCLOUD) |
660 |
|
|
const_iv (FIREHOLES) |
661 |
|
|
const_iv (WAND) |
662 |
|
|
const_iv (SCROLL) |
663 |
|
|
const_iv (DIRECTOR) |
664 |
|
|
const_iv (GIRDLE) |
665 |
|
|
const_iv (FORCE) |
666 |
|
|
const_iv (POTION_EFFECT) |
667 |
|
|
const_iv (EVENT_CONNECTOR) |
668 |
|
|
const_iv (CLOSE_CON) |
669 |
|
|
const_iv (CONTAINER) |
670 |
|
|
const_iv (ARMOUR_IMPROVER) |
671 |
|
|
const_iv (WEAPON_IMPROVER) |
672 |
|
|
const_iv (SKILLSCROLL) |
673 |
|
|
const_iv (DEEP_SWAMP) |
674 |
|
|
const_iv (IDENTIFY_ALTAR) |
675 |
|
|
const_iv (MENU) |
676 |
|
|
const_iv (RUNE) |
677 |
|
|
const_iv (TRAP) |
678 |
|
|
const_iv (POWER_CRYSTAL) |
679 |
|
|
const_iv (CORPSE) |
680 |
|
|
const_iv (DISEASE) |
681 |
|
|
const_iv (SYMPTOM) |
682 |
|
|
const_iv (BUILDER) |
683 |
|
|
const_iv (MATERIAL) |
684 |
|
|
const_iv (ITEM_TRANSFORMER) |
685 |
|
|
const_iv (QUEST) |
686 |
|
|
|
687 |
|
|
const_iv (ST_BD_BUILD) |
688 |
|
|
const_iv (ST_BD_REMOVE) |
689 |
|
|
const_iv (ST_MAT_FLOOR) |
690 |
|
|
const_iv (ST_MAT_WALL) |
691 |
|
|
const_iv (ST_MAT_ITEM) |
692 |
|
|
|
693 |
|
|
const_iv (QUEST_IN_PROGRESS) |
694 |
|
|
const_iv (QUEST_DONE_QUEST) |
695 |
|
|
const_iv (QUEST_DONE_TASK) |
696 |
|
|
const_iv (QUEST_START_QUEST) |
697 |
|
|
const_iv (QUEST_END_QUEST) |
698 |
|
|
const_iv (QUEST_START_TASK) |
699 |
|
|
const_iv (QUEST_END_TASK) |
700 |
|
|
const_iv (QUEST_OVERRIDE) |
701 |
|
|
const_iv (QUEST_ON_ACTIVATE) |
702 |
|
|
|
703 |
|
|
const_iv (WEAP_HIT) |
704 |
|
|
const_iv (WEAP_SLASH) |
705 |
|
|
const_iv (WEAP_PIERCE) |
706 |
|
|
const_iv (WEAP_CLEAVE) |
707 |
|
|
const_iv (WEAP_SLICE) |
708 |
|
|
const_iv (WEAP_STAB) |
709 |
|
|
const_iv (WEAP_WHIP) |
710 |
|
|
const_iv (WEAP_CRUSH) |
711 |
|
|
const_iv (WEAP_BLUD) |
712 |
|
|
|
713 |
|
|
const_iv (FLAG_ALIVE) |
714 |
|
|
const_iv (FLAG_WIZ) |
715 |
|
|
const_iv (FLAG_REMOVED) |
716 |
|
|
const_iv (FLAG_FREED) |
717 |
|
|
const_iv (FLAG_WAS_WIZ) |
718 |
|
|
const_iv (FLAG_APPLIED) |
719 |
|
|
const_iv (FLAG_UNPAID) |
720 |
|
|
const_iv (FLAG_USE_SHIELD) |
721 |
|
|
const_iv (FLAG_NO_PICK) |
722 |
|
|
const_iv (FLAG_ANIMATE) |
723 |
|
|
const_iv (FLAG_MONSTER) |
724 |
|
|
const_iv (FLAG_FRIENDLY) |
725 |
|
|
const_iv (FLAG_GENERATOR) |
726 |
|
|
const_iv (FLAG_IS_THROWN) |
727 |
|
|
const_iv (FLAG_AUTO_APPLY) |
728 |
|
|
const_iv (FLAG_TREASURE) |
729 |
|
|
const_iv (FLAG_PLAYER_SOLD) |
730 |
|
|
const_iv (FLAG_SEE_INVISIBLE) |
731 |
|
|
const_iv (FLAG_CAN_ROLL) |
732 |
|
|
const_iv (FLAG_OVERLAY_FLOOR) |
733 |
|
|
const_iv (FLAG_IS_TURNABLE) |
734 |
|
|
const_iv (FLAG_IS_USED_UP) |
735 |
|
|
const_iv (FLAG_IDENTIFIED) |
736 |
|
|
const_iv (FLAG_REFLECTING) |
737 |
|
|
const_iv (FLAG_CHANGING) |
738 |
|
|
const_iv (FLAG_SPLITTING) |
739 |
|
|
const_iv (FLAG_HITBACK) |
740 |
|
|
const_iv (FLAG_STARTEQUIP) |
741 |
|
|
const_iv (FLAG_BLOCKSVIEW) |
742 |
|
|
const_iv (FLAG_UNDEAD) |
743 |
|
|
const_iv (FLAG_SCARED) |
744 |
|
|
const_iv (FLAG_UNAGGRESSIVE) |
745 |
|
|
const_iv (FLAG_REFL_MISSILE) |
746 |
|
|
const_iv (FLAG_REFL_SPELL) |
747 |
|
|
const_iv (FLAG_NO_MAGIC) |
748 |
|
|
const_iv (FLAG_NO_FIX_PLAYER) |
749 |
|
|
const_iv (FLAG_IS_LIGHTABLE) |
750 |
|
|
const_iv (FLAG_TEAR_DOWN) |
751 |
|
|
const_iv (FLAG_RUN_AWAY) |
752 |
|
|
const_iv (FLAG_PICK_UP) |
753 |
|
|
const_iv (FLAG_UNIQUE) |
754 |
|
|
const_iv (FLAG_NO_DROP) |
755 |
|
|
const_iv (FLAG_WIZCAST) |
756 |
|
|
const_iv (FLAG_CAST_SPELL) |
757 |
|
|
const_iv (FLAG_USE_SCROLL) |
758 |
|
|
const_iv (FLAG_USE_RANGE) |
759 |
|
|
const_iv (FLAG_USE_BOW) |
760 |
|
|
const_iv (FLAG_USE_ARMOUR) |
761 |
|
|
const_iv (FLAG_USE_WEAPON) |
762 |
|
|
const_iv (FLAG_USE_RING) |
763 |
|
|
const_iv (FLAG_READY_RANGE) |
764 |
|
|
const_iv (FLAG_READY_BOW) |
765 |
|
|
const_iv (FLAG_XRAYS) |
766 |
|
|
const_iv (FLAG_NO_APPLY) |
767 |
|
|
const_iv (FLAG_IS_FLOOR) |
768 |
|
|
const_iv (FLAG_LIFESAVE) |
769 |
|
|
const_iv (FLAG_NO_STRENGTH) |
770 |
|
|
const_iv (FLAG_SLEEP) |
771 |
|
|
const_iv (FLAG_STAND_STILL) |
772 |
|
|
const_iv (FLAG_RANDOM_MOVE) |
773 |
|
|
const_iv (FLAG_ONLY_ATTACK) |
774 |
|
|
const_iv (FLAG_CONFUSED) |
775 |
|
|
const_iv (FLAG_STEALTH) |
776 |
|
|
const_iv (FLAG_WIZPASS) |
777 |
|
|
const_iv (FLAG_IS_LINKED) |
778 |
|
|
const_iv (FLAG_CURSED) |
779 |
|
|
const_iv (FLAG_DAMNED) |
780 |
|
|
const_iv (FLAG_SEE_ANYWHERE) |
781 |
|
|
const_iv (FLAG_KNOWN_MAGICAL) |
782 |
|
|
const_iv (FLAG_KNOWN_CURSED) |
783 |
|
|
const_iv (FLAG_CAN_USE_SKILL) |
784 |
|
|
const_iv (FLAG_BEEN_APPLIED) |
785 |
|
|
const_iv (FLAG_READY_SCROLL) |
786 |
|
|
const_iv (FLAG_USE_ROD) |
787 |
|
|
const_iv (FLAG_USE_HORN) |
788 |
|
|
const_iv (FLAG_MAKE_INVIS) |
789 |
|
|
const_iv (FLAG_INV_LOCKED) |
790 |
|
|
const_iv (FLAG_IS_WOODED) |
791 |
|
|
const_iv (FLAG_IS_HILLY) |
792 |
|
|
const_iv (FLAG_READY_SKILL) |
793 |
|
|
const_iv (FLAG_READY_WEAPON) |
794 |
|
|
const_iv (FLAG_NO_SKILL_IDENT) |
795 |
|
|
const_iv (FLAG_BLIND) |
796 |
|
|
const_iv (FLAG_SEE_IN_DARK) |
797 |
|
|
const_iv (FLAG_IS_CAULDRON) |
798 |
|
|
const_iv (FLAG_NO_STEAL) |
799 |
|
|
const_iv (FLAG_ONE_HIT) |
800 |
|
|
const_iv (FLAG_CLIENT_SENT) |
801 |
|
|
const_iv (FLAG_BERSERK) |
802 |
|
|
const_iv (FLAG_NEUTRAL) |
803 |
|
|
const_iv (FLAG_NO_ATTACK) |
804 |
|
|
const_iv (FLAG_NO_DAMAGE) |
805 |
|
|
const_iv (FLAG_OBJ_ORIGINAL) |
806 |
|
|
const_iv (FLAG_OBJ_SAVE_ON_OVL) |
807 |
|
|
const_iv (FLAG_ACTIVATE_ON_PUSH) |
808 |
|
|
const_iv (FLAG_ACTIVATE_ON_RELEASE) |
809 |
|
|
const_iv (FLAG_IS_WATER) |
810 |
|
|
const_iv (FLAG_CONTENT_ON_GEN) |
811 |
|
|
const_iv (FLAG_IS_A_TEMPLATE) |
812 |
|
|
const_iv (FLAG_IS_BUILDABLE) |
813 |
|
|
const_iv (FLAG_AFK) |
814 |
root |
1.6 |
|
815 |
|
|
const_iv (NDI_BLACK) |
816 |
|
|
const_iv (NDI_WHITE) |
817 |
|
|
const_iv (NDI_NAVY) |
818 |
|
|
const_iv (NDI_RED) |
819 |
|
|
const_iv (NDI_ORANGE) |
820 |
|
|
const_iv (NDI_BLUE) |
821 |
|
|
const_iv (NDI_DK_ORANGE) |
822 |
|
|
const_iv (NDI_GREEN) |
823 |
|
|
const_iv (NDI_LT_GREEN) |
824 |
|
|
const_iv (NDI_GREY) |
825 |
|
|
const_iv (NDI_BROWN) |
826 |
|
|
const_iv (NDI_GOLD) |
827 |
|
|
const_iv (NDI_TAN) |
828 |
|
|
const_iv (NDI_MAX_COLOR) |
829 |
|
|
const_iv (NDI_COLOR_MASK) |
830 |
|
|
const_iv (NDI_UNIQUE) |
831 |
|
|
const_iv (NDI_ALL) |
832 |
|
|
|
833 |
|
|
const_iv (F_APPLIED) |
834 |
|
|
const_iv (F_LOCATION) |
835 |
|
|
const_iv (F_UNPAID) |
836 |
|
|
const_iv (F_MAGIC) |
837 |
|
|
const_iv (F_CURSED) |
838 |
|
|
const_iv (F_DAMNED) |
839 |
|
|
const_iv (F_OPEN) |
840 |
|
|
const_iv (F_NOPICK) |
841 |
|
|
const_iv (F_LOCKED) |
842 |
root |
1.11 |
|
843 |
|
|
const_iv (P_BLOCKSVIEW) |
844 |
|
|
const_iv (P_NO_MAGIC) |
845 |
|
|
const_iv (P_IS_ALIVE) |
846 |
|
|
const_iv (P_NO_CLERIC) |
847 |
|
|
const_iv (P_NEED_UPDATE) |
848 |
|
|
const_iv (P_NO_ERROR) |
849 |
|
|
const_iv (P_OUT_OF_MAP) |
850 |
|
|
const_iv (P_NEW_MAP) |
851 |
root |
1.1 |
}; |
852 |
|
|
|
853 |
|
|
for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
854 |
|
|
newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
855 |
|
|
|
856 |
root |
1.9 |
static const struct { |
857 |
root |
1.1 |
const char *name; |
858 |
|
|
IV iv; |
859 |
|
|
} *event, event_list[] = { |
860 |
|
|
# define const_event(name) { # name, (IV)EVENT_ ## name }, |
861 |
|
|
const_event (NONE) |
862 |
|
|
const_event (APPLY) |
863 |
|
|
const_event (ATTACK) |
864 |
|
|
const_event (DEATH) |
865 |
|
|
const_event (DROP) |
866 |
|
|
const_event (PICKUP) |
867 |
|
|
const_event (SAY) |
868 |
|
|
const_event (STOP) |
869 |
|
|
const_event (TIME) |
870 |
|
|
const_event (THROW) |
871 |
|
|
const_event (TRIGGER) |
872 |
|
|
const_event (CLOSE) |
873 |
|
|
const_event (TIMER) |
874 |
|
|
|
875 |
|
|
const_event (BORN) |
876 |
|
|
const_event (CLOCK) |
877 |
|
|
const_event (CRASH) |
878 |
|
|
const_event (PLAYER_DEATH) |
879 |
|
|
const_event (GKILL) |
880 |
|
|
const_event (LOGIN) |
881 |
|
|
const_event (LOGOUT) |
882 |
|
|
const_event (MAPENTER) |
883 |
|
|
const_event (MAPLEAVE) |
884 |
|
|
const_event (MAPRESET) |
885 |
|
|
const_event (REMOVE) |
886 |
|
|
const_event (SHOUT) |
887 |
|
|
const_event (TELL) |
888 |
|
|
const_event (MUZZLE) |
889 |
|
|
const_event (KICK) |
890 |
|
|
}; |
891 |
|
|
|
892 |
|
|
AV *av = get_av ("cf::EVENT", 1); |
893 |
|
|
|
894 |
|
|
for (event = event_list + sizeof (event_list) / sizeof (event_list [0]); event-- > event_list; ) |
895 |
|
|
av_store (av, event->iv, newSVpv ((char *)event->name, 0)); |
896 |
|
|
|
897 |
root |
1.9 |
static const struct { |
898 |
root |
1.1 |
int dtype; |
899 |
|
|
const char *name; |
900 |
|
|
IV idx; |
901 |
|
|
} *cprop, prop_table[] = { |
902 |
|
|
# define prop(type, name) { type, # name, (IV) CFAPI_ ## name }, |
903 |
|
|
prop (CFAPI_INT, MAP_PROP_FLAGS) |
904 |
|
|
prop (CFAPI_INT, MAP_PROP_DIFFICULTY) |
905 |
|
|
prop (CFAPI_STRING, MAP_PROP_PATH) |
906 |
|
|
prop (CFAPI_STRING, MAP_PROP_TMPNAME) |
907 |
|
|
prop (CFAPI_STRING, MAP_PROP_NAME) |
908 |
|
|
prop (CFAPI_INT, MAP_PROP_RESET_TIME) |
909 |
|
|
prop (CFAPI_INT, MAP_PROP_RESET_TIMEOUT) |
910 |
|
|
prop (CFAPI_INT, MAP_PROP_PLAYERS) |
911 |
|
|
prop (CFAPI_INT, MAP_PROP_DARKNESS) |
912 |
|
|
prop (CFAPI_INT, MAP_PROP_WIDTH) |
913 |
|
|
prop (CFAPI_INT, MAP_PROP_HEIGHT) |
914 |
|
|
prop (CFAPI_INT, MAP_PROP_ENTER_X) |
915 |
|
|
prop (CFAPI_INT, MAP_PROP_ENTER_Y) |
916 |
|
|
prop (CFAPI_INT, MAP_PROP_TEMPERATURE) |
917 |
|
|
prop (CFAPI_INT, MAP_PROP_PRESSURE) |
918 |
|
|
prop (CFAPI_INT, MAP_PROP_HUMIDITY) |
919 |
|
|
prop (CFAPI_INT, MAP_PROP_WINDSPEED) |
920 |
|
|
prop (CFAPI_INT, MAP_PROP_WINDDIR) |
921 |
|
|
prop (CFAPI_INT, MAP_PROP_SKY) |
922 |
|
|
prop (CFAPI_INT, MAP_PROP_WPARTX) |
923 |
|
|
prop (CFAPI_INT, MAP_PROP_WPARTY) |
924 |
|
|
prop (CFAPI_STRING, MAP_PROP_MESSAGE) |
925 |
|
|
prop (CFAPI_PMAP, MAP_PROP_NEXT) |
926 |
|
|
prop (CFAPI_PREGION, MAP_PROP_REGION) |
927 |
|
|
prop (CFAPI_POBJECT, OBJECT_PROP_OB_ABOVE) |
928 |
|
|
prop (CFAPI_POBJECT, OBJECT_PROP_OB_BELOW) |
929 |
|
|
prop (CFAPI_POBJECT, OBJECT_PROP_NEXT_ACTIVE_OB) |
930 |
|
|
prop (CFAPI_POBJECT, OBJECT_PROP_PREV_ACTIVE_OB) |
931 |
|
|
prop (CFAPI_POBJECT, OBJECT_PROP_INVENTORY) |
932 |
|
|
prop (CFAPI_POBJECT, OBJECT_PROP_ENVIRONMENT) |
933 |
|
|
prop (CFAPI_POBJECT, OBJECT_PROP_HEAD) |
934 |
|
|
prop (CFAPI_POBJECT, OBJECT_PROP_CONTAINER) |
935 |
|
|
prop (CFAPI_PMAP, OBJECT_PROP_MAP) |
936 |
|
|
prop (CFAPI_INT, OBJECT_PROP_COUNT) |
937 |
|
|
prop (CFAPI_INT, OBJECT_PROP_REFCOUNT) |
938 |
|
|
prop (CFAPI_STRING, OBJECT_PROP_NAME) |
939 |
|
|
prop (CFAPI_STRING, OBJECT_PROP_NAME_PLURAL) |
940 |
|
|
prop (CFAPI_STRING, OBJECT_PROP_TITLE) |
941 |
|
|
prop (CFAPI_STRING, OBJECT_PROP_RACE) |
942 |
|
|
prop (CFAPI_STRING, OBJECT_PROP_SLAYING) |
943 |
|
|
prop (CFAPI_STRING, OBJECT_PROP_SKILL) |
944 |
|
|
prop (CFAPI_STRING, OBJECT_PROP_MESSAGE) |
945 |
|
|
prop (CFAPI_STRING, OBJECT_PROP_LORE) |
946 |
|
|
prop (CFAPI_INT, OBJECT_PROP_X) |
947 |
|
|
prop (CFAPI_INT, OBJECT_PROP_Y) |
948 |
|
|
prop (CFAPI_DOUBLE, OBJECT_PROP_SPEED) |
949 |
|
|
prop (CFAPI_DOUBLE, OBJECT_PROP_SPEED_LEFT) |
950 |
|
|
prop (CFAPI_INT, OBJECT_PROP_NROF) |
951 |
|
|
prop (CFAPI_INT, OBJECT_PROP_DIRECTION) |
952 |
|
|
prop (CFAPI_INT, OBJECT_PROP_FACING) |
953 |
|
|
prop (CFAPI_INT, OBJECT_PROP_TYPE) |
954 |
|
|
prop (CFAPI_INT, OBJECT_PROP_SUBTYPE) |
955 |
|
|
prop (CFAPI_INT, OBJECT_PROP_CLIENT_TYPE) |
956 |
|
|
prop (CFAPI_INT, OBJECT_PROP_ATTACK_TYPE) |
957 |
|
|
prop (CFAPI_INT, OBJECT_PROP_PATH_ATTUNED) |
958 |
|
|
prop (CFAPI_INT, OBJECT_PROP_PATH_REPELLED) |
959 |
|
|
prop (CFAPI_INT, OBJECT_PROP_PATH_DENIED) |
960 |
|
|
prop (CFAPI_INT, OBJECT_PROP_MATERIAL) |
961 |
|
|
prop (CFAPI_STRING, OBJECT_PROP_MATERIAL_NAME) |
962 |
|
|
prop (CFAPI_INT, OBJECT_PROP_MAGIC) |
963 |
|
|
prop (CFAPI_INT, OBJECT_PROP_VALUE) |
964 |
|
|
prop (CFAPI_INT, OBJECT_PROP_LEVEL) |
965 |
|
|
prop (CFAPI_INT, OBJECT_PROP_LAST_HEAL) |
966 |
|
|
prop (CFAPI_INT, OBJECT_PROP_LAST_SP) |
967 |
|
|
prop (CFAPI_INT, OBJECT_PROP_LAST_GRACE) |
968 |
|
|
prop (CFAPI_INT, OBJECT_PROP_LAST_EAT) |
969 |
|
|
prop (CFAPI_INT, OBJECT_PROP_INVISIBLE_TIME) |
970 |
|
|
prop (CFAPI_INT, OBJECT_PROP_PICK_UP) |
971 |
|
|
prop (CFAPI_INT, OBJECT_PROP_ITEM_POWER) |
972 |
|
|
prop (CFAPI_INT, OBJECT_PROP_GEN_SP_ARMOUR) |
973 |
|
|
prop (CFAPI_INT, OBJECT_PROP_WEIGHT) |
974 |
|
|
prop (CFAPI_INT, OBJECT_PROP_WEIGHT_LIMIT) |
975 |
|
|
prop (CFAPI_INT, OBJECT_PROP_CARRYING) |
976 |
|
|
prop (CFAPI_INT, OBJECT_PROP_GLOW_RADIUS) |
977 |
|
|
prop (CFAPI_LONG, OBJECT_PROP_PERM_EXP) |
978 |
|
|
prop (CFAPI_POBJECT, OBJECT_PROP_CURRENT_WEAPON) |
979 |
|
|
prop (CFAPI_POBJECT, OBJECT_PROP_ENEMY) |
980 |
|
|
prop (CFAPI_POBJECT, OBJECT_PROP_ATTACKED_BY) |
981 |
|
|
prop (CFAPI_INT, OBJECT_PROP_RUN_AWAY) |
982 |
|
|
prop (CFAPI_POBJECT, OBJECT_PROP_CHOSEN_SKILL) |
983 |
|
|
prop (CFAPI_INT, OBJECT_PROP_HIDDEN) |
984 |
|
|
prop (CFAPI_INT, OBJECT_PROP_MOVE_STATUS) |
985 |
|
|
prop (CFAPI_INT, OBJECT_PROP_MOVE_TYPE) |
986 |
|
|
prop (CFAPI_POBJECT, OBJECT_PROP_SPELL_ITEM) |
987 |
|
|
prop (CFAPI_DOUBLE, OBJECT_PROP_EXP_MULTIPLIER) |
988 |
|
|
prop (CFAPI_PARCH, OBJECT_PROP_ARCHETYPE) |
989 |
|
|
prop (CFAPI_PARCH, OBJECT_PROP_OTHER_ARCH) |
990 |
|
|
prop (CFAPI_STRING, OBJECT_PROP_CUSTOM_NAME) |
991 |
|
|
prop (CFAPI_INT, OBJECT_PROP_ANIM_SPEED) |
992 |
|
|
prop (CFAPI_INT, OBJECT_PROP_FRIENDLY) |
993 |
|
|
prop (CFAPI_STRING, OBJECT_PROP_SHORT_NAME) |
994 |
|
|
prop (CFAPI_INT, OBJECT_PROP_MAGICAL) |
995 |
|
|
prop (CFAPI_INT, OBJECT_PROP_LUCK) |
996 |
|
|
prop (CFAPI_LONG, OBJECT_PROP_EXP) |
997 |
|
|
prop (CFAPI_POBJECT, OBJECT_PROP_OWNER) |
998 |
|
|
prop (CFAPI_POBJECT, OBJECT_PROP_PRESENT) |
999 |
|
|
prop (CFAPI_INT, OBJECT_PROP_CHEATER) |
1000 |
|
|
prop (CFAPI_INT, OBJECT_PROP_MERGEABLE) |
1001 |
|
|
prop (CFAPI_INT, OBJECT_PROP_PICKABLE) |
1002 |
|
|
prop (CFAPI_INT, OBJECT_PROP_STR) |
1003 |
|
|
prop (CFAPI_INT, OBJECT_PROP_DEX) |
1004 |
|
|
prop (CFAPI_INT, OBJECT_PROP_CON) |
1005 |
|
|
prop (CFAPI_INT, OBJECT_PROP_WIS) |
1006 |
|
|
prop (CFAPI_INT, OBJECT_PROP_INT) |
1007 |
|
|
prop (CFAPI_INT, OBJECT_PROP_POW) |
1008 |
|
|
prop (CFAPI_INT, OBJECT_PROP_CHA) |
1009 |
|
|
prop (CFAPI_INT, OBJECT_PROP_WC) |
1010 |
|
|
prop (CFAPI_INT, OBJECT_PROP_AC) |
1011 |
|
|
prop (CFAPI_INT, OBJECT_PROP_HP) |
1012 |
|
|
prop (CFAPI_INT, OBJECT_PROP_SP) |
1013 |
|
|
prop (CFAPI_INT, OBJECT_PROP_GP) |
1014 |
|
|
prop (CFAPI_INT, OBJECT_PROP_FP) |
1015 |
|
|
prop (CFAPI_INT, OBJECT_PROP_MAXHP) |
1016 |
|
|
prop (CFAPI_INT, OBJECT_PROP_MAXSP) |
1017 |
|
|
prop (CFAPI_INT, OBJECT_PROP_MAXGP) |
1018 |
|
|
prop (CFAPI_INT, OBJECT_PROP_DAM) |
1019 |
|
|
prop (CFAPI_STRING, OBJECT_PROP_GOD) |
1020 |
|
|
prop (CFAPI_STRING, OBJECT_PROP_ARCH_NAME) |
1021 |
|
|
prop (CFAPI_INT, OBJECT_PROP_INVISIBLE) |
1022 |
|
|
prop (CFAPI_INT, OBJECT_PROP_FACE) |
1023 |
|
|
}; |
1024 |
|
|
|
1025 |
|
|
HV *prop_type = get_hv ("cf::PROP_TYPE", 1); |
1026 |
|
|
HV *prop_idx = get_hv ("cf::PROP_IDX", 1); |
1027 |
|
|
|
1028 |
|
|
for (cprop = prop_table + sizeof (prop_table) / sizeof (prop_table [0]); cprop-- > prop_table; ) |
1029 |
|
|
{ |
1030 |
|
|
hv_store (prop_type, cprop->name, strlen (cprop->name), newSViv (cprop->dtype), 0); |
1031 |
|
|
hv_store (prop_idx, cprop->name, strlen (cprop->name), newSViv (cprop->idx ), 0); |
1032 |
|
|
} |
1033 |
|
|
} |
1034 |
|
|
|
1035 |
|
|
void |
1036 |
|
|
LOG (int level, char *msg) |
1037 |
root |
1.6 |
PROTOTYPE: $$ |
1038 |
root |
1.1 |
C_ARGS: level, "%s", msg |
1039 |
|
|
|
1040 |
|
|
char * |
1041 |
|
|
cf_get_maps_directory (char *path) |
1042 |
root |
1.6 |
PROTOTYPE: $ |
1043 |
root |
1.2 |
ALIAS: maps_directory = 0 |
1044 |
root |
1.1 |
|
1045 |
root |
1.5 |
char * |
1046 |
|
|
mapdir () |
1047 |
root |
1.6 |
PROTOTYPE: |
1048 |
root |
1.5 |
ALIAS: |
1049 |
|
|
mapdir = 0 |
1050 |
|
|
uniquedir = 1 |
1051 |
|
|
tmpdir = 2 |
1052 |
|
|
confdir = 3 |
1053 |
|
|
localdir = 4 |
1054 |
|
|
playerdir = 5 |
1055 |
|
|
datadir = 6 |
1056 |
|
|
CODE: |
1057 |
|
|
{ |
1058 |
|
|
int unused_type; |
1059 |
|
|
RETVAL = (char *)systemDirectory (&unused_type, ix); |
1060 |
|
|
} |
1061 |
root |
1.6 |
OUTPUT: RETVAL |
1062 |
root |
1.5 |
|
1063 |
root |
1.4 |
int |
1064 |
|
|
cf_find_animation (char *text) |
1065 |
root |
1.6 |
PROTOTYPE: $ |
1066 |
root |
1.4 |
|
1067 |
root |
1.1 |
MODULE = cf PACKAGE = cf::object PREFIX = cf_object_ |
1068 |
|
|
|
1069 |
|
|
SV * |
1070 |
root |
1.4 |
get_property (object *obj, int type, int idx) |
1071 |
root |
1.1 |
CODE: |
1072 |
|
|
RETVAL = newSVcfapi (type, cf_object_get_property (obj, idx)); |
1073 |
root |
1.6 |
OUTPUT: RETVAL |
1074 |
root |
1.1 |
|
1075 |
root |
1.4 |
SV * |
1076 |
|
|
set_property (object *obj, int type, int idx, SV *newval) |
1077 |
|
|
CODE: |
1078 |
|
|
switch (type) |
1079 |
|
|
{ |
1080 |
|
|
case CFAPI_INT: |
1081 |
|
|
cf_object_set_int_property (obj, idx, SvIV (newval)); |
1082 |
|
|
break; |
1083 |
|
|
case CFAPI_LONG: |
1084 |
|
|
cf_object_set_long_property (obj, idx, SvNV (newval)); |
1085 |
|
|
break; |
1086 |
root |
1.10 |
case CFAPI_DOUBLE: |
1087 |
|
|
{ |
1088 |
|
|
int unused_type; |
1089 |
|
|
object_set_property (&unused_type, obj, idx, (double)SvNV (newval)); |
1090 |
|
|
} |
1091 |
|
|
break; |
1092 |
root |
1.4 |
case CFAPI_STRING: |
1093 |
|
|
cf_object_set_string_property (obj, idx, SvPV_nolen (newval)); |
1094 |
|
|
break; |
1095 |
|
|
default: |
1096 |
|
|
croak ("unhandled type '%d' in set_property '%d'", type, idx); |
1097 |
|
|
} |
1098 |
|
|
|
1099 |
root |
1.1 |
int cf_object_get_resistance (object *op, int rtype) |
1100 |
root |
1.2 |
ALIAS: resistance = 0 |
1101 |
root |
1.1 |
|
1102 |
|
|
int cf_object_get_flag (object *op, int flag) |
1103 |
|
|
ALIAS: flag = 0 |
1104 |
|
|
|
1105 |
|
|
void cf_object_set_flag (object *op, int flag, int value) |
1106 |
|
|
|
1107 |
|
|
void cf_object_move (object *op, object *originator, int dir) |
1108 |
|
|
|
1109 |
|
|
void cf_object_apply (object *op, object *author, int flags) |
1110 |
|
|
|
1111 |
|
|
void cf_object_apply_below (object *op) |
1112 |
|
|
|
1113 |
|
|
void cf_object_remove (object *op) |
1114 |
|
|
|
1115 |
|
|
void cf_object_free (object *op) |
1116 |
|
|
|
1117 |
|
|
object *cf_object_present_archname_inside (object *op, char *whatstr) |
1118 |
|
|
|
1119 |
|
|
int cf_object_transfer (object *op, int x, int y, int r, object *orig) |
1120 |
|
|
|
1121 |
|
|
int cf_object_change_map (object *op, int x, int y, mapstruct *map) |
1122 |
|
|
|
1123 |
|
|
object *cf_object_clone (object *op, int clonetype) |
1124 |
|
|
|
1125 |
|
|
int cf_object_pay_item (object *op, object *buyer) |
1126 |
|
|
|
1127 |
|
|
int cf_object_pay_amount (object *op, double amount) |
1128 |
|
|
|
1129 |
|
|
int cf_object_cast_spell (object *caster, object *ctoo, int dir, object *sp_, char *flags) |
1130 |
|
|
|
1131 |
|
|
int cf_object_cast_ability (object *caster, object *ctoo, int dir, object *sp_, char *flags) |
1132 |
|
|
|
1133 |
|
|
void cf_object_learn_spell (object *op, object *sp) |
1134 |
|
|
|
1135 |
|
|
void cf_object_forget_spell (object *op, object *sp) |
1136 |
|
|
|
1137 |
|
|
object *cf_object_check_for_spell (object *op, char *spellname) |
1138 |
|
|
|
1139 |
|
|
int cf_object_query_money (object *op) |
1140 |
root |
1.2 |
ALIAS: money = 0 |
1141 |
root |
1.1 |
|
1142 |
|
|
int cf_object_query_cost (object *op, object *who, int flags) |
1143 |
root |
1.2 |
ALIAS: cost = 0 |
1144 |
root |
1.1 |
|
1145 |
|
|
void cf_object_activate_rune (object *op , object *victim) |
1146 |
|
|
|
1147 |
|
|
int cf_object_check_trigger (object *op, object *cause) |
1148 |
|
|
|
1149 |
|
|
int cf_object_out_of_map (object *op, int x, int y) |
1150 |
|
|
|
1151 |
|
|
void cf_object_drop (object *op, object *author) |
1152 |
|
|
|
1153 |
|
|
void cf_object_take (object *op, object *author) |
1154 |
|
|
|
1155 |
|
|
void cf_object_say (object *op, char *msg) |
1156 |
|
|
|
1157 |
|
|
void cf_object_speak (object *op, char *msg) |
1158 |
|
|
|
1159 |
|
|
object *cf_object_insert_object (object *op, object *container) |
1160 |
|
|
|
1161 |
|
|
const char *cf_object_get_msg (object *ob) |
1162 |
root |
1.2 |
ALIAS: msg = 0 |
1163 |
root |
1.1 |
|
1164 |
|
|
object *cf_object_insert_in_ob (object *ob, object *where) |
1165 |
|
|
|
1166 |
|
|
int cf_object_teleport (object *op, mapstruct *map, int x, int y) |
1167 |
|
|
|
1168 |
|
|
void cf_object_update (object *op, int flags) |
1169 |
|
|
|
1170 |
|
|
void cf_object_pickup (object *op, object *what) |
1171 |
|
|
|
1172 |
|
|
char *cf_object_get_key (object *op, char *keyname) |
1173 |
root |
1.2 |
ALIAS: key = 0 |
1174 |
root |
1.1 |
|
1175 |
|
|
void cf_object_set_key (object *op, char *keyname, char *value) |
1176 |
|
|
|
1177 |
|
|
char * |
1178 |
|
|
base_name (object *ob, int plural) |
1179 |
|
|
CODE: |
1180 |
|
|
RETVAL = cf_query_base_name (ob, plural); |
1181 |
root |
1.6 |
OUTPUT: RETVAL |
1182 |
root |
1.1 |
|
1183 |
|
|
MODULE = cf PACKAGE = cf::object PREFIX = cf_object_ |
1184 |
|
|
|
1185 |
root |
1.8 |
object *cf_create_object_by_name (const char *name = 0) |
1186 |
|
|
PROTOTYPE: ;$ |
1187 |
|
|
ALIAS: |
1188 |
|
|
create_object = 0 |
1189 |
|
|
new = 0 |
1190 |
|
|
CODE: |
1191 |
|
|
RETVAL = name ? cf_create_object_by_name (name) : cf_create_object (); |
1192 |
|
|
OUTPUT: |
1193 |
|
|
RETVAL |
1194 |
root |
1.1 |
|
1195 |
|
|
void cf_fix_object (object *pl) |
1196 |
root |
1.8 |
ALIAS: fix = 0 |
1197 |
root |
1.1 |
|
1198 |
|
|
object *cf_insert_ob_in_ob (object *ob, object *where) |
1199 |
|
|
|
1200 |
|
|
|
1201 |
|
|
MODULE = cf PACKAGE = cf::object::player PREFIX = cf_player_ |
1202 |
|
|
|
1203 |
|
|
player *player (object *op) |
1204 |
|
|
CODE: |
1205 |
|
|
RETVAL = cf_player_find (cf_query_name (op)); |
1206 |
root |
1.6 |
OUTPUT: RETVAL |
1207 |
root |
1.1 |
|
1208 |
root |
1.6 |
void cf_player_message (object *obj, char *txt, int flags = NDI_ORANGE | NDI_UNIQUE) |
1209 |
root |
1.1 |
|
1210 |
|
|
object *cf_player_send_inventory (object *op) |
1211 |
|
|
|
1212 |
root |
1.6 |
char *cf_player_get_ip (object *op) |
1213 |
|
|
ALIAS: ip = 0 |
1214 |
|
|
|
1215 |
|
|
object *cf_player_get_marked_item (object *op) |
1216 |
|
|
ALIAS: marked_item = 0 |
1217 |
root |
1.1 |
|
1218 |
root |
1.6 |
void cf_player_set_marked_item (object *op, object *ob) |
1219 |
|
|
|
1220 |
|
|
partylist *cf_player_get_party (object *op) |
1221 |
|
|
ALIAS: party = 0 |
1222 |
|
|
|
1223 |
|
|
void cf_player_set_party (object *op, partylist *party) |
1224 |
root |
1.1 |
|
1225 |
|
|
|
1226 |
root |
1.4 |
MODULE = cf PACKAGE = cf::object::map PREFIX = cf_ |
1227 |
root |
1.1 |
|
1228 |
root |
1.6 |
MODULE = cf PACKAGE = cf::player PREFIX = cf_player_ |
1229 |
root |
1.1 |
|
1230 |
|
|
player *cf_player_find (char *name) |
1231 |
root |
1.6 |
PROTOTYPE: $ |
1232 |
root |
1.1 |
|
1233 |
|
|
void cf_player_move (player *pl, int dir) |
1234 |
|
|
|
1235 |
root |
1.6 |
# nonstandard |
1236 |
|
|
object *ob (player *pl) |
1237 |
|
|
CODE: |
1238 |
|
|
RETVAL = pl->ob; |
1239 |
|
|
OUTPUT: RETVAL |
1240 |
root |
1.1 |
|
1241 |
root |
1.6 |
|
1242 |
|
|
MODULE = cf PACKAGE = cf::map PREFIX = cf_map_ |
1243 |
root |
1.1 |
|
1244 |
|
|
SV * |
1245 |
|
|
get_property (mapstruct *obj, int type, int idx) |
1246 |
|
|
CODE: |
1247 |
|
|
RETVAL = newSVcfapi (type, cf_map_get_property (obj, idx)); |
1248 |
root |
1.6 |
OUTPUT: RETVAL |
1249 |
root |
1.1 |
|
1250 |
root |
1.4 |
SV * |
1251 |
|
|
set_property (mapstruct *obj, int type, int idx, SV *newval) |
1252 |
|
|
CODE: |
1253 |
|
|
switch (type) |
1254 |
|
|
{ |
1255 |
|
|
case CFAPI_INT: |
1256 |
|
|
cf_map_set_int_property (obj, idx, SvIV (newval)); |
1257 |
|
|
break; |
1258 |
|
|
default: |
1259 |
|
|
croak ("unhandled type '%d' in set_property '%d'", type, idx); |
1260 |
|
|
} |
1261 |
|
|
|
1262 |
root |
1.11 |
mapstruct *new (int width, int height) |
1263 |
|
|
PROTOTYPE: |
1264 |
|
|
CODE: |
1265 |
|
|
{ |
1266 |
|
|
int unused_type; |
1267 |
|
|
RETVAL = map_get_map (&unused_type, 0, width, height); |
1268 |
|
|
} |
1269 |
|
|
OUTPUT: |
1270 |
|
|
RETVAL |
1271 |
|
|
|
1272 |
root |
1.4 |
mapstruct *cf_map_get_map (char *name) |
1273 |
root |
1.6 |
PROTOTYPE: $ |
1274 |
root |
1.4 |
ALIAS: map = 0 |
1275 |
|
|
|
1276 |
|
|
mapstruct *cf_map_get_first () |
1277 |
root |
1.6 |
PROTOTYPE: |
1278 |
root |
1.4 |
ALIAS: first = 0 |
1279 |
|
|
|
1280 |
|
|
object *cf_map_insert_object_there (mapstruct *where, object *op, object *originator, int flags) |
1281 |
|
|
|
1282 |
|
|
object *cf_map_insert_object (mapstruct *where, object* op, int x, int y) |
1283 |
|
|
|
1284 |
|
|
object* cf_map_present_arch_by_name (mapstruct *map, const char* str, int nx, int ny) |
1285 |
|
|
C_ARGS: str, map, nx, ny |
1286 |
|
|
|
1287 |
|
|
#int cf_map_get_flags (mapstruct* map, mapstruct** nmap, I16 x, I16 y, I16 *nx, I16 *ny) |
1288 |
|
|
|
1289 |
root |
1.11 |
SV *at (mapstruct *obj, unsigned int x, unsigned int y) |
1290 |
|
|
PROTOTYPE: $$$ |
1291 |
|
|
INIT: |
1292 |
|
|
if (x >= MAP_WIDTH (obj) || y >= MAP_HEIGHT (obj)) XSRETURN_UNDEF; |
1293 |
|
|
PPCODE: |
1294 |
|
|
{ |
1295 |
|
|
object *o; |
1296 |
|
|
for (o = GET_MAP_OB (obj, x, y); o; o = o->above) |
1297 |
|
|
XPUSHs (newSVcfapi (CFAPI_POBJECT, o)); |
1298 |
|
|
} |
1299 |
|
|
|
1300 |
|
|
SV *bot_at (mapstruct *obj, unsigned int x, unsigned int y) |
1301 |
|
|
PROTOTYPE: $$$ |
1302 |
|
|
ALIAS: |
1303 |
|
|
top_at = 1 |
1304 |
|
|
flags_at = 2 |
1305 |
|
|
light_at = 3 |
1306 |
|
|
move_block_at = 4 |
1307 |
|
|
move_slow_at = 5 |
1308 |
|
|
move_on_at = 6 |
1309 |
|
|
move_off_at = 7 |
1310 |
|
|
INIT: |
1311 |
|
|
if (x >= MAP_WIDTH (obj) || y >= MAP_HEIGHT (obj)) XSRETURN_UNDEF; |
1312 |
|
|
CODE: |
1313 |
|
|
switch (ix) |
1314 |
|
|
{ |
1315 |
|
|
case 0: RETVAL = newSVcfapi (CFAPI_POBJECT, GET_MAP_OB (obj, x, y)); break; |
1316 |
|
|
case 1: RETVAL = newSVcfapi (CFAPI_POBJECT, GET_MAP_TOP (obj, x, y)); break; |
1317 |
|
|
case 2: RETVAL = newSVuv ( GET_MAP_FLAGS (obj, x, y)); break; |
1318 |
|
|
case 3: RETVAL = newSViv ( GET_MAP_LIGHT (obj, x, y)); break; |
1319 |
|
|
case 4: RETVAL = newSVuv ( GET_MAP_MOVE_BLOCK (obj, x, y)); break; |
1320 |
|
|
case 5: RETVAL = newSVuv ( GET_MAP_MOVE_SLOW (obj, x, y)); break; |
1321 |
|
|
case 6: RETVAL = newSVuv ( GET_MAP_MOVE_ON (obj, x, y)); break; |
1322 |
|
|
case 7: RETVAL = newSVuv ( GET_MAP_MOVE_OFF (obj, x, y)); break; |
1323 |
|
|
} |
1324 |
|
|
OUTPUT: |
1325 |
|
|
RETVAL |
1326 |
root |
1.4 |
|
1327 |
root |
1.1 |
|
1328 |
|
|
MODULE = cf PACKAGE = cf::arch PREFIX = cf_archetype_ |
1329 |
|
|
|
1330 |
|
|
archetype*cf_archetype_get_first() |
1331 |
root |
1.6 |
PROTOTYPE: |
1332 |
root |
1.2 |
ALIAS: first = 0 |
1333 |
root |
1.1 |
|
1334 |
root |
1.2 |
archetype *cf_archetype_get_next (archetype *arch) |
1335 |
|
|
ALIAS: next = 0 |
1336 |
root |
1.1 |
|
1337 |
root |
1.2 |
archetype *cf_archetype_get_head (archetype *arch) |
1338 |
|
|
ALIAS: head = 0 |
1339 |
root |
1.1 |
|
1340 |
|
|
archetype *cf_archetype_get_more (archetype *arch) |
1341 |
root |
1.2 |
ALIAS: more = 0 |
1342 |
root |
1.1 |
|
1343 |
root |
1.2 |
const char *cf_archetype_get_name (archetype *arch) |
1344 |
|
|
ALIAS: name = 0 |
1345 |
root |
1.1 |
|
1346 |
|
|
MODULE = cf PACKAGE = cf::party PREFIX = cf_party_ |
1347 |
|
|
|
1348 |
|
|
partylist *cf_party_get_first () |
1349 |
root |
1.6 |
PROTOTYPE: |
1350 |
root |
1.1 |
ALIAS: first = 0 |
1351 |
|
|
|
1352 |
|
|
partylist *cf_party_get_next (partylist *party) |
1353 |
|
|
ALIAS: next = 0 |
1354 |
|
|
|
1355 |
root |
1.6 |
const char *cf_party_get_name (partylist *party) |
1356 |
|
|
|
1357 |
root |
1.1 |
const char *cf_party_get_password (partylist *party) |
1358 |
|
|
ALIAS: password = 0 |
1359 |
|
|
|
1360 |
|
|
player *cf_party_get_first_player (partylist *party) |
1361 |
|
|
ALIAS: first_player = 0 |
1362 |
|
|
|
1363 |
|
|
player *cf_party_get_next_player (partylist *party, player *op) |
1364 |
|
|
ALIAS: next_player = 0 |
1365 |
|
|
|
1366 |
|
|
|
1367 |
|
|
MODULE = cf PACKAGE = cf::region PREFIX = cf_region_ |
1368 |
|
|
|
1369 |
|
|
region *cf_region_get_first () |
1370 |
root |
1.6 |
PROTOTYPE: |
1371 |
root |
1.1 |
ALIAS: first = 0 |
1372 |
|
|
|
1373 |
|
|
const char *cf_region_get_name (region *reg) |
1374 |
|
|
ALIAS: name = 0 |
1375 |
|
|
|
1376 |
|
|
region *cf_region_get_next (region *reg) |
1377 |
|
|
ALIAS: next = 0 |
1378 |
|
|
|
1379 |
|
|
region *cf_region_get_parent (region *reg) |
1380 |
|
|
ALIAS: parent = 0 |
1381 |
|
|
|
1382 |
|
|
const char *cf_region_get_longname (region *reg) |
1383 |
|
|
ALIAS: longname = 0 |
1384 |
|
|
|
1385 |
|
|
const char *cf_region_get_message (region *reg) |
1386 |
|
|
ALIAS: message = 0 |
1387 |
|
|
|
1388 |
|
|
|