1 | /* |
1 | /* |
2 | * static char *rcsid_time_c = |
2 | * static char *rcsid_time_c = |
3 | * "$Id: time.C,v 1.1 2006/08/13 17:16:05 elmex Exp $"; |
3 | * "$Id: time.C,v 1.5 2006/08/29 07:34:01 root Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
594 | * from maps or inventories), or NULL if was destroyed. |
594 | * from maps or inventories), or NULL if was destroyed. |
595 | */ |
595 | */ |
596 | |
596 | |
597 | static void stop_arrow (object *op) |
597 | static void stop_arrow (object *op) |
598 | { |
598 | { |
599 | /* Lauwenmark: Handle for plugin stop event */ |
599 | if (INVOKE_OBJECT (STOP, op)) |
600 | execute_event(op, EVENT_STOP,NULL,NULL,NULL,SCRIPT_FIX_NOTHING); |
600 | return; |
|
|
601 | |
601 | if (op->inv) { |
602 | if (op->inv) { |
602 | object *payload = op->inv; |
603 | object *payload = op->inv; |
603 | remove_ob (payload); |
604 | remove_ob (payload); |
604 | clear_owner(payload); |
605 | clear_owner(payload); |
605 | insert_ob_in_map (payload, op->map, payload,0); |
606 | insert_ob_in_map (payload, op->map, payload,0); |
… | |
… | |
864 | /* If nothing above us to move, nothing to do */ |
865 | /* If nothing above us to move, nothing to do */ |
865 | if (!tmp || QUERY_FLAG(tmp, FLAG_WIZPASS)) return; |
866 | if (!tmp || QUERY_FLAG(tmp, FLAG_WIZPASS)) return; |
866 | |
867 | |
867 | if(EXIT_PATH(head)) { |
868 | if(EXIT_PATH(head)) { |
868 | if(tmp->type==PLAYER) { |
869 | if(tmp->type==PLAYER) { |
869 | /* Lauwenmark: Handle for plugin TRIGGER event */ |
870 | if (INVOKE_OBJECT (TRIGGER, op, ARG_OBJECT (tmp))) |
870 | if (execute_event(op, EVENT_TRIGGER, tmp, NULL, NULL, SCRIPT_FIX_ALL) != 0) |
|
|
871 | return; |
871 | return; |
|
|
872 | |
872 | enter_exit(tmp, head); |
873 | enter_exit(tmp, head); |
873 | } |
874 | } |
874 | else |
875 | else |
875 | /* Currently only players can transfer maps */ |
876 | /* Currently only players can transfer maps */ |
876 | return; |
877 | return; |
… | |
… | |
880 | LOG(llevError, "Removed illegal teleporter.\n"); |
881 | LOG(llevError, "Removed illegal teleporter.\n"); |
881 | remove_ob(head); |
882 | remove_ob(head); |
882 | free_object(head); |
883 | free_object(head); |
883 | return; |
884 | return; |
884 | } |
885 | } |
885 | /* Lauwenmark: Handle for plugin TRIGGER event */ |
886 | if (INVOKE_OBJECT (TRIGGER, op, ARG_OBJECT (tmp))) |
886 | if (execute_event(op, EVENT_TRIGGER, tmp, NULL, NULL, SCRIPT_FIX_ALL) != 0) |
|
|
887 | return; |
887 | return; |
888 | transfer_ob(tmp,EXIT_X(head),EXIT_Y(head),0,head); |
888 | transfer_ob(tmp,EXIT_X(head),EXIT_Y(head),0,head); |
889 | } |
889 | } |
890 | else { |
890 | else { |
891 | /* Random teleporter */ |
891 | /* Random teleporter */ |
892 | /* Lauwenmark: Handle for plugin TRIGGER event */ |
892 | if (INVOKE_OBJECT (TRIGGER, op, ARG_OBJECT (tmp))) |
893 | if (execute_event(op, EVENT_TRIGGER, tmp, NULL, NULL, SCRIPT_FIX_ALL) != 0) |
|
|
894 | return; |
893 | return; |
895 | teleport(head, TELEPORTER, tmp); |
894 | teleport(head, TELEPORTER, tmp); |
896 | } |
895 | } |
897 | } |
896 | } |
898 | |
897 | |
… | |
… | |
912 | |
911 | |
913 | /* This isn't all that great - means that the player_mover |
912 | /* This isn't all that great - means that the player_mover |
914 | * needs to be on top. |
913 | * needs to be on top. |
915 | */ |
914 | */ |
916 | if(op->above->type==PLAYER) { |
915 | if(op->above->type==PLAYER) { |
917 | /* Lauwenmark: Handle for plugin TRIGGER event */ |
916 | if (INVOKE_OBJECT (TRIGGER, op, ARG_OBJECT (player))) |
918 | if (execute_event(op, EVENT_TRIGGER,op->above,NULL,NULL,SCRIPT_FIX_NOTHING)!=0) |
|
|
919 | return; |
917 | return; |
920 | player=op->above; |
918 | player=op->above; |
921 | for(walk=op->inv;walk!=NULL;walk=walk->below) |
919 | for(walk=op->inv;walk!=NULL;walk=walk->below) |
922 | apply_changes_to_player(player,walk); |
920 | apply_changes_to_player(player,walk); |
923 | |
921 | |
… | |
… | |
1212 | |
1210 | |
1213 | int process_object(object *op) { |
1211 | int process_object(object *op) { |
1214 | if (QUERY_FLAG(op, FLAG_IS_A_TEMPLATE)) |
1212 | if (QUERY_FLAG(op, FLAG_IS_A_TEMPLATE)) |
1215 | return 0; |
1213 | return 0; |
1216 | |
1214 | |
|
|
1215 | if (INVOKE_OBJECT (TICK, op)) |
|
|
1216 | return 0; |
|
|
1217 | |
1217 | if(QUERY_FLAG(op, FLAG_MONSTER)) |
1218 | if(QUERY_FLAG(op, FLAG_MONSTER)) |
1218 | if(move_monster(op) || QUERY_FLAG(op, FLAG_FREED)) |
1219 | if(move_monster(op) || QUERY_FLAG(op, FLAG_FREED)) |
1219 | return 1; |
1220 | return 1; |
1220 | |
1221 | |
1221 | if(QUERY_FLAG(op, FLAG_ANIMATE) && op->anim_speed==0) { |
1222 | if(QUERY_FLAG(op, FLAG_ANIMATE) && op->anim_speed==0) { |
… | |
… | |
1247 | make_sure_not_seen(op); |
1248 | make_sure_not_seen(op); |
1248 | free_object(op); |
1249 | free_object(op); |
1249 | } |
1250 | } |
1250 | return 1; |
1251 | return 1; |
1251 | } |
1252 | } |
1252 | /* Lauwenmark: Handle for plugin time event */ |
|
|
1253 | execute_event(op, EVENT_TIME,NULL,NULL,NULL,SCRIPT_FIX_NOTHING); |
|
|
1254 | switch(op->type) { |
1253 | switch(op->type) { |
1255 | case TRANSPORT: |
|
|
1256 | /* Transports are directed by players - thus, their |
|
|
1257 | * speed is reduced when the player moves them about. |
|
|
1258 | * So give them back there speed here, since process_objects() |
|
|
1259 | * has decremented it. |
|
|
1260 | */ |
|
|
1261 | if (op->speed_left < 0.0) op->speed_left += 1.0; |
|
|
1262 | return 1; |
|
|
1263 | |
1254 | |
1264 | case SPELL_EFFECT: |
1255 | case SPELL_EFFECT: |
1265 | move_spell_effect(op); |
1256 | move_spell_effect(op); |
1266 | return 1; |
1257 | return 1; |
1267 | |
1258 | |