ACS_S_SCRIPT int GetChaseCamPos (int xyz) { int plrNum = -1; accum vz, sz, h, ch, d; // Hacky, but I can't think of another way. // Iterate through camera TIDs to find our player number. for (int i = 0; i < MAX_PLAYERS; i++) { if (player[i].camTid == ACS_ActivatorTID()) plrNum = i; } if (plrNum == -1) return 0; if (xyz == 0) return (int)ACS_GetActorX(player[plrNum].wayTid); if (xyz == 1) return (int)ACS_GetActorY(player[plrNum].wayTid); if (xyz == 2) { d = ACS_GetCVarFixed(s"chase_dist"); h = ACS_GetActorPropertyFixed(player[plrNum].tid, APROP_Height); ch = ACS_GetCVarFixed(s"chase_height"); vz = ACS_Sin(player[plrNum].pitch); sz = h + ch; return (int)(ACS_GetActorZ(player[plrNum].tid) + sz + (vz * d)); } }
void DUH_HellstaffStorm(void) { accum basex = ACS_GetActorX(0); accum basey = ACS_GetActorY(0); accum basez = ACS_GetActorCeilingZ(0) - 12; int shooter = ACS_GetUserVariable(0, s"user_shooter"); int tics = ACS_GetUserVariable(0, s"user_stormTics"); while(tics) { accum x = basex + ACS_RandomFixed(-64, 64); accum y = basey + ACS_RandomFixed(-64, 64); accum z = basez; int tid = DU_MakeTID(); // Hack to not kill projectile if shooting from water. accum shooterx = ACS_GetActorX(shooter); accum shootery = ACS_GetActorY(shooter); accum shooterz = ACS_GetActorZ(shooter); ACS_SetActorPosition(shooter, shooterx, shootery, shooterz+16, false); ACS_SpawnProjectile(shooter, s"DUH_HellstaffMissile3", 0, 0, 0, 0, tid); if(ACS_SetActorPosition(tid, x, y, z, false)) { ACS_SetActorVelocity(tid, 0, 0, -5, false, false); --tics; } else ACS_Thing_Remove(tid); ACS_SetActorPosition(shooter, shooterx, shootery, shooterz, false); ACS_Delay(1); } ACS_Delay(23); ACS_Thing_Remove(ACS_ActivatorTID()); }
// Scripts ACS_S_SCRIPT ENTER void CameraMain (void) { int plrHealth, camType, plrNum = ACS_PlayerNumber(); accum plrAngle = ACS_GetActorAngle(0); player[plrNum].angle = plrAngle; if (!ACS_ActivatorTID()) ACS_Thing_ChangeTID(0, ACS_UniqueTID(-32678, 0)); player[plrNum].tid = ACS_ActivatorTID(); player[plrNum].camTid = ACS_UniqueTID(-32768, 0); ACS_SpawnForced(s"ChaseCam", ACS_GetActorX(0), ACS_GetActorY(0), ACS_GetActorZ(0), player[plrNum].camTid, player[plrNum].angle); while (true) { plrHealth = ACS_GetActorProperty(0, APROP_Health); player[plrNum].angle += ACS_GetPlayerInputFixed(-1, INPUT_YAW); player[plrNum].pitch -= ACS_GetPlayerInputFixed(-1, INPUT_PITCH); if (player[plrNum].pitch > PITCH_LIMIT) player[plrNum].pitch = PITCH_LIMIT; if (player[plrNum].pitch < -PITCH_LIMIT) player[plrNum].pitch = -PITCH_LIMIT; ACS_LineAttack(0, player[plrNum].angle + 0.5k, -player[plrNum].pitch, 0, s"ChaseCamWaypoint", s"", ACS_GetCVarFixed(s"chase_dist"), FHF_NORANDOMPUFFZ); ACS_SetActorAngle(player[plrNum].camTid, player[plrNum].angle); ACS_SetActorPitch(player[plrNum].camTid, player[plrNum].pitch); camType = ACS_GetUserCVar(plrNum, s"chase_camtype"); if (plrHealth) { switch (camType) { default: case 1: plrAngle = player[plrNum].angle; break; case 2: if (KeyDown(BT_FORWARD) || KeyDown(BT_BACK) || KeyDown(BT_MOVELEFT) || KeyDown(BT_MOVERIGHT) || KeyDown(BT_ATTACK) || KeyDown(BT_ALTATTACK)) plrAngle = player[plrNum].angle; break; case 3: if (KeyDown(BT_FORWARD) || KeyDown(BT_BACK) || KeyDown(BT_MOVELEFT) || KeyDown(BT_MOVERIGHT)) plrAngle = player[plrNum].angle; break; } } if (ACS_GetUserCVar(plrNum, s"chase_active")) ACS_ChangeCamera(player[plrNum].camTid, 0, 0); else { if (plrHealth) plrAngle = player[plrNum].angle; ACS_ChangeCamera(0, 0, 0); } ACS_SetActorAngle(0, plrAngle); ACS_SetActorPitch(0, player[plrNum].pitch); ACS_Delay(1); } return; }
void DUH_ArtifactReady(int frames) { static int tics[MAX_PLAYERS]; while(frames--) { int tic = ++tics[ACS_PlayerNumber()]; int inv; int tid = ACS_ActivatorTID(); if(!tid) ACS_Thing_ChangeTID(0, tid = DU_MakeTID()); inv = ACS_CheckInventory(s"ArtiEgg"); if(inv > 256) inv = 256; if(inv && !(tic % ((35 * 256) / inv))) ACS_Spawn(s"DUH_ChickenFriend", ACS_GetActorX(0), ACS_GetActorY(0), ACS_GetActorZ(0) + 56, 0, ACS_GetActorAngle(0)*256); inv = ACS_CheckInventory(s"ArtiFly"); if(inv > 0x7FFF - 8) inv = 0x7FFF - 8; ACS_SetActorPropertyFixed(0, APROP_JumpZ, inv + 8.0k); inv = ACS_CheckInventory(s"ArtiHealth"); if(inv > 35 * 4) inv = 35 * 4; if(inv && !(tic % ((35 * 4) / inv))) ACS_GiveInventory(s"Health", 1); inv = ACS_CheckInventory(s"ArtiInvisibility"); if(inv > 35 * 8) inv = 35 * 8; if(inv && !(tic % ((35 * 8) / inv))) ACS_GiveInventory(s"DUH_ArmorBonus", 1); inv = ACS_CheckInventory(s"ArtiInvulnerability"); if(inv > 35 * 1) inv = 35 * 1; if(inv && !(tic % ((35 * 1) / inv))) ACS_GiveInventory(s"DUH_ArmorBonus", 1); inv = ACS_CheckInventory(s"ArtiSuperHealth") + 4; if(inv > 0x7FFFFFFF / 25) inv = 0x7FFFFFFF / 25; ACS_SetActorProperty(0, APROP_SpawnHealth, inv * 25); inv = ACS_CheckInventory(s"ArtiTeleport"); if(inv > 16) inv = 16; ACS_SetActorPropertyFixed(0, APROP_Speed, (inv / 10.0) + 1.0); inv = ACS_CheckInventory(s"ArtiTimeBomb"); if(inv > 35 * 16) inv = 35 * 16; if(inv && !(tic % ((35 * 16) / inv))) ACS_SpawnProjectile(tid, s"DUH_TimeBombAura", 0, 0, 0, 0, 0); inv = ACS_CheckInventory(s"DUH_BagOfHolding") + 4; if(inv > 16) inv = 16; DUH_ArtifactTomeReady(DUH_ElvenWandAmmo, inv * 50); DUH_ArtifactTomeReady(DUH_CrossbowAmmo, inv * 25); DUH_ArtifactTomeReady(DUH_DragonClawAmmo, inv * 100); DUH_ArtifactTomeReady(DUH_HellstaffAmmo, inv * 100); DUH_ArtifactTomeReady(DUH_PhoenixRodAmmo, inv * 10); DUH_ArtifactTomeReady(DUH_FiremaceAmmo, inv * 75); inv = ACS_CheckInventory(s"ArtiTorch"); if(inv > 64) inv = 64; if(inv && !(tic % ((35 * 64) / inv))) ACS_GiveInventory(s"ArtiTorch", 1); DUH_AmmoReady(tic, DUH_ElvenWandAmmo, 350); DUH_AmmoReady(tic, DUH_CrossbowAmmo, 1750); DUH_AmmoReady(tic, DUH_DragonClawAmmo, 700); DUH_AmmoReady(tic, DUH_HellstaffAmmo, 1050); DUH_AmmoReady(tic, DUH_PhoenixRodAmmo, 3500); DUH_AmmoReady(tic, DUH_FiremaceAmmo, 7000); if(frames) ACS_Delay(1); } }