Merge branch 'master2' of git://github.com/Choupom/teeworlds

This commit is contained in:
SushiTee 2012-08-22 21:14:45 +02:00
commit c5cd2279f8
5 changed files with 136 additions and 253 deletions

View file

@ -48,7 +48,7 @@ CMenus::CMenus()
m_NeedRestartGraphics = false;
m_NeedRestartSound = false;
m_TeePartsSelected = SELECTION_BODY;
m_TeePartSelected = SKINPART_BODY;
m_aSaveSkinName[0] = 0;
m_MenuActive = true;
m_UseMouseButtons = true;

View file

@ -191,7 +191,7 @@ class CMenus : public CComponent
// for settings
bool m_NeedRestartGraphics;
bool m_NeedRestartSound;
int m_TeePartsSelected;
int m_TeePartSelected;
char m_aSaveSkinName[24];
void SaveSkinfile();

View file

@ -48,9 +48,6 @@ bool CMenusKeyBinder::OnInput(IInput::CEvent Event)
return false;
}
static int const gs_aSelectionParts[6] = {SELECTION_BODY, SELECTION_TATTOO, SELECTION_DECORATION,
SELECTION_HANDS, SELECTION_FEET, SELECTION_EYES};
int CMenus::DoButton_Customize(const void *pID, IGraphics::CTextureHandle Texture, int SpriteID, const CUIRect *pRect, float ImageRatio)
{
float Seconds = 0.6f; // 0.6 seconds for fade
@ -123,88 +120,49 @@ void CMenus::WriteLineSkinfile(IOHANDLE File, const char *pLine)
void CMenus::RenderHSLPicker(CUIRect MainView)
{
// check if we need the color stuff
bool Checked = false;
for(int i = 0; i < NUM_SKINPARTS; i++)
{
if(m_TeePartsSelected&(1<<i))
{
if(*gs_apUCCVariables[i])
{
Checked = true;
break;
}
}
}
CUIRect Label;
CUIRect Label, Button, Picker;
// background
float Spacing = 2.0f;
float ButtonHeight = 20.0f;
RenderTools()->DrawUIRect(&MainView, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
MainView.HSplitTop(ButtonHeight, &Label, &MainView);
// color header
float HeaderHeight = 20.0f;
MainView.HSplitTop(HeaderHeight, &Label, &MainView);
Label.y += 2.0f;
UI()->DoLabel(&Label, Localize("Coloration"), ButtonHeight*ms_FontmodHeight*0.8f, 0);
// dont do all the rest if not needed
if(!Checked)
{
// render background of color selection here anyway
MainView.HSplitTop(Spacing, 0, &MainView);
RenderTools()->DrawUIRect(&MainView, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
return;
}
bool Modified = false;
int ConfigColor = -1;
for(int p = 0; p < NUM_SKINPARTS; p++)
{
if(!(m_TeePartsSelected&(1<<p)))
continue;
int Val = (*gs_apColorVariables[p])&0xffffff;
if(ConfigColor != -1 && ConfigColor != Val)
{
ConfigColor = -1;
break;
}
ConfigColor = Val;
}
CUIRect Button, Picker;
UI()->DoLabel(&Label, Localize("Color"), HeaderHeight*ms_FontmodHeight*0.8f, 0);
MainView.HSplitTop(Spacing, 0, &MainView);
bool UseAlpha = (m_TeePartsSelected & SELECTION_TATTOO) && *gs_apUCCVariables[SKINPART_TATTOO];
// use custom color checkbox
float ButtonHeight = 20.0f;
MainView.HSplitTop(ButtonHeight, &Button, &MainView);
static int s_CustomColors = 0;
if(DoButton_CheckBox(&s_CustomColors, Localize("Custom colors"), *gs_apUCCVariables[m_TeePartSelected], &Button))
*gs_apUCCVariables[m_TeePartSelected] ^= 1;
if(!(*gs_apUCCVariables[m_TeePartSelected]))
return;
MainView.HSplitTop(Spacing, 0, &MainView);
bool Modified = false;
bool UseAlpha = m_TeePartSelected == SKINPART_TATTOO;
int Color = *gs_apColorVariables[m_TeePartSelected];
int Hue, Sat, Lgt, Alp;
if(ConfigColor != -1)
{
Hue = (ConfigColor>>16)&0xff;
Sat = (ConfigColor>>8)&0xff;
Lgt = ConfigColor&0xff;
}
else
{
Hue = -1;
Sat = -1;
Lgt = -1;
}
Hue = (Color>>16)&0xff;
Sat = (Color>>8)&0xff;
Lgt = Color&0xff;
if(UseAlpha)
Alp = (g_Config.m_PlayerColorTattoo>>24)&0xff;
else
Alp = -1;
Alp = (Color>>24)&0xff;
MainView.HSplitTop(UseAlpha ? 186.0f : 208.0f, &Picker, &MainView);
MainView.HSplitTop(144.0f, &Picker, &MainView);
RenderTools()->DrawUIRect(&Picker, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
// Hue/Lgt picker :
{
Picker.VMargin((Picker.w-256.0f)/2.0f, &Picker);
Picker.HMargin((Picker.h-128.0f)/2.0f, &Picker);
//Picker.VSplitLeft(256.0f, &Picker, 0);
//Picker.HSplitTop(128.0f, &Picker, 0);
// picker
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_HLPICKER].m_Id);
@ -261,18 +219,20 @@ void CMenus::RenderHSLPicker(CUIRect MainView)
const char *const apNames[4] = {Localize("Hue:"), Localize("Sat:"), Localize("Lgt:"), Localize("Alp:")};
int *const apVars[4] = {&Hue, &Sat, &Lgt, &Alp};
static int s_aButtons[12];
float SliderHeight = 16.0f;
for(int i = 0; i < NumBars; i++)
{
CUIRect Bar;
// label
MainView.HSplitTop(ButtonHeight, &Label, &MainView);
MainView.HSplitTop(Spacing, 0, &MainView);
RenderTools()->DrawUIRect(&Label, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
MainView.HSplitTop(SliderHeight, &Label, &MainView);
MainView.HSplitTop(Spacing, 0, &MainView);
// label
RenderTools()->DrawUIRect(&Label, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
Label.VSplitLeft((Label.w-168.0f)/2.0f, &Label, &Button);
Label.y += 2.0f;
UI()->DoLabelScaled(&Label, apNames[i], ButtonHeight*ms_FontmodHeight*0.8f, 0);
UI()->DoLabelScaled(&Label, apNames[i], SliderHeight*ms_FontmodHeight*0.8f, 0);
// button <
Button.VSplitLeft(Button.h, &Button, &Bar);
@ -321,11 +281,12 @@ void CMenus::RenderHSLPicker(CUIRect MainView)
Modified = true;
}
// label value
// value label
char aBuf[16];
str_format(aBuf, sizeof(aBuf), "%d", *apVars[i]);
Label.y += 2.0f;
UI()->DoLabelScaled(&Label, aBuf, ButtonHeight*ms_FontmodHeight*0.8f, 0);
UI()->DoLabelScaled(&Label, aBuf, SliderHeight*ms_FontmodHeight*0.8f, 0);
// logic
int X;
int Logic = UI()->DoPickerLogic(&s_aButtons[i*3+2], &Bar, &X, 0);
@ -342,7 +303,7 @@ void CMenus::RenderHSLPicker(CUIRect MainView)
int NewVal = (Hue << 16) + (Sat << 8) + Lgt;
for(int p = 0; p < NUM_SKINPARTS; p++)
{
if(m_TeePartsSelected&(1<<p))
if(m_TeePartSelected == p)
*gs_apColorVariables[p] = NewVal;
}
if(UseAlpha)
@ -371,7 +332,7 @@ void CMenus::RenderSkinSelection(CUIRect MainView)
int OldSelected = -1;
UiDoListboxHeader(&MainView, Localize("Skins"), 20.0f, 2.0f);
UiDoListboxStart(&s_InitSkinlist, 50.0f, 0, s_paSkinList.size(), 12, OldSelected, s_ScrollValue);
UiDoListboxStart(&s_InitSkinlist, 50.0f, 0, s_paSkinList.size(), 10, OldSelected, s_ScrollValue);
for(int i = 0; i < s_paSkinList.size(); ++i)
{
@ -399,7 +360,7 @@ void CMenus::RenderSkinSelection(CUIRect MainView)
}
}
Info.m_Size = 40.0f;
Info.m_Size = 50.0f;
Item.m_Rect.HSplitTop(5.0f, 0, &Item.m_Rect); // some margin from the top
RenderTools()->RenderTee(CAnimState::GetIdle(), &Info, 0, vec2(1.0f, 0.0f), vec2(Item.m_Rect.x+Item.m_Rect.w/2, Item.m_Rect.y+Item.m_Rect.h/2));
}
@ -445,43 +406,22 @@ void CMenus::RenderSkinPartSelection(CUIRect MainView)
s_InitSkinPartList = false;
}
int p = -1;
for(int i = 0; i < NUM_SKINPARTS; i++)
const char *const apTitles[6] = {Localize("Bodies"), Localize("Tattoos"), Localize("Decoration"),
Localize("Hands"), Localize("Feet"), Localize("Eyes")};
static int OldSelected = -1;
UiDoListboxHeader(&MainView, apTitles[m_TeePartSelected], 20.0f, 2.0f);
UiDoListboxStart(&s_InitSkinPartList, 50.0f, 0, s_paList[m_TeePartSelected].size(), 5, OldSelected, s_ScrollValue);
for(int i = 0; i < s_paList[m_TeePartSelected].size(); ++i)
{
if(m_TeePartsSelected == 1<<i)
p = i;
}
if(p < 0)
{
// fake list layout for better looks
CUIRect Label;
float Spacing = 2.0f;
float ButtonHeight = 20.0f;
RenderTools()->DrawUIRect(&MainView, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
MainView.HSplitTop(ButtonHeight, &Label, &MainView);
Label.y += 2.0f;
UI()->DoLabel(&Label, Localize("Selection"), ButtonHeight*ms_FontmodHeight*0.8f, 0);
MainView.HSplitTop(Spacing, 0, &MainView);
RenderTools()->DrawUIRect(&MainView, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
return;
}
int OldSelected = -1;
UiDoListboxHeader(&MainView, Localize("Selection"), 20.0f, 2.0f);
UiDoListboxStart(&s_InitSkinPartList, 50.0f, 0, s_paList[p].size(), 6, OldSelected, s_ScrollValue);
for(int i = 0; i < s_paList[p].size(); ++i)
{
const CSkins::CSkinPart *s = s_paList[p][i];
const CSkins::CSkinPart *s = s_paList[m_TeePartSelected][i];
if(s == 0)
continue;
if(!str_comp(s->m_aName, gs_apSkinVariables[p]))
if(!str_comp(s->m_aName, gs_apSkinVariables[m_TeePartSelected]))
OldSelected = i;
CListboxItem Item = UiDoListboxNextItem(&s_paList[p][i], OldSelected == i);
CListboxItem Item = UiDoListboxNextItem(&s_paList[m_TeePartSelected][i], OldSelected == i);
if(Item.m_Visible)
{
CTeeRenderInfo Info;
@ -491,7 +431,7 @@ void CMenus::RenderSkinPartSelection(CUIRect MainView)
const CSkins::CSkinPart *pSkinPart = m_pClient->m_pSkins->GetSkinPart(j, SkinPart);
if(*gs_apUCCVariables[j])
{
if(p == j)
if(m_TeePartSelected == j)
Info.m_aTextures[j] = s->m_ColorTexture;
else
Info.m_aTextures[j] = pSkinPart->m_ColorTexture;
@ -499,16 +439,16 @@ void CMenus::RenderSkinPartSelection(CUIRect MainView)
}
else
{
if(p == j)
if(m_TeePartSelected == j)
Info.m_aTextures[j] = s->m_OrgTexture;
else
Info.m_aTextures[j] = pSkinPart->m_OrgTexture;
Info.m_aColors[j] = vec4(1.0f, 1.0f, 1.0f, 1.0f);
}
}
Info.m_Size = 40.0f;
Info.m_Size = 50.0f;
Item.m_Rect.HSplitTop(5.0f, 0, &Item.m_Rect); // some margin from the top
RenderTools()->RenderTee(CAnimState::GetIdle(), &Info, 0, vec2(1.0f, 0.0f), vec2(Item.m_Rect.x+Item.m_Rect.w/2, Item.m_Rect.y+Item.m_Rect.h/2), m_TeePartsSelected, true);
RenderTools()->RenderTee(CAnimState::GetIdle(), &Info, 0, vec2(1.0f, 0.0f), vec2(Item.m_Rect.x+Item.m_Rect.w/2, Item.m_Rect.y+Item.m_Rect.h/2));
}
}
@ -517,8 +457,8 @@ void CMenus::RenderSkinPartSelection(CUIRect MainView)
{
if(NewSelected != OldSelected)
{
const CSkins::CSkinPart *s = s_paList[p][NewSelected];
mem_copy(gs_apSkinVariables[p], s->m_aName, 24);
const CSkins::CSkinPart *s = s_paList[m_TeePartSelected][NewSelected];
mem_copy(gs_apSkinVariables[m_TeePartSelected], s->m_aName, 24);
}
}
OldSelected = NewSelected;
@ -929,8 +869,8 @@ void CMenus::RenderSettingsTeeCustom(CUIRect MainView)
UI()->DoLabel(&Label, Localize("Customize"), ButtonHeight*ms_FontmodHeight*0.8f, 0);
// skin part selection
static const char *const apParts[6] = {Localize("Body"), Localize("Tattoo"), Localize("Decoration"),
Localize("Hands"), Localize("Feet"), Localize("Eyes")};
const char *const apParts[6] = {Localize("Body"), Localize("Tattoo"), Localize("Decoration"),
Localize("Hands"), Localize("Feet"), Localize("Eyes")};
MainView.HSplitTop(SpacingH, 0, &MainView);
MainView.HSplitTop(ButtonHeight, &Patterns, &MainView);
@ -938,29 +878,13 @@ void CMenus::RenderSettingsTeeCustom(CUIRect MainView)
float ButtonWidth = (Patterns.w/6.0f)-(SpacingW*5.0)/6.0f;
static int s_PatternButtons[6] = {0};
static int s_aPatternButtons[6] = {0};
for(int i = 0; i < NUM_SKINPARTS; i++)
{
Patterns.VSplitLeft(ButtonWidth, &Button, &Patterns);
if(DoButton_MenuTabTop(&s_PatternButtons[i], apParts[i], m_TeePartsSelected&(1<<i), &Button))
if(DoButton_MenuTabTop(&s_aPatternButtons[i], apParts[i], m_TeePartSelected==i, &Button))
{
if(Input()->KeyPressed(KEY_RCTRL) || Input()->KeyPressed(KEY_LCTRL))
m_TeePartsSelected ^= 1<<i;
else
m_TeePartsSelected = 1<<i;
}
Patterns.VSplitLeft(SpacingW, 0, &Patterns);
}
MainView.HSplitTop(SpacingH, 0, &MainView);
MainView.HSplitTop(ButtonHeight, &Patterns, &MainView);
static int s_PatternUCCBoxes[6] = {0};
for(int i = 0; i < NUM_SKINPARTS; i++)
{
Patterns.VSplitLeft(ButtonWidth, &Button, &Patterns);
if(DoButton_CheckBox(&s_PatternUCCBoxes[i], Localize("Custom Color"), *gs_apUCCVariables[i], &Button))
{
*gs_apUCCVariables[i] ^= 1;
m_TeePartSelected = i;
}
Patterns.VSplitLeft(SpacingW, 0, &Patterns);
}
@ -991,7 +915,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
float SpacingH = 2.0f;
float SpacingW = 3.0f;
float ButtonHeight = 20.0f;
float SkinHeight = 45.0f;
float SkinHeight = 50.0f;
float BackgroundHeight = ButtonHeight+SpacingH+SkinHeight;
if(!s_CustomSkinMenu)
BackgroundHeight = (ButtonHeight+SpacingH)*2.0f+SkinHeight;
@ -1019,13 +943,13 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
RenderTools()->DrawUIRect(&Left, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
Left.VSplitMid(&Label, &Left);
Label.y += 14.0f;
Label.y += 17.0f;
UI()->DoLabelScaled(&Label, Localize("Normal:"), ButtonHeight*ms_FontmodHeight*0.8f, 0);
RenderTools()->DrawUIRect(&Left, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
CTeeRenderInfo OwnSkinInfo;
OwnSkinInfo.m_Size = 40.0f;
OwnSkinInfo.m_Size = 50.0f;
for(int p = 0; p < NUM_SKINPARTS; p++)
{
int SkinPart = m_pClient->m_pSkins->FindSkinPart(p, gs_apSkinVariables[p]);
@ -1047,7 +971,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
RenderTools()->DrawUIRect(&Right, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
Right.VSplitLeft(Right.w/3.0f+SpacingW/2.0f, &Label, &Right);
Label.y += 14.0f;
Label.y += 17.0f;
UI()->DoLabelScaled(&Label, Localize("Team:"), ButtonHeight*ms_FontmodHeight*0.8f, 0);
Right.VSplitMid(&Left, &Right);

View file

@ -348,7 +348,7 @@ void CRenderTools::DrawUIRect4(const CUIRect *r, vec4 ColorTopLeft, vec4 ColorTo
Graphics()->QuadsEnd();
}
void CRenderTools::RenderTee(CAnimState *pAnim, CTeeRenderInfo *pInfo, int Emote, vec2 Dir, vec2 Pos, int Parts, bool RenderBackground)
void CRenderTools::RenderTee(CAnimState *pAnim, CTeeRenderInfo *pInfo, int Emote, vec2 Dir, vec2 Pos)
{
vec2 Direction = Dir;
vec2 Position = Pos;
@ -358,95 +358,68 @@ void CRenderTools::RenderTee(CAnimState *pAnim, CTeeRenderInfo *pInfo, int Emote
// TODO: FIX ME
//Graphics()->QuadsDraw(pos.x, pos.y-128, 128, 128);
float AnimScale = pInfo->m_Size * 1.0f/64.0f;
float BaseSize = pInfo->m_Size;
vec2 BodyPos = Position + vec2(pAnim->GetBody()->m_X, pAnim->GetBody()->m_Y)*AnimScale;
// first pass we draw the outline
// second pass we draw the filling
for(int p = 0; p < 2; p++)
{
bool OutLine = p==0 ? 1 : 0;
bool OutLine = p==0;
for(int f = 0; f < 2; f++)
{
float AnimScale = pInfo->m_Size * 1.0f/64.0f;
float BaseSize = pInfo->m_Size;
if(f == 1)
{
vec2 BodyPos = Position + vec2(pAnim->GetBody()->m_X, pAnim->GetBody()->m_Y)*AnimScale;
IGraphics::CQuadItem BodyItem(BodyPos.x, BodyPos.y, BaseSize, BaseSize);
IGraphics::CQuadItem Item;
// draw hands (only if selected)
if(Parts&SELECTION_HANDS)
{
vec2 HandPos = BodyPos + vec2(7.0f, 0.0f);
Graphics()->TextureSet(pInfo->m_aTextures[3]);
Graphics()->QuadsBegin();
vec4 Color = pInfo->m_aColors[3];
Graphics()->SetColor(Color.r, Color.g, Color.b, Color.a);
SelectSprite(OutLine?SPRITE_TEE_HAND_OUTLINE:SPRITE_TEE_HAND, 0, 0, 0);
IGraphics::CQuadItem QuadItem(HandPos.x, HandPos.y, BaseSize/2.0f, BaseSize/2.0f);
Graphics()->QuadsDraw(&QuadItem, 1);
Graphics()->QuadsEnd();
}
// draw decoration
if(Parts&SELECTION_DECORATION || (OutLine && RenderBackground))
if(pInfo->m_aTextures[2].IsValid())
{
if(pInfo->m_aTextures[2].IsValid())
{
Graphics()->TextureSet(pInfo->m_aTextures[2]);
Graphics()->QuadsBegin();
Graphics()->QuadsSetRotation(pAnim->GetBody()->m_Angle*pi*2);
Graphics()->SetColor(pInfo->m_aColors[2].r, pInfo->m_aColors[2].g, pInfo->m_aColors[2].b, pInfo->m_aColors[2].a);
SelectSprite(OutLine?SPRITE_TEE_DECORATION_OUTLINE:SPRITE_TEE_DECORATION, 0, 0, 0);
Item = BodyItem;
Graphics()->QuadsDraw(&Item, 1);
Graphics()->QuadsEnd();
}
}
// draw body (behind tattoo)
if(Parts&SELECTION_BODY || (OutLine && RenderBackground) || (RenderBackground && Parts&SELECTION_EYES))
{
Graphics()->TextureSet(pInfo->m_aTextures[0]);
Graphics()->TextureSet(pInfo->m_aTextures[2]);
Graphics()->QuadsBegin();
Graphics()->QuadsSetRotation(pAnim->GetBody()->m_Angle*pi*2);
if(OutLine)
{
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
SelectSprite(SPRITE_TEE_BODY_OUTLINE, 0, 0, 0);
}
else
{
if(!(Parts&SELECTION_BODY) && Parts&SELECTION_EYES)
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
else
Graphics()->SetColor(pInfo->m_aColors[0].r, pInfo->m_aColors[0].g, pInfo->m_aColors[0].b, pInfo->m_aColors[0].a);
SelectSprite(SPRITE_TEE_BODY, 0, 0, 0);
}
Graphics()->SetColor(pInfo->m_aColors[2].r, pInfo->m_aColors[2].g, pInfo->m_aColors[2].b, pInfo->m_aColors[2].a);
SelectSprite(OutLine?SPRITE_TEE_DECORATION_OUTLINE:SPRITE_TEE_DECORATION, 0, 0, 0);
Item = BodyItem;
Graphics()->QuadsDraw(&Item, 1);
Graphics()->QuadsEnd();
}
// draw tattoo
if(Parts&SELECTION_TATTOO && !OutLine)
// draw body (behind tattoo)
Graphics()->TextureSet(pInfo->m_aTextures[0]);
Graphics()->QuadsBegin();
Graphics()->QuadsSetRotation(pAnim->GetBody()->m_Angle*pi*2);
if(OutLine)
{
if(pInfo->m_aTextures[1].IsValid())
{
Graphics()->TextureSet(pInfo->m_aTextures[1]);
Graphics()->QuadsBegin();
Graphics()->QuadsSetRotation(pAnim->GetBody()->m_Angle*pi*2);
Graphics()->SetColor(pInfo->m_aColors[1].r, pInfo->m_aColors[1].g, pInfo->m_aColors[1].b, pInfo->m_aColors[1].a);
SelectSprite(SPRITE_TEE_TATTOO, 0, 0, 0);
Item = BodyItem;
Graphics()->QuadsDraw(&Item, 1);
Graphics()->QuadsEnd();
}
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
SelectSprite(SPRITE_TEE_BODY_OUTLINE, 0, 0, 0);
}
else
{
Graphics()->SetColor(pInfo->m_aColors[0].r, pInfo->m_aColors[0].g, pInfo->m_aColors[0].b, pInfo->m_aColors[0].a);
SelectSprite(SPRITE_TEE_BODY, 0, 0, 0);
}
Item = BodyItem;
Graphics()->QuadsDraw(&Item, 1);
Graphics()->QuadsEnd();
// draw tattoo
if(pInfo->m_aTextures[1].IsValid() && !OutLine)
{
Graphics()->TextureSet(pInfo->m_aTextures[1]);
Graphics()->QuadsBegin();
Graphics()->QuadsSetRotation(pAnim->GetBody()->m_Angle*pi*2);
Graphics()->SetColor(pInfo->m_aColors[1].r, pInfo->m_aColors[1].g, pInfo->m_aColors[1].b, pInfo->m_aColors[1].a);
SelectSprite(SPRITE_TEE_TATTOO, 0, 0, 0);
Item = BodyItem;
Graphics()->QuadsDraw(&Item, 1);
Graphics()->QuadsEnd();
}
// draw body (in front of tattoo)
if((Parts&SELECTION_BODY || (Parts&SELECTION_EYES && RenderBackground)) && !OutLine)
if(!OutLine)
{
Graphics()->TextureSet(pInfo->m_aTextures[0]);
Graphics()->QuadsBegin();
@ -462,12 +435,12 @@ void CRenderTools::RenderTee(CAnimState *pAnim, CTeeRenderInfo *pInfo, int Emote
}
// draw eyes
if(Parts&SELECTION_EYES && !OutLine)
Graphics()->TextureSet(pInfo->m_aTextures[5]);
Graphics()->QuadsBegin();
Graphics()->QuadsSetRotation(pAnim->GetBody()->m_Angle*pi*2);
Graphics()->SetColor(pInfo->m_aColors[5].r, pInfo->m_aColors[5].g, pInfo->m_aColors[5].b, pInfo->m_aColors[5].a);
if(p == 1)
{
Graphics()->TextureSet(pInfo->m_aTextures[5]);
Graphics()->QuadsBegin();
Graphics()->QuadsSetRotation(pAnim->GetBody()->m_Angle*pi*2);
Graphics()->SetColor(pInfo->m_aColors[5].r, pInfo->m_aColors[5].g, pInfo->m_aColors[5].b, pInfo->m_aColors[5].a);
switch (Emote)
{
case EMOTE_PAIN:
@ -492,41 +465,38 @@ void CRenderTools::RenderTee(CAnimState *pAnim, CTeeRenderInfo *pInfo, int Emote
vec2 Offset = vec2(Direction.x*0.125f, -0.05f+Direction.y*0.10f)*BaseSize;
IGraphics::CQuadItem QuadItem(BodyPos.x+Offset.x, BodyPos.y+Offset.y, EyeScale, h);
Graphics()->QuadsDraw(&QuadItem, 1);
Graphics()->QuadsEnd();
}
Graphics()->QuadsEnd();
}
// draw feet
if(Parts&SELECTION_FEET || (OutLine && RenderBackground))
Graphics()->TextureSet(pInfo->m_aTextures[4]);
Graphics()->QuadsBegin();
CAnimKeyframe *pFoot = f ? pAnim->GetFrontFoot() : pAnim->GetBackFoot();
float w = BaseSize/2.0f;
float h = w;
Graphics()->QuadsSetRotation(pFoot->m_Angle*pi*2);
if(OutLine)
{
Graphics()->TextureSet(pInfo->m_aTextures[4]);
Graphics()->QuadsBegin();
CAnimKeyframe *pFoot = f ? pAnim->GetFrontFoot() : pAnim->GetBackFoot();
float w = BaseSize/2.0f;
float h = w;
Graphics()->QuadsSetRotation(pFoot->m_Angle*pi*2);
if(OutLine)
{
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
SelectSprite(SPRITE_TEE_FOOT_OUTLINE, 0, 0, 0);
}
else
{
bool Indicate = !pInfo->m_GotAirJump && g_Config.m_ClAirjumpindicator;
float cs = 1.0f; // color scale
if(Indicate)
cs = 0.5f;
Graphics()->SetColor(pInfo->m_aColors[4].r*cs, pInfo->m_aColors[4].g*cs, pInfo->m_aColors[4].b*cs, pInfo->m_aColors[4].a);
SelectSprite(SPRITE_TEE_FOOT, 0, 0, 0);
}
IGraphics::CQuadItem QuadItem(Position.x+pFoot->m_X*AnimScale, Position.y+pFoot->m_Y*AnimScale, w, h);
Graphics()->QuadsDraw(&QuadItem, 1);
Graphics()->QuadsEnd();
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
SelectSprite(SPRITE_TEE_FOOT_OUTLINE, 0, 0, 0);
}
else
{
bool Indicate = !pInfo->m_GotAirJump && g_Config.m_ClAirjumpindicator;
float cs = 1.0f; // color scale
if(Indicate)
cs = 0.5f;
Graphics()->SetColor(pInfo->m_aColors[4].r*cs, pInfo->m_aColors[4].g*cs, pInfo->m_aColors[4].b*cs, pInfo->m_aColors[4].a);
SelectSprite(SPRITE_TEE_FOOT, 0, 0, 0);
}
IGraphics::CQuadItem QuadItem(Position.x+pFoot->m_X*AnimScale, Position.y+pFoot->m_Y*AnimScale, w, h);
Graphics()->QuadsDraw(&QuadItem, 1);
Graphics()->QuadsEnd();
}
}
}

View file

@ -37,17 +37,6 @@ enum
TILERENDERFLAG_EXTEND=4,
};
enum
{
SELECTION_BODY=1,
SELECTION_TATTOO=2,
SELECTION_DECORATION=4,
SELECTION_HANDS=8,
SELECTION_FEET=16,
SELECTION_EYES=32,
SELECTION_DEFAULT = SELECTION_BODY|SELECTION_TATTOO|SELECTION_DECORATION|SELECTION_FEET|SELECTION_EYES
};
typedef void (*ENVELOPE_EVAL)(float TimeOffset, int Env, float *pChannels, void *pUser);
class CRenderTools
@ -78,7 +67,7 @@ public:
void RenderTilemapGenerateSkip(class CLayers *pLayers);
// object render methods (gc_render_obj.cpp)
void RenderTee(class CAnimState *pAnim, CTeeRenderInfo *pInfo, int Emote, vec2 Dir, vec2 Pos, int Parts=SELECTION_DEFAULT, bool RenderBackground = false);
void RenderTee(class CAnimState *pAnim, CTeeRenderInfo *pInfo, int Emote, vec2 Dir, vec2 Pos);
// map render methods (gc_render_map.cpp)
static void RenderEvalEnvelope(CEnvPoint *pPoints, int NumPoints, int Channels, float Time, float *pResult);