diff --git a/crusader.qc b/crusader.qc index ca3cd2a..a480946 100644 --- a/crusader.qc +++ b/crusader.qc @@ -193,11 +193,20 @@ void() CrusaderMassHeal = { sound (te, CHAN_ITEM, "auras/aura3.wav", 1, ATTN_NORM); - te.health = te.max_health; - if (self != te) - sprint(te, PRINT_HIGH, self.netname, " restores you to full health\n"); - else - sprint(te, PRINT_HIGH, "Your deity restores you to full health\n"); + if (te.health + 200 >= te.max_health) { + te.health = te.max_health; + if (self != te) + sprint (te, PRINT_HIGH, self.netname, " restores you to full health\n"); + else + sprint (te, PRINT_HIGH, "Your deity restores you to full health\n"); + } else { + te.health += 200; + if (self != te) { + sprint (te, PRINT_HIGH, self.netname, " heals you, but you were too injured to be healed fully\n"); + sprint (self, PRINT_HIGH, te.netname, " was too injured to be healed fully\n"); + } else + sprint (te, PRINT_HIGH, "Your diety heals you, but you were too injured to be healed fully\n"); + } } te = te.chain; diff --git a/defs.qh b/defs.qh index 804ea4b..faa8cc1 100644 --- a/defs.qh +++ b/defs.qh @@ -1325,3 +1325,6 @@ #define MAX(a,b) (((a) > (b)) ? (a) : (b)) #define BOUND(a,b,c) (MAX((a), MIN((b), (c)))) #define ASSERT(a) do {if (!(a)) error (__FILE__ + ":" + itos(__LINE__) + ": Assert failed: " + #a);} while (0) +#define SIGN_i(a) (((a) < 0) ? -1 : +1) +#define SIGN_f(a) (((a) < 0) ? -1.0 : +1.0) +#define printf(...) do {dprint (sprintf (__VA_ARGS__));} while (0) diff --git a/often.qc b/often.qc index 64c9619..1f30198 100644 --- a/often.qc +++ b/often.qc @@ -513,6 +513,27 @@ void (entity player) RemoveHolo = } }; +vector (vector pos, vector dir) NudgeOnePosition = +{ + local float a, b; + a = pointcontents (pos + dir); + b = pointcontents (pos - dir); + if (a != CONTENTS_SOLID && b == CONTENTS_SOLID) + return dir; + else if (a == CONTENTS_SOLID && b != CONTENTS_SOLID) + return -dir; + else + return '0 0 0'; +}; + +vector (vector pos) NudgePosition = +{ + pos += NudgeOnePosition (pos, '1 0 0'); + pos += NudgeOnePosition (pos, '0 1 0'); + pos += NudgeOnePosition (pos, '0 0 1'); + return pos; +}; + //===========================// // THE FLARES ARE BACK! hehe // //===========================// @@ -551,6 +572,30 @@ void() FlareGrenadeTouch = { sound (self, CHAN_MISC, "effects/bodyhit1.wav", 0.6, ATTN_NORM); // bounce sound } + + // the networking imprecision causes them to be through the + // wall on clients, and in QF this stops the light from + // working properly. So I try to nudge them away from the + // wall + setorigin (self, NudgePosition (self.origin)); +/* + local vector netpos; + netpos_x = floor (self.origin_x * 8) / 8; + netpos_y = floor (self.origin_y * 8) / 8; + netpos_z = floor (self.origin_z * 8) / 8; + local float contents = pointcontents (netpos); + printf ("touch: %f\n", contents); + if (contents == CONTENTS_SOLID) { + local vector diff = self.origin - netpos; + printf ("origin: %v netpos: %v diff: %v ", + self.origin, netpos, diff); + diff_x = diff_x ? SIGN_f (diff_x) * 0.25 : 0.0; + diff_y = diff_y ? SIGN_f (diff_y) * 0.25 : 0.0; + diff_z = diff_z ? SIGN_f (diff_z) * 0.25 : 0.0; + printf ("nudge: %v\n", diff); + setorigin (self, self.origin + diff); + } +*/ } else {