Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is the hint implementation missing? #3

Open
patricksurry opened this issue Mar 21, 2024 · 1 comment
Open

Is the hint implementation missing? #3

patricksurry opened this issue Mar 21, 2024 · 1 comment

Comments

@patricksurry
Copy link

patricksurry commented Mar 21, 2024

I've been having fun porting this to a 6502 forth and noticed that altho advent.h defines the HINTx conditions these don't seem to be referenced in the code. The hint messages are present in advent4.h (e.g. #63) but I can't find any equivalent of the checkhints routine from the open-adventure code.

advent.h:#define HINTC       16
advent.h:#define HINTB       32
advent.h:#define HINTS       64
advent.h:#define HINTM       128
advent.h:#define HINT        240

also doc/advent.txt mentions the feature, but maybe disappeared again later?

J) Hint feature restored with original messages
           (exact original algorithm unknown)

I'd be happy to try and restore if you have any traces of the original code.

@patricksurry
Copy link
Author

the open-adventure source tree starts from some horrible f2c version where main.c includes references like below, so maybe I can reconstruct? score.c also has some deductions if you take hints.

/*  CHECK IF THIS LOC IS ELIGIBLE FOR ANY HINTS.  IF BEEN HERE LONG ENOUGH,
 *  BRANCH TO HELP SECTION (ON LATER PAGE).  HINTS ALL COME BACK HERE EVENTUALLY
 *  TO FINISH THE LOOP.  IGNORE "HINTS" < 4 (SPECIAL STUFF, SEE DATABASE NOTES).
		*/

L2600:	if(COND[LOC] < CONDS) goto L2603;
	/* 2602 */ for (HINT=1; HINT<=HNTMAX; HINT++) {
	if(HINTED[HINT]) goto L2602;
	if(!CNDBIT(LOC,HINT+10))HINTLC[HINT]= -1;
	HINTLC[HINT]=HINTLC[HINT]+1;
	if(HINTLC[HINT] >= HINTS[HINT][1]) goto L40000;
L2602:	/*etc*/ ;
	} /* end loop */

...

/*  HINTS */

/*  COME HERE IF HE'S BEEN LONG ENOUGH AT REQUIRED LOC(S) FOR SOME UNUSED HINT.
 *  HINT NUMBER IS IN VARIABLE "HINT".  BRANCH TO QUICK TEST FOR ADDITIONAL
 *  CONDITIONS, THEN COME BACK TO DO NEAT STUFF.  GOTO 40010 IF CONDITIONS ARE
 *  MET AND WE WANT TO OFFER THE HINT.  GOTO 40020 TO CLEAR HINTLC BACK TO ZERO,
 *  40030 TO TAKE NO ACTION YET. */

L40000:    switch (HINT-1) { case 0: goto L40100; case 1: goto L40200; case 2: goto
		L40300; case 3: goto L40400; case 4: goto L40500; case 5: goto
		L40600; case 6: goto L40700; case 7: goto L40800; case 8: goto
		L40900; case 9: goto L41000; }
/*		CAVE  BIRD  SNAKE MAZE  DARK  WITT  URN   WOODS OGRE
 *		JADE */
	BUG(27);

L40010: HINTLC[HINT]=0;
	if(!YES(HINTS[HINT][3],0,54)) goto L2602;
	SETPRM(1,HINTS[HINT][2],HINTS[HINT][2]);
	RSPEAK(261);
	HINTED[HINT]=YES(175,HINTS[HINT][4],54);
	if(HINTED[HINT] && LIMIT > 30)LIMIT=LIMIT+30*HINTS[HINT][2];
L40020: HINTLC[HINT]=0;
L40030:  goto L2602;

/*  NOW FOR THE QUICK TESTS.  SEE DATABASE DESCRIPTION FOR ONE-LINE NOTES. */

L40100: if(PROP[GRATE] == 0 && !HERE(KEYS)) goto L40010;
	 goto L40020;

L40200: if(PLACE[BIRD] == LOC && TOTING(ROD) && OLDOBJ == BIRD) goto L40010;
	 goto L40030;

L40300: if(HERE(SNAKE) && !HERE(BIRD)) goto L40010;
	 goto L40020;

L40400: if(ATLOC[LOC] == 0 && ATLOC[OLDLOC] == 0 && ATLOC[OLDLC2] == 0 && HOLDNG >
		1) goto L40010;
	 goto L40020;

L40500: if(PROP[EMRALD] != -1 && PROP[PYRAM] == -1) goto L40010;
	 goto L40020;

L40600:  goto L40010;

L40700: if(DFLAG == 0) goto L40010;
	 goto L40020;

L40800: if(ATLOC[LOC] == 0 && ATLOC[OLDLOC] == 0 && ATLOC[OLDLC2] == 0) goto
		L40010;
	 goto L40030;

L40900: I=ATDWRF(LOC);
	if(I < 0) goto L40020;
	if(HERE(OGRE) && I == 0) goto L40010;
	 goto L40030;

L41000: if(TALLY == 1 && PROP[JADE] < 0) goto L40010;
	 goto L40020;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant