I need some program structure advice...
Posted: Fri Aug 10, 2012 6:07 pm
I didn't really know what to ask for this problem I'm having.
What I've so far is a DLL that I inject that hooks D3d with the Azo Starter Kit 3.0b then I added in my own hook to the packet recv function in the game. Both of these are working fine my main issue is using them together.
When a update packet come into the game I have a update function to setup the struct for my use...The part I'm working with is items on the ground like armor/gold/w/e drops from kills. It's wierd but the way it works is it'll only show the top 3 items in a pile on the ground. If this is only 1 item(in a single pile) op is 0x01, otherwise it's op is 0x02 which will show the top 3 items.
Now with the D3D hooks I'm using the endScene function to draw text to the screen. I'm needing a way to store the ground items from the packet to a map or something then in endScene draw text over the pile of items with details abotu what's in it. I've managed to get a flicker of the name over the pile but wasn't doing to well with std::maps.
What would be the best way to store the items ID, x, y where I can edit it fast. These packets are updates several times a second and they'll come and go quickly.
What I've so far is a DLL that I inject that hooks D3d with the Azo Starter Kit 3.0b then I added in my own hook to the packet recv function in the game. Both of these are working fine my main issue is using them together.
When a update packet come into the game I have a update function to setup the struct for my use...The part I'm working with is items on the ground like armor/gold/w/e drops from kills. It's wierd but the way it works is it'll only show the top 3 items in a pile on the ground. If this is only 1 item(in a single pile) op is 0x01, otherwise it's op is 0x02 which will show the top 3 items.
Code: Select all
if(opCall == 0x01) //There is 1 item on the round.
{
uint16 xLoc = BytesToInt<uint16>(&packet[pos+2]);
uint16 yLoc = BytesToInt<uint16>(&packet[pos+4]);
itemId[0] = BytesToInt<uint16>(&packet[pos+6]);
pos += 8;
//printf("X: %i. Y: %i, ID: %i\n", xLoc, yLoc, itemId[0]);
}
else if(opCall == 0x02) //More then 1 item on the ground.
{
uint16 xLoc = BytesToInt<uint16>(&packet[pos+2]);
uint16 yLoc = BytesToInt<uint16>(&packet[pos+4]);
itemId[0] = BytesToInt<uint16>(&packet[pos+6]);
itemId[1] = BytesToInt<uint16>(&packet[pos + 8]);
itemId[2] = BytesToInt<uint16>(&packet[pos + 10]);
//printf("X: %i, Y: %i, ID: %i, ID2: %i, ID3: %i\n", xLoc, yLoc, itemId[0], itemId[1], itemId[2]);
pos += 12;
}
What would be the best way to store the items ID, x, y where I can edit it fast. These packets are updates several times a second and they'll come and go quickly.