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