diff --git a/src/g_ai.c b/src/g_ai.c index 973ae01..151f299 100644 --- a/src/g_ai.c +++ b/src/g_ai.c @@ -396,7 +396,7 @@ void FoundTarget (edict_t *self) return; } - // set monster ideal_yaw to point to the combat point + // set monster ideal_yaw to point to the combat point VectorSubtract (self->goalentity->s.origin, self->s.origin, v); self->ideal_yaw = vectoyaw(v); @@ -452,12 +452,12 @@ qboolean FindTarget (edict_t *self) if (self->monsterinfo.aiflags & AI_COMBAT_POINT) return false; -// if the first spawnflag bit is set, the monster will only wake up on -// really seeing the player, not another monster getting angry or hearing -// something + // if the first spawnflag bit is set, the monster will only wake up on + // really seeing the player, not another monster getting angry or hearing + // something -// revised behavior so they will wake up if they "see" a player make a noise -// but not weapon impact/explosion noises + // revised behavior so they will wake up if they "see" a player make a noise + // but not weapon impact/explosion noises heardit = false; if ((level.sight_entity_framenum >= (level.framenum - 1)) && !(self->spawnflags & 1) ) @@ -519,8 +519,6 @@ qboolean FindTarget (edict_t *self) if (r == RANGE_FAR) return false; -// this is where we would check invisibility - // is client in an spot too dark to be seen? if (client->light_level <= 5) return false; @@ -597,9 +595,9 @@ qboolean FindTarget (edict_t *self) self->enemy = client; } -// -// got one -// + // + // got one + // FoundTarget (self); if (!(self->monsterinfo.aiflags & AI_SOUND_TARGET) && (self->monsterinfo.sight)) @@ -664,7 +662,7 @@ qboolean M_CheckAttack (edict_t *self) return true; } -// missile attack + // missile attack if (!self->monsterinfo.attack) return false; @@ -756,7 +754,7 @@ void ai_run_missile(edict_t *self) self->monsterinfo.attack (self); self->monsterinfo.attack_state = AS_STRAIGHT; } -}; +} /* @@ -824,7 +822,7 @@ qboolean ai_checkattack (edict_t *self, float dist) vec3_t temp; qboolean hesDeadJim; -// this causes monsters to run blindly to the combat point w/o firing + // this causes monsters to run blindly to the combat point w/o firing if (self->goalentity) { if (self->monsterinfo.aiflags & AI_COMBAT_POINT) @@ -834,11 +832,12 @@ qboolean ai_checkattack (edict_t *self, float dist) { if ((level.time - self->enemy->teleport_time) > 5.0) { - if (self->goalentity == self->enemy) + if (self->goalentity == self->enemy) { if (self->movetarget) self->goalentity = self->movetarget; else self->goalentity = NULL; + } self->monsterinfo.aiflags &= ~AI_SOUND_TARGET; if (self->monsterinfo.aiflags & AI_TEMP_STAND_GROUND) self->monsterinfo.aiflags &= ~(AI_STAND_GROUND | AI_TEMP_STAND_GROUND); @@ -853,7 +852,7 @@ qboolean ai_checkattack (edict_t *self, float dist) enemy_vis = false; -// see if the enemy is dead + // see if the enemy is dead hesDeadJim = false; if ((!self->enemy) || (!self->enemy->inuse)) { @@ -884,7 +883,7 @@ qboolean ai_checkattack (edict_t *self, float dist) if (hesDeadJim) { self->enemy = NULL; - // FIXME: look all around for other targets + // FIXME: look all around for other targets if (self->oldenemy && self->oldenemy->health > 0) { self->enemy = self->oldenemy; @@ -913,7 +912,7 @@ qboolean ai_checkattack (edict_t *self, float dist) self->show_hostile = level.time + 1; // wake up other monsters -// check knowledge of enemy + // check knowledge of enemy enemy_vis = visible(self, self->enemy); if (enemy_vis) { @@ -921,20 +920,12 @@ qboolean ai_checkattack (edict_t *self, float dist) VectorCopy (self->enemy->s.origin, self->monsterinfo.last_sighting); } -// look for other coop players here -// if (coop && self->monsterinfo.search_time < level.time) -// { -// if (FindTarget (self)) -// return true; -// } - enemy_infront = infront(self, self->enemy); enemy_range = range(self, self->enemy); VectorSubtract (self->enemy->s.origin, self->s.origin, temp); enemy_yaw = vectoyaw(temp); - // JDC self->ideal_yaw = enemy_yaw; if (self->monsterinfo.attack_state == AS_MISSILE) { ai_run_missile (self); @@ -945,7 +936,7 @@ qboolean ai_checkattack (edict_t *self, float dist) ai_run_melee (self); return true; } - + // if enemy is not currently visible, we will never attack if (!enemy_vis) return false; @@ -1005,14 +996,8 @@ void ai_run (edict_t *self, float dist) if (self->monsterinfo.attack_state == AS_FLY_STRAFE) { - if (self->monsterinfo.flyStrafeTimeout < level.time) - self->monsterinfo.attack_state == AS_STRAIGHT; - else - { - ai_fly_strafe(self, dist); - //if (random() < 0.5) - return; - } + ai_fly_strafe(self, dist); + return; } if (ai_checkattack (self, dist)) @@ -1026,8 +1011,6 @@ void ai_run (edict_t *self, float dist) if (enemy_vis) { -// if (self.aiflags & AI_LOST_SIGHT) -// dprint("regained sight\n"); M_MoveToGoal (self, dist); self->monsterinfo.aiflags &= ~AI_LOST_SIGHT; VectorCopy (self->enemy->s.origin, self->monsterinfo.last_sighting); @@ -1035,18 +1018,10 @@ void ai_run (edict_t *self, float dist) return; } - // coop will change to another enemy if visible - if (coop->value) - { // FIXME: insane guys get mad with this, which causes crashes! - if (FindTarget (self)) - return; - } - if ((self->monsterinfo.search_time) && (level.time > (self->monsterinfo.search_time + 20))) { M_MoveToGoal (self, dist); self->monsterinfo.search_time = 0; -// dprint("search timeout\n"); return; } @@ -1059,7 +1034,6 @@ void ai_run (edict_t *self, float dist) if (!(self->monsterinfo.aiflags & AI_LOST_SIGHT)) { // just lost sight of the player, decide where to go first -// dprint("lost sight of player, last seen at "); dprint(vtos(self.last_sighting)); dprint("\n"); self->monsterinfo.aiflags |= (AI_LOST_SIGHT | AI_PURSUIT_LAST_SEEN); self->monsterinfo.aiflags &= ~(AI_PURSUE_NEXT | AI_PURSUE_TEMP); new = true; @@ -1068,14 +1042,12 @@ void ai_run (edict_t *self, float dist) if (self->monsterinfo.aiflags & AI_PURSUE_NEXT) { self->monsterinfo.aiflags &= ~AI_PURSUE_NEXT; -// dprint("reached current goal: "); dprint(vtos(self.origin)); dprint(" "); dprint(vtos(self.last_sighting)); dprint(" "); dprint(ftos(vlen(self.origin - self.last_sighting))); dprint("\n"); // give ourself more time since we got this far self->monsterinfo.search_time = level.time + 5; if (self->monsterinfo.aiflags & AI_PURSUE_TEMP) { -// dprint("was temp goal; retrying original\n"); self->monsterinfo.aiflags &= ~AI_PURSUE_TEMP; marker = NULL; VectorCopy (self->monsterinfo.saved_goal, self->monsterinfo.last_sighting); @@ -1096,9 +1068,6 @@ void ai_run (edict_t *self, float dist) VectorCopy (marker->s.origin, self->monsterinfo.last_sighting); self->monsterinfo.trail_time = marker->timestamp; self->s.angles[YAW] = self->ideal_yaw = marker->s.angles[YAW]; -// dprint("heading is "); dprint(ftos(self.ideal_yaw)); dprint("\n"); - -// debug_drawline(self.origin, self.last_sighting, 52); new = true; } } @@ -1115,8 +1084,6 @@ void ai_run (edict_t *self, float dist) if (new) { -// gi.dprintf("checking for course correction\n"); - tr = gi.trace(self->s.origin, self->mins, self->maxs, self->monsterinfo.last_sighting, self, MASK_PLAYERSOLID); if (tr.fraction < 1) { @@ -1144,7 +1111,6 @@ void ai_run (edict_t *self, float dist) { VectorSet(v, d2 * left * 0.5, -16, 0); G_ProjectSource (self->s.origin, v, v_forward, v_right, left_target); -// gi.dprintf("incomplete path, go part way and adjust again\n"); } VectorCopy (self->monsterinfo.last_sighting, self->monsterinfo.saved_goal); self->monsterinfo.aiflags |= AI_PURSUE_TEMP; @@ -1152,8 +1118,6 @@ void ai_run (edict_t *self, float dist) VectorCopy (left_target, self->monsterinfo.last_sighting); VectorSubtract (self->goalentity->s.origin, self->s.origin, v); self->s.angles[YAW] = self->ideal_yaw = vectoyaw(v); -// gi.dprintf("adjusted left\n"); -// debug_drawline(self.origin, self.last_sighting, 152); } else if (right >= center && right > left) { @@ -1161,7 +1125,6 @@ void ai_run (edict_t *self, float dist) { VectorSet(v, d2 * right * 0.5, 16, 0); G_ProjectSource (self->s.origin, v, v_forward, v_right, right_target); -// gi.dprintf("incomplete path, go part way and adjust again\n"); } VectorCopy (self->monsterinfo.last_sighting, self->monsterinfo.saved_goal); self->monsterinfo.aiflags |= AI_PURSUE_TEMP; @@ -1169,11 +1132,8 @@ void ai_run (edict_t *self, float dist) VectorCopy (right_target, self->monsterinfo.last_sighting); VectorSubtract (self->goalentity->s.origin, self->s.origin, v); self->s.angles[YAW] = self->ideal_yaw = vectoyaw(v); -// gi.dprintf("adjusted right\n"); -// debug_drawline(self.origin, self.last_sighting, 152); } } -// else gi.dprintf("course was fine\n"); } M_MoveToGoal (self, dist); @@ -1183,3 +1143,4 @@ void ai_run (edict_t *self, float dist) if (self) self->goalentity = save; } + diff --git a/src/g_cmds.c b/src/g_cmds.c index 8a58fe6..cf1b15e 100644 --- a/src/g_cmds.c +++ b/src/g_cmds.c @@ -1,6 +1,7 @@ #include "g_local.h" #include "m_player.h" + char *ClientTeam (edict_t *ent) { char *p; @@ -22,7 +23,6 @@ char *ClientTeam (edict_t *ent) return value; } - // if ((int)(dmflags->value) & DF_SKINTEAMS) return ++p; } @@ -314,7 +314,7 @@ void Cmd_God_f (edict_t *ent) { char *msg; - if (deathmatch->value && !sv_cheats->value) + if ((deathmatch->value || coop->value) && !sv_cheats->value) { gi.cprintf (ent, PRINT_HIGH, "You must run the server with '+set cheats 1' to enable this command.\n"); return; @@ -343,7 +343,7 @@ void Cmd_Notarget_f (edict_t *ent) { char *msg; - if (deathmatch->value && !sv_cheats->value) + if ((deathmatch->value || coop->value) && !sv_cheats->value) { gi.cprintf (ent, PRINT_HIGH, "You must run the server with '+set cheats 1' to enable this command.\n"); return; @@ -370,7 +370,7 @@ void Cmd_Noclip_f (edict_t *ent) { char *msg; - if (deathmatch->value && !sv_cheats->value) + if ((deathmatch->value || coop->value) && !sv_cheats->value) { gi.cprintf (ent, PRINT_HIGH, "You must run the server with '+set cheats 1' to enable this command.\n"); return; @@ -398,16 +398,16 @@ struct altsel_s } alternates[] = { {0}, // filler - {2,"Blaster", "Flare Gun"}, - {1,"Shotgun"}, - {1,"Super Shotgun"}, - {1,"Machinegun"}, - {1,"Chaingun"}, - {1,"Grenade Launcher"}, - {1,"Rocket Launcher"}, - {1,"HyperBlaster"}, - {2,"Railgun", "Sniper Rifle"}, - {2,"BFG10K", "Sonic Cannon"} + {2,{"Blaster", "Flare Gun"}}, + {1,{"Shotgun"}}, + {1,{"Super Shotgun"}}, + {1,{"Machinegun"}}, + {1,{"Chaingun"}}, + {1,{"Grenade Launcher"}}, + {1,{"Rocket Launcher"}}, + {1,{"HyperBlaster"}}, + {2,{"Railgun", "Sniper Rifle"}}, + {2,{"BFG10K", "Sonic Cannon"}} }; qboolean tryUse(edict_t *ent, char *s) @@ -455,7 +455,6 @@ void findNext(edict_t *ent, struct altsel_s *ptr, int offset) void altSelect(edict_t *ent, int num) { - int index = 0; int offset = -1; int i = 0; struct altsel_s *ptr = NULL; @@ -485,7 +484,7 @@ void altSelect(edict_t *ent, int num) offset = 0; else { - offset = ((++offset) % ptr->num); + offset = ((offset + 1) % (ptr->num)); } // now select this offset @@ -539,8 +538,6 @@ void Cmd_Use_f (edict_t *ent) } - - /* ================== Cmd_Drop_f @@ -556,7 +553,6 @@ void Cmd_Drop_f (edict_t *ent) s = gi.args(); it = FindItem (s); - if (!it) { gi.cprintf (ent, PRINT_HIGH, "unknown item: %s\n", s); @@ -587,7 +583,7 @@ void Cmd_Inven_f (edict_t *ent) { int i; gclient_t *cl; - + cl = ent->client; cl->showscores = false; @@ -665,7 +661,6 @@ void Cmd_WeapPrev_f (edict_t *ent) for (i=1 ; i<=MAX_ITEMS ; i++) { index = (selected_weapon + MAX_ITEMS - i)%MAX_ITEMS; -// index = (selected_weapon + i)%MAX_ITEMS; if (!cl->pers.inventory[index]) continue; it = &itemlist[index]; @@ -676,7 +671,6 @@ void Cmd_WeapPrev_f (edict_t *ent) if (! (it->flags & IT_WEAPON) ) continue; it->use (ent, it); -// if (cl->pers.weapon == it) if (cl->newweapon == it) return; // successful } @@ -693,7 +687,7 @@ void Cmd_WeapNext_f (edict_t *ent) int i, index; gitem_t *it; int selected_weapon; - + cl = ent->client; if (!cl->pers.weapon) @@ -705,7 +699,6 @@ void Cmd_WeapNext_f (edict_t *ent) for (i=1 ; i<=MAX_ITEMS ; i++) { index = (selected_weapon + i)%MAX_ITEMS; -// index = (selected_weapon + MAX_ITEMS - i)%MAX_ITEMS; if (!cl->pers.inventory[index]) continue; it = &itemlist[index]; @@ -716,7 +709,6 @@ void Cmd_WeapNext_f (edict_t *ent) if (! (it->flags & IT_WEAPON) ) continue; it->use (ent, it); -// if (cl->pers.weapon == it) if (cl->newweapon == it) return; // successful } @@ -1050,7 +1042,7 @@ void ClientCommand (edict_t *ent) Cmd_Help_f (ent); return; } - + if (level.intermissiontime) return; @@ -1128,3 +1120,4 @@ void ClientCommand (edict_t *ent) else // anything that doesn't match a command will be a chat Cmd_Say_f (ent, false, true); } + diff --git a/src/g_combat.c b/src/g_combat.c index d0324aa..6e54501 100644 --- a/src/g_combat.c +++ b/src/g_combat.c @@ -15,7 +15,7 @@ qboolean CanDamage (edict_t *targ, edict_t *inflictor) vec3_t dest; trace_t trace; -// bmodels need special checking because their origin is 0,0,0 + // bmodels need special checking because their origin is 0,0,0 if (targ->movetype == MOVETYPE_PUSH) { VectorAdd (targ->absmin, targ->absmax, dest); @@ -79,11 +79,9 @@ void Killed (edict_t *targ, edict_t *inflictor, edict_t *attacker, int damage, v if ((targ->svflags & SVF_MONSTER) && (targ->deadflag != DEAD_DEAD)) { -// targ->svflags |= SVF_DEADMONSTER; // now treat as a different content type if (!(targ->monsterinfo.aiflags & AI_GOOD_GUY) && !(targ->spawnflags & 16)) { level.killed_monsters++; - if (coop->value && attacker->client) attacker->client->resp.score++; // medics won't heal monsters that they kill themselves @@ -119,7 +117,6 @@ void SpawnDamage (int type, vec3_t origin, vec3_t normal, int damage) damage = 255; gi.WriteByte (svc_temp_entity); gi.WriteByte (type); -// gi.WriteByte (damage); gi.WritePosition (origin); gi.WriteDir (normal); gi.multicast (origin, MULTICAST_PVS); @@ -142,11 +139,11 @@ damage amount of damage being inflicted knockback force to be applied against targ as a result of the damage dflags these flags are used to control how T_Damage works - DAMAGE_RADIUS damage was indirect (from a nearby explosion) - DAMAGE_NO_ARMOR armor does not protect from this damage - DAMAGE_ENERGY damage is from an energy based weapon + DAMAGE_RADIUS damage was indirect (from a nearby explosion) + DAMAGE_NO_ARMOR armor does not protect from this damage + DAMAGE_ENERGY damage is from an energy based weapon DAMAGE_NO_KNOCKBACK do not affect velocity, just view angles - DAMAGE_BULLET damage is from a bullet (used for ricochets) + DAMAGE_BULLET damage is from a bullet (used for ricochets) DAMAGE_NO_PROTECTION kills godmode, armor, everything DAMAGE_ARMORMOSTLY reduces the armor more than the health ============ @@ -156,7 +153,7 @@ static int CheckPowerArmor (edict_t *ent, vec3_t point, vec3_t normal, int damag gclient_t *client; int save; int power_armor_type; - int index; + int index = 0; int damagePerCell; int pa_te_type; int power; @@ -255,7 +252,7 @@ static int CheckPowerArmor (edict_t *ent, vec3_t point, vec3_t normal, int damag if (client) client->pers.inventory[index] -= power_used; - else if (ent->svflags & SVF_MONSTER) + else ent->monsterinfo.power_armor_power -= power_used; return save; } @@ -355,19 +352,17 @@ void M_ReactToDamage (edict_t *targ, edict_t *attacker) (strcmp(attacker->classname, "monster_jorg") != 0) && (!(attacker->mteam && targ->mteam && strcmp(attacker->mteam, targ->mteam) == 0))) { - if (targ->enemy) - if (targ->enemy->client) - targ->oldenemy = targ->enemy; + if (targ->enemy && targ->enemy->client) + targ->oldenemy = targ->enemy; targ->enemy = attacker; if (!(targ->monsterinfo.aiflags & AI_DUCKED)) FoundTarget (targ); } - else if(attacker->enemy) - // otherwise get mad at whoever they are mad at (help our buddy) + // otherwise get mad at whoever they are mad at (help our buddy) unless it is us! + else if (attacker->enemy && attacker->enemy != targ) { - if (targ->enemy) - if (targ->enemy->client) - targ->oldenemy = targ->enemy; + if (targ->enemy && targ->enemy->client) + targ->oldenemy = targ->enemy; targ->enemy = attacker->enemy; if (!(targ->monsterinfo.aiflags & AI_DUCKED)) FoundTarget (targ); @@ -433,14 +428,14 @@ void T_Damage (edict_t *targ, edict_t *inflictor, edict_t *attacker, vec3_t dir, VectorNormalize(dir); -// bonus damage for suprising a monster + // bonus damage for suprising a monster if (!(dflags & DAMAGE_RADIUS) && (targ->svflags & SVF_MONSTER) && (attacker->client) && (!targ->enemy) && (targ->health > 0)) damage *= 2; if (targ->flags & FL_NO_KNOCKBACK) knockback = 0; -// knockback code moved foreward to take into account for DAMAGE_ARMORMOSTLY now + // knockback code moved foreward to take into account for DAMAGE_ARMORMOSTLY now take = damage; save = 0; @@ -486,7 +481,7 @@ void T_Damage (edict_t *targ, edict_t *inflictor, edict_t *attacker, vec3_t dir, //treat cheat/powerup savings the same as armor asave += save; -// figure momentum add + // figure momentum add if (!(dflags & DAMAGE_NO_KNOCKBACK)) { if ((knockback) && (targ->movetype != MOVETYPE_NONE) && (targ->movetype != MOVETYPE_BOUNCE) && (targ->movetype != MOVETYPE_BOUNCEFLY) && (targ->movetype != MOVETYPE_PUSH) && (targ->movetype != MOVETYPE_STOP)) @@ -494,10 +489,10 @@ void T_Damage (edict_t *targ, edict_t *inflictor, edict_t *attacker, vec3_t dir, vec3_t kvel; float mass; - if((dflags & DAMAGE_ARMORMOSTLY) && damage > take) - { - knockback = (int)((float)knockback * (((float)(damage - take) / (float)damage) + 1.0)); - } + if((dflags & DAMAGE_ARMORMOSTLY) && damage > take) + { + knockback = (int)((float)knockback * (((float)(damage - take) / (float)damage) + 1.0)); + } if (targ->mass < 50) mass = 50; @@ -517,7 +512,7 @@ void T_Damage (edict_t *targ, edict_t *inflictor, edict_t *attacker, vec3_t dir, if (!(dflags & DAMAGE_NO_PROTECTION) && CheckTeamDamage (targ, attacker)) return; -// do the damage + // do the damage if (take) { if ((targ->svflags & SVF_MONSTER) || (client)) @@ -526,10 +521,8 @@ void T_Damage (edict_t *targ, edict_t *inflictor, edict_t *attacker, vec3_t dir, SpawnDamage (te_sparks, point, normal, take); - if (targ->takedamage != DAMAGE_IMMORTAL) - targ->health = targ->health - take; - - // kill the entity + targ->health = targ->health - take; + if (targ->health <= 0) { if ((targ->svflags & SVF_MONSTER) || (client)) @@ -647,3 +640,4 @@ void T_RadiusDamagePosition (vec3_t origin, edict_t *inflictor, edict_t *attacke } } } + diff --git a/src/g_func.c b/src/g_func.c index 7446513..3375e0b 100644 --- a/src/g_func.c +++ b/src/g_func.c @@ -146,8 +146,6 @@ void Move_Calc (edict_t *ent, vec3_t dest, void(*func)(edict_t*), int smoothSpee } // smooth speed change -// ent->think = Think_SmoothAccelMove; -// ent->nextthink = level.time + FRAMETIME; Think_SmoothAccelMove(ent); } else if (ent->moveinfo.speed == ent->moveinfo.accel && ent->moveinfo.speed == ent->moveinfo.decel) @@ -291,7 +289,7 @@ void plat_CalcAcceleratedMove(moveinfo_t *moveinfo) } moveinfo->decel_distance = decel_dist; -}; +} void plat_Accelerate (moveinfo_t *moveinfo) { @@ -362,7 +360,7 @@ void plat_Accelerate (moveinfo_t *moveinfo) // we are at constant velocity (move_speed) return; -}; +} void Think_AccelMove (edict_t *ent) { @@ -430,8 +428,6 @@ void Think_SmoothAccelMove (edict_t *ent) ent->think = Think_SmoothAccelMove; } - - void plat_go_down (edict_t *ent); void plat_hit_top (edict_t *ent) @@ -514,7 +510,6 @@ void Use_Plat (edict_t *ent, edict_t *other, edict_t *activator) void Touch_Plat_Center (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf) { - edict_t *trigger = ent; if (!other->client) return; @@ -541,9 +536,9 @@ void plat_spawn_inside_trigger (edict_t *ent) edict_t *trigger; vec3_t tmin, tmax; -// -// middle trigger -// + // + // middle trigger + // trigger = G_Spawn(); trigger->touch = Touch_Plat_Center; trigger->movetype = MOVETYPE_NONE; @@ -794,8 +789,6 @@ void SP_func_rotating (edict_t *ent) if (!ent->dmg) ent->dmg = 2; -// ent->moveinfo.sound_middle = "doors/hydro1.wav"; - ent->use = rotating_use; if (ent->dmg) ent->blocked = rotating_blocked; @@ -1247,7 +1240,7 @@ void Think_SpawnDoorTrigger (edict_t *ent) VectorCopy (mins, other->mins); VectorCopy (maxs, other->maxs); other->owner = ent; - other->spawnflags2 = ent->spawnflags2 & SPAWNFLAG2_MIRRORLEVEL; + other->spawnflags2 = ent->spawnflags2 & SPAWNFLAG2_MIRRORLEVEL; other->solid = SOLID_TRIGGER; other->movetype = MOVETYPE_NONE; other->touch = Touch_DoorTrigger; @@ -1280,8 +1273,8 @@ void door_blocked (edict_t *self, edict_t *other) return; -// if a door has a negative wait, it would never come back if blocked, -// so let it just squash the object to death real fast + // if a door has a negative wait, it would never come back if blocked, + // so let it just squash the object to death real fast if (self->moveinfo.wait >= 0) { if (self->moveinfo.state == STATE_DOWN) @@ -1495,8 +1488,6 @@ void SP_func_door_rotating (edict_t *ent) if (!ent->wait) ent->wait = 3; - //if (!ent->dmg) - // ent->dmg = 2; if (ent->sounds != 1) { @@ -1734,7 +1725,6 @@ void train_next (edict_t *self) again: if (!self->target) { -// gi.dprintf ("train_next: no next target\n"); return; } diff --git a/src/g_items.c b/src/g_items.c index dc82ce0..e0bb192 100644 --- a/src/g_items.c +++ b/src/g_items.c @@ -46,16 +46,6 @@ void Action_Push(edict_t *ent); void Use_PlasmaShield (edict_t *ent, gitem_t *item); -#if defined(_DEBUG) && defined(_Z_TESTMODE) - -void Weapon_LineDraw (edict_t *ent); -void Weapon_Test (edict_t *ent); - -qboolean Pickup_TestItem (edict_t *ent, edict_t *other); -void Drop_TestItem (edict_t *ent, gitem_t *item); - -#endif - //====================================================================== /* @@ -435,8 +425,6 @@ void Use_Breather (edict_t *ent, gitem_t *item) ent->client->breather_framenum += 300; else ent->client->breather_framenum = level.framenum + 300; - -// gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0); } //====================================================================== @@ -450,8 +438,6 @@ void Use_Envirosuit (edict_t *ent, gitem_t *item) ent->client->enviro_framenum += 300; else ent->client->enviro_framenum = level.framenum + 300; - -// gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0); } //====================================================================== @@ -476,8 +462,6 @@ void Use_Silencer (edict_t *ent, gitem_t *item) ent->client->pers.inventory[ITEM_INDEX(item)]--; ValidateSelectedItem (ent); ent->client->silencer_shots += 30; - -// gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0); } //====================================================================== @@ -527,7 +511,6 @@ qboolean Add_Ammo (edict_t *ent, gitem_t *item, int count) max = ent->client->pers.max_cells; else if (item->tag == AMMO_SLUGS) max = ent->client->pers.max_slugs; -// [evolve else if (item->tag == AMMO_LASERTRIPBOMB) max = ent->client->pers.max_tbombs; else if (item->tag == AMMO_FLARES) @@ -538,7 +521,6 @@ qboolean Add_Ammo (edict_t *ent, gitem_t *item, int count) max = ent->client->pers.max_a2k; else if (item->tag == AMMO_PLASMASHIELD) max = ent->client->pers.max_plasmashield; -// evolve] else return false; @@ -571,15 +553,15 @@ qboolean Pickup_Ammo (edict_t *ent, edict_t *other) oldcount = other->client->pers.inventory[ITEM_INDEX(ent->item)]; - if(ent->spawnflags & 0x08) - { - if(oldcount >= count) - { - return false; - } + if(ent->spawnflags & 0x08) + { + if(oldcount >= count) + { + return false; + } - count -= oldcount; - } + count -= oldcount; + } if (!Add_Ammo (other, ent->item, count)) return false; @@ -973,7 +955,7 @@ void Touch_Item (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf //====================================================================== -void drop_temp_touch (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf) +static void drop_temp_touch (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf) { if (other == ent->owner) return; @@ -981,7 +963,7 @@ void drop_temp_touch (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t Touch_Item (ent, other, plane, surf); } -void drop_make_touchable (edict_t *ent) +static void drop_make_touchable (edict_t *ent) { ent->touch = Touch_Item; if (deathmatch->value) @@ -1288,7 +1270,7 @@ gitem_t itemlist[] = NULL }, // leave index 0 alone - // + // // ARMOR // @@ -1495,7 +1477,7 @@ always owned, never in the world NULL, 0, /* precache */ "weapons/blastf1a.wav misc/lasfly.wav" - }, + }, /*QUAKED weapon_shotgun (.3 .3 1) (-16 -16 -16) (16 16 16) */ @@ -1539,7 +1521,7 @@ always owned, never in the world NULL, 0, /* precache */ "weapons/sshotf1b.wav" - }, + }, /*QUAKED weapon_machinegun (.3 .3 1) (-16 -16 -16) (16 16 16) */ @@ -1600,7 +1582,6 @@ always owned, never in the world /* pickup */ "Grenades", /* width */ 3, 5, -// "grenades", "Grenades", IT_AMMO|IT_WEAPON, NULL, @@ -1984,8 +1965,6 @@ always owned, never in the world /* precache */ "items/empnuke/emp_trg.wav" //items/empnuke/emp_act.wav items/empnuke/emp_spin.wav items/empnuke/emp_idle.wav }, -// EVOLVE] - // // POWERUP ITEMS // @@ -2233,7 +2212,7 @@ gives +1 to maximum health NULL, 0, /* precache */ "" - }, + }, // // KEYS @@ -2602,80 +2581,6 @@ security pass for the security level /* precache */ "" }, -#if defined(_DEBUG) && defined(_Z_TESTMODE) - -/* weapon_ldraw (.3 .3 1) (-16 -16 -16) (16 16 16) -always owned, never in the world -*/ - { - "weapon_linedraw", - NULL, - Use_Weapon, - NULL, - Weapon_LineDraw, - "misc/w_pkup.wav", - NULL, 0, - "models/weapons/v_blast/tris.md2", -/* icon */ "w_blaster", -/* pickup */ "Line Draw", - 0, - 0, - NULL, - IT_WEAPON, - NULL, - 0, -/* precache */ "weapons/blastf1a.wav misc/lasfly.wav" - }, - - -/* weapon_testweapon (.3 .3 1) (-16 -16 -16) (16 16 16) -loaded from weapon.cfg -*/ - { - "weapon_test", - Pickup_Weapon, - Use_Weapon, - Drop_Weapon, - Weapon_Test, - "misc/w_pkup.wav", - "models/weapons/v_blast/tris.md2", EF_ROTATE, - "models/weapons/v_blast/tris.md2", -/* icon */ "w_blaster", -/* pickup */ "Test", - 0, - 0, - "Shells", - IT_WEAPON, - NULL, - 0, -/* precache */ "weapons/blastf1a.wav misc/lasfly.wav" - }, - - -/* weapon_testitem (.3 .3 1) (-16 -16 -16) (16 16 16) -loaded from item.cfg -*/ - { - "item_test", - Pickup_TestItem, - NULL, - Drop_TestItem, - NULL, - "misc/w_pkup.wav", - "models/weapons/v_blast/tris.md2", 0, - "models/weapons/v_blast/tris.md2", -/* icon */ "w_blaster", -/* pickup */ "Test", - 0, - 0, - NULL, - 0, - NULL, - 0, -/* precache */ "weapons/blastf1a.wav misc/lasfly.wav" - }, -#endif - // end of list marker {NULL} }; @@ -2779,3 +2684,4 @@ void SetItemNames (void) power_screen_index = ITEM_INDEX(FindItem("Power Screen")); power_shield_index = ITEM_INDEX(FindItem("Power Shield")); } + diff --git a/src/g_local.h b/src/g_local.h index 8f8ab32..3a931e0 100644 --- a/src/g_local.h +++ b/src/g_local.h @@ -1,6 +1,7 @@ // g_local.h -- local definitions for game module #include "q_shared.h" +#include "z_anim.h" // define GAME_INCLUDE so that game.h does not define the // short, server-visible gclient_t and edict_t structures, @@ -24,9 +25,6 @@ // Zaero includes #include "z_debug.h" -#ifdef CACHE_SOUND -#include "z_list.h" -#endif // the "gamename" client command will print this plus compile date #define GAMEVERSION "Zaero 1.1" @@ -123,51 +121,51 @@ typedef enum //deadflag -#define DEAD_NO 0 +#define DEAD_NO 0 #define DEAD_DYING 1 -#define DEAD_DEAD 2 -#define DEAD_RESPAWNABLE 3 +#define DEAD_DEAD 2 +#define DEAD_RESPAWNABLE 3 //range #define RANGE_MELEE 0 #define RANGE_NEAR 1 -#define RANGE_MID 2 -#define RANGE_FAR 3 +#define RANGE_MID 2 +#define RANGE_FAR 3 //gib types #define GIB_ORGANIC 0 #define GIB_METALLIC 1 //monster ai flags -#define AI_STAND_GROUND 0x00000001 -#define AI_TEMP_STAND_GROUND 0x00000002 -#define AI_SOUND_TARGET 0x00000004 -#define AI_LOST_SIGHT 0x00000008 -#define AI_PURSUIT_LAST_SEEN 0x00000010 -#define AI_PURSUE_NEXT 0x00000020 -#define AI_PURSUE_TEMP 0x00000040 -#define AI_HOLD_FRAME 0x00000080 -#define AI_GOOD_GUY 0x00000100 -#define AI_BRUTAL 0x00000200 -#define AI_NOSTEP 0x00000400 -#define AI_DUCKED 0x00000800 -#define AI_COMBAT_POINT 0x00001000 -#define AI_MEDIC 0x00002000 -#define AI_RESURRECTING 0x00004000 -#define AI_SCHOOLING 0x00008000 -#define AI_REDUCEDDAMAGE 0x00010000 -#define AI_SCHOOLINGTURNING 0x00020000 +#define AI_STAND_GROUND 0x00000001 +#define AI_TEMP_STAND_GROUND 0x00000002 +#define AI_SOUND_TARGET 0x00000004 +#define AI_LOST_SIGHT 0x00000008 +#define AI_PURSUIT_LAST_SEEN 0x00000010 +#define AI_PURSUE_NEXT 0x00000020 +#define AI_PURSUE_TEMP 0x00000040 +#define AI_HOLD_FRAME 0x00000080 +#define AI_GOOD_GUY 0x00000100 +#define AI_BRUTAL 0x00000200 +#define AI_NOSTEP 0x00000400 +#define AI_DUCKED 0x00000800 +#define AI_COMBAT_POINT 0x00001000 +#define AI_MEDIC 0x00002000 +#define AI_RESURRECTING 0x00004000 +#define AI_SCHOOLING 0x00008000 +#define AI_REDUCEDDAMAGE 0x00010000 +#define AI_SCHOOLINGTURNING 0x00020000 #define AI_SCHOOLINGTURNINGFAST 0x00040000 -#define AI_DODGETIMEOUT 0x00080000 -#define AI_JUMPING 0x00100000 -#define AI_MONREDUCEDDAMAGE 0x00200000 -#define AI_ONESHOTTARGET 0x00400000 +#define AI_DODGETIMEOUT 0x00080000 +#define AI_JUMPING 0x00100000 +#define AI_MONREDUCEDDAMAGE 0x00200000 +#define AI_ONESHOTTARGET 0x00400000 //monster attack state #define AS_STRAIGHT 1 #define AS_SLIDING 2 -#define AS_MELEE 3 +#define AS_MELEE 3 #define AS_MISSILE 4 #define AS_FLY_STRAFE 5 @@ -480,12 +478,12 @@ typedef struct float flyStrafePitch; float flyStrafeTimeout; - //schooling info - float zSchoolSightRadius; - float zSchoolMaxSpeed, zSchoolMinSpeed; - float zSpeedStandMax, zSpeedWalkMax; - float zSchoolDecayRate, zSchoolMinimumDistance; - int zSchoolFlags; + //schooling info + float zSchoolSightRadius; + float zSchoolMaxSpeed, zSchoolMinSpeed; + float zSpeedStandMax, zSpeedWalkMax; + float zSchoolDecayRate, zSchoolMinimumDistance; + int zSchoolFlags; float reducedDamageAmount; @@ -511,47 +509,47 @@ extern int body_armor_index; // means of death -#define MOD_UNKNOWN 0 -#define MOD_BLASTER 1 -#define MOD_SHOTGUN 2 -#define MOD_SSHOTGUN 3 -#define MOD_MACHINEGUN 4 -#define MOD_CHAINGUN 5 -#define MOD_GRENADE 6 -#define MOD_G_SPLASH 7 -#define MOD_ROCKET 8 -#define MOD_R_SPLASH 9 -#define MOD_HYPERBLASTER 10 -#define MOD_RAILGUN 11 -#define MOD_BFG_LASER 12 -#define MOD_BFG_BLAST 13 -#define MOD_BFG_EFFECT 14 -#define MOD_HANDGRENADE 15 -#define MOD_HG_SPLASH 16 -#define MOD_WATER 17 -#define MOD_SLIME 18 -#define MOD_LAVA 19 -#define MOD_CRUSH 20 -#define MOD_TELEFRAG 21 -#define MOD_FALLING 22 -#define MOD_SUICIDE 23 -#define MOD_HELD_GRENADE 24 -#define MOD_EXPLOSIVE 25 -#define MOD_BARREL 26 -#define MOD_BOMB 27 -#define MOD_EXIT 28 -#define MOD_SPLASH 29 -#define MOD_TARGET_LASER 30 -#define MOD_TRIGGER_HURT 31 -#define MOD_HIT 32 +#define MOD_UNKNOWN 0 +#define MOD_BLASTER 1 +#define MOD_SHOTGUN 2 +#define MOD_SSHOTGUN 3 +#define MOD_MACHINEGUN 4 +#define MOD_CHAINGUN 5 +#define MOD_GRENADE 6 +#define MOD_G_SPLASH 7 +#define MOD_ROCKET 8 +#define MOD_R_SPLASH 9 +#define MOD_HYPERBLASTER 10 +#define MOD_RAILGUN 11 +#define MOD_BFG_LASER 12 +#define MOD_BFG_BLAST 13 +#define MOD_BFG_EFFECT 14 +#define MOD_HANDGRENADE 15 +#define MOD_HG_SPLASH 16 +#define MOD_WATER 17 +#define MOD_SLIME 18 +#define MOD_LAVA 19 +#define MOD_CRUSH 20 +#define MOD_TELEFRAG 21 +#define MOD_FALLING 22 +#define MOD_SUICIDE 23 +#define MOD_HELD_GRENADE 24 +#define MOD_EXPLOSIVE 25 +#define MOD_BARREL 26 +#define MOD_BOMB 27 +#define MOD_EXIT 28 +#define MOD_SPLASH 29 +#define MOD_TARGET_LASER 30 +#define MOD_TRIGGER_HURT 31 +#define MOD_HIT 32 #define MOD_TARGET_BLASTER 33 -#define MOD_SNIPERRIFLE 34 -#define MOD_TRIPBOMB 35 -#define MOD_FLARE 36 -#define MOD_A2K 37 +#define MOD_SNIPERRIFLE 34 +#define MOD_TRIPBOMB 35 +#define MOD_FLARE 36 +#define MOD_A2K 37 #define MOD_SONICCANNON 38 #define MOD_AUTOCANNON 39 -#define MOD_GL_POLYBLEND 40 +#define MOD_GL_POLYBLEND 40 #define MOD_FRIENDLY_FIRE 0x8000000 extern int meansOfDeath; @@ -600,9 +598,6 @@ extern cvar_t *gamedir; extern cvar_t *grenadeammotype; extern cvar_t *grenadeammo; extern cvar_t *bettyammo; -#ifdef CACHE_SOUND -extern cvar_t *printSoundRejects; -#endif #define world (&g_edicts[0]) @@ -714,11 +709,11 @@ void T_RadiusDamage (edict_t *inflictor, edict_t *attacker, float damage, edict_ void T_RadiusDamagePosition (vec3_t origin, edict_t *inflictor, edict_t *attacker, float damage, edict_t *ignore, float radius, int mod); // damage flags -#define DAMAGE_RADIUS 0x00000001 // damage was indirect -#define DAMAGE_NO_ARMOR 0x00000002 // armour does not protect from this damage -#define DAMAGE_ENERGY 0x00000004 // damage is from an energy based weapon +#define DAMAGE_RADIUS 0x00000001 // damage was indirect +#define DAMAGE_NO_ARMOR 0x00000002 // armour does not protect from this damage +#define DAMAGE_ENERGY 0x00000004 // damage is from an energy based weapon #define DAMAGE_NO_KNOCKBACK 0x00000008 // do not affect velocity, just view angles -#define DAMAGE_BULLET 0x00000010 // damage is from a bullet (used for ricochets) +#define DAMAGE_BULLET 0x00000010 // damage is from a bullet (used for ricochets) #define DAMAGE_NO_PROTECTION 0x00000020 // armor, shields, invulnerability, and godmode have no effect #define DAMAGE_ARMORMOSTLY 0x00000040 // reduces the armor more than the health @@ -803,7 +798,6 @@ edict_t *PlayerTrail_PickFirst (edict_t *self); edict_t *PlayerTrail_PickNext (edict_t *self); edict_t *PlayerTrail_LastSpot (void); - // // g_client.c // @@ -825,6 +819,7 @@ void player_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damag // g_svcmds.c // void ServerCommand (void); +qboolean SV_FilterPacket (char *from); // // p_view.c @@ -863,24 +858,6 @@ void G_RunEntity (edict_t *ent); void SaveClientData (void); void FetchClientEntData (edict_t *ent); - -#if defined(_DEBUG) && defined(_Z_TESTMODE) - -// -// z_mtest.c -// -void Cmd_TestItem (edict_t *ent); - -#endif - -// -// z_trigger.c -// -#ifdef CACHE_SOUND -void printSoundNum(); -void initSoundList(); -#endif - // // z_item.c // @@ -1050,10 +1027,6 @@ struct gclient_s float respawn_time; // can respawn when time > this -#if defined(_DEBUG) && defined(_Z_TESTMODE) - struct edict_s *lineDraw; -#endif - // used for blinding int flashTime; int flashBase; @@ -1239,11 +1212,6 @@ struct edict_s float weaponsound_time; -#if defined(_DEBUG) && defined(_Z_TESTMODE) - //can't teach an old dog new tricks - void *extra_data; -#endif - // schooling info edict_t *zRaduisList, *zSchoolChain; float zDistance; @@ -1272,10 +1240,7 @@ struct edict_s int bossFireCount; }; -//zaero debug includes (need type info) -#include "z_frames.h" -#include "z_anim.h" - // Zaero dmflags #define ZDM_NO_GL_POLYBLEND_DAMAGE 1 #define ZDM_ZAERO_ITEMS 2 +