mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
4121: Editor Improvements r=def- a=HamidReza585 Added the option to write separate explanations for different entities and fixed the wrong explanation bug. ![ScreenShot](https://user-images.githubusercontent.com/57710259/131142608-a03ca2d3-6d34-4a8f-ac68-c99e1fb7c8e9.png) ## Checklist - [x] Tested the change ingame - [x] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test if it works standalone, system.c especially - [x] Considered possible null pointers and out of bounds array indexing - [x] Changed no physics that affect existing maps - [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) 4124: Fix specchar transparency and move spec-char to character snap (fixes #4123, #3816) r=def- a=fokkonaut Fixes spec-char being rendered with transparency leading in almost invisible spec chars, aswell as moves spec-char to the character snap serverside. Fixes #4123, #3816 ## Checklist - [ ] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test if it works standalone, system.c especially - [ ] Considered possible null pointers and out of bounds array indexing - [ ] Changed no physics that affect existing maps - [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) Co-authored-by: HamidReza <57710259+HamidReza585@users.noreply.github.com> Co-authored-by: fokkonaut <35420825+fokkonaut@users.noreply.github.com>
This commit is contained in:
commit
76db1d77f4
|
@ -37,7 +37,7 @@ void CNamePlates::RenderNameplate(
|
|||
RenderNameplatePos(Position, pPlayerInfo, 1.0f);
|
||||
}
|
||||
|
||||
void CNamePlates::RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pPlayerInfo, float Alpha)
|
||||
void CNamePlates::RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pPlayerInfo, float Alpha, bool ForceAlpha)
|
||||
{
|
||||
int ClientID = pPlayerInfo->m_ClientID;
|
||||
|
||||
|
@ -115,7 +115,7 @@ void CNamePlates::RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pP
|
|||
STextRenderColor TColor;
|
||||
STextRenderColor TOutlineColor;
|
||||
|
||||
if(OtherTeam)
|
||||
if(OtherTeam && !ForceAlpha)
|
||||
{
|
||||
TOutlineColor.Set(0.0f, 0.0f, 0.0f, 0.2f * g_Config.m_ClShowOthersAlpha / 100.0f);
|
||||
TColor.Set(rgb.r, rgb.g, rgb.b, g_Config.m_ClShowOthersAlpha / 100.0f);
|
||||
|
@ -274,9 +274,7 @@ void CNamePlates::OnRender()
|
|||
|
||||
if(m_pClient->m_aClients[i].m_SpecCharPresent)
|
||||
{
|
||||
bool OtherTeam = m_pClient->IsOtherTeam(i);
|
||||
float Alpha = 0.4f * (OtherTeam ? g_Config.m_ClShowOthersAlpha / 100.0f : 1.0f);
|
||||
RenderNameplatePos(m_pClient->m_aClients[i].m_SpecChar, pInfo, Alpha);
|
||||
RenderNameplatePos(m_pClient->m_aClients[i].m_SpecChar, pInfo, 0.4f, true);
|
||||
}
|
||||
|
||||
// only render active characters
|
||||
|
|
|
@ -43,7 +43,7 @@ class CNamePlates : public CComponent
|
|||
const CNetObj_Character *pPrevChar,
|
||||
const CNetObj_Character *pPlayerChar,
|
||||
const CNetObj_PlayerInfo *pPlayerInfo);
|
||||
void RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pPlayerInfo, float Alpha);
|
||||
void RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pPlayerInfo, float Alpha, bool ForceAlpha = false);
|
||||
|
||||
SPlayerNamePlate m_aNamePlates[MAX_CLIENTS];
|
||||
class CPlayers *m_pPlayers;
|
||||
|
|
|
@ -691,10 +691,8 @@ void CPlayers::OnRender()
|
|||
{
|
||||
continue;
|
||||
}
|
||||
bool OtherTeam = m_pClient->IsOtherTeam(i);
|
||||
float Alpha = OtherTeam ? g_Config.m_ClShowOthersAlpha / 100.0f : 1.0f;
|
||||
vec2 Pos = m_pClient->m_aClients[i].m_SpecChar;
|
||||
RenderTools()->RenderTee(CAnimState::GetIdle(), &m_RenderInfoSpec, EMOTE_BLINK, vec2(1, 0), Pos, Alpha);
|
||||
RenderTools()->RenderTee(CAnimState::GetIdle(), &m_RenderInfoSpec, EMOTE_BLINK, vec2(1, 0), Pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -2392,7 +2392,14 @@ void CEditor::DoMapEditor(CUIRect View)
|
|||
Layer = LAYER_TUNE;
|
||||
}
|
||||
if(m_ShowPicker && Layer != NUM_LAYERS)
|
||||
m_pTooltip = Explain((int)wx / 32 + (int)wy / 32 * 16, Layer);
|
||||
{
|
||||
if(m_SelectEntitiesImage == "DDNet")
|
||||
m_pTooltip = Explain(EXPLANATION_DDNET, (int)wx / 32 + (int)wy / 32 * 16, Layer);
|
||||
else if(m_SelectEntitiesImage == "FNG")
|
||||
m_pTooltip = Explain(EXPLANATION_FNG, (int)wx / 32 + (int)wy / 32 * 16, Layer);
|
||||
else if(m_SelectEntitiesImage == "Vanilla")
|
||||
m_pTooltip = Explain(EXPLANATION_VANILLA, (int)wx / 32 + (int)wy / 32 * 16, Layer);
|
||||
}
|
||||
else if(m_Brush.IsEmpty())
|
||||
m_pTooltip = "Use left mouse button to drag and create a brush. Hold shift to select multiple quads.";
|
||||
else
|
||||
|
|
|
@ -1060,7 +1060,82 @@ public:
|
|||
void AddFileDialogEntry(int Index, CUIRect *pView);
|
||||
void SelectGameLayer();
|
||||
void SortImages();
|
||||
static const char *Explain(int Tile, int Layer);
|
||||
|
||||
//Tile Numbers For Explanations - TODO: Add/Improve tiles and explanations
|
||||
enum
|
||||
{
|
||||
TILE_PUB_AIR,
|
||||
TILE_PUB_HOOKABLE,
|
||||
TILE_PUB_DEATH,
|
||||
TILE_PUB_UNHOOKABLE,
|
||||
|
||||
TILE_PUB_CREDITS1 = 140,
|
||||
TILE_PUB_CREDITS2,
|
||||
TILE_PUB_CREDITS3,
|
||||
TILE_PUB_CREDITS4,
|
||||
TILE_PUB_CREDITS5 = 156,
|
||||
TILE_PUB_CREDITS6,
|
||||
TILE_PUB_CREDITS7,
|
||||
TILE_PUB_CREDITS8,
|
||||
|
||||
TILE_PUB_ENTITIES_OFF1 = 190,
|
||||
TILE_PUB_ENTITIES_OFF2,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
TILE_FNG_SPIKE_GOLD = 7,
|
||||
TILE_FNG_SPIKE_NORMAL,
|
||||
TILE_FNG_SPIKE_RED,
|
||||
TILE_FNG_SPIKE_BLUE,
|
||||
TILE_FNG_SCORE_RED,
|
||||
TILE_FNG_SCORE_BLUE,
|
||||
|
||||
TILE_FNG_SPIKE_GREEN = 14,
|
||||
TILE_FNG_SPIKE_PURPLE,
|
||||
|
||||
TILE_FNG_SPAWN = 192,
|
||||
TILE_FNG_SPAWN_RED,
|
||||
TILE_FNG_SPAWN_BLUE,
|
||||
TILE_FNG_FLAG_RED,
|
||||
TILE_FNG_FLAG_BLUE,
|
||||
TILE_FNG_SHIELD,
|
||||
TILE_FNG_HEART,
|
||||
TILE_FNG_SHOTGUN,
|
||||
TILE_FNG_GRENADE,
|
||||
TILE_FNG_NINJA,
|
||||
TILE_FNG_LASER,
|
||||
|
||||
TILE_FNG_SPIKE_OLD1 = 208,
|
||||
TILE_FNG_SPIKE_OLD2,
|
||||
TILE_FNG_SPIKE_OLD3
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
TILE_VANILLA_SPAWN = 192,
|
||||
TILE_VANILLA_SPAWN_RED,
|
||||
TILE_VANILLA_SPAWN_BLUE,
|
||||
TILE_VANILLA_FLAG_RED,
|
||||
TILE_VANILLA_FLAG_BLUE,
|
||||
TILE_VANILLA_SHIELD,
|
||||
TILE_VANILLA_HEART,
|
||||
TILE_VANILLA_SHOTGUN,
|
||||
TILE_VANILLA_GRENADE,
|
||||
TILE_VANILLA_NINJA,
|
||||
TILE_VANILLA_LASER,
|
||||
};
|
||||
|
||||
//Explanations
|
||||
enum
|
||||
{
|
||||
EXPLANATION_DDNET,
|
||||
EXPLANATION_FNG,
|
||||
EXPLANATION_RACE,
|
||||
EXPLANATION_VANILLA,
|
||||
EXPLANATION_BLOCKWORLDS
|
||||
};
|
||||
static const char *Explain(int ExplanationID, int Tile, int Layer);
|
||||
|
||||
int GetLineDistance() const;
|
||||
void ZoomMouseTarget(float ZoomFactor);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1289,6 +1289,24 @@ void CCharacter::Snap(int SnappingClient)
|
|||
}
|
||||
}
|
||||
|
||||
bool ShowSpec = IsPaused();
|
||||
|
||||
if(SnappingClient >= 0)
|
||||
{
|
||||
CPlayer *pSnapPlayer = GameServer()->m_apPlayers[SnappingClient];
|
||||
ShowSpec = ShowSpec && (GameServer()->GetDDRaceTeam(m_pPlayer->GetCID()) == GameServer()->GetDDRaceTeam(SnappingClient) || pSnapPlayer->m_ShowOthers == 1 || (pSnapPlayer->GetTeam() == TEAM_SPECTATORS || pSnapPlayer->IsPaused()));
|
||||
}
|
||||
|
||||
if(ShowSpec)
|
||||
{
|
||||
CNetObj_SpecChar *pSpecChar = static_cast<CNetObj_SpecChar *>(Server()->SnapNewItem(NETOBJTYPE_SPECCHAR, ID, sizeof(CNetObj_SpecChar)));
|
||||
if(!pSpecChar)
|
||||
return;
|
||||
|
||||
pSpecChar->m_X = Core()->m_Pos.x;
|
||||
pSpecChar->m_Y = Core()->m_Pos.y;
|
||||
}
|
||||
|
||||
CNetObj_DDNetCharacter *pDDNetCharacter = static_cast<CNetObj_DDNetCharacter *>(Server()->SnapNewItem(NETOBJTYPE_DDNETCHARACTER, ID, sizeof(CNetObj_DDNetCharacter)));
|
||||
if(!pDDNetCharacter)
|
||||
return;
|
||||
|
|
|
@ -424,24 +424,6 @@ void CPlayer::Snap(int SnappingClient)
|
|||
return;
|
||||
pRaceInfo->m_RaceStartTick = m_pCharacter->m_StartTime;
|
||||
}
|
||||
|
||||
bool ShowSpec = m_pCharacter && m_pCharacter->IsPaused();
|
||||
|
||||
if(SnappingClient >= 0)
|
||||
{
|
||||
CPlayer *pSnapPlayer = GameServer()->m_apPlayers[SnappingClient];
|
||||
ShowSpec = ShowSpec && (GameServer()->GetDDRaceTeam(id) == GameServer()->GetDDRaceTeam(SnappingClient) || pSnapPlayer->m_ShowOthers == 1 || (pSnapPlayer->GetTeam() == TEAM_SPECTATORS || pSnapPlayer->IsPaused()));
|
||||
}
|
||||
|
||||
if(ShowSpec)
|
||||
{
|
||||
CNetObj_SpecChar *pSpecChar = static_cast<CNetObj_SpecChar *>(Server()->SnapNewItem(NETOBJTYPE_SPECCHAR, id, sizeof(CNetObj_SpecChar)));
|
||||
if(!pSpecChar)
|
||||
return;
|
||||
|
||||
pSpecChar->m_X = m_pCharacter->Core()->m_Pos.x;
|
||||
pSpecChar->m_Y = m_pCharacter->Core()->m_Pos.y;
|
||||
}
|
||||
}
|
||||
|
||||
void CPlayer::FakeSnap()
|
||||
|
|
Loading…
Reference in a new issue