Sprites, who knows :D

All Helbreath Client Source Discussion here.
Post Reply
xenx
Member
Posts: 169
Joined: Tue Oct 03, 2006 7:08 am

Post by xenx »

ok question,

as an example to ask this question im gonne use gold, small health pot, and large health pot.

these are the first three images in the Item-Ground.pak
now my question is, where in the client source, is the client told the locations and sizes of the images inside the sprite,

somewhere it has to say Item-Ground.pak, section 6, location x, y
and the middle of the image ie, where your character stands on said item

iv had a good look through the sources, the only mention i find of item-ground.pak is this,

Code: Select all

	MakeSprite( "item-ground", DEF_SPRID_ITEMGROUND_PIVOTPOINT+1, 19, FALSE);
  	m_hPakFile = CreateFile("sprites\\item-ground.pak", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL);
  	if( m_hPakFile != INVALID_HANDLE_VALUE )
  	{	m_pSprite[DEF_SPRID_ITEMGROUND_PIVOTPOINT+20] = new class CSprite(m_hPakFile, &m_DDraw, "item-ground", 17, FALSE);
    m_pSprite[DEF_SPRID_ITEMGROUND_PIVOTPOINT+21] = new class CSprite(m_hPakFile, &m_DDraw, "item-ground", 18, FALSE);
    m_pSprite[DEF_SPRID_ITEMGROUND_PIVOTPOINT+22] = new class CSprite(m_hPakFile, &m_DDraw, "item-ground", 19, FALSE);//Angels
    CloseHandle(m_hPakFile);
  	}
  	MakeSprite( "item-dynamic", DEF_SPRID_ITEMDYNAMIC_PIVOTPOINT, 3, FALSE);// Snoopy 2-> 3 (flags)
  	m_cLoading = 16;
  }
clearly theres not enough information there to tell the client about all the items on that page of the sprite, so where the hell is the rest?

so anyone know? imagine you were gonna add another image to this sprite, how would you tell the client about the new image ??

Charles
Loyal fan
Posts: 418
Joined: Wed Nov 26, 2003 8:20 pm

Post by Charles »

your not understanding it at all -.-
<i>"Always write good code. Feel bad to write bad code."</i>
xenx
Member
Posts: 169
Joined: Tue Oct 03, 2006 7:08 am

Post by xenx »

hehe nope i know that :D

gimme a hint? :P
bone-you
Spamtastic
Posts: 1310
Joined: Wed Mar 16, 2005 3:12 am

Post by bone-you »

.pak file holds it all.

Bitmap count (different pages)
Frame count (each image)
Offset x/y
Length/height (x/y)

They are stored in the m_stBrush struct and are accessed via sprite id which is loaded and incremented per page (bitmap) and selects the frame (image) and is displayed (already has the brush struct loaded).

m_pSprite[54000]->PutTransSprite70(sX-5, sY, 0, dwTime);

that's my hpbar sprite. I loaded it as 54000 and 0 is the frame to display.

m_pSprite[54000]->PutSpriteFastWidth(sX-5, sY, 1, 40-iBarWidth, dwTime);

frame 1 is the variable length sprite. All on the same page, different frame.

Ultimately, a sprite itself is a bunch of images that are played in succession. Difference is, paks like item ground hold images that are completely separate of each other so instead of having them animated, it draws it as one frame and that's it.
<img src='http://www.helbreathx.net/sig/sig.jpeg' border='0' alt='user posted image' /><br><a href='http://mafia.cheats4us.org/index.php?x=231030' target='_blank'>#1 on Mafia :D</a><br><!--QuoteBegin-Slipknight+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (Slipknight)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->100mb Internet, burstable too 10GB oc192<br>his speed can go up too 10gbs<br>...<br>Yes my car can have a top speed of 1000mph<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd--><br>^^ I wonder where the retard went to.
xenx
Member
Posts: 169
Joined: Tue Oct 03, 2006 7:08 am

Post by xenx »

any chance that you could give an example of something a bit simpler than your bar?

what about the gold sprite? do you know the line of code for that in the client? i need something i can recognise so i can actually see it, or i find it real hard to understand,

cause that whole 54000 bit got be confused you said you loaded it as 54000

m_pSprite[54000]-> how on earth does the clinet know what the hell this means? you said thats the sprite ID, explain sprite ID to me ..

i understand the rest :)
Charles
Loyal fan
Posts: 418
Joined: Wed Nov 26, 2003 8:20 pm

Post by Charles »

item-ground.pak is 1 frame like he said. so it's all loaded in with it. gold would be 1 frame. because m_pSrite apart of a class that it reads from....
<i>"Always write good code. Feel bad to write bad code."</i>
xenx
Member
Posts: 169
Joined: Tue Oct 03, 2006 7:08 am

