DEADSOFTWARE

Initial Player Indicator Implementation.
authorJoseph Stalin <granminigun@gmail.com>
Thu, 20 Dec 2018 21:15:36 +0000 (02:15 +0500)
committerKetmar Dark <ketmar@ketmar.no-ip.org>
Fri, 21 Dec 2018 14:10:33 +0000 (16:10 +0200)
src/game/g_game.pas
src/game/g_language.pas
src/game/g_menu.pas
src/game/g_options.pas
src/game/g_player.pas

index f92af351077aaa34fee47dc16dbb0d6eb9a1056f..503e6169bf74bfeb339535e47caa7b58f29abdf8 100644 (file)
@@ -2313,6 +2313,7 @@ begin
   g_Texture_CreateWADEx('TEXTURE_PLAYER_BLUEFLAG_D', GameWAD+':TEXTURES\FLAGHUD_B_DROP');
   g_Texture_CreateWADEx('TEXTURE_PLAYER_TALKBUBBLE', GameWAD+':TEXTURES\TALKBUBBLE');
   g_Texture_CreateWADEx('TEXTURE_PLAYER_INVULPENTA', GameWAD+':TEXTURES\PENTA');
+  g_Texture_CreateWADEx('TEXTURE_PLAYER_INDICATOR', GameWAD+':TEXTURES\PLRIND');
 
   hasPBarGfx := true;
   if not g_Texture_CreateWADEx('UI_GFX_PBAR_LEFT', GameWAD+':TEXTURES\LLEFT') then hasPBarGfx := false;
@@ -3585,6 +3586,8 @@ begin
 
   renderMapInternal(-c, -d, true);
 
+  if (gGameSettings.GameMode <> GM_SINGLE) and gPlayerIndicator then
+    p.DrawIndicator();
   if p.FSpectator then
     e_TextureFontPrintEx(p.GameX + PLAYER_RECT_CX - 4,
                          p.GameY + PLAYER_RECT_CY - 4,
index 8cadba100245e60df8406e561fb307f11f4f188e..f595199639281b78bca8b04fc629fb4fbb13fff0 100644 (file)
@@ -254,6 +254,7 @@ type
     I_MENU_GAME_MESSAGES,
     I_MENU_GAME_REVERT_PLAYERS,
     I_MENU_GAME_CHAT_BUBBLE,
+    I_MENU_GAME_PLAYER_INDICATOR,
     I_MENU_GAME_CHAT_TYPE_NONE,
     I_MENU_GAME_CHAT_TYPE_SIMPLE,
     I_MENU_GAME_CHAT_TYPE_ADV,
@@ -1080,6 +1081,8 @@ const
                                        'Âòîðîé èãðîê ñâåðõó:'),
     ('MENU GAME CHAT BUBBLE',          'Chat bubbles:',
                                        'Èêîíêà ÷àòà:'),
