… | |
… | |
61 | static f_plug_api cfapiObject_merge = NULL; |
61 | static f_plug_api cfapiObject_merge = NULL; |
62 | static f_plug_api cfapiObject_distance = NULL; |
62 | static f_plug_api cfapiObject_distance = NULL; |
63 | static f_plug_api cfapiObject_update = NULL; |
63 | static f_plug_api cfapiObject_update = NULL; |
64 | static f_plug_api cfapiObject_clear = NULL; |
64 | static f_plug_api cfapiObject_clear = NULL; |
65 | static f_plug_api cfapiObject_reset = NULL; |
65 | static f_plug_api cfapiObject_reset = NULL; |
66 | static f_plug_api cfapiCheck_inventory = NULL; |
66 | /* static f_plug_api cfapiCheck_inventory = NULL; */ |
67 | static f_plug_api cfapiObject_activate_rune = NULL; |
67 | static f_plug_api cfapiObject_activate_rune = NULL; |
68 | static f_plug_api cfapiObject_check_trigger = NULL; |
68 | static f_plug_api cfapiObject_check_trigger = NULL; |
69 | static f_plug_api cfapiObject_query_money = NULL; |
69 | static f_plug_api cfapiObject_query_money = NULL; |
70 | static f_plug_api cfapiObject_query_cost = NULL; |
70 | static f_plug_api cfapiObject_query_cost = NULL; |
71 | static f_plug_api cfapiObject_cast = NULL; |
71 | static f_plug_api cfapiObject_cast = NULL; |
… | |
… | |
180 | GET_HOOK( cfapiRegion_get_property, "cfapi_region_get_property", z ); |
180 | GET_HOOK( cfapiRegion_get_property, "cfapi_region_get_property", z ); |
181 | return 1; |
181 | return 1; |
182 | } |
182 | } |
183 | |
183 | |
184 | /* Should get replaced by tons of more explicit wrappers */ |
184 | /* Should get replaced by tons of more explicit wrappers */ |
185 | void* cf_map_get_property(mapstruct* map, int propcode) |
185 | void* cf_map_get_property(maptile* map, int propcode) |
186 | { |
186 | { |
187 | int val; |
187 | int val; |
188 | return cfapiMap_get_property(&val, propcode, map); |
188 | return cfapiMap_get_property(&val, propcode, map); |
189 | } |
189 | } |
190 | /* Should get replaced by tons of more explicit wrappers */ |
190 | /* Should get replaced by tons of more explicit wrappers */ |
191 | void* cf_map_set_int_property(mapstruct* map, int propcode, int value) |
191 | void* cf_map_set_int_property(maptile* map, int propcode, int value) |
192 | { |
192 | { |
193 | int val; |
193 | int val; |
194 | return cfapiMap_set_property(&val, map, propcode,value); |
194 | return cfapiMap_set_property(&val, map, propcode,value); |
195 | } |
195 | } |
196 | /* Should get replaced by tons of more explicit wrappers */ |
196 | /* Should get replaced by tons of more explicit wrappers */ |
… | |
… | |
266 | { |
266 | { |
267 | int val; |
267 | int val; |
268 | /* return *(int*)cfapiObject_transfer(&val,op,1,x,y,op->map);*/ |
268 | /* return *(int*)cfapiObject_transfer(&val,op,1,x,y,op->map);*/ |
269 | return *(int*)cfapiObject_transfer(&val,op,0,x,y,r,orig); |
269 | return *(int*)cfapiObject_transfer(&val,op,0,x,y,r,orig); |
270 | } |
270 | } |
271 | int cf_object_change_map(object* op, int x, int y, mapstruct* map) |
271 | int cf_object_change_map(object* op, int x, int y, maptile* map) |
272 | { |
272 | { |
273 | int val; |
273 | int val; |
274 | return *(int*)cfapiObject_transfer(&val,op,1,x,y,map); |
274 | return *(int*)cfapiObject_transfer(&val,op,1,x,y,map); |
275 | /*cfapiObject_transfer(&val,op,1,x,y,map); |
275 | /*cfapiObject_transfer(&val,op,1,x,y,map); |
276 | return 0;*/ |
276 | return 0;*/ |
277 | } |
277 | } |
278 | object* cf_map_get_object_at(mapstruct* m, int x, int y) |
278 | object* cf_map_get_object_at(maptile* m, int x, int y) |
279 | { |
279 | { |
280 | int val; |
280 | int val; |
281 | return (object*) cfapiMap_get_object_at(&val, m, x, y); |
281 | return (object*) cfapiMap_get_object_at(&val, m, x, y); |
282 | } |
282 | } |
283 | void cf_map_message(mapstruct* m, char* msg, int color) |
283 | void cf_map_message(maptile* m, char* msg, int color) |
284 | { |
284 | { |
285 | int val; |
285 | int val; |
286 | cfapiMap_message(&val, m, msg, color); |
286 | cfapiMap_message(&val, m, msg, color); |
287 | } |
287 | } |
288 | object* cf_object_clone(object* op, int clonetype) |
288 | object* cf_object_clone(object* op, int clonetype) |
… | |
… | |
361 | { |
361 | { |
362 | int val; |
362 | int val; |
363 | cfapiObject_set_property(&val, op, CFAPI_PLAYER_PROP_PARTY, party); |
363 | cfapiObject_set_property(&val, op, CFAPI_PLAYER_PROP_PARTY, party); |
364 | } |
364 | } |
365 | |
365 | |
366 | mapstruct* cf_map_get_map( char* name ) |
366 | maptile* cf_map_get_map( char* name ) |
367 | { |
367 | { |
368 | int val; |
368 | int val; |
369 | return (mapstruct*) cfapiMap_get_map( &val, 1, name, 0); |
369 | return (maptile*) cfapiMap_get_map( &val, 1, name, 0); |
370 | } |
370 | } |
371 | mapstruct* cf_map_get_first(void) |
371 | maptile* cf_map_get_first(void) |
372 | { |
372 | { |
373 | int val; |
373 | int val; |
374 | return (mapstruct*) cfapiMap_get_map( &val, 3); |
374 | return (maptile*) cfapiMap_get_map( &val, 3); |
375 | } |
375 | } |
376 | int cf_object_query_money( object* op) |
376 | int cf_object_query_money( object* op) |
377 | { |
377 | { |
378 | int val; |
378 | int val; |
379 | return *(int*)cfapiObject_query_money( &val, op); |
379 | return *(int*)cfapiObject_query_money( &val, op); |
… | |
… | |
565 | } |
565 | } |
566 | |
566 | |
567 | return (object*) cfapiObject_insert( &type, ob, 3, where ); |
567 | return (object*) cfapiObject_insert( &type, ob, 3, where ); |
568 | } |
568 | } |
569 | |
569 | |
570 | object* cf_map_insert_object_there(mapstruct* where, object* op, object* originator, int flags) |
570 | object* cf_map_insert_object_there(maptile* where, object* op, object* originator, int flags) |
571 | { |
571 | { |
572 | int val; |
572 | int val; |
573 | return (object*)cfapiObject_insert(&val, op, 1, where, originator, flags); |
573 | return (object*)cfapiObject_insert(&val, op, 1, where, originator, flags); |
574 | } |
574 | } |
575 | object* cf_map_insert_object(mapstruct* where , object* op, int x, int y) |
575 | object* cf_map_insert_object(maptile* where , object* op, int x, int y) |
576 | { |
576 | { |
577 | int type; |
577 | int type; |
578 | return (object*) cfapiObject_insert( &type, op, 0, where, NULL, 0 , x, y); |
578 | return (object*) cfapiObject_insert( &type, op, 0, where, NULL, 0 , x, y); |
579 | } |
579 | } |
580 | int cf_object_teleport( object* op, mapstruct* map, int x, int y ) |
580 | int cf_object_teleport( object* op, maptile* map, int x, int y ) |
581 | { |
581 | { |
582 | int val; |
582 | int val; |
583 | return *( int* )cfapiObject_teleport( &val, op, map, x, y ); |
583 | return *( int* )cfapiObject_teleport( &val, op, map, x, y ); |
584 | } |
584 | } |
585 | object* cf_map_present_arch_by_name(const char* str, mapstruct* map, int nx, int ny) |
585 | object* cf_map_present_arch_by_name(const char* str, maptile* map, int nx, int ny) |
586 | { |
586 | { |
587 | int val; |
587 | int val; |
588 | return (object*)cfapiMap_present_arch_by_name(&val, str,map,nx,ny); |
588 | return (object*)cfapiMap_present_arch_by_name(&val, str,map,nx,ny); |
589 | } |
589 | } |
590 | |
590 | |
591 | static int cf_get_map_int_property(mapstruct* map, int property) |
591 | static int cf_get_map_int_property(maptile* map, int property) |
592 | { |
592 | { |
593 | int type; |
593 | int type; |
594 | void* rv; |
594 | void* rv; |
595 | rv = cfapiMap_get_property(&type, property, map); |
595 | rv = cfapiMap_get_property(&type, property, map); |
596 | if ( !rv || type != CFAPI_INT ) |
596 | if ( !rv || type != CFAPI_INT ) |
597 | return PLUGIN_ERROR_INT; |
597 | return PLUGIN_ERROR_INT; |
598 | return *(int*)rv; |
598 | return *(int*)rv; |
599 | } |
599 | } |
600 | |
600 | |
601 | int cf_map_get_difficulty(mapstruct* map) |
601 | int cf_map_get_difficulty(maptile* map) |
602 | { |
602 | { |
603 | return cf_get_map_int_property(map,CFAPI_MAP_PROP_DIFFICULTY); |
603 | return cf_get_map_int_property(map,CFAPI_MAP_PROP_DIFFICULTY); |
604 | } |
604 | } |
605 | |
605 | |
606 | int cf_map_get_reset_time(mapstruct* map) |
606 | int cf_map_get_reset_time(maptile* map) |
607 | { |
607 | { |
608 | return cf_get_map_int_property(map,CFAPI_MAP_PROP_RESET_TIME); |
608 | return cf_get_map_int_property(map,CFAPI_MAP_PROP_RESET_TIME); |
609 | } |
609 | } |
610 | |
610 | |
611 | int cf_map_get_reset_timeout(mapstruct* map) |
611 | int cf_map_get_reset_timeout(maptile* map) |
612 | { |
612 | { |
613 | return cf_get_map_int_property(map,CFAPI_MAP_PROP_RESET_TIMEOUT); |
613 | return cf_get_map_int_property(map,CFAPI_MAP_PROP_RESET_TIMEOUT); |
614 | } |
614 | } |
615 | |
615 | |
616 | int cf_map_get_players(mapstruct* map) |
616 | int cf_map_get_players(maptile* map) |
617 | { |
617 | { |
618 | return cf_get_map_int_property(map,CFAPI_MAP_PROP_PLAYERS); |
618 | return cf_get_map_int_property(map,CFAPI_MAP_PROP_PLAYERS); |
619 | } |
619 | } |
620 | |
620 | |
621 | int cf_map_get_darkness(mapstruct* map) |
621 | int cf_map_get_darkness(maptile* map) |
622 | { |
622 | { |
623 | return cf_get_map_int_property(map,CFAPI_MAP_PROP_DARKNESS); |
623 | return cf_get_map_int_property(map,CFAPI_MAP_PROP_DARKNESS); |
624 | } |
624 | } |
625 | |
625 | |
626 | int cf_map_get_width(mapstruct* map) |
626 | int cf_map_get_width(maptile* map) |
627 | { |
627 | { |
628 | return cf_get_map_int_property(map,CFAPI_MAP_PROP_WIDTH); |
628 | return cf_get_map_int_property(map,CFAPI_MAP_PROP_WIDTH); |
629 | } |
629 | } |
630 | |
630 | |
631 | int cf_map_get_height(mapstruct* map) |
631 | int cf_map_get_height(maptile* map) |
632 | { |
632 | { |
633 | return cf_get_map_int_property(map,CFAPI_MAP_PROP_HEIGHT); |
633 | return cf_get_map_int_property(map,CFAPI_MAP_PROP_HEIGHT); |
634 | } |
634 | } |
635 | |
635 | |
636 | int cf_map_get_enter_x(mapstruct* map) |
636 | int cf_map_get_enter_x(maptile* map) |
637 | { |
637 | { |
638 | return cf_get_map_int_property(map,CFAPI_MAP_PROP_ENTER_X); |
638 | return cf_get_map_int_property(map,CFAPI_MAP_PROP_ENTER_X); |
639 | } |
639 | } |
640 | |
640 | |
641 | int cf_map_get_enter_y(mapstruct* map) |
641 | int cf_map_get_enter_y(maptile* map) |
642 | { |
642 | { |
643 | return cf_get_map_int_property(map,CFAPI_MAP_PROP_ENTER_Y); |
643 | return cf_get_map_int_property(map,CFAPI_MAP_PROP_ENTER_Y); |
644 | } |
644 | } |
645 | |
645 | |
646 | int cf_map_get_temperature(mapstruct* map) |
646 | int cf_map_get_temperature(maptile* map) |
647 | { |
647 | { |
648 | return cf_get_map_int_property(map,CFAPI_MAP_PROP_TEMPERATURE); |
648 | return cf_get_map_int_property(map,CFAPI_MAP_PROP_TEMPERATURE); |
649 | } |
649 | } |
650 | |
650 | |
651 | int cf_map_get_pressure(mapstruct* map) |
651 | int cf_map_get_pressure(maptile* map) |
652 | { |
652 | { |
653 | return cf_get_map_int_property(map,CFAPI_MAP_PROP_PRESSURE); |
653 | return cf_get_map_int_property(map,CFAPI_MAP_PROP_PRESSURE); |
654 | } |
654 | } |
655 | |
655 | |
656 | int cf_map_get_humidity(mapstruct* map) |
656 | int cf_map_get_humidity(maptile* map) |
657 | { |
657 | { |
658 | return cf_get_map_int_property(map,CFAPI_MAP_PROP_HUMIDITY); |
658 | return cf_get_map_int_property(map,CFAPI_MAP_PROP_HUMIDITY); |
659 | } |
659 | } |
660 | |
660 | |
661 | int cf_map_get_windspeed(mapstruct* map) |
661 | int cf_map_get_windspeed(maptile* map) |
662 | { |
662 | { |
663 | return cf_get_map_int_property(map,CFAPI_MAP_PROP_WINDSPEED); |
663 | return cf_get_map_int_property(map,CFAPI_MAP_PROP_WINDSPEED); |
664 | } |
664 | } |
665 | |
665 | |
666 | int cf_map_get_winddir(mapstruct* map) |
666 | int cf_map_get_winddir(maptile* map) |
667 | { |
667 | { |
668 | return cf_get_map_int_property(map,CFAPI_MAP_PROP_WINDDIR); |
668 | return cf_get_map_int_property(map,CFAPI_MAP_PROP_WINDDIR); |
669 | } |
669 | } |
670 | |
670 | |
671 | int cf_map_get_sky(mapstruct* map) |
671 | int cf_map_get_sky(maptile* map) |
672 | { |
672 | { |
673 | return cf_get_map_int_property(map,CFAPI_MAP_PROP_SKY); |
673 | return cf_get_map_int_property(map,CFAPI_MAP_PROP_SKY); |
674 | } |
674 | } |
675 | |
675 | |
676 | int cf_map_get_wpartx(mapstruct* map) |
676 | int cf_map_get_wpartx(maptile* map) |
677 | { |
677 | { |
678 | return cf_get_map_int_property(map,CFAPI_MAP_PROP_WPARTX); |
678 | return cf_get_map_int_property(map,CFAPI_MAP_PROP_WPARTX); |
679 | } |
679 | } |
680 | |
680 | |
681 | int cf_map_get_wparty(mapstruct* map) |
681 | int cf_map_get_wparty(maptile* map) |
682 | { |
682 | { |
683 | return cf_get_map_int_property(map,CFAPI_MAP_PROP_WPARTY); |
683 | return cf_get_map_int_property(map,CFAPI_MAP_PROP_WPARTY); |
684 | } |
684 | } |
685 | |
685 | |
686 | void cf_object_update( object* op, int flags) |
686 | void cf_object_update( object* op, int flags) |
… | |
… | |
696 | char* cf_strdup_local(char* txt) |
696 | char* cf_strdup_local(char* txt) |
697 | { |
697 | { |
698 | int val; |
698 | int val; |
699 | return (char*)cfapiSystem_strdup_local(&val, txt); |
699 | return (char*)cfapiSystem_strdup_local(&val, txt); |
700 | } |
700 | } |
701 | int cf_map_get_flags( mapstruct* map, mapstruct** nmap, sint16 x, sint16 y, sint16* nx, sint16* ny ) |
701 | int cf_map_get_flags( maptile* map, maptile** nmap, sint16 x, sint16 y, sint16* nx, sint16* ny ) |
702 | { |
702 | { |
703 | int val; |
703 | int val; |
704 | return *( int* )cfapiMap_get_flags(&val, map, nmap, x, y, nx, ny); |
704 | return *( int* )cfapiMap_get_flags(&val, map, nmap, x, y, nx, ny); |
705 | } |
705 | } |
706 | int cf_find_animation(char* txt) |
706 | int cf_find_animation(char* txt) |
… | |
… | |
826 | const char* cf_region_get_message(region* reg) |
826 | const char* cf_region_get_message(region* reg) |
827 | { |
827 | { |
828 | int val; |
828 | int val; |
829 | return (const char*) cfapiRegion_get_property(&val, reg, CFAPI_REGION_PROP_MESSAGE); |
829 | return (const char*) cfapiRegion_get_property(&val, reg, CFAPI_REGION_PROP_MESSAGE); |
830 | } |
830 | } |
831 | |
|
|
832 | #ifdef WIN32 |
|
|
833 | int gettimeofday(struct timeval *time_Info, struct timezone *timezone_Info) |
|
|
834 | { |
|
|
835 | /* Get the time, if they want it */ |
|
|
836 | if (time_Info != NULL) { |
|
|
837 | time_Info->tv_sec = time(NULL); |
|
|
838 | time_Info->tv_usec = timeGetTime()*1000; |
|
|
839 | } |
|
|
840 | /* Get the timezone, if they want it */ |
|
|
841 | if (timezone_Info != NULL) { |
|
|
842 | _tzset(); |
|
|
843 | timezone_Info->tz_minuteswest = _timezone; |
|
|
844 | timezone_Info->tz_dsttime = _daylight; |
|
|
845 | } |
|
|
846 | /* And return */ |
|
|
847 | return 0; |
|
|
848 | } |
|
|
849 | #endif |
|
|