From 4fd8798646bcb768e925ba667b0c4790e99e1e71 Mon Sep 17 00:00:00 2001 From: Joseph Stalin Date: Fri, 21 Dec 2018 02:15:36 +0500 Subject: [PATCH] Initial Player Indicator Implementation. --- src/game/g_game.pas | 3 +++ src/game/g_language.pas | 3 +++ src/game/g_menu.pas | 10 ++++++++++ src/game/g_options.pas | 3 +++ src/game/g_player.pas | 21 +++++++++++++++++++++ 5 files changed, 40 insertions(+) diff --git a/src/game/g_game.pas b/src/game/g_game.pas index f92af35..503e616 100644 --- a/src/game/g_game.pas +++ b/src/game/g_game.pas @@ -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, diff --git a/src/game/g_language.pas b/src/game/g_language.pas index 8cadba1..f595199 100644 --- a/src/game/g_language.pas +++ b/src/game/g_language.pas @@ -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', diff --git a/src/game/g_menu.pas b/src/game/g_menu.pas index 23fbf2e..2c3f851 100644 --- a/src/game/g_menu.pas +++ b/src/game/g_menu.pas @@ -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'; diff --git a/src/game/g_options.pas b/src/game/g_options.pas index cc9a714..1f3bd48 100644 --- a/src/game/g_options.pas +++ b/src/game/g_options.pas @@ -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); diff --git a/src/game/g_player.pas b/src/game/g_player.pas index 189d241..6abe742 100644 --- a/src/game/g_player.pas +++ b/src/game/g_player.pas @@ -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; -- 2.29.2