Skip to content

Commit

Permalink
phase_init, sound_ambient, trigger_push and silent trigger_teleport fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Shanjaq committed Jun 10, 2019
1 parent 0a56e2a commit ef9fff2
Show file tree
Hide file tree
Showing 3 changed files with 174 additions and 19 deletions.
16 changes: 12 additions & 4 deletions portals/skullwiz.hc
Original file line number Diff line number Diff line change
Expand Up @@ -743,13 +743,21 @@ float loop_cnt,forward,dot;
else
spot1 = self.origin;

forward = random(120,200);
spot2 = spot1 + (v_forward * forward);
traceline (spot1, spot2 + (v_forward * 30) , FALSE, self.enemy);
//forward = random(120,200);
//spot2 = spot1 + (v_forward * forward);
//traceline (spot1, spot2 + (v_forward * 30) , FALSE, self.enemy);
forward = random((self.size_x + self.size_y),200.00000);
spot2 = (spot1 + (v_forward * forward) + (v_up * forward));
traceline ( spot1, (spot2 + (v_forward * ((self.size_x + self.size_y) * 0.5))), TRUE, self.enemy);
if (trace_fraction == 1.0) // Check no one is standing where monster wants to be
{
traceline ( spot2, (spot2 - (v_up * (forward * 2.00000))), TRUE, self.enemy);
spot2 = trace_endpos;

makevectors (newangle);
tracearea (spot2,spot2 + v_up * 80,'-32 -32 -10','32 32 46',FALSE,self);
//tracearea (spot2,spot2 + v_up * 80,'-32 -32 -10','32 32 46',FALSE,self);
//tracearea ( spot2, (spot2 + (v_up * 80.00000)), '-32 -32 -10', '32 32 46', FALSE, self);
tracearea ( spot2, (spot2 + (v_up * 80.00000)), self.mins, self.maxs, FALSE, self.enemy);
if ((trace_fraction == 1.0) && (!trace_allsolid)) // Check there is a floor at the new spot
{
spot3 = spot2 + (v_up * -4);
Expand Down
113 changes: 101 additions & 12 deletions portals/sound.hc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,38 @@ void sound_maker_run(void)
sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
}

void music_player_run(void)
{
local entity found;

found = find(world, classname, "player");
while (found)
{
if (self.noise1 == "")
{
stuffcmd(found, "music_stop\n");
}
else
{
if (self.flags & 1)
stuffcmd(found, "music_loop 1\n");
else
stuffcmd(found, "music_loop 0\n");

stuffcmd(found, "music ");
stuffcmd(found, self.noise1);
stuffcmd(found, "\n");
}
found = find ( found, classname, "player");
}
}

void music_player_wait(void)
{
self.think = music_player_run;
thinktime self : self.delay;
}

void sound_maker_wait(void)
{
self.think = sound_maker_run;
Expand Down Expand Up @@ -72,7 +104,7 @@ void sound_again(void)
sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);

self.think = sound_again;
self.nextthink = time + random(5,30);
thinktime self : random(self.flags,self.flags2);
}


