Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void DrawMainBar (double TicFrac)
- {
- if(CPlayer && CPlayer.mo)
- {
- let mech = MechWarrior(CPlayer.mo);
- if(!mech)return;
- if(mech.targetenemy && mech.targetenemy.health > 0)
- {
- Actor target = mech.targetenemy;
- vector2 screencoords;
- vector3 fromworldpos;
- vector3 eyepos = (mech.pos.x, mech.pos.y, mech.pos.z);
- double distance = mech.Distance3D(target);
- float viewfov = mech.player.FOV;
- bool behind;
- console.printf("%f",mech.pitch);
- fromworldpos = MWD_CoordUtil.WorldToScreen(target.pos,eyepos,mech.pitch,mech.angle,mech.roll,viewfov);
- [screencoords, behind] = MWD_CoordUtil.toViewport(fromworldpos);
- if (-1 < fromworldpos.z && fromworldpos.z <= 1)
- {
- // this is the coordinates where you're drawing to:
- if (distance == 0) { return; }
- double height = target.height;
- double radius = target.radius;
- double visibleRadius = radius * 2000.0 / distance;
- double visibleHeight = height * 1000.0 / distance;
- Vector2 left = (screencoords.x - visibleRadius / 2.0, screencoords.y);
- Vector2 right = (screencoords.x + visibleRadius / 2.0, screencoords.y);
- Vector2 top = (screencoords.x, screencoords.y - visibleHeight / 2.0);
- Vector2 bottom = (screencoords.x, screencoords.y + visibleHeight / 2.0);
- Vector2 topLeft = (left.x, top.y);
- Vector2 topRight = (right.x, top.y);
- Vector2 bottomLeft = (left.x, bottom.y);
- Vector2 bottomRight = (right.x, bottom.y);
- DrawImage("RETCA0",topLeft,0,1.0);
- DrawImage("RETCB0",topRight,0,1.0);
- DrawImage("RETCC0",bottomLeft,0,1.0);
- DrawImage("RETCD0",bottomRight,0,1.0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement