void AScriptedMarine::BeginPlay () { Super::BeginPlay (); // Set the current weapon for(int i=WEAPON_Dummy; i<=WEAPON_BFG; i++) { FState *melee, *missile; if (GetWeaponStates(i, melee, missile)) { if (melee == MeleeState && missile == MissileState) { CurrentWeapon = i; } } } // Copy the standard player's scaling AActor * playerdef = GetDefaultByName("DoomPlayer"); if (playerdef != NULL) { scaleX = playerdef->scaleX; scaleY = playerdef->scaleY; } }
int ASigil::GiveSigilPiece (AActor *receiver) { ASigil *sigil; sigil = receiver->FindInventory<ASigil> (); if (sigil == NULL) { sigil = static_cast<ASigil*>(Spawn("Sigil1")); if (!sigil->CallTryPickup (receiver)) { sigil->Destroy (); } return 0; } else if (sigil->NumPieces < 5) { ++sigil->NumPieces; static const char* sigils[5] = { "Sigil1", "Sigil2", "Sigil3", "Sigil4", "Sigil5" }; sigil->Icon = ((AInventory*)GetDefaultByName (sigils[MAX(0,sigil->NumPieces-1)]))->Icon; // If the player has the Sigil out, drop it and bring it back up. if (sigil->Owner->player != NULL && sigil->Owner->player->ReadyWeapon == sigil) { sigil->Owner->player->PendingWeapon = sigil; sigil->DownPieces = sigil->NumPieces - 1; } return sigil->NumPieces - 1; } else { return 5; } }
DEFINE_ACTION_FUNCTION(AActor, A_WraithRaise) { if (A_RaiseMobj (self, 2*FRACUNIT)) { // Reached it's target height // [RH] Once a buried wraith is fully raised, it should be // morphable, right? self->flags3 &= ~(MF3_DONTMORPH|MF3_SPECIALFLOORCLIP); self->SetState (self->FindState("Chase")); // [RH] Reset PainChance to a normal wraith's. self->PainChance = GetDefaultByName ("Wraith")->PainChance; } P_SpawnDirt (self, self->radius); }
angle_t DBot::FireRox (AActor *enemy, ticcmd_t *cmd) { fixed_t dist; angle_t ang; AActor *actor; int m; bglobal.SetBodyAt (player->mo->X() + FixedMul(player->mo->velx, 5*FRACUNIT), player->mo->Y() + FixedMul(player->mo->vely, 5*FRACUNIT), player->mo->Z() + (player->mo->height / 2), 2); actor = bglobal.body2; dist = actor->AproxDistance (enemy); if (dist < SAFE_SELF_MISDIST) return 0; //Predict. m = (((dist+1)/FRACUNIT) / GetDefaultByName("Rocket")->Speed); bglobal.SetBodyAt (enemy->X() + FixedMul(enemy->velx, (m+2*FRACUNIT)), enemy->Y() + FixedMul(enemy->vely, (m+2*FRACUNIT)), ONFLOORZ, 1); //try the predicted location if (P_CheckSight (actor, bglobal.body1, SF_IGNOREVISIBILITY)) //See the predicted location, so give a test missile { FCheckPosition tm; if (bglobal.SafeCheckPosition (player->mo, actor->X(), actor->Y(), tm)) { if (bglobal.FakeFire (actor, bglobal.body1, cmd) >= SAFE_SELF_MISDIST) { ang = actor->AngleTo(bglobal.body1); return ang; } } } //Try fire straight. if (P_CheckSight (actor, enemy, 0)) { if (bglobal.FakeFire (player->mo, enemy, cmd) >= SAFE_SELF_MISDIST) { ang = player->mo->AngleTo(enemy); return ang; } } return 0; }
void AScriptedMarine::SetSprite (const PClass *source) { if (source == NULL || source->ActorInfo == NULL) { // A valid actor class wasn't passed, so use the standard sprite SpriteOverride = sprite = GetClass()->ActorInfo->OwnedStates[0].sprite; // Copy the standard player's scaling AActor * playerdef = GetDefaultByName("DoomPlayer"); if (playerdef == NULL) playerdef = GetDefaultByType(RUNTIME_CLASS(AScriptedMarine)); scaleX = playerdef->scaleX; scaleY = playerdef->scaleY; } else { // Use the same sprite the passed class spawns with SpriteOverride = sprite = GetDefaultByType (source)->SpawnState->sprite; scaleX = GetDefaultByType(source)->scaleX; scaleY = GetDefaultByType(source)->scaleY; } }
DEFINE_ACTION_FUNCTION(AActor, A_MaulerTorpedoWave) { AActor *wavedef = GetDefaultByName("MaulerTorpedoWave"); fixed_t savedz; self->angle += ANGLE_180; // If the torpedo hit the ceiling, it should still spawn the wave savedz = self->Z(); if (wavedef && self->ceilingz - self->Z() < wavedef->height) { self->SetZ(self->ceilingz - wavedef->height); } for (int i = 0; i < 80; ++i) { self->angle += ANGLE_45/10; P_SpawnSubMissile (self, PClass::FindClass("MaulerTorpedoWave"), self->target); } self->SetZ(savedz); }
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); }
DEFINE_ACTION_FUNCTION(AActor, A_MaulerTorpedoWave) { PARAM_ACTION_PROLOGUE; AActor *wavedef = GetDefaultByName("MaulerTorpedoWave"); double savedz; self->Angles.Yaw += 180.; // If the torpedo hit the ceiling, it should still spawn the wave savedz = self->Z(); if (wavedef && self->ceilingz < self->Z() + wavedef->Height) { self->SetZ(self->ceilingz - wavedef->Height); } for (int i = 0; i < 80; ++i) { self->Angles.Yaw += 4.5; P_SpawnSubMissile (self, PClass::FindActor("MaulerTorpedoWave"), self->target); } self->SetZ(savedz); return 0; }
// set the bot specific weapon information // This is intentionally not in the weapon definition anymore. void InitBotStuff() { static struct BotInit { const char *type; int movecombatdist; int weaponflags; const char *projectile; } botinits[] = { { "Pistol", 25000000, 0, NULL }, { "Shotgun", 24000000, 0, NULL }, { "SuperShotgun", 15000000, 0, NULL }, { "Chaingun", 27000000, 0, NULL }, { "RocketLauncher", 18350080, WIF_BOT_REACTION_SKILL_THING|WIF_BOT_EXPLOSIVE, "Rocket" }, { "PlasmaRifle", 27000000, 0, "PlasmaBall" }, { "BFG9000", 10000000, WIF_BOT_REACTION_SKILL_THING|WIF_BOT_BFG, "BFGBall" }, { "GoldWand", 25000000, 0, NULL }, { "GoldWandPowered", 25000000, 0, NULL }, { "Crossbow", 24000000, 0, "CrossbowFX1" }, { "CrossbowPowered", 24000000, 0, "CrossbowFX2" }, { "Blaster", 27000000, 0, NULL }, { "BlasterPowered", 27000000, 0, "BlasterFX1" }, { "SkullRod", 27000000, 0, "HornRodFX1" }, { "SkullRodPowered", 27000000, 0, "HornRodFX2" }, { "PhoenixRod", 18350080, WIF_BOT_REACTION_SKILL_THING|WIF_BOT_EXPLOSIVE, "PhoenixFX1" }, { "Mace", 27000000, WIF_BOT_REACTION_SKILL_THING, "MaceFX2" }, { "MacePowered", 27000000, WIF_BOT_REACTION_SKILL_THING|WIF_BOT_EXPLOSIVE, "MaceFX4" }, { "FWeapHammer", 22000000, 0, "HammerMissile" }, { "FWeapQuietus", 20000000, 0, "FSwordMissile" }, { "CWeapStaff", 25000000, 0, "CStaffMissile" }, { "CWeapFlane", 27000000, 0, "CFlameMissile" }, { "MWeapWand", 25000000, 0, "MageWandMissile" }, { "CWeapWraithverge", 22000000, 0, "HolyMissile" }, { "MWeapFrost", 19000000, 0, "FrostMissile" }, { "MWeapLightning", 23000000, 0, "LightningFloor" }, { "MWeapBloodscourge", 20000000, 0, "MageStaffFX2" }, { "StrifeCrossbow", 24000000, 0, "ElectricBolt" }, { "StrifeCrossbow2", 24000000, 0, "PoisonBolt" }, { "AssaultGun", 27000000, 0, NULL }, { "MiniMissileLauncher", 18350080, WIF_BOT_REACTION_SKILL_THING|WIF_BOT_EXPLOSIVE, "MiniMissile" }, { "FlameThrower", 24000000, 0, "FlameMissile" }, { "Mauler", 15000000, 0, NULL }, { "Mauler2", 10000000, 0, "MaulerTorpedo" }, { "StrifeGrenadeLauncher", 18350080, WIF_BOT_REACTION_SKILL_THING|WIF_BOT_EXPLOSIVE, "HEGrenade" }, { "StrifeGrenadeLauncher2", 18350080, WIF_BOT_REACTION_SKILL_THING|WIF_BOT_EXPLOSIVE, "PhosphorousGrenade" }, }; for(unsigned i=0;i<sizeof(botinits)/sizeof(botinits[0]);i++) { const PClass *cls = PClass::FindClass(botinits[i].type); if (cls != NULL && cls->IsDescendantOf(RUNTIME_CLASS(AWeapon))) { AWeapon *w = (AWeapon*)GetDefaultByType(cls); if (w != NULL) { w->MoveCombatDist = botinits[i].movecombatdist/65536.; w->WeaponFlags |= botinits[i].weaponflags; w->ProjectileType = PClass::FindActor(botinits[i].projectile); } } } static const char *warnbotmissiles[] = { "PlasmaBall", "Ripper", "HornRodFX1" }; for(unsigned i=0;i<countof(warnbotmissiles);i++) { AActor *a = GetDefaultByName (warnbotmissiles[i]); if (a != NULL) { a->flags3|=MF3_WARNBOT; } } }