More type conversion warning cleanup; some minor refactoring in the phase bar while I was cleaning up the warnings.
This commit is contained in:
@@ -711,7 +711,7 @@ MTGCardInstance * AIPlayerBaka::FindCardToPlay(ManaCost * pMana, const char * ty
|
||||
if (hasX){
|
||||
int xDiff = pMana->getConvertedCost() - currentCost;
|
||||
if (xDiff < 0) xDiff = 0;
|
||||
shouldPlayPercentage = shouldPlayPercentage - ((shouldPlayPercentage * 1.9f) / (1 + xDiff));
|
||||
shouldPlayPercentage = shouldPlayPercentage - static_cast<int>((shouldPlayPercentage * 1.9f) / (1 + xDiff));
|
||||
}
|
||||
|
||||
if (WRand() % 100 > shouldPlayPercentage) continue;
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
#include "AllAbilities.h"
|
||||
//TODO:better comments this is too cryptic to work on by anyone but original coder.
|
||||
bool compare_aistats(AIStat * first, AIStat * second){
|
||||
float damage1 = first->value / first->occurences;
|
||||
float damage2 = second->value/ second->occurences;
|
||||
float damage1 = static_cast<float>(first->value / first->occurences);
|
||||
float damage2 = static_cast<float>(second->value / second->occurences);
|
||||
return (damage1 > damage2);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,14 +54,14 @@ ManaIcon::ManaIcon(int color, float x, float y, float destx, float desty) : Pos(
|
||||
//Really, we should just be loading that and then changing colors...
|
||||
psi->nEmission = 114;
|
||||
psi->fLifetime = -1;
|
||||
psi->fParticleLifeMin = 1.1507937;
|
||||
psi->fParticleLifeMax = 1.4682540;
|
||||
psi->fSpeedMin = 0.0099999998;
|
||||
psi->fSizeStart = 0.5;
|
||||
psi->fSizeEnd = 0.69999999;
|
||||
psi->fSizeVar = 0.25396827;
|
||||
psi->fSpinStart = -5.5555553;
|
||||
psi->fAlphaVar = 0.77777779;
|
||||
psi->fParticleLifeMin = 1.1507937f;
|
||||
psi->fParticleLifeMax = 1.4682540f;
|
||||
psi->fSpeedMin = 0.0099999998f;
|
||||
psi->fSizeStart = 0.5f;
|
||||
psi->fSizeEnd = 0.69999999f;
|
||||
psi->fSizeVar = 0.25396827f;
|
||||
psi->fSpinStart = -5.5555553f;
|
||||
psi->fAlphaVar = 0.77777779f;
|
||||
psi->sprite = mq;
|
||||
}
|
||||
|
||||
@@ -103,19 +103,19 @@ ManaIcon::ManaIcon(int color, float x, float y, float destx, float desty) : Pos(
|
||||
|
||||
particleSys->FireAt(x, y);
|
||||
|
||||
zoomP1 = 0.2 + 0.1 * ((float)rand() / (float)RAND_MAX);
|
||||
zoomP2 = 0.2 + 0.1 * ((float)rand() / (float)RAND_MAX);
|
||||
zoomP1 = 0.2f + 0.1f * ((float)rand() / (float)RAND_MAX);
|
||||
zoomP2 = 0.2f + 0.1f * ((float)rand() / (float)RAND_MAX);
|
||||
zoomP3 = 2 * M_PI * ((float)rand() / (float)RAND_MAX);
|
||||
zoomP4 = 2 * M_PI * ((float)rand() / (float)RAND_MAX);
|
||||
zoomP5 = 0.5 + ((float)rand() / (float)RAND_MAX);
|
||||
zoomP6 = 0.5 + ((float)rand() / (float)RAND_MAX);
|
||||
zoomP5 = 0.5f + ((float)rand() / (float)RAND_MAX);
|
||||
zoomP6 = 0.5f + ((float)rand() / (float)RAND_MAX);
|
||||
|
||||
xP1 = 2 * M_PI * ((float)rand() / (float)RAND_MAX);
|
||||
xP2 = 5 + 30 * ((float)rand() / (float)RAND_MAX);
|
||||
xP3 = 0.5 + ((float)rand() / (float)RAND_MAX);
|
||||
xP3 = 0.5f + ((float)rand() / (float)RAND_MAX);
|
||||
yP1 = 2 * M_PI * ((float)rand() / (float)RAND_MAX);
|
||||
yP2 = 5 + 10 * ((float)rand() / (float)RAND_MAX);
|
||||
yP3 = 0.5 + ((float)rand() / (float)RAND_MAX);
|
||||
yP3 = 0.5f + ((float)rand() / (float)RAND_MAX);
|
||||
|
||||
actT = 0;
|
||||
tP1 = 0;
|
||||
@@ -228,16 +228,16 @@ void GuiMana::RenderStatic(){
|
||||
float x0 = x - 20*totalColors;
|
||||
if (x0 < 10) x0 = 10;
|
||||
float xEnd = x0 + 20*totalColors;
|
||||
r->FillRoundRect(x0,y - 5 ,20*totalColors + 5,20,2,ARGB(128,0,0,0));
|
||||
r->FillRoundRect(x0, y - 5, static_cast<float>(20 * totalColors + 5), 20, 2, ARGB(128,0,0,0));
|
||||
|
||||
int offset = 0;
|
||||
for (int i = 0; i < Constants::MTG_NB_COLORS; ++i){
|
||||
if (values[i]){
|
||||
offset-=20;
|
||||
r->RenderQuad(manaIcons[i],xEnd + 15 + offset, y + 5,0,0.7,0.7);
|
||||
r->RenderQuad(manaIcons[i],xEnd + 15 + offset, y + 5, 0, 0.7f, 0.7f);
|
||||
}
|
||||
}
|
||||
r->FillRoundRect(x0,y ,20*totalColors + 5,8,2,ARGB(100,0,0,0));
|
||||
r->FillRoundRect(x0, y, static_cast<float>(20 * totalColors + 5), 8, 2, ARGB(100,0,0,0));
|
||||
offset = 0;
|
||||
for (int i = 0; i < Constants::MTG_NB_COLORS; ++i){
|
||||
if (values[i]){
|
||||
|
||||
@@ -23,12 +23,30 @@ static int colors[] =
|
||||
};
|
||||
*/
|
||||
|
||||
namespace
|
||||
{
|
||||
const float kWidth = 28;
|
||||
const float kHeight = kWidth;
|
||||
const unsigned kPhases = 12;
|
||||
|
||||
const float ICONSCALE = 1.5;
|
||||
const float CENTER = SCREEN_HEIGHT_F / 2 + 10;
|
||||
|
||||
|
||||
void DrawGlyph(JQuad* inQuad, int inGlyph, float inY, float inAngle, unsigned int inP, float inScale)
|
||||
{
|
||||
float xPos = static_cast<float>((inP + inGlyph * (int)(kWidth+1)) % (kPhases * (int)(kWidth+1)));
|
||||
inQuad->SetTextureRect(xPos, 0, kWidth, kHeight);
|
||||
JRenderer::GetInstance()->RenderQuad(inQuad, 0, inY, 0.0, inScale, inScale);
|
||||
}
|
||||
}
|
||||
|
||||
GuiPhaseBar::GuiPhaseBar() : phase(NULL), angle(0.0f)
|
||||
{
|
||||
JQuad * quad = NULL;
|
||||
if ((quad = resources.GetQuad("phasebar")) != NULL){
|
||||
quad->mHeight = Height;
|
||||
quad->mWidth = Width;
|
||||
quad->mHeight = kHeight;
|
||||
quad->mWidth = kWidth;
|
||||
}
|
||||
else GameApp::systemError = "Error loading phasebar texture : " __FILE__;
|
||||
}
|
||||
@@ -44,51 +62,38 @@ void GuiPhaseBar::Update(float dt)
|
||||
|
||||
void GuiPhaseBar::Render()
|
||||
{
|
||||
static const float ICONSCALE = 1.5;
|
||||
static const float CENTER = SCREEN_HEIGHT_F / 2 + 10;
|
||||
JRenderer* renderer = JRenderer::GetInstance();
|
||||
GameObserver * g = GameObserver::GetInstance();
|
||||
JQuad * quad = resources.GetQuad("phasebar");
|
||||
unsigned p = (phase->id + Phases - 4) * (Width+1);
|
||||
float scale;
|
||||
float start = CENTER + (Width / 2) * angle * ICONSCALE / (M_PI / 6) - ICONSCALE * Width / 4;
|
||||
|
||||
JRenderer::GetInstance()->DrawLine(0, CENTER, SCREEN_WIDTH, CENTER, ARGB(255, 255, 255, 255));
|
||||
|
||||
renderer->DrawLine(0, CENTER, SCREEN_WIDTH, CENTER, ARGB(255, 255, 255, 255));
|
||||
unsigned int p = (phase->id + kPhases - 4) * (int)(kWidth+1);
|
||||
float centerYPosition = CENTER + (kWidth / 2) * angle * ICONSCALE / (M_PI / 6) - ICONSCALE * kWidth / 4;
|
||||
float yPos = centerYPosition;
|
||||
float scale = 0;
|
||||
for (int glyph = 3; glyph < 6; ++glyph)
|
||||
{
|
||||
scale = ICONSCALE * sinf(angle + glyph * M_PI / 6) / 2;
|
||||
DrawGlyph(quad, glyph, yPos, angle, p, scale);
|
||||
yPos += kWidth * scale;
|
||||
}
|
||||
|
||||
scale = ICONSCALE * sinf(angle + 3 * M_PI / 6) / 2;
|
||||
quad->SetTextureRect((p + 3 * (Width+1)) % (Phases * (Width+1)), 0, Width, Height);
|
||||
renderer->RenderQuad(quad, 0, start, 0.0, scale, scale);
|
||||
start += Width * scale;
|
||||
|
||||
scale = ICONSCALE * sinf(angle + 4 * M_PI / 6) / 2;
|
||||
quad->SetTextureRect((p + 4 * (Width+1)) % (Phases * (Width+1)), Height, Width, Height);
|
||||
renderer->RenderQuad(quad, 0, start, 0.0, scale, scale);
|
||||
start += Width * scale;
|
||||
|
||||
scale = ICONSCALE * sinf(angle + 5 * M_PI / 6) / 2;
|
||||
quad->SetTextureRect((p + 5 * (Width+1)) % (Phases * (Width+1)), Height, Width, Height);
|
||||
renderer->RenderQuad(quad, 0, start, 0.0, scale, scale);
|
||||
start += Width * scale;
|
||||
|
||||
start = CENTER + (Width / 2) * angle * ICONSCALE / (M_PI / 6) - ICONSCALE * Width / 4;
|
||||
|
||||
scale = ICONSCALE * sinf(angle + 2 * M_PI / 6) / 2;
|
||||
start -= Width * scale;
|
||||
quad->SetTextureRect((p + 2 * (Width+1)) % (Phases * (Width+1)), Height, Width, Height);
|
||||
renderer->RenderQuad(quad, 0, start, 0.0, scale, scale);
|
||||
|
||||
scale = ICONSCALE * sinf(angle + 1 * M_PI / 6) / 2;
|
||||
start -= Width * scale;
|
||||
quad->SetTextureRect((p + 1 * (Width+1)) % (Phases * (Width+1)), Height, Width, Height);
|
||||
renderer->RenderQuad(quad, 0, start, 0.0, scale, scale);
|
||||
yPos = centerYPosition;
|
||||
for (int glyph = 2; glyph > 0; --glyph)
|
||||
{
|
||||
scale = ICONSCALE * sinf(angle + glyph * M_PI / 6) / 2;
|
||||
yPos -= kWidth * scale;
|
||||
DrawGlyph(quad, glyph, yPos, angle, p, scale);
|
||||
}
|
||||
|
||||
if (angle > 0)
|
||||
{
|
||||
scale = ICONSCALE * sinf(angle)/2;
|
||||
start -= Width * scale;
|
||||
quad->SetTextureRect(p % (Phases * (Width+1)), Height, Width, Height);
|
||||
renderer->RenderQuad(quad, 0, start, 0.0, scale, scale);
|
||||
}
|
||||
{
|
||||
scale = ICONSCALE * sinf(angle)/2;
|
||||
yPos -= kWidth * scale;
|
||||
float xPos = static_cast<float>(p % (kPhases * (int)(kWidth+1)));
|
||||
quad->SetTextureRect(xPos, kHeight, kWidth, kHeight);
|
||||
JRenderer::GetInstance()->RenderQuad(quad, 0, yPos, 0.0, scale, scale);
|
||||
}
|
||||
|
||||
//print phase name
|
||||
WFont * font = resources.GetWFont(Fonts::MAIN_FONT);
|
||||
|
||||
Reference in New Issue
Block a user