From 46e21e0ad37733c5d903ecd365a113de77693bf3 Mon Sep 17 00:00:00 2001 From: GeneralGuy4872 Date: Fri, 20 Dec 2019 19:30:33 -0600 Subject: [PATCH] push commit --- src/NotesOnCompiling | 4 +- src/baserender.messy | 5 +- src/class_cleric.csv | 1 + src/class_fighter.csv | 1 + src/class_magic_user.csv | 1 + src/class_rogue.csv | 1 + src/constants.h | 35 +- src/food.messydata | 61 + src/gemstones.csv | 1 + src/greedy/astar.c | 6 +- src/greedy/dijkstra.c | 2 +- src/legend.csv | 24 + src/macro.h | 36 - src/{iwannaflycurses.messy => main.c} | 1546 +---------------- src/monster0.csv | 2 + src/monster1.csv | 1 + src/monster2.csv | 1 + src/objects.messy | 92 +- src/questdialogs/README.md | 8 + src/questdialogs/boom.c | 45 + src/questdialogs/endofthebeginning.asc.rot13 | 20 - .../endofthebeginning_rot13.depra | 28 + .../escape_newteammate_siren.ctxt | 77 + src/questdialogs/goaway.asc | 11 - src/questdialogs/goaway.depra | 12 + src/questdialogs/lightningfractal.c | 29 + src/questdialogs/{ => old}/avianquest | 0 src/questdialogs/{ => old}/knightquest | 0 src/questdialogs/{ => old}/questtemplate | 0 src/questdialogs/{ => old}/roguequest | 0 src/questdialogs/oracles.depra | 4 + src/questdialogs/trollsontheroad.c | 10 + src/questdialogs/trollsontheroad.nfo | 6 - src/questdialogs/twomasters.asc | 10 - src/questdialogs/twomasters.depra | 10 + src/questdialogs/volcanomancy.asc | 4 - src/questdialogs/volcanomancy.depra | 9 + src/render.messy | 2 +- src/roomscroll.ch | 12 + src/structs.messy | 1 - src/swapsave.c | 164 ++ src/types.h | 1295 ++++++++++++++ src/wingrender.messy | 9 +- 43 files changed, 2006 insertions(+), 1580 deletions(-) create mode 100644 src/class_cleric.csv create mode 100644 src/class_fighter.csv create mode 100644 src/class_magic_user.csv create mode 100644 src/class_rogue.csv create mode 100644 src/food.messydata create mode 100644 src/gemstones.csv create mode 100644 src/legend.csv rename src/{iwannaflycurses.messy => main.c} (51%) create mode 100644 src/monster0.csv create mode 100644 src/monster1.csv create mode 100644 src/monster2.csv create mode 100644 src/questdialogs/README.md create mode 100644 src/questdialogs/boom.c delete mode 100644 src/questdialogs/endofthebeginning.asc.rot13 create mode 100644 src/questdialogs/endofthebeginning_rot13.depra create mode 100644 src/questdialogs/escape_newteammate_siren.ctxt delete mode 100644 src/questdialogs/goaway.asc create mode 100644 src/questdialogs/goaway.depra create mode 100644 src/questdialogs/lightningfractal.c rename src/questdialogs/{ => old}/avianquest (100%) rename src/questdialogs/{ => old}/knightquest (100%) rename src/questdialogs/{ => old}/questtemplate (100%) rename src/questdialogs/{ => old}/roguequest (100%) create mode 100644 src/questdialogs/oracles.depra create mode 100644 src/questdialogs/trollsontheroad.c delete mode 100644 src/questdialogs/trollsontheroad.nfo delete mode 100644 src/questdialogs/twomasters.asc create mode 100644 src/questdialogs/twomasters.depra delete mode 100644 src/questdialogs/volcanomancy.asc create mode 100644 src/questdialogs/volcanomancy.depra create mode 100644 src/roomscroll.ch delete mode 100644 src/structs.messy create mode 100644 src/swapsave.c create mode 100644 src/types.h diff --git a/src/NotesOnCompiling b/src/NotesOnCompiling index f9af0ef..95187af 100644 --- a/src/NotesOnCompiling +++ b/src/NotesOnCompiling @@ -11,6 +11,8 @@ that this would be a pessimization in most of my use cases. files that do not require access to a global variable will use the linker; files that do will use preprocessor transclusion -via a .ch file +via a .ch file. the paradigm of existing functions needs to +be changed to switch from calling globals explicitly to passing +them at invocation as development continues. all details are subject to change, based on compiler tinkering. diff --git a/src/baserender.messy b/src/baserender.messy index 3715231..d8728aa 100644 --- a/src/baserender.messy +++ b/src/baserender.messy @@ -2,7 +2,8 @@ enttyp__normalrender (int yzindex,int cullplane) { struct enttyp * next_ent_ptr = ROOM->ent_ptr; while (next_ent_ptr != NULL) { if (raycast__visabledefault(next_ent_ptr->pos,cullplane) { - basentyp * basentity = &((montable[next_ent_ptr->race[0]->table])[next_ent_ptr->race[0]->race]); + basentyp * basentity = &(montable[next_ent_ptr->race[0]->table][next_ent_ptr->race[0]->race]); + baseclasstyp * baseclass = next_ent_ptr->class.notnull ? &(classtable[next_ent_ptr->class.role][next_ent_ptr->class.class][next_ent_ptr->class.mastery]) : NULL; char16_t this_sprite; attr_t this_attr; if (CAMERA.align) { @@ -29,7 +30,7 @@ enttyp__normalrender (int yzindex,int cullplane) { } maskset(z,y,x,ROOM->collisionmap.ents,true); if (CAMERA.dingbats) { - enttyp__wingrender(next_ent_ptr,basentity,yzindex,cullplane); + enttyp__wingrender(next_ent_ptr,basentity,baseclass,yzindex,cullplane); enttyp__sleeprender(next_ent_ptr,basentity,yzindex,cullplane); } raycast__dropshadow(next_ent_ptr->pos); diff --git a/src/class_cleric.csv b/src/class_cleric.csv new file mode 100644 index 0000000..5bff498 --- /dev/null +++ b/src/class_cleric.csv @@ -0,0 +1 @@ +"healer","cleric","priest","druid","alchemist","scholar","white mage","seer" diff --git a/src/class_fighter.csv b/src/class_fighter.csv new file mode 100644 index 0000000..4cf32c8 --- /dev/null +++ b/src/class_fighter.csv @@ -0,0 +1 @@ +"fighter","knight","paladin","valkyrie","viking","samuri","ranger","monk" diff --git a/src/class_magic_user.csv b/src/class_magic_user.csv new file mode 100644 index 0000000..a429067 --- /dev/null +++ b/src/class_magic_user.csv @@ -0,0 +1 @@ +"magic-user","wizard","illusionist","enchanter","black mage","red mage","psion","necromancer" diff --git a/src/class_rogue.csv b/src/class_rogue.csv new file mode 100644 index 0000000..32a1137 --- /dev/null +++ b/src/class_rogue.csv @@ -0,0 +1 @@ +"changeling","rogue","thief","pirate","ninja","assasin","tourist","ronan" diff --git a/src/constants.h b/src/constants.h index 9d9e975..34d41bc 100644 --- a/src/constants.h +++ b/src/constants.h @@ -65,12 +65,29 @@ #define ROOM_STACK_MAX 40 -#define ROOM_UP 02 -#define ROOM_DOWN 03 -#define ROOM_NORTH 04 -#define ROOM_SOUTH 05 -#define ROOM_EAST 06 -#define ROOM_WEST 07 -#define ROOM_UPSTAIR 012 -#define ROOM_DOWNSTAIR 013 -#define ROOM_MIRROR 01 +#define ROOM_NORTH 0 +#define ROOM_SOUTH 1 +#define ROOM_WEST 2 +#define ROOM_EAST 3 +#define ROOM_DOWN 4 +#define ROOM_UP 5 +#define ROOM_DOWNSTAIR 6 +#define ROOM_UPSTAIR 7 + +#define CAMERA_DEFAULT 0 //0000 +#define CAMERA_UP 2 //?010 +#define CAMERA_DOWN 3 //?011 +#define CAMERA_LEFT 4 //?100 +#define CAMERA_RIGHT 5 //?101 +#define CAMERA_PGUP 6 //?110 +#define CAMERA_PGDN 7 //?111 +#define CAMERA_FLAT 8 //1??? +//CAMERA_DEFAULT | CAMERA_FLAT must be corner-case handled to be 0xF instead of invalid value 0x8 + +#define BUFFER_MAX 512 +#define FLOPPYSIZE 1474560 +#define DRUMSIZE 16384 +#define BGCOLORS 8 +#define FGCOLORS 8 + +#define SQRT3 1.732050807568877293528 diff --git a/src/food.messydata b/src/food.messydata new file mode 100644 index 0000000..eee4194 --- /dev/null +++ b/src/food.messydata @@ -0,0 +1,61 @@ +foods (* = uses meta) +hardtak tortilla cornmeal cornbread +flour cheese wine bread +mead ale scotch ethenol +grapes fig date plum +apple banana apricot papaya +orange pear pinapple coconut +kiwi dragonfruit durin peach +grapefruit lemon lime citron +spinach artichoke asparagus bamboo +cucumbers zuccini pickles squash +carrot corn potato celery +brocoli lettuce cabbage kale +cauliflower raddish turnip beets +rhubarb pumpkin avacodo jalapenos +beans greenbeans tomato eggplant +blackolives greenolives garlic onions +watercress chives ketchup mustard +parsly sage rosmary thyme +basil oregano allspice nutmeg +salt bellpeppers peppercorns redpepper +vanillabean cinnimonstick cocoabean sugarbeet +walnut pecan cashew peanut +sunflowerseed pistachio almond chestnuts +cranberrys blueberrys raspberry blackberry +strawberry cherry peppermint pawpaw +sugarcane syrup* molasses honey +seseme poppy fennel eyeofnewt +mushroom* truffel penecillin yeast +barly wheat rye rice +ginger sasafrass blueraspberries bubbles +geletin starch creamoftartar bakingpowder +vinager bakingsoda calciumhydroxide hemlock +popcorn nachos cookies milk* +pasta(uncooked) pasta ramen(uncooked) ramen* +dumplings(uncooked) dumplings* tofu(uncooked) tofu +meatballs marinara alfredosauce parmisian +lasagnia* pizza* spaghetti alfredo +spaghetti&meatballs ramen&dumplings chickenalfredo brocllialfredo +guacamole nachos* chili salsa +pie* cake* soda* chips +salad* hotdog* hamburger* fries +vanilla cinnimon chocolate sugar +cocoapowder cocoabutter cocoaliquor fudge +egg fat* caramel butterscotch +sourcream butter/shortening* mayo dressing* +pie* pie_alamode* englishfruitcake bread* +cake* pancake* waffle* stackofpancakes* +frozenpancake frozenwaffle flavoredmilk* juice* +roast* gravy foo&gravy* foo_chicken* +bakedpotato loadedbakedpotato mashpotatos tatties&neeps +sunnysideup overeasy scrambled hardboiled +bacon* sausage* jerky* spam +nutbrittle* trailmix rasin* peanutbuttersandwich* +baconlettucetomatosandwich clubsandwich fingersandwich* coldcutsandwich* +milkshake* icecream* sorbet* icecreamfloat* +icecreamcone* banannasplit neopolitan rockyroad +gumdrop* hardcandy* candycane filledchocolate* +jelly* jam* preserves* peanutbutter +icecube snow ember blacksoup +broth* stew* ration mistake diff --git a/src/gemstones.csv b/src/gemstones.csv new file mode 100644 index 0000000..6efdce7 --- /dev/null +++ b/src/gemstones.csv @@ -0,0 +1 @@ +"jet","sapphire","emerald","turquoise","ruby","amythest","heliodor","diamond" diff --git a/src/greedy/astar.c b/src/greedy/astar.c index 4d1712b..f1c590f 100644 --- a/src/greedy/astar.c +++ b/src/greedy/astar.c @@ -50,7 +50,7 @@ forever { case 1 : step = 1; break; case 2 : step = diagonal2; break; case 3 : step = diagonal3; break; - default : goto(skip); + default : goto(_skip); } if ( !(( ((abs(xdiff) + abs(ydiff) + abs(zdiff)) > 1) && args.ortho) @@ -58,7 +58,7 @@ forever { (current->x + xdiff ≥ 0) && (current->y + ydiff < MAX_Y) && (current->x + xdiff ≥ 0) && - (current->z + zdiff < CEILING) && + (current->z + zdiff < OLDCEILING) && (current->z + zdiff ≥ 0) && (!(datakeeper.grid[COORDSUB(current->z + zdiff,current->y + ydiff,current->x + xdiff)].obs)) && ( ((datakeeper.grid[COORDSUB(current->z + zdiff,current->y + ydiff,current->x + xdiff)].runningdist) > (datakeeper.grid[COORDSUB(current->z,current->y,current->x)].runningdist + step)) || @@ -113,7 +113,7 @@ forever { } } -skip: +_skip: if (((current->x == pointb.x) && (current->y == pointb.y) && (current->z == pointb.z)) && !args.indecisive) {goto(breakout)} } diff --git a/src/greedy/dijkstra.c b/src/greedy/dijkstra.c index 7a92f90..30fdb44 100644 --- a/src/greedy/dijkstra.c +++ b/src/greedy/dijkstra.c @@ -39,7 +39,7 @@ forever { (current->x + xdiff ≥ 0) && (current->y + ydiff < MAX_Y) && (current->x + xdiff ≥ 0) && - (current->z + zdiff ≤ activeroom->ceiling) && + (current->z + zdiff < OLDCEILING) && (current->z + zdiff ≥ 0) && (!(datakeeper.grid[COORDSUB(current->z + zdiff,current->y + ydiff,current->x + xdiff)].obs)) && ( ((datakeeper.grid[COORDSUB(current->z + zdiff,current->y + ydiff,current->x + xdiff)].runningdist) > (datakeeper.grid[COORDSUB(current->z,current->y,current->x)].runningdist + step)) || diff --git a/src/legend.csv b/src/legend.csv new file mode 100644 index 0000000..cf60227 --- /dev/null +++ b/src/legend.csv @@ -0,0 +1,24 @@ +"truthseeker", +"sword of justice", +"excalibur", +"thunderbolt", +"sickle of chaos", +"stormbringer", +"devilfork", +"staff of tyrants", +"deathscyth", +"sunray", +"nightedge", +"staff of merlin", +"flame's edge", +"tesla's mace", +"stormgale", +"frostpike", +"trident of the seas", +"staff of the forest", +"quake hammer", +"bow of fire", +"bow of ice", +"bow of darkness", +"bow of void", +"bow of dawn" diff --git a/src/macro.h b/src/macro.h index 102c4db..b2569ff 100644 --- a/src/macro.h +++ b/src/macro.h @@ -1,21 +1,10 @@ /*TYPES*/ //ensure size names work on all systems -#define uint unsigned int -#define uchar unsigned char -#define ushort unsigned short -#define ulong unsigned long -#define 8BITPTR uint8_t - #define ≥ >= #define ≤ <= #define forever for (;;) #define END return 0;} -/* syntactic sugar for macros that are actually tailcalls - * such macros contain a return or this macro - */ -#define tailcall(X) X - #ifndef EOF #error now you're just TRYING to break stuff... #endif @@ -30,13 +19,6 @@ #define FALSE false #define False false -/*ENVIROMENTALS*/ -#define BUFFER_MAX 512 -#define FLOPPYSIZE 1474560 -#define DRUMSIZE 16384 -#define BGCOLORS 8 -#define FGCOLORS 8 - /*VERSION*/ #define ENGINE_VERSION "Prealpha" #define RULES_VERSION "Prealpha" @@ -57,28 +39,10 @@ #define MIDI_TYPE "MISSING" #endif -#define CAMERA_UP 9 -#define CAMERA_DOWN 1 -#define CAMERA_LEFT 014 -#define CAMERA_RIGHT 4 -#define CAMERA_PGUP 012 -#define CAMERA_PGDN 2 -#define CAMERA_XY 0xE -#define CAMERA_XZ 013 -#define CAMERA_YZ 0xD - -#define SCROLL_NORTH 3 -#define SCROLL_SOUTH 2 -#define SCROLL_EAST 4 -#define SCROLL_WEST 5 -#define SCROLL_UP 7 -#define SCROLL_DOWN 6 - /*FUNCTION MACROS*/ #define BACKGROUND 010 #define BALTERNOCT(X,Y,Z) ((sgn(Z) * 9) + (sgn(Y) * 3) + sgn(X)) #define COORDSUB(Z,Y,X) ((MAX_Y * Z) + (MAX_X * Y) + X) -#define SWAP(X,Y) {if (X != Y) {intptr_t sWaPtEmPoRaRy = X;Y = X;X = sWaPtEmPoRaRy}}\ // kludge so that stdio and ncurses play nice together #define RESET "\033c\033[2J\033[0H" diff --git a/src/iwannaflycurses.messy b/src/main.c similarity index 51% rename from src/iwannaflycurses.messy rename to src/main.c index 82b5674..d121bf7 100644 --- a/src/iwannaflycurses.messy +++ b/src/main.c @@ -1,26 +1,25 @@ #error NOT READY FOR INITIAL COMPILATION -/* to preserve the file history, - * this file will eventually become main.h, main.c, or util.c - * a dummy.h and dummy.c will provide externs and macros for linkage. - * some of the larger comment blocks will be moved to man, info, and/or doc +/* at the moment, this file is a scratchpad for outlining functions. + * as development progresses, these outlines will be replaced with + * tested and working equivilants. + * to preserve the file history, this file will eventually become main.c + * dummy.h will provide externs and macros for linkage. * * the bulk of it's contents, however, will be moved. * * comments may be deleted, may be moved into documentation, or may stay with what they describe * - * workflow: - * outline blackboxes top-down (-ish) - * outline pseudocode top-down (-ish) + * work process: + * outline pseudocode top-down, using blackboxes as neccisary * write real code bottom-up - * structs are made both top-down (specific) and bottom-up (generic) - * changes must be propogated both down and up * * optimized for memory footprint. speed is not a concern at the moment. - * C++ was considered and partialy implemented, but mangling made it unsuitable + * C++ was found unsuitable for the majority of the program, however + * Perl is seeming more and more of an extravagance; a C/C++ hybrid + * may be called upon to replace it. * - * the programming paradigm I am using throughout the project is based on the way my mind works - * rather than a specific programming paradigm; it contains elements from several, including some - * nonstructured paradigmes. + * the idioms and formatting I am using throughout the project are based on the way my mind works + * rather than a specific programming paradigm; I am borrowing from several. * * the program also uses various memory management paradigms, * including linked lists, stacks, queues, and page swapping. @@ -32,8 +31,8 @@ * stalest room is dropped. when warping, the room stack * is checked before an attempt is made to load another * room; when a room is recalled, it is moved to the top - * of the stack, therefore less stale rooms are able to be - * fetched faster than more stale rooms. + * of the stack, therefore (less stale) rooms are able to be + * fetched faster than (more stale) rooms. * * additional indirection layers are used in an attempt to * prevent larger data structures from being duplicated @@ -46,6 +45,28 @@ * datastructures that are being manipulated are the same ones that * are serialized and saved in the savefiles; listed in the GLOBALS * section + * + * in the documentation and comments, + * an "unbounded" array refers to + * a [0] array that resembles a + * nul-terminated string literal. + * they are used for fixed data where + * linked lists would be bloaty, but the + * size of the array is not consistent. + * + * both explicit and implicit int declarations are used. + * functions declared return either zero (ok) or + * nonzero (error) rather than a proper intergal value. + * this is akin to certain C library functions, and inverse + * to a perl sub or a function returning bool + * for the same pourpouse. + * functions that return pointers return NULL on error; + * functions returning "unbounded" arrays that cannot simply return NULL + * return an equivilant to the empty string on error. + * + * as has already been demonstrated, my comment notation uses + * programming speak in some situations. the meaning should be + * readily apparent. */ /****************************** @@ -68,20 +89,6 @@ * a game using the engine should provide the following: * - A newgame initializer perl script * - Any shared resources needed by events - * the resource files MUST follow the following naming conventions: - * - .pl for a perl script - * - .pm for a perl module - * - .so for a shared object - * - .hex or .hex## for packed unsigned byte arrays, where ## is a power of 8 - * - .bin or .bin## for packed signed byte arrays, where ## is a power of 8 - * - .r8 for a room's tilemap - * - .json for a JSON file - * - .dumper for a Data::Dumper file - * - .tsv or .tab for tab seperated values - * - .csv for comma seperated values (structs) - * - .ans for a line-seperated record - * - .txt for a plaintext block of text - * - .nfo for an ansi escaped block of text * * enviromental requirements: * - UTF-8 terminal of at least 24*80 characters @@ -112,9 +119,9 @@ * - + or - followed by a number move in xyz * - < > strafe * - backspace retreats (winged creatures also take flight) - * - spacebar advances - * - ? turns around - * - tab lunges + * - spacebar attacks + * - tab picks up items + * - enter interacts * - arrow keys, page up, page down, render a flat orthographic projection looking in that direction (free action) * When in multiview mode: * only visable tiles are rendered, other tiles are skipped instead of being rendered blinky. @@ -125,11 +132,13 @@ * - end renders only the plane including the player. takes a slice perpindicular to the camera. (free action) * - 5 idles * - F1 toggles see invisible. (free action) - * - F2 toggles dingbats (free action) - * - F3 shows sense alignment. (free action) - * - F4 shows the direction entities are facing. (free action) - * - F5 shows normal view (free action) - * - . pick up items + * - F2 shows sense alignment. (free action) + * - F3 shows the direction entities are facing. (free action) + * - F4 shows normal view (free action) + * - F5 toggles dingbats (free action) + * - . face a direction + * - . ( "<" | ">" ) rotate that direction + * - . . turn around * - \ initiates command entry. free action itself, but most commands are not. * more tbd * @@ -218,6 +227,7 @@ * * GPLv2 or later unless noted. * Perl code dual-liscensed with the Artistic Liscense unless noted. + * Do Please Distribute, All Wrongs Reversed. */ /**standard libraries**/ @@ -229,7 +239,6 @@ #include #include #include -#define SQRT3 1.732050807568877293528 #include #include #include @@ -379,35 +388,6 @@ forever { } } -struct stringlistyp { -(self) *prev -(self) *next -char* text -} -/* used to store a list of strings - * may be from a data object, or - * stored in a tsv - */ - -struct singlestringlistyp { -(self) * next -char * text -} - -struct filelinetyp { -(self) *prev -(self) *next -ushort lineno -char* text -} -// used by the line editor - -struct singlestringlistyp { -(self) * next -ushort lineno -char * text -} - /*blackbox*/loading() /* clears screen * prints " LOADING..." on line 13 @@ -479,34 +459,6 @@ return lines; *x swapping places with the other option. otherwise, the quit-abort-option3 order will be kept. */ -struct blitimgcolor { - attr_t attr[6]; - char ** img[16]; - } - /* | 0 [0] [1] [2] attr - * 0 [0] [1] [2] [3] img - * [3] [4] [5] [6] [7] - * [4] [8] [9] [10] [11] - * [5] [12] [13] [14] [15] - * - * the first row and column never have any attributes - * NULL img pointers are skipped, rather than acting as sentries - */ - -struct drawvector { - ucoord3 a; - ucoord3 b; - char16_t ch; // if set to \0, then assume that attr also holds an ascii symbol and switch accordingly. - attr_t attr; - ushort uslp; /* how long to delay between each character; calls usleep. - * there is already a miniscule delay for the stepwise pathfinder calculation - */ - } - -/* note: make function where some glyph is swept to some azimuth - * ( char16_t unichar, attr_t attrib, uchar az ¿, float dist?, ushort uslp) - */ - /**GLOBALS**/ playertyp PLAYER roomstackholder ROOMSTACK @@ -514,6 +466,7 @@ roomstackholder ROOMSTACK #define ROOM_NOT_NULL(X,Y) ((ROOM != NULL) ? X : Y) #define WORLD ROOM_NOT_NULL( ROOM->latlon , (latlontyp){0,0,0,0,0,0} ) #define CEILING ROOM_NOT_NULL( ROOM->ceiling , MAX_Z ) +#define OLDCEILING (CEILING + 1) planestackholder PLANESTACK uint64_t TURN nibbles TIMER @@ -532,7 +485,7 @@ stringlistyp *HINT_ptr eventdatastack_ele *EVSTACK_ptr qglobobj * GLOBOBJ_ptr qglobev * GLOBEV_ptr -ushort CHAPTER +chaptertyp CHAPTER bitfield globools #define NEW globools.a #define FIRST globools.b @@ -545,15 +498,6 @@ bitfield globools cameratyp CAMERA /*end GLOBALS*/ -struct turntyp: -uchar sec : 6 -uchar min : 6 -uchar hour : 5 -uchar day : 5 -uchar weekday : 3 -uchar month : 4 -ushort year : 11 - bool ticktock() { TURN++; TIMER.lo++; @@ -594,226 +538,6 @@ NIGHT = ((DATE.hour < 6) || (18 ≤ DATE.hour)) //projection, →x ↓y ↑z -typedef uchar ucoord3[3] -typedef uchar ucoord2[2] -typedef char scoord3[3] -typedef char scoord2[2] -//sentinal for an array of coord3 is {0,0,-1} - -struct lightblit { -ucoord2 pos -ucoord2 size -ushort * mask -} - -struct agetyp { -unsigned chrono : 16 -signed bio : 8 //entity dies on overflow -unsigned rem : 8 -} - -struct mapcoord3: -unsigned x : 6 -unsigned y : 5 -unsigned z : 4 -bool last : 1 - -struct nibbles { -unsigned lo : 4 -unsigned hi : 4 -} - -struct cameratyp { -unsigned dir : 4 -bool invis : 1 -bool align : 1 -bool arrows : 1 -bool dingbats : 1 -} - -struct racetyp { -intptr_t race : 8 -intptr_t table : 4 -unsigned meta : 4 - // 00-0-F is nul -} - -typedef float vector2[2] -typedef float vector3[3] -/* used for velocity, a parameter that holds - * motion that carries accross turns. this motion - * is not always cleared after being done; horizontal - * velocity persists until a tile with friction is - * encountered, while downwards vertical velocity - * accumulates and persists until the ground is encountered. - */ - -struct ray_vfx_typ { -(self) * prev -(self) * next -ucoord3 p -uchar dir //must be a valid octant -float mag -attr_t a -} - -struct polar { -unsigned az : 3 //azimuth -signed el : 2 //elevation -signed slope : 3 //negative is inverse slope, most negative is undefined. defines a cone. -unsigned r : 5 //radius -bool omni : 1 //omnidirectional -bool not : 1 //invert the mask defined by slope -bool behind : 1 //EQUATOR/2 degrees are added to azimuth -} -/* amoungst other uses, defines the cone of vision - * and used to generate magic beams - * - * for all azimuths: - * - * 701 - * 6 2 - * 543 - * - * for all elevations: - * - * +1 - * 0 ?-2? - * -1 - */ - -/* - * notetyp { - * (self) next - * unsigned evnt : 4 - * unsigned chan : 4 - * unsigned note : 8 - * unsigned velo : 8 - * clock_t delay - * } - * for interfacing with a raw midi library - * - * delay is not part of the midi data, rather, - * it tells how long to wait until sending the - * next packet. set to 0 to send immidiately. - */ - -//some specific use cases require spheres. these are simply numeric types. - -struct diceodds: -unsigned num : 3 -unsigned side : 5 -unsigned tobeat : 8 - -struct planetyp { -unsigned rho : 2 -unsigned az : 3 -signed el : 2 -char : 0 -} - -struct latlontyp { -unsigned dep : 8 -unsigned lat : 8 -unsigned lon : 9 -unsigned rho : 2 //are you plane shifted? -unsigned az : 3 -signed el : 2 -} -/* in-game altitude is given as the distance from layer 100 - * - * rho 0 is the prime plane - * rho 1 are the elemental planes - * rho 2 are afterlives - * rho 3 can be used for areas that are meant to not show up on a map. - * (said map is WIP) - * - * az elemental afterlife corrilation - * 0 water neutral good nurturer - * 1 ice chaotic good the ends justify the means - * 2 air chaotic neutral princess stealing - * 3 electricity chaotic evil force lightning - * 4 fire neutral evil obviously - * 5 metal lawful evil greed - * 6 earth lawful neutral stubborn - * 7 trees lawful good knowladge - * - * az rotates by 45 degree steps and el by 90 degree steps. - * a nonzero el causes az to gimbal lock. - * also best not to think about where exactly -2 is pointing. - * - * el " " " - * +1 light true neutral enlightenment - * -1 darkness uncomitted meh, I'll think of one later - * -2 entropy oathbreakers abandon all hope ye who enter here - * - * errors related to this section may generate one of 2 errors: - * "fell off the edge of the world", N1=±lat,N2=±lon - * "froze to death on pluto", N1=+az,N2=±el - * - * a room stack exists that keeps a number of rooms loaded - * if a room is not on the stack, it is loaded from the save file and - * pushed to the stack. this may cause the stack to intentionally drop - * the room at the bottom to prevent eating too much ram. if the file - * does not yet exist, the room is generated according to a dispatch table - * in a shared object. if the function and file are both NULL and the - * room is being entered, a lost in space death is called. if only the - * function is NULL, the file is executed in perl. if only the file is - * NULL, no shared objects are loaded before the function is called. - * - * a swap array keeps track of gating between the 23 major planes, - * saving the player's position, but not keeping the room loaded. - */ - -struct placetyp { -(self) *prev -(self) *next -eventdata eventident -char* name -latlontyp latlon -ucoord3 pos -} - -struct moneytyp { -unsigned gp : 17 -unsigned cp : 7 -} - -typedef short trackaligntyp[2] -/* neutral is the area between -10,000 and 10,000 - * alignments can be between -30,000 and 30,000 - * actions, quests, and being polymorphed into - * certain monsters can alter your alignment - * [0] is good/evil, [1] is lawful/chaotic - */ - -struct aligntyp: -good : b1 -evil : b1 -law : b1 -chaos : b1 -nogood : b1 -noevil : b1 -nolaw : b1 -nochaos : b1 -/* used as a mask. - * starting alignment must be one of the high nibble (those bit flags | true neutral if more than 1 is selected.) - * alignment may NEVER enter any of the low nibble, marked "no" - * - * there are other ways that alignment masks may be specified, - * all of which have finer grained control. - */ - -struct bitfield: -a : 1 -b : 1 -c : 1 -d : 1 -w : 1 -x : 1 -y : 1 -z : 1 - char* itemstabs[256] //stuff that doesn't go anywhere else; i.e. arrows, keys, quest items char* spellstabs[256] //spells char* weapstabs[256] //weapons @@ -827,15 +551,9 @@ basearmortyp* armtable[256] baseshldtyp* shldtable[256] baubtyp* baubtable[256] -struct ray_vfx_typ { -(self) * prev -(self) * next -ucoord3 p -uchar dir //must be a valid octant -float mag -attr_t a -} -char* legendstabs[24] = {"truthseeker"/*bow*/,"sword of justice","excalibur","thunderbolt","sickle of chaos"/*+drain*/,"stormbringer"/*+drain*/,"devilfork"/*+fire*/,"partisen of tyrants"/*+coin stealing*/,"deathscyth"/*+vampiric drain*/,"sunray"/*spear + solar flare*/,"nightedge"/*sword + moonbeam*/,"staff of merlin"/*staff of magic missile*/,"firebrand"/*burn*/,"tesla's mace"/*+spark*/,"stormgale"/*bow*/,"frostpike"/*+frostbite*/,"trident of the seas"/*+tsunami*/,"staff of the forest"/*staff of animante kudzu*/,"quake hammer","bow of fire","bow of ice","bow of darkness","bow of void","bow of dawn"}; +char* legendstabs[24] = { +#include "legend.csv" +}; legendtyp* legendtable[24]; char* psystabs[8] = {"detect alignment","charm","psychic lock","sleep","mind blast","passify","unhinge","terrorize"} @@ -844,48 +562,28 @@ char* psystabs[8] = {"detect alignment","charm","psychic lock","sleep","mind bla uchar id //switch case for each psionic ability -struct multiclasstyp: -(self) *prev -(self) *next -classtyp class -magictyp element - -struct classobjtyp: -classtyp class -magictyp element - -struct classtyp { -unsigned role : 2 -unsigned class : 3 -unsigned align : 9 -unsigned mastery : 2 -} - -char* roguestabs[8] = {"changeling","rogue","thief","pirate","ninja","assasin","tourist","ronan"} -char* fighterstabs[8] = {"fighter","knight","paladin","valkyrie","viking","samuri","ranger","monk"} -char* magicuserstabs[8] = {"magic-user","wizard","illusionist","enchanter","black mage","red mage","psion","necromancer"} -char* healerstabs[8] = {"healer","cleric","priest","druid","alchemist","scholar","white mage","seer"} - -paffect classtable[4][8] - -struct montableptr { -char *nametable[256] -basentyp *ptrtable[256] -} - -struct montableptr montable[16]; - -init__montable() { - montable[0] = {mon1stabs,mon1table}; - montable[1] = {mon2stabs,mon2table}; - montable[2] = {mon3stabs,mon3table}; - END - -char* mon1stabs[256] = -{"human", "elf", "dwarf", "gnome", "hobbit", "half elf", "drow", "siren", "half orc", "half dragon", /*half celestial*/, "tiefling", "half air elemental", "half water elemental", "half earth elemental", "half fire elemental", -"merfolk", "seaelf", "satyr", "fairy", "pixie", "naiad", "naga", "dryad", "orc", "kobald", "centaur", "sphinx", "half electric elemental", "half ice elemental", "half nature elemental", "half metal elemental", - -basentyp* mon1table[256] +char (*classnametable[8])[4] = { + { +#include "class_rogue.csv" + },{ +#include "class_fighter.csv" + },{ +#include "class_magic_user.csv" + },{ +#include "class_cleric.csv" +}} + +struct baseclasstyp classtable[4][8][4]; + +char (*monstabs[256])[16] = { +#include "monster0.csv" + },{ +#include "monster1.csv" + },{ +#include "monster2.csv" +}} + +basentyp (*montable[256])[16] = { /* contains all polymorphable monsters, of type BASENTYPE. * all C0 controls should be valid starting races, or left empty, * any polymorphable race can BECOME your base race... @@ -895,12 +593,6 @@ basentyp* mon1table[256] * commands can change your base race without negative side effects */ -char *mon2stabs[256] = {"grue", "newt", -basentyp* mon2table[256] - -char *mon3stabs[256] = {"rook", "raven", "jackdaw", -basentyp* mon3table[256] - /* MONSTERS BY LETTER * & : horned devil, balrog, jubilix, * @ : human, elf, half elf, drow, seaelf, siren, @@ -955,13 +647,13 @@ basentyp* mon3table[256] * Y : yeti, bigfoot, * y : ape, monkey, gorilla, chimp, leamur, * Z : - * = : [spoiler] * {}: /(flesh|straw|clay|stone|glass|paper|leather) golem/, /(gold|copper|finite-state) automaton/, chest monster, * ? : mystery person * «»: bass, trout, salmon, tuna, carp, pike, halibut, herring, cod * × : lizard, geko, skink, * ÷ : lobster, crab, shrimp, * £ : justice. (strictly-lawful neutral) + * ¥ : [spoiler] * ¶ : da fuzz. (lawful neutral) * Ω : [spoiler] * ⑄ : retribution. (chaotic neutral) @@ -975,7 +667,7 @@ basentyp* mon3table[256] * ⏍ : hungry chest, chest monster, *//* * ≷?≶ ≶?≷ >?< ≤?≥ ≥?≤ ≪?≫ ≫?≪ wings - * for some races, wings disappear when not flying; for others they are permenantly visable + * some wings disappear when not flying; others are permenantly visable * * z : asleep * not rendered in the pgup or pgdn views @@ -983,86 +675,9 @@ basentyp* mon3table[256] * these are rendered before (under) entities, but after tiles on each slice. */ -struct the8stats: //8* 5D6 -stren : u5 -psy : u5 -dex : u5 -con : u5 -fort : u5 -intl : u5 -wis : u5 -bluff : u5 - -struct conlangtype: -unsigned id : 5 -bool r : 1 -bool w : 1 -bool x : 1 //can be spoken - char* conlangtab[32] = {"common language","middle elvish","old elvish","dwarvish", "gnomish","gothic","orkish","draconic", "fey","celestic","demonic","blackspeech", "skyspeak","waterspeak","earthspeak","firespeak", "thieves cant",/*?*/,/*?*/,/*?*/, /*?*/,/*?*/,/*?*/,/*?*/, /*?*/,/*?*/,/*?*/,/*?*/, "electric","icespeak","treespeak","metallic"} -/* note: if the compiler complains about mixing tightly packed and loosly packed fields, - * the tightly packed ones will be split off into a seperate type with "_bitfield" affixed to - * the name, which will be placed in a consistantly-named member at the end of the struct. - * - * possible names: 1."β" 2."_b" - */ - -struct playertyp: -classobjtyp class -multiclasstyp *MULTICLASS -agetyp age -struct racetyp baserace[2] -struct racetyp polyrace -shiftertyp polycounter -ucoord3 pos -polar facing -vector3 velo -float carryover //leftover moves; never exceeds 2 -paffectyp permenent -effectyp fromequip -scoord2 align -ushort hp //they're fun and easy to...wait -ushort mp -uchar air -ushort uptime -uint32_t xp -uchar lvl -short food -moneytyp gold -heldobjtyp *lang_ptr -heldobjtyp *spell_ptr -heldobjtyp *bag_ptr -bitfield psyattack -oneobjtyp helm //any item -subobjtyp shield //shld -subobjtyp bow //weapon -subobjtyp armor //armor -subobjtyp cape //armor -subobjtyp amul //baub -armtyp * arms -legtyp * legs - -struct armtyp { -armtyp * next -subobjtyp weap[2] -subobjtyp ring[2] -subobjtyp wrist[2] -subobjtyp gloves -subobjtyp cannon -} - -struct legtyp { -legtyp * next -subobjtyp boots -subobjtyp greev -} - -enum equipenum = {ENUM_WEAP_LEFT,ENUM_WEAP_RIGHT,ENUM_SHIELD_ENUM_BOW,ENUM_ARMOR,ENUM_CAPE,ENUM_HELM, -ENUM_GLOVES,ENUM_CANNON,ENUM_BOOTS,ENUM_GREEV,ENUM_AMUL,ENUM_RING_LEFT,ENUM_RING_RIGHT,ENUM_WRIST_LEFT, -ENUM_WRIST_RIGHT} - /*blackbox*/update_player /* resets .fromequip , then iterates through the entire equipment list to regenerate it. * must be called every time equipment is changed to ensure that it is up to date @@ -1085,603 +700,10 @@ ENUM_WRIST_RIGHT} * sometimes be necissary if the global buffer is starving the system. */ -struct basentyp: -aligntyp alignmask -aggrotyp aggro //here, shiftable denotes a monster's aggro state is locked. also gives the value that patience is set to when a monster calms down, the value that cooldown is set to when it is angered, and the default AI. -paffectyp base -venomtyp venom -uchar spd //distance calculations use M_SQRT2 and local SQRT3 for diagonals -uchar hplvl -uchar mplvl -uchar xplvl -uchar airmax //how long you can hold your breath -struct conlangtyp lang0 -struct conlangtyp lang1 -uchar vocal[4] -_8BITPTR spell[4] -bitfield psyattack -char16_t sprite -attr_t attrs -char16_t altsprite -attr_t altattrs -signed size : 2 -bool mindless : 1 -bool shadow : 1 -bool incoporeal : 1 -unsigned age_rate : 8 -unsigned element : 8 -unsigned lde : 3 -/* entitys of size 1 or -2 cannot use armor. - * entitys of larger size automaticly win grapples. - * entitys of 2 sizes smaller can be picked up and thrown. - * entitys of size 1 can instakill entitys of size -2. squish. - * size 1: dragon, size 0: human, size -1: dwarf, size -2: pixie - */ - -struct aggrotyp: -bool unhinged : 1 -unsigned patience : 3 -unsigned ai_type : 4 -unsigned anger : 8 - -struct enttyp: -(self) *prev -(self) *next -npctyp * depth -agetyp age -classobjtyp class -aggrotyp aggro -struct racetyp race[2] -ucoord3 pos -polar facing -vector3 velo -float carryover -paffectyp paffect -effectyp effect -ushort hp -uchar air -uint32_t xp -uchar lvl -moneytyp gold -oneobjtyp loot -oneobjtyp helm -subobjtyp shield -subobjtyp bow -subobjtyp armor -subobjtyp cape -subobjtyp amul -armtyp * arms -legtyp * legs - -struct npctyp: -(self) *prev -(self) *next -ucoord3 * path -conlangtyp lang -char * describe -char * gibber -char ** lines // heap array of pointers - -struct followtyp: -(self) * prev -(self) * next -npctyp * depth -agetyp age -classobjtyp class -aggrotyp aggro -struct racetyp baserace[2] -struct racetyp polyrace -shiftertyp polycounter -ucoord3 pos -polar facing -vector3 velo -float carryover -paffectyp permenent -effectyp fromequip -scoord2 align -ushort hp -ushort mp -uchar air -uint32_t xp -uchar lvl -short food -moneytyp gold -heldobjtyp *spell_ptr -bitfield psyattack -oneobjtyp holding -oneobjtyp helm -subobjtyp shield -subobjtyp bow -subobjtyp armor -subobjtyp cape -subobjtyp amul -armtyp * arms -legtyp * legs - -struct spawntyp: -npctyp * depth -classobjtyp class -aggrotyp aggro -struct racetyp race -paffectyp paffect -effectyp effect -oneobjtyp loot -oneobjtyp helm -subobjtyp shield -subobjtyp bow -subobjtyp armor -subobjtyp cape -subobjtyp amul -armtyp * arms -legtyp * legs - -struct oneobjtyp { -objid type -void* data -} - -struct heldobjtyp: -(self) *prev -(self) *next -uchar stack //stack+1 items are present. lumping them together is a complicated operation. -objid type -void* data - -struct subobjtyp: -unsigned itemid : 8 -bool cursed : 1 -bool oxide : 1 -bool burned : 1 -signed bonus : 5 -intptr_t metadata : 8 //secondary _8bitPtr for legendary objects - -struct magictyp: -bool fire : 1 -bool air : 1 -bool water : 1 -bool earth : 1 -unsigned lde : 3 -bool planer : 1 - -struct shiftertyp { -unsigned polytimer : 8 //time remaining in the current polymorph. if non-zero, polyrace is used instead of baserace. -unsigned polydepth : 4 //polymorphing more than 10 times without returning to your base form first change your base form to the 15th one -unsigned polycount : 4 //repeating the same polymorph 10 times will make it permenant -unsigned altertimer : 8 //time remaining in the current alteration. -unsigned gills : 4 //using an alteration spell, including intrensics from polymorph spells, 10 times will make them permenent. -unsigned lungs : 4 //these counters can be reset by rest or spells -unsigned wings : 4 -unsigned tail : 4 -unsigned claws : 4 -unsigned fangs : 4 -unsigned talons : 4 -bodytyp alterations //keeps track of changes. if a change becomes permenent, it is moved to paffect. -} -/* non-player, non-follower entitys do not have this field, - * and any polymorph or alteration is permenent. this may be - * changed in future if memory footprint allows. - */ - -struct spelltyp: -intptr_t itemid : 8 -diceodds odds -uchar prof - -struct basespelltyp: -bool poly : 1 -bool self : 1 -unsigned lvl : 6 -magictyp type -char cost_typ : 2 //0 = at will, 1 = gold, -1 = mp, -2 = hp -unsigned cost_amnt : 6 -potiontyp effect -missiletyp delivery -intptr_t polyref : 8 - -struct psytyp: -signed cost_typ : 2 //0 = at will, 1 = gold, -1 = mp, -2 = hp -unsigned cost_amnt : 6 -potiontyp effect -missiletyp delivery - -struct missiletyp: -bool psion : 1 -bool vamp : 1 -unsigned damage : 8 -signed recoil : 7 -unsigned spread : 2 //0 = line, 1 = narrow (1:3), 2 = wide (1:2), 3 = very wide (1:1) -unsigned splash : 3 //radius of damage on impact -bool spz : 1 //spread and splash in the z plane. -bool dig : 1 -//if (.spread != 0), slope = 4-.spreaad - -struct baseweaptyp: -bool fire : 1 -bool air : 1 -bool water : 1 -bool earth : 1 -bool entro : 1 -bool light : 1 -bool dark : 1 -bool fireproof : 1 -bool waterproof : 1 -bool elecproof : 1 -bool iceproof : 1 -bool warded : 1 -bool illum : 1 -unsigned skill : 3 -unsigned damage : 8 - -legendtyp: -paffectyp magic -symtableref base -symtableref spell -legendflagtyp flags - -legendflagtyp: -bool fire : 1 -bool air : 1 -bool water : 1 -bool earth : 1 -bool entro : 1 -bool light : 1 -bool dark : 1 -bool fireproof : 1 -bool waterproof : 1 -bool elecproof : 1 -bool iceproof : 1 -bool warded : 1 -bool unbreak : 1 -bool infinate : 1 -bool spelled : 1 -bool vamp : 1 -bool drain : 1 -bool interest : 1 -bool useless : 1 -unsigned powermag : 5 - -struct basearmortyp: -effectyp effect -uchar def -uchar spdef -uchar extfort - -struct baseshldtyp: -bool fireproof : 1 -bool waterproof : 1 -bool elecproof : 1 -bool iceproof : 1 -bool reflect : 1 -bool entro : 1 -bool light : 1 -bool dark : 1 -effectyp effect -unsigned def : 8 -unsigned spdef : 8 - -struct bodytyp: -bool gills : 1 //affects breathing underwater -bool wings : 1 //affects flying -bool tail : 1 //affects unarmed attacks, swimming, flying -bool claws : 1 //affects unarmed attacks, writing -bool hoof : 1 //affects walking, swimming, unarmed attacks -bool talon : 1 //affects walking, swimming, unarmed attacks -bool fangs : 1 //affects unarmed attacks -bool legs : 1 //affects walking, swimming, unarmed attacks -bool arms : 1 //affects walking, swimming, unarmed attacks, writing -bool nolungs : 1 //affects breathing above water -bool noswim : 1 //affects swimming -bool nofly : 1 -bool atktail : 1 //affects unarmed attacks, swimming, flying -bool atkwing : 1 //affects unarmed attacks, swimming, flying -signed atkbite : 2 //affects unarmed attacks; +1 = swallow, -1 = bite, -2 = bite ɛ⃓ breath -bool wingoveride : 1 //needed because the next paramaters can't simply be maxed/ORed together -bool permwings : 1 -bool wingsign : 1 -unsigned wingtype : 2 -char : 0 - -struct venomtyp { -elixtyp claws -elixtyp talon -elixtyp fangs -elixtyp tail -elixtyp passive -} - -struct stattyp: -dizzy : u3 -psn : u4 -prlz : u4 -frz : u4 -brn : u4 -stone : s8 //inverse one's complement; 0x00 is inactive (-0), 0xFF is dead (+0). overflows can be used to extend time to live -slime : s8 //inverse one's complement; -slp : u8 -invis : u6 -blind : u8 -eaten : s7 //inverse one's complement; - -struct elixtyp: -dizzy : 1 -psn : 1 -prlz : 1 -frz : 1 -brn : 1 -stone : 1 -slp : 1 -invis : 1 - -struct cursetyp: -stattyp type -uchar polytimer -intptr_t poly : 8 - -struct resistyp: -bool fireproof : 1 -bool waterproof : 1 -bool elecproof : 1 -bool iceproof : 1 -bool stoneproof : 1 -bool polyproof : 1 -bool sleepproof : 1 -bool poisonproof : 1 - -struct sensetyp: -bool trouble : 1 -bool invis : 1 -bool infra : 1 -bool blind : 1 -bool good : 1 -bool evil : 1 -bool law : 1 -bool chaos : 1 - -struct effectyp: -the8stats eight -bodytyp shape -stattyp stat -resistyp resist -sensetyp sense -skilltyp skill -char atk -char spatk -char def -char spdef - -struct paffectyp -the8stats eight -bodytyp shape -nibbles n_arms_legs -elixtyp ails_ya -resistyp resist -sensetyp sense -skilltyp skill -char atk -char spatk -char def -char spdef - -struct potiontyp: -bodytyp shape -elixtyp ails_ya -cursetyp curse -resistyp resist -sensetyp sense -short hp -short mp -diceodds odds - -struct skilltyp: -unsigned sword : 3 //+skill to sword-type weapon attack -unsigned knife : 3 //+skill to knife-type weapon attack -unsigned stave : 3 //+skill to stave-type weapon attack -unsigned spear : 3 //+skill to club-type weapon attack -unsigned whip : 3 //+skill to whip-type weapon range (unused range added to attack) -unsigned club : 2 //+skill to club-type weapon attack -unsigned bow : 4 //+(2 * skill) to bow-type weapon range -unsigned throw : 4 //+(2 * skill) to javalin-type weapon range -unsigned monk : 4 //+(2*skill) to unarmed attack, unlocks more modes of attack. -unsigned shield : 3 //skill in (damage-defense)+abs(damage-defense) chance of blocking -unsigned locks : 3 //1 in 2^(lock.level - (skill)) chance of picking -unsigned caster : 6 //-(skill-1)/4 to casting cost, +(skill-1)/4 to spatk and spdef, unlocks spells, 0 is non-caster -bool swim : 1 //learned in shallow water; may be lost by polymorphing to a form with different locomotion. -bool walk : 1 //learned on land; may be lost by polymorphing to a form with different locomotion. -unsigned fly : 2 //0 = never had wings, 1 = slow falling, 2 = cannot gain altitude, 3 = free flight. lvl1 learned by falling - -/* damage = MAX( incoming-defense , 0 ) - * - * polyshock = base.hplvl - ((poly.hplvl * (util__roll(1,20,1) / 20)) * util__roll(1,3,0)) - * ⎧if n < -HPMAX : Instakill (deathmessage: miscalculated a crucial equivilant-exchange parameter,hath choose...poorly) - * ⎪if n = -HPMAX : Stoning - * ⎨if -HPMAX < n < 0 : abs(n) Damage (deathmessage: could not withstand the cost of transmutation) - * ⎪if n = 0 : stun for 1D16 (standardmessage: your mind reels from the transformation...) - * ⎩if n > 0 : success - * - * writing = - * succeed if 4D6 < dex if !talons, break pen on fail if 1D20 < stren - * succeed if 6D6 < dex if talons, break pen on fail if coinflip - * talons can engrave without tools - */ - -readtyp: -unsigned locale : 6 -bool multiuse : 1 -bool scroll : 1 -unsigned subject : 2 //0 = cooking, 1 = weapons, 2 = language, 3 = spellcraft -unsigned uses : 6 -void* contents - char* wandmaterials[16] = {"oak","ash","yew","honeylocust","silver","bronze","iron","orichalcum","marble","bone","dragon fang","unicorn horn","glass","lead crystal","adamantine","stardust"} //stoning -> marble -wandtyp: -unsigned matter : 4 -unsigned uses : 4 -intptr_t bound : 8 - char* baubmaterials[8] = {"yew","bronze","silver","gold","soapstone","ivory","obsidian","stardust"} //stoning -> soapstone -baubtype : -signed type : 2 //0=ring, 1=bracelet, -1=amulet, -2=tiara -unsigned matter : 3 -unsigned color : 3 -paffectyp enchnt - -struct roomneighbors { -bool north -bool south -bool east -bool west -bool up -bool down -bool upstair -bool downstair -latlontyp north -latlontyp south -latlontyp east -latlontyp west -latlontyp up -latlontyp down -} - -struct roomtyp: //top-down display of a 3d space -latlontyp latlon -tileset *hightiles -char* tiledata[][MAX_Y][MAX_X] -unsigned ceiling : 4 -unsigned bgcolor : 3 -bool visited : 1 -shadowmask seen -shadowmask light -collimaptyp collimap -encontyp *encon_ptr -enttyp *ent_ptr -eventtyp *ev_ptr -mapobjtyp *obj_ptr -ray_vfx_typ *ray_ptr -char lightsource //must be a valid octant -ucoord3 * path_ptr -ucoord2 downstair -ucoord2 upstair -ucoord3 home -struct roomneighbors neighborhood -/* if invalid coords are given for a warp (typically {$FF,$FF}), - * then the player is dumped at the location indicated by home. - * - * if the player has invalid coords, then the error string "fell out of terminal",N1=x,N2=y is generated. - */ - -/* the world of the game will be referred to using two different grids of - * discreet coordinates. the primary grid is the cell space, which is - * interleaved octohedrally with the boundry space, such that if a given - * diminsion in cell space has n points, the same dimension in boundry - * space has n+1 points. the cell space referes to the cells that are - * displayed (the "cells"), while the boundry space referes to their - * boundries. exact boundry space coordinates are not expected to be used; - * only planes and polytopes are meaningful in boundry space. - * - * some notable uses of boundry space are in describing the emulated - * cull plane of the "camera", and as the boundries of a given room. - */ - -struct subroomtyp: //used by mapgen -char tiledata[MAX_Z][MAX_Z][MAX_Z] //cube of MAX_Z -ucoord3 dim -enttype *ent_ptr -mapobjtyp *obj_ptr - -/* *.bin : signed binary data that is organized into 8 bit segments - * *.bin# : signed binary data that is organized into n bit segments - * *.hex : unsigned binary data that is organized into 8 bit segments - * *.hex# : unsigned binary data that is organized into n bit segments - * *.r8 : the tilemap of a room - * *.csv : UTF-8 text record deliminated with commas and line breaks - * *.tsv : UTF-8 text record deliminated with tabs and line breaks - * *.tab : same as tsv - * *.so : a shared object. a game may use as many of these as it wants. Placing single-use functions in LD_LOAD_PATH is DISCOURAGED; they should be placed in the game's private files. - * *.ini : data from inside a savefile - * *.json : produced when a dump is requested - * *.dumper : a self-reassembling perl datastructure - * *.asc : UTF-8 text record delimenated by newline. - * *.txt : UTF-8 text document. usually stored in the program's static files, which is CAT-ed to provide dialouge; also used in dumps of primatives - * *.ans : UTF-8 text record containing SGR sequences deleminated by newline. - * *.nfo : UTF-8 text document (not CP437) containing SGR sequences. otherwise identical to asc. - * **.rot13 : an encrypted text file, containing major spoilers. - * *.tar.gz : each room is saved as a tar.gz file, as are linked lists and the player. rooms are divided into compressed files for each plane. the extra planes are tar.gz files named rho_az_el - * *.tar.bz2 : a savefile is a tar.bz2 file. it is named %H_%M_%S__%d_%m_%Y. the 23 main planes are tar.bz files named rho_az_el - * *.man.# : a linux manpage - * *.mdoc.# : a bsd manpage - * * : documentation - * *.html : documentation - * *.texinfo : documentation - * *.pl : a perl script - * *.pm : a perl module - * *.PL : a build-related perl script - * *.pod : perl documentation - * *.d : everything relating to a struct is stored in the same directory, and pointers to structs are stored as subdirectories with the name of that field. the tail element in a linked list has no subdirectory named "next"; "prev" pointers are "../" implicitly. - * *.conf : a configuration file. - * *.*rc : a user's configuration file. - * *.dumper : a debugger data dump, with a format somwhere between JSON, INI, and C-like pseudocode. essentialy a dat file in readable (and non-raw) format. - * - * if the following new extensions collide with anything, I will change them. I specifically chose ones that were not a TLA or EFLA to try and avoid this, because there have been TDMTLA since before I came along. - * *.midibas : midiBASIC, to be parsed by the midi generator into a .h file. Represents a different subset of general midi than regular midi files, but does so in a human readable format. - */ - -/* dat file format: - * SOH name BEL = struct field key - * STX string ETX = an ascii text field, can contain ESC - * DLE s8bit raw_data = a numeric field, abs(n) bits long. a negative number indicates the field is signed. - * ACK = true - * NAK = false - * SUB = -1 - * NUL = empty string - * XON path XOFF = a pointer to the data at path - * ENQ = is a pointer - * SYN = start an array or add a diminsion to the array - * structs are terminated with ETB - * arrays may have up to 4 dimensions seperated with FS GS RS and US. - * arrays are ended with EM. - */ - -struct mapgen_bordertyp { -tileset *hightiles_n -char north[MAX_Z][MAX_X] -tileset *hightiles_s -char south[MAX_Z][MAX_X] -tileset *hightiles_e -char east[MAX_Z][MAX_Y] -tileset *hightiles_w -char west[MAX_Z][MAX_Y] -tileset *hightiles_ne -char northeast[MAX_Z] -tileset *hightiles_nw -char northwest[MAX_Z] -tileset *hightiles_se -char southeast[MAX_Z] -tileset *hightiles_sw -char southwest[MAX_Z] -tileset *hightiles_u -char up[MAX_Y][MAX_X] -tileset *hightiles_d -char down[MAX_Y][MAX_X] -} -/* only used during mapgen, freed immediatly since it's so huge - * up and down do not need secondary directions as the map cannot be scrolled that way - */ - -typedef ushort shadowmask[MAX_Y][MAX_X] -typedef bitfield starfield[MAX_Y][MAX_X/8] - -typedef ushort collisionmapcols[MAX_Y+2][MAX_X+2] -typedef uchar collisionmapholes[MAX_Y][MAX_X/8] - -struct collisionmaptyp { - collisionmapcols solid - shadowmask liquid - collisionmapholes holes - shadowmask ents - } - set_collision_map (roomtyp * this,char x,char y,char z,bool q) { if (z < this->ceiling) { if (q) { @@ -1758,63 +780,6 @@ set_collision_map (roomtyp * this,char x,char y,char z,bool q) { } return ERR;} -typedef tilemeta* tileset[128] - -struct tilemeta { -bool ladder : 1 -bool solid : 1 -bool liquid : 1 -bool conductive : 1 -bool burns : 1 -bool hypotherm : 1 -bool sharp : 1 -bool entropy : 1 - -bool shiney : 1 -bool slip : 1 -signed speed : 2 - -bool freezes : 1 -bool melts : 1 -bool petrif : 1 - -bool dig : 1 -bool fence : 1 - -intptr_t freeze : 8 -intptr_t melt : 8 -intptr_t stone : 8 -unsigned density - -bool blink : 1 -unsigned color : 6 - -char16_t unichar : 16 -} -/* tiles can be effected by stuff happening around them. - * - * if a tile is flammable, a fire is summoned when fire magic - * enters the space or 1d6 chance if there is fire within 1 taxicab of it. - * - * if a tile is conductive, then electricity is summoned for the instant - * that electrical magic strikes it, and propagates through contiguous tiles. - * - * if a tile can freeze, it's _8BITPTR is changed to the number indicated by ice. - * when ice magic intersects it. - * - * if a tile can melt, it's _8bitPtr is changed to the number indicated by melt - * when fire or electrical magic intersect it. - * - * if a tile can be petrified, it is changed to the tile indicated by stone. - * - * if a tile can be dug, using a ↧digging tool on it will remove it - * digging something triggers updates which cause gravity to affect gases (!liquid,!solid), - * liquids(+liquid,!solid), and granulars(+liquid,+solid), wherin less dense - * tiles will swap with more dense ones. this effect travels outwards, to the edge of the room, - * but will not be applied to the border tiles. in the default set, water has a density of 10, snow - * has a density of -1, and air has a density of -100. - */ - /*pseudocode*/getsym { if (sym < 0) @@ -1827,233 +792,9 @@ char16_t unichar : 16 } } -mapobjflags: -bool hidden : 1 -bool moves : 1 -bool rclass : 1 -unsigned class : 4 -unsigned alignment : 9 - -struct mapobjtyp: -(self) *prev -(self) *next -eventdata eventident -ucoord3 pos -objid type -void* data -mapobjflags flags - -struct signtyp { -char16_t unichar -conlangtyp lang -char* lines -char* gibber -} - -struct chestyp: -heldobjtyp *bag_ptr -cursetyp curse -locktype locked - -struct doortyp { -bool open : 1 -unsigned hp : 7 -locktype lock : 8 - -struct locktype { -bool locked : 1 -bool level : 3 -bool pin1 : 1 -bool pin2 : 1 -bool pin3 : 1 -bool pin4 : 1 -trapflag flags : 8 -/* lockpicking requires the player to enter - * 0 and + in the correct order to turn the - * tumblers. in addition to making the correct - * guess, one must make a skill check: - * 1 in 2^(lock.level - (skill/2)) chance - * - * lockpicking will play an ascending chromatic - * scale on a loop, starting on C3 and ending - * at G3, on synthbass (triangle wave) - */ - -struct encontyp { -(self) *prev -(self) *next -eventdata eventident -uchar tobeat //of 10D20 -spawntyp spawn - -struct miscitembasetyp: -bool key : 1 -bool pick : 1 -bool dig : 1 -bool music : 1 -bool light : 1 -bool book : 1 -bool spark : 1 -bool quest : 1 -bool fireproof : 1 -bool waterproof : 1 -bool elecproof : 1 -bool iceproof : 1 -bool stoneproof : 1 -bool arrow : 1 -bool poisoned : 1 -bool unbreak : 1 -unsigned uses : 8 -intptr_t metadata : 8 - -struct eventdata { //48-bit persistant event data -unsigned identnumber : 15 -bool uses_race : 1 -bool uses_role : 1 -bool uses_class : 1 -unsigned race : 5 -unsigned role : 2 -unsigned class : 3 -unsigned align : 9 -unsigned element : 8 -unsigned lde : 3 -} - -struct eventdatastack_ele { //list of events -(self)* prev -(self)* next -eventdata data -char * heylisten -eventdatastack_garbage * head -eventdatastack_garbage * tail -} - -struct eventdatastack_garbage { -(self) * next -(self) * prev -objid type -void * data -} - -enum eventdatastack_objid = { -EDS_ROOMOBJ_FLAG -EDS_QGLOBOBJ_FLAG -EDS_EVENTTYP_FLAG -EDS_QGLOBEV_FLAG -EDS_ENCONTYP_FLAG -EDS_PLACETYP_FLAG -} - -struct eventtyp: -(self) *prev -(self) *next -ucoord3 pos -eventdata eventdatavals -triggertyp whenthis -const char* dothis //object to be loaded. must be a shared object with C linkage; but not necissarily one written in C. if NULL, is a built-in function. -int (*doit)(union unitype,union unitype,union unitype,union unitype) -unsigned radius : 7 -bool show : 1 -unsigned up : 4 -unsigned down : 4 -uint32_t duration - -enum triggerenum {ALWAYS_FLAG,ILLUM_FLAG,LOOK_FLAG,FARLOOK_FLAG,BUMP_FLAG,HIT_FLAG,FIRST_FLAG,NEW_FLAG,DAY_FLAG,TIME_FLAG,MORN_FLAG,NOON_FLAG,EVE_FLAG,MIDNITE_FLAG,DAY_FLAG,NIGHT_FLAG} - -struct triggertyp { -triggerenum key : 4 -unsigned value : 4 -} - -struct qglobobj: //queued global object -(self) *prev -(self) *next -eventdata eventident -qglobflags flags -latlontyp latlon -ucoord3 pos -objid type -void* data - -struct qglobev: //queued global event -(self) *prev -(self) *next -qglobflags flags -latlontyp latlon -ucoord3 pos -eventdata eventdatavals -triggertyp whenthis -const char* dothis //object to be loaded. must be a shared object with C linkage; but not necissarily one written in C. if NULL, is a built-in function. -int (*doit)(union unitype,union unitype,union unitype,union unitype) -unsigned radius : 7 -bool show : 1 -unsigned up : 4 -unsigned down : 4 -uint32_t duration - -struct qglobflags { -struct racetyp race -race-specific : 1 -role : u2 -class : u3 -lawfulgood : 1 -neutralgood : 1 -chaoticgood : 1 -lawfulneutral : 1 -trueneutral : 1 -chaoticneutral : 1 -lawfulevil : 1 -neutralevil : 1 -chaoticevil : 1 -canforceload : 1 -} - -struct traptyp: -char16_t unichar -ushort duration -magictyp element -stattyp stat -cursetyp curse -diceodds odds -trapflags flags -sensetyp sense -short hp -short mp - -struct trapflags: -bool fireproof : 1 -bool waterproof : 1 -bool elecproof : 1 -bool iceproof : 1 -bool tamperproof : 1 -bool stoneproof : 1 -bool warded : 1 -bool mode : 1 -aligntyp attacks : 8 //if mode is true, will only attack entitys that are of an alignment that is undefined or true; if mode is false, will not attack entitys with alignment that is undefined or false -bool multiuse : 1 -bool magic : 1 //whether the trap is a mechanism or a rune -unsigned color : 6 - -struct subwarptyp { -bool perm : 1 -bool blink : 1 -unsigned color : 6 -ucoord3 pos -ucoord3 * dest -short duration //negative are uses, positive are turns -} - -struct warptyp: -bool perm : 1 -bool blink : 1 -unsigned color : 6 -latlontyp glob_loc -ucoord3 pos -latlontyp glob_dest -ucoord3 * dest -short duration - -char* gemcolors[8] = {"jet","sapphire","emerald","turquoise","ruby","amythest","heliodor","diamond"} //stoning has no effect +char* gemcolors[8] = { +#include "gemstones.csv" +} //stoning has no effect /* cut varys by color: * diamond = {uncut,cushion-cut,princess-cut,perfect-cut} * beryls,emerald={uncut,oval-cut,emerald-cut,teardrop} redundancy of emerald-cut emerald is redundant @@ -2061,53 +802,6 @@ char* gemcolors[8] = {"jet","sapphire","emerald","turquoise","ruby","amythest"," * jet,turquoise={piece of,byzantine,polyhedral,carved relif in} */ -struct gemstonetyp: -unsigned color : 3 -unsigned quality : 2 -unsigned cut : 2 - -struct meattyp: -struct racetyp race -uchar sellby -uchar amount - -struct foodtyp: -intptr_t itemid : 8 -intptr_t metadata : 8 -unsigned sellby : 8 -unsigned amount : 8 - -foodbasetyp: -effectyp effect -diceodds odds -uchar keepsfor //0 means non-perishable -uchar hp -uchar nutri - -enum objid: -WEAPON_FLAG : contains subobjtyp calling baseweaptyp -LEGEND_FLAG : contains subobjtyp calling baseweaptyp -POTION_FLAG : contains potiontyp -READ_FLAG : contains readtyp -FOOD_FLAG : contains subobjtyp containing foodtyp -MEAT_FLAG : contains subobjtyp containing meattyp -ARMOR_FLAG : contains subobjtyp calling basearmortyp -SHLD_FLAG : contains subobjtyp calling baseshldtyp -BAUB_FLAG : contains subobjtyp calling baubtyp -CONLANG_FLAG : contains conlangtyp -SPELL_FLAG : contains spelltyp -MISC_FLAG : contains _8bitPtr -GEM_FLAG : contains gemstonetyp -TRAP_FLAG : contains traptyp -WARP_FLAG : contains warptyp -SUBWARP_FLAG : contains subwarptyp -CHEST_FLAG : contains chestyp -DOOR_FLAG : contains doortyp -LOCK_FLAG : contains locktyp (gates are this) -MONEY_FLAG : contains moneytyp -SPAWN_FLAG : contains spawntyp -SIGN_FLAG : contains signtyp - /*blackbox*/radius /* uses floats to define a circle, * terminating when there is not enough @@ -2123,17 +817,14 @@ layers are drawn from ground to sky; if the player or their shadow would be cove drawing is stopped and the player is drawn if they have not been already fluid tiles are transparent. -to avoid confusion, by default the player always uses a unique character: ☻ -if so, then ☺ is used for your dopplganger. -whether or not these symbols are used must be decided at library compile time - symbols that are white or black based on being filled or unfilled might be switchable at startup in the same way as tilde vs tilde operator depening on difficulty of implementing such, characters might be stored in a lookup table that stores indexes between an anything and a unicode codepoint. this would require a byte encoding scheme for peeking anythings between runtimes, which is problematic considering -the existing 2 ways require either names or pointers +the existing 2 ways require either names (being computationally expensive), +or pointers (which are volatile state) an UNDERLINE is a shadow @@ -2145,13 +836,13 @@ note: unicode symbols are (mostly) used be their appearence, not by their meanin ¡ is a wand. ♮ ⇫ ⇪ is a ladder. ⋎ is a fountain or gyser. ⍾ is a bell. ⎋ is a clockface. ♠ ♣ ‡ are trees. ⋏ is fire. ♜ is a pedestal. ≋ is deep liquid's surface. ∬ is a waterfall. ≈ is a shallow liquid's surface, or a deep liquid below surface. ~ (centered) is a puddle. ≣ is a staircase. ⌁ is electricity. * is ice. ⎈ spider web. ⌬ beehive. ↥ are spikes. ⎙ ⍝ ⎍ ∎ ⎅ are tombstones or signs. ␥ is glass. -• is a boulder. . is a rock. : is a rockslide. ◇ is a gemstone. ◊ is a giant magic crystal. ? is somone wearing a cowled cloak. +• is a boulder. . is a rock. ⑆ is a rockslide. ◇ is a gemstone. ◊ is a giant magic crystal. ? is somone wearing a cowled cloak. ∪ is a sink. ⏍ is a chest. ↯ is the thunderbolt. ∅ is a spacetime anomaly (do not touch). ⍍ ⍔ are level stairs. ⇡ ⇣ ← ↑ → ↓ ↖ ↗ ↘ ↙ are flying projectiles, or facing direction. ⇐ ⇑ ⇒ ⇓ ⇖ ⇗ ⇘ ⇙ are ballistae. ✪ is a rune. ː ˑ are traps. -# █ ▓ ▒ ░ ▞ ▚ ⑆ (etc) are thick walls or floor. ☁ ≎ are clouds. ☈ is a thundercloud (keep your head out of them). -^ ␣ are holes. , is a plant. ; is a grain or sunflower (impassable). ⌸ is a door or gate. ⍯ is a locked door. ⎕ is an open door. -box drawings are low walls or columns. ¦ ⑉ are iron bars. / \ " are sunbeams. -⍽ is mud. ≃ ≊ is stagnent water (unbreathable). ¤ is a mirror. ♄ is an antimagic field. +# █ ▓ ▒ ░ ▞ ▚ ⣿ (etc) are thick walls or floor. ☁ ≎ are clouds. ☈ is a thundercloud (keep your head out of them). ⁂ is fog. +^ ␣ are holes. , is a plant. ; is a grain or sunflower (impassable). ⌸ is a door. ⍯ is a locked door. ⎕ is an open door. +box drawings are low walls or columns. ¦ ⑉ are iron bars. / \ " are sunbeams. = is a gate. ≠ is a locked gate. : is an open gate +⍽ is mud. ≃ ≊ is stagnent water (unbreathable). ☯ is a reflecting pool. ⍬ is a mirror. ♄ is an antimagic field. a prompt at launch uses user responce to choose between using ~ or ∼ for centered tilde. handling of solid vs outlined symbols will use the solid symbol for a forground different from the background, @@ -2175,7 +866,7 @@ and will use the full range of ANSI SGR escape codes rune symbols ◬ air, ⍫ earth, △ fire, ▽ water -⋇ ice, ☇ electricity, ⇡ metal, ♻ nature +⋇ ice, ☇ electricity, ↥ metal, ♻ nature ❖ ☣ status effects, ∅ entropy ☼ light, ☽ dark, § polymorph, ↹ planer ♥ healing @@ -2193,67 +884,6 @@ directional symbols: ◬, ⍫, △, ▽, ⋇, ↯, ♤, ♻, ☼, ☽, ∅, inner planes; LG, NG, CG, LN, CN, LE, NE, CE, TN, UN, ☠, outer planes; -foods (* = uses meta) -hardtak tortilla cornmeal cornbread -flour cheese wine bread -mead ale scotch ethenol -grapes fig date plum -apple banana apricot papaya -orange pear pinapple coconut -kiwi dragonfruit durin peach -grapefruit lemon lime citron -spinach artichoke asparagus bamboo -cucumbers zuccini pickles squash -carrot corn potato celery -brocoli lettuce cabbage kale -cauliflower raddish turnip beets -rhubarb pumpkin avacodo jalapenos -beans greenbeans tomato eggplant -blackolives greenolives garlic onions -watercress chives ketchup mustard -parsly sage rosmary thyme -basil oregano allspice nutmeg -salt bellpeppers peppercorns redpepper -vanillabean cinnimonstick cocoabean sugarbeet -walnut pecan cashew peanut -sunflowerseed pistachio almond chestnuts -cranberrys blueberrys raspberry blackberry -strawberry cherry peppermint pawpaw -sugarcane syrup* molasses honey -seseme poppy fennel eyeofnewt -mushroom* truffel penecillin yeast -barly wheat rye rice -ginger sasafrass blueraspberries bubbles -geletin starch creamoftartar bakingpowder -vinager bakingsoda calciumhydroxide hemlock -popcorn nachos cookies milk* -pasta(uncooked) pasta ramen(uncooked) ramen* -dumplings(uncooked) dumplings* tofu(uncooked) tofu -meatballs marinara alfredosauce parmisian -lasagnia* pizza* spaghetti alfredo -spaghetti&meatballs ramen&dumplings chickenalfredo brocllialfredo -guacamole nachos* chili salsa -pie* cake* soda* chips -salad* hotdog* hamburger* fries -vanilla cinnimon chocolate sugar -cocoapowder cocoabutter cocoaliquor fudge -egg fat* caramel butterscotch -sourcream butter/shortening* mayo dressing* -pie* pie_alamode* englishfruitcake bread* -cake* pancake* waffle* stackofpancakes* -frozenpancake frozenwaffle flavoredmilk* juice* -roast* gravy foo&gravy* foo_chicken* -bakedpotato loadedbakedpotato mashpotatos tatties&neeps -sunnysideup overeasy scrambled hardboiled -bacon* sausage* jerky* spam -nutbrittle* trailmix rasin* peanutbuttersandwich* -baconlettucetomatosandwich clubsandwich fingersandwich* coldcutsandwich* -milkshake* icecream* sorbet* icecreamfloat* -icecreamcone* banannasplit neopolitan rockyroad -gumdrop* hardcandy* candycane filledchocolate* -jelly* jam* preserves* peanutbutter -icecube snow ember blacksoup -broth* stew* ration mistake /*blackbox*/playervelocitycheck() velocitycheck(*entity) /* if you have a nonzero velocity vector, when you try to move @@ -2289,6 +919,7 @@ broth* stew* ration mistake - if you are, adds {-xmove,-ymove,-zmove} to your velocity (half this value in liquids) + roomscroll(direction,stairs) uchar direction bool stairs @@ -2523,7 +1154,6 @@ sleep(4); init__main() { termcheck(); TILDEWIDE = setwidetilde(); -init__montable(); } main() { diff --git a/src/monster0.csv b/src/monster0.csv new file mode 100644 index 0000000..a587c3c --- /dev/null +++ b/src/monster0.csv @@ -0,0 +1,2 @@ +"human", "elf", "dwarf", "gnome", "hobbit", "half elf", "drow", "siren", "half orc", "half dragon", /*half celestial*/, "tiefling", "half air elemental", "half water elemental", "half earth elemental", "half fire elemental", +"merfolk", "seaelf", "satyr", "fairy", "pixie", "naiad", "naga", "dryad", "orc", "kobald", "centaur", "sphinx", "half electric elemental", "half ice elemental", "half nature elemental", "half metal elemental", diff --git a/src/monster1.csv b/src/monster1.csv new file mode 100644 index 0000000..cce7af4 --- /dev/null +++ b/src/monster1.csv @@ -0,0 +1 @@ +"grue", "newt", diff --git a/src/monster2.csv b/src/monster2.csv new file mode 100644 index 0000000..7626d39 --- /dev/null +++ b/src/monster2.csv @@ -0,0 +1 @@ +"rook", "raven", "jackdaw", diff --git a/src/objects.messy b/src/objects.messy index 37d533a..f6c3a89 100644 --- a/src/objects.messy +++ b/src/objects.messy @@ -8,13 +8,20 @@ * roomstackele* roomstackobj__nth(roomstackobj*,int) ...get the nth element; NULL on sentry * roomstackele* roomstackobj__roomp(roomstackobj*,latlontyp) ...if an element exists, return it; else NULL * implicit roomstackobj__roompull(roomstackobj*,latlontyp) ...if an element exists, move it to the front. OK or ERR + * implicit roomstackobj__roomset(roomstackobj*,latlontyp) ...if an element exists, move it to swapin. OK or ERR * implicit roomstackobj__pull(roomstackobj*,roomstackele*) ...move the element to the front. OK or ERR - * implicit roomstackobj__setswap(roomstackobj*,roomtyp*) ...create a room and push it to swap - * roomtyp * roomstackobj__getswap(roomstackobj*,planetyp) ...get the room in a given swap. - * roomtyp * roomstackobj__resetswap(roomstackobj*,planetyp) ...recall the room in the given swap. invalid plane will call topswap; this may not be what you want. - * roomtyp * roomstackobj__topswap(roomstackobj*) ...recall the top of the stack to swap. + * implicit roomstackobj__set(roomstackobj*,roomstackele*) ...move the element to swapin. OK or ERR + * implicit roomstackobj__setswap(roomstackobj*,roomtyp*) ...create a room and push it to a swap slot, setting swapin. + * roomtyp * roomstackobj__getswap(roomstackobj*,planetyp) ...get the room in a given swap slot. + * roomtyp * roomstackobj__resetswap(roomstackobj*,planetyp) ...recall the room in the given swap slot to swapin. invalid plane will call topswap; this may not be what you want. + * roomtyp * roomstackobj__topswap(roomstackobj*) ...recall the top of the stack to swapin. * implicit roomstackobj__setswap_ele(roomstackobj*,roomstackele*) ...push the room contained in an element to swap. * implicit roomstackobj__makecurrent(roomstackobj*,latlontyp) ...smart swap function. if an element doesn't exist, it is created. if it does, it is moved. + * roomstackobj__neighbor_query(latlontyp) ...check if a room is in the neighbor register + * roomstackobj__neighbor_reset() ...set the neighbors register according to the current room + * roomstackobj__neighbor_clear() + * roomstackobj__neighbor_pull(uchar) ...copy a pointer from the neighbors register to the swapin register and clear the neighbors register + * roomstackobj__neighbor_pullset(uchar) ...copy a pointer from the neighbors register to the swapin register and repopulate the neighbors register * note: because of the way the implementation works, duplicate entries are HIGHLY DANGEROUS and must be avoided. */ @@ -25,7 +32,8 @@ roomtyp * room; } struct roomstackobj { -roomtyp ** swapin; //column-major +roomtyp * swapin; +roomtyp *neighbor[2][6]; //first row are the pointers to the swapped in neighboring rooms. second row is for storing neighbor rooms that are not from the stack and will not be put there. roomtyp *bank[3][11]; struct roomstackele * top; struct roomstackele * bottom; @@ -57,7 +65,7 @@ roomstackele * roomstackobj__push(roomstackobj * this,roomtyp * room) { #define roomstackobj__roompull(X,Y) roomstackobj__pull(X,roomstackobj__roomp(X,Y)) -roomstackobj__pull (roomstackobj * this, roomstackele * that) { +roomstackele * roomstackobj__pull (roomstackobj * this, roomstackele * that) { if (!(this->top != that)) { that->prev->next = that->next; if (that->next == NULL) { @@ -93,29 +101,71 @@ roomstackobj__setswap (roomstackobj * this, roomtyp * that) { roomstackobj__push(this,that); } this->swapin = that; - END +return 0;} #define roomstackobj__setswap_ele(X,Y) roomstackobj__setswap(X,roomstackobj__drop(X,Y)) roomstackobj__makecurrent(roomstackobj * this,latlontyp query) { - if ( - (query == roomstackobj__getswap( this , getplanetyp(query) )->latlon) - || - (roomstackobj__roompull(this,query) != NULL) - ) { - /*conditional must short circuit in this order*/ - return 0; + roomtyp * neighborptr = roomstackobj__neighbor_tmpquery(this,query); + if (neighborptr != NULL) { + roomstackobj__setswap(this,neighborptr); + } + planetyp plane = getplanetyp(query); + else if (query == roomstackobj__getswap(this,plane)->latlon) { + roomstackobj__resetswap(this,plane); + } + else if (roomstackobj__roompull(this,query) != NULL) { + roomstackobj__topswap(this); } else { if (roomp(query)) { roomstackobj__setswap(this,loadroom(query)); } else { - setswaproom(roomgen(query)); + roomstackobj__setswap(this,roomgen(query)); } } + roomstackobj__neighbor_reset(); +return 0;} + +roomstackobj__neighbor_reset (struct roomstack * this) { + for (int n = 0;n < 6;n++) { + for (int i = 0,i < n,i++) { + if (this.neighbor[1][i] == this.neighbor[1][n]) { + this.neighbor[1][n] = NULL; + } + } + if (this.neighbor[1][n] != NULL) { + freeroom(this.tmpneighbor[n]); + } + } + for (int n = 0;n < 6;n++) { + this.neighbor[0][n] = NULL; + this.neighbor[1][n] = NULL; + } + struct roomneighbors neighborhood = (*this.swapin)->neighborhood; +#define IFSWITCH(X,Y) if (neighborhood.X) {\ + struct planetyp plane = getplanetyp(neighborhood.latlon[Y]);\ + roomstackele * ele = roomstackobj__roomp(this,neighborhood.latlon[Y]);\ + if (neighborhood.latlon[Y] == roomstackobj__getswap(this,plane).latlon {\ + this.neighbor[0][Y] = roomstackobj__getswap(this,plane);\ + }\ + else if (ele != NULL) {\ + this.neighbor[0][Y] = ele.room;\ + }\ + else {\ + this.neighbor[1][Y] = smrtloadroom(neighborhood.latlon[Y]);\ + this.neighbor[0][Y] = this.neighbor[1][Y];\ + }\ + } + IFSWITCH(north,ROOM_NORTH); + IFSWITCH(south,ROOM_SOUTH); + IFSWITCH(east,ROOM_EAST); + IFSWITCH(west,ROOM_WEST); + IFSWITCH(up,ROOM_UP); + IFSWITCH(down,ROOM_DOWN); +#undef IFSWITCH } -END /*^DONE^ * From Rough Pseudocode to Pseudo C @@ -146,6 +196,7 @@ umint value /**File Operations** * implicit saveroom(roomtyp*) * roomtyp* loadroom(latlontyp) + * roomtyp* smrtloadroom(latlontyp) * void freeroom(roomtyp*) * bool roomp(latlontyp) * bool planep(planetyp) @@ -231,6 +282,15 @@ if (roomptr == NULL) {roomptr = ROOM} * DONE */ +roomtyp * smrtloadroom (struct latlontyp query) { + if (roomp(query)) { + return loadroom(query); + } + else { + return roomgen(query); + } + } + /* planetyp getplanetyp(latlontyp) */ diff --git a/src/questdialogs/README.md b/src/questdialogs/README.md new file mode 100644 index 0000000..ed86699 --- /dev/null +++ b/src/questdialogs/README.md @@ -0,0 +1,8 @@ +Inspired by X bitmaps and old noisy computers; + +pieces of dialoge are stored in shared objects. + +these shared objects are dynamically (un)loaded throughout runtime. + +this should prevent the system ram from being occupied with strings +that mightn't even be used through an entire playthrough. diff --git a/src/questdialogs/boom.c b/src/questdialogs/boom.c new file mode 100644 index 0000000..644b714 --- /dev/null +++ b/src/questdialogs/boom.c @@ -0,0 +1,45 @@ +#include BLAH BLAH BLAH + +boom(int y,int x) { + mvaddch16( y - 2, x - 3, 0x22CF, COLOR_PAIR(COLOR_RED) | A_BOLD); + mvaddch16( y - 2, x - 2, 0x2042, COLOR_PAIR(COLOR_WHITE) | A_DIM); + mvaddch16( y - 2, x - 1, 0x22CF, COLOR_PAIR(COLOR_RED) | A_BOLD); + mvaddch16( y - 2, x, 0x2042, COLOR_PAIR(COLOR_WHITE) | A_DIM); + mvaddch16( y - 2, x + 1, 0x22CF, COLOR_PAIR(COLOR_RED) | A_BOLD); + mvaddch16( y - 2, x + 2, 0x2042, COLOR_PAIR(COLOR_WHITE) | A_DIM); + mvaddch16( y - 2, x + 3, 0x22CF, COLOR_PAIR(COLOR_RED) | A_BOLD); + mvaddch16( y - 1, x - 4, 0x22CF, COLOR_PAIR(COLOR_RED) | A_BOLD); + mvaddch16( y - 1, x - 3, 0x2042, COLOR_PAIR(COLOR_WHITE) | A_DIM); + mvaddch16( y - 1, x - 2, 0x22CF, COLOR_PAIR(COLOR_RED) | A_BOLD); + mvaddch16( y - 1, x - 1, 0x2042, COLOR_PAIR(COLOR_WHITE) | A_DIM); + mvaddch16( y - 1, x, 0x22CF, COLOR_PAIR(COLOR_RED) | A_BOLD); + mvaddch16( y - 1, x + 1, 0x2042, COLOR_PAIR(COLOR_WHITE) | A_DIM); + mvaddch16( y - 1, x + 2, 0x22CF, COLOR_PAIR(COLOR_RED) | A_BOLD); + mvaddch16( y - 1, x + 3, 0x2042, COLOR_PAIR(COLOR_WHITE) | A_DIM); + mvaddch16( y - 1, x + 4, 0x22CF, COLOR_PAIR(COLOR_RED) | A_BOLD); + mvaddch16( y, x - 4, 0x2042, COLOR_PAIR(COLOR_WHITE) | A_DIM); + mvaddch16( y, x - 3, 0x22CF, COLOR_PAIR(COLOR_RED) | A_BOLD); + mvaddch16( y, x - 2, 'B', COLOR_PAIR((BACKGROUND * COLOR_RED) | COLOR_YELLOW) | A_BOLD); + mvaddch16( y, x - 1, 'O', COLOR_PAIR((BACKGROUND * COLOR_RED) | COLOR_YELLOW) | A_BOLD); + mvaddch16( y, x, 'O', COLOR_PAIR((BACKGROUND * COLOR_RED) | COLOR_YELLOW) | A_BOLD); + mvaddch16( y, x + 1, 'O', COLOR_PAIR((BACKGROUND * COLOR_RED) | COLOR_YELLOW) | A_BOLD); + mvaddch16( y, x + 2, 'M', COLOR_PAIR((BACKGROUND * COLOR_RED) | COLOR_YELLOW) | A_BOLD); + mvaddch16( y, x + 3, 0x22CF, COLOR_PAIR(COLOR_RED) | A_BOLD); + mvaddch16( y, x + 4, 0x2042, COLOR_PAIR(COLOR_WHITE) | A_DIM); + mvaddch16( y + 1, x - 4, 0x22CF, COLOR_PAIR(COLOR_RED) | A_BOLD); + mvaddch16( y + 1, x - 3, 0x2042, COLOR_PAIR(COLOR_WHITE) | A_DIM); + mvaddch16( y + 1, x - 2, 0x22CF, COLOR_PAIR(COLOR_RED) | A_BOLD); + mvaddch16( y + 1, x - 1, 0x2042, COLOR_PAIR(COLOR_WHITE) | A_DIM); + mvaddch16( y + 1, x, 0x22CF, COLOR_PAIR(COLOR_RED) | A_BOLD); + mvaddch16( y + 1, x + 1, 0x2042, COLOR_PAIR(COLOR_WHITE) | A_DIM); + mvaddch16( y + 1, x + 2, 0x22CF, COLOR_PAIR(COLOR_RED) | A_BOLD); + mvaddch16( y + 1, x + 3, 0x2042, COLOR_PAIR(COLOR_WHITE) | A_DIM); + mvaddch16( y + 1, x + 4, 0x22CF, COLOR_PAIR(COLOR_RED) | A_BOLD); + mvaddch16( y + 2, x - 3, 0x22CF, COLOR_PAIR(COLOR_RED) | A_BOLD); + mvaddch16( y + 2, x - 2, 0x2042, COLOR_PAIR(COLOR_WHITE) | A_DIM); + mvaddch16( y + 2, x - 1, 0x22CF, COLOR_PAIR(COLOR_RED) | A_BOLD); + mvaddch16( y + 2, x, 0x2042, COLOR_PAIR(COLOR_WHITE) | A_DIM); + mvaddch16( y + 2, x + 1, 0x22CF, COLOR_PAIR(COLOR_RED) | A_BOLD); + mvaddch16( y + 2, x + 2, 0x2042, COLOR_PAIR(COLOR_WHITE) | A_DIM); + mvaddch16( y + 2, x + 3, 0x22CF, COLOR_PAIR(COLOR_RED) | A_BOLD); + } diff --git a/src/questdialogs/endofthebeginning.asc.rot13 b/src/questdialogs/endofthebeginning.asc.rot13 deleted file mode 100644 index 4c34dd3..0000000 --- a/src/questdialogs/endofthebeginning.asc.rot13 +++ /dev/null @@ -1,20 +0,0 @@ -Jrypbzr...V unir orra rkcrpgvat lbh. -V nz Sngr, gur xrrcre bs onynapr. -Naq V arrq lbhe uryc. - -Ynj, Punbf, Tbbq, naq Rivy...rnpu nybar pnaabg shapgvba jvgubhg vg'f bccbfvgr. -Ynj jvgubhg Punbf vf vaqvssrerg naq pehyr. -Punbf jvgubhg ynj vf nanepul. -Tbbq pnaabg fheivir jvgubhg fbzr nzbhag bs Rivy. -Rivy qrfgeblf vgfrys va gur nofrapr bs Tbbq. -Fheryl, lbh unir frra guvf va lbhe ybat geniryf... - -Na napvrag orvat bs Rivy evfrf va gur bhgre cynarf. -vg vf lbhe qrfgval gb rafher gung onynapr erznvaf va gur zhygvirefr... - -V pnaabg vagresrne va gur nssnvef bs gur pbfzbf nal zber guna V unir nyernql qbar; -vg vf sbeovqqra gb qb nf zhpu nf V unir nyernql. Lbh zhfg svaq lbhe bja cngu sebz urer. -V tenag lbh bar ynfg tvsg orsber lbh zhfg yrnir... - -(*Ryrzragny jrncba vf tenagrq urer. -Ebbz orpbzrf vanpprffvoyr nsgre rirag cynlf.*) \ No newline at end of file diff --git a/src/questdialogs/endofthebeginning_rot13.depra b/src/questdialogs/endofthebeginning_rot13.depra new file mode 100644 index 0000000..9dfeb32 --- /dev/null +++ b/src/questdialogs/endofthebeginning_rot13.depra @@ -0,0 +1,28 @@ +char *lines0[] = { + "Jrypbzr...V unir orra rkcrpgvat lbh.", + "V nz Sngr, gur xrrcre bs onynapr.", + "Naq V arrq lbhe uryc." + } + +char *lines1[] = { + "Ynj, Punbf, Tbbq, naq Rivy...rnpu nybar pnaabg shapgvba jvgubhg vg'f bccbfvgr.", + "Ynj jvgubhg Punbf vf vaqvssrerg naq pehyr.", + "Punbf jvgubhg ynj vf nanepul.", + "Tbbq pnaabg fheivir jvgubhg fbzr nzbhag bs Rivy.", + "Rivy qrfgeblf vgfrys va gur nofrapr bs Tbbq.", + "Fheryl, lbh unir frra guvf va lbhe ybat geniryf..." + } + +char *lines2[] = { + "Na napvrag orvat bs Rivy evfrf va gur bhgre cynarf.", + "vg vf lbhe qrfgval gb rafher gung onynapr erznvaf va gur zhygvirefr..." + } + +char *lines3[] = { + "V pnaabg vagresrne va gur nssnvef bs gur pbfzbf nal zber guna V unir nyernql qbar;", + "vg vf sbeovqqra gb qb nf zhpu nf V unir nyernql. Lbh zhfg svaq lbhe bja cngu sebz urer.", + "V tenag lbh bar ynfg tvsg orsber lbh zhfg yrnir..." + } + +/*Ryrzragny jrncba vf tenagrq urer. +Ebbz orpbzrf vanpprffvoyr nsgre rirag cynlf.*/ diff --git a/src/questdialogs/escape_newteammate_siren.ctxt b/src/questdialogs/escape_newteammate_siren.ctxt new file mode 100644 index 0000000..df6f7e9 --- /dev/null +++ b/src/questdialogs/escape_newteammate_siren.ctxt @@ -0,0 +1,77 @@ +/*no stdlib*/ + +struct attrcolortyp default0 = {A_NORMAL,COLOR_WHITE}; + +char *lines0[] = { + "heheh...", + "Do you find this funny, prisoner 101?", + "I find this extreamly funny", + "Really? Then I'm sure you'll find this extreamly funny too;", + "Fetch me... ... ...the device.", + "pfft", + "what?", + "Oh, just the fact that you're posturing to an unchained prisoner.", + "really effective", + "wha-- GUARDS!!!"} + +scoord3 meta0[] = { //speaker,lines,attrs + {0,1,1}, + {1,1,1}, + {0,1,2}, + {1,2,3}, + {0,1,1}, + {1,1,1}, + {0,2,3}, + {1,1,1}, + {-1,-1,-1}} + +struct chgat_args_typ attrs0[] = { + {0,0,-1, A_DIM | A_ITALIC,COLOR_WHITE}, + + {0,17,5, A_ITALIC,COLOR_WHITE}, + + {0,12,15, A_ITALIC,COLOR_WHITE}, + {0,27,4, A_NORMAL,COLOR_GREEN}, + + {0,0,6, A_ITALIC,COLOR_WHITE}, + {0,39,15, A_ITALIC,COLOR_WHITE}, + {1,19,10, A_NORMAL,COLOR_RED}, + + {0,0,-1, A_ITALIC,COLOR_WHITE}, + + {0,0,4, A_ITALIC,COLOR_WHITE}, + + {0,46,18, A_BOLD,COLOR_WHITE}, + {1,0,16, A_ITALIC,COLOR_WHITE}, + {1,16,4, A_NORMAL,COLOR_GREEN}, + + {0,6,9, A_BOLD | A_ITALIC,COLOR_RED}} + + +struct attrcolortyp default1 = {A_NORMAL,COLOR_WHITE}; + +char *lines1[] = { + "...Seriously, who keeps a Siren in an unwarded dungeon?", + "Hey, you!", + "?\a", + "No, the grue behind you", + "Yes. You. Are you coming?"} + +scoord3 meta1 = { + {0,1,1}, + {0,1,0}, + {-128,1,1}, + {0,2,4}, + {-1,-1,-1}} + +struct chgat_args_typ attrs1[] = { + {0,0,-1, A_DIM | A_ITALIC,COLOR_WHITE}, + + /*skip*/ + + {0,0,1, A_BOLD | A_ITALIC,COLOR_WHITE}, + + {0,0,23, A_ITALIC,COLOR_WHITE}, + {0,23,4, A_NORMAL,COLOR_GREEN}, + {1,0,3, A_ITALIC,COLOR_WHITE}, + {1,5,3, A_ITALIC,COLOR_WHITE}} diff --git a/src/questdialogs/goaway.asc b/src/questdialogs/goaway.asc deleted file mode 100644 index bbe19f0..0000000 --- a/src/questdialogs/goaway.asc +++ /dev/null @@ -1,11 +0,0 @@ -∿{HALT!}∿ -∿{Leave this place. You are not welcome here.} - -(*if an evil player tries to enter a Siren village, -they recieve this warning. if they ignore it, they -are smitten. this applies to lawful-* or -chaotic-neutral orcs and humans as well. -the sirens are constantly at war with both -over their precious metal mines, and thus -consider them to be more inclined to evil -than other races.*) \ No newline at end of file diff --git a/src/questdialogs/goaway.depra b/src/questdialogs/goaway.depra new file mode 100644 index 0000000..d0e18c4 --- /dev/null +++ b/src/questdialogs/goaway.depra @@ -0,0 +1,12 @@ +char *lines0[] = { + "∿{HALT!}∿", + "∿{Leave this place. You are not welcome here.}∿", + NULL} + +/*if an evil player tries to enter a Siren village, +they recieve this warning. if they ignore it, they +are smitten.*/ + +/*a parallel event keeps siren players inside the +village until they have done their rites of passage, +by warning them to not leave and then warping them back to their home*/ diff --git a/src/questdialogs/lightningfractal.c b/src/questdialogs/lightningfractal.c new file mode 100644 index 0000000..176ba15 --- /dev/null +++ b/src/questdialogs/lightningfractal.c @@ -0,0 +1,29 @@ +lightningfractal (int x,int y) { + for (int n = 1;;n *= 2) { + for (int i = 0;i < n;i++) { + int a = y - i; + int b = x + n + i; + if (a < 0) {return 0;} + else if (!((a >= MAX_Y) || (b < 0) || (b >= MAX_X))) { + mvaddch(a,b,'/' | COLOR_PAIR(COLOR_CYAN) | A_BOLD); + } + } + for (int i = 0;i < n;i++) { + int a = y - (n + i); + int b = x + ((2n - 1) - i); + if (a < 0) {return 0;} + else if (!((a >= MAX_Y) || (b < 0) || (b >= MAX_X))) { + mvaddch(a,b,'\\' | COLOR_PAIR(COLOR_CYAN) | A_BOLD); + } + for (int i = 0;i < n;i++) { + int a = y - (n + i); + int b = x + i; + if (a < 0) {return -1;} + if (!((a >= MAX_Y) || (b < 0) || (b >= MAX_X))) { + mvaddch(a,b,'/' | COLOR_PAIR(COLOR_CYAN) | A_BOLD); + } + } + x -= 2n; + y -= n; + if (y < 0) {return -1;} + } \ No newline at end of file diff --git a/src/questdialogs/avianquest b/src/questdialogs/old/avianquest similarity index 100% rename from src/questdialogs/avianquest rename to src/questdialogs/old/avianquest diff --git a/src/questdialogs/knightquest b/src/questdialogs/old/knightquest similarity index 100% rename from src/questdialogs/knightquest rename to src/questdialogs/old/knightquest diff --git a/src/questdialogs/questtemplate b/src/questdialogs/old/questtemplate similarity index 100% rename from src/questdialogs/questtemplate rename to src/questdialogs/old/questtemplate diff --git a/src/questdialogs/roguequest b/src/questdialogs/old/roguequest similarity index 100% rename from src/questdialogs/roguequest rename to src/questdialogs/old/roguequest diff --git a/src/questdialogs/oracles.depra b/src/questdialogs/oracles.depra new file mode 100644 index 0000000..1bb0e06 --- /dev/null +++ b/src/questdialogs/oracles.depra @@ -0,0 +1,4 @@ +char *lines0[] = { + "You should heed the words of oracles…", + "Except when they're wrong!", + NULL } diff --git a/src/questdialogs/trollsontheroad.c b/src/questdialogs/trollsontheroad.c new file mode 100644 index 0000000..3427fc8 --- /dev/null +++ b/src/questdialogs/trollsontheroad.c @@ -0,0 +1,10 @@ +char *evntlines0[] = { + "Oh, that's too bad…", + "Are you an adventurer?", + "Great! Could you do me a favor?", + "I need \033[1;93mNutmeg\033[m for my pumpkin bread, and I've run out.", + "I would go get some myself, but the road is \033[3;31mfull of raptors!\033[0;23m", + "Can you clear the road so I can get past? I'll give you a loaf." + } + +/*siren sidequest, most fighter classes, first in chapter 1, siren village, some random house*/ diff --git a/src/questdialogs/trollsontheroad.nfo b/src/questdialogs/trollsontheroad.nfo deleted file mode 100644 index 6ed738d..0000000 --- a/src/questdialogs/trollsontheroad.nfo +++ /dev/null @@ -1,6 +0,0 @@ -Are you an adventurer? -Oh, that's too bad… -Great! Could you do me a favor? -I need Nutmeg for my pumpkin bread, and I've run out. -I would go get some myself, but the road is full of trolls! -Can you clear the road so I can get past? I'll give you a loaf. diff --git a/src/questdialogs/twomasters.asc b/src/questdialogs/twomasters.asc deleted file mode 100644 index 3d8f1e0..0000000 --- a/src/questdialogs/twomasters.asc +++ /dev/null @@ -1,10 +0,0 @@ -Valkerie, come. I must tell you something. -In private. -One such as you cannot serve two masters. -There will soon come a time when your masters will be put at odds. -you will be forced to choose between them. -and your life will forever be changed. -If you choose incorrectly, you will find an easy life ahead of you, devoid of fufillment. -you will grow old and die without honor. -If you choose correctly, your path will be hard and trecherous. -but you will walk the path of destiny, and history will remember you as a great warrior. \ No newline at end of file diff --git a/src/questdialogs/twomasters.depra b/src/questdialogs/twomasters.depra new file mode 100644 index 0000000..842291f --- /dev/null +++ b/src/questdialogs/twomasters.depra @@ -0,0 +1,10 @@ +char *lines0[] = { + "Valkerie, come. I must tell you something. In private.", + "One such as you cannot serve two masters.", + "There will soon come a time when your masters will be put at odds.", + "you will be forced to choose between them, and your life will forever be changed.", + "If you choose incorrectly, you will find an easy life ahead of you, devoid of fufillment.", + "you will grow old and die without honor.", + "If you choose correctly, your path will be hard;", + "but you will walk the path of destiny, and history will remember you a mighty warrior.", + NULL} diff --git a/src/questdialogs/volcanomancy.asc b/src/questdialogs/volcanomancy.asc deleted file mode 100644 index b460d99..0000000 --- a/src/questdialogs/volcanomancy.asc +++ /dev/null @@ -1,4 +0,0 @@ -MONS -MORS -ITERVM -RESVRGVM \ No newline at end of file diff --git a/src/questdialogs/volcanomancy.depra b/src/questdialogs/volcanomancy.depra new file mode 100644 index 0000000..71f0457 --- /dev/null +++ b/src/questdialogs/volcanomancy.depra @@ -0,0 +1,9 @@ +char *lines0[] = { + "MONS", + "MORS", + "ITERVM", + "RESVRGVM", + NULL} + +/*fix grammer later, +there are more important issues atm*/ diff --git a/src/render.messy b/src/render.messy index fb3c261..bb5b6cf 100644 --- a/src/render.messy +++ b/src/render.messy @@ -42,7 +42,7 @@ cullplane = raycast__cullplane(); int posx = 0; int posy; int posz; - for (int z = 0;(z ≤ CEILING) && (z < cullplane);z++) { // one of these is not like the others + for (int z = 0;(z < OLDCEILING) && (z < cullplane);z++) { // one of these is not like the others for (int y = 0;y < MAX_Y;y++) { if (posy ≥ 0) { for (int x = 0;x < MAX_X;x++) { diff --git a/src/roomscroll.ch b/src/roomscroll.ch new file mode 100644 index 0000000..6c6f482 --- /dev/null +++ b/src/roomscroll.ch @@ -0,0 +1,12 @@ +roomscroll(char dir) { +switch (dir & 07) : + case ROOM_EAST : roomstackobj__makecurrent(ROOMSTACK,ROOM->neighborhood.east);PLAYER->pos[0] = MAX_X - 1;break; + case ROOM_WEST : roomstackobj__makecurrent(ROOMSTACK,ROOM->neighborhood.west);PLAYER->pos[0] = 0;break; + case ROOM_NORTH : roomstackobj__makecurrent(ROOMSTACK,ROOM->neighborhood.north);PLAYER->pos[1] = MAX_Y - 1;break; + case ROOM_SOUTH : roomstackobj__makecurrent(ROOMSTACK,ROOM->neighborhood.south);PLAYER->pos[1] = 0;break; + case ROOM_UP : roomstackobj__makecurrent(ROOMSTACK,ROOM->neighborhood.up);PLAYER->pos[2] = 0;break; + case ROOM_UPSTAIR : roomstackobj__makecurrent(ROOMSTACK,ROOM->neighborhood.up);PLAYER->pos[0] = ROOM->downstair[0];PLAYER->pos[1] = ROOM->downstair[1];PLAYER->pos[2] = 0;break; + case ROOM_DOWN : roomstackobj__makecurrent(ROOMSTACK,ROOM->neighborhood.down);PLAYER->pos[2] = CEILING;break; + case ROOM_DOWNSTAIR : roomstackobj__makecurrent(ROOMSTACK,ROOM->neighborhood.down);PLAYER->pos[0] = ROOM->upstair[0];PLAYER->pos[1] = ROOM->upstair[1];PLAYER->pos[2] = CEILING;break; + default : break; +} diff --git a/src/structs.messy b/src/structs.messy deleted file mode 100644 index 760b7c9..0000000 --- a/src/structs.messy +++ /dev/null @@ -1 +0,0 @@ -/*empty*/ diff --git a/src/swapsave.c b/src/swapsave.c new file mode 100644 index 0000000..ee6bcc6 --- /dev/null +++ b/src/swapsave.c @@ -0,0 +1,164 @@ +save__void(void * this,size_t size,size_t n,char * parentdir) + FILE * swapfile; + int len = strlen(parentdir) + 9; + char fullname[len]; + strcpy(fullname,parentdir); + strcat(fullname,"this.dat"); + strcat(fullname,ext); + swapfile = fopen(fullname,"wb+"); + fwrite(this,size,n,swapfile); + fflush(swapfile); + fclose(swapfile); + END + +save__objid_switch(objid key,void * value,char * dir) { + switch key: + case POTION_FLAG : save__potiontyp(value,dir);break; + case READ_FLAG : save__readtyp(value,dir);break; + case CONLANG_FLAG : save__conlangtyp(value,dir);break; + case SPELL_FLAG : save__spelltyp(value,dir);break; + case GEM_FLAG : save__gemstonetyp(value,dir);break; + case TRAP_FLAG : save__traptyp(value,dir);break; + case WARP_FLAG : save__warptyp(value,dir);break; + case SUBWARP_FLAG : save__subwarptyp(value,dir);break; + case CHEST_FLAG : save__chestyp(value,dir);break; + case DOOR_FLAG : save__doortyp(value,dir);break; + case LOCK_FLAG : save__locktyp(value,dir);break; + case MONEY_FLAG : save__moneytyp(value,dir);break; + case SPAWN_FLAG : save__spawntyp(value,dir);break; + case SIGN_FLAG : save__signtyp(value,dir);break; + default : break; + } + +save__langlistele(langlistele * this,char * parentdir) { + save__void(this,sizeof(struct langlistele),1,parentdir); + if (this->next != NULL) { + int len = strlen(parentdir) + 6; + char directory[len]; + strcpy(directory,parentdir); + strcat(directory,"next/"); + save__langlistele(this->next,directory); + } + END + +save__spellistele(spellistele * this,char * parentdir) { + save__void(this,sizeof(struct spellistele),1,parentdir); + if (this->next != NULL) { + int len = strlen(parentdir) + 6; + char directory[len]; + strcpy(directory,parentdir); + strcat(directory,"next/"); + save__langlistele(this->next,directory); + } + END + +save__heldobjtyp(heldobjtyp * this,char * parentdir) { + save__void(this,sizeof(struct heldobjtyp),1,parentdir); + if (this->data != NULL) { + char * subdirname = "data/"; + int len = strlen(directory) + strlen(subdirname) + 1; + char subdirectory[len]; + strcpy(subdirectory,directory); + strcat(subdirectory,subdirname); + save__objid_switch(this->type,this->data,subdirectory); + } + if (this->next != NULL) { + int len = strlen(parentdir) + 6; + char directory[len]; + strcpy(directory,parentdir); + strcat(directory,"next/"); + save__heldobjtyp(this->next,directory); + } + END + +save__armtyp(armtyp * this,char * parentdir); + save__void(this,sizeof(struct armtyp),1,parentdir); + if (this->next != NULL) { + int len = strlen(parentdir) + 6; + char directory[len]; + strcpy(directory,parentdir); + strcat(directory,"next/"); + save__armtyp(this->next,directory); + } + END + +save__legtyp(legtyp * this,char * parentdir); + save__void(this,sizeof(struct legtyp),1,parentdir); + if (this->next != NULL) { + int len = strlen(parentdir) + 6; + char directory[len]; + strcpy(directory,parentdir); + strcat(directory,"next/"); + save__legtyp(this->next,directory); + } + END + +save__playertyp(playertyp * this,char * parentdir) { + int length = strlen(parentdir) + strlen(this->name); + char[length + 1] directory; + strcpy(directory,parentdir); + strcat(directory,this->name); + save__void(this,sizeof(struct playertyp),1,directory,"dat"); + if (this->helm.data != NULL) { + char * subdirname = "helm_data/"; + int len = strlen(directory) + strlen(subdirname) + 1; + char subdirectory[len]; + strcpy(subdirectory,directory); + strcat(subdirectory,subdirname); + save__objid_switch(this->helm.type,this->helm.data,subdirectory); + } + if (this->lang_ptr != NULL) { + char * subdirname = "lang_ptr/"; + int len = strlen(directory) + strlen(subdirname) + 1; + char subdirectory[len]; + strcpy(subdirectory,directory); + strcat(subdirectory,subdirname); + save__langlistele(this->lang_ptr,subdirectory); + } + if (this->spell_ptr != NULL) { + char * subdirname = "spell_ptr/"; + int len = strlen(directory) + strlen(subdirname) + 1; + char subdirectory[len]; + strcpy(subdirectory,directory); + strcat(subdirectory,subdirname); + save__spellistele(this->spell_ptr,subdirectory); + } + if (this->bag_ptr != NULL) { + char * subdirname = "bag_ptr/"; + int len = strlen(directory) + strlen(subdirname) + 1; + char subdirectory[len]; + strcpy(subdirectory,directory); + strcat(subdirectory,subdirname); + save__heldobjtyp(this->bag_ptr,subdirectory); + } + if (this->arms != NULL) { + char * subdirname = "arms/"; + int len = strlen(directory) + strlen(subdirname) + 1; + char subdirectory[len]; + strcpy(subdirectory,directory); + strcat(subdirectory,subdirname); + save__armtyp(this->arms,subdirectory); + } + if (this->legs != NULL) { + char * subdirname = "legs/"; + int len = strlen(directory) + strlen(subdirname) + 1; + char subdirectory[len]; + strcpy(subdirectory,directory); + strcat(subdirectory,subdirname); + save__legtyp(this->legs,subdirectory); + } + END + +/*----------*/ + +loadblock(void * this,size_t size,size_t n,char * parentdir,char * filename) + FILE * swapfile; + int len = strlen(parentdir) + strlen(filename); + char fullname[len + 1]; + strcpy(fullname,parentdir); + strcat(fullname,filename); + swapfile = fopen(fullname,"rb"); + fread(this,size,n,swapfile); + fflush(swapfile); + fclose(swapfile); + } \ No newline at end of file diff --git a/src/types.h b/src/types.h new file mode 100644 index 0000000..d39952e --- /dev/null +++ b/src/types.h @@ -0,0 +1,1295 @@ +/* note: if the compiler complains about mixing tightly packed and loosly packed fields, + * the tightly packed ones will be split off into a seperate type with "_bitfield" affixed to + * the name, which will be placed in a consistantly-named member at the end of the struct. + * + * possible names: 1."β" 2."_b" + */ + +#define uint unsigned int +#define uchar unsigned char +#define ushort unsigned short +#define ulong unsigned long +#define 8BITPTR uint8_t + +struct stringlistyp { +(self) *prev +(self) *next +char* text +} +/* used to store a list of strings + * may be from a data object, or + * stored in a tsv + */ + +struct singlestringlistyp { +(self) * next +char * text +} + +struct filelinetyp { +(self) *prev +(self) *next +ushort lineno +char* text +} +// used by the line editor + +struct singlestringlistyp { +(self) * next +ushort lineno +char * text +} + +struct blitimgcolor { + struct attr_t attr[6] + uchar fgcolor[4] + uchar bgcolor[4] + char ** img[16]; + } + /* [0] [1] [2] [3] fgcolor + * 0 [0] [1] [2] attr + * [0] 0 [0] [1] [2] [3] img + * [1] [3] [4] [5] [6] [7] + * [2] [4] [8] [9] [10] [11] + * [3] [5] [12] [13] [14] [15] + * bgcolor attr + * the first row and column never have any attributes + * NULL img pointers are skipped, rather than acting as sentries + */ + +struct drawvector { + ucoord3 a; + ucoord3 b; + char16_t ch; // if set to \0, then assume that attr also holds an ascii symbol and switch accordingly. + struct attrcolortyp attrcolor; + ushort uslp; /* how long to delay between each character; calls usleep. + * there is already a miniscule delay for the stepwise pathfinder calculation + */ + } + +/* note: make function where some glyph is swept to some azimuth + * ( char16_t unichar, struct attrcolortyp attrcolor, uchar az ¿, float dist?, ushort uslp) + */ + +struct chaptertyp { +unsigned c : 7; //chapter number +unsigned a : 9; //alignment type +} + +struct turntyp: +uchar sec : 6 +uchar min : 6 +uchar hour : 5 +uchar day : 5 +uchar weekday : 3 +uchar month : 4 +ushort year : 11 + +typedef uchar ucoord3[3] +typedef uchar ucoord2[2] +typedef char scoord3[3] +typedef char scoord2[2] +//sentinal for an array of coord3 is {0,0,-1} + +typedef char *strarry[] +typedef void *ptrarry[] + +struct lightyp { +struct lightyp * prev +struct lightyp * next +unsigned x : 7 +unsigned y : 5 +unsigned z : 4 +unsigned xx : 7 +unsigned yy : 5 +unsigned zz : 4 +} + +struct agetyp { +unsigned chrono : 16 +signed bio : 8 //entity dies on overflow +unsigned rem : 8 /* bio remainder after chrono; + * bio increments on the next + * modulo_0 of the entity's current + * aging factor (href basentyp). exploiting the + * immediately apparent flaw of this behavior + * by frequently shapeshifting is allowed; + * but has it's own side effects. + * (href shiftertyp) + */ +} + +struct mapcoord3: +unsigned x : 7 +unsigned y : 5 +unsigned z : 4 + +struct chgat_args_typ { + uchar y; + uchar x; + char n; + attr_t attr; + short color; + } + +struct nibbles { +unsigned lo : 4 +unsigned hi : 4 +} + +struct cameratyp { +unsigned dir : 4 //href CAMERA_? in constants.h +bool seeinvis : 1 +bool detectalign : 1 +bool arrows : 1 +bool dingbats : 1 +} + +struct racetyp { +intptr_t race : 8 +intptr_t table : 4 +unsigned meta : 4 + // 00,0,F is nul +} + +struct attrcolortyp { + attr_t attr; + short color; + } + +typedef float vector2[2] +typedef float vector3[3] +/* used for velocity, a parameter that holds + * motion that carries accross turns. this motion + * is not always cleared after being done; horizontal + * velocity persists until a tile with friction is + * encountered, while downwards vertical velocity + * accumulates and persists until the ground is encountered. + */ + +struct polar { +unsigned az : 3 //azimuth +signed el : 2 //elevation +signed slope : 3 //negative is inverse slope, most negative is undefined. defines a cone. +unsigned r : 5 //radius +bool omni : 1 //omnidirectional +bool not : 1 //invert the mask defined by slope +bool behind : 1 //EQUATOR/2 degrees are added to azimuth +} +/* amoungst other uses, defines the cone of vision + * and used to generate magic beams + * + * for all azimuths: + * + * 701 + * 6 2 + * 543 + * + * for all elevations: + * + * +1 + * 0 ?-2? + * -1 + */ + +/* + * notetyp { + * (self) next + * unsigned evnt : 4 + * unsigned chan : 4 + * unsigned note : 8 + * unsigned velo : 8 + * clock_t delay + * } + * for interfacing with a raw midi library + * + * delay is not part of the midi data, rather, + * it tells how long to wait until sending the + * next packet. set to 0 to send immidiately. + */ + +//some specific use cases require spheres. these are simply numeric types. + +struct diceodds: +unsigned num : 3 +unsigned side : 5 +unsigned tobeat : 8 + +struct planetyp { +unsigned rho : 2 +unsigned az : 3 +signed el : 2 +char : 0 +} + +struct latlontyp { +unsigned dep : 8 +unsigned lat : 8 +unsigned lon : 9 +unsigned rho : 2 //are you plane shifted? +unsigned az : 3 +signed el : 2 +} +/* in-game altitude is given as the distance from layer 100 + * + * rho 0 is the prime plane + * rho 1 are the elemental planes + * rho 2 are afterlives + * rho 3 can be used for areas that are meant to not show up on a map. + * (said map is WIP) + * + * az elemental afterlife corrilation + * 0 water neutral good nurturer + * 1 ice chaotic good the ends justify the means + * 2 air chaotic neutral princess stealing + * 3 electricity chaotic evil force lightning + * 4 fire neutral evil obviously + * 5 metal lawful evil greed + * 6 earth lawful neutral stubborn + * 7 trees lawful good knowladge + * + * az rotates by 45 degree steps and el by 90 degree steps. + * a nonzero el causes az to gimbal lock. + * also best not to think about where exactly -2 is pointing. + * + * el " " " + * +1 light true neutral enlightenment + * -1 darkness uncomitted meh, I'll think of one later + * -2 entropy oathbreakers abandon all hope ye who enter here + * + * errors related to this section may generate one of 2 errors: + * "fell off the edge of the world", N1=±lat,N2=±lon + * "froze to death on pluto", N1=+az,N2=±el + * + * a room stack exists that keeps a number of rooms loaded + * if a room is not on the stack, it is loaded from the save file and + * pushed to the stack. this may cause the stack to intentionally drop + * the room at the bottom to prevent eating too much ram. if the file + * does not yet exist, the room is generated according to a dispatch table + * in a shared object. if the function and file are both NULL and the + * room is being entered, a lost in space death is called. if only the + * function is NULL, the file is executed in perl. if only the file is + * NULL, no shared objects are loaded before the function is called. + * + * a swap array keeps track of gating between the 23 major planes, + * saving the player's position, but not keeping the room loaded. + */ + +struct placetyp { +(self) *prev +(self) *next +eventdata eventident +char* name +latlontyp latlon +ucoord3 pos +} + +struct moneytyp { +unsigned gp : 17 +unsigned cp : 7 +} + +typedef short trackaligntyp[2] +typedef short trackalignplayertyp[3] +/* neutral is the area between -10,000 and 10,000 + * alignments can be between -30,000 and 30,000 + * actions, quests, and being polymorphed into + * certain monsters can alter your alignment + * [0] is good/evil, [1] is lawful/chaotic + * + * for players, proactivness/passivity is also + * tracked + */ + +struct bitfield: +a : 1 +b : 1 +c : 1 +d : 1 +w : 1 +x : 1 +y : 1 +z : 1 + +struct ray_vfx_typ { +(self) * prev +(self) * next +ucoord3 p +uchar dir //must be a valid octant +float mag +struct attrcolortyp ac +} + +struct multiclasstyp: +(self) *prev +(self) *next +bool notnull : 1 +unsigned role : 2 +unsigned class : 3 +unsigned mastery : 2 + +struct classtyp { +bool notnull : 1 +unsigned role : 2 +unsigned class : 3 +unsigned mastery : 2 +} + +struct baseclasstyp { +struct paffectyp bonus +uchar spd_plus +uchar air_plus +struct conlangtyp lang_plus +_8BITPTR spell[2] +bitfield psyattack +bool mindless : 1 +bool shadow : 1 +bool incoporeal : 1 +bool immortal : 1 +unsigned lde : 3 +unsigned alignment : 9 +unsigned element : 8 +} + +struct the8stats: //8* 5D6 +stren : u5 +psy : u5 +dex : u5 +con : u5 +fort : u5 +intl : u5 +wis : u5 +bluff : u5 + +struct conlangtype: +unsigned id : 5 +bool r : 1 +bool w : 1 +bool x : 1 //can be spoken + +struct playertyp: +char * name +classtyp class[3] +uchar element +agetyp age +struct racetyp baserace[2] +struct racetyp polyrace +shiftertyp polycounter +ucoord3 pos +polar facing +vector3 velo +float carryover //leftover moves; never exceeds 2 +paffectyp permenent +effectyp fromequip +trackalignplayertyp align +ushort hp //they're fun and easy to...wait +ushort mp +uchar air +ushort uptime +uint32_t xp +uchar lvl +short food +moneytyp gold +langlistele *lang_ptr +spellistele *spell_ptr +heldobjtyp *bag_ptr +bitfield psyattack +oneobjtyp helm //any item +subobjtyp shield //shld +subobjtyp bow //weapon +subobjtyp armor //armor +subobjtyp cape //armor +subobjtyp amul //baub +armtyp * arms +legtyp * legs + +struct armtyp { +armtyp * next +subobjtyp weap[2] +subobjtyp ring[2] +subobjtyp wrist[2] +subobjtyp gloves +subobjtyp cannon +} + +struct legtyp { +legtyp * next +subobjtyp boots +subobjtyp greev +} + +enum equipenum = {ENUM_WEAP_LEFT,ENUM_WEAP_RIGHT,ENUM_SHIELD_ENUM_BOW,ENUM_ARMOR,ENUM_CAPE,ENUM_HELM, +ENUM_GLOVES,ENUM_CANNON,ENUM_BOOTS,ENUM_GREEV,ENUM_AMUL,ENUM_RING_LEFT,ENUM_RING_RIGHT,ENUM_WRIST_LEFT, +ENUM_WRIST_RIGHT} + +struct basentyp: +aggrotyp aggro //here, shiftable denotes a monster's aggro state is locked. also gives the value that patience is set to when a monster calms down, the value that cooldown is set to when it is angered, and the default AI. +paffectyp base +uchar spd //distance calculations use M_SQRT2 and local SQRT3 for diagonals +uchar hplvl +uchar mplvl +uchar xplvl +uchar airmax //how long you can hold your breath +struct conlangtyp lang0 +struct conlangtyp lang1 +_8BITPTR spell[4] +bitfield psyattack +char16_t sprite +struct attrcolortyp attrcolor +char16_t altsprite +struct attrcolortyp altattrcolor +signed size : 2 +bool mindless : 1 +bool shadow : 1 +bool incoporeal : 1 +unsigned age_rate : 8 +unsigned element : 8 +unsigned lde : 3 +/* entitys of size 1 or -2 cannot use armor. + * entitys of larger size automaticly win grapples. + * entitys of 2 sizes smaller can be picked up and thrown. + * entitys of size 1 can instakill entitys of size -2. squish. + * size 1: dragon, size 0: human, size -1: dwarf, size -2: pixie + */ + +struct aggrotyp: +bool unhinged : 1 +unsigned patience : 3 +unsigned ai_type : 4 +unsigned anger : 8 + +struct enttyp: +(self) *prev +(self) *next +npctyp * depth +agetyp age +classtyp class +uchar element +aggrotyp aggro +struct racetyp race[2] +ucoord3 pos +polar facing +vector3 velo +float carryover +paffectyp paffect +effectyp effect +ushort hp +uchar air +uint32_t xp +uchar lvl +moneytyp gold +oneobjtyp loot +oneobjtyp helm +subobjtyp shield +subobjtyp bow +subobjtyp armor +subobjtyp cape +subobjtyp amul +armtyp * arms +legtyp * legs + +struct npctyp { +(self) *prev +(self) *next +ucoord3 * path +char * describe +uchar lang +char **lines[9]; //accessor: (lines[n])[m] +} +/* npc data is controlled by events, and is stored by room or in + * global space. more complex actors, such as shopkeepers, + * should be events. + */ + +struct followtyp: +(self) * prev +(self) * next +npctyp * depth +agetyp age +classtyp class +uchar element +aggrotyp aggro +struct racetyp baserace[2] +struct racetyp polyrace +shiftertyp polycounter +ucoord3 pos +polar facing +vector3 velo +float carryover +paffectyp permenent +effectyp fromequip +trackaligntyp align +ushort hp +ushort mp +uchar air +uint32_t xp +uchar lvl +short food +moneytyp gold +bitfield psyattack +oneobjtyp holding +oneobjtyp helm +subobjtyp shield +subobjtyp bow +subobjtyp armor +subobjtyp cape +subobjtyp amul +armtyp * arms +legtyp * legs + +struct spawntyp: +npctyp * depth +classtyp class +uchar element +aggrotyp aggro +struct racetyp race +paffectyp paffect +effectyp effect +oneobjtyp loot +oneobjtyp helm +subobjtyp shield +subobjtyp bow +subobjtyp armor +subobjtyp cape +subobjtyp amul +armtyp * arms +legtyp * legs + +struct oneobjtyp { +objid type +void* data +} + +struct heldobjtyp: +(self) *prev +(self) *next +uchar stack //stack+1 items are present. lumping them together is a complicated operation. +objid type +void* data + +struct langlistele { +(self) * prev +(self) * next +struct conlangtyp data +} + +struct spellistele { +(self) * prev +(self) * next +_8BITPTR data +} + +struct subobjtyp: +intptr_t itemid : 8 +bool cursed : 1 +bool oxide : 1 +bool burned : 1 +signed bonus : 5 +intptr_t metadata : 8 //secondary _8bitPtr for legendary objects + +struct magictyp: +bool fire : 1 +bool air : 1 +bool water : 1 +bool earth : 1 +unsigned lde : 3 +bool planer : 1 + +struct shiftertyp { +unsigned polytimer : 8 //time remaining in the current polymorph. if non-zero, polyrace is used instead of baserace. +unsigned polydepth : 4 //polymorphing more than 10 times without returning to your base form first change your base form to the 15th one +unsigned polycount : 4 //repeating the same polymorph 10 times will make it permenant +unsigned altertimer : 8 //time remaining in the current alteration. +unsigned gills : 4 //using an alteration spell, including intrensics from polymorph spells, 10 times will make them permenent. +unsigned lungs : 4 //these counters can be reset by rest or spells +unsigned wings : 4 +unsigned tail : 4 +unsigned claws : 4 +unsigned fangs : 4 +unsigned talons : 4 +bodytyp alterations //keeps track of changes. if a change becomes permenent, it is moved to paffect. +} +/* non-player, non-follower entitys do not have this field, + * and any polymorph or alteration is permenent. this may be + * changed in future if memory footprint allows. + */ + +struct spelltyp: +intptr_t itemid : 8 +diceodds odds +uchar prof + +struct basespelltyp: +bool poly : 1 +bool self : 1 +unsigned lvl : 6 +magictyp type +char cost_typ : 2 //0 = at will, 1 = gold, -1 = mp, -2 = hp +unsigned cost_amnt : 6 +potiontyp effect +missiletyp delivery +intptr_t polyref : 8 + +struct psytyp: +signed cost_typ : 2 //0 = at will, 1 = gold, -1 = mp, -2 = hp +unsigned cost_amnt : 6 +potiontyp effect +missiletyp delivery + +struct missiletyp: +bool psion : 1 +bool vamp : 1 +unsigned damage : 8 +signed recoil : 7 +unsigned spread : 2 //0 = line, 1 = narrow (1:3), 2 = wide (1:2), 3 = very wide (1:1) +unsigned splash : 3 //radius of damage on impact +bool spz : 1 //spread and splash in the z plane. +bool dig : 1 +//if (.spread != 0), slope = 4-.spreaad + +struct baseweaptyp: +bool fire : 1 +bool air : 1 +bool water : 1 +bool earth : 1 +bool entro : 1 +bool light : 1 +bool dark : 1 +bool fireproof : 1 +bool waterproof : 1 +bool elecproof : 1 +bool iceproof : 1 +bool warded : 1 +bool illum : 1 +unsigned skill : 3 +unsigned damage : 8 + +legendtyp: +paffectyp magic +symtableref base +symtableref spell +legendflagtyp flags + +legendflagtyp: +bool fire : 1 +bool air : 1 +bool water : 1 +bool earth : 1 +bool entro : 1 +bool light : 1 +bool dark : 1 +bool fireproof : 1 +bool waterproof : 1 +bool elecproof : 1 +bool iceproof : 1 +bool warded : 1 +bool unbreak : 1 +bool infinate : 1 +bool spelled : 1 +bool vamp : 1 +bool drain : 1 +bool interest : 1 +bool useless : 1 +unsigned powermag : 5 + +struct basearmortyp: +effectyp effect +uchar def +uchar spdef +uchar extfort + +struct baseshldtyp: +bool fireproof : 1 +bool waterproof : 1 +bool elecproof : 1 +bool iceproof : 1 +bool reflect : 1 +bool entro : 1 +bool light : 1 +bool dark : 1 +effectyp effect +unsigned def : 8 +unsigned spdef : 8 + +struct bodytyp { +bool gills : 1; //affects breathing underwater +bool wings : 1; //affects flying +bool tail : 1; //affects unarmed attacks, swimming, flying +bool claws : 1; //affects unarmed attacks, writing +bool hoof : 1; //affects walking, swimming, unarmed attacks +bool talon : 1; //affects walking, swimming, unarmed attacks +bool fangs : 1; //affects unarmed attacks +bool legs : 1; //affects walking, swimming, unarmed attacks +bool arms : 1; //affects walking, swimming, unarmed attacks, writing +bool nolungs : 1; //affects breathing above water +bool noswim : 1; //affects swimming +bool nofly : 1; +bool atktail : 1; //affects unarmed attacks, swimming, flying +bool atkwing : 1; //affects unarmed attacks, swimming, flying +bool bite : 1; +bool breath : 1; +bool engulf : 1; +bool wingoveride : 1; //needed because the next paramaters can't simply be maxed/ORed together +bool permwings : 1; +bool wingsign : 1; +unsigned wingtype : 2; +char : 0; +} + +struct stattyp { +unsigned dizzy : 3; +unsigned psn : 4; +unsigned prlz : 4; +unsigned frz : 4; +unsigned brn : 4; +signed stone : 8; //inverse one's complement; 0x00 is inactive (-0), 0xFF is dead (+0). overflows can be used to extend time to live +signed slime : 8; //inverse one's complement +unsigned slp : 8; +unsigned invis : 6; +unsigned blind : 8; +signed eaten : 7; //inverse one's complement +} + +struct elixtyp: +dizzy : 1 +psn : 1 +prlz : 1 +frz : 1 +brn : 1 +stone : 1 +slp : 1 +invis : 1 + +struct cursetyp: +stattyp type +uchar polytimer +intptr_t poly : 8 + +struct resistyp: +bool fireproof : 1 +bool waterproof : 1 +bool elecproof : 1 +bool iceproof : 1 +bool stoneproof : 1 +bool polyproof : 1 +bool sleepproof : 1 +bool poisonproof : 1 + +struct sensetyp: +bool trouble : 1 +bool invis : 1 +bool infra : 1 +bool blind : 1 +bool good : 1 +bool evil : 1 +bool law : 1 +bool chaos : 1 + +struct effectyp: +the8stats eight +bodytyp shape +stattyp stat +resistyp resist +sensetyp sense +skilltyp skill +char atk +char spatk +char def +char spdef + +struct paffectyp +the8stats eight +bodytyp shape +nibbles n_arms_legs +elixtyp ails_ya +resistyp resist +sensetyp sense +skilltyp skill +venomtyp venom +char atk +char spatk +char def +char spdef + +struct potiontyp: +bodytyp shape +elixtyp ails_ya +cursetyp curse +resistyp resist +sensetyp sense +short hp +short mp +diceodds odds + +struct skilltyp { +unsigned sword : 4; //+skill to sword-type weapon attack +unsigned knife : 4; //+skill to knife-type weapon attack +unsigned stave : 4; //+skill to stave-type weapon attack +unsigned spear : 4; //+skill to spear-type weapon attack +unsigned whip : 4; //+skill to whip-type weapon range (unused range added to attack) +unsigned club : 4; //+skill to club-type weapon attack +unsigned bow : 4; //+(2 * skill) to bow-type weapon range +unsigned throw : 4; //+(2 * skill) to javalin-type weapon range +unsigned monk : 4; //+(2*skill) to unarmed attack, unlocks more modes of attack. +unsigned shield : 4; //skill in (damage-defense)+abs(damage-defense) chance of blocking +unsigned locks : 4; //1 in 2^(lock.level - (skill)) chance of picking +unsigned caster : 6; //-(skill-1)/4 to casting cost, +(skill-1)/4 to spatk and spdef, unlocks spells, 0 is non-caster +signed swim : 8; //one's complement (href stattyp). may be lost by polymorphing to a form with different locomotion. +signed walk : 8; //one's complement. may be lost by polymorphing to a form with different locomotion. +signed flycounter : 8; //one's complement. may be lost by polymorphing to a form with different locomotion. +unsigned fly : 2; //0 = never had wings, 1 = slow falling, 2 = cannot gain altitude, 3 = free flight. lvl1 learned by falling +} +/* damage = MAX( incoming-defense , 0 ) + * + * polyshock = base.hplvl - ((poly.hplvl * (util__roll(1,20,1) / 20)) * util__roll(1,3,0)) + * ⎧if n < -HPMAX : Instakill (deathmessage: miscalculated a crucial equivilant-exchange parameter,hath choose...poorly) + * ⎪if n = -HPMAX : Stoning + * ⎨if -HPMAX < n < 0 : abs(n) Damage (deathmessage: could not withstand the cost of transmutation) + * ⎪if n = 0 : stun for 1D16 (standardmessage: your mind reels from the transformation...) + * ⎩if n > 0 : success + * + * writing = + * succeed if 4D6 < dex if !talons, break pen on fail if 1D20 < stren + * succeed if 6D6 < dex if talons, break pen on fail if coinflip + * talons can engrave without tools + */ + +readtyp: +unsigned locale : 6 +bool multiuse : 1 +bool scroll : 1 +unsigned subject : 2 //0 = cooking, 1 = weapons, 2 = language, 3 = spellcraft +unsigned uses : 6 +void* contents + +wandtyp: +unsigned matter : 4 +unsigned uses : 4 +intptr_t bound : 8 + +baubtype : +signed type : 2 //0=ring, 1=bracelet, -1=amulet, -2=tiara +unsigned matter : 3 +unsigned color : 3 +paffectyp enchnt + +struct roomneighbors { +bool north +bool south +bool east +bool west +bool up +bool down +bool upstair +bool downstair +latlontyp latlon[6] //href ROOM_? in constants.h +} + +struct roomtyp: //top-down display of a 3d space +latlontyp latlon +tileset *hightiles +char* tiledata[][MAX_Y][MAX_X] +unsigned ceiling : 4 +unsigned bgcolor : 3 +bool visited : 1 +shadowmask seen +shadowmask light +collimaptyp collimap +encontyp *encon_ptr +enttyp *ent_ptr +eventtyp *ev_ptr +mapobjtyp *obj_ptr +ray_vfx_typ *ray_ptr +lightyp *light_ptr +char skylightsource //must be a valid octant +ucoord3 * path_ptr +ucoord2 downstair +ucoord2 upstair +ucoord3 home +struct roomneighbors neighborhood +/* if invalid coords are given for a warp (typically {$FF,$FF}), + * then the player is dumped at the location indicated by home. + * + * if the player has invalid coords, then the error string "fell out of terminal",N1=x,N2=y is generated. + */ + +/* the world of the game will be referred to using two different grids of + * discreet coordinates. the primary grid is the cell space, which is + * interleaved octohedrally with the boundry space, such that if a given + * diminsion in cell space has n points, the same dimension in boundry + * space has n+1 points. the cell space referes to the cells that are + * displayed (the "cells"), while the boundry space referes to their + * boundries. exact boundry space coordinates are not expected to be used; + * only planes and polytopes are meaningful in boundry space. + * + * some notable uses of boundry space are in describing the emulated + * cull plane of the "camera", and as the boundries of a given room. + */ + +struct subroomtyp: //used by mapgen +char tiledata[MAX_Z][MAX_Z][MAX_Z] //cube of MAX_Z +ucoord3 dim +enttype *ent_ptr +mapobjtyp *obj_ptr + +struct mapgen_bordertyp { +tileset *hightiles_n +char north[MAX_Z][MAX_X] +tileset *hightiles_s +char south[MAX_Z][MAX_X] +tileset *hightiles_e +char east[MAX_Z][MAX_Y] +tileset *hightiles_w +char west[MAX_Z][MAX_Y] +tileset *hightiles_ne +char northeast[MAX_Z] +tileset *hightiles_nw +char northwest[MAX_Z] +tileset *hightiles_se +char southeast[MAX_Z] +tileset *hightiles_sw +char southwest[MAX_Z] +tileset *hightiles_u +char up[MAX_Y][MAX_X] +tileset *hightiles_d +char down[MAX_Y][MAX_X] +} +/* only used during mapgen, freed immediatly since it's so huge + * up and down do not need secondary directions as the map cannot be scrolled that way + */ + +typedef ushort shadowmask[MAX_Y][MAX_X] +typedef bitfield starfield[MAX_Y][MAX_X/8] + +typedef ushort collisionmapcols[MAX_Y+2][MAX_X+2] +typedef uchar collisionmapholes[MAX_Y][MAX_X/8] + +struct collisionmaptyp { + collisionmapcols solid + shadowmask liquid + collisionmapholes holes + shadowmask ents + } + +typedef tilemeta* tileset[128] + +struct tilemeta { +bool ladder : 1 +bool solid : 1 +bool liquid : 1 +bool conductive : 1 +bool burns : 1 +bool hypotherm : 1 +bool sharp : 1 +bool entropy : 1 + +bool shiney : 1 +bool slip : 1 +signed speed : 2 + +bool freezes : 1 +bool melts : 1 +bool petrif : 1 + +bool dig : 1 +bool fence : 1 + +intptr_t freeze : 8 +intptr_t melt : 8 +intptr_t stone : 8 +unsigned density + +bool blink : 1 +unsigned color : 6 + +char16_t unichar : 16 +} +/* tiles can be effected by stuff happening around them. + * + * if a tile is flammable, a fire is summoned when fire magic + * enters the space or 1d6 chance if there is fire within 1 taxicab of it. + * + * if a tile is conductive, then electricity is summoned for the instant + * that electrical magic strikes it, and propagates through contiguous tiles. + * + * if a tile can freeze, it's _8BITPTR is changed to the number indicated by ice. + * when ice magic intersects it. + * + * if a tile can melt, it's _8bitPtr is changed to the number indicated by melt + * when fire or electrical magic intersect it. + * + * if a tile can be petrified, it is changed to the tile indicated by stone. + * + * if a tile can be dug, using a ↧digging tool on it will remove it + * digging something triggers updates which cause gravity to affect gases (!liquid,!solid), + * liquids(+liquid,!solid), and granulars(+liquid,+solid), wherin less dense + * tiles will swap with more dense ones. this effect travels outwards, to the edge of the room, + * but will not be applied to the border tiles. in the default set, water has a density of 10, snow + * has a density of -1, and air has a density of -100. + */ + +mapobjflags: +bool hidden : 1 +bool moves : 1 +bool rclass : 1 +unsigned class : 4 +unsigned alignment : 9 + +struct mapobjtyp: +(self) *prev +(self) *next +eventdata eventident +ucoord3 pos +objid type +void* data +mapobjflags flags + +struct signtyp { +char16_t unichar +conlangtyp lang +char* lines +char* gibber +} + +struct chestyp: +heldobjtyp *bag_ptr +cursetyp curse +locktype locked + +struct doortyp { +bool open : 1 +unsigned hp : 7 +locktype lock : 8 + +struct locktype { +unsigned level : 4; +bool locked : 1; +unsigned pins : 7; +trapflag flags; +} +/* lockpicking requires the player to enter + * 0 and + in the correct order to turn the + * tumblers. in addition to making the correct + * guess, one must make a skill check: + * 1 in 2^(lock.level - (skill/2)) chance + * + * lockpicking will play an ascending chromatic + * scale on a loop, starting on C3 and ending + * at G3, on synthbass (triangle wave) + */ + +struct encontyp { +(self) *prev +(self) *next +eventdata eventident +uchar tobeat //of 10D20 +spawntyp spawn + +struct miscitembasetyp: +bool key : 1 +bool pick : 1 +bool dig : 1 +bool music : 1 +bool light : 1 +bool book : 1 +bool spark : 1 +bool quest : 1 +bool fireproof : 1 +bool waterproof : 1 +bool elecproof : 1 +bool iceproof : 1 +bool stoneproof : 1 +bool arrow : 1 +bool poisoned : 1 +bool unbreak : 1 +unsigned uses : 8 +intptr_t metadata : 8 + +struct eventdata { +unsigned identnumber : 16 +bool uses_race : 1 +bool uses_role : 1 +bool uses_class : 1 +unsigned race : 5 +unsigned element : 8 +unsigned role : 2 +unsigned class : 3 +unsigned lde : 3 +unsigned chapter : 7 +unsigned align : 9 +} + +struct eventdatastack_ele { //list of events +(self)* prev +(self)* next +eventdata data +char * heylisten +eventdatastack_garbage * head +eventdatastack_garbage * tail +} + +struct eventdatastack_garbage { +(self) * next +(self) * prev +objid type +void * data +} + +enum eventdatastack_objid = { +EDS_ROOMOBJ_FLAG +EDS_QGLOBOBJ_FLAG +EDS_EVENTTYP_FLAG +EDS_QGLOBEV_FLAG +EDS_ENCONTYP_FLAG +EDS_PLACETYP_FLAG +} + +struct eventtyp: +(self) *prev +(self) *next +ucoord3 pos +eventdata eventdatavals +unsigned hours : 24 +int (*dothis)(void*,void*,void*,void*) +unsigned radius : 7 +bool interact : 1 +char16_t unichar +struct attrcolortyp attrcolor +unsigned up : 4 +unsigned down : 4 +unsigned duration : 16 +unsigned remduration : 16 + +struct triggertyp { +triggerenum key : 4 +unsigned value : 4 +} + +struct qglobobj: //queued global object +(self) *prev +(self) *next +eventdata eventident +qglobflags flags +latlontyp latlon +ucoord3 pos +objid type +void* data + +struct qglobev: //queued global event +(self) *prev +(self) *next +qglobflags flags +latlontyp latlon +ucoord3 pos +eventdata eventdatavals +unsigned hours : 24 +int (*dothis)(void*,void*,void*,void*) +unsigned radius : 7 +bool interact : 1 +char16_t unichar +struct attrcolortyp attrcolor +unsigned up : 4 +unsigned down : 4 +unsigned duration : 16 +unsigned remduration : 16 + +struct qglobflags { +struct racetyp race +canforceload : 1 +race-specific : 1 +role : u2 +class : u3 +alignment : u9 +} + +struct traptyp: +char16_t unichar +ushort duration +magictyp element +stattyp stat +cursetyp curse +diceodds odds +trapflags flags +sensetyp sense +short hp +short mp + +struct trapflags: +bool fireproof : 1 +bool waterproof : 1 +bool elecproof : 1 +bool iceproof : 1 +bool tamperproof : 1 +bool stoneproof : 1 +bool warded : 1 +unsigned attack_alignments : 9 +bool multiuse : 1 +bool magic : 1 //whether the trap is a mechanism or a rune +unsigned color : 6 + +struct subwarptyp { +bool perm : 1 +bool blink : 1 +unsigned color : 6 +ucoord3 pos +ucoord3 dest +short duration //negative are uses, positive are turns +} + +struct warptyp: +bool perm : 1 +bool blink : 1 +unsigned color : 6 +latlontyp glob_loc +ucoord3 pos +latlontyp glob_dest +ucoord3 dest +short duration + +struct gemstonetyp: +unsigned color : 3 +unsigned quality : 2 +unsigned cut : 2 + +struct meattyp: +struct racetyp race +uchar sellby +uchar amount + +struct foodtyp: +intptr_t itemid : 8 +intptr_t metadata : 8 +unsigned sellby : 8 +unsigned amount : 8 + +foodbasetyp: +effectyp effect +diceodds odds +uchar keepsfor //0 means non-perishable +uchar hp +uchar nutri + +enum objid: +WEAPON_FLAG : contains subobjtyp calling baseweaptyp +LEGEND_FLAG : contains subobjtyp calling baseweaptyp +POTION_FLAG : contains potiontyp +READ_FLAG : contains readtyp +FOOD_FLAG : contains subobjtyp containing foodtyp +MEAT_FLAG : contains subobjtyp containing meattyp +ARMOR_FLAG : contains subobjtyp calling basearmortyp +SHLD_FLAG : contains subobjtyp calling baseshldtyp +BAUB_FLAG : contains subobjtyp calling baubtyp +CONLANG_FLAG : contains conlangtyp +SPELL_FLAG : contains spelltyp +MISC_FLAG : contains _8bitPtr +GEM_FLAG : contains gemstonetyp +TRAP_FLAG : contains traptyp +WARP_FLAG : contains warptyp +SUBWARP_FLAG : contains subwarptyp +CHEST_FLAG : contains chestyp +DOOR_FLAG : contains doortyp +LOCK_FLAG : contains locktyp (gates are this) +MONEY_FLAG : contains moneytyp +SPAWN_FLAG : contains spawntyp +SIGN_FLAG : contains signtyp + diff --git a/src/wingrender.messy b/src/wingrender.messy index 72bb86b..ece1a60 100644 --- a/src/wingrender.messy +++ b/src/wingrender.messy @@ -8,6 +8,12 @@ X->Y.shape.wingoverride\ (\ basentity->base.skill.fly\ ||\ + (\ + (baseclass != NULL)\ + &&\ + baseclass->bonus.skill.fly\ + )\ + ||\ this->paffect.skill.fly\ ||\ this->effect.skill.fly\ @@ -36,10 +42,11 @@ else {\ }\ } -enttyp__wingrender(enttyp * this,basentyp * basentity,int yzindex,int cullplane,attr_t attrs) { +enttyp__wingrender(enttyp * this,basentyp * basentity,baseclasstyp * baseclass,int yzindex,int cullplane,attr_t attrs) { char16_t this_sprite[2]; if PREDICATE(this,effect) SWITCH_BODY(this,effect) else if PREDICATE(this,paffect) SWITCH_BODY(this,paffect) + esle if PREDICATE(baseclass,bonus) SWITCH_BODY(baseclass,bonus) else if PREDICATE(basentity,base) SWITCH_BODY(basentity,base) else {return 0;} if (