index 812fd85cd59c5c7f114309e002d690208f5daf77..36bb85fce93a77a36c9fb4f3b0d989d0cfb02260 100644 (file)
PunchTextures: array [Boolean, 0..2] of TGLMultiTexture; // [berserk, center/up/down]
VileFire: TGLMultiTexture;
InvulPenta: TGLTexture;
+ IndicatorTexture: TGLTexture;
+ TalkTexture: TGLTexture;
Models: array of record
anim: array [TDirection, 0..A_LAST] of record
base, mask: TGLMultiTexture;
end;
// --------- other --------- //
InvulPenta := r_Textures_LoadFromFile(GameWad + ':TEXTURES/PENTA');
+ IndicatorTexture := r_Textures_LoadFromFile(GameWad + ':TEXTURES/PLRIND');
+ TalkTexture := r_Textures_LoadFromFile(GameWad + ':TEXTURES/TALKBUBBLE');
end;
procedure r_Map_Free;
var i, j, k: Integer; d: TDirection; b: Boolean;
begin
+ if TalkTexture <> nil then
+ TalkTexture.Free;
+ if IndicatorTexture <> nil then
+ IndicatorTexture.Free;
if InvulPenta <> nil then
InvulPenta.Free;
InvulPenta := nil;
end;
end;
+ procedure r_Map_DrawBubble (x, y: Integer; cb, cf: TRGB);
+ var dot: Integer;
+ begin
+ // Outer borders
+ r_Draw_Rect(x + 1, y, x + 18, y + 13, cb.R, cb.G, cb.B, 255);
+ r_Draw_Rect(x, y + 1, x + 19, y + 12, cb.R, cb.G, cb.B, 255);
+ // Inner box
+ r_Draw_FillRect(x + 1, y + 1, x + 18, y + 12, cf.R, cf.G, cf.B, 255);
+ // TODO Tail
+ // Dots
+ dot := 6;
+ r_Draw_FillRect(x + dot + 0, y + 8, x + dot + 0 + 1 + 1, y + 9 + 1, cb.R, cb.G, cb.B, 255);
+ r_Draw_FillRect(x + dot + 3, y + 8, x + dot + 3 + 1 + 1, y + 9 + 1, cb.R, cb.G, cb.B, 255);
+ r_Draw_FillRect(x + dot + 6, y + 8, x + dot + 6 + 1 + 1, y + 9 + 1, cb.R, cb.G, cb.B, 255);
+ end;
+
+ procedure r_Map_DrawTalkBubble (p: TPlayer);
+ var cobj: TObj; fx, fy, x, y: Integer; cb, cf: TRGB;
+ begin
+ {$IFDEF ENABLE_CORPSES}
+ cobj := g_Corpses_GetCameraObj(p);
+ {$ELSE}
+ cobj := p.Obj;
+ {$ENDIF}
+ cobj.Lerp(gLerpFactor, fx, fy);
+ x := fx + p.obj.rect.x + p.obj.rect.width div 2;
+ y := fy;
+ cb := _RGB(63, 63, 63);
+ cf := _RGB(240, 240, 240);
+ case gChatBubble of
+ 1: // simple text
+ begin
+ r_Common_DrawText('[...]', x, y, 255, 255, 255, 255, stdfont, TBasePoint.BP_DOWN);
+ end;
+ 2: // adv team color
+ begin
+ case p.Team of
+ TEAM_RED: cb := _RGB(255, 63, 63);
+ TEAM_BLUE: cb := _RGB(63, 63, 255);
+ end;
+ r_Map_DrawBubble(x, y - 18, cb, cf);
+ end;
+ 3: // adv player color
+ begin
+ cb := p.Model.Color;
+ cf.R := MIN(cb.R * 2 + 64, 255);
+ cf.G := MIN(cb.G * 2 + 64, 255);
+ cf.B := MIN(cb.B * 2 + 64, 255);
+ if (ABS(cf.R - cb.R) < 32) or (ABS(cf.G - cb.G) < 32) or (ABS(cf.B - cb.B) < 32) then
+ begin
+ cb.R := MAX(cf.R div 2 - 16, 0);
+ cb.G := MAX(cf.G div 2 - 16, 0);
+ cb.B := MAX(cf.B div 2 - 16, 0);
+ end;
+ r_Map_DrawBubble(x, y - 18, cb, cf);
+ end;
+ 4: // textured
+ if TalkTexture <> nil then
+ begin
+ r_Common_DrawTexture(TalkTexture, x + 5, y, TalkTexture.width, TalkTexture.height, TBasePoint.BP_DOWN);
+ end;
+ end;
+ end;
+
procedure r_Map_DrawPlayer (p, drawed: TPlayer);
var fX, fY, fSlope, ax, ay, w, h: Integer; b, flip: Boolean; t: TGLMultiTexture; tex: TGLTexture; alpha: Byte; count, frame: LongInt;
begin
r_Map_DrawPlayerModel(p.Model, fX, fY + fSlope, alpha);
end;
// TODO draw g_debug_frames
- // TODO draw chat bubble
+
+ if (gChatBubble > 0) and p.FKeys[KEY_CHAT].Pressed and (p.Ghost = false) then
+ 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
end;
end;
end;
+ procedure r_Map_DrawIndicator (p: TPlayer; color: TRGB; cx, cy, cw, ch: Integer);
+ var a, ax, ay, fx, fy, fSlope, xx, yy: Integer;
+ begin
+ if (p <> nil) and p.Alive then
+ begin
+ p.obj.Lerp(gLerpFactor, fx, fy);
+ fSlope := nlerp(p.SlopeOld, p.obj.slopeUpLeft, gLerpFactor);
+ case gPlayerIndicatorStyle of
+ 0:
+ if IndicatorTexture <> nil then
+ begin
+ ax := IndicatorTexture.width div 2;
+ ay := IndicatorTexture.height div 2;
+ if (p.obj.x + p.obj.rect.x) < cx then
+ begin
+ a := 90;
+ xx := fx + p.obj.rect.x + p.obj.rect.width;
+ yy := fy + p.obj.rect.y + (p.obj.rect.height - IndicatorTexture.width) div 2;
+ end
+ else if (p.obj.x + p.obj.rect.x + p.obj.rect.width) > (cx + cw) then
+ begin
+ a := 270;
+ xx := fx + p.obj.rect.x - IndicatorTexture.height;
+ yy := fy + p.obj.rect.y - (p.obj.rect.height - IndicatorTexture.width) div 2;
+ end
+ else if (p.obj.y - IndicatorTexture.height) < cy then
+ begin
+ a := 180;
+ xx := fx + p.obj.rect.x + (p.obj.rect.width - IndicatorTexture.width) div 2;
+ yy := fy + p.obj.rect.y + p.obj.rect.height;
+ end
+ else
+ begin
+ a := 0;
+ xx := fx + p.obj.rect.x + (p.obj.rect.width - IndicatorTexture.width) div 2;
+ yy := fy - IndicatorTexture.height;
+ end;
+ yy := yy + fSlope;
+ xx := MIN(MAX(xx, cx), cx + cw - IndicatorTexture.width);
+ yy := MIN(MAX(yy, cy), cy + ch - IndicatorTexture.height);
+ r_Draw_TextureRepeatRotate(IndicatorTexture, xx, yy, IndicatorTexture.width, IndicatorTexture.height, false, color.r, color.g, color.b, 255, false, ax, ay, a);
+ end;
+ 1:
+ begin
+ xx := fx + p.obj.rect.x + p.obj.rect.width div 2;
+ yy := fy + fSlope;
+ r_Common_DrawText(p.Name, xx, yy, color.r, color.g, color.b, 255, stdfont, TBasePoint.BP_DOWN);
+ end;
+ end;
+ end;
+ end;
+
+ procedure r_Map_DrawPlayerIndicators (player: TPlayer; cx, cy, cw, ch: Integer);
+ var i: Integer; p: TPlayer;
+ begin
+ case gPlayerIndicator of
+ 1:
+ if player <> nil then
+ begin
+ r_Map_DrawIndicator(player, _RGB(255, 255, 255), cx, cy, cw, ch);
+ end;
+ 2:
+ if gPlayers <> nil then
+ begin
+ for i := 0 to HIGH(gPlayers) do
+ begin
+ p := gPlayers[i];
+ if p <> nil then
+ begin
+ if (player <> nil) and (p = player) then
+ begin
+ r_Map_DrawIndicator(p, _RGB(255, 255, 255), cx, cy, cw, ch);
+ end
+ else if (player = nil) or ((p.Team = player.Team) and (p.Team <> TEAM_NONE)) then
+ begin
+ case gPlayerIndicatorStyle of
+ 0: r_Map_DrawIndicator(p, p.GetColor(), cx, cy, cw, ch);
+ 1: r_Map_DrawIndicator(p, _RGB(192, 192, 192), cx, cy, cw, ch);
+ end;
+ end;
+ end;
+ end;
+ end;
+ end;
+ end;
+
procedure r_Map_Draw (x, y, w, h, camx, camy: Integer; player: TPlayer);
var iter: TPanelGrid.Iter; p: PPanel; cx, cy, cw, ch, xx, yy, ww, hh: Integer; sx, sy, sw, sh: LongInt; l, t, r, b: Integer;
begin
r_Map_DrawPanelType(PANEL_FORE);
// TODO draw monsters health bar
// TODO draw players health bar
- // TODO draw players indicators
+ if gGameSettings.GameMode <> GM_SINGLE then
+ r_Map_DrawPlayerIndicators(player, cx, cy, cw, ch);
if DebugCameraScale <> 1.0 then
begin
r_Draw_Rect (cx, cy, cx + cw, cy + ch, 0, 255, 0, 255);