Skip to content

Commit

Permalink
CGE2: USe an int for sex instead of a boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke committed Jun 3, 2014
1 parent 46d93eb commit 7ef5096
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion engines/cge2/cge2.cpp
Expand Up @@ -77,7 +77,7 @@ CGE2Engine::CGE2Engine(OSystem *syst, const ADGameDescription *gameDescription)
_music = true;
_startupMode = 1;
_now = 1;
_sex = true;
_sex = 1;
_mouseTop = kWorldHeight / 3;
_dark = false;
_lastFrame = 0;
Expand Down
4 changes: 2 additions & 2 deletions engines/cge2/cge2.h
Expand Up @@ -140,7 +140,7 @@ class CGE2Engine : public Engine {
void qGame();
void loadPos();
void releasePocket(Sprite *spr);
void switchHero(bool sex);
void switchHero(int sex);
void optionTouch(int opt, uint16 mask);
void offUse();

Expand Down Expand Up @@ -205,7 +205,7 @@ class CGE2Engine : public Engine {
bool _music;
int _startupMode;
int _now;
bool _sex;
int _sex;
int _mouseTop;
bool _dark;
int _waitSeq;
Expand Down
14 changes: 7 additions & 7 deletions engines/cge2/cge2_main.cpp
Expand Up @@ -573,7 +573,7 @@ void CGE2Engine::loadGame() {
Sprite *s;
Hero *h;

// initialize Andzia
// initialize Andzia/Anna
s = _spare->take(142);
if (s) {
h = new Hero(this);
Expand All @@ -587,7 +587,7 @@ void CGE2Engine::loadGame() {
_vga->_showQ->insert(s);
_heroTab[0]->_face = s;

// initialize Wacek
// initialize Wacek/Vincent
s = _spare->take(141);
if (s) {
h = new Hero(this);
Expand Down Expand Up @@ -795,7 +795,7 @@ void CGE2Engine::killText() {
_talk = NULL;
}

void CGE2Engine::switchHero(bool sex) {
void CGE2Engine::switchHero(int sex) {
if (sex != _sex) {
int scene = _heroTab[sex]->_ptr->_scene;
if (_blinkSprite) {
Expand All @@ -804,7 +804,7 @@ void CGE2Engine::switchHero(bool sex) {
}
if (scene >= 0) {
_commandHandler->addCommand(kCmdSeq, -1, 2, _heroTab[_sex]->_face);
_sex = !_sex;
_sex ^= 1;
switchCave(scene);
}
}
Expand Down Expand Up @@ -843,10 +843,10 @@ void Sprite::touch(uint16 mask, int x, int y, Common::KeyCode keyCode) {
}

if (_vm->isHero(this) && !_vm->_blinkSprite) {
_vm->switchHero(this == _vm->_heroTab[1]->_ptr);
_vm->switchHero((this == _vm->_heroTab[1]->_ptr) ? 1 : 0);
} else if (_flags._kept) { // sprite in pocket
for (int sex = 0; sex < 2; sex++) {
for (int p = 0; p < kPocketMax; p++) {
for (int sex = 0; sex < 2; ++sex) {
for (int p = 0; p < kPocketMax; ++p) {
if (_vm->_heroTab[sex]->_pocket[p] == this) {
_vm->switchHero(sex);
if (_vm->_sex == sex) {
Expand Down

0 comments on commit 7ef5096

Please sign in to comment.