Post by xenx »

i understand everything he said about the frames and the positions and everything, but as i say, i dont understand the whole m_pSprite[54000 part

i mean would that be
m_pSprite[Item-ground.pak]->PutSpriteFastWidth(sX-5, sY, 1, 40

because as i said in the original post i can only find a couple of matches for item-ground in the client source, if each one had a line like that i would have understood it without asking but
there doesnt seem to be lines of code like this,

i need an example of one of the lines of code in the client so i can see it myself and mess with it to try out what does what

the reason i using item-ground.pak is cause there sno animation which makes it less complicated

so if one of you would, could you please pick some random item in item-ground.pak and show me the code that loads that item, any will do.

that way at least i have a reference point so i can say right, this item is loaded here with this/these line(s) of code, therefore to add a new item all i need to do is..

see what im saying? as you will have noticed from my original post i already guessed about the whole page no: and length/height X Y coords, and offset x/y coords.

the part i dont get is how it identifies the actual .pak itself, i mean as i already said theres like 4 references to item-ground.pak
thats not enough there should be like 80 (or however many items there are)

bone-you
Spamtastic
Posts: 1310
Joined: Wed Mar 16, 2005 3:12 am

Post by bone-you »

I'll answer you yet again, but you'll come back with another question.

There's no way to explain this without spoonfeeding you which I don't want to do. Go look at the functions that are called when loading sprites and displaying them to figure out how they work.


m_pSprite[DEF_SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_cItemOrder]->m_sSprite]->PutTransSprite2(sX + 32 + m_pItemList[m_cItemOrder]->m_sX,
sY + 44 + m_pItemList[m_cItemOrder]->m_sY, m_pItemList[m_cItemOrder]->m_sSpriteFrame, dwTime);


or possibly


m_pSprite[DEF_SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_cItemOrder]->m_sSprite]->PutTransSpriteRGB(sX + 32 + m_pItemList[m_cItemOrder]->m_sX,
sY + 44 + m_pItemList[m_cItemOrder]->m_sY, m_pItemList[m_cItemOrder]->m_sSpriteFrame,
m_wWR[cItemColor] -m_wR[0], m_wWG[cItemColor] -m_wG[0], m_wWB[cItemColor] -m_wB[0],
dwTime);


or any other like 10 lines that draw items.
<img src='http://www.helbreathx.net/sig/sig.jpeg' border='0' alt='user posted image' /><br><a href='http://mafia.cheats4us.org/index.php?x=231030' target='_blank'>#1 on Mafia :D</a><br><!--QuoteBegin-Slipknight+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (Slipknight)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->100mb Internet, burstable too 10GB oc192<br>his speed can go up too 10gbs<br>...<br>Yes my car can have a top speed of 1000mph<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd--><br>^^ I wonder where the retard went to.
Sprint
Spamtastic
Posts: 1000
Joined: Tue Jun 06, 2006 6:59 am
Location: Far from home
Contact:

Post by Sprint »

i think the whole c++ is kinda confusing compared to vb lol
<span style='color:blue'><span style='font-size:19pt;line-height:100%'><u><b>FUCK Helbreath!</b></u></span></span><br><br><span style='color:gray'><a href='http://www2.analystica.com/users/anttu/online/ngd' target='_blank'>ngdnetwork</a> OFFICIAL WEBSITE OF Northern Game Developers. Do visit! (THEY ARE UP!)<br><a href='http://project3d.x.am' target='_blank'>Project3d development forum</a> plz join and discuss,develop,give ideas,feedback. Anything goes as long it helps the project!</span><br><br>Zepto Znote 6625WD: 1.8Ghz dual core, 2GB, 512mb graphics card(dedicated), 160GB HDD<br><img src='http://www.signaturebar.com/uploads/images/10111.jpg' border='0' alt='user posted image' /><br><img src='http://www.signaturebar.com/uploads/images/13229.jpg' border='0' alt='user posted image' /><br><img src='http://www.signaturebar.com/uploads/images/8852.png' border='0' alt='user posted image' />
Charles
Loyal fan
Posts: 418
Joined: Wed Nov 26, 2003 8:20 pm

Post by Charles »

vb is for those who don't know c++.

xenx the example your trying to find is harder because item-pack doesn't load them the way your asking. if you want to see one item. you'd have to look at a weapon or a piece of armor.
<i>"Always write good code. Feel bad to write bad code."</i>
Sprint
Spamtastic
Posts: 1000
Joined: Tue Jun 06, 2006 6:59 am
Location: Far from home
Contact:

Post by Sprint »

