DEFINE_ACTION_FUNCTION(AActor, A_TossArm) { AActor *foo = Spawn("InquisitorArm", self->x, self->y, self->z + 24*FRACUNIT, ALLOW_REPLACE); foo->angle = self->angle - ANGLE_90 + (pr_inq.Random2() << 22); foo->velx = FixedMul (foo->Speed, finecosine[foo->angle >> ANGLETOFINESHIFT]) >> 3; foo->vely = FixedMul (foo->Speed, finesine[foo->angle >> ANGLETOFINESHIFT]) >> 3; foo->velz = pr_inq() << 10; }
void Shielder::Update() { fixed s = _power ? M_PT_ZERO_ONE * 12 : M_PT_ZERO_ONE * 4; Rotate( s ); GetShape( 9 ).Rotate( -2 * s ); for ( int i = 0; i < 8; i++ ) GetShape( i ).Rotate( -s ); bool onScreen = false; if ( GetPosition()._x < 0 ) _dir.Set( 1, 0 ); else if ( GetPosition()._x > Lib::WIDTH ) _dir.Set( -1, 0 ); else if ( GetPosition()._y < 0 ) _dir.Set( 0, 1 ); else if ( GetPosition()._y > Lib::HEIGHT ) _dir.Set( 0, -1 ); else onScreen = true; if ( !onScreen && _rotate ) { _timer = 0; _rotate = false; } fixed speed = SPEED + ( _power ? M_PT_ONE * 3 : M_PT_ONE * 2 ) * ( 16 - GetHP() ); if ( _rotate ) { Vec2 d( _dir ); d.Rotate( ( _rDir ? 1 : -1 ) * ( TIMER - _timer ) * M_PI / ( M_TWO * TIMER ) ); _timer--; if ( _timer <= 0 ) { _timer = 0; _rotate = false; _dir.Rotate( ( _rDir ? 1 : -1 ) * M_PI / M_TWO ); } Move( d * speed ); } else { _timer++; if ( _timer > TIMER * 2 ) { _timer = TIMER; _rotate = true; _rDir = GetLib().RandInt( 2 ) != 0; } if ( IsOnScreen() && _timer % TIMER == TIMER / 2 && _power ) { Player* p = GetNearestPlayer(); Vec2 v = GetPosition(); Vec2 d = p->GetPosition() - v; d.Normalise(); Spawn( new SBBossShot( v, d * M_THREE, 0x33cc99ff ) ); PlaySoundRandom( Lib::SOUND_BOSS_FIRE ); } Move( _dir * speed ); } _dir.Normalise(); }
int start4(char *arg) { int pid, status, i; char buf[12]; char name[] = "ChildS"; USLOSS_Console("start4(): Spawning 5 children to sleep\n"); for (i = 0; i < 5; i++) { sprintf(buf, "%d", i); name[5] = buf[0]; status = Spawn(name, ChildS, buf, USLOSS_MIN_STACK,2, &pid); } USLOSS_Console("start4(): Spawning 2 children to termfuncs\n"); status = Spawn("ChildTR", ChildTR, NULL, USLOSS_MIN_STACK,2, &pid); status = Spawn("ChildTW", ChildTW, NULL, USLOSS_MIN_STACK,2, &pid); USLOSS_Console("start4(): Spawning 4 children to diskfuncs\n"); status = Spawn("ChildDW0", ChildDW0, NULL, USLOSS_MIN_STACK,2, &pid); status = Spawn("ChildDW1", ChildDW1, NULL, USLOSS_MIN_STACK,2, &pid); status = Spawn("ChildDR0", ChildDR0, NULL, USLOSS_MIN_STACK,4, &pid); status = Spawn("ChildDR1", ChildDR1, NULL, USLOSS_MIN_STACK,4, &pid); for (i = 0; i < 11; i++) { Wait(&pid, &status); } USLOSS_Console("start4(): done.\n"); Terminate(1); return 0; } /* start4 */
extern void main( void ) /**********************/ { MemInit(); UtilsInit(); Spawn( DoConvert ); FreeMemory(); MemFini(); }
DEFINE_ACTION_FUNCTION(AActor, A_Bang4Cloud) { fixed_t spawnx, spawny; spawnx = self->x + (pr_bang4cloud.Random2() & 3) * 10240; spawny = self->y + (pr_bang4cloud.Random2() & 3) * 10240; Spawn("Bang4Cloud", spawnx, spawny, self->z, ALLOW_REPLACE); }
//this shouldn't really be in here, but the decision to launch an player happens in the 'DisplayProgress' function void LaunchPlayer() { char *Tempstr=NULL; Tempstr=MCopyStr(Tempstr,Player," ",OutputFilesGetFilePath(),NULL); PlayerPid=Spawn(Tempstr); DestroyString(Tempstr); }
int Child1(char *arg) { int pid, status; USLOSS_Console("Child1() starting\n"); Spawn("Child2", Child2, "Child2", USLOSS_MIN_STACK, 5, &pid); USLOSS_Console("Child1(): spawned process %d\n", pid); Wait(&pid, &status); USLOSS_Console("Child1(): child %d returned status of %d\n", pid, status); Spawn("Child3", Child2, "Child3", USLOSS_MIN_STACK, 5, &pid); USLOSS_Console("Child1(): spawned process %d\n", pid); Wait(&pid, &status); USLOSS_Console("Child1(): child %d returned status of %d\n", pid, status); USLOSS_Console("Child1(): done\n"); Terminate(9); return 0; } /* Child1 */
bool P_MorphMonster (AActor *actor, const PClass *spawntype, int duration, int style, const PClass *enter_flash, const PClass *exit_flash) { AMorphedMonster *morphed; if (actor == NULL || actor->player || spawntype == NULL || actor->flags3 & MF3_DONTMORPH || !(actor->flags3 & MF3_ISMONSTER) || !spawntype->IsDescendantOf (RUNTIME_CLASS(AMorphedMonster))) { return false; } morphed = static_cast<AMorphedMonster *>(Spawn (spawntype, actor->x, actor->y, actor->z, NO_REPLACE)); DObject::StaticPointerSubstitution (actor, morphed); morphed->tid = actor->tid; morphed->angle = actor->angle; morphed->UnmorphedMe = actor; morphed->alpha = actor->alpha; morphed->RenderStyle = actor->RenderStyle; morphed->Score = actor->Score; morphed->UnmorphTime = level.time + ((duration) ? duration : MORPHTICS) + pr_morphmonst(); morphed->MorphStyle = style; morphed->MorphExitFlash = (exit_flash) ? exit_flash : RUNTIME_CLASS(ATeleportFog); morphed->FlagsSave = actor->flags & ~MF_JUSTHIT; morphed->special = actor->special; memcpy (morphed->args, actor->args, sizeof(actor->args)); morphed->CopyFriendliness (actor, true); morphed->flags |= actor->flags & MF_SHADOW; morphed->flags3 |= actor->flags3 & MF3_GHOST; if (actor->renderflags & RF_INVISIBLE) { morphed->FlagsSave |= MF_JUSTHIT; } morphed->AddToHash (); actor->RemoveFromHash (); actor->special = 0; actor->tid = 0; actor->flags &= ~(MF_SOLID|MF_SHOOTABLE); actor->flags |= MF_UNMORPHED; actor->renderflags |= RF_INVISIBLE; Spawn(((enter_flash) ? enter_flash : RUNTIME_CLASS(ATeleportFog)), actor->x, actor->y, actor->z + TELEFOGHEIGHT, ALLOW_REPLACE); return true; }
virtual ActionResult<CTFBot> Update(CTFBot *actor, float dt) override { TRACE("[this: %08x] [actor: #%d]", (uintptr_t)this, ENTINDEX(actor)); if (this->m_hHint == nullptr) { return ActionResult<CTFBot>::Done("No hint entity"); } INextBot *nextbot = rtti_cast<INextBot *>(actor); if (nextbot->IsRangeGreaterThan(this->m_hHint->GetAbsOrigin(), 25.0f)) { TRACE_MSG("range_to_hint > 25: pathing\n"); if (this->m_ctRecomputePath.IsElapsed()) { TRACE_MSG("recomputing path\n"); this->m_ctRecomputePath.Start(RandomFloat(1.0f, 2.0f)); CTFBotPathCost cost_func(actor, FASTEST_ROUTE); this->m_PathFollower.Compute(nextbot, this->m_hHint->GetAbsOrigin(), cost_func, 0.0f, true); } this->m_PathFollower.Update(nextbot); if (!this->m_PathFollower.IsValid()) { return ActionResult<CTFBot>::Done("Path failed"); } return ActionResult<CTFBot>::Continue(); } TRACE_MSG("at hint: creating dispenser entity\n"); CBaseEntity *ent = CreateEntityByName("obj_dispenser"); if (ent == nullptr) { return ActionResult<CTFBot>::Done("Couldn't create entity"); } auto dispenser = rtti_cast<CObjectDispenser *>(ent); dispenser->SetName(this->m_hHint->GetEntityName()); dispenser->m_nDefaultUpgradeLevel = 2; dispenser->SetAbsOrigin(this->m_hHint->GetAbsOrigin()); dispenser->SetAbsAngles(this->m_hHint->GetAbsAngles()); dispenser->Spawn(); dispenser->StartPlacement(actor); suppress_speak = true; dispenser->StartBuilding(actor); suppress_speak = false; this->m_hHint->SetOwnerEntity(dispenser); actor->SpeakConceptIfAllowed(MP_CONCEPT_BUILDING_OBJECT, "objtype:dispenser"); return ActionResult<CTFBot>::Done("Built a dispenser"); }
int main( int argc, char *argv[] ) { //====================================== // Call user's program. argc = argc; argv = argv; RTSysInit(); Spawn( &FMAIN ); return( 0 ); }
DEFINE_ACTION_FUNCTION(AActor, A_BishopPuff) { AActor *mo; mo = Spawn ("BishopPuff", self->PosPlusZ(40*FRACUNIT), ALLOW_REPLACE); if (mo) { mo->velz = FRACUNIT/2; } }
bool ProcInput( void ) { bool ret; _SwitchOn( SW_WND_DOING_INPUT ); ret = Spawn( DoProcPending ); DUIProcPendingPaint(); _SwitchOff( SW_WND_DOING_INPUT ); return( ret ); }
DEFINE_ACTION_FUNCTION(AActor, A_SorcererRise) { AActor *mo; self->flags &= ~MF_SOLID; mo = Spawn("Sorcerer2", self->x, self->y, self->z, ALLOW_REPLACE); mo->SetState (mo->FindState("Rise")); mo->angle = self->angle; mo->CopyFriendliness (self, true); }
void CSDKPlayer::State_Enter_ACTIVE() { SetMoveType( MOVETYPE_WALK ); RemoveSolidFlags( FSOLID_NOT_SOLID ); m_Local.m_iHideHUD = 0; PhysObjectWake(); //Tony; call spawn again now -- remember; when we add respawn timers etc, to just put them into the spawn queue, and let the queue respawn them. Spawn(); }
void P_SpawnTeleportFog(fixed_t x, fixed_t y, fixed_t z, int spawnid) { const PClass *fog=NULL; if (spawnid > 0 && spawnid < MAX_SPAWNABLES && SpawnableThings[spawnid] != NULL) { fog = SpawnableThings[spawnid]; } if (fog == NULL) { AActor *mo = Spawn ("TeleportFog", x, y, z + TELEFOGHEIGHT, ALLOW_REPLACE); } else { AActor *mo = Spawn (fog, x, y, z, ALLOW_REPLACE); if (mo != NULL) S_Sound(mo, CHAN_BODY, mo->SeeSound, 1.f, ATTN_NORM); } }
DEFINE_ACTION_FUNCTION(AActor, A_TossArm) { PARAM_ACTION_PROLOGUE; AActor *foo = Spawn("InquisitorArm", self->PosPlusZ(24.), ALLOW_REPLACE); foo->Angles.Yaw = self->Angles.Yaw - 90. + pr_inq.Random2() * (360./1024.); foo->VelFromAngle(foo->Speed / 8); foo->Vel.Z = pr_inq() / 64.; return 0; }
DEFINE_ACTION_FUNCTION(AActor, A_SpectralLightningTail) { PARAM_ACTION_PROLOGUE; AActor *foo = Spawn("SpectralLightningHTail", self->Vec3Offset(-self->Vel.X, -self->Vel.Y, 0.), ALLOW_REPLACE); foo->Angles.Yaw = self->Angles.Yaw; foo->FriendPlayer = self->FriendPlayer; return 0; }
DEFINE_ACTION_FUNCTION(AActor, A_SpawnProgrammerBase) { AActor *foo = Spawn("ProgrammerBase", self->PosPlusZ(24*FRACUNIT), ALLOW_REPLACE); if (foo != NULL) { foo->angle = self->angle + ANGLE_180 + (pr_prog.Random2() << 22); foo->velx = FixedMul (foo->Speed, finecosine[foo->angle >> ANGLETOFINESHIFT]); foo->vely = FixedMul (foo->Speed, finesine[foo->angle >> ANGLETOFINESHIFT]); foo->velz = pr_prog() << 9; }
DEFINE_ACTION_FUNCTION(AActor, A_BishopPuff) { AActor *mo; mo = Spawn ("BishopPuff", self->x, self->y, self->z + 40*FRACUNIT, ALLOW_REPLACE); if (mo) { mo->momz = FRACUNIT/2; } }
int main( void ) /**********************/ { MemInit(); UtilsInit(); Spawn( DoConvert ); FreeMemory(); MemFini(); return( 0 ); }
void GiveSpawner (player_t *player, const PClass *type, int amount) { if (player->mo == NULL || player->health <= 0) { return; } AInventory *item = static_cast<AInventory *> (Spawn (type, player->mo->x, player->mo->y, player->mo->z, NO_REPLACE)); if (item != NULL) { if (amount > 0) { if (type->IsDescendantOf (RUNTIME_CLASS(ABasicArmorPickup))) { if (static_cast<ABasicArmorPickup*>(item)->SaveAmount != 0) { static_cast<ABasicArmorPickup*>(item)->SaveAmount *= amount; } else { static_cast<ABasicArmorPickup*>(item)->SaveAmount *= amount; } } else if (type->IsDescendantOf (RUNTIME_CLASS(ABasicArmorBonus))) { static_cast<ABasicArmorBonus*>(item)->SaveAmount *= amount; // [BB] static_cast<ABasicArmorBonus*>(item)->BonusCount *= amount; } else { item->Amount = MIN (amount, item->MaxAmount); } } if(item->flags & MF_COUNTITEM) // Given items shouldn't count against the map's total, { // since they aren't added to the player's total. level.total_items--; item->flags &= ~MF_COUNTITEM; } if (!item->CallTryPickup (player->mo)) { item->Destroy (); } else { // [BB] This construction is more or less a hack, but at least the give cheats are now working. SERVER_GiveInventoryToPlayer( player, item ); // [BC] Play the announcer sound. if ( players[consoleplayer].camera == players[consoleplayer].mo && cl_announcepickups ) ANNOUNCER_PlayEntry( cl_announcer, item->PickupAnnouncerEntry( )); } } }
pid_t RunEventScript(STREAM *S, const char *Script) { if (Spawn(Script,Settings.DefaultUser,"",NULL) ==-1) { LogToFile(Settings.LogPath, "ERROR: Failed to run event script '%s'. Error was: %s",Script, strerror(errno)); } else LogToFile(Settings.LogPath, "Script: '%s'. Error was: %s",Script, strerror(errno)); STREAMWriteLine("okay\n",S); return(0); }
DEFINE_ACTION_FUNCTION(AActor, A_SpawnEntity) { AActor *entity = Spawn("EntityBoss", self->x, self->y, self->z + 70*FRACUNIT, ALLOW_REPLACE); if (entity != NULL) { entity->angle = self->angle; entity->CopyFriendliness(self, true); entity->velz = 5*FRACUNIT; entity->tracer = self; } }
DEFINE_ACTION_FUNCTION(AActor, A_DripBlood) { AActor *mo; fixed_t xo = (pr_dripblood.Random2() << 11); fixed_t yo = (pr_dripblood.Random2() << 11); mo = Spawn ("Blood", self->Vec3Offset(xo, yo, 0), ALLOW_REPLACE); mo->velx = pr_dripblood.Random2 () << 10; mo->vely = pr_dripblood.Random2 () << 10; mo->gravity = FRACUNIT/8; }
DEFINE_ACTION_FUNCTION(AActor, A_ImpExplode) { AActor *chunk; self->flags &= ~MF_NOGRAVITY; chunk = Spawn("HereticImpChunk1", self->Pos(), ALLOW_REPLACE); chunk->velx = pr_imp.Random2 () << 10; chunk->vely = pr_imp.Random2 () << 10; chunk->velz = 9*FRACUNIT; chunk = Spawn("HereticImpChunk2", self->Pos(), ALLOW_REPLACE); chunk->velx = pr_imp.Random2 () << 10; chunk->vely = pr_imp.Random2 () << 10; chunk->velz = 9*FRACUNIT; if (self->special1 == 666) { // Extreme death crash self->SetState (self->FindState("XCrash")); } }
END_CLASS /* ================ rvClientEffect::rvClientEffect ================ */ rvClientEffect::rvClientEffect ( void ) { Init( NULL ); Spawn(); }
AInventory *ACoin::CreateTossable () { ACoin *tossed; if ((ItemFlags & IF_UNDROPPABLE) || Owner == NULL || Amount <= 0) { return NULL; } if (Amount >= 50) { Amount -= 50; tossed = static_cast<ACoin*>(Spawn("Gold50", Owner->Pos(), NO_REPLACE)); } else if (Amount >= 25) { Amount -= 25; tossed = static_cast<ACoin*>(Spawn("Gold25", Owner->Pos(), NO_REPLACE)); } else if (Amount >= 10) { Amount -= 10; tossed = static_cast<ACoin*>(Spawn("Gold10", Owner->Pos(), NO_REPLACE)); } else if (Amount > 1 || (ItemFlags & IF_KEEPDEPLETED)) { Amount -= 1; tossed = static_cast<ACoin*>(Spawn("Coin", Owner->Pos(), NO_REPLACE)); } else // Amount == 1 && !(ItemFlags & IF_KEEPDEPLETED) { BecomePickup (); tossed = this; } tossed->flags &= ~(MF_SPECIAL|MF_SOLID); tossed->DropTime = 30; if (tossed != this && Amount <= 0) { Destroy (); } return tossed; }
DEFINE_ACTION_FUNCTION(AActor, A_EntityDeath) { AActor *second; fixed_t secondRadius = GetDefaultByName("EntitySecond")->radius * 2; angle_t an; AActor *spot = self->tracer; if (spot == NULL) spot = self; fixed_t SpawnX = spot->x; fixed_t SpawnY = spot->y; fixed_t SpawnZ = spot->z + self->tracer? 70*FRACUNIT : 0; an = self->angle >> ANGLETOFINESHIFT; second = Spawn("EntitySecond", SpawnX + FixedMul (secondRadius, finecosine[an]), SpawnY + FixedMul (secondRadius, finesine[an]), SpawnZ, ALLOW_REPLACE); second->CopyFriendliness(self, true); //second->target = self->target; A_FaceTarget (second); an = second->angle >> ANGLETOFINESHIFT; second->velx += FixedMul (finecosine[an], 320000); second->vely += FixedMul (finesine[an], 320000); an = (self->angle + ANGLE_90) >> ANGLETOFINESHIFT; second = Spawn("EntitySecond", SpawnX + FixedMul (secondRadius, finecosine[an]), SpawnY + FixedMul (secondRadius, finesine[an]), SpawnZ, ALLOW_REPLACE); second->CopyFriendliness(self, true); //second->target = self->target; second->velx = FixedMul (secondRadius, finecosine[an]) << 2; second->vely = FixedMul (secondRadius, finesine[an]) << 2; A_FaceTarget (second); an = (self->angle - ANGLE_90) >> ANGLETOFINESHIFT; second = Spawn("EntitySecond", SpawnX + FixedMul (secondRadius, finecosine[an]), SpawnY + FixedMul (secondRadius, finesine[an]), SpawnZ, ALLOW_REPLACE); second->CopyFriendliness(self, true); //second->target = self->target; second->velx = FixedMul (secondRadius, finecosine[an]) << 2; second->vely = FixedMul (secondRadius, finesine[an]) << 2; A_FaceTarget (second); }
int start3(char *arg) { int pid; printf("start3(): started. Calling Spawn for Child1\n"); Spawn("Child1", Child1, NULL, USLOSS_MIN_STACK, 2, &pid); printf("start3(): after spawn of %d\n", pid); printf("start3(): Parent done. Calling Terminate.\n"); Terminate(8); return 0; } /* start3 */
bool duplicate ( CLxLoc_Shader &acc) { LXtObjectID obj; acc.clear (); if (LXx_FAIL (Spawn (&obj))) return false; return acc.take (obj); }