Increased size of filename buffer for entity transition file in missionpack DLL from MAX_QPATH to MAX_OSPATH.

Changed target_changelevel clear inventory check to use MAPTYPE_CUSTOM check instead of != MAPTYPE_ID.
Misc improvements to func_door_secret2.
Partial fix to func_door_secret as a movewith child.
This commit is contained in:
Knightmare66 2020-09-01 20:04:30 -04:00
parent a680872065
commit b91a68376a
8 changed files with 268 additions and 173 deletions

View file

@ -249,6 +249,7 @@ void Move_Begin (edict_t *ent)
Move_Final (ent);
return;
}
// set object's velocity to direction times speed
VectorScale (ent->moveinfo.dir, ent->moveinfo.speed, ent->velocity);
if (ent->movewith && ent->movewith_ent)
@ -315,8 +316,10 @@ void Move_Calc (edict_t *ent, vec3_t dest, void(*func)(edict_t*))
VectorSubtract (dest, ent->s.origin, ent->moveinfo.dir);
ent->moveinfo.remaining_distance = VectorNormalize (ent->moveinfo.dir);
ent->moveinfo.endfunc = func;
// Knightmare- use smart functions for child movement
if (ent->movewith && ent->movewith_ent)
{ // Knightmare- use smart functions for child movement
{
if (VectorCompare(dest, ent->pos0))
Move_pos0_Think (ent);
else if (VectorCompare(dest, ent->pos1))
@ -327,11 +330,13 @@ void Move_Calc (edict_t *ent, vec3_t dest, void(*func)(edict_t*))
Move_Begin (ent);
}
else if (ent->moveinfo.speed == ent->moveinfo.accel && ent->moveinfo.speed == ent->moveinfo.decel)
{ // what does this mean?
if (level.current_entity == ((ent->flags & FL_TEAMSLAVE) ? ent->teammaster : ent))
{
if (level.current_entity == ((ent->flags & FL_TEAMSLAVE) ? ent->teammaster : ent)) {
Move_Begin (ent);
else if (ent->movewith)
}
else if (ent->movewith) {
Move_Begin (ent);
}
else // wait 0.1 second to start moving
{
ent->nextthink = level.time + FRAMETIME;
@ -3311,7 +3316,8 @@ void train_move_children (edict_t *self)
// For all but buttons, doors, and plats, move origin and match velocities
if ( strcmp(ent->classname, "func_door") && strcmp(ent->classname, "func_button")
&& strcmp(ent->classname, "func_door_secret") && strcmp(ent->classname, "func_door_secret2")
// && strcmp(ent->classname, "func_door_secret") && strcmp(ent->classname, "func_door_secret2")
&& (ent->class_id != ENTITY_FUNC_DOOR_SECRET) && (ent->class_id != ENTITY_FUNC_DOOR_SECRET2)
&& strcmp(ent->classname, "func_plat") && strcmp(ent->classname, "func_plat2")
&& strcmp(ent->classname, "func_water") && strcmp(ent->classname, "turret_wall")
&& (strcmp(ent->classname, "monster_turret") || !(ent->spawnflags & 128)) )
@ -3451,7 +3457,8 @@ void train_move_children (edict_t *self)
// Special cases:
// Func_door/func_button and trigger fields
if ( !strcmp(ent->classname, "func_door") || !strcmp(ent->classname, "func_button")
|| !strcmp(ent->classname, "func_door_secret") || !strcmp(ent->classname, "func_door_secret2")
// || !strcmp(ent->classname, "func_door_secret") || !strcmp(ent->classname, "func_door_secret2")
|| (ent->class_id == ENTITY_FUNC_DOOR_SECRET) || (ent->class_id == ENTITY_FUNC_DOOR_SECRET2)
|| !strcmp(ent->classname, "func_plat") || !strcmp(ent->classname, "func_plat2")
|| !strcmp(ent->classname, "func_water") || !strcmp(ent->classname, "turret_wall")
|| (!strcmp(ent->classname, "monster_turret") && ent->spawnflags & 128) )
@ -3470,7 +3477,8 @@ void train_move_children (edict_t *self)
VectorMA (ent->pos1, ent->movewith_offset[2], up, ent->pos1);
VectorMA (ent->pos1, 32, eforward, ent->pos2);
}
else if (!strcmp(ent->classname, "func_door_secret"))
// else if (!strcmp(ent->classname, "func_door_secret"))
if (ent->class_id == ENTITY_FUNC_DOOR_SECRET)
{
vec3_t eforward, eright, eup;
@ -3484,7 +3492,8 @@ void train_move_children (edict_t *self)
VectorMA (ent->pos0, ent->side * ent->width, eright, ent->pos1);
VectorMA (ent->pos1, ent->length, eforward, ent->pos2);
}
else if (!strcmp(ent->classname, "func_door_secret2"))
// else if (!strcmp(ent->classname, "func_door_secret2"))
else if (ent->class_id == ENTITY_FUNC_DOOR_SECRET2)
{
vec3_t eforward, eright, eup;
@ -3563,7 +3572,8 @@ void train_move_children (edict_t *self)
{
// Cross fingers here... move bounding boxes of doors and buttons
if ( !strcmp(ent->classname, "func_door") || !strcmp(ent->classname, "func_button")
|| !strcmp(ent->classname, "func_door_secret") || !strcmp(ent->classname, "func_door_secret2")
// || !strcmp(ent->classname, "func_door_secret") || !strcmp(ent->classname, "func_door_secret2")
|| (ent->class_id == ENTITY_FUNC_DOOR_SECRET) || (ent->class_id == ENTITY_FUNC_DOOR_SECRET2)
|| !strcmp(ent->classname, "func_plat") || !strcmp(ent->classname, "func_plat2")
|| !strcmp(ent->classname, "func_water") || (ent->solid == SOLID_TRIGGER)
|| !strcmp(ent->classname, "turret_wall")
@ -5037,18 +5047,19 @@ void door_secret_use (edict_t *self, edict_t *other, edict_t *activator)
// added sound
if (self->moveinfo.sound_start)
gi.sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self->moveinfo.sound_start, 1, self->attenuation, 0); // was ATTN_STATIC
if (self->moveinfo.sound_middle) {
if (self->moveinfo.sound_middle)
{
self->s.sound = self->moveinfo.sound_middle;
#ifdef LOOP_SOUND_ATTENUATION
self->s.attenuation = self->attenuation;
#endif
}
if (self->moveinfo.state == STATE_LOWEST)
{
self->moveinfo.state = STATE_DOWN;
Move_Calc (self, self->pos1, door_secret_move1);
door_use_areaportals (self, true);
}
else // Knightmare added
{
@ -5062,6 +5073,7 @@ void door_secret_move1 (edict_t *self)
self->nextthink = level.time + 1.0;
self->think = door_secret_move2;
self->moveinfo.state = STATE_BOTTOM;
// added sound
self->s.sound = 0;
if (self->moveinfo.sound_end)
@ -5079,6 +5091,7 @@ void door_secret_move2 (edict_t *self)
self->s.attenuation = self->attenuation;
#endif
}
self->moveinfo.state = STATE_UP;
Move_Calc (self, self->pos2, door_secret_move3);
}
@ -5086,6 +5099,7 @@ void door_secret_move2 (edict_t *self)
void door_secret_move3 (edict_t *self)
{
self->moveinfo.state = STATE_TOP;
// added sound
self->s.sound = 0;
if (self->moveinfo.sound_end)
@ -5118,6 +5132,7 @@ void door_secret_move5 (edict_t *self)
self->nextthink = level.time + 1.0;
self->think = door_secret_move6;
self->moveinfo.state = STATE_BOTTOM;
// added sound
self->s.sound = 0;
if (self->moveinfo.sound_end)
@ -5135,6 +5150,7 @@ void door_secret_move6 (edict_t *self)
self->s.attenuation = self->attenuation;
#endif
}
self->moveinfo.state = STATE_DOWN;
Move_Calc (self, self->pos0, door_secret_done);
}
@ -5147,6 +5163,7 @@ void door_secret_done (edict_t *self)
self->takedamage = DAMAGE_YES;
}
self->moveinfo.state = STATE_LOWEST;
// added sound
self->s.sound = 0;
if (self->moveinfo.sound_end)
@ -5160,7 +5177,8 @@ void door_secret_blocked (edict_t *self, edict_t *other)
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, self->pos0, other->s.origin, self->pos0, 100000, 1, 0, MOD_CRUSH);
// T_Damage (other, self, self, self->pos0, other->s.origin, self->pos0, 100000, 1, 0, MOD_CRUSH);
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 && other->inuse)
BecomeExplosion1 (other);
@ -5178,7 +5196,8 @@ void door_secret_blocked (edict_t *self, edict_t *other)
return;
self->touch_debounce_time = level.time + 0.5;
T_Damage (other, self, self, self->pos0, other->s.origin, self->pos0, self->dmg, 1, 0, MOD_CRUSH);
// T_Damage (other, self, self, self->pos0, other->s.origin, self->pos0, 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 door_secret_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)

View file

@ -1303,6 +1303,7 @@ void ChasecamStart (edict_t *ent);
#define TRAIN_SPLINE 8192
#define TRAIN_ORIGIN 16384
void door_use_areaportals (edict_t *self, qboolean open);
qboolean box_walkmove (edict_t *ent, float yaw, float dist);
void button_use (edict_t *self, edict_t *other, edict_t *activator);
void trainbutton_use (edict_t *self, edict_t *other, edict_t *activator);

View file

@ -40,6 +40,16 @@ void fd_secret_use (edict_t *self, edict_t *other, edict_t *activator)
if (self->flags & FL_TEAMSLAVE)
return;
// added sound
if (self->moveinfo.sound_start)
gi.sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self->moveinfo.sound_start, 1, self->attenuation, 0); // was ATTN_STATIC
if (self->moveinfo.sound_middle) {
self->s.sound = self->moveinfo.sound_middle;
#ifdef LOOP_SOUND_ATTENUATION
self->s.attenuation = self->attenuation;
#endif
}
// trigger all paired doors
for (ent = self; ent; ent = ent->teamchain)
{
@ -47,11 +57,12 @@ void fd_secret_use (edict_t *self, edict_t *other, edict_t *activator)
{
ent->moveinfo.state = STATE_DOWN;
Move_Calc (ent, ent->pos1, fd_secret_move1);
door_use_areaportals (self, true);
}
else if (self->moveinfo.state == STATE_TOP) // Knightmare added
{
self->moveinfo.state = STATE_UP;
Move_Calc(self, self->pos1, fd_secret_move5);
ent->moveinfo.state = STATE_UP;
Move_Calc (ent, ent->pos1, fd_secret_move5);
}
}
}
@ -75,12 +86,27 @@ void fd_secret_move1(edict_t *self)
self->nextthink = level.time + 1.0;
self->think = fd_secret_move2;
self->moveinfo.state = STATE_BOTTOM;
// added sound
self->s.sound = 0;
if (self->moveinfo.sound_end)
gi.sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self->moveinfo.sound_end, 1, self->attenuation, 0); // was ATTN_STATIC
}
// Start moving sideways w/sound...
void fd_secret_move2 (edict_t *self)
{
// gi.dprintf("fd_secret_move2\n");
// added sound
if (self->moveinfo.sound_start)
gi.sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self->moveinfo.sound_start, 1, self->attenuation, 0); // was ATTN_STATIC
if (self->moveinfo.sound_middle) {
self->s.sound = self->moveinfo.sound_middle;
#ifdef LOOP_SOUND_ATTENUATION
self->s.attenuation = self->attenuation;
#endif
}
self->moveinfo.state = STATE_UP;
Move_Calc (self, self->pos2, fd_secret_move3);
}
@ -95,12 +121,27 @@ void fd_secret_move3(edict_t *self)
self->think = fd_secret_move4;
}
self->moveinfo.state = STATE_TOP;
// added sound
self->s.sound = 0;
if (self->moveinfo.sound_end)
gi.sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self->moveinfo.sound_end, 1, self->attenuation, 0); // was ATTN_STATIC
}
// Move backward...
void fd_secret_move4 (edict_t *self)
{
// gi.dprintf("fd_secret_move4\n");
// added sound
if (self->moveinfo.sound_start)
gi.sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self->moveinfo.sound_start, 1, self->attenuation, 0); // was ATTN_STATIC
if (self->moveinfo.sound_middle) {
self->s.sound = self->moveinfo.sound_middle;
#ifdef LOOP_SOUND_ATTENUATION
self->s.attenuation = self->attenuation;
#endif
}
self->moveinfo.state = STATE_UP;
Move_Calc (self, self->pos1, fd_secret_move5);
}
@ -112,11 +153,25 @@ void fd_secret_move5(edict_t *self)
self->nextthink = level.time + 1.0;
self->think = fd_secret_move6;
self->moveinfo.state = STATE_BOTTOM;
// added sound
self->s.sound = 0;
if (self->moveinfo.sound_end)
gi.sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self->moveinfo.sound_end, 1, self->attenuation, 0); // was ATTN_STATIC
}
void fd_secret_move6 (edict_t *self)
{
// gi.dprintf("fd_secret_move6\n");
// added sound
if (self->moveinfo.sound_start)
gi.sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self->moveinfo.sound_start, 1, self->attenuation, 0); // was ATTN_STATIC
if (self->moveinfo.sound_middle)
self->s.sound = self->moveinfo.sound_middle;
#ifdef LOOP_SOUND_ATTENUATION
self->s.attenuation = self->attenuation;
#endif
self->moveinfo.state = STATE_DOWN;
Move_Calc (self, self->pos0, fd_secret_done);
}
@ -126,11 +181,19 @@ void fd_secret_done(edict_t *self)
// gi.dprintf("fd_secret_done\n");
if (!self->targetname || self->spawnflags & SEC_YES_SHOOT)
{
self->health = 1;
// self->health = 1;
self->health = self->max_health;
self->takedamage = DAMAGE_YES;
self->die = fd_secret_killed;
}
self->moveinfo.state = STATE_LOWEST;
// added sound
self->s.sound = 0;
if (self->moveinfo.sound_end)
gi.sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self->moveinfo.sound_end, 1, self->attenuation, 0); // was ATTN_STATIC
door_use_areaportals (self, false);
}
void secret_blocked (edict_t *self, edict_t *other)
@ -143,7 +206,7 @@ void secret_blocked(edict_t *self, edict_t *other)
}
if (!(self->flags & FL_TEAMSLAVE))
T_Damage (other, self, self, self->pos0, other->s.origin, self->pos0, self->dmg, 0, 0, MOD_CRUSH);
T_Damage (other, self, self, vec3_origin, other->s.origin, vec3_origin, self->dmg, 0, 0, MOD_CRUSH);
// if (time < self->attack_finished)
// return;
@ -163,17 +226,19 @@ void secret_touch(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *su
if (other->health <= 0)
return;
if (!(other->client))
// if (!(other->client))
// Lazarus: Allows robot usage
if (!other->client && !(other->flags & FL_ROBOT))
return;
if (self->monsterinfo.attack_finished > level.time)
return;
self->monsterinfo.attack_finished = level.time + 2;
if (self->message)
{
gi.centerprintf (other, self->message);
gi.sound (other, CHAN_AUTO, gi.soundindex ("misc/talk1.wav"), 1, ATTN_NORM, 0);
// fixme - put this sound back??
// gi.sound (other, CHAN_BODY, "misc/talk.wav", 1, ATTN_NORM);
}
@ -212,12 +277,18 @@ void SP_func_door_secret2 (edict_t *ent)
ent->moveinfo.sound_middle = gi.soundindex (va("doors/dr%02i_mid.wav", ent->sounds));
ent->moveinfo.sound_end = gi.soundindex (va("doors/dr%02i_end.wav", ent->sounds));
}
else
else if (ent->sounds != 1)
{
ent->moveinfo.sound_start = gi.soundindex ("doors/dr1_strt.wav");
ent->moveinfo.sound_middle = gi.soundindex ("doors/dr1_mid.wav");
ent->moveinfo.sound_end = gi.soundindex ("doors/dr1_end.wav");
}
else
{
ent->moveinfo.sound_start = 0;
ent->moveinfo.sound_middle = 0;
ent->moveinfo.sound_end = 0;
}
if (!ent->dmg)
ent->dmg = 2;
@ -245,8 +316,9 @@ void SP_func_door_secret2 (edict_t *ent)
if (!ent->length)
ent->length = ent->size[1] - 2; // was fbSize
}
else
gi.dprintf("Secret door not at 0,90,180,270!\n");
else {
gi.dprintf("func_door_secret2 angles not set at 0, 90, 180, 270!\n");
}
if (ent->spawnflags & SEC_MOVE_FORWARD)
VectorScale(forward, ent->length, forward);
@ -272,6 +344,7 @@ void SP_func_door_secret2 (edict_t *ent)
ent->touch = secret_touch;
ent->blocked = secret_blocked;
ent->use = fd_secret_use;
ent->moveinfo.speed = 50;
ent->moveinfo.accel = 50;
ent->moveinfo.decel = 50;
@ -279,7 +352,9 @@ void SP_func_door_secret2 (edict_t *ent)
if (!ent->targetname || ent->spawnflags & SEC_YES_SHOOT)
{
if (!ent->health) {
ent->health = 1;
}
ent->max_health = ent->health;
ent->takedamage = DAMAGE_YES;
ent->die = fd_secret_killed;
@ -351,7 +426,7 @@ void force_wall_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_
gi.sound (other, CHAN_AUTO, self->noise_index, 1, ATTN_NORM, 0);
}
T_Damage (other, self, self, self->pos0, other->s.origin, self->pos0, self->dmg, self->dmg, 0, MOD_TRIGGER_HURT);
T_Damage (other, self, self, vec3_origin, other->s.origin, vec3_origin, self->dmg, self->dmg, 0, MOD_TRIGGER_HURT);
}
/*QUAKED func_force_wall (1 0 1) ? START_ON

View file

@ -1512,7 +1512,7 @@ void LoadTransitionEnts (void)
gi.dprintf("==== LoadTransitionEnts ====\n");
if (game.transition_ents)
{
char t_file[MAX_QPATH];
char t_file[MAX_OSPATH];
int i, j;
FILE *f;
vec3_t v_spawn;

View file

@ -451,8 +451,8 @@ void use_target_changelevel (edict_t *self, edict_t *other, edict_t *activator)
gi.cvar_forceset("skill", "3");
// Knightmare- some of id's stock Q2 maps have this spawnflag
// set on their trigger_changelevels, so exclude those maps
if ( (self->spawnflags & 1) && (level.maptype != MAPTYPE_ID) && (int)allow_clear_inventory->value )
// set on their trigger_changelevels, so only allow this on custom maps
if ( (self->spawnflags & 1) && (level.maptype == MAPTYPE_CUSTOM) && (int)allow_clear_inventory->value )
{
int n;
if (activator && activator->client)

View file

@ -1784,7 +1784,7 @@ void trans_ent_filename (char *filename, size_t filenameSize)
int trigger_transition_ents (edict_t *changelevel, edict_t *self)
{
char t_file[MAX_QPATH];
char t_file[MAX_OSPATH];
int i, j;
int total=0;
qboolean nogo;

View file

@ -304,7 +304,7 @@ void Do_Text_Display (edict_t *activator, int flags, char *message)
Com_sprintf(pakfile, sizeof(pakfile), "%s\\pak%d.pak", filename, i);
if (NULL != (f = fopen(pakfile, "rb")))
{
num = fread(&pakheader,1,sizeof(pak_header_t),f);
num = (int)fread(&pakheader, 1, sizeof(pak_header_t), f);
if (num >= sizeof(pak_header_t))
{
if ( pakheader.id[0] == 'P' &&