// Search for infoFiles
std::string infoFileName = "";
char** rc2 = PHYSFS_enumerateFiles("/");
- for(char** i = rc2; *i != 0; ++i) {
+ for(char** j = rc2; *j != 0; ++j) {
// get filename of potential infoFile
- std::string potentialInfoFileName = *i;
+ std::string potentialInfoFileName = *j;
// make sure it looks like an infoFile
static const std::string infoExt = ".nfo";
}
void MD5::update(FILE *file) {
- uint8_t buffer[1024];
+ uint8_t buffer_[1024];
int len;
- while ((len=fread(buffer, 1, 1024, file))) update(buffer, len);
+ while ((len=fread(buffer_, 1, 1024, file))) update(buffer_, len);
fclose (file);
}
void MD5::update(std::istream& stream) {
- uint8_t buffer[1024];
+ uint8_t buffer_[1024];
int len;
while (stream.good()) {
- stream.read((char*)buffer, 1024); // note that return value of read is unusable.
+ stream.read((char*)buffer_, 1024); // note that return value of read is unusable.
len=stream.gcount();
- update(buffer, len);
+ update(buffer_, len);
}
}
void MD5::update(std::ifstream& stream) {
- uint8_t buffer[1024];
+ uint8_t buffer_[1024];
int len;
while (stream.good()) {
- stream.read((char*)buffer, 1024); // note that return value of read is unusable.
+ stream.read((char*)buffer_, 1024); // note that return value of read is unusable.
len=stream.gcount();
- update(buffer, len);
+ update(buffer_, len);
}
}
#include <assert.h>
-OggSoundFile::OggSoundFile(PHYSFS_file* file, double loop_begin, double loop_at) :
+OggSoundFile::OggSoundFile(PHYSFS_file* file_, double loop_begin_, double loop_at_) :
file(),
vorbis_file(),
loop_begin(),
loop_at(),
normal_buffer_loop()
{
- this->file = file;
+ this->file = file_;
ov_callbacks callbacks = { cb_read, cb_seek, cb_close, cb_tell };
ov_open_callbacks(file, &vorbis_file, 0, 0, callbacks);
bits_per_sample = 16;
size = static_cast<size_t> (ov_pcm_total(&vorbis_file, -1) * 2);
- double samples_begin = loop_begin * rate;
- double sample_loop = loop_at * rate;
+ double samples_begin = loop_begin_ * rate;
+ double sample_loop = loop_at_ * rate;
this->loop_begin = (ogg_int64_t) samples_begin;
- if(loop_begin < 0) {
+ if(loop_begin_ < 0) {
this->loop_at = (ogg_int64_t) -1;
} else {
this->loop_at = (ogg_int64_t) sample_loop;
buffer = load_file_into_buffer(*file);
buffers.insert(std::make_pair(filename, buffer));
} else {
- std::unique_ptr<StreamSoundSource> source(new StreamSoundSource);
- source->set_sound_file(std::move(file));
- return std::move(source);
+ std::unique_ptr<StreamSoundSource> source_(new StreamSoundSource);
+ source_->set_sound_file(std::move(file));
+ return std::move(source_);
}
log_debug << "Uncached sound \"" << filename << "\" requested to be played" << std::endl;
}
void
-StreamSoundSource::set_fading(FadeState state, float fade_time)
+StreamSoundSource::set_fading(FadeState state, float fade_time_)
{
this->fade_state = state;
- this->fade_time = fade_time;
+ this->fade_time = fade_time_;
this->fade_start_time = real_time;
}
}
void update();
- void set_looping(bool looping)
+ void set_looping(bool looping_)
{
- this->looping = looping;
+ this->looping = looping_;
}
bool get_looping() const
{
}
void
-BadGuy::set_state(State state)
+BadGuy::set_state(State state_)
{
- if(this->state == state)
+ if(this->state == state_)
return;
State laststate = this->state;
- this->state = state;
- switch(state) {
+ this->state = state_;
+ switch(state_) {
case STATE_SQUISHED:
state_timer.start(SQUISH_TIME);
break;
#include "sprite/sprite.hpp"
#include "supertux/sector.hpp"
-Bomb::Bomb(const Vector& pos, Direction dir, std::string custom_sprite /*= "images/creatures/mr_bomb/mr_bomb.sprite"*/ ) :
- BadGuy( pos, dir, custom_sprite ),
+Bomb::Bomb(const Vector& pos, Direction dir_, std::string custom_sprite /*= "images/creatures/mr_bomb/mr_bomb.sprite"*/ ) :
+ BadGuy( pos, dir_, custom_sprite ),
state(),
grabbed(false),
grabber(NULL),
ticking()
{
state = STATE_TICKING;
- set_action(dir == LEFT ? "ticking-left" : "ticking-right", 1);
+ set_action(dir_ == LEFT ? "ticking-left" : "ticking-right", 1);
countMe = false;
ticking = sound_manager->create_sound_source("sounds/fizz.wav");
}
void
-Bomb::grab(MovingObject& object, const Vector& pos, Direction dir)
+Bomb::grab(MovingObject& object, const Vector& pos, Direction dir_)
{
movement = pos - get_pos();
- this->dir = dir;
+ this->dir = dir_;
// We actually face the opposite direction of Tux here to make the fuse more
// visible instead of hiding it behind Tux
}
void
-Bomb::ungrab(MovingObject& object, Direction dir)
+Bomb::ungrab(MovingObject& object, Direction dir_)
{
- this->dir = dir;
+ this->dir = dir_;
// portable objects are usually pushed away from Tux when dropped, but we
// don't want that, so we set the position
//FIXME: why don't we want that? shouldn't behavior be consistent?
- set_pos(object.get_pos() + Vector(dir == LEFT ? -16 : 16, get_bbox().get_height()*0.66666 - 32));
+ set_pos(object.get_pos() + Vector(dir_ == LEFT ? -16 : 16, get_bbox().get_height()*0.66666 - 32));
set_colgroup_active(COLGROUP_MOVING);
grabbed = false;
}
}
HitResponse
-Fish::hit(const CollisionHit& hit)
+Fish::hit(const CollisionHit& hit_)
{
- if(hit.top) {
+ if(hit_.top) {
physic.set_velocity_y(0);
}
assert (suck_lantern);
Vector pos = suck_lantern->get_pos();
Vector delta = get_bbox().get_middle() + SUCK_TARGET_OFFSET - pos;
- Vector dir = delta.unit();
+ Vector dir_ = delta.unit();
if (delta.norm() < 1) {
- dir = delta;
+ dir_ = delta;
suck_lantern->ungrab(*this, RIGHT);
suck_lantern->remove_me();
suck_lantern = 0;
sprite->set_action("swallow", 1);
} else {
- pos += dir;
+ pos += dir_;
suck_lantern->grab(*this, pos, RIGHT);
}
} else {
}
void
-GoldBomb::grab(MovingObject& object, const Vector& pos, Direction dir)
+GoldBomb::grab(MovingObject& object, const Vector& pos, Direction dir_)
{
if(tstate == STATE_TICKING){
movement = pos - get_pos();
- this->dir = dir;
+ this->dir = dir_;
// We actually face the opposite direction of Tux here to make the fuse more
// visible instead of hiding it behind Tux
}
else if(frozen){
movement = pos - get_pos();
- this->dir = dir;
- sprite->set_action(dir == LEFT ? "iced-left" : "iced-right");
+ this->dir = dir_;
+ sprite->set_action(dir_ == LEFT ? "iced-left" : "iced-right");
set_colgroup_active(COLGROUP_DISABLED);
grabbed = true;
}
}
HitResponse
-Kugelblitz::hit(const CollisionHit& hit)
+Kugelblitz::hit(const CollisionHit& hit_)
{
// hit floor?
- if(hit.bottom) {
+ if(hit_.bottom) {
if (!groundhit_pos_set)
{
pos_groundhit = get_pos();
movement_timer.start(MOVETIME);
lifetime.start(LIFETIME);
- } else if(hit.top) { // bumped on roof
+ } else if(hit_.top) { // bumped on roof
physic.set_velocity_y(0);
}
float X_OFFSCREEN_DISTANCE = 400;
float Y_OFFSCREEN_DISTANCE = 600;
- Player* player = get_nearest_player();
- if (!player) return;
- Vector dist = player->get_bbox().get_middle() - get_bbox().get_middle();
+ Player* player_ = get_nearest_player();
+ if (!player_) return;
+ Vector dist = player_->get_bbox().get_middle() - get_bbox().get_middle();
if ((fabsf(dist.x) <= X_OFFSCREEN_DISTANCE) && (fabsf(dist.y) <= Y_OFFSCREEN_DISTANCE)) {
set_state(STATE_ACTIVE);
if (!is_initialized) {
// if starting direction was set to AUTO, this is our chance to re-orient the badguy
if (start_dir == AUTO) {
- Player* player = get_nearest_player();
- if (player && (player->get_bbox().p1.x > get_bbox().p2.x)) {
+ Player* player__ = get_nearest_player();
+ if (player__ && (player__->get_bbox().p1.x > get_bbox().p2.x)) {
dir = RIGHT;
} else {
dir = LEFT;
sound_manager->preload("sounds/stomp.wav");
}
-MoleRock::MoleRock(const Vector& pos, const Vector& velocity, const BadGuy* parent = 0) :
+MoleRock::MoleRock(const Vector& pos, const Vector& velocity, const BadGuy* parent_ = 0) :
BadGuy(pos, LEFT, "images/creatures/mole/mole_rock.sprite", LAYER_TILES - 2),
- parent(parent),
+ parent(parent_),
initial_velocity(velocity)
{
physic.enable_gravity(true);
}
void
-MrBomb::grab(MovingObject&, const Vector& pos, Direction dir)
+MrBomb::grab(MovingObject&, const Vector& pos, Direction dir_)
{
assert(frozen);
movement = pos - get_pos();
- this->dir = dir;
- sprite->set_action(dir == LEFT ? "iced-left" : "iced-right");
+ this->dir = dir_;
+ sprite->set_action(dir_ == LEFT ? "iced-left" : "iced-right");
set_colgroup_active(COLGROUP_DISABLED);
grabbed = true;
}
void
-MrBomb::ungrab(MovingObject& , Direction dir)
+MrBomb::ungrab(MovingObject& , Direction dir_)
{
- this->dir = dir;
+ this->dir = dir_;
set_colgroup_active(COLGROUP_MOVING);
grabbed = false;
}
} /* HitResponse collision_badguy */
void
-SkyDive::grab (MovingObject&, const Vector& pos, Direction dir)
+SkyDive::grab (MovingObject&, const Vector& pos, Direction dir_)
{
movement = pos - get_pos();
- this->dir = dir;
+ this->dir = dir_;
is_grabbed = true;
static const std::string TREEWILLOSOUND = "sounds/willowisp.wav";
static const float SUCKSPEED = 25;
-TreeWillOWisp::TreeWillOWisp(GhostTree* tree, const Vector& pos,
- float radius, float speed) :
- BadGuy(tree->get_pos() + pos, "images/creatures/willowisp/willowisp.sprite",
+TreeWillOWisp::TreeWillOWisp(GhostTree* tree_, const Vector& pos,
+ float radius_, float speed_) :
+ BadGuy(tree_->get_pos() + pos, "images/creatures/willowisp/willowisp.sprite",
LAYER_OBJECTS - 20),
was_sucked(false),
mystate(STATE_DEFAULT),
radius(),
speed(),
sound_source(),
- tree(tree),
+ tree(tree_),
suck_target()
{
sound_manager->preload(TREEWILLOSOUND);
- this->radius = radius;
+ this->radius = radius_;
this->angle = 0;
- this->speed = speed;
+ this->speed = speed_;
set_colgroup_active(COLGROUP_MOVING);
}
}
void
-TreeWillOWisp::start_sucking(Vector suck_target)
+TreeWillOWisp::start_sucking(Vector suck_target_)
{
mystate = STATE_SUCKED;
- this->suck_target = suck_target;
+ this->suck_target = suck_target_;
was_sucked = true;
}
}
if (mystate == STATE_SUCKED) {
- Vector dir = suck_target - get_pos();
- if(dir.norm() < 5) {
+ Vector dir_ = suck_target - get_pos();
+ if(dir_.norm() < 5) {
vanish();
return;
}
- Vector newpos = get_pos() + dir * elapsed_time;
+ Vector newpos = get_pos() + dir_ * elapsed_time;
movement = newpos - get_pos();
return;
}
}
void
-TreeWillOWisp::set_color(const Color& color)
+TreeWillOWisp::set_color(const Color& color_)
{
- this->color = color;
- sprite->set_color(color);
+ this->color = color_;
+ sprite->set_color(color_);
}
Color
#include "sprite/sprite.hpp"
WalkingBadguy::WalkingBadguy(const Vector& pos,
- const std::string& sprite_name,
- const std::string& walk_left_action,
- const std::string& walk_right_action,
- int layer) :
- BadGuy(pos, sprite_name, layer),
- walk_left_action(walk_left_action),
- walk_right_action(walk_right_action),
+ const std::string& sprite_name_,
+ const std::string& walk_left_action_,
+ const std::string& walk_right_action_,
+ int layer_) :
+ BadGuy(pos, sprite_name_, layer_),
+ walk_left_action(walk_left_action_),
+ walk_right_action(walk_right_action_),
walk_speed(80),
max_drop_height(-1),
turn_around_timer(),
WalkingBadguy::WalkingBadguy(const Vector& pos,
Direction direction,
- const std::string& sprite_name,
- const std::string& walk_left_action,
- const std::string& walk_right_action,
- int layer) :
- BadGuy(pos, direction, sprite_name, layer),
- walk_left_action(walk_left_action),
- walk_right_action(walk_right_action),
+ const std::string& sprite_name_,
+ const std::string& walk_left_action_,
+ const std::string& walk_right_action_,
+ int layer_) :
+ BadGuy(pos, direction, sprite_name_, layer_),
+ walk_left_action(walk_left_action_),
+ walk_right_action(walk_right_action_),
walk_speed(80),
max_drop_height(-1),
turn_around_timer(),
}
WalkingBadguy::WalkingBadguy(const Reader& reader,
- const std::string& sprite_name,
- const std::string& walk_left_action,
- const std::string& walk_right_action,
- int layer) :
- BadGuy(reader, sprite_name, layer),
- walk_left_action(walk_left_action),
- walk_right_action(walk_right_action),
+ const std::string& sprite_name_,
+ const std::string& walk_left_action_,
+ const std::string& walk_right_action_,
+ int layer_) :
+ BadGuy(reader, sprite_name_, layer_),
+ walk_left_action(walk_left_action_),
+ walk_right_action(walk_right_action_),
walk_speed(80),
max_drop_height(-1),
turn_around_timer(),
if (dist.norm() > vanish_range) {
vanish();
} else if (dist.norm() >= 1) {
- Vector dir = dist.unit();
- movement = dir * elapsed_time * flyspeed;
+ Vector dir_ = dist.unit();
+ movement = dir_ * elapsed_time * flyspeed;
} else {
/* We somehow landed right on top of the player without colliding.
* Sit tight and avoid a division by zero. */
}
case STATE_VANISHING: {
- Vector dir = dist.unit();
- movement = dir * elapsed_time * flyspeed;
+ Vector dir_ = dist.unit();
+ movement = dir_ * elapsed_time * flyspeed;
if(sprite->animation_done()) {
remove_me();
}
{}
void
-CodeController::press(Control c, bool pressed)
+CodeController::press(Control c, bool pressed_)
{
- controls[c] = pressed;
+ controls[c] = pressed_;
}
void
#include "util/log.hpp"
#include "util/writer.hpp"
-JoystickManager::JoystickManager(InputManager* parent) :
- parent(parent),
+JoystickManager::JoystickManager(InputManager* parent_) :
+ parent(parent_),
joy_button_map(),
joy_axis_map(),
joy_hat_map(),
}
void
-Background::set_image(const std::string& name, float speed)
+Background::set_image(const std::string& name_, float speed_)
{
- this->imagefile = name;
- this->speed = speed;
+ this->imagefile = name_;
+ this->speed = speed_;
- image = Surface::create(name);
+ image = Surface::create(name_);
}
void
-Background::draw_image(DrawingContext& context, const Vector& pos)
+Background::draw_image(DrawingContext& context, const Vector& pos_)
{
Sizef level(Sector::current()->get_width(), Sector::current()->get_height());
Sizef screen(SCREEN_WIDTH, SCREEN_HEIGHT);
Sizef parallax_image_size = (1.0f - speed) * screen + level * speed;
Rectf cliprect = context.get_cliprect();
- int start_x = static_cast<int>(floorf((cliprect.get_left() - (pos.x - image->get_width() /2.0f)) / image->get_width()));
- int end_x = static_cast<int>(ceilf((cliprect.get_right() - (pos.x + image->get_width() /2.0f)) / image->get_width()))+1;
- int start_y = static_cast<int>(floorf((cliprect.get_top() - (pos.y - image->get_height()/2.0f)) / image->get_height()));
- int end_y = static_cast<int>(ceilf((cliprect.get_bottom() - (pos.y + image->get_height()/2.0f)) / image->get_height()))+1;
+ int start_x = static_cast<int>(floorf((cliprect.get_left() - (pos_.x - image->get_width() /2.0f)) / image->get_width()));
+ int end_x = static_cast<int>(ceilf((cliprect.get_right() - (pos_.x + image->get_width() /2.0f)) / image->get_width()))+1;
+ int start_y = static_cast<int>(floorf((cliprect.get_top() - (pos_.y - image->get_height()/2.0f)) / image->get_height()));
+ int end_y = static_cast<int>(ceilf((cliprect.get_bottom() - (pos_.y + image->get_height()/2.0f)) / image->get_height()))+1;
switch(alignment)
{
case LEFT_ALIGNMENT:
for(int y = start_y; y < end_y; ++y)
{
- Vector p(pos.x - parallax_image_size.width / 2.0f,
- pos.y + y * image->get_height() - image->get_height() / 2.0f);
+ Vector p(pos_.x - parallax_image_size.width / 2.0f,
+ pos_.y + y * image->get_height() - image->get_height() / 2.0f);
context.draw_surface(image, p, layer);
}
break;
case RIGHT_ALIGNMENT:
for(int y = start_y; y < end_y; ++y)
{
- Vector p(pos.x + parallax_image_size.width / 2.0f - image->get_width(),
- pos.y + y * image->get_height() - image->get_height() / 2.0f);
+ Vector p(pos_.x + parallax_image_size.width / 2.0f - image->get_width(),
+ pos_.y + y * image->get_height() - image->get_height() / 2.0f);
context.draw_surface(image, p, layer);
}
break;
case TOP_ALIGNMENT:
for(int x = start_x; x < end_x; ++x)
{
- Vector p(pos.x + x * image->get_width() - image->get_width() / 2.0f,
- pos.y - parallax_image_size.height / 2.0f);
+ Vector p(pos_.x + x * image->get_width() - image->get_width() / 2.0f,
+ pos_.y - parallax_image_size.height / 2.0f);
context.draw_surface(image, p, layer);
}
break;
case BOTTOM_ALIGNMENT:
for(int x = start_x; x < end_x; ++x)
{
- Vector p(pos.x + x * image->get_width() - image->get_width() / 2.0f,
- pos.y - image->get_height() + parallax_image_size.height / 2.0f);
+ Vector p(pos_.x + x * image->get_width() - image->get_width() / 2.0f,
+ pos_.y - image->get_height() + parallax_image_size.height / 2.0f);
context.draw_surface(image, p, layer);
}
break;
for(int y = start_y; y < end_y; ++y)
for(int x = start_x; x < end_x; ++x)
{
- Vector p(pos.x + x * image->get_width() - image->get_width()/2,
- pos.y + y * image->get_height() - image->get_height()/2);
+ Vector p(pos_.x + x * image->get_width() - image->get_width()/2,
+ pos_.y + y * image->get_height() - image->get_height()/2);
if (image_top.get() != NULL && (y < 0))
{
center = get_pos();
}
-BicyclePlatform::BicyclePlatform(BicyclePlatform* master) :
+BicyclePlatform::BicyclePlatform(BicyclePlatform* master_) :
MovingSprite(*master),
- master(master),
+ master(master_),
slave(this),
center(master->center),
radius(master->radius),
angle = master->angle + M_PI;
while (angle < 0) { angle += 2*M_PI; }
while (angle > 2*M_PI) { angle -= 2*M_PI; }
- Vector dest = center + Vector(cosf(angle), sinf(angle)) * radius - (bbox.get_size().as_vector() * 0.5);
- movement = dest - get_pos();
+ Vector dest_ = center + Vector(cosf(angle), sinf(angle)) * radius - (bbox.get_size().as_vector() * 0.5);
+ movement = dest_ - get_pos();
}
if (this == master) {
float momentum_diff = momentum - slave->momentum;
while (angle < 0) { angle += 2*M_PI; }
while (angle > 2*M_PI) { angle -= 2*M_PI; }
angular_speed = std::min(std::max(angular_speed, static_cast<float>(-128*M_PI*elapsed_time)), static_cast<float>(128*M_PI*elapsed_time));
- Vector dest = center + Vector(cosf(angle), sinf(angle)) * radius - (bbox.get_size().as_vector() * 0.5);
- movement = dest - get_pos();
+ Vector dest_ = center + Vector(cosf(angle), sinf(angle)) * radius - (bbox.get_size().as_vector() * 0.5);
+ movement = dest_ - get_pos();
center += Vector(angular_speed, 0) * elapsed_time * 32;
slave->center += Vector(angular_speed, 0) * elapsed_time * 32;
}
HitResponse
-BonusBlock::collision(GameObject& other, const CollisionHit& hit){
+BonusBlock::collision(GameObject& other, const CollisionHit& hit_){
Player* player = dynamic_cast<Player*> (&other);
if (player) {
try_open(player);
}
}
- return Block::collision(other, hit);
+ return Block::collision(other, hit_);
}
void
assert(sector);
// First what's below the bonus block, if solid send it up anyway (excepting doll)
- Rectf dest;
- dest.p1.x = bbox.get_left() + 1;
- dest.p1.y = bbox.get_bottom() + 1;
- dest.p2.x = bbox.get_right() - 1;
- dest.p2.y = dest.p1.y + 30;
- if (!Sector::current()->is_free_of_statics(dest, this, true) && !(contents == CONTENT_1UP)) {
+ Rectf dest_;
+ dest_.p1.x = bbox.get_left() + 1;
+ dest_.p1.y = bbox.get_bottom() + 1;
+ dest_.p2.x = bbox.get_right() - 1;
+ dest_.p2.y = dest_.p1.y + 30;
+ if (!Sector::current()->is_free_of_statics(dest_, this, true) && !(contents == CONTENT_1UP)) {
try_open(player);
return;
}
#include "math/random_generator.hpp"
#include "sprite/sprite.hpp"
-BrokenBrick::BrokenBrick(SpritePtr sprite,
+BrokenBrick::BrokenBrick(SpritePtr sprite_,
const Vector& pos, const Vector& nmovement) :
timer(),
- sprite(sprite),
+ sprite(sprite_),
position(pos),
movement(nmovement)
{
const float BULLET_STARTING_YM = 0;
}
-Bullet::Bullet(const Vector& pos, float xm, int dir, BonusType type) :
+Bullet::Bullet(const Vector& pos, float xm, int dir, BonusType type_) :
physic(),
life_count(3),
sprite(),
light(0.0f,0.0f,0.0f),
lightsprite(sprite_manager->create("images/objects/lightmap_light/lightmap_light-small.sprite")),
- type(type)
+ type(type_)
{
float speed = dir == RIGHT ? BULLET_XM : -BULLET_XM;
physic.set_velocity_x(speed + xm);
}
};
-Camera::Camera(Sector* newsector, std::string name) :
+Camera::Camera(Sector* newsector, std::string name_) :
mode(NORMAL),
translation(),
sector(newsector),
scrollspeed(),
config()
{
- this->name = name;
+ this->name = name_;
config = new CameraConfig();
reload_config();
}
}
void
-Camera::keep_in_bounds(Vector& translation)
+Camera::keep_in_bounds(Vector& translation_)
{
float width = sector->get_width();
float height = sector->get_height();
// don't scroll before the start or after the level's end
- translation.x = clamp(translation.x, 0, width - SCREEN_WIDTH);
- translation.y = clamp(translation.y, 0, height - SCREEN_HEIGHT);
+ translation_.x = clamp(translation_.x, 0, width - SCREEN_WIDTH);
+ translation_.y = clamp(translation_.y, 0, height - SCREEN_HEIGHT);
if (height < SCREEN_HEIGHT)
- translation.y = height/2.0 - SCREEN_HEIGHT/2.0;
+ translation_.y = height/2.0 - SCREEN_HEIGHT/2.0;
if (width < SCREEN_WIDTH)
- translation.x = width/2.0 - SCREEN_WIDTH/2.0;
+ translation_.x = width/2.0 - SCREEN_WIDTH/2.0;
}
void
void
Camera::update_scroll_normal(float elapsed_time)
{
- const CameraConfig& config = *(this->config);
+ const CameraConfig& config_ = *(this->config);
Player* player = sector->player;
// TODO: co-op mode needs a good camera
Vector player_pos(player->get_bbox().get_middle().x,
return;
/****** Vertical Scrolling part ******/
- int ymode = config.ymode;
+ int ymode = config_.ymode;
if(player->is_dying() || sector->get_height() == 19*32) {
ymode = 0;
}
if(ymode == 1) {
- cached_translation.y = player_pos.y - SCREEN_HEIGHT * config.target_y;
+ cached_translation.y = player_pos.y - SCREEN_HEIGHT * config_.target_y;
}
if(ymode == 2) {
// target_y is the high we target our scrolling at. This is not always the
target_y = player->last_ground_y + player->get_bbox().get_height();
else
target_y = player->get_bbox().p2.y;
- target_y -= SCREEN_HEIGHT * config.target_y;
+ target_y -= SCREEN_HEIGHT * config_.target_y;
// delta_y is the distance we'd have to travel to directly reach target_y
float delta_y = cached_translation.y - target_y;
// limit the camera speed when jumping upwards
if(player->fall_mode != Player::FALLING
&& player->fall_mode != Player::TRAMPOLINE_JUMP) {
- speed_y = clamp(speed_y, -config.max_speed_y, config.max_speed_y);
+ speed_y = clamp(speed_y, -config_.max_speed_y, config_.max_speed_y);
}
// scroll with calculated speed
cached_translation.y -= speed_y * elapsed_time;
}
if(ymode == 3) {
- float halfsize = config.kirby_rectsize_y * 0.5f;
+ float halfsize = config_.kirby_rectsize_y * 0.5f;
cached_translation.y = clamp(cached_translation.y,
player_pos.y - SCREEN_HEIGHT * (0.5f + halfsize),
player_pos.y - SCREEN_HEIGHT * (0.5f - halfsize));
}
if(ymode == 4) {
- float upperend = SCREEN_HEIGHT * config.edge_x;
- float lowerend = SCREEN_HEIGHT * (1 - config.edge_x);
+ float upperend = SCREEN_HEIGHT * config_.edge_x;
+ float lowerend = SCREEN_HEIGHT * (1 - config_.edge_x);
if (player_delta.y < -CAMERA_EPSILON) {
// walking left
- lookahead_pos.y -= player_delta.y * config.dynamic_speed_sm;
+ lookahead_pos.y -= player_delta.y * config_.dynamic_speed_sm;
if(lookahead_pos.y > lowerend) {
lookahead_pos.y = lowerend;
}
} else if (player_delta.y > CAMERA_EPSILON) {
// walking right
- lookahead_pos.y -= player_delta.y * config.dynamic_speed_sm;
+ lookahead_pos.y -= player_delta.y * config_.dynamic_speed_sm;
if(lookahead_pos.y < upperend) {
lookahead_pos.y = upperend;
}
if(ymode != 0) {
float top_edge, bottom_edge;
- if(config.clamp_y <= 0) {
+ if(config_.clamp_y <= 0) {
top_edge = 0;
bottom_edge = SCREEN_HEIGHT;
} else {
- top_edge = SCREEN_HEIGHT*config.clamp_y;
- bottom_edge = SCREEN_HEIGHT*(1-config.clamp_y);
+ top_edge = SCREEN_HEIGHT*config_.clamp_y;
+ bottom_edge = SCREEN_HEIGHT*(1-config_.clamp_y);
}
float peek_to = 0;
translation.y -= peek_pos.y;
- if(config.clamp_y > 0) {
+ if(config_.clamp_y > 0) {
translation.y = clamp(translation.y,
- player_pos.y - SCREEN_HEIGHT * (1-config.clamp_y),
- player_pos.y - SCREEN_HEIGHT * config.clamp_y);
+ player_pos.y - SCREEN_HEIGHT * (1-config_.clamp_y),
+ player_pos.y - SCREEN_HEIGHT * config_.clamp_y);
cached_translation.y = clamp(cached_translation.y,
- player_pos.y - SCREEN_HEIGHT * (1-config.clamp_y),
- player_pos.y - SCREEN_HEIGHT * config.clamp_y);
+ player_pos.y - SCREEN_HEIGHT * (1-config_.clamp_y),
+ player_pos.y - SCREEN_HEIGHT * config_.clamp_y);
}
}
/****** Horizontal scrolling part *******/
- int xmode = config.xmode;
+ int xmode = config_.xmode;
if(player->is_dying())
xmode = 0;
if(xmode == 1) {
- cached_translation.x = player_pos.x - SCREEN_WIDTH * config.target_x;
+ cached_translation.x = player_pos.x - SCREEN_WIDTH * config_.target_x;
}
if(xmode == 2) {
// our camera is either in leftscrolling, rightscrolling or
else walkDirection = LOOKAHEAD_RIGHT;
float LEFTEND, RIGHTEND;
- if(config.sensitive_x > 0) {
- LEFTEND = SCREEN_WIDTH * config.sensitive_x;
- RIGHTEND = SCREEN_WIDTH * (1-config.sensitive_x);
+ if(config_.sensitive_x > 0) {
+ LEFTEND = SCREEN_WIDTH * config_.sensitive_x;
+ RIGHTEND = SCREEN_WIDTH * (1-config_.sensitive_x);
} else {
LEFTEND = SCREEN_WIDTH;
RIGHTEND = 0;
* sudden changes */
if(changetime < 0) {
changetime = game_time;
- } else if(game_time - changetime > config.dirchange_time) {
+ } else if(game_time - changetime > config_.dirchange_time) {
if(lookahead_mode == LOOKAHEAD_LEFT &&
player_pos.x > cached_translation.x + RIGHTEND) {
lookahead_mode = LOOKAHEAD_RIGHT;
changetime = -1;
}
- LEFTEND = SCREEN_WIDTH * config.edge_x;
- RIGHTEND = SCREEN_WIDTH * (1-config.edge_x);
+ LEFTEND = SCREEN_WIDTH * config_.edge_x;
+ RIGHTEND = SCREEN_WIDTH * (1-config_.edge_x);
// calculate our scroll target depending on scroll mode
float target_x;
// limit our speed
float player_speed_x = player_delta.x / elapsed_time;
- float maxv = config.max_speed_x + (fabsf(player_speed_x * config.dynamic_max_speed_x));
+ float maxv = config_.max_speed_x + (fabsf(player_speed_x * config_.dynamic_max_speed_x));
speed_x = clamp(speed_x, -maxv, maxv);
// apply scrolling
cached_translation.x -= speed_x * elapsed_time;
}
if(xmode == 3) {
- float halfsize = config.kirby_rectsize_x * 0.5f;
+ float halfsize = config_.kirby_rectsize_x * 0.5f;
cached_translation.x = clamp(cached_translation.x,
player_pos.x - SCREEN_WIDTH * (0.5f + halfsize),
player_pos.x - SCREEN_WIDTH * (0.5f - halfsize));
}
if(xmode == 4) {
- float LEFTEND = SCREEN_WIDTH * config.edge_x;
- float RIGHTEND = SCREEN_WIDTH * (1 - config.edge_x);
+ float LEFTEND = SCREEN_WIDTH * config_.edge_x;
+ float RIGHTEND = SCREEN_WIDTH * (1 - config_.edge_x);
if (player_delta.x < -CAMERA_EPSILON) {
// walking left
- lookahead_pos.x -= player_delta.x * config.dynamic_speed_sm;
+ lookahead_pos.x -= player_delta.x * config_.dynamic_speed_sm;
if(lookahead_pos.x > RIGHTEND) {
lookahead_pos.x = RIGHTEND;
}
} else if (player_delta.x > CAMERA_EPSILON) {
// walking right
- lookahead_pos.x -= player_delta.x * config.dynamic_speed_sm;
+ lookahead_pos.x -= player_delta.x * config_.dynamic_speed_sm;
if(lookahead_pos.x < LEFTEND) {
lookahead_pos.x = LEFTEND;
}
if(xmode != 0) {
float left_edge, right_edge;
- if(config.clamp_x <= 0) {
+ if(config_.clamp_x <= 0) {
left_edge = 0;
right_edge = SCREEN_WIDTH;
} else {
- left_edge = SCREEN_WIDTH*config.clamp_x;
- right_edge = SCREEN_WIDTH*(1-config.clamp_x);
+ left_edge = SCREEN_WIDTH*config_.clamp_x;
+ right_edge = SCREEN_WIDTH*(1-config_.clamp_x);
}
float peek_to = 0;
translation.x -= peek_pos.x;
- if(config.clamp_x > 0) {
+ if(config_.clamp_x > 0) {
translation.x = clamp(translation.x,
- player_pos.x - SCREEN_WIDTH * (1-config.clamp_x),
- player_pos.x - SCREEN_WIDTH * config.clamp_x);
+ player_pos.x - SCREEN_WIDTH * (1-config_.clamp_x),
+ player_pos.x - SCREEN_WIDTH * config_.clamp_x);
cached_translation.x = clamp(cached_translation.x,
- player_pos.x - SCREEN_WIDTH * (1-config.clamp_x),
- player_pos.x - SCREEN_WIDTH * config.clamp_x);
+ player_pos.x - SCREEN_WIDTH * (1-config_.clamp_x),
+ player_pos.x - SCREEN_WIDTH * config_.clamp_x);
}
}
}
void
-Candle::set_burning(bool burning)
+Candle::set_burning(bool burning_)
{
- if (this->burning == burning) return;
- this->burning = burning;
- if (burning) {
+ if (this->burning == burning_) return;
+ this->burning = burning_;
+ if (burning_) {
sprite->set_action("on");
} else {
sprite->set_action("off");
static const float BORDER_SIZE = 75;
-DisplayEffect::DisplayEffect(std::string name) :
+DisplayEffect::DisplayEffect(const std::string& name_) :
screen_fade(NO_FADE),
screen_fadetime(0),
screen_fading(0),
black(false),
borders(false)
{
- this->name = name;
+ this->name = name_;
}
DisplayEffect::~DisplayEffect()
public ScriptInterface
{
public:
- DisplayEffect(std::string name = "");
+ DisplayEffect(const std::string& name = std::string());
virtual ~DisplayEffect();
void expose(HSQUIRRELVM vm, SQInteger table_idx);
}
void
-FloatingImage::fade_in(float fadetime)
+FloatingImage::fade_in(float fadetime_)
{
- this->fadetime = fadetime;
- fading = fadetime;
+ this->fadetime = fadetime_;
+ fading = fadetime_;
}
void
-FloatingImage::fade_out(float fadetime)
+FloatingImage::fade_out(float fadetime_)
{
- this->fadetime = fadetime;
- fading = -fadetime;
+ this->fadetime = fadetime_;
+ fading = -fadetime_;
}
void
FloatingImage(const std::string& sprite);
virtual ~FloatingImage();
- void set_layer(int layer) {
- this->layer = layer;
+ void set_layer(int layer_) {
+ this->layer = layer_;
}
int get_layer() const {
return layer;
}
- void set_pos(const Vector& pos) {
- this->pos = pos;
+ void set_pos(const Vector& pos_) {
+ this->pos = pos_;
}
const Vector& get_pos() const {
return pos;
}
- void set_anchor_point(AnchorPoint anchor) {
- this->anchor = anchor;
+ void set_anchor_point(AnchorPoint anchor_) {
+ this->anchor = anchor_;
}
AnchorPoint get_anchor_point() const {
return anchor;
}
- void set_visible(bool visible) {
- this->visible = visible;
+ void set_visible(bool visible_) {
+ this->visible = visible_;
}
bool get_visible() const {
return visible;
}
*/
void
-IceCrusher::set_state(IceCrusherState state, bool force)
+IceCrusher::set_state(IceCrusherState state_, bool force)
{
- if ((this->state == state) && (!force)) return;
- switch(state) {
+ if ((this->state == state_) && (!force)) return;
+ switch(state_) {
case IDLE:
set_group(COLGROUP_STATIC);
physic.enable_gravity (false);
log_debug << "IceCrusher in invalid state" << std::endl;
break;
}
- this->state = state;
+ this->state = state_;
}
HitResponse
}
HitResponse
-InfoBlock::collision(GameObject& other, const CollisionHit& hit){
-
- Player* player = dynamic_cast<Player*> (&other);
- if (player) {
- if (player->does_buttjump)
- InfoBlock::hit(*player);
- }
- return Block::collision(other, hit);
+InfoBlock::collision(GameObject& other, const CollisionHit& hit_)
+{
+ Player* player = dynamic_cast<Player*> (&other);
+ if (player)
+ {
+ if (player->does_buttjump)
+ InfoBlock::hit(*player);
+ }
+ return Block::collision(other, hit_);
}
Player*
}
void
-LevelTime::set_time(float time_left)
+LevelTime::set_time(float time_left_)
{
- this->time_left = std::min(std::max(time_left, 0.0f), 999.0f);
+ this->time_left = std::min(std::max(time_left_, 0.0f), 999.0f);
}
/* EOF */
#include <stdexcept>
-MovingSprite::MovingSprite(const Vector& pos, const std::string& sprite_name,
- int layer, CollisionGroup collision_group) :
- sprite_name(sprite_name),
+MovingSprite::MovingSprite(const Vector& pos, const std::string& sprite_name_,
+ int layer_, CollisionGroup collision_group) :
+ sprite_name(sprite_name_),
sprite(),
- layer(layer)
+ layer(layer_)
{
bbox.set_pos(pos);
sprite = sprite_manager->create(sprite_name);
set_group(collision_group);
}
-MovingSprite::MovingSprite(const Reader& reader, const Vector& pos, int layer, CollisionGroup collision_group) :
+MovingSprite::MovingSprite(const Reader& reader, const Vector& pos, int layer_, CollisionGroup collision_group) :
sprite_name(),
sprite(),
- layer(layer)
+ layer(layer_)
{
bbox.set_pos(pos);
if (!reader.get("sprite", sprite_name))
set_group(collision_group);
}
-MovingSprite::MovingSprite(const Reader& reader, const std::string& sprite_name, int layer, CollisionGroup collision_group) :
- sprite_name(sprite_name),
+MovingSprite::MovingSprite(const Reader& reader, const std::string& sprite_name_, int layer_, CollisionGroup collision_group) :
+ sprite_name(sprite_name_),
sprite(),
- layer(layer)
+ layer(layer_)
{
reader.get("x", bbox.p1.x);
reader.get("y", bbox.p1.y);
set_group(collision_group);
}
-MovingSprite::MovingSprite(const Reader& reader, int layer, CollisionGroup collision_group) :
+MovingSprite::MovingSprite(const Reader& reader, int layer_, CollisionGroup collision_group) :
sprite_name(),
sprite(),
- layer(layer)
+ layer(layer_)
{
reader.get("x", bbox.p1.x);
reader.get("y", bbox.p1.y);
#include <math.h>
#include <assert.h>
-PathWalker::PathWalker(const Path* path, bool running_) :
- path(path),
+PathWalker::PathWalker(const Path* path_, bool running_) :
+ path(path_),
running(running_),
current_node_nr(0),
next_node_nr(0),
bool no_water = true;
}
-Player::Player(PlayerStatus* _player_status, const std::string& name) :
+Player::Player(PlayerStatus* _player_status, const std::string& name_) :
deactivated(),
controller(),
scripting_controller(),
idle_stage(0),
climbing(0)
{
- this->name = name;
+ this->name = name_;
controller = g_input_manager->get_controller();
scripting_controller.reset(new CodeController());
// if/when we have complete penny gfx, we can
}
void
-Player::set_controller(Controller* controller)
+Player::set_controller(Controller* controller_)
{
- this->controller = controller;
+ this->controller = controller_;
}
void
if(moving_object) {
// move the grabbed object a bit away from tux
Rectf grabbed_bbox = moving_object->get_bbox();
- Rectf dest;
- dest.p2.y = bbox.get_top() + bbox.get_height()*0.66666;
- dest.p1.y = dest.p2.y - grabbed_bbox.get_height();
+ Rectf dest_;
+ dest_.p2.y = bbox.get_top() + bbox.get_height()*0.66666;
+ dest_.p1.y = dest_.p2.y - grabbed_bbox.get_height();
if(dir == LEFT) {
- dest.p2.x = bbox.get_left() - 1;
- dest.p1.x = dest.p2.x - grabbed_bbox.get_width();
+ dest_.p2.x = bbox.get_left() - 1;
+ dest_.p1.x = dest_.p2.x - grabbed_bbox.get_width();
} else {
- dest.p1.x = bbox.get_right() + 1;
- dest.p2.x = dest.p1.x + grabbed_bbox.get_width();
+ dest_.p1.x = bbox.get_right() + 1;
+ dest_.p2.x = dest_.p1.x + grabbed_bbox.get_width();
}
- if(Sector::current()->is_free_of_tiles(dest, true)) {
- moving_object->set_pos(dest.p1);
+ if(Sector::current()->is_free_of_tiles(dest_, true)) {
+ moving_object->set_pos(dest_.p1);
if(controller->hold(Controller::UP)) {
grabbed_object->ungrab(*this, UP);
} else {
}
void
-Player::set_visible(bool visible)
+Player::set_visible(bool visible_)
{
- this->visible = visible;
- if( visible )
+ this->visible = visible_;
+ if( visible_ )
set_group(COLGROUP_MOVING);
else
set_group(COLGROUP_DISABLED);
start_y = get_pos().y;
}
-PneumaticPlatform::PneumaticPlatform(PneumaticPlatform* master) :
- MovingSprite(*master),
- master(master),
+PneumaticPlatform::PneumaticPlatform(PneumaticPlatform* master_) :
+ MovingSprite(*master_),
+ master(master_),
slave(this),
- start_y(master->start_y),
- offset_y(-master->offset_y),
+ start_y(master_->start_y),
+ offset_y(-master_->offset_y),
speed_y(0),
contacts()
{
}
-PowerUp::PowerUp(const Vector& pos, const std::string& sprite_name) :
- MovingSprite(pos, sprite_name, LAYER_OBJECTS, COLGROUP_MOVING),
+PowerUp::PowerUp(const Vector& pos, const std::string& sprite_name_) :
+ MovingSprite(pos, sprite_name_, LAYER_OBJECTS, COLGROUP_MOVING),
physic(),
script(),
no_physics(false),
#include <stdexcept>
SpriteParticle::SpriteParticle(std::string sprite_name, std::string action,
- Vector position, AnchorPoint anchor, Vector velocity, Vector acceleration,
+ Vector position_, AnchorPoint anchor, Vector velocity_, Vector acceleration_,
int drawing_layer_) :
sprite(),
- position(position),
- velocity(velocity),
- acceleration(acceleration),
+ position(position_),
+ velocity(velocity_),
+ acceleration(acceleration_),
drawing_layer(drawing_layer_),
light(0.0f,0.0f,0.0f),
lightsprite(sprite_manager->create("images/objects/lightmap_light/lightmap_light-tiny.sprite")),
#include "supertux/resources.hpp"
#include "video/drawing_context.hpp"
-TextObject::TextObject(std::string name) :
+TextObject::TextObject(std::string name_) :
font(),
text(),
fading(0),
anchor(ANCHOR_MIDDLE),
pos(0, 0)
{
- this->name = name;
+ this->name = name_;
font = Resources::normal_font;
centered = false;
}
}
void
-TextObject::set_font(const std::string& name)
+TextObject::set_font(const std::string& name_)
{
- if(name == "normal") {
+ if(name_ == "normal") {
font = Resources::normal_font;
- } else if(name == "big") {
+ } else if(name_ == "big") {
font = Resources::big_font;
- } else if(name == "small") {
+ } else if(name_ == "small") {
font = Resources::small_font;
} else {
- log_warning << "Unknown font '" << name << "'." << std::endl;
+ log_warning << "Unknown font '" << name_ << "'." << std::endl;
font = Resources::normal_font;
}
}
void
-TextObject::set_text(const std::string& text)
+TextObject::set_text(const std::string& text_)
{
- this->text = text;
+ this->text = text_;
}
void
-TextObject::fade_in(float fadetime)
+TextObject::fade_in(float fadetime_)
{
- this->fadetime = fadetime;
- fading = fadetime;
+ this->fadetime = fadetime_;
+ fading = fadetime_;
}
void
-TextObject::fade_out(float fadetime)
+TextObject::fade_out(float fadetime_)
{
- this->fadetime = fadetime;
- fading = -fadetime;
+ this->fadetime = fadetime_;
+ fading = -fadetime_;
}
void
-TextObject::set_visible(bool visible)
+TextObject::set_visible(bool visible_)
{
- this->visible = visible;
+ this->visible = visible_;
fading = 0;
}
void
-TextObject::set_centered(bool centered)
+TextObject::set_centered(bool centered_)
{
- this->centered = centered;
+ this->centered = centered_;
}
void
void set_centered(bool centered);
bool is_visible();
- void set_anchor_point(AnchorPoint anchor) {
- this->anchor = anchor;
+ void set_anchor_point(AnchorPoint anchor_) {
+ this->anchor = anchor_;
}
AnchorPoint get_anchor_point() const {
return anchor;
}
- void set_pos(const Vector& pos) {
- this->pos = pos;
+ void set_pos(const Vector& pos_) {
+ this->pos = pos_;
}
void set_pos(float x, float y) {
set_pos(Vector(x, y));
return pos.y;
}
- void set_anchor_point(int anchor) {
- set_anchor_point((AnchorPoint) anchor);
+ void set_anchor_point(int anchor_) {
+ set_anchor_point((AnchorPoint) anchor_);
}
int get_anchor_point() {
return (int) get_anchor_point();
}
}
-TileMap::TileMap(const TileSet *new_tileset, std::string name, int z_pos,
- bool solid, size_t width, size_t height) :
+TileMap::TileMap(const TileSet *new_tileset, std::string name_, int z_pos_,
+ bool solid, size_t width_, size_t height_) :
tileset(new_tileset),
tiles(),
real_solid(solid),
speed_y(1),
width(0),
height(0),
- z_pos(z_pos),
+ z_pos(z_pos_),
offset(Vector(0,0)),
movement(Vector(0,0)),
drawing_effect(NO_EFFECT),
walker(),
draw_target(DrawingContext::NORMAL)
{
- this->name = name;
+ this->name = name_;
if (this->z_pos > (LAYER_GUI - 100))
this->z_pos = LAYER_GUI - 100;
- resize(width, height);
+ resize(width_, height_);
}
TileMap::~TileMap()
}
void
-TileMap::fade(float alpha, float seconds)
+TileMap::fade(float alpha_, float seconds)
{
- this->alpha = alpha;
+ this->alpha = alpha_;
this->remaining_fade_time = seconds;
}
void
-TileMap::set_alpha(float alpha)
+TileMap::set_alpha(float alpha_)
{
- this->alpha = alpha;
+ this->alpha = alpha_;
this->current_alpha = alpha;
this->remaining_fade_time = 0;
update_effective_solid ();
}
void
-Wind::update(float elapsed_time)
+Wind::update(float elapsed_time_)
{
- this->elapsed_time = elapsed_time;
+ this->elapsed_time = elapsed_time_;
if (!blowing) return;
return traits_type::eof();
if(c != traits_type::eof()) {
- PHYSFS_sint64 res = PHYSFS_write(file, &c2, 1, 1);
- if(res <= 0)
+ PHYSFS_sint64 res_ = PHYSFS_write(file, &c2, 1, 1);
+ if(res_ <= 0)
return traits_type::eof();
}
#include "util/log.hpp"
namespace scripting {
-Camera::Camera(::Camera* camera)
- : camera(camera)
+Camera::Camera(::Camera* camera_)
+ : camera(camera_)
{ }
Camera::~Camera()
namespace scripting {
-Candle::Candle(::Candle* candle)
- : candle(candle)
+Candle::Candle(::Candle* candle_)
+ : candle(candle_)
{ }
Candle::~Candle()
namespace scripting {
-LevelTime::LevelTime(::LevelTime* level_time)
- : level_time(level_time)
+LevelTime::LevelTime(::LevelTime* level_time_)
+ : level_time(level_time_)
{ }
LevelTime::~LevelTime()
namespace scripting {
-Platform::Platform(::Platform* platform)
- : platform(platform)
+Platform::Platform(::Platform* platform_)
+ : platform(platform_)
{ }
Platform::~Platform()
namespace scripting {
-SquirrelError::SquirrelError(HSQUIRRELVM v, const std::string& message) throw() :
+SquirrelError::SquirrelError(HSQUIRRELVM v, const std::string& message_) throw() :
message()
{
std::ostringstream msg;
- msg << "Squirrel error: " << message << " (";
+ msg << "Squirrel error: " << message_ << " (";
const char* lasterr;
sq_getlasterror(v);
if(sq_gettype(v, -1) != OT_STRING)
namespace scripting {
-Thunderstorm::Thunderstorm(::Thunderstorm* thunderstorm)
- : thunderstorm(thunderstorm)
+Thunderstorm::Thunderstorm(::Thunderstorm* thunderstorm_)
+ : thunderstorm(thunderstorm_)
{
}
namespace scripting {
-TileMap::TileMap(::TileMap* tilemap)
- : tilemap(tilemap)
+TileMap::TileMap(::TileMap* tilemap_)
+ : tilemap(tilemap_)
{ }
TileMap::~TileMap()
namespace scripting {
-Wind::Wind(::Wind* wind)
- : wind(wind)
+Wind::Wind(::Wind* wind_)
+ : wind(wind_)
{ }
Wind::~Wind()
}
void
-Console::show_history(int offset)
+Console::show_history(int offset_)
{
- while ((offset > 0) && (history_position != history.end())) {
+ while ((offset_ > 0) && (history_position != history.end())) {
history_position++;
- offset--;
+ offset_--;
}
- while ((offset < 0) && (history_position != history.begin())) {
+ while ((offset_ < 0) && (history_position != history.begin())) {
history_position--;
- offset++;
+ offset_++;
}
if (history_position == history.end()) {
inputBuffer = "";
}
void
-Console::move_cursor(int offset)
+Console::move_cursor(int offset_)
{
- if (offset == -65535) inputBufferPosition = 0;
- if (offset == +65535) inputBufferPosition = inputBuffer.length();
- inputBufferPosition+=offset;
+ if (offset_ == -65535) inputBufferPosition = 0;
+ if (offset_ == +65535) inputBufferPosition = inputBuffer.length();
+ inputBufferPosition+=offset_;
if (inputBufferPosition < 0) inputBufferPosition = 0;
if (inputBufferPosition > (int)inputBuffer.length()) inputBufferPosition = inputBuffer.length();
}
#include "supertux/globals.hpp"
#include "video/drawing_context.hpp"
-FadeOut::FadeOut(float fade_time, Color color)
- : color(color), fade_time(fade_time), accum_time(0)
+FadeOut::FadeOut(float fade_time_, Color color_)
+ : color(color_), fade_time(fade_time_), accum_time(0)
{
}
}
void
-GameSession::set_editmode(bool edit_mode)
+GameSession::set_editmode(bool edit_mode_)
{
- if (this->edit_mode == edit_mode) return;
- this->edit_mode = edit_mode;
+ if (this->edit_mode == edit_mode_) return;
+ this->edit_mode = edit_mode_;
- currentsector->get_players()[0]->set_edit_mode(edit_mode);
+ currentsector->get_players()[0]->set_edit_mode(edit_mode_);
- if (edit_mode) {
+ if (edit_mode_) {
// entering edit mode
} // namespace
-InfoBoxLine::InfoBoxLine(char format_char, const std::string& text) :
+InfoBoxLine::InfoBoxLine(char format_char, const std::string& text_) :
lineType(NORMAL),
font(Resources::normal_font),
color(),
- text(text),
+ text(text_),
image()
{
font = get_font_by_format_char(format_char);
#include <sstream>
#include <boost/format.hpp>
-LevelIntro::LevelIntro(const Level* level, const Statistics* best_level_statistics) :
- level(level),
- best_level_statistics(best_level_statistics),
+LevelIntro::LevelIntro(const Level* level_, const Statistics* best_level_statistics_) :
+ level(level_),
+ best_level_statistics(best_level_statistics_),
player_sprite(),
player_sprite_py(0),
player_sprite_vy(0),
args.merge_into(*g_config);
init_tinygettext();
}
- catch(const std::exception& err)
+ catch(const std::exception& err_)
{
- log_fatal << "failed to init config or tinygettext: " << err.what() << std::endl;
+ log_fatal << "failed to init config or tinygettext: " << err_.what() << std::endl;
}
std::cout << "Error: " << err.what() << std::endl;
}
fullscreen_res->list.push_back("Desktop");
- std::ostringstream out;
std::string fullscreen_size_str = "Desktop";
- if (g_config->fullscreen_size != Size(0, 0))
{
- out << g_config->fullscreen_size.width << "x" << g_config->fullscreen_size.height << "@" << g_config->fullscreen_refresh_rate;
- fullscreen_size_str = out.str();
+ std::ostringstream out;
+ if (g_config->fullscreen_size != Size(0, 0))
+ {
+ out << g_config->fullscreen_size.width << "x" << g_config->fullscreen_size.height << "@" << g_config->fullscreen_refresh_rate;
+ fullscreen_size_str = out.str();
+ }
}
+
size_t cnt = 0;
for (std::vector<std::string>::iterator i = fullscreen_res->list.begin(); i != fullscreen_res->list.end(); ++i)
{
std::ostringstream out;
out << g_config->aspect_size.width << ":" << g_config->aspect_size.height;
std::string aspect_ratio = out.str();
- size_t cnt = 0;
+ size_t cnt_ = 0;
for(std::vector<std::string>::iterator i = aspect->list.begin(); i != aspect->list.end(); ++i)
{
if(*i == aspect_ratio)
{
aspect_ratio.clear();
- aspect->selected = cnt;
+ aspect->selected = cnt_;
break;
}
- ++cnt;
+ ++cnt_;
}
if (!aspect_ratio.empty())
}
void
-Physic::enable_gravity(bool enable_gravity)
+Physic::enable_gravity(bool enable_gravity_)
{
- gravity_enabled_flag = enable_gravity;
+ gravity_enabled_flag = enable_gravity_;
}
bool
}
void
-Physic::set_gravity_modifier(float gravity_modifier)
+Physic::set_gravity_modifier(float gravity_modifier_)
{
- this->gravity_modifier = gravity_modifier;
+ this->gravity_modifier = gravity_modifier_;
}
Vector
}
GameObject*
-Sector::parse_object(const std::string& name, const Reader& reader)
+Sector::parse_object(const std::string& name_, const Reader& reader)
{
- if(name == "camera") {
- Camera* camera = new Camera(this, "Camera");
- camera->parse(reader);
- return camera;
- } else if(name == "particles-snow") {
+ if(name_ == "camera") {
+ Camera* camera_ = new Camera(this, "Camera");
+ camera_->parse(reader);
+ return camera_;
+ } else if(name_ == "particles-snow") {
SnowParticleSystem* partsys = new SnowParticleSystem();
partsys->parse(reader);
return partsys;
- } else if(name == "particles-rain") {
+ } else if(name_ == "particles-rain") {
RainParticleSystem* partsys = new RainParticleSystem();
partsys->parse(reader);
return partsys;
- } else if(name == "particles-comets") {
+ } else if(name_ == "particles-comets") {
CometParticleSystem* partsys = new CometParticleSystem();
partsys->parse(reader);
return partsys;
- } else if(name == "particles-ghosts") {
+ } else if(name_ == "particles-ghosts") {
GhostParticleSystem* partsys = new GhostParticleSystem();
partsys->parse(reader);
return partsys;
- } else if(name == "particles-clouds") {
+ } else if(name_ == "particles-clouds") {
CloudParticleSystem* partsys = new CloudParticleSystem();
partsys->parse(reader);
return partsys;
- } else if(name == "money") { // for compatibility with old maps
+ } else if(name_ == "money") { // for compatibility with old maps
return new Jumpy(reader);
} else {
try {
- return ObjectFactory::instance().create(name, reader);
+ return ObjectFactory::instance().create(name_, reader);
} catch(std::exception& e) {
log_warning << e.what() << "" << std::endl;
return 0;
}
// add a camera
- Camera* camera = new Camera(this, "Camera");
- add_object(camera);
+ Camera* camera_ = new Camera(this, "Camera");
+ add_object(camera_);
update_game_objects();
solid_tilemaps.push_back(tilemap);
}
- Camera* camera = dynamic_cast<Camera*> (object);
- if(camera != NULL) {
+ Camera* camera_ = dynamic_cast<Camera*> (object);
+ if(camera_ != NULL) {
if(this->camera != 0) {
log_warning << "Multiple cameras added. Ignoring" << std::endl;
return false;
}
- this->camera = camera;
+ this->camera = camera_;
}
- Player* player = dynamic_cast<Player*> (object);
- if(player != NULL) {
+ Player* player_ = dynamic_cast<Player*> (object);
+ if(player_ != NULL) {
if(this->player != 0) {
log_warning << "Multiple players added. Ignoring" << std::endl;
return false;
}
- this->player = player;
+ this->player = player_;
}
- DisplayEffect* effect = dynamic_cast<DisplayEffect*> (object);
- if(effect != NULL) {
+ DisplayEffect* effect_ = dynamic_cast<DisplayEffect*> (object);
+ if(effect_ != NULL) {
if(this->effect != 0) {
log_warning << "Multiple DisplayEffects added. Ignoring" << std::endl;
return false;
}
- this->effect = effect;
+ this->effect = effect_;
}
if(_current == this) {
}
void
-Sector::set_gravity(float gravity)
+Sector::set_gravity(float gravity_)
{
log_warning << "Changing a Sector's gravitational constant might have unforeseen side-effects" << std::endl;
- this->gravity = gravity;
+ this->gravity = gravity_;
}
float
#include "supertux/shrinkfade.hpp"
#include "video/drawing_context.hpp"
-ShrinkFade::ShrinkFade(const Vector& dest, float fade_time) :
- dest(dest),
- fade_time(fade_time),
+ShrinkFade::ShrinkFade(const Vector& dest_, float fade_time_) :
+ dest(dest_),
+ fade_time(fade_time_),
accum_time(0),
speedleft(),
speedright(),
}
Tile::Tile(const std::vector<ImageSpec>& imagespecs_, const std::vector<ImageSpec>& editor_imagespecs_,
- uint32_t attributes, uint32_t data, float fps) :
+ uint32_t attributes_, uint32_t data_, float fps_) :
imagespecs(imagespecs_),
images(),
editor_imagespecs(editor_imagespecs_),
editor_images(),
- attributes(attributes),
- data(data),
- fps(fps)
+ attributes(attributes_),
+ data(data_),
+ fps(fps_)
{
correct_attributes();
}
}
void
-Timer::start(float period, bool cyclic)
+Timer::start(float period_, bool cyclic_)
{
- this->period = period;
- this->cyclic = cyclic;
+ this->period = period_;
+ this->cyclic = cyclic_;
cycle_start = game_time;
}
}
HitResponse
-Door::collision(GameObject& other, const CollisionHit& hit)
+Door::collision(GameObject& other, const CollisionHit& hit_)
{
switch (state) {
case CLOSED:
break;
}
- return TriggerBase::collision(other, hit);
+ return TriggerBase::collision(other, hit_);
}
/* EOF */
triggerevent = EVENT_TOUCH;
}
-ScriptTrigger::ScriptTrigger(const Vector& pos, const std::string& script) :
+ScriptTrigger::ScriptTrigger(const Vector& pos, const std::string& script_) :
triggerevent(),
script()
{
bbox.set_pos(pos);
bbox.set_size(32, 32);
- this->script = script;
+ this->script = script_;
triggerevent = EVENT_TOUCH;
}
message_displayed = false;
}
-SecretAreaTrigger::SecretAreaTrigger(const Rectf& area, std::string fade_tilemap) :
+SecretAreaTrigger::SecretAreaTrigger(const Rectf& area, std::string fade_tilemap_) :
message_timer(),
message_displayed(),
message(_("You found a secret area!")),
- fade_tilemap(fade_tilemap),
+ fade_tilemap(fade_tilemap_),
script()
{
bbox = area;
class Ref
{
public:
- Ref(T* object = 0)
- : object(object)
+ Ref(T* object_ = 0)
+ : object(object_)
{
if(object)
object->ref();
return *this;
}
- Ref<T>& operator= (T* object)
+ Ref<T>& operator= (T* object_)
{
- if(object)
- object->ref();
+ if(object_)
+ object_->ref();
if(this->object)
this->object->unref();
- this->object = object;
+ this->object = object_;
return *this;
}
}
void
-DrawingContext::clear_drawing_requests(DrawingRequests& requests)
+DrawingContext::clear_drawing_requests(DrawingRequests& requests_)
{
- for(auto& request : requests)
+ for(auto& request : requests_)
{
if (request->request_data)
{
}
request->~DrawingRequest();
}
- requests.clear();
+ requests_.clear();
}
void
};
void
-DrawingContext::handle_drawing_requests(DrawingRequests& requests)
+DrawingContext::handle_drawing_requests(DrawingRequests& requests_)
{
- std::stable_sort(requests.begin(), requests.end(), RequestPtrCompare());
+ std::stable_sort(requests_.begin(), requests_.end(), RequestPtrCompare());
DrawingRequests::const_iterator i;
- for(i = requests.begin(); i != requests.end(); ++i) {
+ for(i = requests_.begin(); i != requests_.end(); ++i) {
const DrawingRequest& request = **i;
switch(request.target) {
}
void
-DrawingContext::set_target(Target target)
+DrawingContext::set_target(Target target_)
{
- this->target = target;
- if(target == LIGHTMAP) {
+ this->target = target_;
+ if(target_ == LIGHTMAP) {
requests = &lightmap_requests;
} else {
- assert(target == NORMAL);
+ assert(target_ == NORMAL);
requests = &drawing_requests;
}
}
// scan for prefix-filename in addons search path
char **rc = PHYSFS_enumerateFiles(fontdir.c_str());
for (char **i = rc; *i != NULL; i++) {
- std::string filename(*i);
- if( filename.rfind(fontname) != std::string::npos ) {
- loadFontFile(fontdir + filename);
+ std::string filename_(*i);
+ if( filename_.rfind(fontname) != std::string::npos ) {
+ loadFontFile(fontdir + filename_);
}
}
PHYSFS_freeList(rc);
const std::string &glyphimage,
const std::string &shadowimage,
const std::vector<std::string> &chars,
- GlyphWidth glyph_width,
+ GlyphWidth glyph_width_,
int char_width
)
{
SDL_Surface *surface = NULL;
- if( glyph_width == VARIABLE ) {
+ if( glyph_width_ == VARIABLE ) {
//this does not work:
// surface = ((SDL::Texture *)glyph_surface.get_texture())->get_texture();
surface = IMG_Load_RW(get_physfs_SDLRWops("images/engine/fonts/"+glyphimage), 1);
Glyph glyph;
glyph.surface_idx = surface_idx;
- if( glyph_width == FIXED )
+ if( glyph_width_ == FIXED )
{
glyph.rect = Rectf(x, y, x + char_width, y + char_height);
glyph.offset = Vector(0, 0);
namespace worldmap {
-LevelTile::LevelTile(const std::string& basedir, const Reader& lisp) :
+LevelTile::LevelTile(const std::string& basedir_, const Reader& lisp) :
pos(),
title(),
solved(false),
statistics(),
target_time(),
extro_script(),
- basedir(basedir),
+ basedir(basedir_),
picture_cached(false),
picture(0)
{
lisp.get("extro-script", extro_script);
- if (!PHYSFS_exists((basedir + name).c_str()))
+ if (!PHYSFS_exists((basedir_ + name).c_str()))
{
log_warning << "level file '" << name
<< "' does not exist and will not be added to the worldmap" << std::endl;
void
Tux::updateInputDirection()
{
- Controller* controller = g_input_manager->get_controller();
- if(controller->hold(Controller::UP))
+ Controller* controller_ = g_input_manager->get_controller();
+ if(controller_->hold(Controller::UP))
input_direction = D_NORTH;
- else if(controller->hold(Controller::DOWN))
+ else if(controller_->hold(Controller::DOWN))
input_direction = D_SOUTH;
- else if(controller->hold(Controller::LEFT))
+ else if(controller_->hold(Controller::LEFT))
input_direction = D_WEST;
- else if(controller->hold(Controller::RIGHT))
+ else if(controller_->hold(Controller::RIGHT))
input_direction = D_EAST;
}
WorldMap* WorldMap::current_ = NULL;
-WorldMap::WorldMap(const std::string& filename, Savegame& savegame, const std::string& force_spawnpoint) :
+WorldMap::WorldMap(const std::string& filename, Savegame& savegame, const std::string& force_spawnpoint_) :
tux(),
m_savegame(savegame),
tileset(NULL),
worldmap_table(),
scripts(),
ambient_light( 1.0f, 1.0f, 1.0f, 1.0f ),
- force_spawnpoint(force_spawnpoint),
+ force_spawnpoint(force_spawnpoint_),
in_level(false),
pan_pos(),
panning(false),
}
void
-WorldMap::change(const std::string& filename, const std::string& force_spawnpoint)
+WorldMap::change(const std::string& filename, const std::string& force_spawnpoint_)
{
g_screen_manager->pop_screen();
- g_screen_manager->push_screen(std::unique_ptr<Screen>(new WorldMap(filename, m_savegame, force_spawnpoint)));
+ g_screen_manager->push_screen(std::unique_ptr<Screen>(new WorldMap(filename, m_savegame, force_spawnpoint_)));
}
void
lisp::Parser parser;
const lisp::Lisp* root = parser.parse(map_filename);
- const lisp::Lisp* level = root->get_lisp("supertux-level");
- if(level == NULL)
+ const lisp::Lisp* level_ = root->get_lisp("supertux-level");
+ if(level_ == NULL)
throw std::runtime_error("file isn't a supertux-level file.");
- level->get("name", name);
+ level_->get("name", name);
- const lisp::Lisp* sector = level->get_lisp("sector");
+ const lisp::Lisp* sector = level_->get_lisp("sector");
if(!sector)
throw std::runtime_error("No sector specified in worldmap file.");
- const lisp::Lisp* tilesets_lisp = level->get_lisp("tilesets");
+ const lisp::Lisp* tilesets_lisp = level_->get_lisp("tilesets");
if(tilesets_lisp != NULL) {
tileset = tile_manager->parse_tileset_definition(*tilesets_lisp).release();
free_tileset = true;
}
std::string tileset_name;
- if(level->get("tileset", tileset_name)) {
+ if(level_->get("tileset", tileset_name)) {
if(tileset != NULL) {
- log_warning << "multiple tilesets specified in level" << std::endl;
+ log_warning << "multiple tilesets specified in level_" << std::endl;
} else {
tileset = tile_manager->get_tileset(tileset_name);
}
Vector
WorldMap::get_camera_pos_for_tux() {
- Vector camera_offset;
+ Vector camera_offset_;
Vector tux_pos = tux->get_pos();
- camera_offset.x = tux_pos.x - SCREEN_WIDTH/2;
- camera_offset.y = tux_pos.y - SCREEN_HEIGHT/2;
- return camera_offset;
+ camera_offset_.x = tux_pos.x - SCREEN_WIDTH/2;
+ camera_offset_.y = tux_pos.y - SCREEN_HEIGHT/2;
+ return camera_offset_;
}
void
if(!panning) {
camera_offset = get_camera_pos_for_tux();
} else {
- Vector delta = pan_pos - camera_offset;
- float mag = delta.norm();
+ Vector delta__ = pan_pos - camera_offset;
+ float mag = delta__.norm();
if(mag > CAMERA_PAN_SPEED) {
- delta *= CAMERA_PAN_SPEED/mag;
+ delta__ *= CAMERA_PAN_SPEED/mag;
}
- camera_offset += delta;
+ camera_offset += delta__;
if(camera_offset == pan_pos) {
panning = false;
}
if (enter_level && !tux->is_moving())
{
/* Check level action */
- LevelTile* level = at_level();
- if (!level) {
+ LevelTile* level_ = at_level();
+ if (!level_) {
//Respawn if player on a tile with no level and nowhere to go.
int tile_data = tile_data_at(tux->get_tile_pos());
if(!( tile_data & ( Tile::WORLDMAP_NORTH | Tile::WORLDMAP_SOUTH | Tile::WORLDMAP_WEST | Tile::WORLDMAP_EAST ))){
return;
}
- if (level->pos == tux->get_tile_pos()) {
+ if (level_->pos == tux->get_tile_pos()) {
try {
- Vector shrinkpos = Vector(level->pos.x*32 + 16 - camera_offset.x,
- level->pos.y*32 + 8 - camera_offset.y);
- std::string levelfile = levels_path + level->get_name();
+ Vector shrinkpos = Vector(level_->pos.x*32 + 16 - camera_offset.x,
+ level_->pos.y*32 + 8 - camera_offset.y);
+ std::string levelfile = levels_path + level_->get_name();
// update state and savegame
save_state();
- g_screen_manager->push_screen(std::unique_ptr<Screen>(new GameSession(levelfile, m_savegame, &level->statistics)),
+ g_screen_manager->push_screen(std::unique_ptr<Screen>(new GameSession(levelfile, m_savegame, &level_->statistics)),
std::unique_ptr<ScreenFade>(new ShrinkFade(shrinkpos, 1.0f)));
in_level = true;
} catch(std::exception& e) {