From 0e9c10ebcfc57f43804927c61812644751d6904e Mon Sep 17 00:00:00 2001 From: Denis Pauk Date: Sat, 19 Oct 2024 15:27:51 +0300 Subject: [PATCH] game: sync code style of g_func.c --- Makefile | 1 + src/game/common/cl_strings.h | 2 +- src/game/effects/fx_halo.c | 2 +- src/game/effects/fx_lensflare.c | 12 +- src/game/effects/fx_morph.c | 2 +- src/game/effects/fx_shrine.c | 4 +- src/game/effects/fx_spellhands.c | 2 +- src/game/effects/fx_sphereofannihlation.c | 6 +- src/game/effects/generic_character_effects.c | 2 +- src/game/effects/main.c | 2 +- src/game/g_combat.c | 2 +- src/game/g_func.c | 1904 ++++++++++++++---- src/game/g_newai.c | 1678 +++++++++++++++ src/game/g_spawn.c | 4 +- src/game/game_utilities.c | 6 +- src/game/header/local.h | 118 +- src/game/monster/boss2/boss2.c | 2 +- src/game/monster/boss3/boss31.c | 2 +- src/game/monster/boss5/boss5.c | 4 +- src/game/monster/brain/brain.c | 4 +- src/game/monster/chick/chick.c | 2 +- src/game/monster/fish/fish.c | 10 +- src/game/monster/fixbot/fixbot.c | 4 +- src/game/monster/float/float.c | 2 +- src/game/monster/flyer/flyer.c | 2 +- src/game/monster/gladiator/gladb.c | 2 +- src/game/monster/gladiator/gladiator.c | 2 +- src/game/monster/gunner/gunner.c | 2 +- src/game/monster/infantry/infantry.c | 2 +- src/game/monster/insane/insane.c | 2 +- src/game/monster/parasite/parasite.c | 2 +- src/game/monster/soldier/soldier.c | 2 +- src/game/monster/supertank/supertank.c | 2 +- src/game/monster/tank/tank.c | 2 +- src/game/player/client.c | 26 +- src/game/player/funcs.c | 2 +- src/game/player/library/p_actions.c | 2 +- src/game/player/library/p_anim_branch.c | 6 +- src/game/player/library/p_anim_data.c | 6 +- src/game/player/library/p_items.c | 42 +- src/game/spell/meteorbarrier.c | 2 +- src/game/spell/morph.c | 6 +- src/game/spell/ripper.c | 2 +- src/game/spell/sphereofannihlation.c | 10 +- 44 files changed, 3448 insertions(+), 453 deletions(-) create mode 100644 src/game/g_newai.c diff --git a/Makefile b/Makefile index b6139fa9e..3e29134c0 100644 --- a/Makefile +++ b/Makefile @@ -1028,6 +1028,7 @@ GAME_OBJS_ = \ src/game/g_hitlocation.o \ src/game/g_items.o \ src/game/g_light.o \ + src/game/g_newai.o \ src/game/g_main.o \ src/game/g_message.o \ src/game/g_misc.o \ diff --git a/src/game/common/cl_strings.h b/src/game/common/cl_strings.h index a951b7174..b0443edfe 100644 --- a/src/game/common/cl_strings.h +++ b/src/game/common/cl_strings.h @@ -181,7 +181,7 @@ typedef enum GM_OBIT_HELLSTAFF2 , GM_OBIT_P_STAFF = 184, - GM_OBIT_P_STAFF1 , + GM_OBIT_P_STAFF1 , GM_OBIT_P_STAFF2 , GM_OBIT_P_FIREBALL , GM_OBIT_P_FIREBALL1 , diff --git a/src/game/effects/fx_halo.c b/src/game/effects/fx_halo.c index 8ea5ea839..f8b322ecc 100644 --- a/src/game/effects/fx_halo.c +++ b/src/game/effects/fx_halo.c @@ -113,7 +113,7 @@ static qboolean FXHaloThink(struct client_entity_s *self, centity_t *Owner) } else { - self->flags &= ~CEF_NO_DRAW; + self->flags &= ~CEF_NO_DRAW; if (self->alpha < 0.5) self->alpha += 0.25; diff --git a/src/game/effects/fx_lensflare.c b/src/game/effects/fx_lensflare.c index 781117542..32b1b30b0 100644 --- a/src/game/effects/fx_lensflare.c +++ b/src/game/effects/fx_lensflare.c @@ -332,9 +332,9 @@ void FXLensFlare(centity_t *owner,int Type,int Flags,vec3_t Origin) VectorSet(Explosion->up, 0.0f, 0.0f, 0.0f); - Explosion->r.color.r = tint.r; - Explosion->r.color.g = tint.g; - Explosion->r.color.b = tint.b; + Explosion->r.color.r = tint.r; + Explosion->r.color.g = tint.g; + Explosion->r.color.b = tint.b; Explosion->alpha=alpha; switch (I) @@ -453,9 +453,9 @@ void FXClientLensFlare(centity_t *owner,int Type,int Flags,vec3_t Origin, int li VectorSet(Explosion->up, 0.0f, 0.0f, 0.0f); - Explosion->r.color.r = tint->r; - Explosion->r.color.g = tint->g; - Explosion->r.color.b = tint->b; + Explosion->r.color.r = tint->r; + Explosion->r.color.g = tint->g; + Explosion->r.color.b = tint->b; Explosion->alpha = (float)(tint->a)/255.0; switch (I) diff --git a/src/game/effects/fx_morph.c b/src/game/effects/fx_morph.c index 7df643045..6beea7aa0 100644 --- a/src/game/effects/fx_morph.c +++ b/src/game/effects/fx_morph.c @@ -49,7 +49,7 @@ static qboolean FXMorphMissileThink(client_entity_t *missile, centity_t *owner) vec3_t scaled_vel; client_entity_t *trail; int count; - paletteRGBA_t color; + paletteRGBA_t color; vec3_t diff, curpos; int dur; diff --git a/src/game/effects/fx_shrine.c b/src/game/effects/fx_shrine.c index c48461d9d..e2eca8938 100644 --- a/src/game/effects/fx_shrine.c +++ b/src/game/effects/fx_shrine.c @@ -325,7 +325,7 @@ static qboolean FXShrineLungsThink(struct client_entity_s *self, centity_t *owne VectorScale(vel, flrand(1.0,LUNG_RAD), vel); vel[2] = -30.0; - color.c = 0xffffff40; + color.c = 0xffffff40; ce = ClientParticle_new(PART_32x32_STEAM, color, 450); @@ -1077,7 +1077,7 @@ static qboolean FXShrineBallThink(struct client_entity_s *self, centity_t *owner part = ShrineParticle[self->SpawnInfo][irand(0,1)]; if (part == PART_32x32_STEAM) - color.c = 0xffffff40; + color.c = 0xffffff40; else color.c = 0xffffffff; diff --git a/src/game/effects/fx_spellhands.c b/src/game/effects/fx_spellhands.c index 27ba2128f..ec7081a8d 100644 --- a/src/game/effects/fx_spellhands.c +++ b/src/game/effects/fx_spellhands.c @@ -46,7 +46,7 @@ static qboolean FXSpellHandsThink(struct client_entity_s *Self, centity_t *Owner vec3_t Trailend,Trailstart; vec3_t Real_Trailend,Real_Trailstart; vec3_t TrailDelta; - float TrailLength; + float TrailLength; client_particle_t *ce; paletteRGBA_t color; diff --git a/src/game/effects/fx_sphereofannihlation.c b/src/game/effects/fx_sphereofannihlation.c index 36b78d974..f3bbd4186 100644 --- a/src/game/effects/fx_sphereofannihlation.c +++ b/src/game/effects/fx_sphereofannihlation.c @@ -349,9 +349,9 @@ static qboolean FXSphereOfAnnihilationGlowballSpawnerThink(struct client_entity_ flrand(-10.0, 10.0)+ Self->r.origin[2]); } - VectorCopy(Owner->current.angles,Temp); - VectorScale(Temp,180.0/M_PI,Temp); - AngleVectors(Temp,Forward2,Right2,NULL); + VectorCopy(Owner->current.angles,Temp); + VectorScale(Temp,180.0/M_PI,Temp); + AngleVectors(Temp,Forward2,Right2,NULL); // Set my velocity and accelaration. diff --git a/src/game/effects/generic_character_effects.c b/src/game/effects/generic_character_effects.c index bc5d04cd3..fdec425f8 100644 --- a/src/game/effects/generic_character_effects.c +++ b/src/game/effects/generic_character_effects.c @@ -805,7 +805,7 @@ static qboolean FXFeetTrailThink(struct client_entity_s *self, centity_t *owner) for(i = 0; i < count; i++) { - color.c = 0xffffff40; + color.c = 0xffffff40; flame = ClientParticle_new(PART_32x32_STEAM, color, hand_flame_dur); VectorSet( flame->origin, diff --git a/src/game/effects/main.c b/src/game/effects/main.c index 1c67bed42..e4b1c0eef 100644 --- a/src/game/effects/main.c +++ b/src/game/effects/main.c @@ -694,7 +694,7 @@ AddServerEntities(frame_t *frame) } // jmarshall end - VectorCopy(ent->origin, ent->oldorigin); + VectorCopy(ent->origin, ent->oldorigin); VectorCopy(cent->origin, cent->lerp_origin); // Set model. diff --git a/src/game/g_combat.c b/src/game/g_combat.c index db8c18b8a..0740da9e5 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -811,7 +811,7 @@ void T_Damage(edict_t *targ, edict_t *inflictor, edict_t *attacker, vec3_t pdir, // be sure we still have some damage if (!damage) { - damage = 1; + damage = 1; armorabsorb = 1; } else diff --git a/src/game/g_func.c b/src/game/g_func.c index 6ce382f0d..d1085ac0e 100644 --- a/src/game/g_func.c +++ b/src/game/g_func.c @@ -81,7 +81,13 @@ void door_secret_move5(edict_t *self); void door_secret_move6(edict_t *self); void door_secret_done(edict_t *self); +void train_next(edict_t *self); void door_go_up(edict_t *self, edict_t *activator); +void door_go_down(edict_t *self); +void plat2_go_down(edict_t *ent); +void plat2_go_up(edict_t *ent); +void plat2_spawn_danger_area(edict_t *ent); +void plat2_kill_danger_area(edict_t *ent); void Think_AccelMove(edict_t *ent); void plat_go_down(edict_t *ent); @@ -770,9 +776,10 @@ plat_blocked(edict_t *self, edict_t *other) if ((other->svflags & SVF_MONSTER) && (!other->client) && !(other->svflags & SVF_MONSTER)) { - // give it a chance to go away on it's own terms (like gibs) - T_Damage (other, self, self, vec3_origin, other->s.origin, vec3_origin, 3000, 1, DAMAGE_AVOID_ARMOR,MOD_CRUSH); - // if it's still there, nuke it + /* give it a chance to go away on it's own terms (like gibs) */ + T_Damage(other, self, self, vec3_origin, other->s.origin, + vec3_origin, 3000, 1, DAMAGE_AVOID_ARMOR, MOD_CRUSH); + /* if it's still there, nuke it */ if(other->health > 0) BecomeDebris(other); return; @@ -780,7 +787,8 @@ plat_blocked(edict_t *self, edict_t *other) if (self->spawnflags & DOOR_CRUSHER) { - T_Damage(other, self, self, vec3_origin, other->s.origin, vec3_origin, self->dmg * 10, 1, 0,MOD_CRUSH); + T_Damage(other, self, self, vec3_origin, other->s.origin, + vec3_origin, self->dmg * 10, 1, 0, MOD_CRUSH); return; } @@ -813,6 +821,37 @@ Use_Plat(edict_t *ent, edict_t *other, edict_t *activator /* unused */) plat_go_down(ent); } +void +wait_and_change_think(edict_t* ent) +{ + void (*afterwaitfunc)(edict_t *) = ent->moveinfo.endfunc; + ent->moveinfo.endfunc = NULL; + afterwaitfunc(ent); +} + +/* + * In coop mode, this waits for coop_elevator_delay seconds + * before calling afterwaitfunc(ent); otherwise it just calls + * afterwaitfunc(ent); + */ +static void +wait_and_change(edict_t* ent, void (*afterwaitfunc)(edict_t *)) +{ + float waittime = coop_elevator_delay->value; + if (coop->value && waittime > 0.0f) + { + if(ent->nextthink == 0) + { + ent->moveinfo.endfunc = afterwaitfunc; + ent->think = wait_and_change_think; + ent->nextthink = level.time + waittime; + } + } + else + { + afterwaitfunc(ent); + } +} void Touch_Plat_Center(edict_t *ent, edict_t *other, cplane_t *plane /* unsed */, @@ -874,120 +913,646 @@ plat_spawn_inside_trigger(edict_t *ent) tmin[2] = tmax[2] - (ent->pos1[2] - ent->pos2[2] + st.lip); - if (ent->spawnflags & PLAT_LOW_TRIGGER) + if (ent->spawnflags & PLAT_LOW_TRIGGER) + { + tmax[2] = tmin[2] + 8; + } + + if (tmax[0] - tmin[0] <= 0) + { + tmin[0] = (ent->mins[0] + ent->maxs[0]) * 0.5; + tmax[0] = tmin[0] + 1; + } + + if (tmax[1] - tmin[1] <= 0) + { + tmin[1] = (ent->mins[1] + ent->maxs[1]) * 0.5; + tmax[1] = tmin[1] + 1; + } + + VectorCopy(tmin, trigger->mins); + VectorCopy(tmax, trigger->maxs); + + gi.linkentity(trigger); + + return trigger; +} + +/* + * QUAKED func_plat (0 .5 .8) ? PLAT_LOW_TRIGGER + * + * speed -> default 150 + * + * Plats are always drawn in the extended position, + * so they will light correctly. + * + * If the plat is the target of another trigger or button, + * it will start out disabled in the extended position until + * it is trigger, when it will lower and become a normal plat. + * + * "speed" overrides default 200. + * "accel" overrides default 500 + * "lip" overrides default 8 pixel lip + * + * If the "height" key is set, that will determine the amount + * the plat moves, instead of being implicitly determoveinfoned + * by the model's height. + * + * Set "sounds" to one of the following: +0) silent +1) generic door +2) heavy stone door +3) for swing arm on palace level +4) for stone bridge in palace level +5) small/medium wood door swinging +6) large/huge wood door swinging +7) medium sized stone/wood door sliding +8) large stone/wood sliding door or portcullis +9) average metal door swinging +10) Fast sliding doors +11) Hive, Metal, Multipaneled sliding +12) Huge stone door swinging +13) Medium/large elevator +14) Crane (warehouse) +15) hammerlike pump in oglemine1 +16) sliding metal table in cloudlabs +17) lab table which rotates up to ceiling - cloublabs +18) piston sound +19) short, sharp metal clang +20) something going under water +21) the bam sound + +*/ +void +SP_func_plat(edict_t *ent) +{ + if (!ent) + { + return; + } + + VectorClear(ent->s.angles); + ent->solid = SOLID_BSP; + ent->movetype = MOVETYPE_PUSH; + + gi.setmodel(ent, ent->model); + ent->clipmask = MASK_PLAYERSOLID; + + ent->blocked = plat_blocked; + + if (!ent->speed) + { + ent->speed = 20; + } + else + { + ent->speed *= 0.1; + } + + if (!ent->accel) + { + ent->accel = 5; + } + else + { + ent->accel *= 0.1; + } + + if (!ent->decel) + { + ent->decel = 5; + } + else + { + ent->decel *= 0.1; + } + + /* Added to kill things it's being blocked by */ + if (!ent->dmg) + { + ent->dmg = 2; + } + + if (!st.lip) + { + st.lip = 8; + } + + /* pos1 is the top position, pos2 is the bottom */ + VectorCopy(ent->s.origin, ent->pos1); + VectorCopy(ent->s.origin, ent->pos2); + + if (st.height) + { + ent->pos2[2] -= st.height; + } + else + { + ent->pos2[2] -= (ent->maxs[2] - ent->mins[2]) - st.lip; + } + + ent->use = Use_Plat; + + if (ent->targetname) + { + ent->moveinfo.state = STATE_UP; + } + else + { + VectorCopy(ent->pos2, ent->s.origin); + ent->moveinfo.state = STATE_BOTTOM; + } + + ent->moveinfo.speed = ent->speed; + ent->moveinfo.accel = ent->accel; + ent->moveinfo.decel = ent->decel; + ent->moveinfo.wait = ent->wait; + VectorCopy(ent->pos1, ent->moveinfo.start_origin); + VectorCopy(ent->s.angles, ent->moveinfo.start_angles); + VectorCopy(ent->pos2, ent->moveinfo.end_origin); + VectorCopy(ent->s.angles, ent->moveinfo.end_angles); + + VectorSubtract(ent->maxs, ent->mins, ent->s.bmodel_origin); + Vec3ScaleAssign(0.5, ent->s.bmodel_origin); + VectorAdd(ent->mins, ent->s.bmodel_origin, ent->s.bmodel_origin); + + door_sounds(ent); + + gi.linkentity (ent); + + plat_spawn_inside_trigger(ent); // the "start moving" trigger + +} + +void +plat2_spawn_danger_area(edict_t *ent) +{ + if (!ent) + { + return; + } + + vec3_t mins, maxs; + + VectorCopy(ent->mins, mins); + VectorCopy(ent->maxs, maxs); + maxs[2] = ent->mins[2] + 64; + + SpawnBadArea(mins, maxs, 0, ent); +} + +void +plat2_kill_danger_area(edict_t *ent) +{ + edict_t *t; + + if (!ent) + { + return; + } + + t = NULL; + + while ((t = G_Find(t, FOFS(classname), "bad_area"))) + { + if (t->owner == ent) + { + G_FreeEdict(t); + } + } +} + +void +plat2_hit_top(edict_t *ent) +{ + if (!ent) + { + return; + } + + if (!(ent->flags & FL_TEAMSLAVE)) + { + if (ent->moveinfo.sound_end) + { + gi.sound(ent, CHAN_NO_PHS_ADD + CHAN_VOICE, ent->moveinfo.sound_end, + 1, ATTN_STATIC, 0); + } + + ent->s.sound = 0; + } + + ent->moveinfo.state = STATE_TOP; + + if (ent->plat2flags & PLAT2_CALLED) + { + ent->plat2flags = PLAT2_WAITING; + + if (!(ent->spawnflags & PLAT2_TOGGLE)) + { + ent->think = plat2_go_down; + ent->nextthink = level.time + 5.0; + } + + if (deathmatch->value) + { + ent->last_move_time = level.time - 1.0; + } + else + { + ent->last_move_time = level.time - 2.0; + } + } + else if (!(ent->spawnflags & PLAT2_TOP) && + !(ent->spawnflags & PLAT2_TOGGLE)) + { + ent->plat2flags = 0; + ent->think = plat2_go_down; + ent->nextthink = level.time + 2.0; + ent->last_move_time = level.time; + } + else + { + ent->plat2flags = 0; + ent->last_move_time = level.time; + } + + G_UseTargets(ent, ent); +} + +void +plat2_hit_bottom(edict_t *ent) +{ + if (!ent) + { + return; + } + + if (!(ent->flags & FL_TEAMSLAVE)) + { + if (ent->moveinfo.sound_end) + { + gi.sound(ent, CHAN_NO_PHS_ADD + CHAN_VOICE, + ent->moveinfo.sound_end, 1, + ATTN_STATIC, 0); + } + + ent->s.sound = 0; + } + + ent->moveinfo.state = STATE_BOTTOM; + + if (ent->plat2flags & PLAT2_CALLED) + { + ent->plat2flags = PLAT2_WAITING; + + if (!(ent->spawnflags & PLAT2_TOGGLE)) + { + ent->think = plat2_go_up; + ent->nextthink = level.time + 5.0; + } + + if (deathmatch->value) + { + ent->last_move_time = level.time - 1.0; + } + else + { + ent->last_move_time = level.time - 2.0; + } + } + else if ((ent->spawnflags & PLAT2_TOP) && !(ent->spawnflags & PLAT2_TOGGLE)) + { + ent->plat2flags = 0; + ent->think = plat2_go_up; + ent->nextthink = level.time + 2.0; + ent->last_move_time = level.time; + } + else + { + ent->plat2flags = 0; + ent->last_move_time = level.time; + } + + plat2_kill_danger_area(ent); + G_UseTargets(ent, ent); +} + +void +plat2_go_down(edict_t *ent) +{ + if (!ent) + { + return; + } + + if (!(ent->flags & FL_TEAMSLAVE)) + { + if (ent->moveinfo.sound_start) + { + gi.sound(ent, CHAN_NO_PHS_ADD + CHAN_VOICE, + ent->moveinfo.sound_start, 1, + ATTN_STATIC, 0); + } + + ent->s.sound = ent->moveinfo.sound_middle; + } + + ent->moveinfo.state = STATE_DOWN; + ent->plat2flags |= PLAT2_MOVING; + + Move_Calc(ent, ent->moveinfo.end_origin, plat2_hit_bottom); +} + +void +plat2_go_up(edict_t *ent) +{ + if (!ent) + { + return; + } + + if (!(ent->flags & FL_TEAMSLAVE)) + { + if (ent->moveinfo.sound_start) + { + gi.sound(ent, CHAN_NO_PHS_ADD + CHAN_VOICE, + ent->moveinfo.sound_start, 1, + ATTN_STATIC, 0); + } + + ent->s.sound = ent->moveinfo.sound_middle; + } + + ent->moveinfo.state = STATE_UP; + ent->plat2flags |= PLAT2_MOVING; + + plat2_spawn_danger_area(ent); + + Move_Calc(ent, ent->moveinfo.start_origin, plat2_hit_top); +} + +void +plat2_operate(edict_t *ent, edict_t *other) +{ + int otherState; + float pauseTime; + float platCenter; + edict_t *trigger; + + if (!ent || !other) + { + return; + } + + trigger = ent; + ent = ent->enemy; /* now point at the plat, not the trigger */ + + if (ent->plat2flags & PLAT2_MOVING) + { + return; + } + + if ((ent->last_move_time + 2) > level.time) + { + return; + } + + platCenter = (trigger->absmin[2] + trigger->absmax[2]) / 2; + + if (ent->moveinfo.state == STATE_TOP) + { + otherState = STATE_TOP; + + if (ent->spawnflags & PLAT2_BOX_LIFT) + { + if (platCenter > other->s.origin[2]) + { + otherState = STATE_BOTTOM; + } + } + else + { + if (trigger->absmax[2] > other->s.origin[2]) + { + otherState = STATE_BOTTOM; + } + } + } + else + { + otherState = STATE_BOTTOM; + + if (other->s.origin[2] > platCenter) + { + otherState = STATE_TOP; + } + } + + ent->plat2flags = PLAT2_MOVING; + + if (deathmatch->value) + { + pauseTime = 0.3; + } + else + { + pauseTime = 0.5; + } + + if (ent->moveinfo.state != otherState) + { + ent->plat2flags |= PLAT2_CALLED; + pauseTime = 0.1; + } + + ent->last_move_time = level.time; + + if (ent->moveinfo.state == STATE_BOTTOM) + { + ent->think = plat2_go_up; + ent->nextthink = level.time + pauseTime; + } + else + { + ent->think = plat2_go_down; + ent->nextthink = level.time + pauseTime; + } +} + +void +Touch_Plat_Center2(edict_t *ent, edict_t *other, + cplane_t *plane /* unused */, csurface_t *surf /* unused */) +{ + if (!ent || !other) + { + return; + } + + /* this requires monsters to actively trigger plats, not just step on them. */ + if (other->health <= 0) + { + return; + } + + /* don't let non-monsters activate plat2s */ + if ((!(other->svflags & SVF_MONSTER)) && (!other->client)) + { + return; + } + + plat2_operate(ent, other); +} + +void +plat2_blocked(edict_t *self, edict_t *other) +{ + if (!self || !other) + { + return; + } + + if (!(other->svflags & SVF_MONSTER) && (!other->client)) + { + /* give it a chance to go away on it's own terms (like gibs) */ + T_Damage(other, self, self, vec3_origin, other->s.origin, + vec3_origin, 100000, 1, 0, MOD_CRUSH); + + /* if it's still there, nuke it */ + if (other->inuse) + { + BecomeExplosion1(other); + } + + return; + } + + /* gib dead things */ + if (other->health < 1) { - tmax[2] = tmin[2] + 8; + T_Damage(other, self, self, vec3_origin, other->s.origin, + vec3_origin, 100, 1, 0, MOD_CRUSH); } - if (tmax[0] - tmin[0] <= 0) + T_Damage(other, self, self, vec3_origin, other->s.origin, + vec3_origin, self->dmg, 1, 0, MOD_CRUSH); + + if (self->moveinfo.state == STATE_UP) { - tmin[0] = (ent->mins[0] + ent->maxs[0]) * 0.5; - tmax[0] = tmin[0] + 1; + plat2_go_down(self); } - - if (tmax[1] - tmin[1] <= 0) + else if (self->moveinfo.state == STATE_DOWN) { - tmin[1] = (ent->mins[1] + ent->maxs[1]) * 0.5; - tmax[1] = tmin[1] + 1; + plat2_go_up(self); } - - VectorCopy(tmin, trigger->mins); - VectorCopy(tmax, trigger->maxs); - - gi.linkentity(trigger); - - return trigger; -} - -void FuncRotate_Deactivate(edict_t *self, G_Message_t *msg) -{ - VectorClear(self->velocity); - VectorClear(self->avelocity); } -void FuncRotate_Activate(edict_t *self, G_Message_t *msg) +void +Use_Plat2(edict_t *ent, edict_t *other /* unused */, + edict_t *activator) { - self->use(self,NULL,NULL); - gi.linkentity(self); -} + edict_t *trigger; + int i; -void FuncRotateStaticsInit() -{ - classStatics[CID_FUNC_ROTATE].msgReceivers[G_MSG_SUSPEND] = FuncRotate_Deactivate; - classStatics[CID_FUNC_ROTATE].msgReceivers[G_MSG_UNSUSPEND] = FuncRotate_Activate; -} + if (!ent || !activator) + { + return; + } + if (ent->moveinfo.state > STATE_BOTTOM) + { + return; + } + if ((ent->last_move_time + 2) > level.time) + { + return; + } -void FuncDoor_Deactivate(edict_t *self, G_Message_t *msg) -{ - VectorClear(self->velocity); - VectorClear(self->avelocity); -} + for (i = 1, trigger = g_edicts + 1; i < globals.num_edicts; i++, trigger++) + { + if (!trigger->inuse) + { + continue; + } -void FuncDoor_Activate(edict_t *self, G_Message_t *msg) -{ - self->use(self,NULL,NULL); - gi.linkentity(self); + if (trigger->touch == Touch_Plat_Center2) + { + if (trigger->enemy == ent) + { + plat2_operate(trigger, activator); + return; + } + } + } } -void FuncDoorStaticsInit() +void +plat2_activate(edict_t *ent, edict_t *other /* unused */, + edict_t *activator /* unused */) { - classStatics[CID_FUNC_DOOR].msgReceivers[G_MSG_SUSPEND] = FuncRotate_Deactivate; - classStatics[CID_FUNC_DOOR].msgReceivers[G_MSG_UNSUSPEND] = FuncRotate_Activate; -} - - + edict_t *trigger; -/* - * QUAKED func_plat (0 .5 .8) ? PLAT_LOW_TRIGGER -speed default 150 + if (!ent) + { + return; + } -Plats are always drawn in the extended position, so they will light correctly. + ent->use = Use_Plat2; + trigger = plat_spawn_inside_trigger(ent); /* the "start moving" trigger */ -If the plat is the target of another trigger or button, it will start out disabled in the extended position until it is trigger, when it will lower and become a normal plat. + trigger->maxs[0] += 10; + trigger->maxs[1] += 10; + trigger->mins[0] -= 10; + trigger->mins[1] -= 10; -"speed" overrides default 200. -"accel" overrides default 500 -"lip" overrides default 8 pixel lip + gi.linkentity(trigger); -If the "height" key is set, that will determine the amount the plat moves, instead of being implicitly determoveinfoned by the model's height. + trigger->touch = Touch_Plat_Center2; /* Override trigger touch function */ -"sounds" -0) silent -1) generic door -2) heavy stone door -3) for swing arm on palace level -4) for stone bridge in palace level -5) small/medium wood door swinging -6) large/huge wood door swinging -7) medium sized stone/wood door sliding -8) large stone/wood sliding door or portcullis -9) average metal door swinging -10) Fast sliding doors -11) Hive, Metal, Multipaneled sliding -12) Huge stone door swinging -13) Medium/large elevator -14) Crane (warehouse) -15) hammerlike pump in oglemine1 -16) sliding metal table in cloudlabs -17) lab table which rotates up to ceiling - cloublabs -18) piston sound -19) short, sharp metal clang -20) something going under water -21) the bam sound + plat2_go_down(ent); +} -*/ +/* QUAKED func_plat2 (0 .5 .8) ? PLAT_LOW_TRIGGER PLAT2_TOGGLE PLAT2_TOP PLAT2_TRIGGER_TOP PLAT2_TRIGGER_BOTTOM BOX_LIFT + * speed default 150 + * + * PLAT_LOW_TRIGGER - creates a short trigger field at the bottom + * PLAT2_TOGGLE - plat will not return to default position. + * PLAT2_TOP - plat's default position will the the top. + * PLAT2_TRIGGER_TOP - plat will trigger it's targets each time it hits top + * PLAT2_TRIGGER_BOTTOM - plat will trigger it's targets each time it hits bottom + * BOX_LIFT - this indicates that the lift is a box, rather than just a platform + * + * Plats are always drawn in the extended position, so they will light correctly. + * + * If the plat is the target of another trigger or button, it will start out + * disabled in the extended position until it is trigger, when it will lower + * and become a normal plat. + * + * "speed" overrides default 200. + * "accel" overrides default 500 + * "lip" no default + * + * If the "height" key is set, that will determine the amount the plat moves, + * instead of being implicitly determoveinfoned by the model's height. + * + */ void -SP_func_plat(edict_t *ent) +SP_func_plat2(edict_t *ent) { - VectorClear(ent->s.angles); + edict_t *trigger; + + if (!ent) + { + return; + } + VectorClear(ent->s.angles); ent->solid = SOLID_BSP; ent->movetype = MOVETYPE_PUSH; - ent->clipmask = MASK_PLAYERSOLID; - ent->blocked = plat_blocked; - ent->use = Use_Plat; + + gi.setmodel(ent, ent->model); + + ent->blocked = plat2_blocked; if (!ent->speed) { @@ -1016,34 +1581,61 @@ SP_func_plat(edict_t *ent) ent->decel *= 0.1; } + if (deathmatch->value) + { + ent->speed *= 2; + ent->accel *= 2; + ent->decel *= 2; + } + /* Added to kill things it's being blocked by */ if (!ent->dmg) { ent->dmg = 2; } - if (!st.lip) - st.lip = 8; + /* pos1 is the top position, pos2 is the bottom */ + VectorCopy(ent->s.origin, ent->pos1); + VectorCopy(ent->s.origin, ent->pos2); - // pos1 is the top position, pos2 is the bottom - VectorCopy (ent->s.origin, ent->pos1); - VectorCopy (ent->s.origin, ent->pos2); if (st.height) - ent->pos2[2] -= st.height; + { + ent->pos2[2] -= (st.height - st.lip); + } else { ent->pos2[2] -= (ent->maxs[2] - ent->mins[2]) - st.lip; } + ent->moveinfo.state = STATE_TOP; + if (ent->targetname) { - ent->moveinfo.state = STATE_UP; + ent->use = plat2_activate; } else { - VectorCopy(ent->pos2, ent->s.origin); - ent->moveinfo.state = STATE_BOTTOM; + ent->use = Use_Plat2; + + trigger = plat_spawn_inside_trigger(ent); /* the "start moving" trigger */ + + trigger->maxs[0] += 10; + trigger->maxs[1] += 10; + trigger->mins[0] -= 10; + trigger->mins[1] -= 10; + + gi.linkentity(trigger); + trigger->touch = Touch_Plat_Center2; /* Override trigger touch function */ + + if (!(ent->spawnflags & PLAT2_TOP)) + { + VectorCopy(ent->pos2, ent->s.origin); + ent->moveinfo.state = STATE_BOTTOM; + } } + + gi.linkentity(ent); + ent->moveinfo.speed = ent->speed; ent->moveinfo.accel = ent->accel; ent->moveinfo.decel = ent->decel; @@ -1053,20 +1645,55 @@ SP_func_plat(edict_t *ent) VectorCopy(ent->pos2, ent->moveinfo.end_origin); VectorCopy(ent->s.angles, ent->moveinfo.end_angles); - VectorSubtract(ent->maxs, ent->mins, ent->s.bmodel_origin); - Vec3ScaleAssign(0.5, ent->s.bmodel_origin); - VectorAdd(ent->mins, ent->s.bmodel_origin, ent->s.bmodel_origin); + ent->moveinfo.sound_start = gi.soundindex("plats/pt1_strt.wav"); + ent->moveinfo.sound_middle = gi.soundindex("plats/pt1_mid.wav"); + ent->moveinfo.sound_end = gi.soundindex("plats/pt1_end.wav"); +} - door_sounds(ent); +void +FuncRotate_Deactivate(edict_t *self, G_Message_t *msg) +{ + VectorClear(self->velocity); + VectorClear(self->avelocity); +} - gi.setmodel(ent, ent->model); - gi.linkentity (ent); +void +FuncRotate_Activate(edict_t *self, G_Message_t *msg) +{ + self->use(self,NULL,NULL); + gi.linkentity(self); +} - plat_spawn_inside_trigger(ent); // the "start moving" trigger +void +FuncRotateStaticsInit() +{ + classStatics[CID_FUNC_ROTATE].msgReceivers[G_MSG_SUSPEND] = FuncRotate_Deactivate; + classStatics[CID_FUNC_ROTATE].msgReceivers[G_MSG_UNSUSPEND] = FuncRotate_Activate; +} + +void +FuncDoor_Deactivate(edict_t *self, G_Message_t *msg) +{ + VectorClear(self->velocity); + VectorClear(self->avelocity); +} + +void +FuncDoor_Activate(edict_t *self, G_Message_t *msg) +{ + self->use(self,NULL,NULL); + gi.linkentity(self); +} +void +FuncDoorStaticsInit() +{ + classStatics[CID_FUNC_DOOR].msgReceivers[G_MSG_SUSPEND] = FuncRotate_Deactivate; + classStatics[CID_FUNC_DOOR].msgReceivers[G_MSG_UNSUSPEND] = FuncRotate_Activate; } -void rotate_sounds (edict_t *ent) +void +rotate_sounds(edict_t *ent) { if (ent->sounds == 0) { @@ -1098,16 +1725,20 @@ void rotate_sounds (edict_t *ent) } } -//==================================================================== +/* ==================================================================== */ /* - * QUAKED func_rotating (0 .5 .8) ? START_ON REVERSE X_AXIS Y_AXIS TOUCH_PAIN STOP ANIMATED ANIMATED_FAST CRUSHER -You need to have an origin brush as part of this entity. The center of that brush will be -the point around which it is rotated. It will rotate around the Z axis by default. You can -check either the X_AXIS or Y_AXIS box to change that. -----------KEYS------------- -"speed" determines how fast it moves; default value is 100. -"dmg" damage to inflict when blocked (2 default) + * QUAKED func_rotating (0 .5 .8) ? START_ON REVERSE X_AXIS Y_AXIS TOUCH_PAIN STOP ANIMATED ANIMATED_FAST EAST MED HARD DM COOP ACCEL + * + * You need to have an origin brush as part of this entity. + * The center of that brush will be the point around which it + * is rotated. It will rotate around the Z axis by default. + * You can check either the X_AXIS or Y_AXIS box to change that. + * + * func_rotating will use it's targets when it stops and starts. + * + * "speed" determines how fast it moves; default value is 100. + * "dmg" damage to inflict when blocked (2 default) "sounds" 0 - silent 1 - generic rotate @@ -1118,6 +1749,58 @@ check either the X_AXIS or Y_AXIS box to change that. REVERSE will cause the it to rotate in the opposite direction. STOP mean it will stop moving instead of pushing entities */ +void +rotating_accel(edict_t *self) +{ + float current_speed; + + if (!self) + { + return; + } + + current_speed = VectorLength(self->avelocity); + + if (current_speed >= (self->speed - self->accel)) /* done */ + { + VectorScale(self->movedir, self->speed, self->avelocity); + G_UseTargets(self, self); + } + else + { + current_speed += self->accel; + VectorScale(self->movedir, current_speed, self->avelocity); + self->think = rotating_accel; + self->nextthink = level.time + FRAMETIME; + } +} + +void +rotating_decel(edict_t *self) +{ + float current_speed; + + if (!self) + { + return; + } + + current_speed = VectorLength(self->avelocity); + + if (current_speed <= self->decel) /* done */ + { + VectorClear(self->avelocity); + G_UseTargets(self, self); + self->touch = NULL; + } + else + { + current_speed -= self->decel; + VectorScale(self->movedir, current_speed, self->avelocity); + self->think = rotating_decel; + self->nextthink = level.time + FRAMETIME; + } +} void rotating_blocked(edict_t *self, edict_t *other) @@ -1133,7 +1816,7 @@ rotating_blocked(edict_t *self, edict_t *other) void rotating_touch(edict_t *self, edict_t *other, cplane_t *plane /* unused */, - csurface_t *surf /* unused */) + csurface_t *surf /* unused */) { if (!self || !other) { @@ -1149,7 +1832,7 @@ rotating_touch(edict_t *self, edict_t *other, cplane_t *plane /* unused */, void rotating_use(edict_t *self, edict_t *other /* unused */, - edict_t *activator /* unused */) + edict_t *activator /* unused */) { if (!self) { @@ -1166,7 +1849,7 @@ rotating_use(edict_t *self, edict_t *other /* unused */, { self->s.sound = self->moveinfo.sound_middle; self->s.sound_data = (255 & ENT_VOL_MASK) | ATTN_IDLE; - VectorScale (self->movedir, self->speed, self->avelocity); + VectorScale(self->movedir, self->speed, self->avelocity); if (self->spawnflags & 16) { self->touch = rotating_touch; @@ -1182,10 +1865,8 @@ SP_func_rotating(edict_t *ent) return; } - ent->msgHandler = DefaultMsgHandler; - ent->classID = CID_FUNC_ROTATE; - ent->solid = SOLID_BSP; + if (ent->spawnflags & 32) { ent->movetype = MOVETYPE_STOP; @@ -1195,6 +1876,8 @@ SP_func_rotating(edict_t *ent) ent->movetype = MOVETYPE_PUSH; } + ent->msgHandler = DefaultMsgHandler; + ent->classID = CID_FUNC_ROTATE; rotate_sounds(ent); /* set the axis of rotation */ @@ -1262,34 +1945,56 @@ SP_func_rotating(edict_t *ent) gi.linkentity(ent); } -/* -====================================================================== - -BUTTONS - -====================================================================== -*/ +/* ==================================================================== */ +/* BUTTONS */ -void button_fire (edict_t *self); +void button_fire(edict_t *self); -void button_killed2(edict_t *self, G_Message_t *msg) +void +button_killed2(edict_t *self, G_Message_t *msg) { - self->activator = self->enemy; button_fire (self); self->health = self->max_health; } - -void ButtonStaticsInit() +void +ButtonStaticsInit() { classStatics[CID_BUTTON].msgReceivers[MSG_DEATH] = button_killed2; } -void button_done (edict_t *self) +/* + * QUAKED func_button (0 .5 .8) ? + * + * When a button is touched, it moves some distance + * in the direction of it's angle, triggers all of it's + * targets, waits some time, then returns to it's original + * position where it can be triggered again. + * + * "angle" determines the opening direction + * "target" all entities with a matching targetname will be used + * "speed" override the default 40 speed + * "wait" override the default 1 second wait (-1 = never return) + * "lip" override the default 4 pixel lip remaining at end of move + * "health" if set, the button must be killed instead of touched + * "sounds" + * 1) silent + * 2) steam metal + * 3) wooden clunk + * 4) metallic click + * 5) in-out + */ +void +button_done(edict_t *self) { + if (!self) + { + return; + } + self->moveinfo.state = STATE_BOTTOM; self->s.frame = 0; } @@ -1448,44 +2153,61 @@ When a button is touched, it moves some distance in the direction of it's angle, --------SPAWNFLAGS-------- TOUCH - player can touch button to set it off */ -void SP_func_button (edict_t *ent) + +void +SP_func_button(edict_t *ent) { - vec3_t abs_movedir; - float dist; + vec3_t abs_movedir; + float dist; + + if (!ent) + { + return; + } - G_SetMovedir (ent->s.angles, ent->movedir); + G_SetMovedir(ent->s.angles, ent->movedir); ent->movetype = MOVETYPE_STOP; ent->solid = SOLID_BSP; ent->takedamage = DAMAGE_NO; gi.setmodel(ent, ent->model); - gi.linkentity(ent); button_sounds(ent); -// ent->health = 5; if (!ent->speed) + { ent->speed = 40; + } + if (!ent->accel) + { ent->accel = ent->speed; + } + if (!ent->decel) + { ent->decel = ent->speed; + } if (!ent->wait) + { ent->wait = 3; + } + if (!st.lip) + { st.lip = 4; + } - VectorCopy (ent->s.origin, ent->pos1); + VectorCopy(ent->s.origin, ent->pos1); VectorAbs(ent->movedir, abs_movedir); dist = DotProduct(abs_movedir, ent->size) - st.lip; - VectorMA (ent->pos1, dist, ent->movedir, ent->pos2); + VectorMA(ent->pos1, dist, ent->movedir, ent->pos2); ent->use = button_use; if (ent->health) { ent->max_health = ent->health; -// ent->die = button_killed; ent->takedamage = DAMAGE_YES; } @@ -1500,55 +2222,115 @@ void SP_func_button (edict_t *ent) ent->moveinfo.accel = ent->accel; ent->moveinfo.decel = ent->decel; ent->moveinfo.wait = ent->wait; - VectorCopy (ent->pos1, ent->moveinfo.start_origin); - VectorCopy (ent->s.angles, ent->moveinfo.start_angles); - VectorCopy (ent->pos2, ent->moveinfo.end_origin); - VectorCopy (ent->s.angles, ent->moveinfo.end_angles); + VectorCopy(ent->pos1, ent->moveinfo.start_origin); + VectorCopy(ent->s.angles, ent->moveinfo.start_angles); + VectorCopy(ent->pos2, ent->moveinfo.end_origin); + VectorCopy(ent->s.angles, ent->moveinfo.end_angles); ent->msgHandler = DefaultMsgHandler; + gi.linkentity(ent); } -/* -====================================================================== - -DOORS - - spawn a trigger surrounding the entire team unless it is - allready targeted by another +/* ==================================================================== */ -====================================================================== -*/ +/* + * DOORS + * + * spawn a trigger surrounding the entire team + * unless it is already targeted by another + */ +/* + * QUAKED func_door (0 .5 .8) ? START_OPEN x CRUSHER NOMONSTER ANIMATED TOGGLE ANIMATED_FAST + * + * TOGGLE wait in both the start and end states for a trigger event. + * START_OPEN the door to moves to its destination when spawned, and operate in reverse. + * It is used to temporarily or permanently close off an area when triggered + * (not useful for touch or takedamage doors). + * NOMONSTER monsters will not trigger this door + * + * "message" is printed when the door is touched if it is a trigger door and it hasn't been fired yet + * "angle" determines the opening direction + * "targetname" if set, no touch field will be spawned and a remote button or trigger field activates the door. + * "health" if set, door must be shot open + * "speed" movement speed (100 default) + * "wait" wait before returning (3 default, -1 = never return) + * "lip" lip remaining at end of move (8 default) + * "dmg" damage to inflict when blocked (2 default) + * "sounds" +0) silent +1) generic door +2) heavy stone door +3) for swing arm on palace level +4) for stone bridge in palace level +5) small/medium wood door swinging +6) large/huge wood door swinging +7) medium sized stone/wood door sliding +8) large stone/wood sliding door or portcullis +9) average metal door swinging +10) Fast sliding doors +11) Hive, Metal, Multipaneled sliding +12) Huge stone door swinging +13) Medium/large elevator +14) Crane (warehouse) +15) hammerlike pump in oglemine1 +16) sliding metal table in cloudlabs +17) lab table which rotates up to ceiling - cloublabs +18) piston sound +19) short, sharp metal clang +20) something going under water +21) the bam sound + */ -void door_use_areaportals(edict_t *self, qboolean open) +void +door_use_areaportals(edict_t *self, qboolean open) { - edict_t *t = NULL; + edict_t *t = NULL; + + if (!self) + { + return; + } if (!self->target) + { return; + } - while ((t = G_Find (t, FOFS(targetname), self->target))) + while ((t = G_Find(t, FOFS(targetname), self->target))) { if (Q_stricmp(t->classname, "func_areaportal") == 0) { - gi.SetAreaPortalState (t->style, open); + gi.SetAreaPortalState(t->style, open); } } } -void door_go_down (edict_t *self); - -void door_hit_top (edict_t *self) +void +door_hit_top(edict_t *self) { + if (!self) + { + return; + } + if (!(self->flags & FL_TEAMSLAVE)) { if (self->moveinfo.sound_end) - gi.sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self->moveinfo.sound_end, 1, ATTN_IDLE, 0); + { + gi.sound(self, CHAN_NO_PHS_ADD + CHAN_VOICE, self->moveinfo.sound_end, 1, ATTN_IDLE, 0); + } + self->s.sound = 0; } + self->moveinfo.state = STATE_TOP; + if (self->spawnflags & DOOR_TOGGLE) + { return; + } + if (self->moveinfo.wait >= 0) { self->think = door_go_down; @@ -1573,9 +2355,15 @@ door_hit_bottom(edict_t *self) if (!(self->flags & FL_TEAMSLAVE)) { if (self->moveinfo.sound_end) - gi.sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self->moveinfo.sound_end, 1, ATTN_IDLE, 0); + { + gi.sound(self, CHAN_NO_PHS_ADD + CHAN_VOICE, + self->moveinfo.sound_end, 1, + ATTN_IDLE, 0); + } + self->s.sound = 0; } + self->moveinfo.state = STATE_BOTTOM; if (self->moveinfo.wait == -2) // Endlessly cycle @@ -1599,7 +2387,12 @@ door_go_down(edict_t *self) if (!(self->flags & FL_TEAMSLAVE)) { if (self->moveinfo.sound_start) - gi.sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self->moveinfo.sound_start, 1, ATTN_IDLE, 0); + { + gi.sound(self, CHAN_NO_PHS_ADD + CHAN_VOICE, + self->moveinfo.sound_start, + 1, ATTN_IDLE, 0); + } + self->s.sound = self->moveinfo.sound_middle; self->s.sound_data = (255 & ENT_VOL_MASK) | ATTN_IDLE; } @@ -1678,6 +2471,117 @@ door_go_up(edict_t *self, edict_t *activator) door_use_areaportals(self, true); } +void +smart_water_go_up(edict_t *self) +{ + float distance; + edict_t *lowestPlayer; + edict_t *ent; + float lowestPlayerPt; + int i; + + if (!self) + { + return; + } + + if (self->moveinfo.state == STATE_TOP) + { + /* reset top wait time */ + if (self->moveinfo.wait >= 0) + { + self->nextthink = level.time + self->moveinfo.wait; + } + + return; + } + + if (self->health) + { + if (self->absmax[2] >= self->health) + { + VectorClear(self->velocity); + self->nextthink = 0; + self->moveinfo.state = STATE_TOP; + return; + } + } + + if (!(self->flags & FL_TEAMSLAVE)) + { + if (self->moveinfo.sound_start) + { + gi.sound(self, CHAN_NO_PHS_ADD + CHAN_VOICE, + self->moveinfo.sound_start, 1, + ATTN_STATIC, 0); + } + + self->s.sound = self->moveinfo.sound_middle; + } + + /* find the lowest player point. */ + lowestPlayerPt = 999999; + lowestPlayer = NULL; + + for (i = 0; i < game.maxclients; i++) + { + ent = &g_edicts[1 + i]; + + /* don't count dead or unused player slots */ + if ((ent->inuse) && (ent->health > 0)) + { + if (ent->absmin[2] < lowestPlayerPt) + { + lowestPlayerPt = ent->absmin[2]; + lowestPlayer = ent; + } + } + } + + if (!lowestPlayer) + { + return; + } + + distance = lowestPlayerPt - self->absmax[2]; + + /* for the calculations, make sure we + intend to go up at least a little. */ + if (distance < self->accel) + { + distance = 100; + self->moveinfo.speed = 5; + } + else + { + self->moveinfo.speed = distance / self->accel; + } + + if (self->moveinfo.speed < 5) + { + self->moveinfo.speed = 5; + } + else if (self->moveinfo.speed > self->speed) + { + self->moveinfo.speed = self->speed; + } + + /* should this allow any movement other than straight up? */ + VectorSet(self->moveinfo.dir, 0, 0, 1); + VectorScale(self->moveinfo.dir, self->moveinfo.speed, self->velocity); + self->moveinfo.remaining_distance = distance; + + if (self->moveinfo.state != STATE_UP) + { + G_UseTargets(self, lowestPlayer); + door_use_areaportals(self, true); + self->moveinfo.state = STATE_UP; + } + + self->think = smart_water_go_up; + self->nextthink = level.time + FRAMETIME; +} + /* qboolean smart_door_side_check (edict_t *self, edict_t *activator) @@ -1717,9 +2621,15 @@ smart_door_side_check(edict_t *self, edict_t *activator) edict_t *TestEntityPosition(edict_t *self); void -door_use(edict_t *self, edict_t *other, edict_t *activator) +door_use(edict_t *self, edict_t *other /* unused */, edict_t *activator) { - edict_t *ent; + edict_t *ent; + vec3_t center; + + if (!self || !activator) + { + return; + } if(Vec3IsZero(self->avelocity)) { @@ -1931,10 +2841,12 @@ door_blocked(edict_t *self, edict_t *other) if ((other->svflags & SVF_MONSTER) && !other->client && !(other->svflags & SVF_BOSS)) { - // give it a chance to go away on it's own terms (like gibs) - T_Damage (other, self, self, vec3_origin, other->s.origin, vec3_origin, 3000, 1, DAMAGE_AVOID_ARMOR,MOD_CRUSH); + /* give it a chance to go away on it's own terms (like gibs) */ + T_Damage(other, self, self, vec3_origin, other->s.origin, + vec3_origin, 3000, 1, DAMAGE_AVOID_ARMOR,MOD_CRUSH); + /* if it's still there, nuke it */ - if(other->health > 0) + if (other->health > 0) { BecomeDebris(other); } @@ -1944,14 +2856,14 @@ door_blocked(edict_t *self, edict_t *other) if (self->spawnflags & DOOR_CRUSHER) { - T_Damage (other, self, self, vec3_origin, other->s.origin, vec3_origin, self->dmg * 10, 1, 0,MOD_CRUSH); + T_Damage (other, self, self, vec3_origin, other->s.origin, vec3_origin, self->dmg * 10, 1, 0, MOD_CRUSH); return; } - T_Damage (other, self, self, vec3_origin, other->s.origin, vec3_origin, self->dmg, 1, 0,MOD_CRUSH); + T_Damage (other, self, self, vec3_origin, other->s.origin, vec3_origin, self->dmg, 1, 0, MOD_CRUSH); /* if a door has a negative wait, it would never - come back if blocked, (unless -2) - so let it just squash the object to death real fast */ + come back if blocked, (unless -2) so let it just squash the + object to death real fast */ if ((self->moveinfo.wait >= 0) || (self->moveinfo.wait == -2)) { if (self->moveinfo.state == STATE_DOWN) @@ -2134,48 +3046,15 @@ door_sounds(edict_t *ent) } } -/* - * QUAKED func_door (0 .5 .8) ? START_OPEN x CRUSHER NOMONSTER ANIMATED TOGGLE ANIMATED_FAST -TOGGLE wait in both the start and end states for a trigger event. -START_OPEN the door to moves to its destination when spawned, and operate in reverse. It is used to temporarily or permanently close off an area when triggered (not useful for touch or takedamage doors). -NOMONSTER monsters will not trigger this door - -"message" is printed when the door is touched if it is a trigger door and it hasn't been fired yet -"angle" determines the opening direction -"targetname" if set, no touch field will be spawned and a remote button or trigger field activates the door. -"health" if set, door must be shot open -"height" if set, tells how far up door opens -"speed" movement speed (100 default) -"wait" wait before returning (3 default, -1 = never return,-2 = never stop cycle) -"lip" lip remaining at end of move (8 default) -"dmg" damage to inflict when blocked (2 default) -"sounds" -0) silent -1) generic door -2) heavy stone door -3) for swing arm on palace level -4) for stone bridge in palace level -5) small/medium wood door swinging -6) large/huge wood door swinging -7) medium sized stone/wood door sliding -8) large stone/wood sliding door or portcullis -9) average metal door swinging -10) Fast sliding doors -11) Hive, Metal, Multipaneled sliding -12) Huge stone door swinging -13) Medium/large elevator -14) Crane (warehouse) -15) hammerlike pump in oglemine1 -16) sliding metal table in cloudlabs -17) lab table which rotates up to ceiling - cloublabs -18) piston sound -19) short, sharp metal clang -20) something going under water -21) the bam sound - */ -void SP_func_door (edict_t *self) +void +SP_func_door(edict_t *self) { - vec3_t abs_movedir; + vec3_t abs_movedir; + + if (!self) + { + return; + } door_sounds(self); @@ -2206,7 +3085,7 @@ void SP_func_door (edict_t *self) self->dmg = 2; // calculate second position - VectorCopy (self->s.origin, self->pos1); + VectorCopy(self->s.origin, self->pos1); VectorAbs(self->movedir, abs_movedir); if (!st.height) @@ -2219,9 +3098,9 @@ void SP_func_door (edict_t *self) // if it starts open, switch the positions if (self->spawnflags & DOOR_START_OPEN) { - VectorCopy (self->pos2, self->s.origin); - VectorCopy (self->pos1, self->pos2); - VectorCopy (self->s.origin, self->pos1); + VectorCopy(self->pos2, self->s.origin); + VectorCopy(self->pos1, self->pos2); + VectorCopy(self->s.origin, self->pos1); } self->moveinfo.state = STATE_BOTTOM; @@ -2242,10 +3121,10 @@ void SP_func_door (edict_t *self) self->moveinfo.accel = self->accel; self->moveinfo.decel = self->decel; self->moveinfo.wait = self->wait; - VectorCopy (self->pos1, self->moveinfo.start_origin); - VectorCopy (self->s.angles, self->moveinfo.start_angles); - VectorCopy (self->pos2, self->moveinfo.end_origin); - VectorCopy (self->s.angles, self->moveinfo.end_angles); + VectorCopy(self->pos1, self->moveinfo.start_origin); + VectorCopy(self->s.angles, self->moveinfo.start_angles); + VectorCopy(self->pos2, self->moveinfo.end_origin); + VectorCopy(self->s.angles, self->moveinfo.end_angles); VectorSubtract(self->maxs, self->mins, self->s.bmodel_origin); Vec3ScaleAssign(0.5, self->s.bmodel_origin); @@ -2262,37 +3141,41 @@ void SP_func_door (edict_t *self) self->nextthink = level.time + FRAMETIME; if (self->health || self->targetname) + { self->think = Think_CalcMoveSpeed; + } else + { self->think = Think_SpawnDoorTrigger; + } } /* - * QUAKED func_door_rotating (0 .5 .8) ? START_OPEN REVERSE CRUSHER NOMONSTER ANIMATED TOGGLE X_AXIS Y_AXIS SWINGAWAY x x x x x x x -TOGGLE causes the door to wait in both the start and end states for a trigger event. - -START_OPEN the door to moves to its destination when spawned, and operate in reverse. It is used to temporarily or permanently close off an area when triggered (not useful for touch or takedamage doors). -NOMONSTER monsters will not trigger this door - -You need to have an origin brush as part of this entity. The center of that brush will be -the point around which it is rotated. It will rotate around the Z axis by default. You can -check either the X_AXIS or Y_AXIS box to change that. - -"distance" is how many degrees the door will be rotated. -"speed" determines how fast the door moves; default value is 100. - -REVERSE will cause the door to rotate in the opposite direction. - -SWINGAWAY door will always swing away from the activator... - -"message" is printed when the door is touched if it is a trigger door and it hasn't been fired yet -"angle" determines the opening direction -"targetname" if set, no touch field will be spawned and a remote button or trigger field activates the door. -"health" if set, door must be shot open -"speed" movement speed (100 default) -"wait" wait before returning (3 default, -1 = never return,-2 = never stop cycle) -"dmg" damage to inflict when blocked (2 default) -"sounds" + * QUAKED func_door_rotating (0 .5 .8) ? START_OPEN REVERSE CRUSHER NOMONSTER ANIMATED TOGGLE X_AXIS Y_AXIS + * + * TOGGLE causes the door to wait in both the start and end states for a trigger event. + * START_OPEN the door to moves to its destination when spawned, and operate in reverse. + * It is used to temporarily or permanently close off an area when triggered + * (not useful for touch or takedamage doors). + * NOMONSTER monsters will not trigger this door + * + * You need to have an origin brush as part of this entity. The center of that brush will be + * the point around which it is rotated. It will rotate around the Z axis by default. You can + * check either the X_AXIS or Y_AXIS box to change that. + * + * "distance" is how many degrees the door will be rotated. + * "speed" determines how fast the door moves; default value is 100. + * + * REVERSE will cause the door to rotate in the opposite direction. + * + * "message" is printed when the door is touched if it is a trigger door and it hasn't been fired yet + * "angle" determines the opening direction + * "targetname" if set, no touch field will be spawned and a remote button or trigger field activates the door. + * "health" if set, door must be shot open + * "speed" movement speed (100 default) + * "wait" wait before returning (3 default, -1 = never return) + * "dmg" damage to inflict when blocked (2 default) + * "sounds" 0) silent 1) generic door 2) heavy stone door @@ -2437,56 +3320,69 @@ SP_func_door_rotating(edict_t *ent) ent->nextthink = level.time + FRAMETIME; if (ent->health || ent->targetname) + { ent->think = Think_CalcMoveSpeed; + } else + { ent->think = Think_SpawnDoorTrigger; + } } +/* ==================================================================== */ + /* * QUAKED func_water (0 .5 .8) ? START_OPEN -func_water is a moveable water brush. It must be targeted to operate. Use a non-water texture at your own risk. - -START_OPEN causes the water to move to its destination when spawned and operate in reverse. - -"angle" determines the opening direction (up or down only) -"speed" movement speed (25 default) -"wait" wait before returning (-1 default, -1 = TOGGLE) -"lip" lip remaining at end of move (0 default) -"sounds" (yes, these need to be changed) -0) no sound -1) water -2) lava -*/ - -void SP_func_water (edict_t *self) + * + * func_water is a moveable water brush. It must be targeted to operate. + * Use a non-water texture at your own risk. + * + * START_OPEN causes the water to move to its destination when spawned + * and operate in reverse. + * + * "angle" determines the opening direction (up or down only) + * "speed" movement speed (25 default) + * "wait" wait before returning (-1 default, -1 = TOGGLE) + * "lip" lip remaining at end of move (0 default) + * "sounds" (yes, these need to be changed) + * 0) no sound + * 1) water + * 2) lava + */ +void +SP_func_water(edict_t *self) { - vec3_t abs_movedir; + vec3_t abs_movedir; - G_SetMovedir (self->s.angles, self->movedir); + if (!self) + { + return; + } + + G_SetMovedir(self->s.angles, self->movedir); self->movetype = MOVETYPE_PUSH; self->solid = SOLID_BSP; gi.setmodel(self, self->model); - gi.linkentity(self); - // calculate second position - VectorCopy (self->s.origin, self->pos1); + /* calculate second position */ + VectorCopy(self->s.origin, self->pos1); VectorAbs(self->movedir, abs_movedir); self->moveinfo.distance = DotProduct(abs_movedir, self->size) - st.lip; VectorMA (self->pos1, self->moveinfo.distance, self->movedir, self->pos2); - // if it starts open, switch the positions + /* if it starts open, switch the positions */ if (self->spawnflags & DOOR_START_OPEN) { - VectorCopy (self->pos2, self->s.origin); - VectorCopy (self->pos1, self->pos2); - VectorCopy (self->s.origin, self->pos1); + VectorCopy(self->pos2, self->s.origin); + VectorCopy(self->pos1, self->pos2); + VectorCopy(self->s.origin, self->pos1); } - VectorCopy (self->pos1, self->moveinfo.start_origin); - VectorCopy (self->s.angles, self->moveinfo.start_angles); - VectorCopy (self->pos2, self->moveinfo.end_origin); - VectorCopy (self->s.angles, self->moveinfo.end_angles); + VectorCopy(self->pos1, self->moveinfo.start_origin); + VectorCopy(self->s.angles, self->moveinfo.start_angles); + VectorCopy(self->pos2, self->moveinfo.end_origin); + VectorCopy(self->s.angles, self->moveinfo.end_angles); VectorSubtract(self->maxs, self->mins, self->s.bmodel_origin); Vec3ScaleAssign(0.5, self->s.bmodel_origin); @@ -2495,25 +3391,34 @@ void SP_func_water (edict_t *self) self->moveinfo.state = STATE_BOTTOM; if (!self->speed) + { self->speed = 25; - self->moveinfo.accel = self->moveinfo.decel = self->moveinfo.speed = self->speed; + } + + self->moveinfo.accel = self->moveinfo.decel = + self->moveinfo.speed = self->speed; if (!self->wait) + { self->wait = -1; + } + self->moveinfo.wait = self->wait; self->use = door_use; if (self->wait == -1) + { self->spawnflags |= DOOR_TOGGLE; + } self->classname = "func_door"; + gi.linkentity(self); } -void train_next (edict_t *self); - -void train_anim(edict_t *self) +void +train_anim(edict_t *self) { if ((self->s.frame == 0) && (self->moveinfo.sound_middle)) // Start sound if there is one @@ -2529,7 +3434,8 @@ void train_anim(edict_t *self) train_next (self); } -void train_animbackwards(edict_t *self) +void +train_animbackwards(edict_t *self) { if (((self->s.frame + 1) == self->count) && (self->moveinfo.sound_middle)) // Start sound if there is one @@ -2544,16 +3450,21 @@ void train_animbackwards(edict_t *self) else train_next (self); } + #define TRAIN_START_ON 1 #define TRAIN_TOGGLE 2 #define TRAIN_BLOCK_STOPS 4 +/* ==================================================================== */ + /* - * QUAKED func_train (0 .5 .8) ? START_ON TOGGLE BLOCK_STOPS HASORIGIN NO_CLIP PUSHPULL -Trains are moving platforms that players can ride. -The targets origin specifies the min point of the train at each corner. -The train spawns at the first target it is pointing at. -If the train is the target of a button or trigger, it will not begin moving until activated. This means if it has a targetname it won't move unless triggered. + * QUAKED func_train (0 .5 .8) ? START_ON TOGGLE BLOCK_STOPS + * + * Trains are moving platforms that players can ride. + * The targets origin specifies the min point of the train + * at each corner. The train spawns at the first target it + * is pointing at. If the train is the target of a button + * or trigger, it will not begin moving until activated. -------KEYS------ NO_CLIP - train will not block anything. @@ -2585,8 +3496,14 @@ materialtype - 10 = MAT_NONE - just makes smoke */ -void train_blocked (edict_t *self, edict_t *other) +void +train_blocked(edict_t *self, edict_t *other) { + if (!self || !other) + { + return; + } + if ((other->svflags & SVF_MONSTER) && (!other->client) && !(other->svflags & SVF_BOSS)) { // give it a chance to go away on it's own terms (like gibs) @@ -2598,35 +3515,47 @@ void train_blocked (edict_t *self, edict_t *other) } if (level.time < self->touch_debounce_time) + { return; + } if (!self->dmg) + { return; + } + self->touch_debounce_time = level.time + 0.5; - T_Damage (other, self, self, vec3_origin, other->s.origin, vec3_origin, self->dmg, 1, 0,MOD_CRUSH); + T_Damage(other, self, self, vec3_origin, other->s.origin, + vec3_origin, self->dmg, 1, 0, MOD_CRUSH); } -void train_wait (edict_t *self) +void +train_wait(edict_t *self) { + if (!self) + { + return; + } if (self->target_ent->moveinfo.sound_middle) gi.sound(self->target_ent, CHAN_VOICE, self->target_ent->moveinfo.sound_middle, 1, ATTN_NORM, 0); if (self->target_ent->pathtarget) { - char *savetarget; - edict_t *ent; + char *savetarget; + edict_t *ent; ent = self->target_ent; savetarget = ent->target; ent->target = ent->pathtarget; - - G_UseTargets (ent, self->activator); + G_UseTargets(ent, self->activator); ent->target = savetarget; - // make sure we didn't get killed by a killtarget + /* make sure we didn't get killed by a killtarget */ if (!self->inuse) + { return; + } } if (self->moveinfo.wait) @@ -2654,24 +3583,33 @@ void train_wait (edict_t *self) } else if (self->spawnflags & TRAIN_TOGGLE) // && wait < 0 { - train_next (self); + train_next(self); self->spawnflags &= ~TRAIN_START_ON; - VectorClear (self->velocity); + VectorClear(self->velocity); self->nextthink = 0; } if (!(self->flags & FL_TEAMSLAVE)) { if (self->moveinfo.sound_end) - gi.sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self->moveinfo.sound_end, 1, ATTN_IDLE, 0); + { + gi.sound(self, CHAN_NO_PHS_ADD + CHAN_VOICE, + self->moveinfo.sound_end, 1, + ATTN_IDLE, 0); + } + self->s.sound = 0; } } else { - train_next (self); + train_next(self); } +} +void +train_piece_wait(edict_t *self) +{ } void @@ -2741,13 +3679,18 @@ train_next(edict_t *self) if (self->spawnflags & 8) // Has an origin - VectorCopy (ent->s.origin, dest); - else // No origin - VectorSubtract (ent->s.origin, self->mins, dest); - self->moveinfo.state = STATE_TOP; + { + VectorCopy(ent->s.origin, dest); + } + else + { + // No origin + VectorSubtract(ent->s.origin, self->mins, dest); + } - VectorCopy (self->s.origin, self->moveinfo.start_origin); - VectorCopy (dest, self->moveinfo.end_origin); + self->moveinfo.state = STATE_TOP; + VectorCopy(self->s.origin, self->moveinfo.start_origin); + VectorCopy(dest, self->moveinfo.end_origin); if (ent->speed) { @@ -2845,7 +3788,7 @@ func_train_find(edict_t *self) void train_use(edict_t *self, edict_t *other /* unused */, - edict_t *activator) + edict_t *activator) { if (!self || !activator) { @@ -2979,41 +3922,57 @@ SP_func_train(edict_t *self) /* * QUAKED func_timer (0.3 0.1 0.6) (-8 -8 -8) (8 8 8) START_ON -"wait" base time between triggering all targets, default is 1 -"random" wait variance, default is 0 - -so, the basic time between firing is a random time between -(wait - random) and (wait + random) - -"delay" delay before first firing when turned on, default is 0 - -"pausetime" additional delay used only the very first time - and only if spawned with START_ON - -These can used but not touched. -*/ -void func_timer_think (edict_t *self) + * + * "wait" base time between triggering all targets, default is 1 + * "random" wait variance, default is 0 + * + * so, the basic time between firing is a random time + * between (wait - random) and (wait + random) + * + * "delay" delay before first firing when turned on, default is 0 + * "pausetime" additional delay used only the very first time + * and only if spawned with START_ON + * + * These can used but not touched. + */ +void +func_timer_think(edict_t *self) { - G_UseTargets (self, self->activator); - self->nextthink = level.time + self->wait + flrand(-self->random, self->random); + if (!self) + { + return; + } + + G_UseTargets(self, self->activator); + self->nextthink = level.time + self->wait + crandom() * self->random; } -void func_timer_use (edict_t *self, edict_t *other, edict_t *activator) +void +func_timer_use(edict_t *self, edict_t *other /* unused */, edict_t *activator) { + if (!self || !activator) + { + return; + } + self->activator = activator; - // if on, turn it off + /* if on, turn it off */ if (self->nextthink) { self->nextthink = 0; return; } - // turn it on + /* turn it on */ if (self->delay) + { self->nextthink = level.time + self->delay; + } else - func_timer_think (self); + { + func_timer_think(self); + } } void @@ -3062,7 +4021,7 @@ SP_func_timer(edict_t *self) */ void func_conveyor_use(edict_t *self, edict_t *other /* unused */, - edict_t *activator /* unused */) + edict_t *activator /* unused */) { if (!self) { @@ -3167,7 +4126,7 @@ door_secret_use(edict_t *self, edict_t *other /* unused */, if (self->moveinfo.sound_start) { - gi.sound(self, CHAN_NO_PHS_ADD+CHAN_VOICE, self->moveinfo.sound_start, 1, ATTN_IDLE, 0); + gi.sound(self, CHAN_NO_PHS_ADD + CHAN_VOICE, self->moveinfo.sound_start, 1, ATTN_IDLE, 0); } Move_Calc(self, self->pos1, door_secret_move1); @@ -3196,7 +4155,7 @@ door_secret_move2(edict_t *self) if (self->moveinfo.sound_middle) { - gi.sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self->moveinfo.sound_middle, 1, ATTN_IDLE, 0); + gi.sound (self, CHAN_NO_PHS_ADD + CHAN_VOICE, self->moveinfo.sound_middle, 1, ATTN_IDLE, 0); } Move_Calc(self, self->pos2, door_secret_move3); @@ -3212,7 +4171,7 @@ door_secret_move3(edict_t *self) if (self->moveinfo.sound_end) { - gi.sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self->moveinfo.sound_end, 1, ATTN_IDLE, 0); + gi.sound (self, CHAN_NO_PHS_ADD + CHAN_VOICE, self->moveinfo.sound_end, 1, ATTN_IDLE, 0); } if (self->wait == -1) @@ -3234,7 +4193,7 @@ door_secret_move4(edict_t *self) if (self->moveinfo.sound_middle) { - gi.sound(self, CHAN_NO_PHS_ADD+CHAN_VOICE, self->moveinfo.sound_middle, 1, ATTN_IDLE, 0); + gi.sound(self, CHAN_NO_PHS_ADD + CHAN_VOICE, self->moveinfo.sound_middle, 1, ATTN_IDLE, 0); } Move_Calc(self, self->pos1, door_secret_move5); @@ -3250,7 +4209,7 @@ door_secret_move5(edict_t *self) if (self->moveinfo.sound_end) { - gi.sound(self, CHAN_NO_PHS_ADD+CHAN_VOICE, self->moveinfo.sound_end, 1, ATTN_IDLE, 0); + gi.sound(self, CHAN_NO_PHS_ADD + CHAN_VOICE, self->moveinfo.sound_end, 1, ATTN_IDLE, 0); } self->nextthink = level.time + 1.0; @@ -3267,7 +4226,7 @@ door_secret_move6(edict_t *self) if (self->moveinfo.sound_start) { - gi.sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self->moveinfo.sound_start, 1, ATTN_IDLE, 0); + gi.sound (self, CHAN_NO_PHS_ADD + CHAN_VOICE, self->moveinfo.sound_start, 1, ATTN_IDLE, 0); } Move_Calc(self, vec3_origin, door_secret_done); @@ -3352,7 +4311,6 @@ SP_func_door_secret(edict_t *ent) ent->movetype = MOVETYPE_PUSH; ent->solid = SOLID_BSP; gi.setmodel(ent, ent->model); - gi.linkentity(ent); ent->blocked = door_secret_blocked; ent->use = door_secret_use; @@ -3423,9 +4381,271 @@ SP_func_door_secret(edict_t *ent) ent->classname = "func_door"; + gi.linkentity(ent); +} + +/* ==================================================================== */ + +/* + * QUAKED func_killbox (1 0 0) ? + * + * Kills everything inside when fired, + * irrespective of protection. + */ +void +use_killbox(edict_t *self, edict_t *other /* unused */, + edict_t *activator /* unused */) +{ + if (!self) + { + return; + } + + KillBox(self); +} + +void +SP_func_killbox(edict_t *ent) +{ + if (!ent) + { + return; + } + + gi.setmodel(ent, ent->model); + ent->use = use_killbox; + ent->svflags = SVF_NOCLIENT; +} + +/* + * QUAKED rotating_light (0 .5 .8) (-8 -8 -8) (8 8 8) START_OFF ALARM + * "health" if set, the light may be killed. + */ + +#define START_OFF 1 + +void +rotating_light_alarm(edict_t *self) +{ + if (!self) + { + return; + } + + if (self->spawnflags & START_OFF) + { + self->think = NULL; + self->nextthink = 0; + } + else + { + gi.sound(self, CHAN_NO_PHS_ADD + CHAN_VOICE, + self->moveinfo.sound_start, 1, + ATTN_STATIC, 0); + self->nextthink = level.time + 1; + } +} + +void +rotating_light_killed(edict_t *self, edict_t *inflictor /* unused */, + edict_t *attacker /* unused */, int damage /* unused */, + vec3_t point /* unused */) +{ + if (!self) + { + return; + } + + gi.WriteByte(svc_temp_entity); + gi.WriteByte(TE_WELDING_SPARKS); + gi.WriteByte(30); + gi.WritePosition(self->s.origin); + gi.WriteDir(vec3_origin); + gi.WriteByte(0xe0 + (rand() & 7)); + gi.multicast(self->s.origin, MULTICAST_PVS); + + self->s.effects &= ~EF_SPINNINGLIGHTS; + self->use = NULL; + + self->think = G_FreeEdict; + self->nextthink = level.time + 0.1; +} + +void +rotating_light_use(edict_t *self, edict_t *other /* unused */, + edict_t *activator /* unused */) +{ + if (!self) + { + return; + } + + if (self->spawnflags & START_OFF) + { + self->spawnflags &= ~START_OFF; + self->s.effects |= EF_SPINNINGLIGHTS; + + if (self->spawnflags & 2) + { + self->think = rotating_light_alarm; + self->nextthink = level.time + 0.1; + } + } + else + { + self->spawnflags |= START_OFF; + self->s.effects &= ~EF_SPINNINGLIGHTS; + } +} + +void +SP_rotating_light(edict_t *self) +{ + if (!self) + { + return; + } + + self->movetype = MOVETYPE_STOP; + self->solid = SOLID_BBOX; + + self->s.modelindex = gi.modelindex("models/objects/light/tris.md2"); + + self->s.frame = 0; + + self->use = rotating_light_use; + + if (self->spawnflags & START_OFF) + { + self->s.effects &= ~EF_SPINNINGLIGHTS; + } + else + { + self->s.effects |= EF_SPINNINGLIGHTS; + } + + if (!self->speed) + { + self->speed = 32; + } + + if (!self->health) + { + self->health = 10; + self->max_health = self->health; + self->die = rotating_light_killed; + self->takedamage = DAMAGE_YES; + } + else + { + self->max_health = self->health; + self->die = rotating_light_killed; + self->takedamage = DAMAGE_YES; + } + + if (self->spawnflags & 2) + { + self->moveinfo.sound_start = gi.soundindex("misc/alarm.wav"); + } + + gi.linkentity(self); +} + +/* + * QUAKED func_object_repair (1 .5 0) (-8 -8 -8) (8 8 8) + * object to be repaired. + * The default delay is 1 second + * "delay" the delay in seconds for spark to occur + */ +void +object_repair_fx(edict_t *ent) +{ + if (!ent) + { + return; + } + + ent->nextthink = level.time + ent->delay; + + if (ent->health <= 100) + { + ent->health++; + } + else + { + gi.WriteByte(svc_temp_entity); + gi.WriteByte(TE_WELDING_SPARKS); + gi.WriteByte(10); + gi.WritePosition(ent->s.origin); + gi.WriteDir(vec3_origin); + gi.WriteByte(0xe0 + (rand() & 7)); + gi.multicast(ent->s.origin, MULTICAST_PVS); + } +} + +void +object_repair_dead(edict_t *ent) +{ + if (!ent) + { + return; + } + + G_UseTargets(ent, ent); + ent->nextthink = level.time + 0.1; + ent->think = object_repair_fx; +} + +void +object_repair_sparks(edict_t *ent) +{ + if (!ent) + { + return; + } + + if (ent->health < 0) + { + ent->nextthink = level.time + 0.1; + ent->think = object_repair_dead; + return; + } + + ent->nextthink = level.time + ent->delay; + + gi.WriteByte(svc_temp_entity); + gi.WriteByte(TE_WELDING_SPARKS); + gi.WriteByte(10); + gi.WritePosition(ent->s.origin); + gi.WriteDir(vec3_origin); + gi.WriteByte(0xe0 + (rand() & 7)); + gi.multicast(ent->s.origin, MULTICAST_PVS); +} + +void +SP_object_repair(edict_t *ent) +{ + if (!ent) + { + return; + } + + ent->movetype = MOVETYPE_NONE; + ent->solid = SOLID_BBOX; + ent->classname = "object_repair"; + ent->think = object_repair_sparks; + ent->nextthink = level.time + 1.0; + ent->health = 100; + + if (!ent->delay) + { + ent->delay = 1.0; + } + + gi.linkentity(ent); } -void monsterspawner_go (edict_t *self) +void monsterspawner_go(edict_t *self) { edict_t *monster; vec3_t angle,holdorigin; @@ -3707,24 +4927,6 @@ void SP_func_monsterspawner (edict_t *self) } - -/* - * QUAKED func_killbox (1 0 0) ? - * Kills everything inside when fired, irrespective of protection. - */ -void use_killbox (edict_t *self, edict_t *other, edict_t *activator) -{ - KillBox (self); -} - -void SP_func_killbox (edict_t *ent) -{ - gi.setmodel(ent, ent->model); - ent->use = use_killbox; - ent->svflags = SVF_NOCLIENT; -} - - //=========================== // These are just temp entities until the actual code is written for each monster //=========================== diff --git a/src/game/g_newai.c b/src/game/g_newai.c new file mode 100644 index 000000000..0fe11f151 --- /dev/null +++ b/src/game/g_newai.c @@ -0,0 +1,1678 @@ +/* + * Copyright (c) ZeniMax Media Inc. + * Licensed under the GNU General Public License 2.0. + */ + +/* + * ======================================================================= + * + * Rogue specific AI code + * + * ======================================================================= + */ + +#include "header/local.h" + +#if 0 + +#define STATE_TOP 0 +#define STATE_BOTTOM 1 +#define STATE_UP 2 +#define STATE_DOWN 3 + +#define HINT_ENDPOINT 0x0001 +#define MAX_HINT_CHAINS 100 + +#define TESLA_DAMAGE_RADIUS 128 + +edict_t *hint_path_start[MAX_HINT_CHAINS]; +int hint_paths_present; +int num_hint_paths; + +qboolean face_wall(edict_t *self); +void HuntTarget(edict_t *self); + +qboolean +blocked_checkplat(edict_t *self, float dist) +{ + int playerPosition; + trace_t trace; + vec3_t pt1, pt2; + vec3_t forward; + edict_t *plat; + + if (!self) + { + return false; + } + + if (!self->enemy) + { + return false; + } + + /* check player's relative altitude */ + if (self->enemy->absmin[2] >= self->absmax[2]) + { + playerPosition = 1; + } + else if (self->enemy->absmax[2] <= self->absmin[2]) + { + playerPosition = -1; + } + else + { + playerPosition = 0; + } + + /* if we're close to the same position, don't bother trying plats. */ + if (playerPosition == 0) + { + return false; + } + + plat = NULL; + + /* see if we're already standing on a plat. */ + if (self->groundentity && (self->groundentity != world)) + { + if (!strncmp(self->groundentity->classname, "func_plat", 8)) + { + plat = self->groundentity; + } + } + + /* if we're not, check to see if we'll step onto one with this move */ + if (!plat) + { + AngleVectors(self->s.angles, forward, NULL, NULL); + VectorMA(self->s.origin, dist, forward, pt1); + VectorCopy(pt1, pt2); + pt2[2] -= 384; + + trace = gi.trace(pt1, vec3_origin, vec3_origin, pt2, + self, MASK_MONSTERSOLID); + + if ((trace.fraction < 1) && !trace.allsolid && !trace.startsolid) + { + if (!strncmp(trace.ent->classname, "func_plat", 8)) + { + plat = trace.ent; + } + } + } + + /* if we've found a plat, trigger it. */ + if (plat && plat->use) + { + if (playerPosition == 1) + { + if (((self->groundentity == plat) && + (plat->moveinfo.state == STATE_BOTTOM)) || + ((self->groundentity != plat) && + (plat->moveinfo.state == STATE_TOP))) + { + plat->use(plat, self, self); + return true; + } + } + else if (playerPosition == -1) + { + if (((self->groundentity == plat) && + (plat->moveinfo.state == STATE_TOP)) || + ((self->groundentity != plat) && + (plat->moveinfo.state == STATE_BOTTOM))) + { + plat->use(plat, self, self); + return true; + } + } + } + + return false; +} + +qboolean +blocked_checkjump(edict_t *self, float dist, float maxDown, float maxUp) +{ + int playerPosition; + trace_t trace; + vec3_t pt1, pt2; + vec3_t forward, up; + + if (!self) + { + return false; + } + + if (!self->enemy) + { + return false; + } + + AngleVectors(self->s.angles, forward, NULL, up); + + if (self->enemy->absmin[2] > (self->absmin[2] + 16)) + { + playerPosition = 1; + } + else if (self->enemy->absmin[2] < (self->absmin[2] - 16)) + { + playerPosition = -1; + } + else + { + playerPosition = 0; + } + + if ((playerPosition == -1) && maxDown) + { + /* check to make sure we can even get to the spot we're going to "fall" from */ + VectorMA(self->s.origin, 48, forward, pt1); + trace = gi.trace(self->s.origin, self->mins, self->maxs, pt1, + self, MASK_MONSTERSOLID); + + if (trace.fraction < 1) + { + return false; + } + + VectorCopy(pt1, pt2); + pt2[2] = self->absmin[2] - maxDown - 1; + + trace = gi.trace(pt1, vec3_origin, vec3_origin, pt2, self, + MASK_MONSTERSOLID | MASK_WATER); + + if ((trace.fraction < 1) && !trace.allsolid && !trace.startsolid) + { + if (((self->absmin[2] - trace.endpos[2]) >= + 24) && (trace.contents & MASK_SOLID)) + { + if ((self->enemy->absmin[2] - trace.endpos[2]) > 32) + { + return false; + } + + if (trace.plane.normal[2] < 0.9) + { + return false; + } + + return true; + } + } + } + else if ((playerPosition == 1) && maxUp) + { + VectorMA(self->s.origin, 48, forward, pt1); + VectorCopy(pt1, pt2); + pt1[2] = self->absmax[2] + maxUp; + + trace = gi.trace(pt1, vec3_origin, vec3_origin, pt2, self, + MASK_MONSTERSOLID | MASK_WATER); + + if ((trace.fraction < 1) && !trace.allsolid && !trace.startsolid) + { + if (((trace.endpos[2] - self->absmin[2]) <= maxUp) && + trace.contents & MASK_SOLID) + { + face_wall(self); + return true; + } + } + } + + return false; +} + +qboolean +blocked_checknewenemy(edict_t *self) +{ + return false; +} + +void +hintpath_go(edict_t *self, edict_t *point) +{ + vec3_t dir; + vec3_t angles; + + if (!self || !point) + { + return; + } + + VectorSubtract(point->s.origin, self->s.origin, dir); + vectoangles2(dir, angles); + + self->ideal_yaw = angles[YAW]; + self->goalentity = self->movetarget = point; + self->monsterinfo.pausetime = 0; + self->monsterinfo.aiflags |= AI_HINT_PATH; + self->monsterinfo.aiflags &= ~(AI_SOUND_TARGET | AI_PURSUIT_LAST_SEEN | AI_PURSUE_NEXT | AI_PURSUE_TEMP); + + /* run for it */ + self->monsterinfo.search_time = level.time; + self->monsterinfo.run(self); +} + +void +hintpath_stop(edict_t *self) +{ + if (!self) + { + return; + } + + self->goalentity = NULL; + self->movetarget = NULL; + self->monsterinfo.last_hint_time = level.time; + self->monsterinfo.goal_hint = NULL; + self->monsterinfo.aiflags &= ~AI_HINT_PATH; + + if (has_valid_enemy(self)) + { + /* if we can see our target, go nuts */ + if (visible(self, self->enemy)) + { + FoundTarget(self); + return; + } + + /* otherwise, keep chasing */ + HuntTarget(self); + return; + } + + /* if our enemy is no longer valid, forget about our enemy and go into stand */ + self->enemy = NULL; + + /* we need the pausetime otherwise the stand code + will just revert to walking with no target and + the monsters will wonder around aimlessly trying + to hunt the world entity */ + self->monsterinfo.pausetime = level.time + 100000000; + self->monsterinfo.stand(self); +} + +qboolean +monsterlost_checkhint(edict_t *self) +{ + edict_t *e, *monster_pathchain, *target_pathchain; + edict_t *checkpoint = NULL; + edict_t *closest; + float closest_range = 1000000; + edict_t *start, *destination; + int count1 = 0, count2 = 0, count4 = 0, count5 = 0; + float r; + int i; + qboolean hint_path_represented[MAX_HINT_CHAINS]; + + if (!self) + { + return false; + } + + /* if there are no hint paths on this map, exit immediately. */ + if (!hint_paths_present) + { + return false; + } + + if (!self->enemy) + { + return false; + } + + if (self->monsterinfo.aiflags & AI_STAND_GROUND) + { + return false; + } + + if (!strcmp(self->classname, "monster_turret")) + { + return false; + } + + monster_pathchain = NULL; + + /* find all the hint_paths. */ + for (i = 0; i < num_hint_paths; i++) + { + e = hint_path_start[i]; + + while (e) + { + count1++; + + if (e->monster_hint_chain) + { + e->monster_hint_chain = NULL; + } + + if (monster_pathchain) + { + checkpoint->monster_hint_chain = e; + checkpoint = e; + } + else + { + monster_pathchain = e; + checkpoint = e; + } + + e = e->hint_chain; + } + } + + /* filter them by distance and visibility to the monster */ + e = monster_pathchain; + checkpoint = NULL; + + while (e) + { + r = realrange(self, e); + + if (r > 512) + { + count2++; + + if (checkpoint) + { + checkpoint->monster_hint_chain = e->monster_hint_chain; + e->monster_hint_chain = NULL; + e = checkpoint->monster_hint_chain; + continue; + } + else + { + /* use checkpoint as temp pointer */ + checkpoint = e; + e = e->monster_hint_chain; + checkpoint->monster_hint_chain = NULL; + + /* and clear it again */ + checkpoint = NULL; + + /* since we have yet to find a valid one (or else + checkpoint would be set) move the start of + monster_pathchain */ + monster_pathchain = e; + continue; + } + } + + if (!visible(self, e)) + { + count4++; + + if (checkpoint) + { + checkpoint->monster_hint_chain = e->monster_hint_chain; + e->monster_hint_chain = NULL; + e = checkpoint->monster_hint_chain; + continue; + } + else + { + /* use checkpoint as temp pointer */ + checkpoint = e; + e = e->monster_hint_chain; + checkpoint->monster_hint_chain = NULL; + + /* and clear it again */ + + checkpoint = NULL; + /* since we have yet to find a valid one (or else + checkpoint would be set) move the start of + monster_pathchain */ + monster_pathchain = e; + continue; + } + } + + /* if it passes all the tests, it's a keeper */ + count5++; + checkpoint = e; + e = e->monster_hint_chain; + } + + /* at this point, we have a list of all of the eligible + hint nodes for the monster we now take them, figure out + what hint chains they're on, and traverse down those + chains, seeing whether any can see the player. first, + we figure out which hint chains we have represented + in monster_pathchain */ + if (count5 == 0) + { + return false; + } + + for (i = 0; i < num_hint_paths; i++) + { + hint_path_represented[i] = false; + } + + e = monster_pathchain; + checkpoint = NULL; + + while (e) + { + if ((e->hint_chain_id < 0) || (e->hint_chain_id > num_hint_paths)) + { + return false; + } + + hint_path_represented[e->hint_chain_id] = true; + e = e->monster_hint_chain; + } + + count2 = 0; + count4 = 0; + count5 = 0; + + /* now, build the target_pathchain which contains all of + the hint_path nodes we need to check for validity + (within range, visibility) */ + target_pathchain = NULL; + checkpoint = NULL; + + for (i = 0; i < num_hint_paths; i++) + { + /* if this hint chain is represented in the + monster_hint_chain, add all of it's nodes + to the target_pathchain for validity checking */ + if (hint_path_represented[i]) + { + e = hint_path_start[i]; + + while (e) + { + if (target_pathchain) + { + checkpoint->target_hint_chain = e; + checkpoint = e; + } + else + { + target_pathchain = e; + checkpoint = e; + } + + e = e->hint_chain; + } + } + } + + /* target_pathchain is a list of all of the hint_path nodes + we need to check for validity relative to the target */ + e = target_pathchain; + checkpoint = NULL; + + while (e) + { + r = realrange(self->enemy, e); + + if (r > 512) + { + count2++; + + if (checkpoint) + { + checkpoint->target_hint_chain = e->target_hint_chain; + e->target_hint_chain = NULL; + e = checkpoint->target_hint_chain; + continue; + } + else + { + /* use checkpoint as temp pointer */ + checkpoint = e; + e = e->target_hint_chain; + checkpoint->target_hint_chain = NULL; + + /* and clear it again */ + checkpoint = NULL; + target_pathchain = e; + continue; + } + } + + if (!visible(self->enemy, e)) + { + count4++; + + if (checkpoint) + { + checkpoint->target_hint_chain = e->target_hint_chain; + e->target_hint_chain = NULL; + e = checkpoint->target_hint_chain; + continue; + } + else + { + /* use checkpoint as temp pointer */ + checkpoint = e; + e = e->target_hint_chain; + checkpoint->target_hint_chain = NULL; + + /* and clear it again */ + checkpoint = NULL; + target_pathchain = e; + continue; + } + } + + /* if it passes all the tests, it's a keeper */ + count5++; + checkpoint = e; + e = e->target_hint_chain; + } + + /* at this point we should have: + - monster_pathchain - a list of "monster valid" hint_path nodes linked + together by monster_hint_chain + - target_pathcain - a list of "target valid" hint_path nodes linked + together by target_hint_chain. these are filtered + such that only nodes which are on the same chain + as "monster valid" nodes + + Now, we figure out which "monster valid" node we want to use. To do this, we + first off make sure we have some target nodes. If we don't, there are no + valid hint_path nodes for us to take. If we have some, we filter all of our + "monster valid" nodes by which ones have "target valid" nodes on them. Once + this filter is finished, we select the closest "monster valid" node, and go to it. */ + + if (count5 == 0) + { + return false; + } + + /* reuse the hint_chain_represented array, this time + to see which chains are represented by the target */ + for (i = 0; i < num_hint_paths; i++) + { + hint_path_represented[i] = false; + } + + e = target_pathchain; + checkpoint = NULL; + + while (e) + { + if ((e->hint_chain_id < 0) || (e->hint_chain_id > num_hint_paths)) + { + return false; + } + + hint_path_represented[e->hint_chain_id] = true; + e = e->target_hint_chain; + } + + /* traverse the monster_pathchain - if the hint_node isn't represented + in the "target valid" chain list, remove it. if it is on the list, + check it for range from the monster. If the range is the closest, keep it */ + closest = NULL; + e = monster_pathchain; + + while (e) + { + if (!(hint_path_represented[e->hint_chain_id])) + { + checkpoint = e->monster_hint_chain; + e->monster_hint_chain = NULL; + e = checkpoint; + continue; + } + + r = realrange(self, e); + + if (r < closest_range) + { + closest = e; + } + + e = e->monster_hint_chain; + } + + if (!closest) + { + return false; + } + + start = closest; + + /* now we know which one is the closest to the monster.. + this is the one the monster will go to. we need to + finally determine what the DESTINATION node is for the + monster. walk down the hint_chain, and find the closest one + to the player */ + closest = NULL; + closest_range = 10000000; + e = target_pathchain; + + while (e) + { + if (start->hint_chain_id == e->hint_chain_id) + { + r = realrange(self, e); + + if (r < closest_range) + { + closest = e; + } + } + + e = e->target_hint_chain; + } + + if (!closest) + { + return false; + } + + destination = closest; + + self->monsterinfo.goal_hint = destination; + hintpath_go(self, start); + + return true; +} + +void +hint_path_touch(edict_t *self, edict_t *other, cplane_t *plane /* unused */, + csurface_t *surf /* unused */) +{ + edict_t *e, *goal; + edict_t *next = NULL; + qboolean goalFound = false; + + if (!self || !other) + { + return; + } + + /* make sure we're the target of it's obsession */ + if (other->movetarget == self) + { + goal = other->monsterinfo.goal_hint; + + /* if the monster is where he wants to be */ + if (goal == self) + { + hintpath_stop(other); + return; + } + else + { + /* if we aren't, figure out which way we want to go */ + e = hint_path_start[self->hint_chain_id]; + + while (e) + { + /* if we get up to ourselves on the hint chain, we're going down it */ + if (e == self) + { + next = e->hint_chain; + break; + } + + if (e == goal) + { + goalFound = true; + } + + /* if we get to where the next link on the chain is this hint_path + and have found the goal on the way we're going upstream, so + remember who the previous link is */ + if ((e->hint_chain == self) && goalFound) + { + next = e; + break; + } + + e = e->hint_chain; + } + } + + /* if we couldn't find it, have the monster go back to normal hunting. */ + if (!next) + { + hintpath_stop(other); + return; + } + + /* set the last_hint entry to this hint_path, + and send him on his way */ + hintpath_go(other, next); + + /* have the monster freeze if the hint path we + just touched has a wait time on it, for e + xample, when riding a plat. */ + if (self->wait) + { + other->nextthink = level.time + self->wait; + } + } +} + +/* + * QUAKED hint_path (.5 .3 0) (-8 -8 -8) (8 8 8) END + * + * Target: next hint path + * + * END - set this flag on the endpoints of each hintpath. + * "wait" - set this if you want the monster to freeze when they touch this hintpath + */ +void +SP_hint_path(edict_t *self) +{ + if (!self) + { + return; + } + + if (deathmatch->value) + { + G_FreeEdict(self); + return; + } + + if (!self->targetname && !self->target) + { + gi.dprintf("unlinked hint_path at %s\n", vtos(self->s.origin)); + G_FreeEdict(self); + return; + } + + self->solid = SOLID_TRIGGER; + self->touch = hint_path_touch; + VectorSet(self->mins, -8, -8, -8); + VectorSet(self->maxs, 8, 8, 8); + self->svflags |= SVF_NOCLIENT; + gi.linkentity(self); +} + +void +InitHintPaths(void) +{ + edict_t *e, *current; + int field, i, count2; + + hint_paths_present = 0; + + /* check all the hint_paths. */ + field = FOFS(classname); + e = G_Find(NULL, field, "hint_path"); + + if (e) + { + hint_paths_present = 1; + } + else + { + return; + } + + memset(hint_path_start, 0, MAX_HINT_CHAINS * sizeof(edict_t *)); + num_hint_paths = 0; + + while (e) + { + if (e->spawnflags & HINT_ENDPOINT) + { + if (e->target) /* start point */ + { + if (e->targetname) /* this is a bad end, ignore it */ + { + gi.dprintf("Hint path at %s marked as endpoint with both target (%s) and targetname (%s)\n", + vtos(e->s.origin), e->target, e->targetname); + } + else + { + if (num_hint_paths >= MAX_HINT_CHAINS) + { + break; + } + + hint_path_start[num_hint_paths++] = e; + } + } + } + + e = G_Find(e, field, "hint_path"); + } + + field = FOFS(targetname); + + for (i = 0; i < num_hint_paths; i++) + { + count2 = 1; + current = hint_path_start[i]; + current->hint_chain_id = i; + e = G_Find(NULL, field, current->target); + + if (G_Find(e, field, current->target)) + { + gi.dprintf("\nForked hint path at %s detected for chain %d, target %s\n", + vtos(current->s.origin), num_hint_paths, current->target); + hint_path_start[i]->hint_chain = NULL; + continue; + } + + while (e) + { + if (e->hint_chain) + { + gi.dprintf("\nCircular hint path at %s detected for chain %d, targetname %s\n", + vtos(e->s.origin), num_hint_paths, e->targetname); + hint_path_start[i]->hint_chain = NULL; + break; + } + + count2++; + current->hint_chain = e; + current = e; + current->hint_chain_id = i; + + if (!current->target) + { + break; + } + + e = G_Find(NULL, field, current->target); + + if (G_Find(e, field, current->target)) + { + gi.dprintf("\nForked hint path at %s detected for chain %d, target %s\n", + vtos(current->s.origin), num_hint_paths, current->target); + hint_path_start[i]->hint_chain = NULL; + break; + } + } + } +} + +qboolean +inback(edict_t *self, edict_t *other) +{ + vec3_t vec; + float dot; + vec3_t forward; + + if (!self || !other) + { + return false; + } + + AngleVectors(self->s.angles, forward, NULL, NULL); + VectorSubtract(other->s.origin, self->s.origin, vec); + VectorNormalize(vec); + dot = DotProduct(vec, forward); + + if (dot < -0.3) + { + return true; + } + + return false; +} + +float +realrange(edict_t *self, edict_t *other) +{ + vec3_t dir; + + if (!self || !other) + { + return 0; + } + + VectorSubtract(self->s.origin, other->s.origin, dir); + + return VectorLength(dir); +} + +qboolean +face_wall(edict_t *self) +{ + vec3_t pt; + vec3_t forward; + vec3_t ang; + trace_t tr; + + if (!self) + { + return false; + } + + AngleVectors(self->s.angles, forward, NULL, NULL); + VectorMA(self->s.origin, 64, forward, pt); + tr = gi.trace(self->s.origin, vec3_origin, vec3_origin, + pt, self, MASK_MONSTERSOLID); + + if ((tr.fraction < 1) && !tr.allsolid && !tr.startsolid) + { + vectoangles2(tr.plane.normal, ang); + self->ideal_yaw = ang[YAW] + 180; + + if (self->ideal_yaw > 360) + { + self->ideal_yaw -= 360; + } + + M_ChangeYaw(self); + return true; + } + + return false; +} +#endif + +void +badarea_touch(edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf) +{ +} + +edict_t * +SpawnBadArea(vec3_t mins, vec3_t maxs, float lifespan, edict_t *owner) +{ + edict_t *badarea; + vec3_t origin; + + if (!owner) + { + return NULL; + } + + VectorAdd(mins, maxs, origin); + VectorScale(origin, 0.5, origin); + + VectorSubtract(maxs, origin, maxs); + VectorSubtract(mins, origin, mins); + + badarea = G_Spawn(); + VectorCopy(origin, badarea->s.origin); + VectorCopy(maxs, badarea->maxs); + VectorCopy(mins, badarea->mins); + badarea->touch = badarea_touch; + badarea->movetype = MOVETYPE_NONE; + badarea->solid = SOLID_TRIGGER; + badarea->classname = "bad_area"; + gi.linkentity(badarea); + + if (lifespan) + { + badarea->think = G_FreeEdict; + badarea->nextthink = level.time + lifespan; + } + + badarea->owner = owner; + + return badarea; +} + +#if 0 +edict_t * +CheckForBadArea(edict_t *ent) +{ + int i, num; + edict_t *touch[MAX_EDICTS], *hit; + vec3_t mins, maxs; + + if (!ent) + { + return NULL; + } + + VectorAdd(ent->s.origin, ent->mins, mins); + VectorAdd(ent->s.origin, ent->maxs, maxs); + + num = gi.BoxEdicts(mins, maxs, touch, MAX_EDICTS, AREA_TRIGGERS); + + /* be careful, it is possible to have an entity in this + list removed before we get to it (killtriggered) */ + for (i = 0; i < num; i++) + { + hit = touch[i]; + + if (!hit->inuse) + { + continue; + } + + if (hit->touch == badarea_touch) + { + return hit; + } + } + + return NULL; +} + +qboolean +MarkTeslaArea(edict_t *self, edict_t *tesla) +{ + vec3_t mins, maxs; + edict_t *e; + edict_t *tail; + edict_t *area; + + if (!tesla || !self) + { + return false; + } + + area = NULL; + + /* make sure this tesla doesn't have a bad area around it already... */ + e = tesla->teamchain; + tail = tesla; + + while (e) + { + tail = tail->teamchain; + + if (!strcmp(e->classname, "bad_area")) + { + return false; + } + + e = e->teamchain; + } + + /* see if we can grab the trigger directly */ + if (tesla->teamchain && tesla->teamchain->inuse) + { + edict_t *trigger; + + trigger = tesla->teamchain; + + VectorCopy(trigger->absmin, mins); + VectorCopy(trigger->absmax, maxs); + + if (tesla->air_finished) + { + area = SpawnBadArea(mins, maxs, tesla->air_finished, tesla); + } + else + { + area = SpawnBadArea(mins, maxs, tesla->nextthink, tesla); + } + } + /* otherwise we just guess at how long it'll last. */ + else + { + VectorSet(mins, -TESLA_DAMAGE_RADIUS, -TESLA_DAMAGE_RADIUS, + tesla->mins[2]); + VectorSet(maxs, TESLA_DAMAGE_RADIUS, TESLA_DAMAGE_RADIUS, TESLA_DAMAGE_RADIUS); + + area = SpawnBadArea(mins, maxs, 30, tesla); + } + + /* if we spawned a bad area, then link it to the tesla */ + if (area) + { + tail->teamchain = area; + } + + return true; +} + +void +PredictAim(edict_t *target, vec3_t start, float bolt_speed, qboolean eye_height, + float offset, vec3_t aimdir, vec3_t aimpoint) +{ + vec3_t dir, vec; + float dist, time; + + if (!target || !target->inuse) + { + VectorCopy(vec3_origin, aimdir); + return; + } + + VectorSubtract(target->s.origin, start, dir); + + if (eye_height) + { + dir[2] += target->viewheight; + } + + dist = VectorLength(dir); + time = dist / bolt_speed; + + VectorMA(target->s.origin, time - offset, target->velocity, vec); + + if (eye_height) + { + vec[2] += target->viewheight; + } + + if (aimdir) + { + VectorSubtract(vec, start, aimdir); + VectorNormalize(aimdir); + } + + if (aimpoint) + { + VectorCopy(vec, aimpoint); + } +} + +qboolean +below(edict_t *self, edict_t *other) +{ + vec3_t vec; + float dot; + vec3_t down; + + if (!self || !other) + { + return false; + } + + VectorSubtract(other->s.origin, self->s.origin, vec); + VectorNormalize(vec); + VectorSet(down, 0, 0, -1); + dot = DotProduct(vec, down); + + if (dot > 0.95) /* 18 degree arc below */ + { + return true; + } + + return false; +} + +void +drawbbox(edict_t *self) +{ + int lines[4][3] = { + {1, 2, 4}, + {1, 2, 7}, + {1, 4, 5}, + {2, 4, 7} + }; + + if (!self) + { + return; + } + + int starts[4] = {0, 3, 5, 6}; + + vec3_t pt[8]; + int i, j, k; + vec3_t coords[2]; + vec3_t newbox; + vec3_t f, r, u, dir; + + VectorCopy(self->absmin, coords[0]); + VectorCopy(self->absmax, coords[1]); + + for (i = 0; i <= 1; i++) + { + for (j = 0; j <= 1; j++) + { + for (k = 0; k <= 1; k++) + { + pt[4 * i + 2 * j + k][0] = coords[i][0]; + pt[4 * i + 2 * j + k][1] = coords[j][1]; + pt[4 * i + 2 * j + k][2] = coords[k][2]; + } + } + } + + for (i = 0; i <= 3; i++) + { + for (j = 0; j <= 2; j++) + { + gi.WriteByte(svc_temp_entity); + gi.WriteByte(TE_DEBUGTRAIL); + gi.WritePosition(pt[starts[i]]); + gi.WritePosition(pt[lines[i][j]]); + gi.multicast(pt[starts[i]], MULTICAST_ALL); + } + } + + vectoangles2(self->s.angles, dir); + AngleVectors(dir, f, r, u); + + VectorMA(self->s.origin, 50, f, newbox); + gi.WriteByte(svc_temp_entity); + gi.WriteByte(TE_DEBUGTRAIL); + gi.WritePosition(self->s.origin); + gi.WritePosition(newbox); + gi.multicast(self->s.origin, MULTICAST_PVS); + VectorClear(newbox); + + VectorMA(self->s.origin, 50, r, newbox); + gi.WriteByte(svc_temp_entity); + gi.WriteByte(TE_DEBUGTRAIL); + gi.WritePosition(self->s.origin); + gi.WritePosition(newbox); + gi.multicast(self->s.origin, MULTICAST_PVS); + VectorClear(newbox); + + VectorMA(self->s.origin, 50, u, newbox); + gi.WriteByte(svc_temp_entity); + gi.WriteByte(TE_DEBUGTRAIL); + gi.WritePosition(self->s.origin); + gi.WritePosition(newbox); + gi.multicast(self->s.origin, MULTICAST_PVS); + VectorClear(newbox); +} + +void +M_MonsterDodge(edict_t *self, edict_t *attacker, float eta, trace_t *tr) +{ + float r = random(); + float height; + qboolean ducker = false, dodger = false; + + if (!self || !attacker || !tr) + { + return; + } + + /* this needs to be here since this can be + called after the monster has "died" */ + if (self->health < 1) + { + return; + } + + if ((self->monsterinfo.duck) && (self->monsterinfo.unduck)) + { + ducker = true; + } + + if ((self->monsterinfo.sidestep) && + !(self->monsterinfo.aiflags & AI_STAND_GROUND)) + { + dodger = true; + } + + if ((!ducker) && (!dodger)) + { + return; + } + + if (!self->enemy) + { + self->enemy = attacker; + FoundTarget(self); + } + + if ((eta < 0.1) || (eta > 5)) + { + return; + } + + /* skill level determination.. */ + if (r > (0.25 * ((skill->value) + 1))) + { + return; + } + + if (ducker) + { + height = self->absmax[2] - 32 - 1; /* the -1 is because the absmax is s.origin + maxs + 1 */ + + if ((!dodger) && ((tr->endpos[2] <= height) || (self->monsterinfo.aiflags & AI_DUCKED))) + { + return; + } + } + else + { + height = self->absmax[2]; + } + + if (dodger) + { + /* if we're already dodging, just finish + the sequence, i.e. don't do anything else */ + if (self->monsterinfo.aiflags & AI_DODGING) + { + return; + } + + /* if we're ducking already, or the shot is at our knees */ + if ((tr->endpos[2] <= height) || (self->monsterinfo.aiflags & AI_DUCKED)) + { + vec3_t right, diff; + + AngleVectors(self->s.angles, NULL, right, NULL); + VectorSubtract(tr->endpos, self->s.origin, diff); + + if (DotProduct(right, diff) < 0) + { + self->monsterinfo.lefty = 0; + } + else + { + self->monsterinfo.lefty = 1; + } + + /* if we are currently ducked, unduck */ + if ((ducker) && (self->monsterinfo.aiflags & AI_DUCKED)) + { + self->monsterinfo.unduck(self); + } + + self->monsterinfo.aiflags |= AI_DODGING; + self->monsterinfo.attack_state = AS_SLIDING; + + /* call the monster specific code here */ + self->monsterinfo.sidestep(self); + return; + } + } + + if (ducker) + { + if (self->monsterinfo.next_duck_time > level.time) + { + return; + } + + monster_done_dodge(self); + + /* set this prematurely; it doesn't hurt, and prevents extra iterations */ + self->monsterinfo.aiflags |= AI_DUCKED; + self->monsterinfo.duck(self, eta); + } +} + +void +monster_duck_down(edict_t *self) +{ + if (!self) + { + return; + } + + self->monsterinfo.aiflags |= AI_DUCKED; + self->maxs[2] = self->monsterinfo.base_height - 32; + self->takedamage = DAMAGE_YES; + + if (self->monsterinfo.duck_wait_time < level.time) + { + self->monsterinfo.duck_wait_time = level.time + 1; + } + + gi.linkentity(self); +} + +void +monster_duck_hold(edict_t *self) +{ + if (!self) + { + return; + } + + if (level.time >= self->monsterinfo.duck_wait_time) + { + self->monsterinfo.aiflags &= ~AI_HOLD_FRAME; + } + else + { + self->monsterinfo.aiflags |= AI_HOLD_FRAME; + } +} + +void +monster_duck_up(edict_t *self) +{ + if (!self) + { + return; + } + + self->monsterinfo.aiflags &= ~AI_DUCKED; + self->maxs[2] = self->monsterinfo.base_height; + self->takedamage = DAMAGE_AIM; + self->monsterinfo.next_duck_time = level.time + DUCK_INTERVAL; + gi.linkentity(self); +} + +qboolean +has_valid_enemy(edict_t *self) +{ + if (!self) + { + return false; + } + + if (!self->enemy) + { + return false; + } + + if (!self->enemy->inuse) + { + return false; + } + + if (self->enemy->health < 1) + { + return false; + } + + return true; +} + +void +TargetTesla(edict_t *self, edict_t *tesla) +{ + if ((!self) || (!tesla)) + { + return; + } + + /* medic bails on healing things */ + if (self->monsterinfo.aiflags & AI_MEDIC) + { + if (self->enemy) + { + cleanupHealTarget(self->enemy); + } + + self->monsterinfo.aiflags &= ~AI_MEDIC; + } + + /* store the player enemy in case we lose track of him. */ + if (self->enemy && self->enemy->client) + { + self->monsterinfo.last_player_enemy = self->enemy; + } + + if (self->enemy != tesla) + { + self->oldenemy = self->enemy; + self->enemy = tesla; + + if (self->monsterinfo.attack) + { + if (self->health <= 0) + { + return; + } + + self->monsterinfo.attack(self); + } + else + { + FoundTarget(self); + } + } +} + +edict_t * +PickCoopTarget(edict_t *self) +{ + if (!self) + { + return NULL; + } + + /* no more than 4 players in coop, so.. */ + edict_t *targets[4]; + int num_targets = 0, targetID; + edict_t *ent; + int player; + + /* if we're not in coop, this is a noop */ + if (!coop || !coop->value) + { + return NULL; + } + + memset(targets, 0, 4 * sizeof(edict_t *)); + + for (player = 1; player <= game.maxclients; player++) + { + ent = &g_edicts[player]; + + if (!ent->inuse) + { + continue; + } + + if (!ent->client) + { + continue; + } + + if (visible(self, ent)) + { + targets[num_targets++] = ent; + } + } + + if (!num_targets) + { + return NULL; + } + + /* get a number from 0 to (num_targets-1) */ + targetID = (random() * (float)num_targets); + + /* just in case we got a 1.0 from random */ + if (targetID == num_targets) + { + targetID--; + } + + return targets[targetID]; +} + +int +CountPlayers(void) +{ + edict_t *ent; + int count = 0; + int player; + + /* if we're not in coop, this is a noop */ + if (!coop || !coop->value) + { + return 1; + } + + for (player = 1; player <= game.maxclients; player++) + { + ent = &g_edicts[player]; + + if (!ent->inuse) + { + continue; + } + + if (!ent->client) + { + continue; + } + + count++; + } + + return count; +} + +void +monster_jump_start(edict_t *self) +{ + if (!self) + { + return; + } + + self->timestamp = level.time; +} + +qboolean +monster_jump_finished(edict_t *self) +{ + if (!self) + { + return false; + } + + if ((level.time - self->timestamp) > 3) + { + return true; + } + + return false; +} + +qboolean +blind_rocket_ok(edict_t *self, vec3_t start, vec3_t right, vec3_t target, float ofs, + vec3_t dir) +{ + trace_t tr; + vec3_t vec; + + if (!self) + { + return false; + } + + tr = gi.trace(start, vec3_origin, vec3_origin, target, self, MASK_SHOT); + + /* since all traces have the same start point this only needs one check */ + if (tr.startsolid) + { + return false; + } + + if (!tr.allsolid && (tr.fraction >= 0.5f)) + { + return true; + } + + VectorMA(target, -ofs, right, vec); + VectorSubtract(vec, start, dir); + VectorNormalize(dir); + + tr = gi.trace(start, vec3_origin, vec3_origin, vec, self, MASK_SHOT); + + if (!tr.allsolid && (tr.fraction >= 0.5f)) + { + return true; + } + + VectorMA(target, ofs, right, vec); + VectorSubtract(vec, start, dir); + VectorNormalize(dir); + + tr = gi.trace(start, vec3_origin, vec3_origin, vec, self, MASK_SHOT); + + return !tr.allsolid && (tr.fraction >= 0.5f); +} +#endif diff --git a/src/game/g_spawn.c b/src/game/g_spawn.c index c4a130630..7fa1dba17 100644 --- a/src/game/g_spawn.c +++ b/src/game/g_spawn.c @@ -701,14 +701,14 @@ SpawnEntities(const char *mapname, char *entities, const char *spawnpoint) if (!Q_stricmp(level.mapname, "rhangar2") && !Q_stricmp(ent->classname, "trigger_always") && - ent->target && !Q_stricmp(ent->target, "t265")) + ent->target && !Q_stricmp(ent->target, "t265")) { ent->spawnflags |= SPAWNFLAG_NOT_COOP; } if (!Q_stricmp(level.mapname, "rhangar2") && !Q_stricmp(ent->classname, "func_wall") && - !Q_stricmp(ent->model, "*15")) + !Q_stricmp(ent->model, "*15")) { ent->spawnflags |= SPAWNFLAG_NOT_COOP; } diff --git a/src/game/game_utilities.c b/src/game/game_utilities.c index 88ccfdbf0..2360ff329 100644 --- a/src/game/game_utilities.c +++ b/src/game/game_utilities.c @@ -439,7 +439,7 @@ edict_t *FindNearestVisibleActorInFrustum(edict_t *Finder,vec3_t FinderAngles, _BBMax, // Bounding box max. TempVec, // End pos. Finder, // Ignore this edict. - CONTENTS_SOLID); // Contents mask. + CONTENTS_SOLID); // Contents mask. if((Trace.fraction!=1.0)||(Trace.startsolid)) { @@ -589,7 +589,7 @@ edict_t *FindNearestVisibleActorInFrustum(edict_t *Finder,vec3_t FinderAngles, _BBMax, // Bounding box max. TempVec, // End pos. Finder, // Ignore this edict. - CONTENTS_SOLID); // Contents mask. + CONTENTS_SOLID); // Contents mask. if((Trace.fraction!=1.0)||(Trace.startsolid)) { @@ -682,7 +682,7 @@ edict_t *FindSpellTargetInRadius(edict_t *searchent, float radius, vec3_t search _maxs, // Bounding box max. entpos, // End pos. searchent, // Ignore this edict. - CONTENTS_SOLID); // Contents mask. + CONTENTS_SOLID); // Contents mask. if((Trace.fraction!=1.0)||(Trace.startsolid)) { diff --git a/src/game/header/local.h b/src/game/header/local.h index d272dcd00..cf40bb284 100644 --- a/src/game/header/local.h +++ b/src/game/header/local.h @@ -1158,8 +1158,13 @@ qboolean ahead(edict_t *self, edict_t *other); void G_SetToFree(edict_t *); void G_LinkMissile(edict_t *ent); + char *G_CopyString(char *in); + +float *tv(float x, float y, float z); char *vtos(vec3_t v); +void get_normal_vector(const cplane_t *p, vec3_t normal); + float vectoyaw(vec3_t vec); void vectoangles(vec3_t vec, vec3_t angles); @@ -1232,9 +1237,12 @@ qboolean M_CheckAttack(edict_t *self); void M_CheckGround(edict_t *ent); /* g_misc.c */ +void ThrowHead(edict_t *self, const char *gibname, int damage, int type); void ThrowClientHead(edict_t *self, int damage); void ThrowGib(edict_t *self, const char *gibname, int damage, int type); void BecomeExplosion1(edict_t *self); +void ThrowHeadACID(edict_t *self, const char *gibname, int damage, int type); +void ThrowGibACID(edict_t *self, const char *gibname, int damage, int type); /* g_ai.c */ void AI_SetSightClient(void); @@ -1255,6 +1263,46 @@ qboolean infront(edict_t *self, edict_t *other); qboolean visible(edict_t *self, edict_t *other); qboolean FacingIdeal(edict_t *self); +/* g_weapon.c */ +void ThrowDebris(edict_t *self, char *modelname, float speed, vec3_t origin); +qboolean fire_hit(edict_t *self, vec3_t aim, int damage, int kick); +void fire_bullet(edict_t *self, vec3_t start, vec3_t aimdir, int damage, + int kick, int hspread, int vspread, int mod); +void fire_shotgun(edict_t *self, vec3_t start, vec3_t aimdir, int damage, + int kick, int hspread, int vspread, int count, int mod); +void fire_blaster(edict_t *self, vec3_t start, vec3_t aimdir, int damage, + int speed, int effect, qboolean hyper); +void fire_grenade(edict_t *self, vec3_t start, vec3_t aimdir, int damage, + int speed, float timer, float damage_radius); +void fire_grenade2(edict_t *self, vec3_t start, vec3_t aimdir, int damage, + int speed, float timer, float damage_radius, qboolean held); +void fire_rocket(edict_t *self, vec3_t start, vec3_t dir, int damage, + int speed, float damage_radius, + int radius_damage); +void fire_rail(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick); +void fire_bfg(edict_t *self, vec3_t start, vec3_t dir, int damage, + int speed, float damage_radius); +void fire_ionripper(edict_t *self, vec3_t start, vec3_t aimdir, int damage, + int speed, int effect); +void fire_heat(edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, + float damage_radius, int radius_damage); +void fire_heatbeam(edict_t *self, vec3_t start, vec3_t aimdir, vec3_t offset, + int damage, int kick, qboolean monster); +void fire_blueblaster(edict_t *self, vec3_t start, vec3_t aimdir, int damage, + int speed, int effect); +void fire_plasma(edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, + float damage_radius, int radius_damage); +void fire_trap(edict_t *self, vec3_t start, vec3_t aimdir, int damage, + int speed, float timer, float damage_radius, qboolean held); + +/* g_ptrail.c */ +void PlayerTrail_Init(void); +void PlayerTrail_Add(vec3_t spot); +void PlayerTrail_New(vec3_t spot); +edict_t *PlayerTrail_PickFirst(edict_t *self); +edict_t *PlayerTrail_PickNext(edict_t *self); +edict_t *PlayerTrail_LastSpot(void); + /* g_client.c */ void respawn(edict_t *ent); void BeginIntermission(edict_t *targ); @@ -1320,6 +1368,71 @@ void SaveClientData(void); void LocalizationInit(void); const char* LocalizationMessage(const char *message, int *sound_index); +/* g_chase.c */ +void UpdateChaseCam(edict_t *ent); +void ChaseNext(edict_t *ent); +void ChasePrev(edict_t *ent); +void GetChaseTarget(edict_t *ent); + +/* savegame */ +void InitGame(void); +void ReadLevel(const char *filename); +void WriteLevel(const char *filename); +void ReadGame(const char *filename); +void WriteGame(const char *filename, qboolean autosave); +void SpawnEntities(const char *mapname, char *entities, const char *spawnpoint); + +void fire_flechette(edict_t *self, vec3_t start, vec3_t dir, int damage, + int speed, int kick); +void fire_prox(edict_t *self, vec3_t start, vec3_t aimdir, int damage, + int speed); +void fire_nuke(edict_t *self, vec3_t start, vec3_t aimdir, int speed); +void fire_flame(edict_t *self, vec3_t start, vec3_t aimdir, int damage, + int speed); +void fire_burst(edict_t *self, vec3_t start, vec3_t aimdir, int damage, + int speed); +void fire_maintain(edict_t *, edict_t *, vec3_t start, vec3_t aimdir, + int damage, int speed); +void fire_incendiary_grenade(edict_t *self, vec3_t start, vec3_t aimdir, + int damage, int speed, float timer, float damage_radius); +void fire_player_melee(edict_t *self, vec3_t start, vec3_t aim, int reach, + int damage, int kick, int quiet, int mod); +void fire_tesla(edict_t *self, vec3_t start, vec3_t aimdir, int damage, + int speed); +void fire_blaster2(edict_t *self, vec3_t start, vec3_t aimdir, int damage, + int speed, int effect, qboolean hyper); +void fire_tracker(edict_t *self, vec3_t start, vec3_t dir, int damage, + int speed, edict_t *enemy); + +/* g_newai.c */ +qboolean blind_rocket_ok(edict_t *self, vec3_t start, vec3_t right, vec3_t target, float ofs, + vec3_t dir); +qboolean blocked_checkplat(edict_t *self, float dist); +qboolean blocked_checkjump(edict_t *self, float dist, float maxDown, float maxUp); +qboolean blocked_checknewenemy(edict_t *self); +qboolean monsterlost_checkhint(edict_t *self); +qboolean inback(edict_t *self, edict_t *other); +float realrange(edict_t *self, edict_t *other); +edict_t *SpawnBadArea(vec3_t mins, vec3_t maxs, float lifespan, edict_t *owner); +edict_t *CheckForBadArea(edict_t *ent); +qboolean MarkTeslaArea(edict_t *self, edict_t *tesla); +void InitHintPaths(void); +void PredictAim(edict_t *target, vec3_t start, float bolt_speed, qboolean eye_height, + float offset, vec3_t aimdir, vec3_t aimpoint); +qboolean below(edict_t *self, edict_t *other); +void drawbbox(edict_t *self); +void M_MonsterDodge(edict_t *self, edict_t *attacker, float eta, trace_t *tr); +void monster_duck_down(edict_t *self); +void monster_duck_hold(edict_t *self); +void monster_duck_up(edict_t *self); +qboolean has_valid_enemy(edict_t *self); +void TargetTesla(edict_t *self, edict_t *tesla); +void hintpath_stop(edict_t *self); +edict_t *PickCoopTarget(edict_t *self); +int CountPlayers(void); +void monster_jump_start(edict_t *self); +qboolean monster_jump_finished(edict_t *self); + /* g_breakable.c */ void KillBrush(edict_t *targ,edict_t *inflictor,edict_t *attacker,int damage); @@ -1664,11 +1777,12 @@ struct edict_s int viewheight; /* height above origin where eyesight is determined */ - int bloodType; // type of stuff to spawn off when hit - edict_t *mynoise; /* can go in client only */ edict_t *mynoise2; + int bloodType; // type of stuff to spawn off when hit + int plat2flags; + vec3_t move_origin; vec3_t move_angles; diff --git a/src/game/monster/boss2/boss2.c b/src/game/monster/boss2/boss2.c index 228d754c6..6c333078d 100644 --- a/src/game/monster/boss2/boss2.c +++ b/src/game/monster/boss2/boss2.c @@ -676,7 +676,7 @@ boss2_reattack_mg(edict_t *self) void boss2_pain(edict_t *self, edict_t *other /* unused */, - float kick /* unused */, int damage) + float kick /* unused */, int damage) { if (!self) { diff --git a/src/game/monster/boss3/boss31.c b/src/game/monster/boss3/boss31.c index 191994486..fcfc678d8 100644 --- a/src/game/monster/boss3/boss31.c +++ b/src/game/monster/boss3/boss31.c @@ -556,7 +556,7 @@ jorg_attack1(edict_t *self) void jorg_pain(edict_t *self, edict_t *other /* unused */, - float kick /* unused */, int damage) + float kick /* unused */, int damage) { if (!self) { diff --git a/src/game/monster/boss5/boss5.c b/src/game/monster/boss5/boss5.c index 9f84a1667..957c37785 100644 --- a/src/game/monster/boss5/boss5.c +++ b/src/game/monster/boss5/boss5.c @@ -568,7 +568,7 @@ boss5_reattack1(edict_t *self) void boss5_pain(edict_t *self, edict_t *other /* unused */, - float kick /* unused */, int damage) + float kick /* unused */, int damage) { if (!self) { @@ -833,7 +833,7 @@ BossExplode2(edict_t *self) void boss5_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */, int damage /* unused */, - vec3_t point /* unused */) + vec3_t point /* unused */) { if (!self) { diff --git a/src/game/monster/brain/brain.c b/src/game/monster/brain/brain.c index 5c33870fd..016a97231 100644 --- a/src/game/monster/brain/brain.c +++ b/src/game/monster/brain/brain.c @@ -805,7 +805,7 @@ brain_laserbeam(edict_t *self) if (random() > 0.8) { gi.sound(self, CHAN_AUTO, gi.soundindex("misc/lasfly.wav"), - 1, ATTN_STATIC, 0); + 1, ATTN_STATIC, 0); } /* check for max distance */ @@ -1078,7 +1078,7 @@ brain_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* u if (self->health <= self->gib_health) { gi.sound(self, CHAN_VOICE, gi.soundindex("misc/udeath.wav"), - 1, ATTN_NORM, 0); + 1, ATTN_NORM, 0); for (n = 0; n < 2; n++) { diff --git a/src/game/monster/chick/chick.c b/src/game/monster/chick/chick.c index a79e217ba..f45f0dd6a 100644 --- a/src/game/monster/chick/chick.c +++ b/src/game/monster/chick/chick.c @@ -379,7 +379,7 @@ mmove_t chick_move_pain3 = void chick_pain(edict_t *self, edict_t *other /* unused */, - float kick /* unused */, int damage) + float kick /* unused */, int damage) { float r; diff --git a/src/game/monster/fish/fish.c b/src/game/monster/fish/fish.c index 354eb2d63..31fd92121 100644 --- a/src/game/monster/fish/fish.c +++ b/src/game/monster/fish/fish.c @@ -502,7 +502,7 @@ void fish_blocked(edict_t *self, trace_t *trace) // first decide if this guy is dead if (trace->ent->deadflag == DEAD_DEAD) { - fish_bounce_direction(self); + fish_bounce_direction(self); self->enemy = NULL; } // nope, so lets BITE THE BASTARD :) @@ -573,7 +573,7 @@ void finished_swim(edict_t *self) if (temp <= 5) { self->speed = 20; - self->ai_mood = AI_MOOD_STAND; + self->ai_mood = AI_MOOD_STAND; SetAnim(self, ANIM_STAND1); } } @@ -620,7 +620,7 @@ void finished_runswim(edict_t *self) if (temp <= 5) { self->speed = 20; - self->ai_mood = AI_MOOD_STAND; + self->ai_mood = AI_MOOD_STAND; SetAnim(self, ANIM_STAND1); } } @@ -923,7 +923,7 @@ void fish_hunt(edict_t *self) if(self->curAnimID == ANIM_PAIN1) { self->speed = 20; - self->ai_mood = AI_MOOD_STAND; + self->ai_mood = AI_MOOD_STAND; SetAnim(self, ANIM_STAND1); } return; @@ -994,7 +994,7 @@ void fish_pause (edict_t *self) } else // far enough that I break off.. { - self->enemy = NULL; + self->enemy = NULL; self->ai_mood = AI_MOOD_WANDER; fish_bounce_direction(self); } diff --git a/src/game/monster/fixbot/fixbot.c b/src/game/monster/fixbot/fixbot.c index 2fd64735f..c67e79994 100644 --- a/src/game/monster/fixbot/fixbot.c +++ b/src/game/monster/fixbot/fixbot.c @@ -1174,7 +1174,7 @@ fixbot_fire_laser(edict_t *self) } gi.sound(self, CHAN_AUTO, gi.soundindex("misc/lasfly.wav"), - 1, ATTN_STATIC, 0); + 1, ATTN_STATIC, 0); VectorCopy(self->s.origin, start); VectorCopy(self->enemy->s.origin, end); @@ -1576,7 +1576,7 @@ fixbot_attack(edict_t *self) void fixbot_pain(edict_t *self, edict_t *other /* unused */, - float kick /* unused */, int damage /* unused */) + float kick /* unused */, int damage /* unused */) { if (!self) { diff --git a/src/game/monster/float/float.c b/src/game/monster/float/float.c index 5ab8fc226..feb054a1d 100644 --- a/src/game/monster/float/float.c +++ b/src/game/monster/float/float.c @@ -768,7 +768,7 @@ floater_melee(edict_t *self) void floater_pain(edict_t *self, edict_t *other /* unused */, - float kick /* unused */, int damage) + float kick /* unused */, int damage) { int n; diff --git a/src/game/monster/flyer/flyer.c b/src/game/monster/flyer/flyer.c index 582cd690e..a41d077aa 100644 --- a/src/game/monster/flyer/flyer.c +++ b/src/game/monster/flyer/flyer.c @@ -934,7 +934,7 @@ flyer_check_melee(edict_t *self) void flyer_pain(edict_t *self, edict_t *other /* unused */, - float kick /* unused */, int damage) + float kick /* unused */, int damage) { int n; diff --git a/src/game/monster/gladiator/gladb.c b/src/game/monster/gladiator/gladb.c index 0bf0dbb2f..10a7eab22 100644 --- a/src/game/monster/gladiator/gladb.c +++ b/src/game/monster/gladiator/gladb.c @@ -459,7 +459,7 @@ mmove_t gladb_move_death = { void gladb_die(edict_t *self, edict_t *inflictor /* unused */, - edict_t *attacker /* unused */, int damage /*unused */, + edict_t *attacker /* unused */, int damage /*unused */, vec3_t point) { int n; diff --git a/src/game/monster/gladiator/gladiator.c b/src/game/monster/gladiator/gladiator.c index 52b475cf3..93db91437 100644 --- a/src/game/monster/gladiator/gladiator.c +++ b/src/game/monster/gladiator/gladiator.c @@ -486,7 +486,7 @@ mmove_t gladiator_move_death = void gladiator_die(edict_t *self, edict_t *inflictor /* unused */, - edict_t *attacker /* unused */, int damage /*unused */, + edict_t *attacker /* unused */, int damage /*unused */, vec3_t point) { int n; diff --git a/src/game/monster/gunner/gunner.c b/src/game/monster/gunner/gunner.c index e09a301e0..2f9775ade 100644 --- a/src/game/monster/gunner/gunner.c +++ b/src/game/monster/gunner/gunner.c @@ -413,7 +413,7 @@ mmove_t gunner_move_pain1 = void gunner_pain(edict_t *self, edict_t *other /* unused */, - float kick /* unused */, int damage) + float kick /* unused */, int damage) { if (!self) { diff --git a/src/game/monster/infantry/infantry.c b/src/game/monster/infantry/infantry.c index f1fbbb181..2702e2bdf 100644 --- a/src/game/monster/infantry/infantry.c +++ b/src/game/monster/infantry/infantry.c @@ -303,7 +303,7 @@ mmove_t infantry_move_pain2 = void infantry_pain(edict_t *self, edict_t *other /* unused */, - float kick /* unused */, int damage) + float kick /* unused */, int damage) { if (!self) { diff --git a/src/game/monster/insane/insane.c b/src/game/monster/insane/insane.c index b5e161bfb..f7050be17 100644 --- a/src/game/monster/insane/insane.c +++ b/src/game/monster/insane/insane.c @@ -700,7 +700,7 @@ insane_run(edict_t *self) void insane_pain(edict_t *self, edict_t *other /* unused */, - float kick /* unused */, int damage) + float kick /* unused */, int damage) { int l, r; diff --git a/src/game/monster/parasite/parasite.c b/src/game/monster/parasite/parasite.c index 9c48b3c07..e2c353545 100644 --- a/src/game/monster/parasite/parasite.c +++ b/src/game/monster/parasite/parasite.c @@ -443,7 +443,7 @@ mmove_t parasite_move_pain1 = void parasite_pain(edict_t *self, edict_t *other /* unused */, - float kick /* unused */, int damage /* unused */) + float kick /* unused */, int damage /* unused */) { if (!self) { diff --git a/src/game/monster/soldier/soldier.c b/src/game/monster/soldier/soldier.c index 07f898807..1216703db 100644 --- a/src/game/monster/soldier/soldier.c +++ b/src/game/monster/soldier/soldier.c @@ -2526,7 +2526,7 @@ mmove_t soldierh_move_pain4 = { void soldierh_pain(edict_t *self, edict_t *other /* unused */, - float kick /* unused */, int damage /* unused */) + float kick /* unused */, int damage /* unused */) { float r; int n; diff --git a/src/game/monster/supertank/supertank.c b/src/game/monster/supertank/supertank.c index 5f1fb6391..408802039 100644 --- a/src/game/monster/supertank/supertank.c +++ b/src/game/monster/supertank/supertank.c @@ -584,7 +584,7 @@ supertank_reattack1(edict_t *self) void supertank_pain(edict_t *self, edict_t *other /* unused */, - float kick /* unused */, int damage) + float kick /* unused */, int damage) { if (!self) { diff --git a/src/game/monster/tank/tank.c b/src/game/monster/tank/tank.c index 1cb11a87c..87c491d3a 100644 --- a/src/game/monster/tank/tank.c +++ b/src/game/monster/tank/tank.c @@ -372,7 +372,7 @@ mmove_t tank_move_pain3 = void tank_pain(edict_t *self, edict_t *other /* other */, - float kick /* other */, int damage) + float kick /* other */, int damage) { if (!self) { diff --git a/src/game/player/client.c b/src/game/player/client.c index c51d77505..e9acb723b 100644 --- a/src/game/player/client.c +++ b/src/game/player/client.c @@ -967,16 +967,16 @@ static const short KillBy[MOD_MAX] = 0, // MOD_UNKNOWN GM_OBIT_STAFF, // MOD_STAFF - GM_OBIT_FIREBALL, // MOD_FIREBALL - GM_OBIT_MMISSILE, // MOD_MMISSILE + GM_OBIT_FIREBALL, // MOD_FIREBALL + GM_OBIT_MMISSILE, // MOD_MMISSILE GM_OBIT_SPHERE, // MOD_SPHERE - GM_OBIT_SPHERE_SPL, // MOD_SPHERE_SPL - GM_OBIT_IRONDOOM, // MOD_IRONDOOM - GM_OBIT_FIREWALL, // MOD_FIREWALL + GM_OBIT_SPHERE_SPL, // MOD_SPHERE_SPL + GM_OBIT_IRONDOOM, // MOD_IRONDOOM + GM_OBIT_FIREWALL, // MOD_FIREWALL GM_OBIT_STORM, // MOD_STORM - GM_OBIT_PHOENIX, // MOD_PHOENIX + GM_OBIT_PHOENIX, // MOD_PHOENIX GM_OBIT_PHOENIX_SPL, // MOD_PHOENIX_SPL - GM_OBIT_HELLSTAFF, // MOD_HELLSTAFF + GM_OBIT_HELLSTAFF, // MOD_HELLSTAFF GM_OBIT_STAFF, // MOD_P_STAFF GM_OBIT_FIREBALL, // MOD_P_FIREBALL @@ -1050,7 +1050,7 @@ void ClientObituary(edict_t *self, edict_t *inflictor, edict_t *attacker) if(friendlyFire) attacker->client->resp.score--; else - attacker->client->resp.score++; + attacker->client->resp.score++; player_leader_effect(); } @@ -1068,7 +1068,7 @@ void ClientObituary(edict_t *self, edict_t *inflictor, edict_t *attacker) if(deathmatch->value) { self->client->resp.score--; - player_leader_effect(); + player_leader_effect(); } self->enemy = NULL; @@ -1229,7 +1229,7 @@ player_die(edict_t *self, edict_t *inflictor, edict_t *attacker, // Won`t get sent to client if mi 0 unless flag is set self->svflags |= SVF_ALWAYS_SEND; self->s.effects |= EF_NODRAW_ALWAYS_SEND | EF_ALWAYS_ADD_EFFECTS; - self->deadflag=DEAD_DEAD; + self->deadflag=DEAD_DEAD; self->client->playerinfo.deadflag=DEAD_DEAD; } @@ -1256,7 +1256,7 @@ player_die(edict_t *self, edict_t *inflictor, edict_t *attacker, PlayerChickenDeath(self); player_make_gib(self, attacker); - self->s.modelindex=0; + self->s.modelindex=0; // Won`t get sent to client if mi 0 unless flag is set self->svflags |= SVF_ALWAYS_SEND; self->s.effects |= EF_NODRAW_ALWAYS_SEND | EF_ALWAYS_ADD_EFFECTS; @@ -1733,7 +1733,7 @@ InitBodyQue(void) void body_die(edict_t *self, edict_t *inflictor /* unused */, - edict_t *attacker /* unused */, int damage, + edict_t *attacker /* unused */, int damage, vec3_t point /* unused */) { BecomeDebris(self); @@ -2065,7 +2065,7 @@ void SpawnInitialPlayerEffects(edict_t *ent) // jmarshall end if (deathmatch->value || coop->value) - player_leader_effect(); + player_leader_effect(); } // ************************************************************************************************ diff --git a/src/game/player/funcs.c b/src/game/player/funcs.c index 782fbce0c..cfa791d91 100644 --- a/src/game/player/funcs.c +++ b/src/game/player/funcs.c @@ -956,7 +956,7 @@ qboolean G_HandleTeleport(playerinfo_t *playerinfo) } if(!deathmatch->value) - return true; + return true; } return false; diff --git a/src/game/player/library/p_actions.c b/src/game/player/library/p_actions.c index 641038066..06e7bf0cc 100644 --- a/src/game/player/library/p_actions.c +++ b/src/game/player/library/p_actions.c @@ -1598,7 +1598,7 @@ void PlayerActionSwimIdleSound(playerinfo_t *playerinfo, float value) } else { - playerinfo->G_Sound(SND_PRED_ID15, + playerinfo->G_Sound(SND_PRED_ID15, playerinfo->leveltime, playerinfo->self, CHAN_VOICE, diff --git a/src/game/player/library/p_anim_branch.c b/src/game/player/library/p_anim_branch.c index 8f23d2849..4c27e950c 100644 --- a/src/game/player/library/p_anim_branch.c +++ b/src/game/player/library/p_anim_branch.c @@ -2079,13 +2079,13 @@ int BranchCheckAmmo(playerinfo_t *playerinfo) playerinfo->G_WeapNext(playerinfo->self); if (playerinfo->pers.weapon->tag == ITEM_WEAPON_REDRAINBOW) { - PlayerAnimSetUpperSeq(playerinfo, ASEQ_WRRBOW_END); - return(ASEQ_WRRBOW_END); + PlayerAnimSetUpperSeq(playerinfo, ASEQ_WRRBOW_END); + return(ASEQ_WRRBOW_END); } else { PlayerAnimSetUpperSeq(playerinfo, ASEQ_WPHBOW_END); - return(ASEQ_WPHBOW_END); + return(ASEQ_WPHBOW_END); } } diff --git a/src/game/player/library/p_anim_data.c b/src/game/player/library/p_anim_data.c index 0ed3d2cac..14ab2e11b 100644 --- a/src/game/player/library/p_anim_data.c +++ b/src/game/player/library/p_anim_data.c @@ -1481,15 +1481,15 @@ paceldata_t PlayerChickenData[ASEQ_MAX] = { &chickenp_move_stand, 0, 0, PLAYER_FLAG_STAND|PLAYER_FLAG_FALLBREAK }, // ASEQ_PIVOTR { &chickenp_move_stand, 0, 0, PLAYER_FLAG_STAND|PLAYER_FLAG_FALLBREAK }, // ASEQ_PIVOTR_END { &chickenp_move_dummy, 0, 0, PLAYER_FLAG_FALLBREAK }, // ASEQ_TURN180 - { &chickenp_move_run, 0, 0, PLAYER_FLAG_FALLBREAK }, // ASEQ_RUNF_GO, + { &chickenp_move_run, 0, 0, PLAYER_FLAG_FALLBREAK }, // ASEQ_RUNF_GO, { &chickenp_move_runattack, 0, 0, PLAYER_FLAG_FALLBREAK }, // ASEQ_RUNF, { &chickenp_move_dummy, 0, 0, PLAYER_FLAG_FALLBREAK }, // ASEQ_RUNF_END, - { &chickenp_move_walk, 0, 0, PLAYER_FLAG_FALLBREAK }, // ASEQ_WALKF_GO + { &chickenp_move_walk, 0, 0, PLAYER_FLAG_FALLBREAK }, // ASEQ_WALKF_GO { &chickenp_move_dummy, 0, 0, PLAYER_FLAG_FALLBREAK }, // ASEQ_WALKF { &chickenp_move_dummy, 0, 0, PLAYER_FLAG_FALLBREAK }, // ASEQ_WALKF_END, { &chickenp_move_dummy, 0, 0, PLAYER_FLAG_FALLBREAK }, // ASEQ_CREEPF, { &chickenp_move_dummy, 0, 0, PLAYER_FLAG_FALLBREAK }, // ASEQ_CREEPF_END, - { &chickenp_move_back, 0, 0, PLAYER_FLAG_FALLBREAK }, // ASEQ_WALKB, + { &chickenp_move_back, 0, 0, PLAYER_FLAG_FALLBREAK }, // ASEQ_WALKB, { &chickenp_move_dummy, 0, 0, PLAYER_FLAG_FALLBREAK }, // ASEQ_CREEPB, { &chickenp_move_dummy, 0, 0, PLAYER_FLAG_FALLBREAK }, // ASEQ_CREEPB_END, { &chickenp_move_dummy, 0, 0, PLAYER_FLAG_FALLBREAK }, // ASEQ_CROUCH_GO, diff --git a/src/game/player/library/p_items.c b/src/game/player/library/p_items.c index 24173ebcd..0a587f41c 100644 --- a/src/game/player/library/p_items.c +++ b/src/game/player/library/p_items.c @@ -124,7 +124,7 @@ gitem_t itemlist[]= "array", // Pickup name (char *) GM_FORCEBLAST, // pickup message GM_NOFORCE, // can`t use message - NULL, // Pickup (f) + NULL, // Pickup (f) NULL, // Use (f) NULL, // Drop (f) NULL, // Think (f) @@ -736,7 +736,7 @@ gitem_t itemlist[]= "Town Key", // Pickup name (char *) GM_F_TOWNKEY, // pickup message GM_NEED_TOWNKEY, // can`t use message - NULL, // Pickup (f) + NULL, // Pickup (f) NULL, // Use (f) NULL, // Drop (f) NULL, // Think (f) @@ -762,7 +762,7 @@ gitem_t itemlist[]= "Cog", // Pickup name (char *) GM_F_COG, // pickup message GM_NEED_COG, // can`t use message - NULL, // Pickup (f) + NULL, // Pickup (f) NULL, // Use (f) NULL, // Drop (f) NULL, // Think (f) @@ -788,7 +788,7 @@ gitem_t itemlist[]= "Defensive Shield", // Pickup name (char *) GM_F_SHIELD, // pickup message GM_NEED_SHIELD, // can`t use message - NULL, // Pickup (f) + NULL, // Pickup (f) NULL, // Use (f) NULL, // Drop (f) NULL, // Think (f) @@ -814,7 +814,7 @@ gitem_t itemlist[]= "Potion", // Pickup name (char *) GM_F_POTION, // pickup message GM_NEED_POTION, // can`t use message - NULL, // Pickup (f) + NULL, // Pickup (f) NULL, // Use (f) NULL, // Drop (f) NULL, // Think (f) @@ -841,7 +841,7 @@ gitem_t itemlist[]= "Container", // Pickup name (char *) GM_F_CONT, // pickup message GM_NEED_CONT, // can`t use message - NULL, // Pickup (f) + NULL, // Pickup (f) NULL, // Use (f) NULL, // Drop (f) NULL, // Think (f) @@ -868,7 +868,7 @@ gitem_t itemlist[]= "Full Container", // Pickup name (char *) GM_F_CONTFULL, // pickup message GM_NEED_CONTFULL, // can`t use message - NULL, // Pickup (f) + NULL, // Pickup (f) NULL, // Use (f) NULL, // Drop (f) NULL, // Think (f) @@ -894,7 +894,7 @@ gitem_t itemlist[]= "Crystal", // Pickup name (char *) GM_F_CRYSTAL, // pickup message GM_NEED_CRYSTAL, // can`t use message - NULL, // Pickup (f) + NULL, // Pickup (f) NULL, // Use (f) NULL, // Drop (f) NULL, // Think (f) @@ -920,7 +920,7 @@ gitem_t itemlist[]= "Canyon Key", // Pickup name (char *) GM_F_CANYONKEY, // pickup message GM_NEED_CANYONKEY, // can`t use message - NULL, // Pickup (f) + NULL, // Pickup (f) NULL, // Use (f) NULL, // Drop (f) NULL, // Think (f) @@ -946,7 +946,7 @@ gitem_t itemlist[]= "Hive 2 Amulet", // Pickup name (char *) GM_F_AMULET, // pickup message GM_NEED_AMULET, // can`t use message - NULL, // Pickup (f) + NULL, // Pickup (f) NULL, // Use (f) NULL, // Drop (f) NULL, // Think (f) @@ -972,7 +972,7 @@ gitem_t itemlist[]= "Hive 2 Spear", // Pickup name (char *) GM_F_SPEAR, // pickup message GM_NEED_SPEAR, // can`t use message - NULL, // Pickup (f) + NULL, // Pickup (f) NULL, // Use (f) NULL, // Drop (f) NULL, // Think (f) @@ -998,7 +998,7 @@ gitem_t itemlist[]= "Hive 2 Gem", // Pickup name (char *) GM_F_GEM, // pickup message GM_NEED_GEM, // can`t use message - NULL, // Pickup (f) + NULL, // Pickup (f) NULL, // Use (f) NULL, // Drop (f) NULL, // Think (f) @@ -1024,7 +1024,7 @@ gitem_t itemlist[]= "Minecart Wheel", // Pickup name (char *) GM_F_CARTWHEEL, // pickup message GM_NEED_CARTWHEEL, // can`t use message - NULL, // Pickup (f) + NULL, // Pickup (f) NULL, // Use (f) NULL, // Drop (f) NULL, // Think (f) @@ -1050,7 +1050,7 @@ gitem_t itemlist[]= "Ore", // Pickup name (char *) GM_F_UNREFORE, // pickup message GM_NEED_UNREFORE, // can`t use message - NULL, // Pickup (f) + NULL, // Pickup (f) NULL, // Use (f) NULL, // Drop (f) NULL, // Think (f) @@ -1076,7 +1076,7 @@ gitem_t itemlist[]= "Refined Ore", // Pickup name (char *) GM_F_REFORE, // pickup message GM_NEED_REFORE, // can`t use message - NULL, // Pickup (f) + NULL, // Pickup (f) NULL, // Use (f) NULL, // Drop (f) NULL, // Think (f) @@ -1102,7 +1102,7 @@ gitem_t itemlist[]= "Dungeon Key", // Pickup name (char *) GM_F_DUNGEONKEY, // pickup message GM_NEED_DUNGEONKEY, // can`t use message - NULL, // Pickup (f) + NULL, // Pickup (f) NULL, // Use (f) NULL, // Drop (f) NULL, // Think (f) @@ -1128,7 +1128,7 @@ gitem_t itemlist[]= "Cloud Key", // Pickup name (char *) GM_F_CLOUDKEY, // pickup message GM_NEED_CLOUDKEY, // can`t use message - NULL, // Pickup (f) + NULL, // Pickup (f) NULL, // Use (f) NULL, // Drop (f) NULL, // Think (f) @@ -1155,7 +1155,7 @@ gitem_t itemlist[]= "Key", // Pickup name (char *) GM_F_HIGHKEY, // pickup message GM_NEED_HIGHKEY, // can`t use message - NULL, // Pickup (f) + NULL, // Pickup (f) NULL, // Use (f) NULL, // Drop (f) NULL, // Think (f) @@ -1181,7 +1181,7 @@ gitem_t itemlist[]= "Symbol", // Pickup name (char *) GM_F_SYMBOL, // pickup message GM_NEED_SYMBOL, // can`t use message - NULL, // Pickup (f) + NULL, // Pickup (f) NULL, // Use (f) NULL, // Drop (f) NULL, // Think (f) @@ -1207,7 +1207,7 @@ gitem_t itemlist[]= "Tome", // Pickup name (char *) GM_F_TOME, // pickup message GM_NEED_TOME, // can`t use message - NULL, // Pickup (f) + NULL, // Pickup (f) NULL, // Use (f) NULL, // Drop (f) NULL, // Think (f) @@ -1232,7 +1232,7 @@ gitem_t itemlist[]= "Tavern Key", // Pickup name (char *) GM_F_TAVERNKEY, // pickup message GM_NEED_TAVERNKEY, // can`t use message - NULL, // Pickup (f) + NULL, // Pickup (f) NULL, // Use (f) NULL, // Drop (f) NULL, // Think (f) diff --git a/src/game/spell/meteorbarrier.c b/src/game/spell/meteorbarrier.c index 0ba471be7..14b83ac20 100644 --- a/src/game/spell/meteorbarrier.c +++ b/src/game/spell/meteorbarrier.c @@ -436,7 +436,7 @@ void SpellCastMeteorBarrier(edict_t *Caster,vec3_t StartPos,vec3_t AimAngles,vec Meteor->reflect_debounce_time = MAX_REFLECT; Meteor->health = I; Meteor->think = MeteorBarrierSearchInitThink; - Meteor->count = 0; + Meteor->count = 0; Meteor->random = 0; // Lifetime count Meteor->solid = SOLID_NOT; Meteor->owner = Caster; diff --git a/src/game/spell/morph.c b/src/game/spell/morph.c index 3dff03359..9f4976bc7 100644 --- a/src/game/spell/morph.c +++ b/src/game/spell/morph.c @@ -524,9 +524,9 @@ void MorphMissileTouch(edict_t *self, edict_t *other, cplane_t *plane, csurface_ // has the target got reflection turned on ? if(EntReflecting(other, true, true) && self->reflect_debounce_time) { - Create_rand_relect_vect(self->velocity, self->velocity); - Vec3ScaleAssign(ARROW_SPEED/2, self->velocity); - MorphReflect(self, other, self->velocity); + Create_rand_relect_vect(self->velocity, self->velocity); + Vec3ScaleAssign(ARROW_SPEED/2, self->velocity); + MorphReflect(self, other, self->velocity); return; } diff --git a/src/game/spell/ripper.c b/src/game/spell/ripper.c index 5d3d96f24..adea5b271 100644 --- a/src/game/spell/ripper.c +++ b/src/game/spell/ripper.c @@ -70,7 +70,7 @@ static void RipperExplodeBallThink(edict_t *self) // What the hell, let's spawn a big gush of blood in the travelling direction. VectorScale(self->movedir, RIPPER_EXPLODE_SPEED*0.25, vel); if(trace.ent->materialtype == MAT_INSECT) - gi.CreateEffect(NULL, FX_BLOOD, CEF_FLAG8, self->last_org, "ub", vel, (byte)20); + gi.CreateEffect(NULL, FX_BLOOD, CEF_FLAG8, self->last_org, "ub", vel, (byte)20); else gi.CreateEffect(NULL, FX_BLOOD, 0, self->last_org, "ub", vel, (byte)20); diff --git a/src/game/spell/sphereofannihlation.c b/src/game/spell/sphereofannihlation.c index a4206632a..8c832ef0a 100644 --- a/src/game/spell/sphereofannihlation.c +++ b/src/game/spell/sphereofannihlation.c @@ -79,7 +79,7 @@ static void SphereOfAnnihilationGrowThink(edict_t *Self) VectorCopy(Self->owner->s.origin, Self->s.origin); Self->s.origin[0] += Forward[0]*20.0; Self->s.origin[1] += Forward[1]*20.0; - Self->s.origin[2] += Self->owner->viewheight-5.0; + Self->s.origin[2] += Self->owner->viewheight-5.0; } Self->nextthink=level.time+0.1; @@ -123,7 +123,7 @@ static void SphereOfAnnihilationGrowThink(edict_t *Self) Self->touch=SphereOfAnnihilationTouch; Self->think=NULL; - VectorSet(Self->mins, -SPHERE_RADIUS, -SPHERE_RADIUS, -SPHERE_RADIUS); + VectorSet(Self->mins, -SPHERE_RADIUS, -SPHERE_RADIUS, -SPHERE_RADIUS); VectorSet(Self->maxs, SPHERE_RADIUS, SPHERE_RADIUS, SPHERE_RADIUS); Self->s.sound = 0; @@ -285,7 +285,7 @@ static void SphereOfAnnihilationGrowThinkPower(edict_t *Self) VectorCopy(Self->owner->s.origin, Self->s.origin); Self->s.origin[0] += Forward[0]*20.0; Self->s.origin[1] += Forward[1]*20.0; - Self->s.origin[2] += Self->owner->viewheight-5.0; + Self->s.origin[2] += Self->owner->viewheight-5.0; } Self->nextthink=level.time+0.1; @@ -397,7 +397,7 @@ void SphereExplodeThink(edict_t *self) { T_Damage(ent, self, self->owner, self->velocity, ent->s.origin, vec3_origin, self->dmg, 0, 0, MOD_SPHERE); ent->fire_timestamp = self->fire_timestamp; - gi.CreateEffect(&ent->s, FX_LIGHTNING_HIT, CEF_OWNERS_ORIGIN, NULL, "t", vec3_origin); + gi.CreateEffect(&ent->s, FX_LIGHTNING_HIT, CEF_OWNERS_ORIGIN, NULL, "t", vec3_origin); } } @@ -681,7 +681,7 @@ static void SphereWatcherGrowThink(edict_t *Self) Self->think=SphereWatcherFlyThink; Self->nextthink=level.time+0.1; - VectorSet(Self->mins, -SPHERE_RADIUS, -SPHERE_RADIUS, -SPHERE_RADIUS); + VectorSet(Self->mins, -SPHERE_RADIUS, -SPHERE_RADIUS, -SPHERE_RADIUS); VectorSet(Self->maxs, SPHERE_RADIUS, SPHERE_RADIUS, SPHERE_RADIUS); Self->s.sound = 0;