123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396 |
- /* =============================================================================
- * PROGRAM: ularn
- * FILENAME: diag.c
- *
- * DESCRIPTION:
- * Diagnostic dump module.
- *
- * =============================================================================
- * EXPORTED VARIABLES
- *
- * None
- *
- * =============================================================================
- * EXPORTED FUNCTIONS
- *
- * diag - Print diagnostic information
- *
- * =============================================================================
- */
- #include "diag.h"
- #include "dungeon.h"
- #include "header.h"
- #include "itm.h"
- #include "monster.h"
- #include "player.h"
- #include "potion.h"
- #include "scroll.h"
- #include "spell.h"
- #include "ularn_game.h"
- #include "ularn_win.h"
- /* =============================================================================
- * Local variables
- */
- /*
- * Character attribute strings.
- * The strings must match the order of the AttributeType enumeration
- */
- static char *cdef[] = {"STRENGTH",
- "INTELLIGENCE",
- "WISDOM",
- "CONSTITUTION",
- "DEXTERITY",
- "CHARISMA",
- "HPMAX",
- "HP",
- "GOLD",
- "EXPERIENCE",
- "LEVEL",
- "REGEN",
- "WCLASS",
- "AC",
- "BANKACCOUNT",
- "SPELLMAX",
- "SPELLS",
- "ENERGY",
- "ECOUNTER",
- "MOREDEFENSES",
- "WEAR",
- "PROTECTIONTIME",
- "WIELD",
- "AMULET",
- "REGENCOUNTER",
- "MOREDAM",
- "DEXCOUNT",
- "STRCOUNT",
- "BLINDCOUNT",
- "CAVELEVEL",
- "CONFUSE",
- "ALTPRO",
- "HERO",
- "CHARMCOUNT",
- "INVISIBILITY",
- "CANCELLATION",
- "HASTESELF",
- "EYEOFLARN",
- "AGGRAVATE ",
- "GLOBE",
- "TELEFLAG",
- "SLAYING",
- "NEGATESPIRIT",
- "SCAREMONST ",
- "AWARENESS",
- "HOLDMONST",
- "TIMESTOP",
- "HASTEMONST",
- "CUBEofUNDEAD",
- "GIANTSTR",
- "FIRERESISTANCE",
- "BESSMANN",
- "NOTHEFT",
- "HARDGAME",
- "",
- "",
- "",
- "",
- "",
- "VORPAL",
- "LANCEDEATH",
- "SPIRITPRO",
- "UNDEADPRO",
- "SHIELD ",
- "STEALTH",
- "ITCHING",
- "LAUGHING",
- "DRAINSTRENGTH",
- "CLUMSINESS",
- "INFEEBLEMENT",
- "HALFDAM",
- "SEEINVISIBLE",
- "FILLROOM",
- "",
- "SPHCAST",
- "WTW",
- "STREXTRA",
- "TMP",
- "LIFEPROT",
- "ORB",
- "ELVUP",
- "ELVDOWN",
- "HAND",
- "CUBEUNDEAD",
- "DRAGSLAY",
- "NEGATE",
- "URN",
- "LAMP",
- "TALISMAN",
- "WAND",
- "STAFF",
- "DEVICE",
- "SLASH",
- "ELVEN",
- "VORP",
- "SLAY",
- "PAD",
- "COKED",
- "",
- ""};
- /*
- * Names for inventory items
- */
- static char *ivendef[] = {"",
- "OALTAR",
- "OTHRONE",
- "OORB",
- "OPIT",
- "OSTAIRSUP",
- "OELEVATORUP",
- "OFOUNTAIN",
- "OSTATUE",
- "OTELEPORTER",
- "OSCHOOL",
- "OMIRROR",
- "ODNDSTORE",
- "OSTAIRSDOWN",
- "OELEVATORDOWN",
- "OBANK2",
- "OBANK",
- "ODEADFOUNTAIN",
- "OGOLDPILE",
- "OOPENDOOR",
- "OCLOSEDDOOR",
- "OWALL",
- "OTRAPARROW",
- "OTRAPARROWIV",
- "OLARNEYE",
- "OPLATE",
- "OCHAIN",
- "OLEATHER",
- "ORING",
- "OSTUDLEATHER",
- "OSPLINT",
- "OPLATEARMOR",
- "OSSPLATE",
- "OSHIELD",
- "OSWORDofSLASHING",
- "OHAMMER",
- "OSWORD",
- "O2SWORD",
- "OSPEAR",
- "ODAGGER",
- "OBATTLEAXE",
- "OLONGSWORD",
- "OFLAIL",
- "OLANCE",
- "ORINGOFEXTRA",
- "OREGENRING",
- "OPROTRING",
- "OENERGYRING",
- "ODEXRING",
- "OSTRRING",
- "OCLEVERRING",
- "ODAMRING",
- "OBELT",
- "OSCROLL",
- "OPOTION",
- "OBOOK",
- "OCHEST",
- "OAMULET",
- "OORBOFDRAGON",
- "OSPIRITSCARAB",
- "OCUBEofUNDEAD",
- "ONOTHEFT",
- "ODIAMOND",
- "ORUBY",
- "OEMERALD",
- "OSAPPHIRE",
- "OENTRANCE",
- "OVOLDOWN",
- "OVOLUP",
- "OHOME",
- "OMAXGOLD",
- "OKGOLD",
- "ODGOLD",
- "OIVDARTRAP",
- "ODARTRAP",
- "OTRAPDOOR",
- "OIVTRAPDOOR",
- "OTRADEPOST",
- "OIVTELETRAP",
- "ODEADTHRONE",
- "OANNIHILATION",
- "OTHRONE2",
- "OLRS",
- "OCOOKIE",
- "OURN",
- "OBRASSLAMP",
- "OHANDofFEAR",
- "OSPHTALISMAN",
- "OWWAND",
- "OPSTAFF",
- "OVORPAL",
- "OSLAYER",
- "OELVENCHAIN",
- "OSPEED",
- "OACID",
- "OHASH",
- "OSHROOMS",
- "OCOKE",
- "OPAD",
- ""};
- /*
- * Pointer to the debug output file
- */
- static FILE *dfile;
- /* =============================================================================
- * Local functions
- */
- /* =============================================================================
- * FUNCTION: drawdiagscreen
- *
- * DESCRIPTION:
- * Draw the ASCII map to the diag file.
- *
- * PARAMETERS:
- *
- * None.
- *
- * RETURN VALUE:
- *
- * None.
- */
- static void diagdrawscreen(void) {
- int i, j;
- MonsterIdType Monst;
- /* east west walls of this line */
- for (i = 0; i < MAXY; i++) {
- for (j = 0; j < MAXX; j++) {
- Monst = mitem[j][i].mon;
- if (Monst != MONST_NONE)
- fprintf(dfile, "%c", monstnamelist[Monst]);
- else
- fprintf(dfile, "%c", objnamelist[(int)item[j][i]]);
- }
- fprintf(dfile, "\n");
- }
- }
- /* =============================================================================
- * Exported functions
- */
- /* =============================================================================
- * FUNCTION: diag
- */
- void diag(void) {
- int i, j;
- MonsterIdType Monst;
- if ((dfile = fopen(diagfile, "w")) == (FILE *)NULL)
- return;
- Print("\nDiagnosing . . .\n");
- fprintf(dfile, "\n-------- Beginning of DIAG diagnostics ---------\n\n");
- fprintf(dfile, "Hit points: %2ld(%2ld)\n", c[HP], c[HPMAX]);
- fprintf(dfile,
- "gold: %ld Experience: %ld Character level: %ld Level in caverns: "
- "%d\n",
- (long)c[GOLD], (long)c[EXPERIENCE], (long)c[LEVEL], level);
- fprintf(dfile, "\nFor the c[] array:\n");
- fflush(dfile);
- for (j = 0; j < 100; j++)
- fprintf(dfile, "c[%d]\t%-20s\t= %ld\n", j, cdef[j], c[j]);
- fprintf(dfile, "\n\n");
- fflush(dfile);
- fprintf(dfile, "Inventory\n");
- for (j = 0; j < IVENSIZE; j++) {
- fprintf(dfile, "iven[%d] %-12s = %d", j, ivendef[(int)iven[j]], iven[j]);
- fprintf(dfile, "\t%s", objectname[(int)iven[j]]);
- fprintf(dfile, "\t+ %d\n", ivenarg[j]);
- }
- fprintf(dfile, "\nHere are the maps:\n\n");
- i = level;
- for (j = 0; j < NLEVELS; j++) {
- newcavelevel(j);
- fprintf(dfile, "\n---------------------------------------------------------"
- "----------\n");
- fprintf(dfile, "Map %s level %d\n", levelname[level], level);
- fprintf(dfile, "-----------------------------------------------------------"
- "--------\n");
- diagdrawscreen();
- fflush(dfile);
- }
- level = (char)i;
- getlevel();
- fprintf(dfile, "\n\nNow for the monster data:\n\n");
- fprintf(dfile, "\nTotal types of monsters: %d\n\n", MAXMONST + 8);
- fprintf(dfile,
- " Monster Name LEV AC DAM ATT GOLD HP EXP\n");
- fprintf(
- dfile,
- "-----------------------------------------------------------------\n");
- fflush(dfile);
- for (Monst = MONST_NONE; Monst < MONST_COUNT; Monst++) {
- fprintf(dfile, "%19s %2d %3d ", monster[Monst].name, monster[Monst].level,
- monster[Monst].armorclass);
- fprintf(dfile, " %3d %3d ", monster[Monst].damage, monster[Monst].attack);
- fprintf(dfile, "%6d %3d %6ld\n", monster[Monst].gold,
- monster[Monst].hitpoints, (long)monster[Monst].experience);
- fflush(dfile);
- }
- fprintf(dfile, "\nAvailable potions:\n\n");
- for (i = 0; i < MAXPOTION; i++)
- fprintf(dfile, "%20s\n", &potionname[i][1]);
- fflush(dfile);
- fprintf(dfile, "\nAvailable scrolls:\n\n");
- for (i = 0; i < MAXSCROLL; i++)
- fprintf(dfile, "%20s\n", &scrollname[i][1]);
- fflush(dfile);
- fprintf(dfile, "\nSpell list:\n\n");
- fprintf(dfile, "spell# name description\n");
- fprintf(dfile, "-------------------------------------------------\n\n");
- for (j = 0; j < SPELL_COUNT; j++) {
- fprintf(dfile, "%-10s", spelcode[j]);
- fprintf(dfile, " %21s\n", spelname[j]);
- fprintf(dfile, "%s\n", speldescript[j]);
- }
- fflush(dfile);
- fprintf(dfile, "\nObject list\n\n");
- fprintf(dfile, "\nj \tObject \tName\n");
- fprintf(dfile, "---------------------------------\n");
- for (j = 0; j < OCOUNT; j++) {
- fprintf(dfile, "%d \t%c \t%s\n", j, objnamelist[j], objectname[j]);
- }
- fflush(dfile);
- fprintf(dfile, "\n-------- End of DIAG diagnostics ---------\n");
- fflush(dfile);
- fclose(dfile);
- Print("\nDone Diagnosing.\n");
- }
|