u just say that cos u just understood how stupi u were and chose c++ instead of vb or c#
<span style='color:blue'><span style='font-size:19pt;line-height:100%'><u><b>FUCK Helbreath!</b></u></span></span><br><br><span style='color:gray'><a href='http://www2.analystica.com/users/anttu/online/ngd' target='_blank'>ngdnetwork</a> OFFICIAL WEBSITE OF Northern Game Developers. Do visit! (THEY ARE UP!)<br><a href='http://project3d.x.am' target='_blank'>Project3d development forum</a> plz join and discuss,develop,give ideas,feedback. Anything goes as long it helps the project!</span><br><br>Zepto Znote 6625WD: 1.8Ghz dual core, 2GB, 512mb graphics card(dedicated), 160GB HDD<br><img src='http://www.signaturebar.com/uploads/images/10111.jpg' border='0' alt='user posted image' /><br><img src='http://www.signaturebar.com/uploads/images/13229.jpg' border='0' alt='user posted image' /><br><img src='http://www.signaturebar.com/uploads/images/8852.png' border='0' alt='user posted image' />
Charles
Loyal fan
Posts: 418
Joined: Wed Nov 26, 2003 8:20 pm

Post by Charles »

uhm if you knew me you would know that i know vb and c++ -.-
<i>"Always write good code. Feel bad to write bad code."</i>
xenx
Member
Posts: 169
Joined: Tue Oct 03, 2006 7:08 am

Post by xenx »

damn bone the beginning of your post was HARSH, you in a bad mood? :P

and i think i just got it, the pak (item-ground) is defined at the beginning as,
MakeSprite( "item-ground", DEF_SPRID_ITEMGROUND_PIVOTPOINT

from then on it only needs to be referred to as DEF_SPRID_ITEMGROUND_PIVOTPOINT

so once you define the pak with a name you can then call that name which tells it which .pak your talking about, and from there you can do things such as

Code: Select all

  	m_pSprite[DEF_SPRID_ITEMPACK_PIVOTPOINT +
             m_pItemList[m_stDialogBoxInfo[26].sV1]->m_sSprite]->PutSpriteFast(sX + iAdjX + 55 +(1-(rand()%3)), sY + iAdjY + 55 +(1-(rand()%3)),
       m_pItemList[m_stDialogBoxInfo[26].sV1]->m_sSpriteFrame, dwTime);
which at the moment i dont understand just by looking at it but it obviously calls the spite at the start, then defines perameters in the middle there and then, err, says where to display it? ill figure that out.. am i on the right track ?
bone-you
Spamtastic
Posts: 1310
Joined: Wed Mar 16, 2005 3:12 am

Post by bone-you »

xenx wrote: damn bone the beginning of your post was HARSH, you in a bad mood? :P

and i think i just got it, the pak (item-ground) is defined at the beginning as,
MakeSprite( "item-ground", DEF_SPRID_ITEMGROUND_PIVOTPOINT

from then on it only needs to be referred to as DEF_SPRID_ITEMGROUND_PIVOTPOINT

so once you define the pak with a name you can then call that name which tells it which .pak your talking about, and from there you can do things such as

Code: Select all

  	m_pSprite[DEF_SPRID_ITEMPACK_PIVOTPOINT +
             m_pItemList[m_stDialogBoxInfo[26].sV1]->m_sSprite]->PutSpriteFast(sX + iAdjX + 55 +(1-(rand()%3)), sY + iAdjY + 55 +(1-(rand()%3)),
       m_pItemList[m_stDialogBoxInfo[26].sV1]->m_sSpriteFrame, dwTime);
which at the moment i dont understand just by looking at it but it obviously calls the spite at the start, then defines perameters in the middle there and then, err, says where to display it? ill figure that out.. am i on the right track ?
No, I said what I said because I was right. You responded with questions back even though I told you all that you need to know.

I have nothing else to tell you in regards to loading items. It is different based on what client you use. I know my own client won't match the ones you all use if you use the "3.82" client. I use different offsets for the sprite array.
from then on it only needs to be referred to as DEF_SPRID_ITEMGROUND_PIVOTPOINT
Wrong. Look at it as a whole and not piece by piece. You missed a very important part of that line. The +1. And after that, the +20 and +21.

Items are loaded by their sprite id.

DEF_SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV1]->m_sSprite
<img src='http://www.helbreathx.net/sig/sig.jpeg' border='0' alt='user posted image' /><br><a href='http://mafia.cheats4us.org/index.php?x=231030' target='_blank'>#1 on Mafia :D</a><br><!--QuoteBegin-Slipknight+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (Slipknight)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->100mb Internet, burstable too 10GB oc192<br>his speed can go up too 10gbs<br>...<br>Yes my car can have a top speed of 1000mph<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd--><br>^^ I wonder where the retard went to.
Post Reply