summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f657672)
raw | patch | inline | side by side (parent: f657672)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Wed, 22 Feb 2023 13:47:00 +0000 (16:47 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Fri, 9 Jun 2023 09:20:31 +0000 (12:20 +0300) |
src/game/renders/opengl/r_draw.pas | patch | blob | history | |
src/game/renders/opengl/r_map.pas | patch | blob | history |
index be5d947aaf8365933d5ba226a611b7b51155fe17..f77b3471ce6f043f444d216304a14f782a2f703b 100644 (file)
procedure r_Draw_Rect (l, t, r, b: Integer; rr, gg, bb, aa: Byte);
procedure r_Draw_FillRect (l, t, r, b: Integer; rr, gg, bb, aa: Byte);
procedure r_Draw_InvertRect (l, t, r, b: Integer; rr, gg, bb, aa: Byte);
+ procedure r_Draw_Line (x0, y0, x1, y1: Integer; rr, gg, bb, aa: Byte);
procedure r_Draw_Text (const text: AnsiString; x, y: Integer; r, g, b, a: Byte; f: TGLFont);
procedure r_Draw_GetTextSize (const text: AnsiString; f: TGLFont; out w, h: Integer);
end;
end;
+ procedure r_Draw_Line (x0, y0, x1, y1: Integer; rr, gg, bb, aa: Byte);
+ begin
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ r_Draw_EnableTexture2D(false);
+ r_Draw_SetColor(rr, gg, bb, aa);
+ glLineWidth(1);
+ glBegin(GL_LINES);
+ glVertex2i(x0, y0);
+ glVertex2i(x1, y1);
+ glEnd;
+ end;
+
procedure r_Draw_Text (const text: AnsiString; x, y: Integer; r, g, b, a: Byte; f: TGLFont);
var i, xoff, spc: Integer; t: TGLTexture; ch: AnsiChar;
begin
index ed57ab39513dc8e90074c4f1b6e20b515e1a4bfb..ee1c8b32a48aca7dddeb5404a3f26bb512ba0b2c 100644 (file)
end;
end;
+ procedure r_Map_DrawAim (p: TPlayer);
+ var x0, y0, x1, y1, a, len: Integer;
+ begin
+ ASSERT(p <> nil);
+ r_Common_GetPlayerPos(p, x0, y0);
+ x0 := x0 + WEAPONPOINT[p.Direction].X + IfThen(p.Direction = TDirection.D_LEFT, 7, -7);
+ y0 := y0 + WEAPONPOINT[p.Direction].Y;
+ a := p.Angle_;
+ len := 1024;
+ case p.CurrWeap of
+ WEAPON_KASTET: len := 12;
+ WEAPON_SAW: len := 24;
+ WEAPON_PISTOL, WEAPON_SHOTGUN1, WEAPON_SHOTGUN2, WEAPON_CHAINGUN,
+ WEAPON_ROCKETLAUNCHER, WEAPON_SUPERPULEMET, WEAPON_FLAMETHROWER:
+ begin
+ if a = ANGLE_RIGHTUP then DEC(a, 2);
+ if a = ANGLE_RIGHTDOWN then INC(a, 4);
+ if a = ANGLE_LEFTUP then INC(a, 2);
+ if a = ANGLE_LEFTDOWN then DEC(a, 4);
+ end;
+ WEAPON_PLASMA:
+ begin
+ if a = ANGLE_RIGHTUP then DEC(a, 1);
+ if a = ANGLE_RIGHTDOWN then INC(a, 3);
+ if a = ANGLE_LEFTUP then INC(a, 1);
+ if a = ANGLE_LEFTDOWN then DEC(a, 3);
+ end;
+ WEAPON_BFG:
+ begin
+ if a = ANGLE_RIGHTUP then DEC(a, 1);
+ if a = ANGLE_RIGHTDOWN then INC(a, 2);
+ if a = ANGLE_LEFTUP then INC(a, 1);
+ if a = ANGLE_LEFTDOWN then DEC(a, 2);
+ end;
+ end;
+ x1 := x0 + Trunc(Cos(-DegToRad(a)) * len);
+ y1 := y0 + Trunc(Sin(-DegToRad(a)) * len);
+ r_Draw_Line(x0, y0, x1, y1, 255, 0, 0, 158);
+ end;
+
procedure r_Map_DrawPlayer (p, drawed: TPlayer);
var x, y, ax, ay, w, h: Integer; b, flip: Boolean; t: TGLMultiTexture; tex: TGLTexture; alpha: Byte; count, frame: LongInt;
begin
if (p.FMegaRulez[MR_INVIS] <= gTime) or ((drawed <> nil) and ((p = drawed) or (p.Team = drawed.Team) and (gGameSettings.GameMode <> GM_DM))) then
r_Map_DrawTalkBubble(p);
- // TODO draw aim
+ if gAimLine and p.alive and ((p = gPlayer1) or (p = gPlayer2)) then
+ r_Map_DrawAim(p);
end;
procedure r_Map_DrawPlayers (x, y, w, h: Integer; player: TPlayer);