Beispiel #1
0
// evaluate the value a position (p,q) in image coordinates
static void pixel(float *out, struct pan_state *e, double p, double q)
{
	//if(p<0||q<0){out[0]=out[1]=out[2]=170;return;}// TODO: kill this
	//if(p>=e->i->w||q>=e->i->h){out[0]=out[1]=out[2]=85;return;}
	if (p < 0 || q < 0 || p >= e->i->w || q >= e->i->h) {
		int ip = p+256;
		int iq = q+256;
		int pip = gmod(ip/256, 2);
		int piq = gmod(iq/256, 2);
		int val = gmod(pip+piq,2);
		out[0] = out[1] = out[2] = 127+val*64;
		return;
	}

	int oct = 0;
	if (e->zoom_factor < 0.9999)
	{
		int s = round(log2(1/e->zoom_factor));
		if (s < 0) s = 0;
		if (s >= MAX_PYRAMID_LEVELS) s = MAX_PYRAMID_LEVELS-1;
		int sfac = 1<<(s);
		oct = s;
		p /= sfac;
		q /= sfac;
	}
	for (int i = 0; i < e->i->pd; i++)
	{
		// TODO, interpolation
		out[i] = fancy_image_getsample_oct(e->i, oct, p, q, i);
	}
}
Beispiel #2
0
// extrapolate by periodicity
inline
static float getsample_per(float *x, int w, int h, int pd, int i, int j, int l)
{
	i = gmod(i, w);
	j = gmod(j, h);
	return getsample_abort(x, w, h, pd, i, j, l);
}
Beispiel #3
0
/* K a bnf. Compute kernel \tilde{Cl}_K(ell); return cyclic factors.
 * Set *pM to (vtilde_S[i](US[j]))_{i,j} */
