-static int raw_init(void) {
- printf("Couldn't find adventure.data, using adventure.text...\n");
-
-/* CLEAR OUT THE VARIOUS TEXT-POINTER ARRAYS. ALL TEXT IS STORED IN ARRAY
- * LINES; EACH LINE IS PRECEDED BY A WORD POINTING TO THE NEXT POINTER (I.E.
- * THE WORD FOLLOWING THE END OF THE LINE). THE POINTER IS NEGATIVE IF THIS IS
- * FIRST LINE OF A MESSAGE. THE TEXT-POINTER ARRAYS CONTAIN INDICES OF
- * POINTER-WORDS IN LINES. STEXT(N) IS SHORT DESCRIPTION OF LOCATION N.
- * LTEXT(N) IS LONG DESCRIPTION. PTEXT(N) POINTS TO MESSAGE FOR PROP(N)=0.
- * SUCCESSIVE PROP MESSAGES ARE FOUND BY CHASING POINTERS. RTEXT CONTAINS
- * SECTION 6'S STUFF. CTEXT(N) POINTS TO A PLAYER-CLASS MESSAGE. TTEXT IS FOR
- * SECTION 14. WE ALSO CLEAR COND (SEE DESCRIPTION OF SECTION 9 FOR DETAILS). */
-
- /* 1001 */ for (I=1; I<=300; I++) {
- if(I <= 100)PTEXT[I]=0;
- if(I <= RTXSIZ)RTEXT[I]=0;
- if(I <= CLSMAX)CTEXT[I]=0;
- if(I <= 100)OBJSND[I]=0;
- if(I <= 100)OBJTXT[I]=0;
- if(I > LOCSIZ) goto L1001;
- STEXT[I]=0;
- LTEXT[I]=0;
- COND[I]=0;
- KEY[I]=0;
- LOCSND[I]=0;
-L1001: /*etc*/ ;
- } /* end loop */
-
- LINUSE=1;
- TRVS=1;
- CLSSES=0;
- TRNVLS=0;
-
-/* START NEW DATA SECTION. SECT IS THE SECTION NUMBER. */
-
-L1002: SECT=GETNUM(1);
- OLDLOC= -1;
- switch (SECT) { case 0: return(0); case 1: goto L1004; case 2: goto
- L1004; case 3: goto L1030; case 4: goto L1040; case 5: goto L1004;
- case 6: goto L1004; case 7: goto L1050; case 8: goto L1060; case
- 9: goto L1070; case 10: goto L1004; case 11: goto L1080; case 12:
- break; case 13: goto L1090; case 14: goto L1004; }
-/* (0) (1) (2) (3) (4) (5) (6) (7) (8) (9)
- * (10) (11) (12) (13) (14) */
- BUG(9);
-
-/* SECTIONS 1, 2, 5, 6, 10, 14. READ MESSAGES AND SET UP POINTERS. */
-
-L1004: KK=LINUSE;
-L1005: LINUSE=KK;
- LOC=GETNUM(1);
- if(LNLENG >= LNPOSN+70)BUG(0);
- if(LOC == -1) goto L1002;
- if(LNLENG < LNPOSN)BUG(1);
-L1006: KK=KK+1;
- if(KK >= LINSIZ)BUG(2);
- LINES[KK]=GETTXT(FALSE,FALSE,FALSE,KK);
- if(LINES[KK] != -1) goto L1006;
- LINES[LINUSE]=KK;
- if(LOC == OLDLOC) goto L1005;
- OLDLOC=LOC;
- LINES[LINUSE]= -KK;
- if(SECT == 14) goto L1014;
- if(SECT == 10) goto L1012;
- if(SECT == 6) goto L1011;
- if(SECT == 5) goto L1010;
- if(LOC > LOCSIZ)BUG(10);
- if(SECT == 1) goto L1008;
-
- STEXT[LOC]=LINUSE;
- goto L1005;
-
-L1008: LTEXT[LOC]=LINUSE;
- goto L1005;
-
-L1010: if(LOC > 0 && LOC <= 100)PTEXT[LOC]=LINUSE;
- goto L1005;
-
-L1011: if(LOC > RTXSIZ)BUG(6);
- RTEXT[LOC]=LINUSE;
- goto L1005;
-
-L1012: CLSSES=CLSSES+1;
- if(CLSSES > CLSMAX)BUG(11);
- CTEXT[CLSSES]=LINUSE;
- CVAL[CLSSES]=LOC;
- goto L1005;
-
-L1014: TRNVLS=TRNVLS+1;
- if(TRNVLS > TRNSIZ)BUG(11);
- TTEXT[TRNVLS]=LINUSE;
- TRNVAL[TRNVLS]=LOC;
- goto L1005;
-
-/* THE STUFF FOR SECTION 3 IS ENCODED HERE. EACH "FROM-LOCATION" GETS A
- * CONTIGUOUS SECTION OF THE "TRAVEL" ARRAY. EACH ENTRY IN TRAVEL IS
- * NEWLOC*1000 + KEYWORD (FROM SECTION 4, MOTION VERBS), AND IS NEGATED IF
- * THIS IS THE LAST ENTRY FOR THIS LOCATION. KEY(N) IS THE INDEX IN TRAVEL
- * OF THE FIRST OPTION AT LOCATION N. */
-
-L1030: LOC=GETNUM(1);
- if(LOC == -1) goto L1002;
- NEWLOC=GETNUM(0);
- if(KEY[LOC] != 0) goto L1033;
- KEY[LOC]=TRVS;
- goto L1035;
-L1033: TRVS--; TRAVEL[TRVS]= -TRAVEL[TRVS]; TRVS++;
-L1035: L=GETNUM(0);
- if(L == 0) goto L1039;
- TRAVEL[TRVS]=NEWLOC*1000+L;
- TRVS=TRVS+1;
- if(TRVS == TRVSIZ)BUG(3);
- goto L1035;
-L1039: TRVS--; TRAVEL[TRVS]= -TRAVEL[TRVS]; TRVS++;
- goto L1030;
-
-/* HERE WE READ IN THE VOCABULARY. KTAB(N) IS THE WORD NUMBER, ATAB(N) IS
- * THE CORRESPONDING WORD. THE -1 AT THE END OF SECTION 4 IS LEFT IN KTAB
- * AS AN END-MARKER. THE WORDS ARE GIVEN A MINIMAL HASH TO MAKE DECIPHERING
- * THE CORE-IMAGE HARDER. (WE DON'T USE GETTXT'S HASH SINCE THAT WOULD FORCE
- * US TO HASH EACH INPUT LINE TO MAKE COMPARISONS WORK, AND THAT IN TURN
- * WOULD MAKE IT HARDER TO DETECT PARTICULAR INPUT WORDS.) */
-
-L1040: J=10000;
- /* 1042 */ for (TABNDX=1; TABNDX<=TABSIZ; TABNDX++) {
-L1043: KTAB[TABNDX]=GETNUM(1);
- if(KTAB[TABNDX] == -1) goto L1002;
- J=J+7;
-L1042: ATAB[TABNDX]=GETTXT(TRUE,TRUE,TRUE,0)+J*J;
- } /* end loop */
- BUG(4);
-
-/* READ IN THE INITIAL LOCATIONS FOR EACH OBJECT. ALSO THE IMMOVABILITY INFO.
- * PLAC CONTAINS INITIAL LOCATIONS OF OBJECTS. FIXD IS -1 FOR IMMOVABLE
- * OBJECTS (INCLUDING THE SNAKE), OR = SECOND LOC FOR TWO-PLACED OBJECTS. */
-
-L1050: OBJ=GETNUM(1);
- if(OBJ == -1) goto L1002;
- PLAC[OBJ]=GETNUM(0);
- FIXD[OBJ]=GETNUM(0);
- goto L1050;
-
-/* READ DEFAULT MESSAGE NUMBERS FOR ACTION VERBS, STORE IN ACTSPK. */
-
-L1060: VERB=GETNUM(1);
- if(VERB == -1) goto L1002;
- ACTSPK[VERB]=GETNUM(0);
- goto L1060;
-
-/* READ INFO ABOUT AVAILABLE LIQUIDS AND OTHER CONDITIONS, STORE IN COND. */
-
-L1070: K=GETNUM(1);
- if(K == -1) goto L1002;
-L1071: LOC=GETNUM(0);
- if(LOC == 0) goto L1070;
- if(CNDBIT(LOC,K)) BUG(8);
- COND[LOC]=COND[LOC]+SETBIT(K);
- goto L1071;
-
-/* READ DATA FOR HINTS. */
-
-L1080: HNTMAX=0;
-L1081: K=GETNUM(1);
- if(K == -1) goto L1002;
- if(K <= 0 || K > HNTSIZ)BUG(7);
- /* 1083 */ for (I=1; I<=4; I++) {
-L1083: HINTS[K][I] =GETNUM(0);
- } /* end loop */
- HNTMAX=(HNTMAX>K ? HNTMAX : K);
- goto L1081;
-
-/* READ THE SOUND/TEXT INFO, STORE IN OBJSND, OBJTXT, LOCSND. */
-
-L1090: K=GETNUM(1);
- if(K == -1) goto L1002;
- KK=GETNUM(0);
- I=GETNUM(0);
- if(I == 0) goto L1092;
- OBJSND[K]=(KK>0 ? KK : 0);
- OBJTXT[K]=(I>0 ? I : 0);
- goto L1090;
-
-L1092: LOCSND[K]=KK;
- goto L1090;
-}
-
-/* FINISH CONSTRUCTING INTERNAL DATA FORMAT */
-
-/* HAVING READ IN THE DATABASE, CERTAIN THINGS ARE NOW CONSTRUCTED. PROPS ARE
- * SET TO ZERO. WE FINISH SETTING UP COND BY CHECKING FOR FORCED-MOTION TRAVEL
- * ENTRIES. THE PLAC AND FIXD ARRAYS ARE USED TO SET UP ATLOC(N) AS THE FIRST
- * OBJECT AT LOCATION N, AND LINK(OBJ) AS THE NEXT OBJECT AT THE SAME LOCATION
- * AS OBJ. (OBJ>100 INDICATES THAT FIXED(OBJ-100)=LOC; LINK(OBJ) IS STILL THE
- * CORRECT LINK TO USE.) ABB IS ZEROED; IT CONTROLS WHETHER THE ABBREVIATED
- * DESCRIPTION IS PRINTED. COUNTS MOD 5 UNLESS "LOOK" IS USED. */
-