FOnline Development > Questions and Answers
Can I get screen pos of CritterCl head?
(1/1)
Janusz2238:
Hello good peoples from all world!
I want draw image beside player name. For now, I am using GetHexPos function,
--- Code: --- #define X_OFFSET -80
#define Y_OFFSET -75
int x=0, y=0;
if(GetHexPos(critters[i].HexX, critters[i].HexY, x, y))
{
x += X_OFFSET;
y += Y_OFFSET;
if(x > __ScreenWidth || y > __ScreenHeight || x < 0 || y < 0)
{
continue;
}
testSprite.Draw(x, y);
}
--- End code ---
But effect isn't fluent. Is there any better way to get position of Critter head?
Cheers
Janusz
Wipe:
I've added dedicated function for this (getting name/text over head position) some weeks ago, but no idea when/if SDK gonna be updated.
Janusz2238:
Hello, Thanks for reply, Do you add it to 2238 branch? Im using 2238 branch - no tla sdk.
Cvet paste me this log, but I dont understund where is this TextRect structure. I searhed all folder with total commander, and in any file i didn't find it.
--- Code: ---[20:29:54] <~cvet> Here. You mean pass parameters from scripts or fo3d files?
[20:31:17] <~cvet> Both is possible.
[20:38:17] <cirn1> How to pass from script to shader
[20:38:35] <cirn1> to the .fx or .glsl
[20:38:47] <cirn1> use 3rd party library?
[21:51:47] <~cvet> Global variables __EffectValue0..9.
[21:52:13] <~cvet> Type is float.
[21:53:21] <cirn1> inside Shader it is referenced as same?
[21:54:20] <~cvet> Without __.
[21:54:36] <~cvet> uniform float EffectValue0;
[21:55:03] <cirn1> Great, have you visited the forum post about my first question?
[21:56:21] <[DP]LoadRunner> http://www.fonline.ru/forum/threads/3935/
[21:57:06] <~cvet> Title is about one, first post about another, what do you want to know?
[21:57:27] <cirn1> If there is a reference between sprite object and a critter
[21:58:31] <cirn1> Is possible to get the rendered position of the critter's sprite by script?
[22:12:51] <~cvet> For now I see this way. It's next fields for CritterCl class:
[22:12:54] <~cvet> UShortPairVec MoveSteps;
[22:12:54] <~cvet> int CurMoveStep;
[22:12:54] <~cvet> ...
[22:12:54] <~cvet> private:
[22:12:54] <~cvet> bool needReSet;
[22:12:54] <~cvet> uint reSetTick;
[22:12:54] <~cvet> ...
[22:12:54] <~cvet> public:
[22:12:54] <~cvet> void* Layers3d;
[22:12:54] <~cvet> ...
[22:12:54] <~cvet> private:
[22:12:54] <~cvet> uint curSpr, lastEndSpr;
[22:12:54] <~cvet> uint animStartTick;
[22:12:54] <~cvet> ...
[22:12:54] <~cvet> typedef vector< CritterAnim > CritterAnimVec;
[22:12:54] <~cvet> CritterAnimVec animSequence;
[22:12:54] <~cvet> CritterAnim stayAnim;
[22:12:54] <~cvet> ...
[22:12:54] <~cvet> public:
[22:12:54] <~cvet> Animation3d* Anim3d;
[22:12:54] <~cvet> Animation3d* Anim3dStay;
[22:12:54] <~cvet> bool Visible;
[22:12:54] <~cvet> uchar Alpha;
[22:12:54] <~cvet> Rect DRect;
[22:12:54] <~cvet> bool SprDrawValid;
[22:12:54] <~cvet> Sprite* SprDraw;
[22:12:54] <~cvet> uint SprId;
[22:12:54] <~cvet> short SprOx, SprOy;
[22:13:26] <~cvet> UShortPairVec, CritterAnimVec - vectors, size is 12.
[22:14:16] <~cvet> Rect DRect; - here bounds.
[22:14:29] <~cvet> uint SprId; - drawing sprite.
[22:14:38] <~cvet> short SprOx, SprOy; - offsets.
[22:15:57] <~cvet> Whole in the end:
[22:15:57] <~cvet> bool SprDrawValid;
[22:15:57] <~cvet> Sprite* SprDraw;
[22:15:57] <~cvet> uint SprId;
[22:15:57] <~cvet> short SprOx, SprOy;
[22:15:57] <~cvet> // Extra offsets
[22:15:57] <~cvet> short OxExtI, OyExtI;
[22:15:57] <~cvet> float OxExtF, OyExtF;
[22:15:57] <~cvet> float OxExtSpeed, OyExtSpeed;
[22:15:57] <~cvet> uint OffsExtNextTick;
[22:15:57] <~cvet> int staySprDir;
[22:15:57] <~cvet> uint staySprTick;
[22:15:57] <~cvet> uint finishingTime;
[22:15:57] <~cvet> bool fadingEnable;
[22:15:57] <~cvet> bool fadeUp;
[22:15:57] <~cvet> uint FadingTick;
[22:15:57] <~cvet> Rect textRect;
[22:15:57] <~cvet> uint tickFidget;
[22:15:57] <~cvet> string strTextOnHead;
[22:15:57] <~cvet> uint tickStartText;
[22:15:57] <~cvet> uint tickTextDelay;
[22:15:57] <~cvet> uint textOnHeadColor;
[22:15:57] <~cvet> short RefCounter;
[22:15:57] <~cvet> bool IsNotValid;
[22:18:05] <~cvet> sizeof CritterAnim = 40
[22:23:25] <~cvet> Add this to end of CritterCl:
[22:23:32] <cirn1> Ah ok
[22:23:37] <~cvet> char RawData[112];
[22:23:37] <~cvet> struct { L, T, R, B } DRect;
[22:23:37] <~cvet> bool SprDrawValid;
[22:23:37] <~cvet> Sprite* SprDraw;
[22:23:37] <~cvet> uint SprId;
[22:23:37] <~cvet> short SprOx, SprOy;
[22:23:58] <~cvet> char RawData[112];
[22:23:58] <~cvet> struct { L, T, R, B } DRect;
[22:23:58] <~cvet> bool SprDrawValid;
[22:23:58] <~cvet> Sprite* SprDraw;
[22:23:58] <~cvet> uint SprId;
[22:23:58] <~cvet> short SprOx, SprOy;
[22:28:37] <~cvet> char RawData[112];
[22:28:37] <~cvet> struct { L, T, R, B } SpriteRect;
[22:28:37] <~cvet> bool SprDrawValid;
[22:28:37] <~cvet> Sprite* SprDraw;
[22:28:37] <~cvet> uint SprId;
[22:28:37] <~cvet> short SprOx, SprOy;
[22:28:37] <~cvet> char RawData2[44];
[22:28:37] <~cvet> struct { L, T, R, B } TextRect;
[22:28:44] <~cvet> ...............
[22:28:47] <~cvet> char RawData[112];
[22:28:47] <~cvet> struct { L, T, R, B } SpriteRect;
[22:28:47] <~cvet> bool SprDrawValid;
[22:28:47] <~cvet> Sprite* SprDraw;
[22:28:47] <~cvet> uint SprId;
[22:28:47] <~cvet> short SprOx, SprOy;
[22:28:47] <~cvet> char RawData2[44];
[22:28:47] <~cvet> struct { L, T, R, B } TextRect;
[22:29:13] <~cvet> SpriteRect - sprite rect, TextRect - text on head.
[22:29:35] <~cvet> struct { L, T, R, B } - struct { int L, T, R, B; }
[22:35:26] <cirn1> it is inside fonline.h I add, extend myself to get the sprite info?
[22:38:49] <~cvet> Yes, to CritterCl, in the end of structure.
[22:39:34] <cirn1> I will update the forum with this information
[22:41:35] <cirn1> Thank you, one last one for today, is possible to setEffect only for critter with script? I know the engine supports it.
[22:42:26] <~cvet> Whole client critter engine header http://codepad.org/StQmcKBt
[22:43:01] <~cvet> Don't know what you mean, but you can set effect by critter id.
[22:43:33] <cirn1> currently void SetEffect(int effectType, int effectSubtype, string@ effectName);
[22:44:29] <~cvet> bool SetEffect(int effectType, int effectSubtype, string@+ effectName, string@+ effectDefines = null)
[22:45:04] <cirn1> must be inside newer rev
[22:45:05] <~cvet> https://xp-dev.com/sc/change/76003/394
[22:45:09] <cirn1> ok
[22:45:13] <cirn1> Thats great
[22:45:33] <~cvet> >EFFECT_2D_CRITTER - при указании id криттера, эффект сменится только для него; при передаче 0 сменится эффект по умолчанию;
--- End code ---
Wipe:
--- Quote from: Janusz2238 on November 10, 2013, 02:53:54 pm ---Do you add it to 2238 branch?
--- End quote ---
Nah, to TLA (if it gets thru code review, ofc :>) - requests was from people who are using original SDK and there's practically 0 chance to switch to mono version or anything with serious changes.
--- Quote from: Janusz2238 on November 10, 2013, 02:53:54 pm ---Cvet paste me this log, but I dont understund where is this TextRect structure.
--- End quote ---
Well provided fonline.h doesn't cover whole structure of CritterCl, Item, and so on - what you got is stuff which you need to add to your own fonline.h to reach the TextRect where text over head info is stored (what covers both char name and results of Say()). It's practically same stuff i used to make the func mentioned.
Navigation
[0] Message Index
Go to full version