static GEN
CL_tilde(GEN K, GEN US, GEN ell, GEN T, GEN Ftilde, GEN *pM, long prec)
{
  GEN D, M, ellk, vdegS;
  long i, j, imin, vmin, k, lD, l = lg(T), lU = lg(US);

  *pM = cgetg(1, t_MAT);
  if (l == 2) return cgetg(1, t_VEC); /* p = P^e: \tilde{Cl}(l) = (1) */
  vdegS = get_vdegS(Ftilde, ell, prec);
  imin = 1; vmin = l; /* upper bound */
  for (i = 1; i < l; i++)
  {
    long v = z_pval(Ftilde[i], ell);
    if (v < vmin) { vmin = v; imin = i; }
  }
  M = cgetg(lU, t_MAT);
  for (j = 1; j < lU; j++)
  {
    GEN c = cgetg(l, t_COL), a = gel(US,j);
    for (i = 1; i < l; i++)
      gel(c,i) = vtilde(K, a, gel(T,i), gel(vdegS,i), ell, prec);
    gel(M,j) = c;
  }
  k = padicprec(M, ell); ellk = powiu(ell, k);
  *pM = M = gmod(M, ellk);
  M = rowsplice(M, imin);
  l--;
  if (l == 1) return cgetg(1, t_VEC);
  M = ZM_hnfmodid(M, ellk);
  D = matsnf0(M, 4); lD = lg(D);
  if (lD > 1 && Z_pval(gel(D,1), ell) >= k) return NULL;
  return D;
}
Beispiel #4
0
int do_factor(GEN n, long prec)
{
	pari_sp ltop;
	GEN sq = gfloor(gsqrt(n, prec));
	GEN q = stoi(2);

	ltop = avma;
	for (;;) {
		if (cmpii(q, sq) > 0)
			return -1;

		if (equalsi(0, gmod(n, q))) {
			pari_printf("%Ps = %Ps * %Ps\n", n, q, gdiv(n, q));
			return 0;
		}
		gaddz(gen_1, q, q);
		avma = ltop;
	}
}
Beispiel #5
0
bool aimbot::Think(CUserCmd* cmd)
{
	float best = std::numeric_limits<float>::quiet_NaN();

	if (css())
	{
		if (!GetMaterialParameters)
			GetMaterialParameters = (void (__cdecl*)(int, float&, float&))util::FindPattern("client", "\x55\x8B\xEC\x8B\x45\x08\x83\xC0\xBD");

		if (!GetBulletTypeParameters)
			GetBulletTypeParameters = (void (__stdcall*)(int, float&, float&))util::FindPattern("client",
				"\x55\x8B\xEC\x56\x8B\x75\x08\x68????\x56\xE8????\x83\xC4\x08\x84\xC0"
			);
	}

	if (!bf)
		bf = new BulletFilter();

	target_id = 0;
	bf->hSelf = lp;

	Vector sp = lp->GetShootPos();
	Vector tp = Vector();

	CBaseEntity* w = lp->GetActiveWeapon();

	if (gmod() && MENU_SPAWPROT == 3 && ALPHA(lp->GetMDLColor()) == 200)
		return 0;

	int lteam = lp->GetTeam();
	int maxcl = (MENU_NPCAIMBT ? ents->GetHighestEntityIndex() : globals->max_clients);

	for (int i = 1; i <= maxcl; ++i)
		if (CBaseEntity* pl = ents->GetClientEntity(i))
		{
			if (pl == lp)
				continue;

			//if (pl->IsDormant())
			//	continue;

			if (!pl->GetModel())
				continue;

			bool npc = i > globals->max_clients;
			bool lowp = 1;

			if (npc)
			{
				const char* cclass = pl->GetClientClass()->m_pNetworkName;

				if (gmod())
				{
					RecvTable* p = pl->GetClientClass()->m_pRecvTable->m_pProps[0].m_pDataTable;

					if ((strcmp(cclass, "CAI_BaseNPC") && (!p || strcmp(p->m_pNetTableName, "DT_AI_BaseNPC"))) || !pl->IsAlive())
						continue;
				}

				if (tf2())
				{
					if (
						lowp = (
							strcmp(cclass, "CObjectSentrygun") ||
							ReadPtr<bool>(pl, m_bHasSapper)
						) &&
						(
							strcmp(cclass, "CTFGrenadePipebombProjectile") ||
							!ReadPtr<int>(pl, m_iType) ||
							!ReadPtr<bool>(pl, m_bTouched) ||
							!pl->IsDummyProjectile() ||
							sp.DistTo(lp->GetAbsOrigin()) > 768.f
						)
					)
						continue;

					if (pl->GetTeam() == lteam)
						continue;
				}
			}
			else if (!DoStateCheck(pl))
				continue;

			if (!pl->UpdateBones())
				continue;
			
			float rate = Rate(lp, pl, npc);
			if (!lowp)
				rate *= 0.1f;

			if (rate > best)
				continue;

			if (css() && pl->GetOrigin().DistTo(sp) > 8192.f)
				continue;

			int aim = GetAimBone(pl);
			bool doscan = 1;

			if (pl->GetHitbox(aim))
			{
				Vector box = pl->GetBoxPos(aim);

				if (BulletTrace(sp, box, pl))
				{
					target_id	= i;
					best		= rate;
					tp			= box;

					continue;
				}
			}

			if (doscan && MENU_BONESCAN)
			{
				int m = pl->Hitboxes();
				for (int j = 0; j < m; ++j)
				{
					if (j == aim)
						continue;

					if (pl->GetHitbox(j))
					{
						Vector box = pl->GetBoxPos(j);

						if (BulletTrace(sp, box, pl))
						{
							target_id	= i;
							best		= rate;
							tp			= box;

							continue;
						}
					}
				}
			}
		}

	if (target_id > 0)
	{
		CBaseEntity* pl = ents->GetClientEntity(target_id);

		if (!pl)
			return 0;

		if (target_id > globals->max_clients) // TODO: predict non-lag comepnsated stuff
		{
			tp -= pl->GetAbsOrigin();
			tp += pl->GetOrigin() + pl->GetVelocity() * engine->GetNetChannel()->GetPing();
		}

		cmd->viewangles = (tp - sp).Angle();
		NormalizeAngles(cmd->viewangles);

		if (MENU_AUTOSHOT)
			add(cmd->buttons, IN_ATTACK);

		return 1;
	}

	return 0;
}
Beispiel #6
0
static GEN
bnflog_i(GEN bnf, GEN ell)
{
  long prec0, prec;
  GEN nf, US, vdegS, S, T, M, CLp, CLt, Ftilde, vtG, ellk;
  GEN D, Ap, cycAp, bnfS;
  long i, j, lS, lvAp;

  checkbnf(bnf);
  nf = checknf(bnf);
  S = idealprimedec(nf, ell);
  bnfS = bnfsunit0(bnf, S, nf_GENMAT, LOWDEFAULTPREC); /* S-units */
  US = leafcopy(gel(bnfS,1));
  prec0 = maxss(30, vtilde_prec(nf, US, ell));
  US = shallowconcat(bnf_get_fu(bnf), US);
  settyp(US, t_COL);
  T = padicfact(nf, S, prec0);
  lS = lg(S); Ftilde = cgetg(lS, t_VECSMALL);
  for (j = 1; j < lS; j++) Ftilde[j] = ftilde(nf, gel(S,j), gel(T,j));
  CLp = CL_prime(bnf, ell, S);
  cycAp = gel(CLp,1);
  Ap = gel(CLp,2);
  for(;;)
  {
    CLt = CL_tilde(nf, US, ell, T, Ftilde, &vtG, prec0);
    if (CLt) break;
    prec0 <<= 1;
    T = padicfact(nf, S, prec0);
  }
  prec = ellexpo(cycAp, ell) + ellexpo(CLt,ell) + 1;
  if (prec == 1) return mkvec3(cgetg(1,t_VEC), cgetg(1,t_VEC), cgetg(1,t_VEC));

  vdegS = get_vdegS(Ftilde, ell, prec0);
  ellk = powiu(ell, prec);
  lvAp = lg(Ap);
  if (lvAp > 1)
  {
    GEN Kcyc = bnf_get_cyc(bnf);
    GEN C = zeromatcopy(lvAp-1, lS-1);
    GEN Rell = gel(CLp,3), Uell = gel(CLp,4), ordS = gel(CLp,5);
    for (i = 1; i < lvAp; i++)
    {
      GEN a, b, bi, A = gel(Ap,i), d = gel(cycAp,i);
      bi = isprincipal(bnf, A);
      a = vecmodii(ZC_Z_mul(bi,d), Kcyc);
      /* a in subgroup generated by S = Rell; hence b integral */
      b = hnf_invimage(Rell, a);
      b = vecmodii(ZM_ZC_mul(Uell, ZC_neg(b)), ordS);
      A = mkvec2(A, cgetg(1,t_MAT));
      A = idealpowred(nf, A, d);
      /* find a principal representative of A_i^cycA_i up to elements of S */
      a = isprincipalfact(bnf,gel(A,1),S,b,nf_GENMAT|nf_FORCE);
      if (!gequal0(gel(a,1))) pari_err_BUG("bnflog");
      a = famat_mul_shallow(gel(A,2), gel(a,2)); /* principal part */
      if (lg(a) == 1) continue;
      for (j = 1; j < lS; j++)
        gcoeff(C,i,j) = vtilde(nf, a, gel(T,j), gel(vdegS,j), ell, prec0);
    }
    C = gmod(gneg(C),ellk);
    C = shallowtrans(C);
    M = mkmat2(mkcol2(diagonal_shallow(cycAp), C), mkcol2(gen_0, vtG));
    M = shallowmatconcat(M); /* relation matrix */
  }
  else
    M = vtG;
  M = ZM_hnfmodid(M, ellk);
  D = matsnf0(M, 4);
  if (lg(D) == 1 || !dvdii(gel(D,1), ellk))
    pari_err_BUG("bnflog [missing Z_l component]");
  D = vecslice(D,2,lg(D)-1);
  return mkvec3(D, CLt, ellsylow(cycAp, ell));
}
Beispiel #7
0
u32 g31(void){ return( gmod(31)+1 ) ; }
Beispiel #8
0
u32 g7(void){ return( gmod(7)+1 ) ; }
Beispiel #9
0
u32 g255(void){ return( gmod(255) ) ; }
Beispiel #10
0
u32 g5(void){ return( gmod(5) ) ; }
Beispiel #11
0
GEN gmode(GEN *x, GEN y)
{
  *x=gmod(*x,y);
  return *x;
}
Beispiel #12
0
void CreateMove(CUserCmd* cmd)
{
	sendPacket = 1;

	CBaseEntity* me	= LocalPlayer();
	CBaseEntity* w	= me->GetActiveWeapon();

	Vector qrv = cmd->viewangles;
	
	globals->cur_time = (float)me->GetTickBase() * ReadPtr<float>(me, m_flLaggedMovementValue) * globals->interval_per_tick;
	
	aimbot::Update();
	aimbot::PerformPrediction(cmd);
	
	bool aim = 0;
	if (MENU_AIMBOTEN && (!MENU_AIMBOTKB || util::IsKeyDown(MENU_AIMBOTKB)) && !aimbot::dummy)
		aim = aimbot::Think(cmd);

	if (!MENU_FAKEVIEW && aim)
		engine->SetViewAngles(cmd->viewangles);
	
	nospread::HandleCmd(cmd, w);


	if (MENU_NORECOIL && !aimbot::dummy)
	{
		nospread::FixRecoil(cmd);
		NormalizeAngles(cmd->viewangles);
	}

	if (MENU_SEMIFULL && !aimbot::dummy && !aimbot::bullet)
		del(cmd->buttons, IN_ATTACK);

	if (tf2() && MENU_AUTOSTAB && w && !strcmp(w->GetClientClass()->m_pNetworkName, "CTFKnife") &&
			!me->TF2_IsCloaked() && ReadPtr<bool>(w, m_bReadyToBackstab))

		add(cmd->buttons, IN_ATTACK);


	if (MENU_AUTORELD && w && !w->IsMelee() && !w->GetClip1() && !w->IsReloading())
	{
		add(cmd->buttons, IN_RELOAD);
		del(cmd->buttons, IN_ATTACK);
	}


	if (aim)
	{
		if (chk(cmd->buttons, IN_ATTACK) && aimbot::bullet)
			aimbot::next_shot = aimbot::target_id;
	}
	else
		aimbot::next_shot = 0;



	if (gmod() && MENU_PROPKILL && w && !strcmp(w->GetClientClass()->m_pNetworkName, "CWeaponPhysGun"))
	{
		static int hold = 0, punt = 0;

		if (chk(cmd->buttons, IN_ATTACK))
		{
			float latency = engine->GetNetChannel()->GetPing();

			hold = (int)((1.0f / globals->interval_per_tick) * (latency + 0.05f));
			punt = (int)((1.0f / globals->interval_per_tick) * (latency + 0.2f));
		}
		else
		{
			if (hold > 0)
			{
				add(cmd->buttons, IN_ATTACK);
				hold--;
			}

			if (punt > 0)
			{
				*cmd->mousewheel() = 0x7F;
				punt--;
			}
		}
	}

	if (MENU_FAKEDUCK && css() && me->IsAlive() && me->IsOnGround() && chk(cmd->buttons, IN_DUCK) && (cmd->tick_count % 2))
	{
		del(cmd->buttons, IN_DUCK);
		del(cmd->buttons, IN_ATTACK);

		sendPacket = 0;
	}

	if (MENU_SMACAIMB)
	{
		static Vector old = cmd->viewangles;
		Vector snap = (cmd->viewangles - old);

		NormalizeAngles(snap);

		const float smac = 42.f;
		if (snap.Normalize() > smac)
		{
			cmd->viewangles = old + snap * smac;
			NormalizeAngles(cmd->viewangles);

			if (aimbot::bullet)
				del(cmd->buttons, IN_ATTACK);
		}

		old = cmd->viewangles;
	}

	if (me->IsAlive())
	{
		//if (MENU_ANTIAIMB)
		//	antiaim::Think(cmd, &sendPacket);



		static float move = 400.f; // move = max(move, (abs(cmd->move.x) + abs(cmd->move.y)) * 0.5f);
		float s_move = move * 0.5065f;

		if (MENU_AUTOSTRF)
		{
			if ((chk(cmd->buttons, IN_JUMP) || !me->IsOnGround()) && me->GetWaterLevel() < 2)
			{
				cmd->move.x = move * 0.015f;
				cmd->move.y += (float)(((cmd->tick_count % 2) * 2) - 1) * s_move;
				
				if (cmd->mousex)
					cmd->move.y = (float)clamp(cmd->mousex, -1, 1) * s_move;

				static float strafe	= cmd->viewangles.y;

				float rt = cmd->viewangles.y, rotation;
				rotation = strafe - rt;

				if (rotation < FloatNegate(globals->interval_per_tick))
					cmd->move.y = -s_move;

				if (rotation > globals->interval_per_tick)
					cmd->move.y = s_move;

				strafe = rt;
			}
		}



		/*
		if (MENU_WALKBOST && !chk(cmd->buttons, IN_JUMP) && me->IsOnGround())
		{
			if ((chk(cmd->buttons, IN_FORWARD) && chk(cmd->buttons, IN_MOVELEFT)) || (chk(cmd->buttons, IN_BACK) && chk(cmd->buttons, IN_MOVERIGHT)))
			if (even)
			{
				cmd->move.y += s_move;
				cmd->move.x += s_move;
			}
			else
			{
				cmd->move.y -= s_move;
				cmd->move.x -= s_move;
			}
			else if ((chk(cmd->buttons, IN_FORWARD) && chk(cmd->buttons, IN_MOVERIGHT)) || (chk(cmd->buttons, IN_BACK) && chk(cmd->buttons, IN_MOVELEFT)))
			if (even)
			{
				cmd->move.y += s_move;
				cmd->move.x -= s_move;
			}
			else
			{
				cmd->move.y -= s_move;
				cmd->move.x += s_move;
			}
			else if (chk(cmd->buttons, IN_FORWARD) || chk(cmd->buttons, IN_BACK))
				if (even)	cmd->move.y += s_move;
				else		cmd->move.y -= s_move;
			else if (chk(cmd->buttons, IN_MOVELEFT) || chk(cmd->buttons, IN_MOVERIGHT))
				if (even)	cmd->move.x += s_move;
				else		cmd->move.x -= s_move;
		}
		*/

		Vector qmove, fixed_va = cmd->viewangles;
		float speed = cmd->move.Length2D();
		
		VectorAngles(cmd->move, qmove);
		NormalizeAngles(fixed_va);

		

		float yaw = Deg2Rad(fixed_va.y - qrv.y + qmove.y);
		float nyaw = FloatNegate(yaw);

		if (cmd->viewangles.x < -90.f || cmd->viewangles.x > 90.f)
		{
			cmd->move.x = FloatNegate(sin(nyaw) * speed);
			cmd->move.y = FloatNegate(cos(nyaw) * speed);
		}
		else
		{
			cmd->move.x = cos(yaw) * speed;
			cmd->move.y = sin(yaw) * speed;
		}

		if (MENU_BUNNYHOP)
		{
			static bool firstjump = 0, fakejmp;

			if (chk(cmd->buttons, IN_JUMP) && me->GetWaterLevel() < 2)
				if (!firstjump)
					firstjump = fakejmp = 1;
				else if (!me->IsOnGround())
					if (MENU_BHOPSAFE && fakejmp && me->GetVelocity().z < 0.0f)
						fakejmp = 0;
					else
						del(cmd->buttons, IN_JUMP);
				else
					fakejmp = 1;
			else
				firstjump = 0;
		}
	}




	if (MENU_FAKELAGB)
	{
		static int q = 0;

		if (q > 0 && !((MENU_FAKELAGA && LocalPlayer()->GetVelocity().Length() < 100.f) ||
			MENU_FAKELAGS && !aimbot::dummy && aimbot::bullet && chk(cmd->buttons, IN_ATTACK)))
		{
			q--;
			sendPacket = 0;
		}
		else
			q = MENU_FAKELAGN;
	}

	if (MENU_CHATSPAM && !(cmd->tick_count % (int)(0.2f / globals->interval_per_tick)))
	{
		char disrupt[] =
		{
			0x7F,
			10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
			10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
			10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
			10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
			10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
			10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
			10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
			10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
			10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
			10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
			0
		};

		util::SendStringCmd("say %s", disrupt);
	}
	
	if (MENU_NAMESTLR)
		namestealer::Think();
}