Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "zcommon.acs"
- function void DrawText3D(str text, int id, int color, int alpha, int x, int y, int z)
- {
- int wd = 640;
- int ht = 480;
- if (GetCVar("screenblocks") < 11) ht -= 64;
- if (z > 0) return;
- // modify scale based on z.
- int scale = -z / ht;
- wd = FixedMul(wd<<16, scale)>>16;
- ht = FixedMul(ht<<16, scale)>>16;
- int hwd = wd/2;
- int hht = ht/2;
- int KP = hwd;
- SetHudSize(wd, ht, 0);
- int tX = ((FixedDiv(x, z)*KP)>>16)+hwd;
- int tY = ((FixedDiv(y, z)*KP)>>16)+hht;
- HudMessage(s:text; HUDMSG_PLAIN|HUDMSG_NOWRAP|HUDMSG_ALPHA, id, color, tX<<16, tY<<16, 0.1, alpha);
- }
- function int Scale12(int i) { return FixedMul(i, 1.2); }
- function int Abs(int i) { if (i < 0) return -i; return i; }
- function void DrawText3DTrans(str text, int id, int color, int alpha, int x, int y, int z, int px, int py, int pz, int fang, int YAng)
- {
- fang += 0.25;
- fang = (fang+1.0) % 1.0;
- //z = Scale12(z);
- //pz = Scale12(pz);
- //YAng += 0.25;
- //printbold(f:YAng);
- x -= px;
- y -= py;
- z -= pz;
- int dst = VectorLength(z, VectorLength(x, y)) / 512;
- int fix = 1.13826;
- //printbold(f:fix);
- //int fix = 1.2;
- //
- // one-sided adjustment.
- // disclaimer: I DON'T FUCKING KNOW HOW THIS WORKS O_O
- int yangmul = 1.0-(Abs(YAng)*4);
- YAng = FixedMul(YAng, 1.0+FixedMul(0.235, yangmul));
- z = Scale12(z);
- YAng = (YAng+2.0) % 1.0;
- int x1s, z1s;
- x1s = FixedMul(y, sin(fang)) + FixedMul(x, cos(fang));
- z1s = FixedMul(y, cos(fang)) - FixedMul(x, sin(fang));
- x = x1s;
- y = FixedMul(z, cos(YAng)) - FixedMul(z1s, sin(YAng));
- z = FixedMul(z, sin(YAng)) + FixedMul(z1s, cos(YAng));
- DrawText3D(text, id, color, alpha, x, y, z);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement