From 82b9a0903dd397f273f1b8f83bb22384e67e3308 Mon Sep 17 00:00:00 2001 From: GeneralGuy4872 Date: Mon, 30 Dec 2019 13:21:01 -0600 Subject: [PATCH] push to sync computers --- orkish_citadale_outer_courtyard.txt | 16 ++ src/class_cleric.carray | 8 + src/class_fighter.carray | 8 + src/class_magic_user.carray | 8 + src/class_rogue.carray | 8 + src/coord3list.messy | 407 ++++++++++++++++++++++++++++ src/drawline.c | 81 ++++++ src/gemstones.carray | 8 + src/legend.carray | 24 ++ src/monster0.carray | 3 + src/monster1.carray | 1 + src/monster2.carray | 1 + src/objects.h | 53 ++++ 13 files changed, 626 insertions(+) create mode 100644 orkish_citadale_outer_courtyard.txt create mode 100644 src/class_cleric.carray create mode 100644 src/class_fighter.carray create mode 100644 src/class_magic_user.carray create mode 100644 src/class_rogue.carray create mode 100644 src/coord3list.messy create mode 100644 src/drawline.c create mode 100644 src/gemstones.carray create mode 100644 src/legend.carray create mode 100644 src/monster0.carray create mode 100644 src/monster1.carray create mode 100644 src/monster2.carray create mode 100644 src/objects.h diff --git a/orkish_citadale_outer_courtyard.txt b/orkish_citadale_outer_courtyard.txt new file mode 100644 index 0000000..c9a1063 --- /dev/null +++ b/orkish_citadale_outer_courtyard.txt @@ -0,0 +1,16 @@ +################################################################ + #### #### #### #### #### #### ####### +## # # # # # # # # # # # # ###### +#### #### #### #### #### #### #### ##### +## # # # # # # # # # # # # # #### + #### #### #### #### #### #### #### ### +## # # # # # # # # # # # # # # ## +#### #### #### #### #### #### #### #### +## # # # # # # # # # # # # # # ## + #### #### #### #### #### #### #### ### +## # # # # # # # # # # # # # #### +#### #### #### #### #### #### #### ##### +## # # # # # # # # # # # # ###### + #### #### #### #### #### #### ####### +################################################################ +################################################################ diff --git a/src/class_cleric.carray b/src/class_cleric.carray new file mode 100644 index 0000000..dd977ba --- /dev/null +++ b/src/class_cleric.carray @@ -0,0 +1,8 @@ +{"healer","healers"}, +{"cleric","clerics"}, +{"priest","priests"}, +{"druid","druids"}, +{"alchemist","alchemists"}, +{"scholar","scholars"}, +{"white mage","white mages"}, +{"seer","seers"} diff --git a/src/class_fighter.carray b/src/class_fighter.carray new file mode 100644 index 0000000..f4a35d3 --- /dev/null +++ b/src/class_fighter.carray @@ -0,0 +1,8 @@ +{"fighter","fighters"} +{"knight","knights"}, +{"paladin","paladins"}, +{"valkyrie","valkyries"}, +{"viking","vikings"}, +{"samuri","samuri"}, +{"ranger","rangers"}, +{"monk","monks} diff --git a/src/class_magic_user.carray b/src/class_magic_user.carray new file mode 100644 index 0000000..7291fd5 --- /dev/null +++ b/src/class_magic_user.carray @@ -0,0 +1,8 @@ +{"magic-user","magic-users"}, +{"wizard","wizards"}, +{"illusionist","illusionists"}, +{"enchanter","enchanters"}, +{"black mage","black mages"}, +{"red mage","red mages}, +{"psion","psions"}, +{"necromancer","necromancers"} diff --git a/src/class_rogue.carray b/src/class_rogue.carray new file mode 100644 index 0000000..1d04209 --- /dev/null +++ b/src/class_rogue.carray @@ -0,0 +1,8 @@ +{"changeling","changelings"}, +{"rogue","rogues"}, +{"thief","thieves"}, +{"pirate","pirates"}, +{"ninja","ninjas"}, +{"assasin","assasins"}, +{"tourist","tourists"}, +{"ronan","ronans"} diff --git a/src/coord3list.messy b/src/coord3list.messy new file mode 100644 index 0000000..9339174 --- /dev/null +++ b/src/coord3list.messy @@ -0,0 +1,407 @@ +typedef struct ucoord3list { +struct ucoord3list * prev; +struct ucoord3list * next; +uchar x; +uchar y; +uchar z; +} ucoord3list; + +ucoord3list * ucoord3list__new (ucoord3 data) { + ucoord3list * new = malloc(sizeof(ucoord3list)); + new->prev = NULL; + new->next = NULL; + new->x = data[0]; + new->y = data[1]; + new->z = data[2]; + return new; + + +ucoord3list * ucoord3list__head_push_raw (ucoord3list * head,ucoord3list * new) { + new->prev = NULL; + new->next = head; + head->prev = new; + return new; + } + +#define ucoord3list__head_push_new(X,Y) ucoord3list__head_push_raw(X,ucoord3list__new(Y)) + +ucoord3list * ucoord3list__head_pop (ucoord3list * head) { + ucoord3list * output = head->next; + free(head); + output->prev = NULL; + return output; + } + +ucoord3list * ucoord3list__head_pull(ucoord3list * head,ucoord3list * this) { + if (this->prev != NULL) { + if (this->next != NULL) { + this->next->prev = this->prev; + this->prev->next = this->next; + } + else { + this->prev->next = NULL; + } + this->next = head; + head->prev = this; + this->prev = NULL; + return this; + else if (this == head) { + return head; + } + else { + raise(SIGILL); + abort(); + } + } + +/**HR**/ + +ucoord3list * ucoord3list__tail_push_raw (ucoord3list * tail,ucoord3list * new) { + new->prev = tail; + new->next = NULL; + tail->next = new; + return new; + } + +#define ucoord3list__tail_push_new(X,Y) ucoord3list__tail_push_raw(X,ucoord3list__new(Y)) + +ucoord3list * ucoord3list__tail_pop(ucoord3list * tail) { + ucoord3list * output = tail->prev; + free(tail); + output->next = NULL; + return output; + } + +ucoord3list * ucoord3list__tail_punt(ucoord3list * tail,ucoord3list * that) + if (that->next != NULL) { + if (that->prev != NULL) { + that->next->prev = that->prev; + that->prev->next = that->next; + } + else { + that->next->prev = NULL; + } + this->next = head; + head->prev = this; + this->prev = NULL; + return this; + else if (this == tail) { + return tail; + } + else { + raise(SIGILL); + abort(); + } + } + + +/**HR**/ + +ucoord3list * ucoord3list__insert_after_raw (ucoord3list * after,ucoord3list * new) { + if (after->next == NULL) { + return ucoord3list__tail_push(after,data); + } + else { + ucoord3list * before = after->next; + + new->prev = after; + after->next = new; + new->next = before; + before->prev = new; + return new; + } + } + +#define ucoord3list__insert_after_new(X,Y) ucoord3list__insert_after_raw(X,ucoord3list__new(Y)) + +ucoord3list * ucoord3list__insert_before(ucoord3list * before,ucoord3list * new) { + if (before->next == NULL) { + return ucoord3list__head_push(before,data); + } + else { + ucoord3list * after = before->prev; + + new->prev = after; + after->next = new; + new->next = before; + before->prev = new; + return new; + } + } + +#define ucoord3list__insert_before_new(X,Y) ucoord3list__insert_before_raw(X,ucoord3list__new(Y)) + +ucoord3list * ucoord3list__drop(ucoord3list * deadbeef) { + if (deadbeef->next != NULL) { + deadbeef->next->prev = deadbeef->prev; + } + if (deadbeef->prev != NULL) { + deadbeef->prev->next = deadbeef->next; + } + return deadbeef; + } + +/**HR**/ + +ucoord3list * ucoord3list__modify(ucoord3list * this,ucoord3 data) { + this->x = data[0]; + this->y = data[1]; + this->z = data[2]; + return this; + } + +ucoord3list__swap(ucoord3list * this,ucoord3list * that) { + if ((this != that) && ((this->prev != NULL) || (this->next != NULL) || (that->prev != NULL) || (that->next != NULL))) { + if (this->next == that) { + if (that->prev == this) { + ucoord3list before = this->prev; + ucoord3list before = that->next; + that->prev = before; + that->prev->next = that; + this->prev = that; + this->prev->next = this; + after->prev = this; + after->prev->next = after; + } + else { + raise(SIGBUS); + abort(); + } + else if (that->next == this) { + if (this->prev == that) { + ucoord3list before = that->prev; + ucoord3list after = this->next; + this->prev = before; + this->prev->next = this; + that->prev = this; + that->prev->next = that; + after->prev = that; + after->prev->next = after; + } + else { + raise(SIGBUS); + abort(); + } + } + else { + ucoord3list beforethis = this->prev; + ucoord3list afterthis = this->next; + ucoord3list beforethat = that->prev; + ucoord3list afterthat = that->next; + + that->prev = beforethis; + that->prev->next = that; + that->next = afterthis; + that->next->prev = that; + + this->prev = beforethat; + this->prev->next = this; + this->next = afterthat; + this->next->prev = this; + } + } + } + +typedef struct scoord3list { +struct scoord3list * prev; +struct scoord3list * next; +char x; +char y; +char z; +} scoord3list; + +scoord3list * scoord3list__new (scoord3 data) { + scoord3list * new = malloc(sizeof(scoord3list)); + new->prev = NULL; + new->next = NULL; + new->x = data[0]; + new->y = data[1]; + new->z = data[2]; + return new; + + +scoord3list * scoord3list__head_push_raw (scoord3list * head,scoord3list * new) { + new->prev = NULL; + new->next = head; + head->prev = new; + return new; + } + +#define scoord3list__head_push_new(X,Y) scoord3list__head_push_raw(X,scoord3list__new(Y)) + +scoord3list * scoord3list__head_pop (scoord3list * head) { + scoord3list * output = head->next; + free(head); + output->prev = NULL; + return output; + } + +scoord3list * scoord3list__head_pull(scoord3list * head,scoord3list * this) { + if (this->prev != NULL) { + if (this->next != NULL) { + this->next->prev = this->prev; + this->prev->next = this->next; + } + else { + this->prev->next = NULL; + } + this->next = head; + head->prev = this; + this->prev = NULL; + return this; + else if (this == head) { + return head; + } + else { + raise(SIGILL); + abort(); + } + } + +/**HR**/ + +scoord3list * scoord3list__tail_push_raw (scoord3list * tail,scoord3list * new) { + new->prev = tail; + new->next = NULL; + tail->next = new; + return new; + } + +#define scoord3list__tail_push_new(X,Y) scoord3list__tail_push_raw(X,scoord3list__new(Y)) + +scoord3list * scoord3list__tail_pop(scoord3list * tail) { + scoord3list * output = tail->prev; + free(tail); + output->next = NULL; + return output; + } + +scoord3list * scoord3list__tail_punt(scoord3list * tail,scoord3list * that) + if (that->next != NULL) { + if (that->prev != NULL) { + that->next->prev = that->prev; + that->prev->next = that->next; + } + else { + that->next->prev = NULL; + } + this->next = head; + head->prev = this; + this->prev = NULL; + return this; + else if (this == tail) { + return tail; + } + else { + raise(SIGILL); + abort(); + } + } + + +/**HR**/ + +scoord3list * scoord3list__insert_after_raw (scoord3list * after,scoord3list * new) { + if (after->next == NULL) { + return scoord3list__tail_push(after,data); + } + else { + scoord3list * before = after->next; + + new->prev = after; + after->next = new; + new->next = before; + before->prev = new; + return new; + } + } + +#define scoord3list__insert_after_new(X,Y) scoord3list__insert_after_raw(X,scoord3list__new(Y)) + +scoord3list * scoord3list__insert_before(scoord3list * before,scoord3list * new) { + if (before->next == NULL) { + return scoord3list__head_push(before,data); + } + else { + scoord3list * after = before->prev; + + new->prev = after; + after->next = new; + new->next = before; + before->prev = new; + return new; + } + } + +#define scoord3list__insert_before_new(X,Y) scoord3list__insert_before_raw(X,scoord3list__new(Y)) + +scoord3list * scoord3list__drop(scoord3list * deadbeef) { + if (deadbeef->next != NULL) { + deadbeef->next->prev = deadbeef->prev; + } + if (deadbeef->prev != NULL) { + deadbeef->prev->next = deadbeef->next; + } + return deadbeef; + } + +/**HR**/ + +scoord3list * scoord3list__modify(scoord3list * this,scoord3 data) { + this->x = data[0]; + this->y = data[1]; + this->z = data[2]; + return this; + } + +scoord3list__swap(scoord3list * this,scoord3list * that) { + if ((this != that) && ((this->prev != NULL) || (this->next != NULL) || (that->prev != NULL) || (that->next != NULL))) { + if (this->next == that) { + if (that->prev == this) { + scoord3list before = this->prev; + scoord3list before = that->next; + that->prev = before; + that->prev->next = that; + this->prev = that; + this->prev->next = this; + after->prev = this; + after->prev->next = after; + } + else { + raise(SIGBUS); + abort(); + } + else if (that->next == this) { + if (this->prev == that) { + scoord3list before = that->prev; + scoord3list after = this->next; + this->prev = before; + this->prev->next = this; + that->prev = this; + that->prev->next = that; + after->prev = that; + after->prev->next = after; + } + else { + raise(SIGBUS); + abort(); + } + } + else { + scoord3list beforethis = this->prev; + scoord3list afterthis = this->next; + scoord3list beforethat = that->prev; + scoord3list afterthat = that->next; + + that->prev = beforethis; + that->prev->next = that; + that->next = afterthis; + that->next->prev = that; + + this->prev = beforethat; + this->prev->next = this; + this->next = afterthat; + this->next->prev = this; + } + } + } diff --git a/src/drawline.c b/src/drawline.c new file mode 100644 index 0000000..2be9404 --- /dev/null +++ b/src/drawline.c @@ -0,0 +1,81 @@ +ucoord3list * attractorline(ucoord3 p1, ucoord3 p2,int glyph) { + +x = p2[0] - p1[0]; +y = p2[1] - p1[1]; +z = p2[2] - p1[2]; +euclid = sqrt((x * x) + (y * y) + (z * z)); + +ucoord3list * head = ucoord3list(p1); +ucoord3list * tail = ucoord3list(p2); +head->next = tail; +tail->prev = head; + +/*for*/{ + int i = 1; + int n = 2; + struct setcoord3 * oldprev = head; + struct setcoord3 * oldnext = tail; + + while ((n < euclid) && (oldprev->next != NULL)) { + /*do*/ + oldnext = oldprev->next; + struct setcoord3 * new = malloc(sizeof(struct setcoord3)); + oldprev->next = new; + oldnext->prev = new; + new->prev = oldprev; + new->next = oldnext; + new->x = (oldprev->x + oldnext->x) / 2; + new->y = (oldprev->y + oldnext->y) / 2; + /*and then do*/ + oldprev = oldnext; + n += i; + i++; + } + } +return head; +} + + +/*unfinished*/ +breshamline(char args,ucoord3 p1,ucoord3 p2,int glyph) + int deltx = p1[0] - p0[0]; + int xdir = sgn(deltx); + if (xdir < 0) { + deltx *= -1; + } + int delty = p1[1] - p0[1]; + int ydir = sgn(delty); + if (ydir < 0) { + delty *= -1; + } + int deltz = p1[2] - p0[2]; + int zdir = sgn(deltz); + if (zdir < 0) { + deltz *= -1; + } + + /*HR*/ + + if ((abs(delty) ≤ 1) && (abs(deltz) ≤ 1)) { + goto(goforx); + } + else if ((abs(deltx) ≤ 1) && (abs(deltz) ≤ 1)) { + goto(gofory); + } + else if ((abs(deltx) ≤ 1) && (abs(delty) ≤ 1)) { + goto(goforz); + } + + /*HR*/ + + goforx: + /*for*/{ + int n = 0; + int x = p0[0]; + + while ((x != p1[0]) && (n < 100)) { + + /*and then*/ + x += xdir; + n++; + } \ No newline at end of file diff --git a/src/gemstones.carray b/src/gemstones.carray new file mode 100644 index 0000000..8410617 --- /dev/null +++ b/src/gemstones.carray @@ -0,0 +1,8 @@ +{"jet","jets"}, +{"sapphire","sapphires"}, +{"emerald","emeralds"}, +{"turquoise","turquoises"}, +{"ruby","rubies"}, +{"amythest","amythests"}, +{"heliodor","heliodors"}, +{"diamond","diamonds"} diff --git a/src/legend.carray b/src/legend.carray new file mode 100644 index 0000000..cf60227 --- /dev/null +++ b/src/legend.carray @@ -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/monster0.carray b/src/monster0.carray new file mode 100644 index 0000000..457b85a --- /dev/null +++ b/src/monster0.carray @@ -0,0 +1,3 @@ +{"human","humans"},{"elf","elves"},{"dwarf","dwarfs"},{"gnome","gnomes"},{"hobbit","hobbits"},{"half elf","half elves"},{"drow","drow"},{"orc","orks"},{"half orc","half orks"},{"half dragon","half dragons"},/*half celestial*/,{"tiefling","tieflings"},{"half air elemental","half air elementals"},{"half water elemental","half water elementals"},{"half earth elemental","half earth elementals"},{"half fire elemental","half fire elementals"}, +{"merfolk","merfolk},{"sea elf","sea elves"},{"satyr","satyres"},{"fairy","fairies"},{"pixie","pixies"},{"naiad","naiads"},{"wood elf","wood elves"},{"dryad","dryads"},{"naga","nagas"},{"kobald","kobalds"},{"centaur","centaurs"},{"sphinx","sphinxes"},{"half electric elemental","half electric elementals"},{"half ice elemental","half ice elementals"},{"half nature elemental","half nature elementals"},{"half metal elemental","half metal elementals"}, +{"siren","sirens"},{"harpy","harpies"},{"erinys","erinyes"},{"kerr","keres"}, diff --git a/src/monster1.carray b/src/monster1.carray new file mode 100644 index 0000000..a5aaa46 --- /dev/null +++ b/src/monster1.carray @@ -0,0 +1 @@ +{"grue","grue},{"newt","newts"}, diff --git a/src/monster2.carray b/src/monster2.carray new file mode 100644 index 0000000..68a940c --- /dev/null +++ b/src/monster2.carray @@ -0,0 +1 @@ +{"rook","rooks"},{"raven","ravens"},{"jackdaw","jackdaws"}, diff --git a/src/objects.h b/src/objects.h new file mode 100644 index 0000000..7fc0d23 --- /dev/null +++ b/src/objects.h @@ -0,0 +1,53 @@ +#ifndef IWANNAFLY_OBJECTS_H_REENTERANT +#define IWANNAFLY_OBJECTS_H_REENTERANT 1 + +struct roomstackele { +struct roomstackele * prev; +struct roomstackele * next; +roomtyp * room; +} + +struct roomstackobj { +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; +ushort depth; +} + +extern roomstackele * roomstackobj__pushover(roomstackobj * this,roomtyp * room); +#define ROOMSTACK__pushover(R) roomstackobj(ROOMSTACK,R) + +extern void roomstackobj__trim(roomstackobj * this); +#define ROOMSTACK__trim() roomstackobj__trim(ROOMSTACK) + +extern roomstackele * roomstackobj__push(roomstackobj * this,roomtyp * room); +#define ROOMSTACK__push(R) roomstackobj__push(ROOMSTACK,R) + +#define roomstackobj__roompull(X,Y) roomstackobj__pull(X,roomstackobj__roomp(X,Y)) +#define ROOMSTACK__roompull(Y) roomstackobj__roompull(ROOMSTACK,Y) + +extern roomstackele * roomstackobj__pull (roomstackobj * this, roomstackele * that); +#define ROOMSTACK__pull(X) roomstackobj__pull(ROOMSTACK,X) + +extern roomstackobj__setswap (roomstackobj * this, roomtyp * that); +#define ROOMSTACK__setswap(X) roomstackobj__setswap(ROOMSTACK,X) + +#define roomstackobj__setswap_ele(X,Y) roomstackobj__setswap(X,roomstackobj__drop(X,Y)) +#define ROOMSTACK__setswap_ele(Y) roomstackobj__setswap_ele(ROOMSTACK,Y) + +extern roomstackobj__makecurrent(roomstackobj * this,latlontyp query); +#define ROOMSTACK__makecurrent(Q) roomstackobj__makecurrent(ROOMSTACK,Q) + +extern roomstackobj__scroll(roomstackobj * this,playertyp * you,char dir); +#define ROOMSCROLL(D) roomstackobj__scroll(ROOMSTACK,PLAYER,D) + +extern roomstackobj__neighbor_reset (struct roomstack * this); +#define ROOMSTACK__neighbor_reset() roomstackobj__neighbor_reset(ROOMSTACK) + +extern smrtloadroom (struct latlontyp query); + +extern struct planetyp getplanetyp (struct latlontyp input); + +#endif