Item.cpp File:Hello everyone, today I want to share my decompilation of this function. Which makes it possible to modify the Rotation Angles: X,Y,Z and the Display Size of the Items on the Map Floor. Enjoy it!
NOTE: 0 ASM Code.
#include "StdAfx.h"
cItem gItem;
int cItem::DrawObjectOnViewport(lpObjViewport lpObjView) // -> 0x005C0467
{
switch(lpObjView->ObjIndex)
{
case Demon_Pet:
lpObjView->AngleX = 0.f;
lpObjView->AngleY = 0.f;
lpObjView->AngleZ = 70.f;
lpObjView->Size = 0.2f;
break;
case Fairy_Pet:
lpObjView->AngleX = 0.f;
lpObjView->AngleY = 0.f;
lpObjView->AngleZ = 70.f;
lpObjView->Size = 0.4f;
break;
default:
return pObjOnViewport(lpObjView);
break;
}
// ----
return 0;
}
void cItem::InitDrawObjectOnViewport()
{
gToolKit.SetOp((LPVOID)oDrawObjectCall01,this->DrawObjectOnViewport,ASM::CALL);
gToolKit.SetOp((LPVOID)oDrawObjectCall02,this->DrawObjectOnViewport,ASM::CALL);
}
void cItem::Load()
{
this->InitDrawObjectOnViewport();
}
Structs.h File:
#ifndef __STRUCTS_H__#define __STRUCTS_H__#pragma pack(push,1)typedef struct{ /*+0*/ BYTE Unknown0; /*+1*/ BYTE Unknown1; /*+2*/ BYTE Unknown2; /*+3*/ BYTE Unknown3; /*+4*/ BYTE Unknown4; /*+5*/ BYTE Unknown5; /*+6*/ BYTE Unknown6; /*+7*/ BYTE Unknown7; /*+8*/ BYTE Unknown8; /*+9*/ BYTE Unknown9; /*+10*/ BYTE Unknown10; /*+11*/ BYTE Unknown11; /*+12*/ BYTE Unknown12; /*+13*/ BYTE Unknown13; /*+14*/ BYTE Unknown14; /*+15*/ BYTE Unknown15; /*+16*/ BYTE Unknown16; /*+17*/ BYTE Unknown17; /*+18*/ BYTE Unknown18; /*+19*/ BYTE Unknown19; /*+20*/ BYTE Unknown20; /*+21*/ BYTE Unknown21; /*+22*/ BYTE Unknown22; /*+23*/ BYTE Unknown23; /*+24*/ BYTE Unknown24; /*+25*/ BYTE Unknown25; /*+26*/ BYTE Unknown26; /*+27*/ BYTE Unknown27; /*+28*/ BYTE Unknown28; /*+29*/ BYTE Unknown29; /*+30*/ BYTE Unknown30; /*+31*/ BYTE Unknown31; /*+32*/ BYTE Unknown32; /*+33*/ BYTE Unknown33; /*+34*/ BYTE Unknown34; /*+35*/ BYTE Unknown35; /*+36*/ BYTE Unknown36; /*+37*/ BYTE Unknown37; /*+38*/ BYTE Unknown38; /*+39*/ BYTE Unknown39; /*+40*/ BYTE Unknown40; /*+41*/ BYTE Unknown41; /*+42*/ BYTE Unknown42; /*+43*/ BYTE Unknown43; /*+44*/ BYTE Unknown44; /*+45*/ BYTE Unknown45; /*+46*/ BYTE Unknown46; /*+47*/ BYTE Unknown47; /*+48*/ DWORD ObjIndex; /*+49*/ BYTE Unknown49; /*+50*/ BYTE Unknown50; /*+51*/ BYTE Unknown51; /*+52*/ BYTE Unknown52; BYTE Shift1[40]; /*+96*/ float Size; BYTE Shift2[164]; /*264*/ float AngleX; /*268*/ float AngleY; /*272*/ float AngleZ;}gObjViewport, *lpObjViewport;#pragma pack(pop)#endif
Last edited by Kiosani; 11-01-17 at 07:15 PM.
can you share method decode struct ?, i can decode sub code with the IDA, but cant decode struct :(
Decode Struct ? bro... you only can decode a struct if you have some: .pdb from main, at least I'm thinking this. If you need re-make some struct you only must calc positions that you know of this. and put Shift[XX] bytes on fields that you don't know of this struct. size must be the same for your used Fields -> /*+96*/ float Size; for example, etc.
because here you have a different struct lpObjViewport bro... anyways are you sure that this is equivalent function on your old school main ?? If your Answer it's YES, then you must remake it !
Ex for your main ObjIndex(using your Screenshot from reference at: 0x005F5478):
/*+0*/ BYTE Unknown0;
/*+1*/ BYTE Unknown1;
/*+2*/ WORD ObjIndex;
PS: I can try to make for u, pass me your main.exe + your DLLs (ogg.dll, wzAudio.dll & vorbisfile.dll).
PS 2: I'm thinking that by your Screenshot... I mean.. using your showed function on your Screenshot... your struct is something like this:
/*+28*/ float AngleX;
/*+32*/ float AngleY;
/*+36*/ float AngleZ;
![]()
Last edited by Kiosani; 15-01-17 at 08:23 PM.
Hello. Can you give me offset for this function in 1.04D main.exe? Thx.
Yes I searched all references and gave me this function I tried to use like this:
Int Type = * (WORD *) (Struct + 2);
Direct without using struct and also in asm but did not change the size;
My main is this: https://www.sendspace.com/file/64ore0
Thankiu!
your main.exe named like: 'MyPrincipal' is not the same main.exe that in your ScreenShot bro...anyways... your posted main.exe have the same struct size, then maybe this can be useful for you:
PS: In old school main.exe (like your main) that use ITEM_STRUCTURE from: 32 Item Index by every Item Type... in lpObjViewport Struct Size field is: /*+12*/ DWORD Size; sincerely I don't know why... but anyways you can try to use: float values on code if you make a small Cast first something like this:Code:// Main 1.02.14 Protocol: ??? (32 Item Index) #pragma pack(push,1) typedef struct // -> Total Size: ? { /*+0*/ BYTE Unknown0; /*+1*/ BYTE Unknown1; /*+2*/ WORD ObjIndex; /*+3*/ BYTE Unknown2; /*+4*/ BYTE Unknown3; /*+5*/ BYTE Unknown4; /*+6*/ BYTE Unknown5; /*+7*/ BYTE Unknown6; /*+8*/ BYTE Unknown7; /*+9*/ BYTE Unknown8; /*+10*/ BYTE Unknown9; /*+12*/ DWORD Size; /*+16*/ float PosX; /*+20*/ float PosY; /*+24*/ float PosZ; /*+28*/ float AngleX; /*+32*/ float AngleY; /*+36*/ float AngleZ; }gObjViewport, *lpObjViewport; #pragma pack(pop)
Cast Ex:
PS 2: I hope this has been helpful to you... don't forget that your main works with: 32 as maximum Index, so: ObjIndex must be matched to a formula like this:Code:case Demon_Pet: lpObjView->AngleX = 0.f; lpObjView->AngleY = 0.f; lpObjView->AngleZ = 70.f; lpObjView->Size = (DWORD)0.2f; break;
Main 1.02.14 Protocol: ??? ObjectId Formula:
Code:#define ObjectId(x,y) ((x*32)+y+530) // -> 530 in hex: (0x212) is Item Offset in Array from: 1.02.14 main
Last edited by Kiosani; 17-01-17 at 05:01 AM.
Bro sorry to waste your time, but unfortunately this offset comes from the protocol recv, and seems not to be used I used breakpoint before starting the main after I started it and I entered the character in no time used the function and unfortunately it was the only reference Closer to the one you posted, I think the older ones do not have these options, thanks for trying to help me!
Unfortunately I ran the whole main, I modified several places where I used 0x1C 0x18 0x20 and 0x24, but I did not find any that modified the size of the item in the character, I think this is not possible in the old versions, if it were you would have some Idea of where it might be? So that I can continue my search