1 /* ScummVM - Graphic Adventure Engine 2 * 3 * ScummVM is the legal property of its developers, whose names 4 * are too numerous to list here. Please refer to the COPYRIGHT 5 * file distributed with this source distribution. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef GLK_ACODE 24 #define GLK_ACODE 25 26 #include "common/scummsys.h" 27 #include "common/serializer.h" 28 29 namespace Glk { 30 namespace Alan3 { 31 32 #define ACODEEXTENSION ".a3c" 33 34 typedef uint32 Aptr; /* Type for an ACODE memory address used in the structures */ 35 /* TODO: Here's the major 32->64bit problem: Aptrs are 32 bit to fit 36 into the 32-bit structure of the Amachine, but sometimes this is 37 used to store a *real* pointer value, which on 64-bit machines are 38 64bits. */ 39 40 typedef uint32 Aword; /* Type for an ACODE word */ 41 typedef uint32 Aaddr; /* Type for an ACODE address */ 42 typedef uint32 Aid; /* Type for an ACODE Instance Id value */ 43 typedef int32 Abool; /* Type for an ACODE Boolean value */ 44 typedef int32 Aint; /* Type for an ACODE Integer value */ 45 typedef int32 Aset; /* Type for an ACODE Set value */ 46 typedef int CodeValue; /* Definition for the packing process */ 47 48 #ifndef TRUE 49 #define TRUE (0==0) 50 #endif 51 #ifndef FALSE 52 #define FALSE (!TRUE) 53 #endif 54 55 /* Constants for the Acode file, words/block & bytes/block */ 56 #define BLOCKLEN 256L 57 #define BLOCKSIZE (BLOCKLEN*sizeof(Aword)) 58 59 60 /* Definitions for the packing process */ 61 #define VALUEBITS 16 62 63 #define EOFChar 256 64 #define TOPVALUE (((CodeValue)1<<VALUEBITS) - 1) /* Highest value possible */ 65 66 /* Half and quarter points in the code value range */ 67 #define ONEQUARTER (TOPVALUE/4+1) /* Point after first quarter */ 68 #define HALF (2*ONEQUARTER) /* Point after first half */ 69 #define THREEQUARTER (3*ONEQUARTER) /* Point after third quarter */ 70 71 72 /* AMACHINE Word Classes, bit positions */ 73 typedef int WordKind; 74 #define SYNONYM_WORD 0 75 #define SYNONYM_BIT (((Aword)1)<<SYNONYM_WORD) 76 77 #define ADJECTIVE_WORD (SYNONYM_WORD+1) 78 #define ADJECTIVE_BIT (((Aword)1)<<ADJECTIVE_WORD) 79 80 #define ALL_WORD (ADJECTIVE_WORD+1) 81 #define ALL_BIT (((Aword)1)<<ALL_WORD) 82 83 #define EXCEPT_WORD (ALL_WORD+1) 84 #define EXCEPT_BIT (((Aword)1)<<EXCEPT_WORD) 85 86 #define CONJUNCTION_WORD (EXCEPT_WORD+1) 87 #define CONJUNCTION_BIT (((Aword)1)<<CONJUNCTION_WORD) 88 89 #define PREPOSITION_WORD (CONJUNCTION_WORD+1) 90 #define PREPOSITION_BIT (((Aword)1)<<PREPOSITION_WORD) 91 92 #define DIRECTION_WORD (PREPOSITION_WORD+1) 93 #define DIRECTION_BIT (((Aword)1)<<DIRECTION_WORD) 94 95 #define IT_WORD (DIRECTION_WORD+1) 96 #define IT_BIT (((Aword)1)<<IT_WORD) 97 98 #define NOISE_WORD (IT_WORD+1) 99 #define NOISE_BIT (((Aword)1)<<NOISE_WORD) 100 101 #define NOUN_WORD (NOISE_WORD+1) 102 #define NOUN_BIT (((Aword)1)<<NOUN_WORD) 103 104 #define THEM_WORD (NOUN_WORD+1) 105 #define THEM_BIT (((Aword)1)<<THEM_WORD) 106 107 #define VERB_WORD (THEM_WORD+1) 108 #define VERB_BIT (((Aword)1)<<VERB_WORD) 109 110 #define PRONOUN_WORD (VERB_WORD+1) 111 #define PRONOUN_BIT (((Aword)1)<<PRONOUN_WORD) 112 113 #define WRD_CLASSES (PRONOUN_WORD+1) 114 115 116 /* The #nowhere and NO_LOCATION constants */ 117 #define NO_LOCATION 0 118 #define NOWHERE 1 119 120 121 /* Syntax element classifications */ 122 // End of file/data 123 #define EOD (uint32)-1 124 // End Of Syntax 125 #define EOS (uint32)-2 126 127 /* Syntax element flag bits */ 128 #define MULTIPLEBIT 0x1 129 #define OMNIBIT 0x2 130 131 132 /* Parameter Classes */ 133 enum ClaKind { /* NOTE! These must have the same order as */ 134 CLA_OBJ = 1, /* the name classes in NAM.H */ 135 CLA_CNT = (int)CLA_OBJ << 1, 136 CLA_ACT = (int)CLA_CNT << 1, 137 CLA_NUM = (int)CLA_ACT << 1, 138 CLA_STR = (int)CLA_NUM << 1, 139 CLA_COBJ = (int)CLA_STR << 1, 140 CLA_CACT = (int)CLA_COBJ << 1 141 }; 142 143 144 /* Verb Qualifiers */ 145 enum QualClass { 146 Q_DEFAULT, 147 Q_AFTER, 148 Q_BEFORE, 149 Q_ONLY 150 }; 151 152 153 /* The AMACHINE Operations */ 154 enum OpClass { 155 C_CONST, 156 C_STMOP, 157 C_CURVAR 158 }; 159 160 /* AMACHINE Text Styles */ 161 enum TextStyle { 162 NORMAL_STYLE, 163 EMPHASIZED_STYLE, 164 PREFORMATTED_STYLE, 165 ALERT_STYLE, 166 QUOTE_STYLE 167 }; 168 169 170 #define CONSTANT(op) ((Aword)op) 171 #define INSTRUCTION(op) ((((Aword)C_STMOP)<<28)|((Aword)op)) 172 #define CURVAR(op) ((((Aword)C_CURVAR)<<28)|((Aword)op)) 173 174 enum InstClass { 175 I_LINE, /* Source line debug info */ 176 I_PRINT, /* Print a string from the text file */ 177 I_STYLE, /* Set output text style */ 178 I_QUIT, 179 I_LOOK, 180 I_SAVE, 181 I_RESTORE, 182 I_LIST, /* List contents of a container */ 183 I_EMPTY, 184 I_SCORE, 185 I_VISITS, 186 I_SCHEDULE, 187 I_CANCEL, 188 I_LOCATE, 189 I_MAKE, /* Set a boolean attribute to the */ 190 /* value on top of stack */ 191 I_SET, /* Set a numeric attribute to the */ 192 /* value on top of stack */ 193 I_SETSTR, /* Set a string valued attribute to */ 194 /* the string on top of stack, */ 195 /* deallocate current contents first */ 196 I_SETSET, /* Set a Set valued attribute to */ 197 /* the Set on top of stack, */ 198 /* deallocate current contents first */ 199 I_NEWSET, /* Push a new, empty set at the top of stack */ 200 I_ATTRIBUTE, /* Push the value of an attribute */ 201 I_ATTRSTR, /* Push a copy of a string attribute */ 202 I_ATTRSET, /* Push a copy of a set attribute */ 203 I_UNION, /* Add a set from the top of stack to a */ 204 /* set valued attribute */ 205 I_GETSTR, /* Get a string contents from text 206 file, create a copy and push it 207 on top of stack */ 208 I_INCR, /* Increase an attribute */ 209 I_DECR, /* Decrease a numeric attribute */ 210 I_INCLUDE, /* Include a value in the set on stack top */ 211 I_EXCLUDE, /* Remove a value from the set on stack top */ 212 I_SETSIZE, /* Push number of members in a set */ 213 I_SETMEMB, /* Push the member with index <top>-1 214 from set <top> */ 215 I_CONTSIZE, /* Push number of members in a container */ 216 I_CONTMEMB, /* Push the member with index <top>-1 217 from container <top> */ 218 I_USE, 219 I_STOP, 220 I_AT, 221 I_IN, 222 I_INSET, 223 I_HERE, 224 I_NEARBY, 225 I_NEAR, 226 I_WHERE, /* Current position of an instance */ 227 I_LOCATION, /* The *location* an instance is at */ 228 I_DESCRIBE, 229 I_SAY, 230 I_SAYINT, 231 I_SAYSTR, 232 I_IF, 233 I_ELSE, 234 I_ENDIF, 235 I_AND, 236 I_OR, 237 I_NE, 238 I_EQ, 239 I_STREQ, /* String compare */ 240 I_STREXACT, /* Exact match */ 241 I_LE, 242 I_GE, 243 I_LT, 244 I_GT, 245 I_PLUS, 246 I_MINUS, 247 I_MULT, 248 I_DIV, 249 I_NOT, 250 I_UMINUS, 251 I_RND, 252 I_RETURN, 253 I_SYSTEM, 254 I_RESTART, 255 I_BTW, 256 I_CONTAINS, 257 I_DUP, 258 I_DEPEND, 259 I_DEPCASE, 260 I_DEPEXEC, 261 I_DEPELSE, 262 I_ENDDEP, 263 I_ISA, 264 I_FRAME, 265 I_SETLOCAL, 266 I_GETLOCAL, 267 I_ENDFRAME, 268 I_LOOP, 269 I_LOOPNEXT, 270 I_LOOPEND, 271 I_SUM, /* Aggregates: */ 272 I_MAX, 273 I_MIN, 274 I_COUNT, /* COUNT aggregate & limit meta-attribute */ 275 I_SHOW, 276 I_PLAY, 277 I_CONCAT, 278 I_STRIP, 279 I_POP, 280 I_TRANSCRIPT, 281 I_DUPSTR /* Duplicate the string on the top of the stack */ 282 }; 283 284 enum SayForm { 285 SAY_SIMPLE, 286 SAY_DEFINITE, 287 SAY_INDEFINITE, 288 SAY_NEGATIVE, 289 SAY_PRONOUN 290 }; 291 292 enum VarClass { 293 V_PARAM, 294 V_CURLOC, 295 V_CURACT, 296 V_CURVRB, 297 V_SCORE, 298 V_CURRENT_INSTANCE, 299 V_MAX_INSTANCE 300 }; 301 302 /* For transitivity in HERE, IN etc. */ 303 enum ATrans { 304 TRANSITIVE = 0, 305 DIRECT = 1, 306 INDIRECT = 2 307 }; 308 309 /* Predefined attributes, one is for containers and the other for locations 310 and since instances cannot be both, the attributes can have the same number */ 311 #define OPAQUEATTRIBUTE 1 312 #define VISITSATTRIBUTE 1 313 #define PREDEFINEDATTRIBUTES OPAQUEATTRIBUTE 314 315 #define I_CLASS(x) ((x)>>28) 316 #define I_OP(x) ((x&0x08000000)?(x)|0xf0000000:(x)&0x0fffffff) 317 318 319 /* AMACHINE Table entry types */ 320 321 #define AwordSizeOf(x) (sizeof(x)/sizeof(Aword)) 322 323 #include "common/pack-start.h" // START STRUCT PACKING 324 325 struct ArticleEntry { 326 Aaddr address; /* Address of article code */ 327 Abool isForm; /* Is the article a complete form? */ 328 } PACKED_STRUCT; 329 330 struct ClassEntry { /* CLASS TABLE */ 331 Aword code; /* Own code */ 332 Aaddr id; /* Address to identifier string */ 333 Aint parent; /* Code for the parent class, 0 if none */ 334 Aaddr name; /* Address to name printing code */ 335 Aint pronoun; /* Code for the pronoun word */ 336 Aaddr initialize; /* Address to initialization statements */ 337 Aaddr descriptionChecks; /* Address of description checks */ 338 Aaddr description; /* Address of description code */ 339 ArticleEntry definite; /* Definite article entry */ 340 ArticleEntry indefinite; /* Indefinite article entry */ 341 ArticleEntry negative; /* Negative article entry */ 342 Aaddr mentioned; /* Address of code for Mentioned clause */ 343 Aaddr verbs; /* Address of verb table */ 344 Aaddr entered; /* Address of code for Entered clause */ 345 } PACKED_STRUCT; 346 347 struct InstanceEntry { /* INSTANCE TABLE */ 348 Aint code; /* Own code */ 349 Aaddr id; /* Address to identifier string */ 350 Aint parent; /* Code for the parent class, 0 if none */ 351 Aaddr name; /* Address to name printing code */ 352 Aint pronoun; /* Word code for the pronoun */ 353 Aint initialLocation; /* Code for current location */ 354 Aaddr initialize; /* Address to initialization statements */ 355 Aint container; /* Code for a possible container property */ 356 Aaddr initialAttributes; /* Address of attribute list */ 357 Aaddr checks; /* Address of description checks */ 358 Aaddr description; /* Address of description code */ 359 ArticleEntry definite; /* Definite article entry */ 360 ArticleEntry indefinite; /* Indefinite article entry */ 361 ArticleEntry negative; /* Negative article entry */ 362 Aaddr mentioned; /* Address to short description code */ 363 Aaddr verbs; /* Address of local verb list */ 364 Aaddr entered; /* Address of entered code (location only) */ 365 Aaddr exits; /* Address of exit list */ 366 } PACKED_STRUCT; 367 368 struct AttributeEntry { /* ATTRIBUTE LIST */ 369 Aint code; /* Its code */ 370 Aptr value; /* Its value, a string has a dynamic 371 string pointer, a set has a pointer 372 to a dynamically allocated set */ 373 Aaddr id; /* Address to the name */ 374 375 /** 376 * Save/resotre data from save file 377 */ 378 void synchronize(Common::Serializer &s); 379 } PACKED_STRUCT; 380 381 struct AttributeHeaderEntry { /* ATTRIBUTE LIST in header */ 382 Aint code; /* Its code */ 383 Aword value; /* Its value, a string has a dynamic 384 string pointer, a set has a pointer 385 to a dynamically allocated set */ 386 Aaddr id; /* Address to the name */ 387 } PACKED_STRUCT; 388 389 struct ExitEntry { /* EXIT TABLE structure */ 390 Aword code; /* Direction code */ 391 Aaddr checks; /* Address of check table */ 392 Aaddr action; /* Address of action code */ 393 Aword target; /* Id for the target location */ 394 } PACKED_STRUCT; 395 396 397 struct RuleEntry { /* RULE TABLE */ 398 Abool alreadyRun; 399 Aaddr exp; /* Address to expression code */ 400 Aaddr stms; /* Address to run */ 401 } PACKED_STRUCT; 402 403 404 #define RESTRICTIONCLASS_CONTAINER (-2) 405 #define RESTRICTIONCLASS_INTEGER (-3) 406 #define RESTRICTIONCLASS_STRING (-4) 407 408 struct RestrictionEntry { /* PARAMETER RESTRICTION TABLE */ 409 Aint parameterNumber; /* Parameter number */ 410 Aint _class; /* Parameter class code */ 411 Aaddr stms; /* Exception statements */ 412 } PACKED_STRUCT; 413 414 struct ContainerEntry { /* CONTAINER TABLE */ 415 Aword owner; /* Owner instance index */ 416 Aint _class; /* Class to allow in container */ 417 Aaddr limits; /* Address to limit check code */ 418 Aaddr header; /* Address to header code */ 419 Aaddr empty; /* Address to code for header when empty */ 420 Aaddr extractChecks; /* Address to check before extracting */ 421 Aaddr extractStatements; /* Address to execute when extracting */ 422 } PACKED_STRUCT; 423 424 425 struct ElementEntry { /* SYNTAX ELEMENT TABLES */ 426 Aint code; /* Code for this element, 0 -> parameter */ 427 Aword flags; /* Flags for multiple/omni (if parameter), syntax number/verb of EOS */ 428 Aaddr next; /* Address to next element table ... */ 429 /* ... or restrictions if code == EOS */ 430 } PACKED_STRUCT; 431 432 struct SyntaxEntryPreBeta2 { /* SYNTAX TABLE */ 433 Aint code; /* Code for verb word */ 434 Aaddr elms; /* Address to element tables */ 435 } PACKED_STRUCT; 436 437 struct SyntaxEntry { /* SYNTAX TABLE */ 438 Aint code; /* Code for verb word, or 0 if starting with parameter */ 439 Aaddr elms; /* Address to element tables */ 440 Aaddr parameterNameTable; /* Address to a table of id-addresses giving the names of the parameters */ 441 } PACKED_STRUCT; 442 443 struct ParameterMapEntry { /* PARAMETER MAPPING TABLE */ 444 Aint syntaxNumber; 445 Aaddr parameterMapping; 446 Aint verbCode; 447 } PACKED_STRUCT; 448 449 struct EventEntry { /* EVENT TABLE */ 450 Aaddr id; /* Address to name string */ 451 Aaddr code; 452 } PACKED_STRUCT; 453 454 struct ScriptEntry { /* SCRIPT TABLE */ 455 Aaddr id; /* Address to name string */ 456 Aint code; /* Script number */ 457 Aaddr description; /* Optional description statements */ 458 Aaddr steps; /* Address to steps */ 459 } PACKED_STRUCT; 460 461 struct StepEntry { /* STEP TABLE */ 462 Aaddr after; /* Expression to say after how many ticks? */ 463 Aaddr exp; /* Expression to condition saying when */ 464 Aaddr stms; /* Address to the actual code */ 465 } PACKED_STRUCT; 466 467 struct AltEntry { /* VERB ALTERNATIVE TABLE */ 468 Aword qual; /* Verb execution qualifier */ 469 Aint param; /* Parameter number */ 470 Aaddr checks; /* Address of the check table */ 471 Aaddr action; /* Address of the action code */ 472 } PACKED_STRUCT; 473 474 struct SourceFileEntry { /* SOURCE FILE NAME TABLE */ 475 Aint fpos; 476 Aint len; 477 } PACKED_STRUCT; 478 479 struct SourceLineEntry { /* SOURCE LINE TABLE */ 480 Aint file; 481 Aint line; 482 } PACKED_STRUCT; 483 484 struct StringInitEntry { /* STRING INITIALISATION TABLE */ 485 Aword fpos; /* File position */ 486 Aword len; /* Length */ 487 Aint instanceCode; /* Where to store it */ 488 Aint attributeCode; 489 } PACKED_STRUCT; 490 491 struct SetInitEntry { /* SET INITIALISATION TABLE */ 492 Aint size; /* Size of the initial set */ 493 Aword setAddress; /* Address to the initial set */ 494 Aint instanceCode; /* Where to store it */ 495 Aint attributeCode; 496 } PACKED_STRUCT; 497 498 struct DictionaryEntry { /* Dictionary */ 499 Aaddr string; /* ACODE address to string */ 500 Aword classBits; /* Word class */ 501 Aword code; 502 Aaddr adjectiveRefs; /* Address to reference list */ 503 Aaddr nounRefs; /* Address to reference list */ 504 Aaddr pronounRefs; /* Address to reference list */ 505 } PACKED_STRUCT; 506 507 508 509 /* AMACHINE Header */ 510 511 struct ACodeHeader { 512 /* Important info */ 513 char tag[4]; /* "ALAN" */ 514 byte version[4]; /* Version of compiler */ 515 Aword uid; /* Unique id of the compiled game */ 516 Aword size; /* Size of ACD-file in Awords */ 517 /* Options */ 518 Abool pack; /* Is the text packed and encoded ? */ 519 Aword stringOffset; /* Offset to string data in game file */ 520 Aword pageLength; /* Length of a displayed page */ 521 Aword pageWidth; /* and width */ 522 Aword debug; /* Option: debug */ 523 /* Data structures */ 524 Aaddr classTableAddress; 525 Aword classMax; 526 Aword entityClassId; 527 Aword thingClassId; 528 Aword objectClassId; 529 Aword locationClassId; 530 Aword actorClassId; 531 Aword literalClassId; 532 Aword integerClassId; 533 Aword stringClassId; 534 Aaddr instanceTableAddress; /* Instance table */ 535 Aword instanceMax; /* Highest number of an instance */ 536 Aword theHero; /* The hero instance code (id) */ 537 Aaddr containerTableAddress; 538 Aword containerMax; 539 Aaddr scriptTableAddress; 540 Aword scriptMax; 541 Aaddr eventTableAddress; 542 Aword eventMax; 543 Aaddr syntaxTableAddress; 544 Aaddr parameterMapAddress; 545 Aword syntaxMax; 546 Aaddr dictionary; 547 Aaddr verbTableAddress; 548 Aaddr ruleTableAddress; 549 Aaddr messageTableAddress; 550 /* Miscellaneous */ 551 Aint attributesAreaSize; /* Size of attribute data area in Awords */ 552 Aint maxParameters; /* Maximum number of parameters in any syntax */ 553 Aaddr stringInitTable; /* String init table address */ 554 Aaddr setInitTable; /* Set init table address */ 555 Aaddr start; /* Address to Start code */ 556 Aword maximumScore; /* Maximum score */ 557 Aaddr scores; /* Score table */ 558 Aint scoreCount; /* Max index into scores table */ 559 Aaddr sourceFileTable; /* Table of fpos/len for source filenames */ 560 Aaddr sourceLineTable; /* Table of available source lines to break on */ 561 Aaddr freq; /* Address to Char freq's for coding */ 562 Aword acdcrc; /* Checksum for acd code (excl. hdr) */ 563 Aword txtcrc; /* Checksum for text data file */ 564 Aaddr ifids; /* Address to IFIDS */ 565 Aaddr prompt; 566 } PACKED_STRUCT; 567 568 struct Pre3_0beta2Header { 569 /* Important info */ 570 char tag[4]; /* "ALAN" */ 571 byte version[4]; /* Version of compiler */ 572 Aword uid; /* Unique id of the compiled game */ 573 Aword size; /* Size of ACD-file in Awords */ 574 /* Options */ 575 Abool pack; /* Is the text packed ? */ 576 Aword stringOffset; /* Offset to string data in game file */ 577 Aword pageLength; /* Length of a page */ 578 Aword pageWidth; /* and width */ 579 Aword debug; /* Option: debug */ 580 /* Data structures */ 581 Aaddr classTableAddress; /* Class table */ 582 Aword classMax; /* Number of classes */ 583 Aword entityClassId; 584 Aword thingClassId; 585 Aword objectClassId; 586 Aword locationClassId; 587 Aword actorClassId; 588 Aword literalClassId; 589 Aword integerClassId; 590 Aword stringClassId; 591 Aaddr instanceTableAddress; /* Instance table */ 592 Aword instanceMax; /* Highest number of an instance */ 593 Aword theHero; /* The hero instance code (id) */ 594 Aaddr containerTableAddress; 595 Aword containerMax; 596 Aaddr scriptTableAddress; 597 Aword scriptMax; 598 Aaddr eventTableAddress; 599 Aword eventMax; 600 Aaddr syntaxTableAddress; 601 Aaddr parameterMapAddress; 602 Aword syntaxMax; 603 Aaddr dictionary; 604 Aaddr verbTableAddress; 605 Aaddr ruleTableAddress; 606 Aaddr messageTableAddress; 607 /* Miscellaneous */ 608 Aint attributesAreaSize; /* Size of attribute data area in Awords */ 609 Aint maxParameters; /* Maximum number of parameters in any syntax */ 610 Aaddr stringInitTable; /* String init table address */ 611 Aaddr setInitTable; /* Set init table address */ 612 Aaddr start; /* Address to Start code */ 613 Aword maximumScore; /* Maximum score */ 614 Aaddr scores; /* Score table */ 615 Aint scoreCount; /* Max index into scores table */ 616 Aaddr sourceFileTable; /* Table of fpos/len for source filenames */ 617 Aaddr sourceLineTable; /* Table of available source lines to break on */ 618 Aaddr freq; /* Address to Char freq's for coding */ 619 Aword acdcrc; /* Checksum for acd code (excl. hdr) */ 620 Aword txtcrc; /* Checksum for text data file */ 621 Aaddr ifids; /* Address to IFIDS */ 622 } PACKED_STRUCT; 623 624 struct Pre3_0alpha5Header { 625 /* Important info */ 626 char tag[4]; /* "ALAN" */ 627 byte version[4]; /* Version of compiler */ 628 Aword uid; /* Unique id of the compiled game */ 629 Aword size; /* Size of ACD-file in Awords */ 630 /* Options */ 631 Abool pack; /* Is the text packed ? */ 632 Aword stringOffset; /* Offset to string data in game file */ 633 Aword pageLength; /* Length of a page */ 634 Aword pageWidth; /* and width */ 635 Aword debug; /* Option: debug */ 636 /* Data structures */ 637 Aaddr classTableAddress; /* Class table */ 638 Aword classMax; /* Number of classes */ 639 Aword entityClassId; 640 Aword thingClassId; 641 Aword objectClassId; 642 Aword locationClassId; 643 Aword actorClassId; 644 Aword literalClassId; 645 Aword integerClassId; 646 Aword stringClassId; 647 Aaddr instanceTableAddress; /* Instance table */ 648 Aword instanceMax; /* Highest number of an instance */ 649 Aword theHero; /* The hero instance code (id) */ 650 Aaddr containerTableAddress; 651 Aword containerMax; 652 Aaddr scriptTableAddress; 653 Aword scriptMax; 654 Aaddr eventTableAddress; 655 Aword eventMax; 656 Aaddr syntaxTableAddress; 657 Aaddr parameterMapAddress; 658 Aword syntaxMax; 659 Aaddr dictionary; 660 Aaddr verbTableAddress; 661 Aaddr ruleTableAddress; 662 Aaddr messageTableAddress; 663 /* Miscellaneous */ 664 Aint attributesAreaSize; /* Size of attribute data area in Awords */ 665 Aint maxParameters; /* Maximum number of parameters in any syntax */ 666 Aaddr stringInitTable; /* String init table address */ 667 Aaddr setInitTable; /* Set init table address */ 668 Aaddr start; /* Address to Start code */ 669 Aword maximumScore; /* Maximum score */ 670 Aaddr scores; /* Score table */ 671 Aint scoreCount; /* Max index into scores table */ 672 Aaddr sourceFileTable; /* Table of fpos/len for source filenames */ 673 Aaddr sourceLineTable; /* Table of available source lines to break on */ 674 Aaddr freq; /* Address to Char freq's for coding */ 675 Aword acdcrc; /* Checksum for acd code (excl. hdr) */ 676 Aword txtcrc; /* Checksum for text data file */ 677 } PACKED_STRUCT; 678 679 #include "common/pack-end.h" // END STRUCT PACKING 680 681 /* Error message numbers */ 682 enum MsgKind { 683 M_UNKNOWN_WORD, 684 M_WHAT, 685 M_WHAT_WORD, 686 M_MULTIPLE, 687 M_NOUN, 688 M_AFTER_BUT, 689 M_BUT_ALL, 690 M_NOT_MUCH, 691 M_WHICH_ONE_START, 692 M_WHICH_ONE_COMMA, 693 M_WHICH_ONE_OR, 694 M_NO_SUCH, 695 M_NO_WAY, 696 M_CANT0, 697 M_SEE_START, 698 M_SEE_COMMA, 699 M_SEE_AND, 700 M_SEE_END, 701 M_CONTAINS, 702 M_CARRIES, 703 M_CONTAINS_COMMA, 704 M_CONTAINS_AND, 705 M_CONTAINS_END, 706 M_EMPTY, 707 M_EMPTYHANDED, 708 M_CANNOTCONTAIN, 709 M_SCORE, 710 M_MORE, 711 M_AGAIN, 712 M_SAVEWHERE, 713 M_SAVEOVERWRITE, 714 M_SAVEFAILED, 715 M_RESTOREFROM, 716 M_SAVEMISSING, 717 M_NOTASAVEFILE, 718 M_SAVEVERS, 719 M_SAVENAME, 720 M_REALLY, 721 M_QUITACTION, 722 M_UNDONE, 723 M_NO_UNDO, 724 M_WHICH_PRONOUN_START, 725 M_WHICH_PRONOUN_FIRST, 726 M_IMPOSSIBLE_WITH, 727 M_CONTAINMENT_LOOP, 728 M_CONTAINMENT_LOOP2, 729 MSGMAX 730 }; 731 732 #define NO_MSG MSGMAX 733 734 } // End of namespace Alan3 735 } // End of namespace Glk 736 737 #endif 738