… | |
… | |
16 | |
16 | |
17 | You should have received a copy of the GNU General Public License |
17 | You should have received a copy of the GNU General Public License |
18 | along with this program; if not, write to the Free Software |
18 | along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | |
20 | |
21 | The author can be reached via e-mail to crossfire-devel@real-time.com |
21 | The author can be reached via e-mail to <crossfire@schmorp.de> |
22 | */ |
22 | */ |
23 | |
23 | |
24 | #include <global.h> |
24 | #include <global.h> |
25 | #ifndef WIN32 /* ---win32 remove headers */ |
25 | #ifndef WIN32 /* ---win32 remove headers */ |
26 | # include <pwd.h> |
26 | # include <pwd.h> |
… | |
… | |
279 | p->peaceful = 1; /* default peaceful */ |
279 | p->peaceful = 1; /* default peaceful */ |
280 | p->do_los = 1; |
280 | p->do_los = 1; |
281 | p->explore = 0; |
281 | p->explore = 0; |
282 | p->no_shout = 0; /* default can shout */ |
282 | p->no_shout = 0; /* default can shout */ |
283 | |
283 | |
284 | strncpy (p->title, op->arch->clone.name, sizeof (p->title) - 1); |
284 | assign (p->title, op->arch->clone.name); |
285 | p->title[sizeof (p->title) - 1] = '\0'; |
|
|
286 | op->race = op->arch->clone.race; |
285 | op->race = op->arch->clone.race; |
287 | |
286 | |
288 | CLEAR_FLAG (op, FLAG_READY_SKILL); |
287 | CLEAR_FLAG (op, FLAG_READY_SKILL); |
289 | |
288 | |
290 | /* we need to clear these to -1 and not zero - otherwise, |
289 | /* we need to clear these to -1 and not zero - otherwise, |
… | |
… | |
1134 | op->name = op->name_pl = name; |
1133 | op->name = op->name_pl = name; |
1135 | op->x = x; |
1134 | op->x = x; |
1136 | op->y = y; |
1135 | op->y = y; |
1137 | SET_ANIMATION (op, 2); /* So player faces south */ |
1136 | SET_ANIMATION (op, 2); /* So player faces south */ |
1138 | insert_ob_in_map (op, op->map, op, 0); |
1137 | insert_ob_in_map (op, op->map, op, 0); |
1139 | strncpy (op->contr->title, op->arch->clone.name, sizeof (op->contr->title) - 1); |
1138 | assign (op->contr->title, op->arch->clone.name); |
1140 | op->contr->title[sizeof (op->contr->title) - 1] = '\0'; |
|
|
1141 | add_statbonus (op); |
1139 | add_statbonus (op); |
1142 | tmp_loop = allowed_class (op); |
1140 | tmp_loop = allowed_class (op); |
1143 | } |
1141 | } |
1144 | |
1142 | |
1145 | update_object (op, UP_OBJ_FACE); |
1143 | update_object (op, UP_OBJ_FACE); |
1146 | esrv_update_item (UPD_FACE, op, op); |
1144 | esrv_update_item (UPD_FACE, op, op); |
1147 | fix_player (op); |
1145 | fix_player (op); |
1148 | op->stats.hp = op->stats.maxhp; |
1146 | op->stats.hp = op->stats.maxhp; |
1149 | op->stats.sp = op->stats.maxsp; |
1147 | op->stats.sp = op->stats.maxsp; |
1150 | op->stats.grace = 0; |
1148 | op->stats.grace = 0; |
|
|
1149 | |
1151 | if (op->msg) |
1150 | if (op->msg) |
1152 | new_draw_info (NDI_BLUE, 0, op, op->msg); |
1151 | new_draw_info (NDI_BLUE, 0, op, op->msg); |
|
|
1152 | |
1153 | send_query (&op->contr->socket, CS_QUERY_SINGLECHAR, "Press any key for the next race.\nPress `d' to play this race.\n"); |
1153 | send_query (&op->contr->socket, CS_QUERY_SINGLECHAR, "Press any key for the next race.\nPress `d' to play this race.\n"); |
1154 | return 0; |
1154 | return 0; |
1155 | } |
1155 | } |
1156 | |
1156 | |
1157 | int |
1157 | int |
… | |
… | |
2977 | { |
2977 | { |
2978 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, op, "You have been defeated in combat!"); |
2978 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, op, "You have been defeated in combat!"); |
2979 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, op, "Local medics have saved your life..."); |
2979 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, op, "Local medics have saved your life..."); |
2980 | |
2980 | |
2981 | /* restore player */ |
2981 | /* restore player */ |
2982 | at = find_archetype ("poisoning"); |
2982 | at = archetype::find ("poisoning"); |
2983 | tmp = present_arch_in_ob (at, op); |
2983 | tmp = present_arch_in_ob (at, op); |
2984 | if (tmp) |
2984 | if (tmp) |
2985 | { |
2985 | { |
2986 | remove_ob (tmp); |
2986 | remove_ob (tmp); |
2987 | free_object (tmp); |
2987 | free_object (tmp); |
2988 | new_draw_info (NDI_UNIQUE, 0, op, "Your body feels cleansed"); |
2988 | new_draw_info (NDI_UNIQUE, 0, op, "Your body feels cleansed"); |
2989 | } |
2989 | } |
2990 | |
2990 | |
2991 | at = find_archetype ("confusion"); |
2991 | at = archetype::find ("confusion"); |
2992 | tmp = present_arch_in_ob (at, op); |
2992 | tmp = present_arch_in_ob (at, op); |
2993 | if (tmp) |
2993 | if (tmp) |
2994 | { |
2994 | { |
2995 | remove_ob (tmp); |
2995 | remove_ob (tmp); |
2996 | free_object (tmp); |
2996 | free_object (tmp); |
… | |
… | |
3001 | op->stats.hp = op->stats.maxhp; |
3001 | op->stats.hp = op->stats.maxhp; |
3002 | if (op->stats.food <= 0) |
3002 | if (op->stats.food <= 0) |
3003 | op->stats.food = 999; |
3003 | op->stats.food = 999; |
3004 | |
3004 | |
3005 | /* create a bodypart-trophy to make the winner happy */ |
3005 | /* create a bodypart-trophy to make the winner happy */ |
3006 | tmp = arch_to_object (find_archetype ("finger")); |
3006 | tmp = arch_to_object (archetype::find ("finger")); |
3007 | if (tmp != NULL) |
3007 | if (tmp != NULL) |
3008 | { |
3008 | { |
3009 | sprintf (buf, "%s's finger", &op->name); |
3009 | sprintf (buf, "%s's finger", &op->name); |
3010 | tmp->name = buf; |
3010 | tmp->name = buf; |
3011 | sprintf (buf, " This finger has been cut off %s\n" |
3011 | sprintf (buf, " This finger has been cut off %s\n" |
… | |
… | |
3108 | lost_a_stat = 1; |
3108 | lost_a_stat = 1; |
3109 | } |
3109 | } |
3110 | else |
3110 | else |
3111 | { |
3111 | { |
3112 | /* deplete a stat */ |
3112 | /* deplete a stat */ |
3113 | archetype *deparch = find_archetype ("depletion"); |
3113 | archetype *deparch = archetype::find ("depletion"); |
3114 | object *dep; |
3114 | object *dep; |
3115 | |
3115 | |
3116 | dep = present_arch_in_ob (deparch, op); |
3116 | dep = present_arch_in_ob (deparch, op); |
3117 | if (!dep) |
3117 | if (!dep) |
3118 | { |
3118 | { |
… | |
… | |
3188 | new_draw_info (NDI_UNIQUE, 0, op, "For a brief moment you" " feel a holy presence protecting you from losing yourself completely."); |
3188 | new_draw_info (NDI_UNIQUE, 0, op, "For a brief moment you" " feel a holy presence protecting you from losing yourself completely."); |
3189 | |
3189 | |
3190 | /* Put a gravestone up where the character 'almost' died. List the |
3190 | /* Put a gravestone up where the character 'almost' died. List the |
3191 | * exp loss on the stone. |
3191 | * exp loss on the stone. |
3192 | */ |
3192 | */ |
3193 | tmp = arch_to_object (find_archetype ("gravestone")); |
3193 | tmp = arch_to_object (archetype::find ("gravestone")); |
3194 | sprintf (buf, "%s's gravestone", &op->name); |
3194 | sprintf (buf, "%s's gravestone", &op->name); |
3195 | tmp->name = buf; |
3195 | tmp->name = buf; |
3196 | sprintf (buf, "%s's gravestones", &op->name); |
3196 | sprintf (buf, "%s's gravestones", &op->name); |
3197 | tmp->name_pl = buf; |
3197 | tmp->name_pl = buf; |
3198 | sprintf (buf, "RIP\nHere rests the hero %s the %s,\n" "who was killed\n" "by %s.\n", &op->name, op->contr->title, op->contr->killer); |
3198 | sprintf (buf, "RIP\nHere rests the hero %s the %s,\n" "who was killed\n" "by %s.\n", &op->name, op->contr->title, op->contr->killer); |
… | |
… | |
3209 | |
3209 | |
3210 | /**************************************/ |
3210 | /**************************************/ |
3211 | |
3211 | |
3212 | /* remove any poisoning and confusion the character may be suffering. */ |
3212 | /* remove any poisoning and confusion the character may be suffering. */ |
3213 | /* restore player */ |
3213 | /* restore player */ |
3214 | at = find_archetype ("poisoning"); |
3214 | at = archetype::find ("poisoning"); |
3215 | tmp = present_arch_in_ob (at, op); |
3215 | tmp = present_arch_in_ob (at, op); |
3216 | if (tmp) |
3216 | if (tmp) |
3217 | { |
3217 | { |
3218 | remove_ob (tmp); |
3218 | remove_ob (tmp); |
3219 | free_object (tmp); |
3219 | free_object (tmp); |
3220 | new_draw_info (NDI_UNIQUE, 0, op, "Your body feels cleansed"); |
3220 | new_draw_info (NDI_UNIQUE, 0, op, "Your body feels cleansed"); |
3221 | } |
3221 | } |
3222 | |
3222 | |
3223 | at = find_archetype ("confusion"); |
3223 | at = archetype::find ("confusion"); |
3224 | tmp = present_arch_in_ob (at, op); |
3224 | tmp = present_arch_in_ob (at, op); |
3225 | if (tmp) |
3225 | if (tmp) |
3226 | { |
3226 | { |
3227 | remove_ob (tmp); |
3227 | remove_ob (tmp); |
3228 | free_object (tmp); |
3228 | free_object (tmp); |
… | |
… | |
3350 | } |
3350 | } |
3351 | |
3351 | |
3352 | play_again (op); |
3352 | play_again (op); |
3353 | |
3353 | |
3354 | /* peterm: added to create a corpse at deathsite. */ |
3354 | /* peterm: added to create a corpse at deathsite. */ |
3355 | tmp = arch_to_object (find_archetype ("corpse_pl")); |
3355 | tmp = arch_to_object (archetype::find ("corpse_pl")); |
3356 | sprintf (buf, "%s", &op->name); |
3356 | sprintf (buf, "%s", &op->name); |
3357 | tmp->name = tmp->name_pl = buf; |
3357 | tmp->name = tmp->name_pl = buf; |
3358 | tmp->level = op->level; |
3358 | tmp->level = op->level; |
3359 | tmp->x = x; |
3359 | tmp->x = x; |
3360 | tmp->y = y; |
3360 | tmp->y = y; |