Skip to content

Commit a23450a

Browse files
committed
Get rid of some pointless getter/setters.
1 parent b1495ba commit a23450a

16 files changed

+146
-427
lines changed

draw.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ void Renderer::drawSprite(float x, float y, float z, float rotation, SpriteSheet
700700

701701
void Renderer::drawFieldOfView(Scene* scene, FieldOfView* fov, GLuint program)
702702
{
703-
if (!fov->isActive())
703+
if (!fov->_active)
704704
{
705705
return;
706706
}
@@ -884,7 +884,7 @@ void Renderer::drawEntities(Scene* scene)
884884
vol.x -= scene->getCamera().x;
885885
vol.y -= scene->getCamera().y;
886886

887-
if (ent->isHighlighted())
887+
if (ent->_highlighted)
888888
{
889889
drawRect2(vol, 1, 1, 1, 1);
890890
}
@@ -954,7 +954,7 @@ void Renderer::drawEntities(Scene* scene)
954954

955955
for (i = 0; i < map->getNumberOfShafts(); i++)
956956
{
957-
if (map->getShaftAt(i)->isMoving())
957+
if (map->getShaftAt(i)->_moving)
958958
{
959959
vol = map->getShaftAt(i)->getRect();
960960
vol.x -= scene->getCamera().x;
@@ -988,7 +988,7 @@ void Renderer::drawEntities(Scene* scene)
988988
vol = particle->getCollisionRect();
989989
vol.x -= scene->getCamera().x;
990990
vol.y -= scene->getCamera().y;
991-
if (particle->isAlive())
991+
if (particle->_alive)
992992
{
993993
drawSprite( position.x - cam.x,
994994
position.y - cam.y,
@@ -1435,7 +1435,7 @@ void Renderer::drawScene(Scene* scene)
14351435
drawTileLayer(scene, 0);
14361436
if (!scene->inCrosslinkMode())
14371437
{
1438-
if ((!player->isInElevator() || !player->getElevatorDoor()->getShaft()->isMoving()) && !player->isPinning())
1438+
if ((!player->isInElevator() || !player->getElevatorDoor()->_shaft->_moving) && !player->isPinning())
14391439
{
14401440
glBindTexture(GL_TEXTURE_2D, player->getDirection() == Right ? resPlayer->getTexId() : resPlayerLeft->getTexId());
14411441
drawSprite( scene->getPlayerPosition().x - cam.x,
@@ -1451,7 +1451,7 @@ void Renderer::drawScene(Scene* scene)
14511451
drawSprite( scene->getPlayerPosition().x - cam.x,
14521452
scene->getPlayerPosition().y - cam.y - 4,
14531453
2.8f,
1454-
player->getArmRotation(),
1454+
player->_armRotation,
14551455
player->getDirection() == Right ? resPlayer : resPlayerLeft,
14561456
spr,
14571457
SDM_Normal, 0, 0, 0);
@@ -1486,7 +1486,7 @@ void Renderer::drawScene(Scene* scene)
14861486
if (scene->inCrosslinkMode())
14871487
{
14881488
//if in crosslink mode, draw black sprites of enemies and player last so that color is not affected by lights.
1489-
if ((!player->isInElevator() || !player->getElevatorDoor()->getShaft()->isMoving()) && !player->isPinning())
1489+
if ((!player->isInElevator() || !player->getElevatorDoor()->_shaft->_moving) && !player->isPinning())
14901490
{
14911491
drawSpriteBind( scene->getPlayerPosition().x - cam.x,
14921492
scene->getPlayerPosition().y - cam.y,
@@ -1497,7 +1497,7 @@ void Renderer::drawScene(Scene* scene)
14971497
SDM_LinkableCross, 0, 0, 0);
14981498
}
14991499
drawEnemies(scene, true);
1500-
sprintf(print, "Energy: %i", scene->getPlayerEnergy());
1500+
sprintf(print, "Energy: %i", scene->_playerEnergy);
15011501
drawText(32, 160, print, RGB_WHITE, 1.0f, font1);
15021502
}
15031503

@@ -1533,7 +1533,7 @@ void Renderer::drawScene(Scene* scene)
15331533

15341534
if (scene->hasPlayerFiredShot() || player->isAimingGun())
15351535
{
1536-
sprintf(print, "%i", scene->getTimeToSniper());
1536+
sprintf(print, "%i", (scene->_timeToSniper / 1000));
15371537
if (scene->hasPlayerFiredShot())
15381538
{
15391539
drawText(winX - 64, winY - 32, print, RGB_RED, 1.0f, font1);
@@ -1544,7 +1544,7 @@ void Renderer::drawScene(Scene* scene)
15441544
}
15451545
if (player->isAimingGun())
15461546
{
1547-
sprintf(print, "Ammo: %i", scene->getNumPlayerBullets());
1547+
sprintf(print, "Ammo: %i", scene->_numPlayerBullets);
15481548
drawText(32, 128, print, RGB_WHITE, 1.0f, font1);
15491549
}
15501550
}
@@ -1590,14 +1590,14 @@ void Renderer::drawDebugSceneText(Scene* scene)
15901590
py = scene->getPlayerPosition().y;
15911591
drawText(px - scene->getCamera().x, py - scene->getCamera().y, print, RGB_WHITE, 1.0f, font1);
15921592
drawText(32, 32, (char*)"On Ground: ", RGB_WHITE, 1.0f, font1);
1593-
if (scene->getPlayer()->isOnGround())
1593+
if (scene->getPlayer()->_onGround)
15941594
drawText(192, 32, (char*)"Yes", 0.0f, 1.0f, 0.0f, 1.0f, font1);
15951595
else
15961596
drawText(192, 32, (char*)"No", RGB_RED, 1.0f, font1);
15971597

15981598
sprintf(print, "Attach Type: %i", scene->getPlayer()->getAttachType());
15991599
drawText(32, 64, print, RGB_WHITE, 1.0f, font1);
1600-
sprintf(print, "Light: %i", scene->getPlayer()->getLightVisibility());
1600+
sprintf(print, "Light: %i", scene->getPlayer()->_lightVisibility);
16011601
drawText(32, 96, print, RGB_WHITE, 1.0f, font1);
16021602
}
16031603

elevators.cpp

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,6 @@ bool ElevatorDoor::isOpen()
7070
return _open;
7171
}
7272

73-
void ElevatorDoor::registerShaft(ElevatorShaft* shaft)
74-
{
75-
_shaft = shaft;
76-
}
77-
78-
void ElevatorDoor::registerSwitch(ElevatorSwitch* eSwitch)
79-
{
80-
_switch = eSwitch;
81-
}
82-
83-
ElevatorShaft* ElevatorDoor::getShaft()
84-
{
85-
return _shaft;
86-
}
87-
8873
void ElevatorDoor::update(unsigned int dT)
8974
{
9075
Entity::update(dT);
@@ -109,11 +94,6 @@ bool ElevatorDoor::isClosing()
10994
return _activeSequence == Locator::getAnimationManager()->getSequence(ANIM_ELEVATOR_CLOSE);
11095
}
11196

112-
ElevatorSwitch* ElevatorDoor::getSwitch()
113-
{
114-
return _switch;
115-
}
116-
11797
ElevatorShaft::ElevatorShaft(int x)
11898
{
11999
_moving = false;
@@ -179,17 +159,12 @@ void ElevatorShaft::update()
179159
_yVel /= fabs(_yVel);
180160
_yVel *= 0.1f;
181161
setAccel(&_acceleration, true, _yVel < 0.0f ? -0.01f : 0.01f, _yVel < 0.0f ? -1.5f : 1.5f);
182-
setMoving(true);
162+
_moving = true;
183163
_waitingForClose = false;
184164
Locator::getAudio()->playSound("elevator_leave");
185165
}
186166
}
187167

188-
int ElevatorShaft::getX()
189-
{
190-
return _x;
191-
}
192-
193168
void ElevatorShaft::setOpenDoor(ElevatorDoor* door, bool animate)
194169
{
195170
int index = containsDoor(door);
@@ -232,19 +207,14 @@ void ElevatorShaft::setTarget(ElevatorDoor* target)
232207
_openDoor->close(true);
233208
_waitingForClose = true;
234209
_target = target;
235-
_target->getSwitch()->changeSprite(Locator::getSpriteManager()->getIndex("./data/sprites/linkable.sprites", "elev_switch_wait"));
210+
_target->_switch->changeSprite(Locator::getSpriteManager()->getIndex("./data/sprites/linkable.sprites", "elev_switch_wait"));
236211
}
237212

238213
void ElevatorShaft::addDoor(ElevatorDoor* ed)
239214
{
240215
_doors.push_back(ed);
241216
}
242217

243-
bool ElevatorShaft::isMoving()
244-
{
245-
return _moving;
246-
}
247-
248218
int ElevatorShaft::containsDoor(ElevatorDoor* door)
249219
{
250220
unsigned int i;
@@ -258,11 +228,6 @@ int ElevatorShaft::containsDoor(ElevatorDoor* door)
258228
return -1;
259229
}
260230

261-
void ElevatorShaft::setMoving(bool b)
262-
{
263-
_moving = b;
264-
}
265-
266231
ElevatorDoor* ElevatorShaft::getOpenDoor()
267232
{
268233
return _openDoor;
@@ -339,9 +304,4 @@ int ElevatorShaft::getDoorIndexOrdered(int index)
339304
}
340305
}
341306
return -1;
342-
}
343-
344-
float ElevatorShaft::getVelocity()
345-
{
346-
return _yVel;
347307
}

enemy.cpp

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ void Enemy::update(unsigned int dT)
207207
{
208208
_targetSwitch->activate(NULL);
209209
_numSwitchAttempts++;
210-
if ((_lightToActivate != NULL && _lightToActivate->isActive()) || _numSwitchAttempts == 3) //activate the light, or give up.
210+
if ((_lightToActivate != NULL && _lightToActivate->_active) || _numSwitchAttempts == 3) //activate the light, or give up.
211211
{
212212
_targetSwitch = NULL;
213213
_targetType = TARGET_NONE;
@@ -621,7 +621,7 @@ void Enemy::setStrongestLight(FieldOfView* light)
621621
changeState(PATROLLING);
622622
}
623623

624-
if ((light == _lightToActivate && light != NULL) || (light != NULL && _lightToActivate != NULL && light->getLightFixture() == _lightToActivate->getLightFixture()))
624+
if ((light == _lightToActivate && light != NULL) || (light != NULL && _lightToActivate != NULL && light->_fixture == _lightToActivate->_fixture))
625625
{
626626
//Nothing to activate, since it's now on.
627627
_lightToActivate = NULL;
@@ -778,16 +778,6 @@ void Enemy::_fireWeapon(GunShotTraceType gstt)
778778
setResolve(1, gstt);
779779
}
780780

781-
void Enemy::setGun(EnemyGun* gun)
782-
{
783-
_gun = gun;
784-
}
785-
786-
EnemyGun* Enemy::getGun()
787-
{
788-
return _gun;
789-
}
790-
791781
void Enemy::setResolve(int timeToReact, GunShotTraceType gstt)
792782
{
793783
_resolve.timeSinceShot = timeToReact;

entity.cpp

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -209,16 +209,6 @@ void Entity::changeAnimationSequence(AnimationSequence* sequence)
209209
}
210210
}
211211

212-
bool Entity::isHighlighted()
213-
{
214-
return _highlighted;
215-
}
216-
217-
void Entity::setHighlighted(bool b)
218-
{
219-
_highlighted = b;
220-
}
221-
222212
Particle::Particle(float x, float y, unsigned int sprite) : Entity(x, y, sprite)
223213
{
224214
setCollisionRectDims(8, 8, 8);
@@ -232,27 +222,13 @@ void Particle::update(unsigned int dT)
232222
updateCollisionRectPosition();
233223
}
234224

235-
bool Particle::isAlive()
236-
{
237-
return _alive;
238-
}
239-
void Particle::setAlive(bool b)
240-
{
241-
_alive = b;
242-
}
243-
244225
TutorialMark::TutorialMark(float x, float y, StringMessage ts) : Entity(x, y)
245226
{
246227
setCollisionRectDims(32, 48, ENTDIM);
247228
_ts = ts;
248229
_sprite = Locator::getSpriteManager()->getIndex("./data/sprites/objects.sprites", "tutorial");
249230
}
250231

251-
StringMessage TutorialMark::getTutorialString()
252-
{
253-
return _ts;
254-
}
255-
256232
MainComputer::MainComputer(float x, float y, bool active) : Entity(x, y)
257233
{
258234
setCollisionRectDims(64, 32, ENTDIM);

0 commit comments

Comments
 (0)