+    ('MENU GAME PLAYER INDICATOR',     'Player indicator:',
+                                       'Èíäèêàòîð èãðîêà:'),
     ('MENU GAME CHAT TYPE NONE',       'None',
                                        'Íåò'),
     ('MENU GAME CHAT TYPE SIMPLE',     'Simple',
index 23fbf2e947c3f77ac7a455db154a71b120ad6c97..2c3f85153e2ec850f69fade3f52fdda927f0272d 100644 (file)
@@ -160,6 +160,7 @@ begin
   gShowMessages := TGUISwitch(menu.GetControl('swMessages')).ItemIndex = 0;
   gRevertPlayers := TGUISwitch(menu.GetControl('swRevertPlayers')).ItemIndex = 0;
   gChatBubble := TGUISwitch(menu.GetControl('swChatBubble')).ItemIndex;
+  gPlayerIndicator := TGUISwitch(menu.GetControl('swPlayerIndicator')).ItemIndex = 0;
   g_dbg_scale := TGUIScroll(menu.GetControl('scScaleFactor')).Value + 1;
 
   menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
@@ -511,6 +512,9 @@ begin
 
   with TGUISwitch(menu.GetControl('swChatBubble')) do
     ItemIndex := gChatBubble;
+    
+  with TGUISwitch(menu.GetControl('swPlayerIndicator')) do
+    if gPlayerIndicator then ItemIndex := 0 else ItemIndex := 1;
 
   TGUIScroll(menu.GetControl('scScaleFactor')).Value := Round(g_dbg_scale - 1);
 
@@ -2711,6 +2715,12 @@ begin
       AddItem(_lc[I_MENU_GAME_CHAT_TYPE_COLOR]);
       AddItem(_lc[I_MENU_GAME_CHAT_TYPE_TEXTURE]);
     end;
+    with AddSwitch(_lc[I_MENU_GAME_PLAYER_INDICATOR]) do
+    begin
+      Name := 'swPlayerIndicator';
+      AddItem(_lc[I_MENU_YES]);
+      AddItem(_lc[I_MENU_NO]);
+    end;
     with AddScroll(_lc[I_MENU_GAME_SCALE_FACTOR]) do
     begin
       Name := 'scScaleFactor';
index cc9a71400bc4a4a7cf159a0392e171f0c8c4cae8..1f3bd4881e0f9f7e5d4e8d5032d5c11bb6695caf 100644 (file)
@@ -357,6 +357,7 @@ begin
   gShowMessages := True;
   gRevertPlayers := False;
   gChatBubble := 4;
+  gPlayerIndicator := True;
   gSFSDebug := False;
   gSFSFastMode := False;
   e_FastScreenshots := True;
@@ -636,6 +637,7 @@ begin
   ReadBoolean(gShowMessages, 'Messages');
   ReadBoolean(gRevertPlayers, 'RevertPlayers');
   ReadInteger(gChatBubble, 'ChatBubble', 0, 4);
+  ReadBoolean(gPlayerIndicator, 'PlayerIndicator');
   ReadBoolean(gSFSDebug, 'SFSDebug'); wadoptDebug := gSFSDebug;
   ReadBoolean(gSFSFastMode, 'SFSFastMode'); wadoptFast := gSFSFastMode;
   ReadBoolean(e_FastScreenshots, 'FastScreenshots');
@@ -874,6 +876,7 @@ begin
   config.WriteBool('Game', 'Messages', gShowMessages);
   config.WriteBool('Game', 'RevertPlayers', gRevertPlayers);
   config.WriteInt('Game', 'ChatBubble', gChatBubble);
+  config.WriteBool('Game', 'PlayerIndicator', gPlayerIndicator);
   config.WriteBool('Game', 'SFSDebug', gSFSDebug);
   config.WriteBool('Game', 'SFSFastMode', gSFSFastMode);
   config.WriteBool('Game', 'FastScreenshots', e_FastScreenshots);
index 189d241aae564c6fcd0489e9c0f7f8e4a2105509..6abe742c440bf746e51626c3a49bd428a604d799 100644 (file)
@@ -316,6 +316,7 @@ type
     procedure   DrawPickup();
     procedure   DrawRulez();
     procedure   DrawAim();
+    procedure   DrawIndicator();
     procedure   DrawBubble();
     procedure   DrawGUI();
     procedure   Update(); virtual;
@@ -554,6 +555,7 @@ var
   gFly: Boolean = False;
   gAimLine: Boolean = False;
   gChatBubble: Byte = 0;
+  gPlayerIndicator: Boolean = True;
   gNumBots: Word = 0;
   gLMSPID1: Word = 0;
   gLMSPID2: Word = 0;
@@ -2345,6 +2347,25 @@ begin
   inherited;
 end;
 
+procedure TPlayer.DrawIndicator();
+var
+  indX, indY: Integer;
+  indW, indH: Word;
+  ID: DWORD;
+begin
+  if FAlive then
+    begin
+      indX := FObj.X+FObj.Rect.X;
+      indY := FObj.Y - 12;
+      if g_Texture_Get('TEXTURE_PLAYER_INDICATOR', ID) then
+        begin
+          e_GetTextureSize(ID, @indW, @indH);
+          e_Draw(ID, indX + indW div 2, indY, 0, True, False);
+        end;
+    end;
+  //e_TextureFontPrint(indX, indY, FName, gStdFont); // Shows player name overhead
+end;
+
 procedure TPlayer.DrawBubble();
 var
   bubX, bubY: Integer;