1.13c Pointer and struct for Spawn a Monster ?

This forum is for discussions on how to edit what can not be edited through the txt files, needless to say this isn't about battle net hacking.

Moderators: Nefarius, Havvoric

Post Reply
meinerdeiner
Posts: 17
Joined: Sun Feb 26, 2017 8:29 pm
Germany

1.13c Pointer and struct for Spawn a Monster ?

Post by meinerdeiner » Sun May 28, 2017 9:21 pm

Someone has pointer and struct for spawn a monster ?

User avatar
thaison
Junior Member
Paladin
Posts: 108
Joined: Fri Apr 03, 2015 11:59 am
Location: Viet Nam
Vietnam

Re: 1.13c Pointer and struct for Spawn a Monster ?

Post by thaison » Mon May 29, 2017 6:20 am

I use PlugY Source :)

Function:

Code: Select all

D2FUNC(D2GAME, D2SpawnMonster, DWORD, __fastcall, (Game* ptGame, Room* ptRoom, DWORD zero1, DWORD x, DWORD y, DWORD minusOne, DWORD superuniqueID, DWORD zero2), 0x24950)
Stub:

Code: Select all

NAKED DWORD __fastcall D2SpawnMonster(Game* ptGame, Room* ptRoom, DWORD zero1, DWORD x, DWORD y, DWORD minusOne, DWORD superuniqueID, DWORD zero2)
{
	__asm
	{
		PUSH DWORD PTR SS:[ESP+0x10]
		PUSH DWORD PTR SS:[ESP+0x10]
		PUSH DWORD PTR SS:[ESP+0x10]
		PUSH EDX
		PUSH ECX
		MOV EAX,DWORD PTR SS:[ESP+0x18]
		MOV EDX,DWORD PTR SS:[ESP+0x2C]
		MOV ECX,DWORD PTR SS:[ESP+0x28]
		CALL D2GAME_D2SpawnMonster
		RETN 0x18
	}
}

User avatar
kidpaddle94
Forum Legend
Principality
Posts: 2057
Joined: Thu Aug 13, 2009 2:54 pm
Location: localhost
Canada

Re: 1.13c Pointer and struct for Spawn a Monster ?

Post by kidpaddle94 » Mon May 29, 2017 6:24 am

You can use this function. Technically the function is a fastcall function you can use as is without any stub, but I stubbed it to reorder args

Code: Select all

__declspec (naked) Unit* __fastcall D2GAME_SpawnMonster(Game* pGame, DrlgRoom* pRoom, int nMonster, int nMode, int nPosX, int nPosY, int nA7, int nA8)
{
	/*
		push nA8
		push nA7
		push nPosY
		push nPosX
		push pRoom
		push pGame
		mov edx, nMode
		mov ecx, nMonster
		call D2GAME_6FD0F650
	*/

	__asm
	{
		push [esp+0x18]
		push [esp+0x18]
		push [esp+0x18]
		push [esp+0x18]
		push edx
		push ecx
		mov edx, [esp+0x20]
		mov ecx, [esp+0x1C]
		call D2GAME_6FD0F650
		retn 0x18
	}
}

Post Reply

Return to “Code Editing”