ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/time.C
(Generate patch)

Comparing deliantra/server/server/time.C (file contents):
Revision 1.95 by root, Mon Oct 26 11:31:39 2009 UTC vs.
Revision 1.99 by root, Sat Nov 7 18:30:06 2009 UTC

90 } 90 }
91 91
92 op->drop_and_destroy (); 92 op->drop_and_destroy ();
93} 93}
94 94
95void 95static void
96generate_monster (object *gen) 96generate_monster (object *gen)
97{ 97{
98 if (!gen->map) 98 if (!gen->map)
99 return; 99 return;
100 100
158 } 158 }
159 159
160 op->destroy (); 160 op->destroy ();
161} 161}
162 162
163void 163static void
164remove_force (object *op) 164remove_force (object *op)
165{ 165{
166 if (--op->duration > 0) 166 if (--op->duration > 0)
167 return; 167 return;
168 168
180 } 180 }
181 181
182 op->destroy (); 182 op->destroy ();
183} 183}
184 184
185void 185static void
186remove_blindness (object *op) 186remove_blindness (object *op)
187{ 187{
188 if (--op->stats.food > 0) 188 if (--op->stats.food > 0)
189 return; 189 return;
190 190
197 } 197 }
198 198
199 op->destroy (); 199 op->destroy ();
200} 200}
201 201
202void 202static void
203poison_more (object *op) 203poison_more (object *op)
204{ 204{
205 if (op->env == NULL || !QUERY_FLAG (op->env, FLAG_ALIVE) || op->env->stats.hp < 0) 205 if (op->env == NULL || !QUERY_FLAG (op->env, FLAG_ALIVE) || op->env->stats.hp < 0)
206 { 206 {
207 op->destroy (); 207 op->destroy ();
232 232
233 hit_player (op->env, op->stats.dam, op, AT_INTERNAL, 1); 233 hit_player (op->env, op->stats.dam, op, AT_INTERNAL, 1);
234} 234}
235 235
236 236
237void 237static void
238move_gate (object *op) 238move_gate (object *op)
239{ /* 1 = going down, 0 = going up */ 239{ /* 1 = going down, 0 = going up */
240 object *tmp; 240 object *tmp;
241 241
242 if (op->stats.wc < 0 || (int) op->stats.wc >= NUM_ANIMATIONS (op)) 242 if (op->stats.wc < 0 || (int) op->stats.wc >= NUM_ANIMATIONS (op))
249 if (op->value) 249 if (op->value)
250 { 250 {
251 if (--op->stats.wc <= 0) 251 if (--op->stats.wc <= 0)
252 { /* Reached bottom, let's stop */ 252 { /* Reached bottom, let's stop */
253 op->stats.wc = 0; 253 op->stats.wc = 0;
254 if (op->arch->speed) 254 if (op->arch->has_active_speed ())
255 op->value = 0; 255 op->value = 0;
256 else 256 else
257 op->set_speed (0); 257 op->set_speed (0);
258 } 258 }
259 259
285 if (!QUERY_FLAG (tmp, FLAG_NO_PICK) || QUERY_FLAG (tmp, FLAG_CAN_ROLL) || QUERY_FLAG (tmp, FLAG_ALIVE)) 285 if (!QUERY_FLAG (tmp, FLAG_NO_PICK) || QUERY_FLAG (tmp, FLAG_CAN_ROLL) || QUERY_FLAG (tmp, FLAG_ALIVE))
286 break; 286 break;
287 287
288 if (!tmp) 288 if (!tmp)
289 { 289 {
290 if (op->arch->speed) 290 if (op->arch->has_active_speed ())
291 op->value = 1; 291 op->value = 1;
292 else 292 else
293 op->set_speed (0); 293 op->set_speed (0);
294 294
295 return; 295 return;
376 376
377/* hp : how long door is open/closed 377/* hp : how long door is open/closed
378 * maxhp : initial value for hp 378 * maxhp : initial value for hp
379 * sp : 1 = open, 0 = close 379 * sp : 1 = open, 0 = close
380 */ 380 */
381void 381static void
382move_timed_gate (object *op) 382move_timed_gate (object *op)
383{ 383{
384 int v = op->value; 384 int v = op->value;
385 385
386 if (op->stats.sp) 386 if (op->stats.sp)
405 * speed: frequency of 'glances' 405 * speed: frequency of 'glances'
406 * connected: connected value of detector 406 * connected: connected value of detector
407 * sp: 1 if detection sets buttons 407 * sp: 1 if detection sets buttons
408 * -1 if detection unsets buttons 408 * -1 if detection unsets buttons
409 */ 409 */
410 410static void
411void
412move_detector (object *op) 411move_detector (object *op)
413{ 412{
414 object *tmp; 413 object *tmp;
415 int last = op->value; 414 int last = op->value;
416 int detected; 415 int detected;
483 SET_ANIMATION (op, op->stats.wc); 482 SET_ANIMATION (op, op->stats.wc);
484 update_object (op, UP_OBJ_FACE); 483 update_object (op, UP_OBJ_FACE);
485 } 484 }
486} 485}
487 486
488void 487static void
489move_hole (object *op) 488move_hole (object *op)
490{ /* 1 = opening, 0 = closing */ 489{ /* 1 = opening, 0 = closing */
491 if (op->value) 490 if (op->value)
492 { /* We're opening */ 491 { /* We're opening */
493 if (--op->stats.wc <= 0) 492 if (--op->stats.wc <= 0)
825 824
826 /* Move the arrow. */ 825 /* Move the arrow. */
827 op->move_to (pos); 826 op->move_to (pos);
828} 827}
829 828
830void 829static void
831change_object (object *op) 830change_object (object *op)
832{ /* Doesn`t handle linked objs yet */ 831{ /* Doesn`t handle linked objs yet */
833 int i, j; 832 int i, j;
834 833
835 if (!op->other_arch) 834 if (!op->other_arch)
942/* This object will teleport someone to a different map 941/* This object will teleport someone to a different map
943 and will also apply changes to the player from its inventory. 942 and will also apply changes to the player from its inventory.
944 This was invented for giving classes, but there's no reason it 943 This was invented for giving classes, but there's no reason it
945 can't be generalized. 944 can't be generalized.
946*/ 945*/
947void 946static void
948move_player_changer (object *op) 947move_player_changer (object *op)
949{ 948{
950 object *player;
951 object *walk;
952
953 if (!op->above || !EXIT_PATH (op)) 949 if (!op->above || !EXIT_PATH (op))
954 return; 950 return;
955 951
956 /* This isn't all that great - means that the player_mover 952 /* This isn't all that great - means that the player_mover
957 * needs to be on top. 953 * needs to be on top.
958 */ 954 */
959 if (op->above->type == PLAYER) 955 if (op->above->type == PLAYER)
960 { 956 {
957 object *player = op->above;
958
961 if (INVOKE_OBJECT (TRIGGER, op, ARG_OBJECT (player))) 959 if (INVOKE_OBJECT (TRIGGER, op, ARG_OBJECT (player)))
962 return; 960 return;
963 961
964 player = op->above;
965
966 for (walk = op->inv; walk; walk = walk->below) 962 for (object *walk = op->inv; walk; walk = walk->below)
967 apply_changes_to_player (player, walk); 963 apply_changes_to_player (player, walk);
968 964
969 player->update_stats (); 965 player->update_stats ();
970 966
971 esrv_send_inventory (op->above, op->above); 967 esrv_send_inventory (op->above, op->above);
1018 * moves them in the op->stats.sp direction. speed is how often it'll move. 1014 * moves them in the op->stats.sp direction. speed is how often it'll move.
1019 * If attacktype is nonzero it will paralyze the player. If lifesave is set, 1015 * If attacktype is nonzero it will paralyze the player. If lifesave is set,
1020 * it'll dissapear after hp+1 moves. If hp is set and attacktype is set, 1016 * it'll dissapear after hp+1 moves. If hp is set and attacktype is set,
1021 * it'll paralyze the victim for hp*his speed/op->speed 1017 * it'll paralyze the victim for hp*his speed/op->speed
1022 */ 1018 */
1023void 1019static void
1024move_player_mover (object *op) 1020move_player_mover (object *op)
1025{ 1021{
1026 int dir = op->stats.sp; 1022 int dir = op->stats.sp;
1027 sint16 nx, ny; 1023 sint16 nx, ny;
1028 maptile *m; 1024 maptile *m;
1072 /* only level >=1 movers move people */ 1068 /* only level >=1 movers move people */
1073 if (op->level) 1069 if (op->level)
1074 { 1070 {
1075 /* Following is a bit of hack. We need to make sure it 1071 /* Following is a bit of hack. We need to make sure it
1076 * is cleared, otherwise the player will get stuck in 1072 * is cleared, otherwise the player will get stuck in
1077 * place. This can happen if the player used a spell to 1073 * place. This can happen if the player used a spell to
1078 * get to this space. 1074 * get to this space.
1079 */ 1075 */
1080 victim->contr->fire_on = 0; 1076 victim->contr->fire_on = 0;
1081 victim->speed_left = 1.f; 1077 victim->speed_left = 1.f;
1082 move_player (victim, dir); 1078 move_player (victim, dir);
1090 if (!op->stats.maxsp && op->attacktype) 1086 if (!op->stats.maxsp && op->attacktype)
1091 op->stats.maxsp = 2; 1087 op->stats.maxsp = 2;
1092 1088
1093 if (op->attacktype) 1089 if (op->attacktype)
1094 { /* flag to paralyze the player */ 1090 { /* flag to paralyze the player */
1095 victim->speed_left = max (-5.f, -FABS (op->stats.maxsp * victim->speed / op->speed)); 1091 victim->speed_left = max (-5.f, -fabs (op->stats.maxsp * victim->speed / op->speed));
1096 } 1092 }
1097 } 1093 }
1098 } 1094 }
1099} 1095}
1100 1096
1254 } 1250 }
1255} 1251}
1256 1252
1257// mapscript objects activate themselves (only) then their timer fires 1253// mapscript objects activate themselves (only) then their timer fires
1258// TODO: maybe they should simply trigger the link like any other object? 1254// TODO: maybe they should simply trigger the link like any other object?
1259void 1255static void
1260move_mapscript (object *op) 1256move_mapscript (object *op)
1261{ 1257{
1262 op->set_speed (0); 1258 op->set_speed (0);
1263 cfperl_mapscript_activate (op, true, op, 0); 1259 cfperl_mapscript_activate (op, true, op, 0);
1264} 1260}
1265 1261
1262static void
1266void move_lamp (object *op) 1263move_lamp (object *op)
1267{ 1264{
1268 // if the lamp/torch is off, we should disable it. 1265 // if the lamp/torch is off, we should disable it.
1269 if (!op->glow_radius) 1266 if (!op->glow_radius)
1270 { 1267 {
1271 op->set_speed (0); 1268 op->set_speed (0);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines