void CMomentaryDoor::Spawn( void ) { SetMovedir (pev); pev->solid = SOLID_BSP; pev->movetype = MOVETYPE_PUSH; UTIL_SetOrigin(pev, pev->origin); SET_MODEL( ENT(pev), STRING(pev->model) ); if (pev->speed == 0) pev->speed = 100; if (pev->dmg == 0) pev->dmg = 2; m_vecPosition1 = pev->origin; // Subtract 2 from size because the engine expands bboxes by 1 in all directions making the size too big m_vecPosition2 = m_vecPosition1 + (pev->movedir * (fabs( pev->movedir.x * (pev->size.x-2) ) + fabs( pev->movedir.y * (pev->size.y-2) ) + fabs( pev->movedir.z * (pev->size.z-2) ) - m_flLip)); ASSERTSZ(m_vecPosition1 != m_vecPosition2, "door start/end positions are equal"); if ( FBitSet (pev->spawnflags, SF_DOOR_START_OPEN) ) { // swap pos1 and pos2, put door at pos2 UTIL_SetOrigin(pev, m_vecPosition2); m_vecPosition2 = m_vecPosition1; m_vecPosition1 = pev->origin; } SetTouch( NULL ); Precache(); }
void CBlood::Spawn( void ) { pev->solid = SOLID_NOT; pev->movetype = MOVETYPE_NONE; pev->effects = 0; pev->frame = 0; SetMovedir( pev ); }
/* <690bc> ../cstrike/dlls/doors.cpp:285 */ void CBaseDoor::__MAKE_VHOOK(Spawn)(void) { Precache(); SetMovedir(pev); //normal door if (pev->skin == 0) { if (pev->spawnflags & SF_DOOR_PASSABLE) pev->solid = SOLID_NOT; else pev->solid = SOLID_BSP; } else // special contents { pev->solid = SOLID_NOT; // water is silent for now pev->spawnflags |= SF_DOOR_SILENT; } pev->movetype = MOVETYPE_PUSH; UTIL_SetOrigin(pev, pev->origin); SET_MODEL(ENT(pev), STRING(pev->model)); if (pev->speed == 0) pev->speed = 100; m_vecPosition1 = pev->origin; // Subtract 2 from size because the engine expands bboxes by 1 in all directions making the size too big m_vecPosition2 = m_vecPosition1 + (pev->movedir * (fabs((float_precision)(pev->movedir.x * (pev->size.x - 2))) + fabs((float_precision)(pev->movedir.y * (pev->size.y - 2))) + fabs((float_precision)(pev->movedir.z * (pev->size.z - 2))) - m_flLip)); assert(("door start/end positions are equal", m_vecPosition1 != m_vecPosition2)); if (pev->spawnflags & SF_DOOR_START_OPEN) { // swap pos1 and pos2, put door at pos2 UTIL_SetOrigin(pev, m_vecPosition2); m_vecPosition2 = m_vecPosition1; m_vecPosition1 = pev->origin; } m_toggle_state = TS_AT_BOTTOM; // if the door is flagged for USE button activation only, use NULL touch function if (pev->spawnflags & SF_DOOR_USE_ONLY) { SetTouch(NULL); } else { // touchable button SetTouch(&CBaseDoor::DoorTouch); } m_lastBlockedTimestamp = 0; }
/* <69949> ../cstrike/dlls/doors.cpp:334 */ void CBaseDoor::__MAKE_VHOOK(Restart)(void) { SetMovedir(pev); m_toggle_state = TS_AT_BOTTOM; DoorGoDown(); if (pev->spawnflags & SF_DOOR_USE_ONLY) SetTouch(NULL); else SetTouch(&CBaseDoor::DoorTouch); }
/* ================ InitTrigger ================ */ void InitTrigger() { // trigger angles are used for one-way touches. An angle of 0 is assumed // to mean no restrictions, so use a yaw of 360 instead. if ( !VectorCompareF( self->s.v.angles, 0, 0, 0 ) ) SetMovedir( self ); self->s.v.solid = SOLID_TRIGGER; setmodel( self, self->s.v.model ); // set size and link into world self->s.v.movetype = MOVETYPE_NONE; self->s.v.modelindex = 0; self->s.v.model = ""; }
void CBaseDoor::Spawn( ) { Precache(); SetMovedir (pev); if ( pev->skin == 0 ) {//normal door if ( FBitSet (pev->spawnflags, SF_DOOR_PASSABLE) ) pev->solid = SOLID_NOT; else pev->solid = SOLID_BSP; } else {// special contents pev->solid = SOLID_NOT; SetBits( pev->spawnflags, SF_DOOR_SILENT ); // water is silent for now } pev->movetype = MOVETYPE_PUSH; UTIL_SetOrigin(pev, pev->origin); SET_MODEL( ENT(pev), STRING(pev->model) ); // added by jason if( !stricmp( STRING( pev->classname ), "func_water" ) ) { pev->skin = CONTENTS_WATER; pev->rendermode = kRenderTransAlpha; } if (pev->speed == 0) pev->speed = 100; m_vecPosition1 = pev->origin; // Subtract 2 from size because the engine expands bboxes by 1 in all directions making the size too big m_vecPosition2 = m_vecPosition1 + (pev->movedir * (fabs( pev->movedir.x * (pev->size.x-2) ) + fabs( pev->movedir.y * (pev->size.y-2) ) + fabs( pev->movedir.z * (pev->size.z-2) ) - m_flLip)); ASSERTSZ(m_vecPosition1 != m_vecPosition2, "door start/end positions are equal"); if ( FBitSet (pev->spawnflags, SF_DOOR_START_OPEN) ) { // swap pos1 and pos2, put door at pos2 UTIL_SetOrigin(pev, m_vecPosition2); m_vecPosition2 = m_vecPosition1; m_vecPosition1 = pev->origin; } m_toggle_state = TS_AT_BOTTOM; // if the door is flagged for USE button activation only, use NULL touch function if ( FBitSet ( pev->spawnflags, SF_DOOR_USE_ONLY ) ) { SetTouch ( NULL ); } else // touchable button SetTouch( DoorTouch ); }
void SP_trap_spikeshooter() { SetMovedir(); self->use = ( func_t ) spikeshooter_use; if ( ( int ) ( self->s.v.spawnflags ) & SPAWNFLAG_LASER ) { trap_precache_model( "progs/laser.mdl" ); trap_precache_sound( "enforcer/enfire.wav" ); trap_precache_sound( "enforcer/enfstop.wav" ); } else trap_precache_sound( "weapons/spike2.wav" ); }
void CBaseButton::Spawn(void) { char *pszSound = ButtonSound(m_sounds); PRECACHE_SOUND(pszSound); pev->noise = ALLOC_STRING(pszSound); Precache(); if (FBitSet(pev->spawnflags, SF_BUTTON_SPARK_IF_OFF)) { SetThink(&CBaseButton::ButtonSpark); pev->nextthink = gpGlobals->time + 0.5; } SetMovedir(pev); pev->movetype = MOVETYPE_PUSH; pev->solid = SOLID_BSP; SET_MODEL(ENT(pev), STRING(pev->model)); if (!pev->speed) pev->speed = 40; if (pev->health > 0) pev->takedamage = DAMAGE_YES; if (!m_flWait) m_flWait = 1; if (!m_flLip) m_flLip = 4; m_toggle_state = TS_AT_BOTTOM; m_vecPosition1 = pev->origin; m_vecPosition2 = m_vecPosition1 + (pev->movedir * (fabs(pev->movedir.x * (pev->size.x - 2)) + fabs(pev->movedir.y * (pev->size.y - 2)) + fabs(pev->movedir.z * (pev->size.z - 2)) - m_flLip)); if (((m_vecPosition2 - m_vecPosition1).Length() < 1) || (pev->spawnflags & SF_BUTTON_DONTMOVE)) m_vecPosition2 = m_vecPosition1; m_fStayPushed = m_flWait == -1 ? TRUE : FALSE; m_fRotating = FALSE; if (FBitSet(pev->spawnflags, SF_BUTTON_TOUCH_ONLY)) { SetTouch(&CBaseButton::ButtonTouch); } else { SetTouch(NULL); SetUse(&CBaseButton::ButtonUse); } }
void CBaseButton::Restart() { m_hActivator = NULL; SetMovedir(pev); ButtonReturn(); if (pev->spawnflags & SF_BUTTON_TOUCH_ONLY) { SetTouch(&CBaseButton::ButtonTouch); } else { SetTouch(NULL); SetUse(&CBaseButton::ButtonUse); } }
void CBaseDoor::Spawn() { Precache(); SetMovedir( this ); if( GetSkin() == 0 ) {//normal door if( GetSpawnFlags().Any( SF_DOOR_PASSABLE ) ) SetSolidType( SOLID_NOT ); else SetSolidType( SOLID_BSP ); } else {// special contents SetSolidType( SOLID_NOT ); GetSpawnFlags().AddFlags( SF_DOOR_SILENT ); // water is silent for now } SetMoveType( MOVETYPE_PUSH ); SetAbsOrigin( GetAbsOrigin() ); SetModel( GetModelName() ); if( GetSpeed() == 0 ) SetSpeed( 100 ); m_vecPosition1 = GetAbsOrigin(); // Subtract 2 from size because the engine expands bboxes by 1 in all directions making the size too big m_vecPosition2 = m_vecPosition1 + ( GetMoveDir() * ( fabs( GetMoveDir().x * ( GetBounds().x - 2 ) ) + fabs( GetMoveDir().y * ( GetBounds().y - 2 ) ) + fabs( GetMoveDir().z * ( GetBounds().z - 2 ) ) - m_flLip ) ); ASSERTSZ( m_vecPosition1 != m_vecPosition2, "door start/end positions are equal" ); if( GetSpawnFlags().Any( SF_DOOR_START_OPEN ) ) { // swap pos1 and pos2, put door at pos2 SetAbsOrigin( m_vecPosition2 ); m_vecPosition2 = m_vecPosition1; m_vecPosition1 = GetAbsOrigin(); } m_toggle_state = TS_AT_BOTTOM; // if the door is flagged for USE button activation only, use NULL touch function if( GetSpawnFlags().Any( SF_DOOR_USE_ONLY ) ) { SetTouch( NULL ); } else // touchable button SetTouch( &CBaseDoor::DoorTouch ); }
void CFuncConveyor :: Spawn( void ) { SetMovedir( pev ); CFuncWall::Spawn(); if ( !(pev->spawnflags & SF_CONVEYOR_VISUAL) ) SetBits( pev->flags, FL_CONVEYOR ); // HACKHACK - This is to allow for some special effects if ( pev->spawnflags & SF_CONVEYOR_NOTSOLID ) { pev->solid = SOLID_NOT; pev->skin = 0; // Don't want the engine thinking we've got special contents on this brush } if ( pev->speed == 0 ) pev->speed = 100; UpdateSpeed( pev->speed ); }
void CGibShooter::Spawn( void ) { Precache(); pev->solid = SOLID_NOT; pev->effects = EF_NODRAW; if ( m_flDelay == 0 ) { m_flDelay = 0.1; } if ( m_flGibLife == 0 ) { m_flGibLife = 25; } SetMovedir ( pev ); pev->body = MODEL_FRAMES( m_iGibModelIndex ); }
void CMomentaryDoor::Spawn( void ) { SetMovedir (pev); pev->solid = SOLID_BSP; pev->movetype = MOVETYPE_PUSH; UTIL_SetOrigin(this, pev->origin); SET_MODEL( ENT(pev), STRING(pev->model) ); // if (pev->speed == 0) // pev->speed = 100; if (pev->dmg == 0) pev->dmg = 2; m_iState = STATE_OFF; m_vecPosition1 = pev->origin; // Subtract 2 from size because the engine expands bboxes by 1 in all directions making the size too big m_vecPosition2 = m_vecPosition1 + (pev->movedir * (fabs( pev->movedir.x * (pev->size.x-2) ) + fabs( pev->movedir.y * (pev->size.y-2) ) + fabs( pev->movedir.z * (pev->size.z-2) ) - m_flLip)); ASSERTSZ(m_vecPosition1 != m_vecPosition2, "door start/end positions are equal"); //LRC: FIXME, move to PostSpawn if ( FBitSet (pev->spawnflags, SF_DOOR_START_OPEN) ) { // swap pos1 and pos2, put door at pos2 UTIL_AssignOrigin(this, m_vecPosition2); Vector vecTemp = m_vecPosition2; m_vecPosition2 = m_vecPosition1; m_vecPosition1 = vecTemp; } if (m_pMoveWith) { m_vecPosition1 = m_vecPosition1 - m_pMoveWith->pev->origin; m_vecPosition2 = m_vecPosition2 - m_pMoveWith->pev->origin; } Precache(); SetTouch( NULL ); }
//standard Spirit 1.0 spawn function void CBaseDoor::Spawn( ) { Precache(); SetMovedir (pev); if ( pev->skin == 0 ) {//normal door if ( FBitSet (pev->spawnflags, SF_DOOR_PASSABLE) ) pev->solid = SOLID_NOT; else pev->solid = SOLID_BSP; } else {// special contents pev->solid = SOLID_NOT; SetBits( pev->spawnflags, SF_DOOR_SILENT ); // water is silent for now } pev->movetype = MOVETYPE_PUSH; SET_MODEL( ENT(pev), STRING(pev->model) ); UTIL_SetOrigin(this, pev->origin); if (pev->speed == 0) pev->speed = 100; m_toggle_state = TS_AT_BOTTOM; // if the door is flagged for USE button activation only, use NULL touch function // (unless it's overridden, of course- LRC) if ( FBitSet ( pev->spawnflags, SF_DOOR_USE_ONLY ) && !FBitSet ( pev->spawnflags, SF_DOOR_FORCETOUCHABLE )) { SetTouch ( NULL ); } else // touchable button SetTouch( &CBaseDoor:: DoorTouch ); }
void CBaseButton::Spawn() { char *pszSound; //---------------------------------------------------- //determine sounds for buttons //a sound of 0 should not make a sound //---------------------------------------------------- pszSound = ButtonSound(m_sounds); PRECACHE_SOUND(pszSound); pev->noise = ALLOC_STRING(pszSound); Precache(); if(FBitSet(pev->spawnflags, SF_BUTTON_SPARK_IF_OFF)) // this button should spark in OFF state { SetThink(&CBaseButton::ButtonSpark); pev->nextthink = gpGlobals->time + 0.5; // no hurry, make sure everything else spawns } SetMovedir(pev); pev->movetype = MOVETYPE_PUSH; pev->solid = SOLID_BSP; SET_MODEL(ENT(pev), STRING(pev->model)); if(pev->speed == 0) pev->speed = 40; if(pev->health > 0) { pev->takedamage = DAMAGE_YES; } if(m_flWait == 0) m_flWait = 1; if(m_flLip == 0) m_flLip = 4; m_toggle_state = TS_AT_BOTTOM; m_vecPosition1 = pev->origin; // Subtract 2 from size because the engine expands bboxes by 1 in all directions making the size too big m_vecPosition2 = m_vecPosition1 + (pev->movedir * (fabs(pev->movedir.x * (pev->size.x - 2)) + fabs(pev->movedir.y * (pev->size.y - 2)) + fabs(pev->movedir.z * (pev->size.z - 2)) - m_flLip)); // Is this a non-moving button? if(((m_vecPosition2 - m_vecPosition1).Length() < 1) || (pev->spawnflags & SF_BUTTON_DONTMOVE)) m_vecPosition2 = m_vecPosition1; m_fStayPushed = (m_flWait == -1 ? TRUE : FALSE); m_fRotating = FALSE; // if the button is flagged for USE button activation only, take away it's touch function and add a use function if(FBitSet(pev->spawnflags, SF_BUTTON_TOUCH_ONLY)) // touchable button { SetTouch(&CBaseButton::ButtonTouch); } else { SetTouch(NULL); SetUse(&CBaseButton::ButtonUse); } }
/*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" 0) steam metal 1) wooden clunk 2) metallic click 3) in-out */ void SP_func_button() { float ftemp; if ( self->s.v.sounds == 0 ) { trap_precache_sound( "buttons/airbut1.wav" ); self->s.v.noise = "buttons/airbut1.wav"; } if ( self->s.v.sounds == 1 ) { trap_precache_sound( "buttons/switch21.wav" ); self->s.v.noise = "buttons/switch21.wav"; } if ( self->s.v.sounds == 2 ) { trap_precache_sound( "buttons/switch02.wav" ); self->s.v.noise = "buttons/switch02.wav"; } if ( self->s.v.sounds == 3 ) { trap_precache_sound( "buttons/switch04.wav" ); self->s.v.noise = "buttons/switch04.wav"; } SetMovedir(); self->s.v.movetype = MOVETYPE_PUSH; self->s.v.solid = SOLID_BSP; setmodel( self, self->s.v.model ); self->s.v.blocked = ( func_t ) button_blocked; self->s.v.use = ( func_t ) button_use; if ( self->s.v.health ) { self->s.v.max_health = self->s.v.health; self->th_die = button_killed; self->s.v.takedamage = DAMAGE_YES; } else self->s.v.touch = ( func_t ) button_touch; if ( !self->speed ) self->speed = 40; if ( !self->wait ) self->wait = 1; if ( !self->lip ) self->lip = 4; self->state = STATE_BOTTOM; // self->pos1 = self->s.v.origin; VectorCopy( self->s.v.origin, self->pos1 ); ftemp = ( fabs( DotProduct( self->s.v.movedir, self->s.v.size ) ) - self->lip ); self->pos2[0] = self->pos1[0] + self->s.v.movedir[0] * ftemp; self->pos2[1] = self->pos1[1] + self->s.v.movedir[1] * ftemp; self->pos2[2] = self->pos1[2] + self->s.v.movedir[2] * ftemp; }
void SP_func_door() { float tmp; if ( world->worldtype == 0 ) { trap_precache_sound( "doors/medtry.wav" ); trap_precache_sound( "doors/meduse.wav" ); self->s.v.noise3 = "doors/medtry.wav"; self->noise4 = "doors/meduse.wav"; } else if ( world->worldtype == 1 ) { trap_precache_sound( "doors/runetry.wav" ); trap_precache_sound( "doors/runeuse.wav" ); self->s.v.noise3 = "doors/runetry.wav"; self->noise4 = "doors/runeuse.wav"; } else if ( world->worldtype == 2 ) { trap_precache_sound( "doors/basetry.wav" ); trap_precache_sound( "doors/baseuse.wav" ); self->s.v.noise3 = "doors/basetry.wav"; self->noise4 = "doors/baseuse.wav"; } else { G_Printf( "no worldtype set!\n" ); } if ( self->s.v.sounds == 0 ) { trap_precache_sound( "misc/null.wav" ); trap_precache_sound( "misc/null.wav" ); self->s.v.noise1 = "misc/null.wav"; self->s.v.noise2 = "misc/null.wav"; } if ( self->s.v.sounds == 1 ) { trap_precache_sound( "doors/drclos4.wav" ); trap_precache_sound( "doors/doormv1.wav" ); self->s.v.noise1 = "doors/drclos4.wav"; self->s.v.noise2 = "doors/doormv1.wav"; } if ( self->s.v.sounds == 2 ) { trap_precache_sound( "doors/hydro1.wav" ); trap_precache_sound( "doors/hydro2.wav" ); self->s.v.noise2 = "doors/hydro1.wav"; self->s.v.noise1 = "doors/hydro2.wav"; } if ( self->s.v.sounds == 3 ) { trap_precache_sound( "doors/stndr1.wav" ); trap_precache_sound( "doors/stndr2.wav" ); self->s.v.noise2 = "doors/stndr1.wav"; self->s.v.noise1 = "doors/stndr2.wav"; } if ( self->s.v.sounds == 4 ) { trap_precache_sound( "doors/ddoor1.wav" ); trap_precache_sound( "doors/ddoor2.wav" ); self->s.v.noise1 = "doors/ddoor2.wav"; self->s.v.noise2 = "doors/ddoor1.wav"; } SetMovedir(); self->s.v.max_health = self->s.v.health; self->s.v.solid = SOLID_BSP; self->s.v.movetype = MOVETYPE_PUSH; setorigin( self, PASSVEC3( self->s.v.origin ) ); setmodel( self, self->s.v.model ); self->s.v.classname = "door"; self->s.v.blocked = ( func_t ) door_blocked; self->s.v.use = ( func_t ) door_use; if ( ( int ) ( self->s.v.spawnflags ) & DOOR_SILVER_KEY ) self->s.v.items = IT_KEY1; if ( ( int ) ( self->s.v.spawnflags ) & DOOR_GOLD_KEY ) self->s.v.items = IT_KEY2; if ( !self->speed ) self->speed = 100; if ( !self->wait ) self->wait = 3; if ( !self->lip ) self->lip = 8; if ( !self->dmg ) self->dmg = 2; VectorCopy( self->s.v.origin, self->pos1 ); // tmp = fabs( DotProduct( self->s.v.movedir, self->s.v.size ) ) - self->lip; self->pos2[0] = self->pos1[0] + self->s.v.movedir[0] * tmp; self->pos2[1] = self->pos1[1] + self->s.v.movedir[1] * tmp; self->pos2[2] = self->pos1[2] + self->s.v.movedir[2] * tmp; // DOOR_START_OPEN is to allow an entity to be lighted in the closed position // but spawn in the open position if ( ( int ) ( self->s.v.spawnflags ) & DOOR_START_OPEN ) { setorigin( self, PASSVEC3( self->pos2 ) ); VectorCopy( self->pos1, self->pos2 ); VectorCopy( self->s.v.origin, self->pos1 ); } self->state = STATE_BOTTOM; if ( self->s.v.health ) { self->s.v.takedamage = DAMAGE_YES; self->th_die = door_killed; } if ( self->s.v.items ) self->wait = -1; self->s.v.touch = ( func_t ) door_touch; // LinkDoors can't be done until all of the doors have been spawned, so // the sizes can be detected properly. self->s.v.think = ( func_t ) LinkDoors; self->s.v.nextthink = self->s.v.ltime + 0.1; }
void CLocusVariable::Spawn( void ) { SetMovedir(pev); }