All pastes #2107184 Raw Edit

Stuff

public text v1 · immutable
#2107184 ·published 2012-01-28 22:52 UTC
rendered paste body

u16 __fastcall VacHook(CInPacket *packet, u32 edx)
{
	CMob *mob;
	u32 mobType;
	u16 fh;

	_asm
	{
		mov	eax, [esp+4]
		mov [mob], eax
	}

	fh = *(u16 *)(packet->data + packet->offset + 5);

	mobType = DecodeLong(mob->m_pTemplate->_ZtlSecureTear_dwTemplateID, mob->m_pTemplate->_ZtlSecureTear_dwTemplateID_CS);
	if (mobType != 9999999)	// trap mob
	{
		if (g_vacMode == 1 && g_vacPlat.state != 0)
		{
			*(u16 *)(packet->data + packet->offset) = g_vacPlat.rx1 + (g_vacPlat.rx2 - g_vacPlat.rx1) / 2;
			*(u16 *)(packet->data + packet->offset + 2) = g_vacPlat.ry1 + (g_vacPlat.ry2 - g_vacPlat.ry1) / 2;
			*(u16 *)(packet->data + packet->offset + 5) = g_vacPlat.sn;
			*(u16 *)(packet->data + packet->offset + 7) = g_vacPlat.sn;
		} else if (g_vacMode == 2)
		{
			std::map<int, CStaticFoothold *>::iterator i = g_vacMap.find(fh);
			if (i != g_vacMap.end())
			{
				*(u16 *)(packet->data + packet->offset) = i->second->rx2;
				*(u16 *)(packet->data + packet->offset + 2) = i->second->ry1 + (i->second->ry2 - i->second->ry1) / 2;
				*(u16 *)(packet->data + packet->offset + 5) = i->second->sn;
				*(u16 *)(packet->data + packet->offset + 7) = i->second->sn;
				//Log("x: %i, y: %i\n", *(u16 *)(packet->data + packet->offset), *(u16 *)(packet->data + packet->offset + 2));
			}
		}
	}

	return ((u16 (__fastcall *)(CInPacket *, u32))0x436500)(packet, edx);
}