diff --git a/src/bresenham.c b/src/bresenham.c index 8c1ba83..089f74c 100644 --- a/src/bresenham.c +++ b/src/bresenham.c @@ -8,14 +8,55 @@ int signz = sgnf(deltaz); ucoordlist3 * output = ucoordlist3__new(p1); ucoordlist3 * output_tail = output; -if ( (fabs(deltay) ≤ 1.0) && (fabs(deltaz) ≤ 1.0) ) { +if ( (deltax == 0.0) && (deltay == 0.0) && (deltaz == 0.0) ) { + return output; + } + +else if ( (deltay == 0.0) && (deltaz == 0.0) ) { + for (int x = p1[0];x != p2[0];x += signx) { + output_tail = ucoordlist3__tail_push_int(output_tail,x,p1[1],p1[2]); + } + return output; + } + +else if ( (deltax == 0.0) && (deltaz == 0.0) ) { + for (int y = p1[1];y != p2[1];y += signy) { + output_tail = ucoordlist3__tail_push_int(output_tail,p1[0],y,p1[2]); + } + return output; + } + +else if ( (deltax == 0.0) && (deltay == 0.0) ) { + for (int z = p1[2];z != p2[2];z += signz) { + output_tail = ucoordlist3__tail_push_int(output_tail,p1[0],p1[1],z); + } + return output; + } + +/* handling for single zeros here */ + +else if ( (fabs(deltax) == 1.0) && (fabs(deltay) == 1.0) && (fabs(deltaz) == 1.0) ) { + int x = p1[0]; + int y = p1[1]; + int z = p1[2]; + while (x != p2[0]) { //for 45 degree angles, only one needs to be checked + x += signx; + y += signy; + z += signz; + output_tail = ucoordlist3__tail_push_int(output_tail,x,y,z); + } + return output; + } + +else if ( (fabs(deltay) ≤ 1.0) && (fabs(deltaz) ≤ 1.0) ) { float deltaerrory = fabs(deltay / deltax); float errory = 0.0; float deltaerrorz = fabs(deltaz / deltax); float errorz = 0.0; - int x,y,z; + int x = p1[0]; + int y = p1[1]; + int z = p1[2]; forever { - output_tail = ucoordlist3__tail_push_int(output_tail,x,y,z); errory += deltaerrory; if (errory ≥ 0.5) { y += signy; @@ -25,12 +66,13 @@ if ( (fabs(deltay) ≤ 1.0) && (fabs(deltaz) ≤ 1.0) ) { z += signz; errorz -= 1.0;} x += signx; + output_tail = ucoordlist3__tail_push_int(output_tail,x,y,z); /*conditional exits below*/ if (signx < 0) { if (x ≤ p2[0]) {return output} } else { - if (x ≥ p2[0] {return output} + if (x ≥ p2[0]) {return output} } } diff --git a/src/checkattrib.messy b/src/checkattrib.messy new file mode 100644 index 0000000..2854b5c --- /dev/null +++ b/src/checkattrib.messy @@ -0,0 +1,2 @@ +playertyp__movecheck(playertyp this,int x,int y, int z) + diff --git a/src/main.c b/src/main.c index 1126e99..7aafbf9 100644 --- a/src/main.c +++ b/src/main.c @@ -643,7 +643,7 @@ basentyp (*montable[256])[16] = { * Y : yeti, bigfoot, * y : ape, monkey, gorilla, chimp, leamur, * Z : - * {}: /(flesh|straw|clay|stone|glass|paper|leather) golem/, /(gold|copper|finite-state) automaton/, chest monster, + * {}: /(flesh|straw|clay|stone|glass|paper|leather) golem/, /(gold|copper|silver|brass|bronze|pewter|tin|lead|iron|steel|finite-state) automaton/, chest monster, * ? : mystery person * «»: bass, trout, salmon, tuna, carp, pike, halibut, herring, cod * × : lizard, geko, skink, @@ -857,7 +857,20 @@ A_INVIS is not able to be seen A_REVERSE video is a magic spell's area of effect A_UNDERLINE is the shadow of an entity -text that is cat-ed from an nfo file, or otherwise printed using stdio, will not be restricted to ncurses formatting, +(unimplemented) +for playing a musical instrument: +1234567 play a note on a diatonic scale +prefixing with / makes the note one half-step flat +prefixing with * makes the note one half-step sharp +prefixing with - makes the note one quarter-step flat +prefixing with + makes the note one quarter-step sharp +prefixing with < makes the note one octave lower +prefixing with > makes the note one octave higher +the symbols must be entered in the order [<>][-+][*/][1234567] + +(mostly obsolete) +text that is cat-ed from an nfo file, or otherwise printed using stdio, +will not be restricted to ncurses formatting, and will use the full range of ANSI SGR escape codes rune symbols @@ -880,7 +893,6 @@ directional symbols: ◬, ⍫, △, ▽, ⋇, ↯, ♤, ♻, ☼, ☽, ∅, inner planes; LG, NG, CG, LN, CN, LE, NE, CE, TN, UN, ☠, outer planes; - /*blackbox*/playervelocitycheck() velocitycheck(*entity) /* if you have a nonzero velocity vector, when you try to move * you travel in a direction determined by the mean vector of diff --git a/src/midpointsphere.messy b/src/midpointsphere.messy new file mode 100644 index 0000000..729049c --- /dev/null +++ b/src/midpointsphere.messy @@ -0,0 +1,107 @@ +shadowmask sphere(ucoord3 omega,int rho) { + shadowmask * output; + { + int point[3][8][3]; + /* 0=xy + * 1=xz + * 2=yz + * + * 7 0 0 + * 6 1 3 1 + * 5 2 2 + * 4 3 + */ + for (int n = 0;n < 3;n++) { + for (int m = 0;m < 4;m++) { + point[n][m][0] = omega[0]; point[n][m][1] = omega[1]; point[n][m][2] = omega[2]; + } + } + while ((squared(point[0][0][0] - omega[0]) + squared(point[0][0][1] - omega[1]) + squared(point[0][0][2] - omega[2])) < squared(rho)) {point[0][0][1]--;} + while ((squared(point[0][1][0] - omega[0]) + squared(point[0][1][1] - omega[1]) + squared(point[0][1][2] - omega[2])) < squared(rho)) {point[0][0][0]++;} + while ((squared(point[0][2][0] - omega[0]) + squared(point[0][2][1] - omega[1]) + squared(point[0][2][2] - omega[2])) < squared(rho)) {point[0][0][1]++;} + while ((squared(point[0][3][0] - omega[0]) + squared(point[0][3][1] - omega[1]) + squared(point[0][3][2] - omega[2])) < squared(rho)) {point[0][0][0]--;} + while ((squared(point[1][0][0] - omega[0]) + squared(point[1][0][1] - omega[1]) + squared(point[1][0][2] - omega[2])) < squared(rho)) {point[1][0][2]++;} + while ((squared(point[1][1][0] - omega[0]) + squared(point[1][1][1] - omega[1]) + squared(point[1][1][2] - omega[2])) < squared(rho)) {point[1][0][0]++;} + while ((squared(point[1][2][0] - omega[0]) + squared(point[1][2][1] - omega[1]) + squared(point[1][2][2] - omega[2])) < squared(rho)) {point[1][0][2]--;} + while ((squared(point[1][3][0] - omega[0]) + squared(point[1][3][1] - omega[1]) + squared(point[1][3][2] - omega[2])) < squared(rho)) {point[1][0][0]--;} + while ((squared(point[2][0][0] - omega[0]) + squared(point[2][0][1] - omega[1]) + squared(point[2][0][2] - omega[2])) < squared(rho)) {point[2][0][2]++;} + while ((squared(point[2][1][0] - omega[0]) + squared(point[2][1][1] - omega[1]) + squared(point[2][1][2] - omega[2])) < squared(rho)) {point[2][0][1]++;} + while ((squared(point[2][2][0] - omega[0]) + squared(point[2][2][1] - omega[1]) + squared(point[2][2][2] - omega[2])) < squared(rho)) {point[2][0][2]--;} + while ((squared(point[2][3][0] - omega[0]) + squared(point[2][3][1] - omega[1]) + squared(point[2][3][2] - omega[2])) < squared(rho)) {point[2][0][1]--;} + for (int a = 0;a < 3;a++) { + for (int b = 0;b < 4;b++) { + maskset(point[a][b][2],point[a][b][1],point[a][b][0],output,true); + } + } + bool stop = (rho > 1); //dubious + for (int i = 1;!stop;i++) { + point[0][0][0] = omega[0] + i; point[0][0][1] = omega[1]; point[0][0][2] = omega[2]; + point[0][1][0] = omega[0]; point[0][1][1] = omega[1] - i; point[0][1][2] = omega[2]; + point[0][2][0] = omega[0]; point[0][2][1] = omega[1] + i; point[0][2][2] = omega[2]; + point[0][3][0] = omega[0] + i; point[0][3][1] = omega[1]; point[0][3][2] = omega[2]; + point[0][4][0] = omega[0] - i; point[0][4][1] = omega[1]; point[0][4][2] = omega[2]; + point[0][5][0] = omega[0]; point[0][5][1] = omega[1] + i; point[0][5][2] = omega[2]; + point[0][6][0] = omega[0]; point[0][6][1] = omega[1] - i; point[0][6][2] = omega[2]; + point[0][7][0] = omega[0] - i; point[0][7][1] = omega[1]; point[0][7][2] = omega[2]; + while ((squared(point[0][0][0] - omega[0]) + squared(point[0][0][1] - omega[1]) + squared(point[0][0][2] - omega[2])) < squared(rho)) {point[0][0][1]--;} + while ((squared(point[0][1][0] - omega[0]) + squared(point[0][1][1] - omega[1]) + squared(point[0][1][2] - omega[2])) < squared(rho)) {point[0][1][0]++;} + while ((squared(point[0][2][0] - omega[0]) + squared(point[0][2][1] - omega[1]) + squared(point[0][2][2] - omega[2])) < squared(rho)) {point[0][2][0]++;} + while ((squared(point[0][3][0] - omega[0]) + squared(point[0][3][1] - omega[1]) + squared(point[0][3][2] - omega[2])) < squared(rho)) {point[0][3][1]++;} + while ((squared(point[0][4][0] - omega[0]) + squared(point[0][4][1] - omega[1]) + squared(point[0][4][2] - omega[2])) < squared(rho)) {point[0][4][1]++;} + while ((squared(point[0][5][0] - omega[0]) + squared(point[0][5][1] - omega[1]) + squared(point[0][5][2] - omega[2])) < squared(rho)) {point[0][5][0]--;} + while ((squared(point[0][6][0] - omega[0]) + squared(point[0][6][1] - omega[1]) + squared(point[0][6][2] - omega[2])) < squared(rho)) {point[0][6][0]--;} + while ((squared(point[0][7][0] - omega[0]) + squared(point[0][7][1] - omega[1]) + squared(point[0][7][2] - omega[2])) < squared(rho)) {point[0][7][1]--;} + point[1][0][0] = omega[0] + i; point[1][0][1] = omega[1]; point[1][0][2] = omega[2]; + point[1][1][0] = omega[0]; point[1][1][1] = omega[1]; point[1][1][2] = omega[2] + i; + point[1][2][0] = omega[0]; point[1][2][1] = omega[1]; point[1][2][2] = omega[2] - i; + point[1][3][0] = omega[0] + i; point[1][3][1] = omega[1]; point[1][3][2] = omega[2]; + point[1][4][0] = omega[0] - i; point[1][4][1] = omega[1]; point[1][4][2] = omega[2]; + point[1][5][0] = omega[0]; point[1][5][1] = omega[1]; point[1][5][2] = omega[2] - i; + point[1][6][0] = omega[0]; point[1][6][1] = omega[1]; point[1][6][2] = omega[2] + i; + point[1][7][0] = omega[0] - i; point[1][7][1] = omega[1]; point[1][7][2] = omega[2]; + while ((squared(point[1][0][0] - omega[0]) + squared(point[1][0][1] - omega[1]) + squared(point[1][0][2] - omega[2])) < squared(rho)) {point[1][0][2]++;} + while ((squared(point[1][1][0] - omega[0]) + squared(point[1][1][1] - omega[1]) + squared(point[1][1][2] - omega[2])) < squared(rho)) {point[1][1][0]++;} + while ((squared(point[1][2][0] - omega[0]) + squared(point[1][2][1] - omega[1]) + squared(point[1][2][2] - omega[2])) < squared(rho)) {point[1][2][0]++;} + while ((squared(point[1][3][0] - omega[0]) + squared(point[1][3][1] - omega[1]) + squared(point[1][3][2] - omega[2])) < squared(rho)) {point[1][3][2]--;} + while ((squared(point[1][4][0] - omega[0]) + squared(point[1][4][1] - omega[1]) + squared(point[1][4][2] - omega[2])) < squared(rho)) {point[1][4][2]--;} + while ((squared(point[1][5][0] - omega[0]) + squared(point[1][5][1] - omega[1]) + squared(point[1][5][2] - omega[2])) < squared(rho)) {point[1][5][0]--;} + while ((squared(point[1][6][0] - omega[0]) + squared(point[1][6][1] - omega[1]) + squared(point[1][6][2] - omega[2])) < squared(rho)) {point[1][6][0]--;} + while ((squared(point[1][7][0] - omega[0]) + squared(point[1][7][1] - omega[1]) + squared(point[1][7][2] - omega[2])) < squared(rho)) {point[1][7][2]++;} + point[2][0][0] = omega[0]; point[2][0][1] = omega[1] + i; point[2][0][2] = omega[2]; + point[2][1][0] = omega[0]; point[2][1][1] = omega[1]; point[2][1][2] = omega[2] + i; + point[2][2][0] = omega[0]; point[2][2][1] = omega[1]; point[2][2][2] = omega[2] - i; + point[2][3][0] = omega[0]; point[2][3][1] = omega[1] + i; point[2][3][2] = omega[2]; + point[2][4][0] = omega[0]; point[2][4][1] = omega[1] - i; point[2][4][2] = omega[2]; + point[2][5][0] = omega[0]; point[2][5][1] = omega[1]; point[2][5][2] = omega[2] - i; + point[2][6][0] = omega[0]; point[2][6][1] = omega[1]; point[2][6][2] = omega[2] + i; + point[2][7][0] = omega[0]; point[2][7][1] = omega[1] - i; point[2][7][2] = omega[2]; + while ((squared(point[2][0][0] - omega[0]) + squared(point[2][0][1] - omega[1]) + squared(point[2][0][2] - omega[2])) < squared(rho)) {point[2][0][2]++;} + while ((squared(point[2][1][0] - omega[0]) + squared(point[2][1][1] - omega[1]) + squared(point[2][1][2] - omega[2])) < squared(rho)) {point[2][1][1]++;} + while ((squared(point[2][2][0] - omega[0]) + squared(point[2][2][1] - omega[1]) + squared(point[2][2][2] - omega[2])) < squared(rho)) {point[2][2][1]++;} + while ((squared(point[2][3][0] - omega[0]) + squared(point[2][3][1] - omega[1]) + squared(point[2][3][2] - omega[2])) < squared(rho)) {point[2][3][2]--;} + while ((squared(point[2][4][0] - omega[0]) + squared(point[2][4][1] - omega[1]) + squared(point[2][4][2] - omega[2])) < squared(rho)) {point[2][4][2]--;} + while ((squared(point[2][5][0] - omega[0]) + squared(point[2][5][1] - omega[1]) + squared(point[2][5][2] - omega[2])) < squared(rho)) {point[2][5][1]--;} + while ((squared(point[2][6][0] - omega[0]) + squared(point[2][6][1] - omega[1]) + squared(point[2][6][2] - omega[2])) < squared(rho)) {point[2][6][1]--;} + while ((squared(point[2][7][0] - omega[0]) + squared(point[2][7][1] - omega[1]) + squared(point[2][7][2] - omega[2])) < squared(rho)) {point[2][7][2]++;} + for (int a = 0;a < 3;a++) { + for (int b = 0;b < 8;b++) { + maskset(point[a][b][2],point[a][b][1],point[a][b][0],output,true); + } + } + stop |= (point[0][0][0] == point[0][1][0]); stop |= (point[0][0][1] == point[0][1][1]); stop |= (point[0][0][2] == point[0][1][2]); + stop |= (point[0][2][0] == point[0][3][0]); stop |= (point[0][2][1] == point[0][3][1]); stop |= (point[0][2][2] == point[0][3][2]); + stop |= (point[0][4][0] == point[0][5][0]); stop |= (point[0][4][1] == point[0][5][1]); stop |= (point[0][4][2] == point[0][5][2]); + stop |= (point[0][6][0] == point[0][7][0]); stop |= (point[0][6][1] == point[0][7][1]); stop |= (point[0][6][2] == point[0][7][2]); + + stop |= (point[1][0][0] == point[1][1][0]); stop |= (point[1][0][1] == point[1][1][1]); stop |= (point[1][0][2] == point[1][1][2]); + stop |= (point[1][2][0] == point[1][3][0]); stop |= (point[1][2][1] == point[1][3][1]); stop |= (point[1][2][2] == point[1][3][2]); + stop |= (point[1][4][0] == point[1][5][0]); stop |= (point[1][4][1] == point[1][5][1]); stop |= (point[1][4][2] == point[1][5][2]); + stop |= (point[1][6][0] == point[1][7][0]); stop |= (point[1][6][1] == point[1][7][1]); stop |= (point[1][6][2] == point[1][7][2]); + + stop |= (point[2][0][0] == point[2][1][0]); stop |= (point[2][0][1] == point[2][1][1]); stop |= (point[2][0][2] == point[2][1][2]); + stop |= (point[2][2][0] == point[2][3][0]); stop |= (point[2][2][1] == point[2][3][1]); stop |= (point[2][2][2] == point[2][3][2]); + stop |= (point[2][4][0] == point[2][5][0]); stop |= (point[2][4][1] == point[2][5][1]); stop |= (point[2][4][2] == point[2][5][2]); + stop |= (point[2][6][0] == point[2][7][0]); stop |= (point[2][6][1] == point[2][7][1]); stop |= (point[2][6][2] == point[2][7][2]); + } + return *output; + } diff --git a/src/move.messy b/src/move.messy new file mode 100644 index 0000000..e69de29 diff --git a/src/questdialogs/README.md b/src/questdialogs/README.md deleted file mode 100644 index ed86699..0000000 --- a/src/questdialogs/README.md +++ /dev/null @@ -1,8 +0,0 @@ -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/sphere.messy b/src/sphere.messy new file mode 100644 index 0000000..8d32fba --- /dev/null +++ b/src/sphere.messy @@ -0,0 +1,55 @@ +shadowmask ucoord3__sphere(ucoord3 omega,int r) { + shadowmask output; + ucoord2 xy[8],xz[8],yz[8]; + for (int i = 0;;i++) { + xy[0][0] = omega[0] + i; + xy[0][1] = omega[1]; + xy[1][0] = omega[0]; + xy[1][1] = omega[1] - i; + xy[2][0] = omega[0]; + xy[2][1] = omega[1] + i; + xy[3][0] = omega[0] + i; + xy[3][1] = omega[1]; + xy[4][0] = omega[0] - i; + xy[4][1] = omega[1]; + xy[5][0] = omega[0]; + xy[5][1] = omega[1] - i; + xy[6][0] = omega[0]; + xy[6][1] = omega[1] + i; + xy[7][0] = omega[0] - i; + xy[7][1] = omega[1]; + /**HR**/ + xz[0][0] = omega[0] + i; + xz[0][1] = omega[2]; + xz[1][0] = omega[0]; + xz[1][1] = omega[2] - i; + xz[2][0] = omega[0]; + xz[2][1] = omega[2] + i; + xz[3][0] = omega[0] + i; + xz[3][1] = omega[2]; + xz[4][0] = omega[0] - i; + xz[4][1] = omega[2]; + xz[5][0] = omega[0]; + xz[5][1] = omega[2] - i; + xz[6][0] = omega[0]; + xz[6][1] = omega[2] + i; + xz[7][0] = omega[0] - i; + xz[7][1] = omega[2]; + /**HR**/ + yz[0][0] = omega[1] + i; + yz[0][1] = omega[2]; + yz[1][0] = omega[1]; + yz[1][1] = omega[2] - i; + yz[2][0] = omega[1]; + yz[2][1] = omega[2] + i; + yz[3][0] = omega[1] + i; + yz[3][1] = omega[2]; + yz[4][0] = omega[1] - i; + yz[4][1] = omega[2]; + yz[5][0] = omega[1]; + yz[5][1] = omega[2] - i; + yz[6][0] = omega[1]; + yz[6][1] = omega[2] + i; + yz[7][0] = omega[1] - i; + yz[7][1] = omega[2]; + /**HR**/ diff --git a/src/types.h b/src/types.h index 0eb20d1..5500b60 100644 --- a/src/types.h +++ b/src/types.h @@ -394,18 +394,18 @@ unsigned mastery : 2 struct baseclasstyp { struct paffectyp bonus -uchar spd_plus -uchar air_plus -struct conlangtyp lang_plus +uchar spd +uchar air +struct conlangtyp lang _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 +unsigned lde : 3 //grants +unsigned alignment : 9 //requires +unsigned element : 8 //grants } struct the8stats: //8* 5D6 @@ -431,6 +431,30 @@ uchar elecollect[8]; uchar questcollect[3]; } +/* note: everything related to players and entitys is + * copied into the struct, because it might be changed. + * the base entities and base classes are only templates. + * + * whenever you "rest" in-game, all entities are re-verified; + * meaning that all effect registers are recalculated. this + * has the side effect of removing any non-item based buffs + * and debuffs. this should be one of the only times that + * a baseclasstyp or basentyp are referenced; the others + * being adding a class, looseing a class, advancing in a class, + * polymorphing, polylocking, by the renderer, + * and when spawning a new entity. + * + * some stats are spread out accross multiple fields in the structure; + * most effects have one field for permenant and one field for temporary + * versions of the effect. a handful of alteration spells have a third + * register, with the polymorph stack, for timed spells, since the + * other temporary slot has no timer. + * + * nearly all fields of the player struct are created by COMBINING the + * basentyp and baseclasstyp chosen at the creation of the savefile. + * the remainder are based on backstory and user input. + */ + struct playertyp: char * name classtyp class[3] @@ -439,8 +463,8 @@ agetyp age struct shiftstackobj race ucoord3 pos polar facing -vector3 velo -float carryover //leftover moves; never exceeds 2 +uchar spd +float carryover //leftover moves; maximum of 5 paffectyp permenent effectyp fromequip trackalignplayertyp align @@ -492,8 +516,7 @@ uchar hplvl uchar mplvl uchar xplvl uchar airmax //how long you can hold your breath -struct conlangtyp lang0 -struct conlangtyp lang1 +struct conlangtyp lang[2] _8BITPTR spell[4] bitfield psyattack char16_t sprite @@ -531,7 +554,7 @@ aggrotyp aggro struct shiftstackobj race ucoord3 pos polar facing -vector3 velo +uchar spd float carryover paffectyp paffect effectyp effect @@ -574,7 +597,7 @@ aggrotyp aggro struct shiftstackobj race ucoord3 pos polar facing -vector3 velo +uchar spd float carryover paffectyp permenent effectyp fromequip @@ -818,7 +841,6 @@ 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; diff --git a/src/util.c b/src/util.c index 51eda04..fd35a7f 100644 --- a/src/util.c +++ b/src/util.c @@ -2,7 +2,7 @@ skip () {} /*---INTERGALS---*/ -__attribute__((const)) max(int a,int b) { +signed __attribute__((const)) max(signed a,signed b) { if (a ≥ b) { return a; } @@ -10,7 +10,7 @@ __attribute__((const)) max(int a,int b) { return b; } -__attribute__((const)) min(int a,int b) { +signed __attribute__((const)) min(signed a,signed b) { if (a ≥ b) { return a; } @@ -34,6 +34,13 @@ unsigned __attribute__((const)) umin(unsigned a,unsigned b) { return b; } +unsigned __attribute__((const)) squared(signed n) { + return n * n + } + +unsigned __attribute__((const)) usquared(unsigned n) { + return n * n + } __attribute__((const)) sgn(int n) { if (n == 0) { @@ -52,7 +59,7 @@ __attribute__((const)) sgn(int n) { /*---LONG---*/ -long __attribute__((const)) maxl(long a,long b) { +signed long __attribute__((const)) maxl(signed long a,signed long b) { if (a ≥ b) { return a; } @@ -60,7 +67,7 @@ long __attribute__((const)) maxl(long a,long b) { return b; } -long __attribute__((const)) minl(long a,long b) { +signed long __attribute__((const)) minl(signed long a,signed long b) { if (a ≥ b) { return a; } @@ -68,7 +75,7 @@ long __attribute__((const)) minl(long a,long b) { return b; } -long __attribute__((const)) umaxl(unsigned long a,unsigned long b) { +unsigned long __attribute__((const)) umaxl(unsigned long a,unsigned long b) { if (a ≥ b) { return a; } @@ -76,7 +83,7 @@ long __attribute__((const)) umaxl(unsigned long a,unsigned long b) { return b; } -long __attribute__((const)) uminl(unsigned long a,unsigned long b) { +unsigned long __attribute__((const)) uminl(unsigned long a,unsigned long b) { if (a ≥ b) { return a; } @@ -84,6 +91,14 @@ long __attribute__((const)) uminl(unsigned long a,unsigned long b) { return b; } +unsigned long __attribute__((const)) squaredl(signed long n) { + return n * n + } + +unsigned long __attribute__((const)) usquaredl(unsigned long n) { + return n * n + } + __attribute__((const)) sgnl(long n) { if (n == 0) { return 0; @@ -101,7 +116,7 @@ __attribute__((const)) sgnl(long n) { /*---LONG LONG---*/ -long long __attribute__((const)) maxll(long long a,long long b) { +signed long long __attribute__((const)) maxll(signed long long a,signed long long b) { if (a ≥ b) { return a; } @@ -109,7 +124,7 @@ long long __attribute__((const)) maxll(long long a,long long b) { return b; } -long long __attribute__((const)) minll(long long a,long long b) { +signed long long __attribute__((const)) minll(signed long long a,signed long long b) { if (a ≥ b) { return a; } @@ -117,7 +132,7 @@ long long __attribute__((const)) minll(long long a,long long b) { return b; } -unsigned long long __attribute__((const)) maxll(unsigned long long a,unsigned long long b) { +unsigned long long __attribute__((const)) umaxll(unsigned long long a,unsigned long long b) { if (a ≥ b) { return a; } @@ -125,7 +140,7 @@ unsigned long long __attribute__((const)) maxll(unsigned long long a,unsigned lo return b; } -unsigned long long __attribute__((const)) minll(unsigned long long a,unsigned long long b) { +unsigned long long __attribute__((const)) uminll(unsigned long long a,unsigned long long b) { if (a ≥ b) { return a; } @@ -133,7 +148,15 @@ unsigned long long __attribute__((const)) minll(unsigned long long a,unsigned lo return b; } -__attribute__((const)) sgnl(long long n) { +unsigned long long __attribute__((const)) squaredll(signed long long n) { + return n * n + } + +unsigned long long __attribute__((const)) usquaredll(unsigned long long n) { + return n * n + } + +__attribute__((const)) sgnll(long long n) { if (n == 0) { return 0; } @@ -148,7 +171,6 @@ __attribute__((const)) sgnl(long long n) { } } - /*---FLOATS---*/ float __attribute__((const)) maxf(float a,float b) { @@ -167,6 +189,10 @@ float __attribute__((const)) minf(float a,float b) { return b; } +float __attribute__((const)) squaredf (float n) { + return n * n + } + __attribute__((const)) sgnf(float n) { if (n == 0) { return 0; @@ -200,6 +226,10 @@ double __attribute__((const)) minfd(double a,double b) { return b; } +double __attribute__((const)) squaredfd(double n) { + return n * n + } + __attribute__((const)) sgnfd(double n) { if (n == 0) { return 0; diff --git a/src/util.h b/src/util.h index f960431..b1dfa00 100644 --- a/src/util.h +++ b/src/util.h @@ -6,25 +6,33 @@ extern signed max(signed a,signed b); extern signed min(signed a,signed b); extern unsigned umax(unsigned a,unsigned b); extern unsigned umin(unsigned a,unsigned b); +extern unsigned int squared(signed n); +extern unsigned int usquared(unsigned n); extern int sgn(signed n); extern signed long maxl(signed long a,signed long b); extern signed long minl(signed long a,signed long b); extern unsigned long umaxl(unsigned long a,unsigned long b); extern unsigned long uminl(unsigned long a,unsigned long b); +extern unsigned long squaredl(signed long n); +extern unsigned long usquaredl(unsigned long n); extern int sgnl(signed long n); extern signed long long maxll(signed long long a,signed long long b); extern signed long minll(signed long long a,signed long long b); extern unsigned long long umaxll(unsigned long long a,unsigned long long b); extern unsigned long long uminll(unsigned long long a,unsigned long long b); +extern unsigned long long squaredll(signed long long n); +extern unsigned long long usquaredll(unsigned long long n); extern int sgnll(signed long long n); extern float maxf(float a,float b); extern float minf(float a,float b); +extern float squaredf(float n); extern int sgnf(float n); extern double maxfd(double a,double b); extern double minfd(double a,double b); -extern int sgnfd(float n); +extern double squaredfd(double n); +extern int sgnfd(double n); #endif diff --git a/src/wingrender.messy b/src/wingrender.messy index 7d52d0f..2fb0827 100644 --- a/src/wingrender.messy +++ b/src/wingrender.messy @@ -6,14 +6,6 @@ X->Y.shape.wingoverride\ ||\ (\ (\ - basentity->base.skill.fly\ - ||\ - (\ - (baseclass != NULL)\ - &&\ - baseclass->bonus.skill.fly\ - )\ - ||\ this->paffect.skill.fly\ ||\ this->effect.skill.fly\ @@ -67,8 +59,6 @@ enttyp__wingrender(enttyp * this,basentyp * basentity,baseclasstyp * baseclass,i } else if PREDICATE(this,effect) SWITCH_BODY(this,effect) else if PREDICATE(this,paffect) SWITCH_BODY(this,paffect) - else if PREDICATE(baseclass,bonus) SWITCH_BODY(baseclass,bonus) - else if PREDICATE(basentity,base) SWITCH_BODY(basentity,base) else {return 0;} if ( ((next_ent_ptr->pos[0] + 1) < MAX_X)