Expand Down Expand Up @@ -111,15 +143,17 @@ void sound_ambient (void)
{
precache_sound ("ambience/drip1.wav");
self.noise1 = ("ambience/drip1.wav");
self.flags = 5;
self.flags2 = 30;
self.think = sound_again;
thinktime self : random(5,30);
}
else if (self.soundtype == 3)
{
precache_sound ("ambience/drip2.wav");
self.noise1 = ("ambience/drip2.wav");
self.flags = 5;
self.flags2 = 30;
self.think = sound_again;
thinktime self : random(5,30);
}
else if (self.soundtype == 4)
{
Expand All @@ -130,29 +164,33 @@ void sound_ambient (void)
{
precache_sound ("ambience/night.wav");
self.noise1 = ("ambience/night.wav");
self.flags = 5;
self.flags2 = 30;
self.think = sound_again;
thinktime self : random(5,30);
}
else if (self.soundtype == 6)
{
precache_sound ("ambience/birds.wav");
self.noise1 = ("ambience/birds.wav");
self.flags = 15;
self.flags2 = 60;
self.think = sound_again;
thinktime self : random(15,60);
}
else if (self.soundtype == 7)
{
precache_sound ("ambience/raven.wav");
self.noise1 = ("ambience/raven.wav");
self.flags = 15;
self.flags2 = 60;
self.think = sound_again;
thinktime self : random(15,60);
}
else if (self.soundtype == 8)
{
precache_sound ("ambience/rockfall.wav");
self.noise1 = ("ambience/rockfall.wav");
self.flags = 15;
self.flags2 = 60;
self.think = sound_again;
thinktime self : random(15,60);
}
else if (self.soundtype == 9)
{
Expand All @@ -170,15 +208,19 @@ void sound_ambient (void)
self.noise1 = ("ambience/metal.wav");
precache_sound ("ambience/metal2.wav");
self.noise2 = ("ambience/metal2.wav");
thinktime self : random(5,30);
self.flags = 5;
self.flags2 = 30;
self.think = sound_again;
}
else if (self.soundtype == 12)
{
precache_sound ("ambience/pounding.wav");
self.noise1 = ("ambience/pounding.wav");
precache_sound ("ambience/poundin2.wav");
self.noise2 = ("ambience/poundin2.wav");
thinktime self : random(5,30);
self.flags = 5;
self.flags2 = 30;
self.think = sound_again;
}
else if (self.soundtype == 13)
{
Expand All @@ -188,21 +230,27 @@ void sound_ambient (void)
self.noise2 = ("ambience/moan2.wav");
precache_sound ("ambience/moan3.wav");
self.noise3 = ("ambience/moan3.wav");
thinktime self : random(5,30);
self.flags = 5;
self.flags2 = 30;
self.think = sound_again;
}
else if (self.soundtype == 14)
{
precache_sound ("ambience/creak.wav");
self.noise1 = ("ambience/creak.wav");
precache_sound ("ambience/creak2.wav");
self.noise2 = ("ambience/creak2.wav");
thinktime self : random(5,30);
self.flags = 5;
self.flags2 = 30;
self.think = sound_again;
}
else if (self.soundtype == 15)
{
precache_sound ("ambience/rattle.wav");
self.noise1 = ("ambience/rattle.wav");
thinktime self : random(5,30);
self.flags = 5;
self.flags2 = 30;
self.think = sound_again;
}
else if (self.soundtype == 16)
{
Expand All @@ -213,7 +261,48 @@ void sound_ambient (void)
if (!self.think)
ambientsound (self.origin, self.noise1, 1, ATTN_STATIC);
else
{
sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
thinktime self : random(15,60);
}

}

void custom_sound_maker (void)
{
precache_sound (self.netname);
self.noise1 = (self.netname);

if (self.delay)
self.use = sound_maker_wait;
else
self.use = sound_maker_run;
}



void custom_sound_ambient (void)
{
precache_sound (self.netname);
self.noise1 = (self.netname);

if (self.flags) {
self.think = sound_again;
thinktime self : random(self.flags,self.flags2);
}

if (!self.think)
ambientsound (self.origin, self.noise1, 1, ATTN_STATIC);
else
sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
}

void custom_music_player (void)
{
self.noise1 = (self.netname);

if (self.delay)
self.use = music_player_wait;
else
self.use = music_player_run;
}
64 changes: 61 additions & 3 deletions portals/triggers.hc
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,47 @@ void() trigger_relay =
};


/*QUAKED trigger_broadcast (.5 .5 .5) (-8 -8 -8) (8 8 8)
This fixed size trigger cannot be touched, it can only be fired by
other events. It can contain killtargets, targets, delays, and
messages.
"failchance" - default 0 - chance that trigger may fail to fire (0 - 100%)
*/
void trigger_broadcast_check_reset ()
{
self.check_ok=FALSE;
}

void() trigger_broadcast_use =
{
// dprint("Trig_relay Used by: ");
// dprint(other.classname);
// dprint("\n");
if(self.failchance)
if(random()*100<self.failchance)
return;

if(!self.delay)
self.check_ok=TRUE;
if(world.spawnflags & 1) /* MISSIONPACK */
self.enemy = activator;

SUB_UseTargets();

if(self.wait)
{
self.think=trigger_broadcast_check_reset;
thinktime self : self.wait;
}
else
self.check_ok=FALSE;
};

void() trigger_broadcast =
{
self.use = trigger_broadcast_use;
};

//=============================================================================

/*QUAK-ED trigger_secret (.5 .5 .5) ?
Expand Down Expand Up @@ -1243,7 +1284,12 @@ float poof_speed;
}
}
else
org=t.origin;
{
if (!self.spawnflags & SILENT)
org=t.origin - '0 0 27';
else
org=t.origin;
}

spawn_tdeath(t.origin, other);

Expand All @@ -1259,7 +1305,10 @@ float poof_speed;
if((t.spawnflags&2||self.spawnflags&16)&&other.classname=="player")
other.velocity='0 0 0';//Kill all player's velocity

setorigin (other, t.origin);
if (!self.spawnflags & SILENT)
setorigin (other, t.origin);
else
setorigin (other, t.origin - '0 0 27');

if (!self.spawnflags & SILENT)
{
Expand All @@ -1284,7 +1333,12 @@ float poof_speed;
poof_speed = 225; // otherwise cant reach the balcony
*/
else
poof_speed = 300;
{
if (!self.spawnflags & SILENT)
poof_speed = 300;
else
poof_speed = vlen(other.velocity);
}
other.velocity = v_forward * poof_speed;
}
}
Expand Down Expand Up @@ -1566,13 +1620,17 @@ void() trigger_push =
precache_sound ("ambience/windpush.wav");

if(world.spawnflags&MISSIONPACK)
{
if(self.targetname)
self.use = trigger_push_turn_on;
else
{
self.use = trigger_push_gone;
self.touch = trigger_push_touch;
}
}
else
self.touch = trigger_push_touch;

if (!self.speed)
self.speed = 500;
Expand Down

0 comments on commit ef9fff2

Please sign in to comment.