Code: Select all
function void HUDMessageOnActor(int tid, int range, str text, int zoffset, int colour)
{
int dist, ang, vang, pitch, x, y;
int HUDX = 370;
int HUDY = 290;
int offset = 0;
int scale=1;
int d4, d3, d2;
int no_hud=0;
x = getactorx(tid) - getactorx(1000);
y = getactory(tid) - getactory(1000);
vang = vectorangle(x,y);
ang = (vang - GetActorAngle(1000) + 1.0) % 1.0;
if(((vang+0.125)%0.5) > 0.25) dist = fixeddiv(y, sin(vang));
else dist = fixeddiv(x, cos(vang));
scale=(dist/(range*2));
scale=scale+1.0;
//print (f: scale);
HUDX=FixedMul (HUDX, scale);
HUDY=FixedMul (HUDY, scale);
sethudsize(HUDX, HUDY, 1);
setFont("SMALLFONT");
if ((ang < 0.2 || ang > 0.8) && dist < range * 65536)
{
pitch = vectorangle(dist, getactorz(tid) - (getactorz(1000) + (41.0 - zoffset)));
pitch = (pitch + GetActorPitch(1000) + 1.0) % 1.0;
x = HUDX/2 - ((HUDX/2) * sin(ang) / cos(ang));
y = HUDY/2 - ((HUDX/2) * sin(pitch) / cos(pitch));
if (no_hud==0 && tid!=0 && GetActorProperty(tid,APROP_Health)>0) {hudmessage(s:text; HUDMSG_FadeOut | HUDMSG_NOTWITHFULLMAP, 900+tid, colour, (x<<16)+offset, (y<<16)+offset, 0.05);}
if (no_hud==1 || tid==0) {hudmessage(s:""; HUDMSG_PLAIN, 900+tid, colour, (x<<16)+offset, (y<<16)+offset, 0.05);}
}
else
hudmessage(s:" "; HUDMSG_PLAIN, 900, colour, 0, 0, 0);
}
(A big thank you to Isle for making this, and Caligari + Hotwax for adjustments and making this a possibility.)
The only big problem I anticipate here is de-ACS-ifying everything when it comes to doubles/floats. Haven't messed with that in a while... Is it as simple as just removing the bit shifts and * 65536 or is there more to it? That's all I really need to know, I can handle converting everything else.
(Just doing a direct port and using pointers instead of TID with a toggleable boolean to revert. No other enhancements have been planned yet.)