Reformat score.c like normal C, since it now almost is.
Still two gotos to get rid of.
This commit is contained in:
parent
7555eb7de3
commit
db4b972fc7
1 changed files with 102 additions and 99 deletions
51
score.c
51
score.c
|
@ -6,11 +6,12 @@
|
||||||
* scoring and wrap-up
|
* scoring and wrap-up
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void score(long mode) {
|
void score(long mode)
|
||||||
/* arg is <0 if scoring, >0 if quitting, =0 if died or won */
|
/* mode is <0 if scoring, >0 if quitting, =0 if died or won */
|
||||||
|
{
|
||||||
long i, score = 0, mxscor = 0;
|
long i, score = 0, mxscor = 0;
|
||||||
|
|
||||||
/* The present scoring algorithm is as follows:
|
/* The present scoring algorithm is as follows:
|
||||||
* Objective: Points: Present total possible:
|
* Objective: Points: Present total possible:
|
||||||
* Getting well into cave 25 25
|
* Getting well into cave 25 25
|
||||||
* Each treasure < chest 12 60
|
* Each treasure < chest 12 60
|
||||||
|
@ -29,7 +30,7 @@ void score(long mode) {
|
||||||
* Points can also be deducted for using hints or too many turns, or for
|
* Points can also be deducted for using hints or too many turns, or for
|
||||||
* saving intermediate positions. */
|
* saving intermediate positions. */
|
||||||
|
|
||||||
/* First tally up the treasures. Must be in building and not broken.
|
/* First tally up the treasures. Must be in building and not broken.
|
||||||
* Give the poor guy 2 points just for finding each treasure. */
|
* Give the poor guy 2 points just for finding each treasure. */
|
||||||
|
|
||||||
for (i=MINTRS; i<=MAXTRS; i++) {
|
for (i=MINTRS; i<=MAXTRS; i++) {
|
||||||
|
@ -43,9 +44,9 @@ void score(long mode) {
|
||||||
score=score+K-2;
|
score=score+K-2;
|
||||||
mxscor=mxscor+K;
|
mxscor=mxscor+K;
|
||||||
}
|
}
|
||||||
} /* end loop */
|
}
|
||||||
|
|
||||||
/* Now look at how he finished and how far he got. MAXDIE and
|
/* Now look at how he finished and how far he got. MAXDIE and
|
||||||
* game.numdie tell us how well he survived. game.dflag will tell us
|
* game.numdie tell us how well he survived. game.dflag will tell us
|
||||||
* if he ever got suitably deep into the cave. game.closng still
|
* if he ever got suitably deep into the cave. game.closng still
|
||||||
* indicates whether he reached the endgame. And if he got as far as
|
* indicates whether he reached the endgame. And if he got as far as
|
||||||
|
@ -61,37 +62,38 @@ void score(long mode) {
|
||||||
if(game.closng)score=score+25;
|
if(game.closng)score=score+25;
|
||||||
mxscor=mxscor+25;
|
mxscor=mxscor+25;
|
||||||
if(game.closed) {
|
if(game.closed) {
|
||||||
if(game.bonus == 0)score=score+10;
|
if(game.bonus == 0)
|
||||||
if(game.bonus == 135)score=score+25;
|
score=score+10;
|
||||||
if(game.bonus == 134)score=score+30;
|
if(game.bonus == 135)
|
||||||
if(game.bonus == 133)score=score+45;
|
score=score+25;
|
||||||
|
if(game.bonus == 134)
|
||||||
|
score=score+30;
|
||||||
|
if(game.bonus == 133)
|
||||||
|
score=score+45;
|
||||||
}
|
}
|
||||||
mxscor=mxscor+45;
|
mxscor=mxscor+45;
|
||||||
|
|
||||||
/* Did he come to Witt's End as he should? */
|
/* Did he come to Witt's End as he should? */
|
||||||
|
|
||||||
if(game.place[MAGZIN] == 108)
|
if(game.place[MAGZIN] == 108)
|
||||||
score=score+1;
|
score=score+1;
|
||||||
mxscor=mxscor+1;
|
mxscor=mxscor+1;
|
||||||
|
|
||||||
/* Round it off. */
|
/* Round it off. */
|
||||||
|
|
||||||
score=score+2;
|
score=score+2;
|
||||||
mxscor=mxscor+2;
|
mxscor=mxscor+2;
|
||||||
|
|
||||||
/* Deduct for hints/turns/saves. Hints < 4 are special; see database desc. */
|
/* Deduct for hints/turns/saves. Hints < 4 are special; see database desc. */
|
||||||
|
|
||||||
for (i=1; i<=HNTMAX; i++) {
|
for (i=1; i<=HNTMAX; i++) {
|
||||||
if(game.hinted[i])score=score-HINTS[i][2];
|
if(game.hinted[i])
|
||||||
} /* end loop */
|
score=score-HINTS[i][2];
|
||||||
|
}
|
||||||
if(game.novice)
|
if(game.novice)
|
||||||
score=score-5;
|
score=score-5;
|
||||||
if(game.clshnt)
|
if(game.clshnt)
|
||||||
score=score-10;
|
score=score-10;
|
||||||
score=score-game.trnluz-game.saved;
|
score=score-game.trnluz-game.saved;
|
||||||
|
|
||||||
/* Return to score command if that's where we came from. */
|
/* Return to score command if that's where we came from. */
|
||||||
|
|
||||||
if(mode < 0) {
|
if(mode < 0) {
|
||||||
SETPRM(1,score,mxscor);
|
SETPRM(1,score,mxscor);
|
||||||
SETPRM(3,game.turns,game.turns);
|
SETPRM(3,game.turns,game.turns);
|
||||||
|
@ -99,10 +101,11 @@ void score(long mode) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* that should be good enough. Let's tell him all about it. */
|
/* that should be good enough. Let's tell him all about it. */
|
||||||
|
if(score+game.trnluz+1 >= mxscor && game.trnluz != 0)
|
||||||
if(score+game.trnluz+1 >= mxscor && game.trnluz != 0)RSPEAK(242);
|
RSPEAK(242);
|
||||||
if(score+game.saved+1 >= mxscor && game.saved != 0)RSPEAK(143);
|
if(score+game.saved+1 >= mxscor && game.saved != 0)
|
||||||
|
RSPEAK(143);
|
||||||
SETPRM(1,score,mxscor);
|
SETPRM(1,score,mxscor);
|
||||||
SETPRM(3,game.turns,game.turns);
|
SETPRM(3,game.turns,game.turns);
|
||||||
RSPEAK(262);
|
RSPEAK(262);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue