[FIX] Fixed warnings.
This commit is contained in:
parent
3ee91c42ac
commit
277111a678
@ -42,12 +42,12 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\src\Libs\;..\..\Dependencies\Include\"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
WarningLevel="4"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
@ -106,7 +106,7 @@
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
AdditionalIncludeDirectories="..\..\..\src\Libs\;..\..\Dependencies\Include\"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
|
@ -42,7 +42,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\src\Libs\;..\..\Dependencies\Include\"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
@ -118,7 +118,7 @@
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
AdditionalIncludeDirectories="..\..\..\src\Libs\;..\..\Dependencies\Include\"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
|
@ -227,7 +227,7 @@ void Game::LoadSavegame(const string savegameIDArg) {
|
||||
int playerY = atoi(dataElem->GetText());
|
||||
// </y>
|
||||
|
||||
_player->SetXY(playerX, playerY);
|
||||
_player->SetXY((float)playerX, (float)playerY);
|
||||
|
||||
// <map> - Parse the map file.
|
||||
dataElem = dataElem->NextSiblingElement("map");
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "Player.h"
|
||||
|
||||
// Pixels * 60 / sec.
|
||||
const float Player::PLAYER_SPEED = Character::CHARACTER_SPEED + 0.5;
|
||||
const float Player::PLAYER_SPEED = Character::CHARACTER_SPEED + 0.5f;
|
||||
|
||||
Player::Player(Map *mapArg) : Character(mapArg) {
|
||||
|
||||
@ -68,8 +68,8 @@ void Player::SetName(string nameArg) {
|
||||
}
|
||||
|
||||
void Player::SetCamera(void) {
|
||||
camera.x = (x + w / 2) - SCREEN_WIDTH / 2;
|
||||
camera.y = (y + h / 2) - SCREEN_HEIGHT / 2;
|
||||
camera.x = (Sint16)((x + w / 2) - SCREEN_WIDTH / 2);
|
||||
camera.y = (Sint16)((y + h / 2) - SCREEN_HEIGHT / 2);
|
||||
|
||||
if(camera.x < 0)
|
||||
camera.x = 0;
|
||||
@ -85,7 +85,7 @@ void Player::SetCamera(void) {
|
||||
void Player::Move() {
|
||||
Character::Move();
|
||||
if(map->GetMapTransitionName(tileX, tileY) != "null") {
|
||||
SetXY(map->GetMapTransitionX(tileX, tileY), map->GetMapTransitionY(tileX, tileY));
|
||||
SetXY((float)map->GetMapTransitionX(tileX, tileY), (float)map->GetMapTransitionY(tileX, tileY));
|
||||
map->Load(map->GetMapTransitionName(tileX, tileY));
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ int WINAPI WinMain(HINSTANCE,HINSTANCE,LPSTR,int) {
|
||||
screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 32, SDL_HWSURFACE);
|
||||
SDL_WM_SetCaption("fps - 00", NULL);
|
||||
|
||||
srand(time(NULL));
|
||||
srand((unsigned int)time(NULL));
|
||||
|
||||
camera.x = 0;
|
||||
camera.y = 0;
|
||||
|
@ -5,8 +5,8 @@ void ApplySurface(int x, int y, SDL_Surface* source, SDL_Surface* destination, S
|
||||
|
||||
SDL_Rect offset;
|
||||
|
||||
offset.x = x - camera.x;
|
||||
offset.y = y - camera.y;
|
||||
offset.x = (Sint16)(x - camera.x);
|
||||
offset.y = (Sint16)(y - camera.y);
|
||||
|
||||
SDL_BlitSurface(source, clip, destination, &offset);
|
||||
}
|
||||
@ -16,8 +16,8 @@ void ApplySurfaceLiteral(int x, int y, SDL_Surface* source, SDL_Surface* destina
|
||||
|
||||
SDL_Rect offset;
|
||||
|
||||
offset.x = x;
|
||||
offset.y = y;
|
||||
offset.x = (Sint16)x;
|
||||
offset.y = (Sint16)y;
|
||||
|
||||
SDL_BlitSurface(source, clip, destination, &offset);
|
||||
}
|
||||
|
@ -39,15 +39,15 @@ void Character::LoadSprites(string filename, int wArg, int hArg) {
|
||||
|
||||
_texture = LoadImageAlpha(filename.c_str());
|
||||
|
||||
w = wArg;
|
||||
h = hArg;
|
||||
w = (float)wArg;
|
||||
h = (float)hArg;
|
||||
|
||||
for(int m_direction = 0; m_direction < 4; m_direction++) {
|
||||
for(int m_action = 0; m_action < 4; m_action++) {
|
||||
_sprites[m_direction][m_action].x = w * m_action;
|
||||
_sprites[m_direction][m_action].y = h * m_direction;
|
||||
_sprites[m_direction][m_action].w = w;
|
||||
_sprites[m_direction][m_action].h = h;
|
||||
_sprites[m_direction][m_action].x = (Sint16)(w * m_action);
|
||||
_sprites[m_direction][m_action].y = (Sint16)(h * m_direction);
|
||||
_sprites[m_direction][m_action].w = (Sint16)w;
|
||||
_sprites[m_direction][m_action].h = (Sint16)h;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -65,33 +65,33 @@ void Character::Render(void) {
|
||||
// Draw some fancy speach bubbles. It is a bit of a mess, I am playing.
|
||||
if(_speachBubble.size() != 0) {
|
||||
if(_speachBubbleTimer.GetTicks() < SPEACH_BUBBLE_DISPLAY_LENGTH) {
|
||||
roundedBoxRGBA(screen, (x + w / 2) - 100 - camera.x,
|
||||
y - 100 - camera.y,
|
||||
(x + w / 2) + 100 - camera.x,
|
||||
y - 35 - camera.y,
|
||||
roundedBoxRGBA(screen, (Sint16)((x + w / 2) - 100 - camera.x),
|
||||
(Sint16)(y - 100 - camera.y),
|
||||
(Sint16)((x + w / 2) + 100 - camera.x),
|
||||
(Sint16)(y - 35 - camera.y),
|
||||
5, 255, 255, 255, 255);
|
||||
|
||||
filledTrigonRGBA(screen, (x + w / 2) - 100 - camera.x,
|
||||
y - 100 - camera.y,
|
||||
(x + w / 2) - 10 - camera.x,
|
||||
y - 40 - camera.y,
|
||||
(x + w / 2) + 10 - camera.x,
|
||||
y - 40 - camera.y,
|
||||
filledTrigonRGBA(screen, (Sint16)((x + w / 2) - 100 - camera.x),
|
||||
(Sint16)(y - 100 - camera.y),
|
||||
(Sint16)((x + w / 2) - 10 - camera.x),
|
||||
(Sint16)(y - 40 - camera.y),
|
||||
(Sint16)((x + w / 2) + 10 - camera.x),
|
||||
(Sint16)(y - 40 - camera.y),
|
||||
255, 255, 255, 255);
|
||||
|
||||
_speachBubbleText.Render((x + w / 2) - 90, y - 90);
|
||||
_speachBubbleText.Render((int)((x + w / 2) - 90), (int)y - 90);
|
||||
}
|
||||
}
|
||||
|
||||
if(attacking && attackTimer.GetTicks() < ATTACKING_DISPLAY_LEN) {
|
||||
ApplySurface(x, y, _texture, screen, &_sprites[directionFacing][ANIM_ATTACK]);
|
||||
ApplySurface((int)x, (int)y, _texture, screen, &_sprites[directionFacing][ANIM_ATTACK]);
|
||||
return;
|
||||
}
|
||||
else if(attacking)
|
||||
attacking = false;
|
||||
|
||||
if(xVel == 0.0f && yVel == 0.0f)
|
||||
ApplySurface(x, y, _texture, screen, &_sprites[directionFacing][ANIM_NO_FOOT]);
|
||||
ApplySurface((int)x, (int)y, _texture, screen, &_sprites[directionFacing][ANIM_NO_FOOT]);
|
||||
else {
|
||||
if(_animationTimer.GetTicks() > ANIMATION_SPEED) {
|
||||
if(_animationStage == ANIM_NO_FOOT) {
|
||||
@ -110,7 +110,7 @@ void Character::Render(void) {
|
||||
}
|
||||
_animationTimer.Start();
|
||||
}
|
||||
ApplySurface(x, y, _texture, screen, &_sprites[directionFacing][_animationStage]);
|
||||
ApplySurface((int)x, (int)y, _texture, screen, &_sprites[directionFacing][_animationStage]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,8 +134,8 @@ void Character::Update(void) {
|
||||
|
||||
void Character::Move(void) {
|
||||
x += xVel;
|
||||
tileX = ((x + (w / 2)) / TILE_WIDTH);
|
||||
tileY = ((y + (h / 2)) / TILE_HEIGHT);
|
||||
tileX = (int)(((x + (w / 2)) / TILE_WIDTH));
|
||||
tileY = (int)(((y + (h / 2)) / TILE_HEIGHT));
|
||||
|
||||
// Check collisions.
|
||||
if((x < 0) || (x + w) > levelWidth) x -= xVel;
|
||||
@ -144,8 +144,8 @@ void Character::Move(void) {
|
||||
if(CheckCharacterCollisions()) x -= xVel;
|
||||
|
||||
y += yVel;
|
||||
tileX = ((x + (w / 2)) / TILE_WIDTH);
|
||||
tileY = ((y + (h / 2)) / TILE_HEIGHT);
|
||||
tileX = (int)(((x + (w / 2)) / TILE_WIDTH));
|
||||
tileY = (int)(((y + (h / 2)) / TILE_HEIGHT));
|
||||
|
||||
if((y < 0) || (y + h) > levelHeight) y -= yVel;
|
||||
if(CheckTileCollisions()) y -= yVel;
|
||||
@ -162,7 +162,7 @@ bool Character::CheckTileCollisions(void) {
|
||||
for(int i = -1; i < 2; i++) {
|
||||
for(int j = -1; j < 2; j++) {
|
||||
if(map->GetTileSolidity(tileX + i, tileY + j))
|
||||
if(CheckCollisionXY(x, y, w, h, map->GetTileX(tileX + i, tileY + j),
|
||||
if(CheckCollisionXY((int)x, (int)y, (int)w, (int)h, map->GetTileX(tileX + i, tileY + j),
|
||||
map->GetTileY(tileX + i, tileY + j), TILE_WIDTH, TILE_HEIGHT))
|
||||
return true;
|
||||
}
|
||||
@ -174,7 +174,7 @@ bool Character::CheckEntityCollisions(void) {
|
||||
for(int i = -1; i < 2; i++) {
|
||||
for(int j = -1; j < 2; j++) {
|
||||
if(map->GetEntitySolidity(tileX + i, tileY + j)) {
|
||||
if(CheckCollisionXY(x, y, w, h, map->GetEntityX(tileX + i, tileY + j),
|
||||
if(CheckCollisionXY((int)x, (int)y, (int)w, (int)h, map->GetEntityX(tileX + i, tileY + j),
|
||||
map->GetEntityY(tileX + i, tileY + j),
|
||||
map->GetEntityWidth(tileX + i, tileY + j),
|
||||
map->GetEntityHeight(tileX + i, tileY + j)))
|
||||
@ -190,11 +190,11 @@ bool Character::CheckCharacterCollisions(void) {
|
||||
collisionIter != collisionList.end();
|
||||
collisionIter++) {
|
||||
if((*collisionIter) != this) {
|
||||
if(CheckCollisionXY(x, y, w, h,
|
||||
(*collisionIter)->GetX(),
|
||||
(*collisionIter)->GetY(),
|
||||
(*collisionIter)->GetWidth(),
|
||||
(*collisionIter)->GetHeight())) {
|
||||
if(CheckCollisionXY((int)x, (int)y, (int)w, (int)h,
|
||||
(int)(*collisionIter)->GetX(),
|
||||
(int)(*collisionIter)->GetY(),
|
||||
(int)(*collisionIter)->GetWidth(),
|
||||
(int)(*collisionIter)->GetHeight())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ void Debug::message(const char *msg, ...) {
|
||||
va_start(vargList, msg);
|
||||
|
||||
#if defined WIN32
|
||||
outLen = _vsnprintf(outBuf, sizeof(outBuf), msg, vargList);
|
||||
outLen = (unsigned short)_vsnprintf(outBuf, sizeof(outBuf), msg, vargList);
|
||||
#else
|
||||
outLen = vsnprintf(outBuf, sizeof(outBuf), msg, vargList);
|
||||
#endif
|
||||
|
@ -58,7 +58,7 @@ void UpdateInput(void) {
|
||||
|
||||
char GetKey(void) {
|
||||
if(keyboard.lastChar != -1)
|
||||
return keyboard.lastChar;
|
||||
return (char)keyboard.lastChar;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,8 @@ MainMenu::~MainMenu(void) {
|
||||
mainMenuNavVal_t MainMenu::Run(void) {
|
||||
FPS fpsLimiter(20);
|
||||
|
||||
while(1) {
|
||||
bool running = true;
|
||||
while(running) {
|
||||
Render();
|
||||
SDL_Flip(screen);
|
||||
|
||||
@ -103,6 +104,7 @@ mainMenuNavVal_t MainMenu::Run(void) {
|
||||
|
||||
fpsLimiter.LimitFPS();
|
||||
}
|
||||
return mainMenuExitGame;
|
||||
}
|
||||
|
||||
void MainMenu::Render(void) {
|
||||
|
@ -104,13 +104,13 @@ void Map::Load(const string filename) {
|
||||
// <mapTransX>
|
||||
dataElem = dataElem->NextSiblingElement("mapTransX");
|
||||
assert(dataElem != NULL);
|
||||
int mapTransX = atoi(dataElem->GetText());
|
||||
// int mapTransX = atoi(dataElem->GetText()); // not referenced
|
||||
// </mapTransX>
|
||||
|
||||
// <mapTransY>
|
||||
dataElem = dataElem->NextSiblingElement("mapTransY");
|
||||
assert(dataElem != NULL);
|
||||
int mapTransY = atoi(dataElem->GetText());
|
||||
// int mapTransY = atoi(dataElem->GetText()); // not referenced
|
||||
// </mapTransY>
|
||||
|
||||
tileElem = tileElem->NextSiblingElement("tile");
|
||||
|
@ -14,7 +14,7 @@ NPC::~NPC(void) {
|
||||
|
||||
void NPC::Update(void) {
|
||||
// Store the NPC's health.
|
||||
int health = GetHealth();
|
||||
// int health = GetHealth(); // not referenced
|
||||
|
||||
Move();
|
||||
|
||||
|
@ -15,8 +15,8 @@ void ParticleEmitter::SetXY(int xArg, int yArg) {
|
||||
|
||||
void ParticleEmitter::ForceXY(int xArg, int yArg) {
|
||||
for(int i = 0; i < _particleCount; i++) {
|
||||
m_particle[i].x = xArg;
|
||||
m_particle[i].y = yArg;
|
||||
m_particle[i].x = (float)xArg;
|
||||
m_particle[i].y = (float)yArg;
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ void ParticleEmitter::SetParticleLifetime(int lifetimeArg) {
|
||||
|
||||
void ParticleEmitter::Render(void) {
|
||||
for(int i = 0; i < _particleCount; i++) {
|
||||
ApplySurface(m_particle[i].x, m_particle[i].y, _particleTexture, screen);
|
||||
ApplySurface((int)m_particle[i].x, (int)m_particle[i].y, _particleTexture, screen);
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,16 +60,16 @@ void ParticleEmitter::Update(void) {
|
||||
for(int i = 0; i < _particleCount; i++) {
|
||||
if((int)SDL_GetTicks() - m_particle[i].startTime > m_particle[i].lifetime) {
|
||||
// Reset the x and y coords.
|
||||
m_particle[i].x = x;
|
||||
m_particle[i].y = y;
|
||||
m_particle[i].x = (float)x;
|
||||
m_particle[i].y = (float)y;
|
||||
|
||||
m_particle[i].xVel = rand() % 360;
|
||||
m_particle[i].yVel = rand() % 360;
|
||||
m_particle[i].xVel = (float)(rand() % 360);
|
||||
m_particle[i].yVel = (float)(rand() % 360);
|
||||
|
||||
if(rand() % 2)
|
||||
m_particle[i].xVel = m_particle[i].xVel * -1;
|
||||
m_particle[i].xVel = m_particle[i].xVel * -1.0f;
|
||||
if(rand() % 2)
|
||||
m_particle[i].yVel = m_particle[i].yVel * -1;
|
||||
m_particle[i].yVel = m_particle[i].yVel * -1.0f;
|
||||
|
||||
m_particle[i].startTime = SDL_GetTicks();
|
||||
} else {
|
||||
|
@ -7,13 +7,13 @@ Rect::~Rect(void) {
|
||||
}
|
||||
|
||||
void Rect::SetXY(int xArg, int yArg) {
|
||||
rect.x = xArg;
|
||||
rect.y = yArg;
|
||||
rect.x = (Sint16)xArg;
|
||||
rect.y = (Sint16)yArg;
|
||||
}
|
||||
|
||||
void Rect::SetWidthHeight(int wArg, int hArg) {
|
||||
rect.w = wArg;
|
||||
rect.h = hArg;
|
||||
rect.w = (Uint16)wArg;
|
||||
rect.h = (Uint16)hArg;
|
||||
}
|
||||
|
||||
void Rect::SetRGB(Uint8 rArg, Uint8 gArg, Uint8 bArg) {
|
||||
@ -42,10 +42,10 @@ void Rect::Draw(void) {
|
||||
void Rect::Draw(int xArg, int yArg) {
|
||||
SDL_Rect offset;
|
||||
|
||||
offset.x = xArg - camera.x;
|
||||
offset.y = yArg - camera.y;
|
||||
offset.w = rect.w;
|
||||
offset.h = rect.h;
|
||||
offset.x = (Sint16)(xArg - camera.x);
|
||||
offset.y = (Sint16)(yArg - camera.y);
|
||||
offset.w = (Sint16)rect.w;
|
||||
offset.h = (Sint16)rect.h;
|
||||
}
|
||||
|
||||
void Rect::DrawLiteral(void) {
|
||||
@ -55,8 +55,8 @@ void Rect::DrawLiteral(void) {
|
||||
void Rect::DrawLiteral(int xArg, int yArg) {
|
||||
SDL_Rect offset;
|
||||
|
||||
offset.x = xArg;
|
||||
offset.y = yArg;
|
||||
offset.x = (Sint16)xArg;
|
||||
offset.y = (Sint16)yArg;
|
||||
offset.w = rect.w;
|
||||
offset.h = rect.h;
|
||||
|
||||
|
@ -49,5 +49,5 @@ void Texture::LoadAlpha(const char* filename) {
|
||||
}
|
||||
|
||||
void Texture::SetAlpha(int alphaArg) {
|
||||
SDL_SetAlpha(_texture, SDL_SRCALPHA, alphaArg);
|
||||
SDL_SetAlpha(_texture, SDL_SRCALPHA, (Uint8)alphaArg);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user