Пример #1
0
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());
}
Пример #2
0
void DUH_WeaponReady(int frames, int *tics, __str ammo, int period)
{
   DUH_ArtifactReady(frames);

   while(frames--)
   {
      DUH_AmmoReady(++tics[ACS_PlayerNumber()], ammo, period);

      if(frames) ACS_Delay(1);
   }
}
Пример #3
0
ACS_S_SCRIPT void WaypointSpawn (void)
{
	if (!ACS_ActivatorTID())
		ACS_Thing_ChangeTID(0, ACS_UniqueTID(-32768, 0));
	int tid = ACS_ActivatorTID();
	ACS_SetActivatorToTarget(0);
	int plrNum = ACS_PlayerNumber();
	if (plrNum != -1)
	{
		player[plrNum].wayTid = tid;
		ACS_SetActorAngle(tid, player[plrNum].angle);
		ACS_SetActorPitch(tid, player[plrNum].pitch);
		ACS_SetActorProperty(player[plrNum].camTid, APROP_MasterTID, tid);
		ACS_GiveActorInventory(player[plrNum].camTid, s"ChaseCamWarp", 1);
		ACS_Delay(1);
		ACS_Thing_Remove(tid);
	}
	return;
}
Пример #4
0
// 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;
}
Пример #5
0
script
static void UpdateMagicUI(struct player *p, struct upgrade *upgr)
{
   struct gui_state *g = &UData.gst;

   G_Begin(g, 320, 240);
   G_UpdateState(g, p);

   PrintSprite(sp_UI_MagicSelectBack, 0,1, 0,1);

   bool any = false;

   for(i32 i = 0; i < countof(minf); i++)
   {
      struct magic_info const *m = &minf[i];

      if(m->st != -1 && !world.cbiupgr[m->st]) continue;

      char gfx[32] = ":UI:"; strcat(gfx, m->name);
      char hot[32] = ":UI:"; strcat(hot, m->name); strcat(hot, "Sel");

      struct gui_pre_btn pre = {
         .gfx      = gfx,
         .hot      = hot,
         .cdef     = "d",
         .cact     = "r",
         .chot     = "k",
         .cdis     = "m",
         .font     = s"cbifont",
         .snd      = s"player/cbi/buttonpress",
         .external = true,
         .w        = 64,
         .h        = 64
      };

      char name[128]; LanguageCV(name, LANG "INFO_SHORT_%s", m->name);

      if(G_Button_FId(g, i + 1, name, m->x, m->y, .preset = &pre))
         GiveMagic(m);
   }

   G_End(g, gui_curs_outline);
}

script
static void GivePlayerZ(i32 tid, struct player *p)
{
   while(ACS_ThingCount(T_NONE, tid)) {
      SetMembI(tid, sm_UserZ, p->z);
      ACS_Delay(1);
   }
}

static void SetMagicUI(struct player *p, bool on)
{
   if(p->dead) return;

   struct upgrade *upgr = p->getUpgr(UPGR_Magic);

   if(on)
   {
      UData.ui = true;
      p->semifrozen++;

      UData.gst.gfxprefix = ":UI:";
      UData.gst.cx = 320/2;
      UData.gst.cy = 240/2;

      G_Init(&UData.gst);
   }
   else if(!on && UData.ui)
   {
      if(UData.gst.hot) GiveMagic(&minf[UData.gst.hot - 1]);

      UData.ui = false;
      p->semifrozen--;

      memset(&UData.gst, 0, sizeof UData.gst);
   }
}

// Extern Functions ----------------------------------------------------------|

script
void Upgr_Magic_Update(struct player *p, struct upgrade *upgr)
{
   StrEntON
   k32 manaperc = p->mana / (k32)p->manamax;

   if(UData.manaperc < 1 && manaperc == 1)
      ACS_LocalAmbientSound(ss_player_manafull, 127);

   UData.manaperc = manaperc;

   if(p->buttons & BT_USER4 && !(p->old.buttons & BT_USER4))
      SetMagicUI(p, true);
   else if(!(p->buttons & BT_USER4) && p->old.buttons & BT_USER4)
      SetMagicUI(p, false);

   if(UData.ui)
      UpdateMagicUI(p, upgr);

   if(manaperc >= 0.7)
      for(i32 i = 0; i < 5 * manaperc; i++)
   {
      k32 dst = ACS_RandomFixed(32, 56);
      k32 ang = ACS_RandomFixed(0, 1);
      i32 tid = ACS_UniqueTID();
      i32 x   = ACS_Cos(ang) * dst;
      i32 y   = ACS_Sin(ang) * dst;
      i32 z   = ACS_Random(8, 48);
      ACS_Spawn(so_ManaLeak, p->x + x, p->y + y, p->z + z, tid);
      SetMembI(tid, sm_UserX, x);
      SetMembI(tid, sm_UserY, y);
      SetPropK(tid, APROP_Alpha, manaperc / 2);
      PtrSet(tid, AAPTR_DEFAULT, AAPTR_MASTER, p->tid);
      GivePlayerZ(tid, p);
   }
}
Пример #6
0
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);
   }
}