… | |
… | |
1039 | * it'll paralyze the victim for hp*his speed/op->speed |
1039 | * it'll paralyze the victim for hp*his speed/op->speed |
1040 | */ |
1040 | */ |
1041 | void |
1041 | void |
1042 | move_player_mover (object *op) |
1042 | move_player_mover (object *op) |
1043 | { |
1043 | { |
1044 | object *victim, *nextmover; |
|
|
1045 | int dir = op->stats.sp; |
1044 | int dir = op->stats.sp; |
1046 | sint16 nx, ny; |
1045 | sint16 nx, ny; |
1047 | maptile *m; |
1046 | maptile *m; |
1048 | |
1047 | |
1049 | /* Determine direction now for random movers so we do the right thing */ |
1048 | /* Determine direction now for random movers so we do the right thing */ |
1050 | if (!dir) |
1049 | if (!dir) |
1051 | dir = rndm (1, 8); |
1050 | dir = rndm (1, 8); |
1052 | |
1051 | |
1053 | for (victim = GET_MAP_OB (op->map, op->x, op->y); victim != NULL; victim = victim->above) |
1052 | for (object *victim = op->ms ().bot; victim; victim = victim->above) |
1054 | { |
1053 | { |
1055 | if (QUERY_FLAG (victim, FLAG_ALIVE) && !QUERY_FLAG (victim, FLAG_WIZPASS) && |
1054 | if (QUERY_FLAG (victim, FLAG_ALIVE) && !QUERY_FLAG (victim, FLAG_WIZPASS) && |
1056 | (victim->move_type & op->move_type || !victim->move_type)) |
1055 | (victim->move_type & op->move_type || !victim->move_type)) |
1057 | { |
1056 | { |
1058 | |
1057 | |
… | |
… | |
1075 | } |
1074 | } |
1076 | |
1075 | |
1077 | if (should_director_abort (op, victim)) |
1076 | if (should_director_abort (op, victim)) |
1078 | return; |
1077 | return; |
1079 | |
1078 | |
1080 | for (nextmover = GET_MAP_OB (m, nx, ny); nextmover != NULL; nextmover = nextmover->above) |
1079 | for (object *nextmover = m->at (nx, ny).bot; nextmover; nextmover = nextmover->above) |
1081 | { |
1080 | { |
1082 | if (nextmover->type == PLAYERMOVER) |
1081 | if (nextmover->type == PLAYERMOVER) |
1083 | nextmover->speed_left = -.99; |
1082 | nextmover->speed_left = -.99f; |
|
|
1083 | |
1084 | if (QUERY_FLAG (nextmover, FLAG_ALIVE)) |
1084 | if (QUERY_FLAG (nextmover, FLAG_ALIVE)) |
1085 | { |
|
|
1086 | op->speed_left = -1.1; /* wait until the next thing gets out of the way */ |
1085 | op->speed_left = -1.1f; /* wait until the next thing gets out of the way */ |
1087 | } |
|
|
1088 | } |
1086 | } |
1089 | |
1087 | |
1090 | if (victim->type == PLAYER) |
1088 | if (victim->type == PLAYER) |
1091 | { |
1089 | { |
1092 | /* only level >=1 movers move people */ |
1090 | /* only level >=1 movers move people */ |
… | |
… | |
1096 | * is cleared, otherwise the player will get stuck in |
1094 | * is cleared, otherwise the player will get stuck in |
1097 | * place. This can happen if the player used a spell to |
1095 | * place. This can happen if the player used a spell to |
1098 | * get to this space. |
1096 | * get to this space. |
1099 | */ |
1097 | */ |
1100 | victim->contr->fire_on = 0; |
1098 | victim->contr->fire_on = 0; |
1101 | victim->speed_left = -FABS (victim->speed); |
1099 | victim->speed_left = 0.f; |
1102 | move_player (victim, dir); |
1100 | move_player (victim, dir); |
1103 | } |
1101 | } |
1104 | else |
1102 | else |
1105 | return; |
1103 | return; |
1106 | } |
1104 | } |
… | |
… | |
1110 | if (!op->stats.maxsp && op->attacktype) |
1108 | if (!op->stats.maxsp && op->attacktype) |
1111 | op->stats.maxsp = 2; |
1109 | op->stats.maxsp = 2; |
1112 | |
1110 | |
1113 | if (op->attacktype) |
1111 | if (op->attacktype) |
1114 | { /* flag to paralyze the player */ |
1112 | { /* flag to paralyze the player */ |
1115 | |
|
|
1116 | victim->speed_left = -FABS (op->stats.maxsp * victim->speed / op->speed); |
1113 | victim->speed_left = max (-5.f, -FABS (op->stats.maxsp * victim->speed / op->speed)); |
1117 | /* Not sure why, but for some chars on metalforge, they |
|
|
1118 | * would sometimes get -inf speed_left, and from the |
|
|
1119 | * description, it could only happen here, so just put |
|
|
1120 | * a lower sanity limit. My only guess is that the |
|
|
1121 | * mover has 0 speed. |
|
|
1122 | */ |
|
|
1123 | if (victim->speed_left < -5.f) |
|
|
1124 | victim->speed_left = -5.f; |
|
|
1125 | } |
1114 | } |
1126 | } |
1115 | } |
1127 | } |
1116 | } |
1128 | } |
1117 | } |
1129 | |
1118 | |