| Alien (BUGFIX 1.7) | Routines |
| Prev: 36187 | Up: Map | Next: 36428 |
|
Recompute the morale (+6) of the crew member whose slot is in NearestCrewC from his courage (+5) plus a term per companion slot in NearestCrewA/B: a live companion adds his own courage - 2 (a brave friend reassures, a coward unnerves); a dead one costs 1 — and a freshly dead body (status 1) is "found": everyone's courage decays, msg #20 fires and the body's status moves to 2 so it is only found once. Standing in one of the rooms in (NearRoomList, the tracker-holder scan at 38903) is worth +1. The sum is clamped to 0 on underflow.
|
||||
| 36283 | XOR A | companion-effect accumulator = 0 | ||
| 36284 | LD (33698),A | |||
| 36287 | LD A,(33695) | A = whose morale to compute | ||
| 36290 | CP 255 | nobody? | ||
| 36292 | RET Z | |||
| 36293 | LD B,A | IX -> that crew member's record | ||
| 36294 | LD IX,29566 | |||
| 36298 | LD DE,8 | |||
| 36301 | ADD IX,DE | |||
| 36303 | DJNZ 36301 | |||
| 36305 | XOR A | dead or removed (+7 nonzero)? | ||
| 36306 | CP (IX+7) | |||
| 36309 | RET NZ | yes: no morale to compute | ||
| 36310 | PUSH IX | |||
| 36312 | LD B,2 | both companion slots: | ||
| 36314 | LD DE,33696 | NearestCrewA, then NearestCrewB | ||
| 36317 | PUSH BC | |||
| 36318 | PUSH DE | |||
| 36319 | LD A,(DE) | A = companion slot (255 = none) | ||
| 36320 | CP 255 | |||
| 36322 | JR Z,36385 | |||
| 36324 | LD IX,29566 | IX -> the companion's record | ||
| 36328 | LD DE,8 | |||
| 36331 | ADD IX,DE | |||
| 36333 | DEC A | |||
| 36334 | JR NZ,36331 | |||
| 36336 | CP (IX+7) | companion alive (status 0)? | ||
| 36339 | JR Z,36372 | yes: courage support | ||
| 36341 | INC A | a freshly dead body (status 1)? | ||
| 36342 | CP (IX+7) | |||
| 36345 | JR NZ,36366 | no (found earlier / removed): just -1 | ||
| 36347 | CALL 36428 | find the body: everyone's courage decays, | ||
| 36350 | POP DE | |||
| 36351 | PUSH DE | |||
| 36352 | LD A,(DE) | H = the body's slot | ||
| 36353 | LD H,A | |||
| 36354 | LD A,(33695) | |||
| 36357 | LD L,A | L = the discovering crew slot | ||
| 36358 | LD A,20 | msg #20 "{actor} finds {target}'s body" | ||
| 36360 | CALL 37176 | |||
| 36363 | INC (IX+7) | status 2: the body is only found once | ||
| 36366 | LD HL,33698 | a dead companion: | ||
| 36369 | DEC (HL) | morale term -1 | ||
| 36370 | JR 36385 | |||
| 36372 | LD A,(IX+5) | a live companion: morale term += | ||
| 36375 | SUB 2 | his courage - 2 | ||
| 36377 | LD E,A | |||
| 36378 | LD A,(33698) | |||
| 36381 | ADD A,E | |||
| 36382 | LD (33698),A | |||
| 36385 | POP DE | |||
| 36386 | INC DE | next companion slot | ||
| 36387 | POP BC | |||
| 36388 | DJNZ 36317 | |||
| 36390 | POP IX | IX -> the actor again | ||
| 36392 | LD B,3 | is his spot one of the 3 rooms | ||
| 36394 | LD HL,33692 | in NearRoomList? | ||
| 36397 | LD A,(IX+1) | |||
| 36400 | CP (HL) | |||
| 36401 | JR Z,36408 | |||
| 36403 | INC HL | |||
| 36404 | DJNZ 36400 | |||
| 36406 | JR 36412 | |||
| 36408 | LD HL,33698 | yes: +1 | ||
| 36411 | INC (HL) | |||
| 36412 | LD HL,33698 | morale = courage + companion effects, | ||
| 36415 | LD A,(IX+5) | |||
| 36418 | ADD A,(HL) | |||
| 36419 | CP 127 | clamped to 0 on underflow | ||
| 36421 | JR C,36424 | |||
| 36423 | XOR A | |||
| 36424 | LD (IX+6),A | |||
| 36427 | RET | |||
| Prev: 36187 | Up: Map | Next: 36428 |