despite rather general name, used exclusively for hero's starting pet */
| 216 | |
| 217 | /* despite rather general name, used exclusively for hero's starting pet */ |
| 218 | struct monst * |
| 219 | makedog(void) |
| 220 | { |
| 221 | struct monst *mtmp; |
| 222 | const char *petname; |
| 223 | int pettype; |
| 224 | |
| 225 | if (gp.preferred_pet == 'n') { |
| 226 | /* static init yields 0 (PM_GIANT_ANT); fix that up now */ |
| 227 | svc.context.startingpet_typ = NON_PM; |
| 228 | return ((struct monst *) 0); |
| 229 | } |
| 230 | |
| 231 | pettype = svc.context.startingpet_typ = pet_type(); |
| 232 | petname = (pettype == PM_LITTLE_DOG) ? gd.dogname |
| 233 | : (pettype == PM_KITTEN) ? gc.catname |
| 234 | : (pettype == PM_PONY) ? gh.horsename |
| 235 | : ""; |
| 236 | |
| 237 | /* default pet names */ |
| 238 | if (!*petname && pettype == PM_LITTLE_DOG) { |
| 239 | /* All of these names were for dogs. */ |
| 240 | if (Role_if(PM_CAVE_DWELLER)) |
| 241 | petname = "Slasher"; /* The Warrior */ |
| 242 | if (Role_if(PM_SAMURAI)) |
| 243 | petname = "Hachi"; /* Shibuya Station */ |
| 244 | if (Role_if(PM_BARBARIAN)) |
| 245 | petname = "Idefix"; /* Obelix */ |
| 246 | if (Role_if(PM_RANGER)) |
| 247 | petname = "Sirius"; /* Orion's dog */ |
| 248 | } |
| 249 | |
| 250 | /* specifying NO_MINVENT prevents makemon() from having a 1% chance |
| 251 | of creating a pony with an already worn saddle; dogs and cats |
| 252 | aren't affected because they don't have any initial inventory |
| 253 | [if anybody adds stranger pets that are expected to have such, |
| 254 | they'll need to modify this] */ |
| 255 | mtmp = makemon(&mons[pettype], u.ux, u.uy, MM_EDOG | NO_MINVENT); |
| 256 | |
| 257 | if (!mtmp) |
| 258 | return ((struct monst *) 0); /* pets were genocided [how?] */ |
| 259 | |
| 260 | if (!svc.context.startingpet_mid) { |
| 261 | svc.context.startingpet_mid = mtmp->m_id; |
| 262 | if (!u.uroleplay.pauper) { |
| 263 | /* initial horses start wearing a saddle (pauper hero excluded) */ |
| 264 | if (pettype == PM_PONY) { |
| 265 | /* NULL obj arg means put_saddle_on_mon() |
| 266 | * will carry out the saddle creation */ |
| 267 | put_saddle_on_mon((struct obj *) 0, mtmp); |
| 268 | } |
| 269 | } |
| 270 | /* starting pet's type has been seen up close (unless PermaBlind) |
| 271 | and for tourist treat it as having already been photographed */ |
| 272 | gb.bhitpos.x = mtmp->mx, gb.bhitpos.y = mtmp->my; |
| 273 | gn.notonhead = FALSE; |
| 274 | see_monster_closeup(mtmp, carrying(EXPENSIVE_CAMERA) ? TRUE : FALSE); |
| 275 | } else { |
no test coverage detected