OpenCores
URL https://opencores.org/ocsvn/ion/ion/trunk

Subversion Repositories ion

[/] [ion/] [trunk/] [src/] [adventure/] [score.c] - Blame information for rev 245

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 90 ja_rd
#include "misc.h"
2
#include "main.h"
3
#include "share.h"
4
 
5
#define TRUE  (0==0)
6
#define FALSE (0!=0)
7
 
8
/*
9
 * SCORING AND WRAP-UP
10
 */
11
 
12
void score(MODE)long MODE; {
13
        /* <0 if scoring, >0 if quitting, =0 if died or won */
14
 
15
/*  THE PRESENT SCORING ALGORITHM IS AS FOLLOWS:
16
 *     OBJECTIVE:          POINTS:        PRESENT TOTAL POSSIBLE:
17
 *  GETTING WELL INTO CAVE   25                    25
18
 *  EACH TREASURE < CHEST    12                    60
19
 *  TREASURE CHEST ITSELF    14                    14
20
 *  EACH TREASURE > CHEST    16                   224
21
 *  SURVIVING             (MAX-NUM)*10             30
22
 *  NOT QUITTING              4                     4
23
 *  REACHING "CLOSNG"        25                    25
24
 *  "CLOSED": QUIT/KILLED    10
25
 *            KLUTZED        25
26
 *            WRONG WAY      30
27
 *            SUCCESS        45                    45
28
 *  CAME TO WITT'S END        1                     1
29
 *  ROUND OUT THE TOTAL       2                     2
30
 *                                       TOTAL:   430
31
 *  POINTS CAN ALSO BE DEDUCTED FOR USING HINTS OR TOO MANY TURNS, OR FOR
32
 *  SAVING INTERMEDIATE POSITIONS. */
33
 
34
L20000: SCORE=0;
35
        MXSCOR=0;
36
 
37
/*  FIRST TALLY UP THE TREASURES.  MUST BE IN BUILDING AND NOT BROKEN.
38
 *  GIVE THE POOR GUY 2 POINTS JUST FOR FINDING EACH TREASURE. */
39
 
40
        /* 20010 */ for (I=50; I<=MAXTRS; I++) {
41
        if(PTEXT[I] == 0) goto L20010;
42
        K=12;
43
        if(I == CHEST)K=14;
44
        if(I > CHEST)K=16;
45
        if(PROP[I] >= 0)SCORE=SCORE+2;
46
        if(PLACE[I] == 3 && PROP[I] == 0)SCORE=SCORE+K-2;
47
        MXSCOR=MXSCOR+K;
48
L20010: /*etc*/ ;
49
        } /* end loop */
50
 
51
/*  NOW LOOK AT HOW HE FINISHED AND HOW FAR HE GOT.  MAXDIE AND NUMDIE TELL US
52
 *  HOW WELL HE SURVIVED.  DFLAG WILL
53
 *  TELL US IF HE EVER GOT SUITABLY DEEP INTO THE CAVE.  CLOSNG STILL INDICATES
54
 *  WHETHER HE REACHED THE ENDGAME.  AND IF HE GOT AS FAR AS "CAVE CLOSED"
55
 *  (INDICATED BY "CLOSED"), THEN BONUS IS ZERO FOR MUNDANE EXITS OR 133, 134,
56
 *  135 IF HE BLEW IT (SO TO SPEAK). */
57
 
58
        SCORE=SCORE+(MAXDIE-NUMDIE)*10;
59
        MXSCOR=MXSCOR+MAXDIE*10;
60
        if(MODE == 0)SCORE=SCORE+4;
61
        MXSCOR=MXSCOR+4;
62
        if(DFLAG != 0)SCORE=SCORE+25;
63
        MXSCOR=MXSCOR+25;
64
        if(CLOSNG)SCORE=SCORE+25;
65
        MXSCOR=MXSCOR+25;
66
        if(!CLOSED) goto L20020;
67
        if(BONUS == 0)SCORE=SCORE+10;
68
        if(BONUS == 135)SCORE=SCORE+25;
69
        if(BONUS == 134)SCORE=SCORE+30;
70
        if(BONUS == 133)SCORE=SCORE+45;
71
L20020: MXSCOR=MXSCOR+45;
72
 
73
/*  DID HE COME TO WITT'S END AS HE SHOULD? */
74
 
75
        if(PLACE[MAGZIN] == 108)SCORE=SCORE+1;
76
        MXSCOR=MXSCOR+1;
77
 
78
/*  ROUND IT OFF. */
79
 
80
        SCORE=SCORE+2;
81
        MXSCOR=MXSCOR+2;
82
 
83
/*  DEDUCT FOR HINTS/TURNS/SAVES.  HINTS < 4 ARE SPECIAL; SEE DATABASE DESC. */
84
 
85
        /* 20030 */ for (I=1; I<=HNTMAX; I++) {
86
L20030: if(HINTED[I])SCORE=SCORE-HINTS[I][2];
87
        } /* end loop */
88
        if(NOVICE)SCORE=SCORE-5;
89
        if(CLSHNT)SCORE=SCORE-10;
90
        SCORE=SCORE-TRNLUZ-SAVED;
91
 
92
/*  RETURN TO SCORE COMMAND IF THAT'S WHERE WE CAME FROM. */
93
 
94
        if(MODE < 0) return;
95
 
96
/*  THAT SHOULD BE GOOD ENOUGH.  LET'S TELL HIM ALL ABOUT IT. */
97
 
98
        if(SCORE+TRNLUZ+1 >= MXSCOR && TRNLUZ != 0)RSPEAK(242);
99
        if(SCORE+SAVED+1 >= MXSCOR && SAVED != 0)RSPEAK(143);
100
        SETPRM(1,SCORE,MXSCOR);
101
        SETPRM(3,TURNS,TURNS);
102
        RSPEAK(262);
103
        /* 20200 */ for (I=1; I<=CLSSES; I++) {
104
        if(CVAL[I] >= SCORE) goto L20210;
105
L20200: /*etc*/ ;
106
        } /* end loop */
107
        SPK=265;
108
         goto L25000;
109
 
110
L20210: SPEAK(CTEXT[I]);
111
        SPK=264;
112
        if(I >= CLSSES) goto L25000;
113
        I=CVAL[I]+1-SCORE;
114
        SETPRM(1,I,I);
115
        SPK=263;
116
L25000: RSPEAK(SPK);
117
        exit(FALSE);
118
 
119
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.