10 void score(enum termination mode)
11 /* mode is 'scoregame' if scoring, 'quitgame' if quitting, 'endgame' if died
14 long score = 0, mxscor = 0;
16 /* The present scoring algorithm is as follows:
17 * Objective: Points: Present total possible:
18 * Getting well into cave 25 25
19 * Each treasure < chest 12 60
20 * Treasure chest itself 14 14
21 * Each treasure > chest 16 224
22 * Surviving (MAX-NUM)*10 30
24 * Reaching "game.closng" 25 25
25 * "Closed": Quit/Killed 10
29 * Came to Witt's End 1 1
30 * Round out the total 2 2
32 * Points can also be deducted for using hints or too many turns, or for
33 * saving intermediate positions. */
35 /* First tally up the treasures. Must be in building and not broken.
36 * Give the poor guy 2 points just for finding each treasure. */
37 for (long i = MINTRS; i <= MAXTRS; i++) {
38 if (object_descriptions[i].inventory != 0) {
40 if (i == CHEST)k = 14;
42 if (game.prop[i] >= 0)
44 if (game.place[i] == LOC_BUILDING && game.prop[i] == 0)
50 /* Now look at how he finished and how far he got. MAXDIE and
51 * game.numdie tell us how well he survived. game.dflag will tell us
52 * if he ever got suitably deep into the cave. game.closng still
53 * indicates whether he reached the endgame. And if he got as far as
54 * "cave closed" (indicated by "game.closed"), then bonus is zero for
55 * mundane exits or 133, 134, 135 if he blew it (so to speak). */
56 score += (MAXDIE - game.numdie) * 10;
57 mxscor += MAXDIE * 10;
61 if (game.dflag != 0)score += 25;
63 if (game.closng)score += 25;
68 if (game.bonus == SPLATTER_MESSAGE)
70 if (game.bonus == DEFEAT_MESSAGE)
72 if (game.bonus == VICTORY_MESSAGE)
77 /* Did he come to Witt's End as he should? */
78 if (game.place[MAGZIN] == LOC_WITTSEND)
86 /* Deduct for hints/turns/saves. Hints < 4 are special; see database desc. */
87 for (long i = 1; i <= HNTMAX; i++) {
89 score = score - HINTS[i][2];
95 score = score - game.trnluz - game.saved;
97 /* Return to score command if that's where we came from. */
98 if (mode == scoregame) {
99 SETPRM(1, score, mxscor);
100 SETPRM(3, game.turns, game.turns);
101 RSPEAK(GARNERED_POINTS);
105 /* that should be good enough. Let's tell him all about it. */
106 if (score + game.trnluz + 1 >= mxscor && game.trnluz != 0)
108 if (score + game.saved + 1 >= mxscor && game.saved != 0)
109 RSPEAK(WITHOUT_SUSPENDS);
110 SETPRM(1, score, mxscor);
111 SETPRM(3, game.turns, game.turns);
113 for (long i = 1; i <= (long)CLSSES; i++) {
114 if (CVAL[i] >= score) {
115 newspeak(class_messages[i]);
116 i = CVAL[i] + 1 - score;