diff options
-rw-r--r-- | engines/teenagent/actor.cpp | 4 | ||||
-rw-r--r-- | engines/teenagent/animation.h | 2 | ||||
-rw-r--r-- | engines/teenagent/callbacks.cpp | 22 | ||||
-rw-r--r-- | engines/teenagent/console.cpp | 8 | ||||
-rw-r--r-- | engines/teenagent/detection.cpp | 2 | ||||
-rw-r--r-- | engines/teenagent/inventory.cpp | 6 | ||||
-rw-r--r-- | engines/teenagent/music.cpp | 2 | ||||
-rw-r--r-- | engines/teenagent/objects.cpp | 26 | ||||
-rw-r--r-- | engines/teenagent/objects.h | 14 | ||||
-rw-r--r-- | engines/teenagent/pack.cpp | 2 | ||||
-rw-r--r-- | engines/teenagent/pack.h | 9 | ||||
-rw-r--r-- | engines/teenagent/scene.cpp | 241 | ||||
-rw-r--r-- | engines/teenagent/scene.h | 80 | ||||
-rw-r--r-- | engines/teenagent/surface.cpp | 6 | ||||
-rw-r--r-- | engines/teenagent/surface.h | 4 | ||||
-rw-r--r-- | engines/teenagent/surface_list.cpp | 4 | ||||
-rw-r--r-- | engines/teenagent/surface_list.h | 6 | ||||
-rw-r--r-- | engines/teenagent/teenagent.cpp | 73 | ||||
-rw-r--r-- | engines/teenagent/teenagent.h | 2 |
19 files changed, 257 insertions, 256 deletions
diff --git a/engines/teenagent/actor.cpp b/engines/teenagent/actor.cpp index 717c022c38..cb8c798fb6 100644 --- a/engines/teenagent/actor.cpp +++ b/engines/teenagent/actor.cpp @@ -37,7 +37,7 @@ Common::Rect Actor::renderIdle(Graphics::Surface *surface, const Common::Point & debug(0, "switched to idle animation %u", idle_type); } - Resources * res = Resources::instance(); + Resources *res = Resources::instance(); byte *frames_idle; do { frames_idle = res->dseg.ptr(res->dseg.get_word(0x6540 + idle_type * 2)) + index; @@ -47,7 +47,7 @@ Common::Rect Actor::renderIdle(Graphics::Surface *surface, const Common::Point & debug(0, "switched to idle animation %u[loop]", idle_type); index = 3; //put 4th frame (base 1) if idle animation loops } - } while(*frames_idle == 0); + } while (*frames_idle == 0); bool mirror = orientation == kActorLeft; Surface *s = frames + *frames_idle - 1; diff --git a/engines/teenagent/animation.h b/engines/teenagent/animation.h index d9092d1707..6942cc74eb 100644 --- a/engines/teenagent/animation.h +++ b/engines/teenagent/animation.h @@ -35,7 +35,7 @@ public: enum Type {kTypeLan, kTypeVaria, kTypeInventory}; Animation(); - void load(Common::SeekableReadStream&, Type type = kTypeLan); + void load(Common::SeekableReadStream &, Type type = kTypeLan); void free(); Surface *firstFrame(); diff --git a/engines/teenagent/callbacks.cpp b/engines/teenagent/callbacks.cpp index ae498478a4..f8bb142bd8 100644 --- a/engines/teenagent/callbacks.cpp +++ b/engines/teenagent/callbacks.cpp @@ -34,7 +34,7 @@ namespace TeenAgent { #define INC_FLAG(addr) (++*res->dseg.ptr(addr)) void TeenAgentEngine::rejectMessage() { - Resources * res = Resources::instance(); + Resources *res = Resources::instance(); //random reject message: uint i = _rnd.getRandomNumber(3); //debug(0, "reject message: %s", (const char *)res->dseg.ptr(res->dseg.get_word(0x339e + 2 * i))); @@ -46,9 +46,9 @@ bool TeenAgentEngine::processCallback(uint16 addr) { if (addr == 0) return false; - Resources * res = Resources::instance(); + Resources *res = Resources::instance(); debug(0, "processCallback(%04x)", addr); - byte * code = res->cseg.ptr(addr); + byte *code = res->cseg.ptr(addr); //try trivial callbacks first if (code[0] == 0xbb && code[3] == 0xe8 && code[6] == 0xc3) { @@ -1355,7 +1355,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { inventory->add(11); disableObject(1); - byte * scene_15_ons = scene->getOns(15); //patch ons for the scene 15 + byte *scene_15_ons = scene->getOns(15); //patch ons for the scene 15 scene_15_ons[0] = 0; byte f = GET_FLAG(0xDB98) + 1; @@ -2501,7 +2501,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { return true; case 0x862c: - displayMessage(CHECK_FLAG(0xDBB0, 1)? 0x4882: 0x3457); + displayMessage(CHECK_FLAG(0xDBB0, 1) ? 0x4882 : 0x3457); return true; case 0x86a9: //correcting height of the pole with spanner @@ -2561,7 +2561,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { setOns(4, 0); { - Walkbox * w = scene->getWalkbox(0); + Walkbox *w = scene->getWalkbox(0); w->rect.clear(); w->save(); } @@ -2747,21 +2747,21 @@ bool TeenAgentEngine::processCallback(uint16 addr) { inventory->remove(36); SET_FLAG(0xDBAD, 1); { - Object * o = scene->getObject(7); + Object *o = scene->getObject(7); o->actor_rect.left = o->actor_rect.right = 297; o->actor_rect.top = o->actor_rect.bottom = 181; o->actor_orientation = 1; o->save(); } { - Object * o = scene->getObject(9); + Object *o = scene->getObject(9); o->actor_rect.left = o->actor_rect.right = 297; o->actor_rect.top = o->actor_rect.bottom = 181; o->actor_orientation = 1; o->save(); } { - Walkbox * w = scene->getWalkbox(0); + Walkbox *w = scene->getWalkbox(0); w->rect.right = 266; w->rect.bottom = 193; w->save(); @@ -3904,7 +3904,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { SET_FLAG(0, 0); processCallback(0x9a7a); INC_FLAG(0xDBA6); - switch(GET_FLAG(0xDBA6)) { + switch (GET_FLAG(0xDBA6)) { case 1: displayMessage(0x39ae); break; @@ -4014,7 +4014,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { moveTo(186, 198, 2, true); moveTo(220, 198, 4); { - Walkbox * w = scene->getWalkbox(0); + Walkbox *w = scene->getWalkbox(0); w->rect.left = 0; w->rect.bottom = 199; w->save(); diff --git a/engines/teenagent/console.cpp b/engines/teenagent/console.cpp index 2f4d7cc9c3..5164b44729 100644 --- a/engines/teenagent/console.cpp +++ b/engines/teenagent/console.cpp @@ -25,10 +25,10 @@ namespace TeenAgent { Console::Console(TeenAgentEngine *engine) : _engine(engine) { - DCmd_Register("enable_object", WRAP_METHOD(Console, enableObject)); - DCmd_Register("disable_object", WRAP_METHOD(Console, enableObject)); - DCmd_Register("set_ons", WRAP_METHOD(Console, setOns)); - DCmd_Register("set_music", WRAP_METHOD(Console, setMusic)); + DCmd_Register("enable_object", WRAP_METHOD(Console, enableObject)); + DCmd_Register("disable_object", WRAP_METHOD(Console, enableObject)); + DCmd_Register("set_ons", WRAP_METHOD(Console, setOns)); + DCmd_Register("set_music", WRAP_METHOD(Console, setMusic)); } bool Console::enableObject(int argc, const char **argv) { diff --git a/engines/teenagent/detection.cpp b/engines/teenagent/detection.cpp index fa5a578636..5db1919823 100644 --- a/engines/teenagent/detection.cpp +++ b/engines/teenagent/detection.cpp @@ -80,7 +80,7 @@ static const ADGameDescription teenAgentGameDescriptions[] = { }; enum { - MAX_SAVES = 20 + MAX_SAVES = 20 }; class TeenAgentMetaEngine : public AdvancedMetaEngine { diff --git a/engines/teenagent/inventory.cpp b/engines/teenagent/inventory.cpp index 2b858bbb4d..59dd44baa3 100644 --- a/engines/teenagent/inventory.cpp +++ b/engines/teenagent/inventory.cpp @@ -286,10 +286,10 @@ void Inventory::Item::free() { void Inventory::Item::backgroundEffect(Graphics::Surface *s) { uint w = _rect.right - _rect.left, h = _rect.bottom - _rect.top; byte *line = (byte *)s->getBasePtr(_rect.left, _rect.top); - for(uint y = 0; y < h; ++y, line += s->pitch) { + for (uint y = 0; y < h; ++y, line += s->pitch) { byte *dst = line; - for(uint x = 0; x < w; ++x, ++dst) { - *dst = (*dst == 232)? 214: 224; + for (uint x = 0; x < w; ++x, ++dst) { + *dst = (*dst == 232) ? 214 : 224; } } } diff --git a/engines/teenagent/music.cpp b/engines/teenagent/music.cpp index 0f70f4b082..6cc2fd8d6b 100644 --- a/engines/teenagent/music.cpp +++ b/engines/teenagent/music.cpp @@ -137,7 +137,7 @@ void MusicPlayer::interrupt() { continue; } - setChannelData(chn, (const int8*)_samples[sample].data, NULL, _samples[sample].size, 0); + setChannelData(chn, (const int8 *)_samples[sample].data, NULL, _samples[sample].size, 0); setChannelPeriod(chn, noteToPeriod[((note >> 4) & 0x0F) - 1][(note & 0x0F)]); } } diff --git a/engines/teenagent/objects.cpp b/engines/teenagent/objects.cpp index 74e3a4944d..748f342d54 100644 --- a/engines/teenagent/objects.cpp +++ b/engines/teenagent/objects.cpp @@ -26,7 +26,7 @@ namespace TeenAgent { -void Rect::load(byte * src) { +void Rect::load(byte *src) { _base = src; Common::MemoryReadStream ins(src, 8); left = ins.readUint16LE(); @@ -52,7 +52,7 @@ void Rect::render(Graphics::Surface *surface, uint8 color) const { } -void Object::load(byte * src) { +void Object::load(byte *src) { _base = src; id = *src++; @@ -85,10 +85,10 @@ void Object::setName(const Common::String &new_name) { void Object::dump(int level) const { debug(level, "object: %u %u [%u,%u,%u,%u], actor: [%u,%u,%u,%u], orientation: %u, name: %s", id, enabled, - rect.left, rect.top, rect.right, rect.bottom, - actor_rect.left, actor_rect.top, actor_rect.right, actor_rect.bottom, - actor_orientation, name.c_str() - ); + rect.left, rect.top, rect.right, rect.bottom, + actor_rect.left, actor_rect.top, actor_rect.right, actor_rect.bottom, + actor_orientation, name.c_str() + ); } Common::String Object::parse_description(const char *name) { @@ -139,16 +139,16 @@ void UseHotspot::load(byte *src) { void UseHotspot::dump(int level) const { debug(level, - "hotspot: inv_id: %02x, obj_id: %02x, orientation?: %02x, actor position: (%d,%d), callback: %04x", - inventory_id, object_id, orientation, actor_x, actor_y, callback - ); + "hotspot: inv_id: %02x, obj_id: %02x, orientation?: %02x, actor position: (%d,%d), callback: %04x", + inventory_id, object_id, orientation, actor_x, actor_y, callback + ); } void Walkbox::dump(int level) const { debug(level, "walkbox %02x %02x [%d, %d, %d, %d] top: %u, right: %u, bottom: %u, left: %u", - type, orientation, - rect.left, rect.top, rect.right, rect.bottom, - side_hint[0], side_hint[1], side_hint[2], side_hint[3]); + type, orientation, + rect.left, rect.top, rect.right, rect.bottom, + side_hint[0], side_hint[1], side_hint[2], side_hint[3]); } void Walkbox::load(byte *src) { @@ -158,7 +158,7 @@ void Walkbox::load(byte *src) { orientation = *src++; rect.load(src); src += 8; - for(byte i = 0; i < 4; ++i) + for (byte i = 0; i < 4; ++i) side_hint[i] = *src++; } diff --git a/engines/teenagent/objects.h b/engines/teenagent/objects.h index d1e4388a15..555287fc56 100644 --- a/engines/teenagent/objects.h +++ b/engines/teenagent/objects.h @@ -74,7 +74,7 @@ struct Rect { return x >= left && x <= right && y1 <= bottom && y2 >= top; } - inline bool contains(const Rect & rect) const { + inline bool contains(const Rect &rect) const { return rect.left >= left && rect.right <= right && rect.top >= top && rect.bottom <= bottom; } @@ -120,7 +120,7 @@ struct Rect { } void side(Common::Point &p1, Common::Point &p2, int o, const Common::Point &nearest) const { - switch(o) { + switch (o) { case kActorLeft: p1 = Common::Point(left, top); p2 = Common::Point(left, bottom); @@ -150,7 +150,7 @@ struct Rect { } protected: - byte * _base; + byte *_base; }; struct Object { @@ -172,7 +172,7 @@ struct Object { static Common::String parse_description(const char *name); protected: - byte * _base; + byte *_base; }; struct InventoryObject { @@ -184,7 +184,7 @@ struct InventoryObject { void load(byte *addr); protected: - byte * _base; + byte *_base; }; struct UseHotspot { @@ -209,7 +209,7 @@ struct Walkbox { void save() const; protected: - byte * _base; + byte *_base; }; struct FadeType { @@ -220,7 +220,7 @@ struct FadeType { }; //\todo move it to util.h? -template<typename T> inline T SIGN (T x) { return (x > 0)? 1: ((x < 0)? -1: 0); } +template<typename T> inline T SIGN(T x) { return (x > 0) ? 1 : ((x < 0) ? -1 : 0); } } // End of namespace TeenAgent diff --git a/engines/teenagent/pack.cpp b/engines/teenagent/pack.cpp index aada922f7d..5302e2eceb 100644 --- a/engines/teenagent/pack.cpp +++ b/engines/teenagent/pack.cpp @@ -179,7 +179,7 @@ bool MemoryPack::open(const Common::String &filename) { uint32 MemoryPack::getSize(uint32 id) const { --id; - return id < chunks.size()? chunks[id].size: 0; + return id < chunks.size() ? chunks[id].size : 0; } uint32 MemoryPack::read(uint32 id, byte *dst, uint32 size) const { diff --git a/engines/teenagent/pack.h b/engines/teenagent/pack.h index 09168676e2..1d6c471554 100644 --- a/engines/teenagent/pack.h +++ b/engines/teenagent/pack.h @@ -85,8 +85,13 @@ class MemoryPack : public Pack { byte *data; uint32 size; inline Chunk(): data(0), size(0) {} - inline Chunk(const Chunk &c): data(c.data), size(c.size) { c.reset(); } - inline Chunk& operator=(const Chunk &c) { data = c.data; size = c.size; c.reset(); return *this; } + inline Chunk(const Chunk &c) : data(c.data), size(c.size) { c.reset(); } + inline Chunk &operator=(const Chunk &c) { + data = c.data; + size = c.size; + c.reset(); + return *this; + } inline ~Chunk() { delete[] data; } inline void reset() const { Chunk *c = const_cast<Chunk *>(this); diff --git a/engines/teenagent/scene.cpp b/engines/teenagent/scene.cpp index 39b77ea447..e8c2dec4fa 100644 --- a/engines/teenagent/scene.cpp +++ b/engines/teenagent/scene.cpp @@ -38,9 +38,9 @@ namespace TeenAgent { Scene::Scene(TeenAgentEngine *engine, OSystem *system) : intro(false), _id(0), ons(0), - orientation(kActorRight), actor_talking(false), - message_timer(0), message_first_frame(0), message_last_frame(0), message_animation(NULL), - current_event(SceneEvent::kNone), hide_actor(false), callback(0), callback_timer(0), _idle_timer(0) { + orientation(kActorRight), actor_talking(false), + message_timer(0), message_first_frame(0), message_last_frame(0), message_animation(NULL), + current_event(SceneEvent::kNone), hide_actor(false), callback(0), callback_timer(0), _idle_timer(0) { _engine = engine; _system = system; @@ -100,13 +100,13 @@ bool Scene::findPath(Scene::Path &p, const Common::Point &src, const Common::Poi p.push_back(dst); Common::List<uint> boxes; - for(uint i = 0; i < scene_walkboxes.size(); ++i) { - const Walkbox & w = scene_walkboxes[i]; + for (uint i = 0; i < scene_walkboxes.size(); ++i) { + const Walkbox &w = scene_walkboxes[i]; if (!w.rect.in(src) && !w.rect.in(dst)) boxes.push_back(i); } - for(Path::iterator i = p.begin(); i != p.end() && !boxes.empty(); ) { + for (Path::iterator i = p.begin(); i != p.end() && !boxes.empty();) { Path::iterator next = i; ++next; if (next == p.end()) @@ -116,8 +116,8 @@ bool Scene::findPath(Scene::Path &p, const Common::Point &src, const Common::Poi debug(1, "%d,%d -> %d,%d", p1.x, p1.y, p2.x, p2.y); Common::List<uint>::iterator wi; - for(wi = boxes.begin(); wi != boxes.end(); ++wi) { - const Walkbox & w = scene_walkboxes[*wi]; + for (wi = boxes.begin(); wi != boxes.end(); ++wi) { + const Walkbox &w = scene_walkboxes[*wi]; int mask = w.rect.intersects_line(p1, p2); if (mask == 0) { continue; @@ -279,7 +279,7 @@ void Scene::loadObjectData() { byte *fade_table = res->dseg.ptr(res->dseg.get_word(0x663e + i * 2)); Common::Array<FadeType> &scene_fades = fades[i]; - while(READ_LE_UINT16(fade_table) != 0xffff) { + while (READ_LE_UINT16(fade_table) != 0xffff) { FadeType fade; fade.load(fade_table); fade_table += 9; @@ -402,14 +402,14 @@ void Scene::init(int id, const Common::Point &pos) { Common::ScopedPtr<Common::SeekableReadStream> stream(res->on.getStream(id)); int sub_hack = 0; if (id == 7) { //something patched in the captains room - switch(res->dseg.get_byte(0xdbe6)) { - case 2: - break; - case 1: - sub_hack = 1; - break; - default: - sub_hack = 2; + switch (res->dseg.get_byte(0xdbe6)) { + case 2: + break; + case 1: + sub_hack = 1; + break; + default: + sub_hack = 2; } } on.load(*stream, SurfaceList::kTypeOn, sub_hack); @@ -428,7 +428,7 @@ void Scene::init(int id, const Common::Point &pos) { } void Scene::playAnimation(byte idx, uint id, bool loop, bool paused, bool ignore) { - debug(0, "playAnimation(%u, %u, loop:%s, paused:%s, ignore:%s)", idx, id, loop?"true":"false", paused?"true":"false", ignore?"true":"false"); + debug(0, "playAnimation(%u, %u, loop:%s, paused:%s, ignore:%s)", idx, id, loop ? "true" : "false", paused ? "true" : "false", ignore ? "true" : "false"); assert(idx < 4); Common::ScopedPtr<Common::SeekableReadStream> s(Resources::instance()->loadLan(id + 1)); if (!s) @@ -441,7 +441,7 @@ void Scene::playAnimation(byte idx, uint id, bool loop, bool paused, bool ignore } void Scene::playActorAnimation(uint id, bool loop, bool ignore) { - debug(0, "playActorAnimation(%u, loop:%s, ignore:%s)", id, loop?"true":"false", ignore?"true":"false"); + debug(0, "playActorAnimation(%u, loop:%s, ignore:%s)", id, loop ? "true" : "false", ignore ? "true" : "false"); Common::ScopedPtr<Common::SeekableReadStream> s(Resources::instance()->loadLan(id + 1)); if (!s) error("playing animation %u failed", id); @@ -452,13 +452,13 @@ void Scene::playActorAnimation(uint id, bool loop, bool ignore) { actor_animation.id = id; } -Animation * Scene::getAnimation(byte slot) { +Animation *Scene::getAnimation(byte slot) { assert(slot < 4); return custom_animation + slot; } byte Scene::peekFlagEvent(uint16 addr) const { - for(EventList::const_iterator i = events.reverse_begin(); i != events.end(); --i) { + for (EventList::const_iterator i = events.reverse_begin(); i != events.end(); --i) { const SceneEvent &e = *i; if (e.type == SceneEvent::kSetFlag && e.callback == addr) return e.color; @@ -497,7 +497,7 @@ bool Scene::processEvent(const Common::Event &event) { return false; case Common::EVENT_KEYDOWN: - switch(event.kbd.keycode) { + switch (event.kbd.keycode) { case Common::KEYCODE_ESCAPE: case Common::KEYCODE_SPACE: { if (intro && event.kbd.keycode == Common::KEYCODE_ESCAPE) { @@ -535,7 +535,7 @@ bool Scene::processEvent(const Common::Event &event) { uint feature = event.kbd.keycode - '1'; if (feature < DebugFeatures::kMax) { debug_features.feature[feature] = !debug_features.feature[feature]; - debug(0, "switched feature %u %s", feature, debug_features.feature[feature] ? "on": "off"); + debug(0, "switched feature %u %s", feature, debug_features.feature[feature] ? "on" : "off"); } } break; @@ -557,10 +557,9 @@ struct ZOrderCmp { int Scene::lookupZoom(uint y) const { Resources *res = Resources::instance(); - for(byte *zoom_table = res->dseg.ptr(res->dseg.get_word(0x70f4 + (_id - 1) * 2)); - zoom_table[0] != 0xff && zoom_table[1] != 0xff; - zoom_table += 2 - ) { + for (byte *zoom_table = res->dseg.ptr(res->dseg.get_word(0x70f4 + (_id - 1) * 2)); + zoom_table[0] != 0xff && zoom_table[1] != 0xff; + zoom_table += 2) { //debug(0, "%d %d->%d", y, zoom_table[0], zoom_table[1]); if (y <= zoom_table[0]) { //debug(0, "%d %d->%d", y, zoom_table[0], zoom_table[1]); @@ -575,9 +574,9 @@ void Scene::paletteEffect(byte step) { Resources *res = Resources::instance(); byte *src = res->dseg.ptr(0x6609); byte *dst = palette + 3 * 0xf2; - for(byte i = 0; i < 0xd; ++i) { - for(byte c = 0; c < 3; ++c, ++src) - *dst++ = *src > step? *src - step: 0; + for (byte i = 0; i < 0xd; ++i) { + for (byte c = 0; c < 3; ++c, ++src) + *dst++ = *src > step ? *src - step : 0; } } @@ -586,7 +585,7 @@ byte Scene::findFade() const { return 0; const Common::Array<FadeType> &scene_fades = fades[_id - 1]; - for(uint i = 0; i < scene_fades.size(); ++i) { + for (uint i = 0; i < scene_fades.size(); ++i) { const FadeType &fade = scene_fades[i]; if (fade.rect.in(position)) { return fade.value; @@ -599,8 +598,8 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 delta) { Resources *res = Resources::instance(); bool busy; bool restart; - uint32 game_delta = tick_game? 1: 0; - uint32 mark_delta = tick_mark? 1: 0; + uint32 game_delta = tick_game ? 1 : 0; + uint32 mark_delta = tick_mark ? 1 : 0; do { restart = false; @@ -616,7 +615,7 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 delta) { } } - switch(current_event.type) { + switch (current_event.type) { case SceneEvent::kCredits: { _system->fillScreen(0); ///\todo: optimize me @@ -729,7 +728,7 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 delta) { Surface *mark = actor_animation.currentFrame(game_delta); int horizon = position.y; - for(z_order_it = z_order.begin(); z_order_it != z_order.end(); ++z_order_it) { + for (z_order_it = z_order.begin(); z_order_it != z_order.end(); ++z_order_it) { Surface *s = *z_order_it; if (s->y + s->h > horizon) break; @@ -770,16 +769,16 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 delta) { if (tick_mark) { int speed_x = zoom / 32; //8 * zoom / 256 - int speed_y = (o == kActorDown || o == kActorUp? 2: 1) * zoom / 256; + int speed_y = (o == kActorDown || o == kActorUp ? 2 : 1) * zoom / 256; if (speed_x == 0) speed_x = 1; if (speed_y == 0) speed_y = 1; - position.y += (ABS(dp.y) < speed_y? dp.y: SIGN(dp.y) * speed_y); - position.x += (o == kActorDown || o == kActorUp)? - (ABS(dp.x) < speed_y? dp.x: SIGN(dp.x) * speed_y): - (ABS(dp.x) < speed_x? dp.x: SIGN(dp.x) * speed_x); + position.y += (ABS(dp.y) < speed_y ? dp.y : SIGN(dp.y) * speed_y); + position.x += (o == kActorDown || o == kActorUp) ? + (ABS(dp.x) < speed_y ? dp.x : SIGN(dp.x) * speed_y) : + (ABS(dp.x) < speed_x ? dp.x : SIGN(dp.x) * speed_x); } _idle_timer = 0; @@ -815,11 +814,11 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 delta) { //removed mark == null. In final scene of chapter 2 mark rendered above table. //if it'd cause any bugs, add hack here. (_id != 23 && mark == NULL) if (on_enabled && - debug_features.feature[DebugFeatures::kShowOn]) { + debug_features.feature[DebugFeatures::kShowOn]) { on.render(surface, actor_animation_position); } - for(; z_order_it != z_order.end(); ++z_order_it) { + for (; z_order_it != z_order.end(); ++z_order_it) { Surface *s = *z_order_it; s->render(surface); } @@ -862,7 +861,7 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 delta) { } Common::Point last_p = position; - for(Path::const_iterator p = path.begin(); p != path.end(); ++p) { + for (Path::const_iterator p = path.begin(); p != path.end(); ++p) { const Common::Point dp(p->x - last_p.x, p->y - last_p.y); if (dp.x != 0) { surface->hLine(last_p.x, last_p.y, p->x, 0xfe); @@ -929,7 +928,7 @@ bool Scene::processEventQueue() { ptr[on_id] = current_event.color; } else { on_enabled = current_event.color != 0; - debug(0, "%s on rendering", on_enabled? "enabling": "disabling"); + debug(0, "%s on rendering", on_enabled ? "enabling" : "disabling"); } loadOns(); current_event.clear(); @@ -983,85 +982,85 @@ bool Scene::processEventQueue() { case SceneEvent::kCreditsMessage: case SceneEvent::kMessage: { - message = current_event.message; - message_animation = NULL; - if (current_event.first_frame) { - message_timer = 0; - message_first_frame = current_event.first_frame; - message_last_frame = current_event.last_frame; - if (current_event.slot > 0) { - message_animation = custom_animation + (current_event.slot - 1); - //else if (!animation[current_event.slot].empty()) - // message_animation = animation + current_event.slot; - } else - message_animation = &actor_animation; - debug(0, "async message %d-%d (slot %u)", message_first_frame, message_last_frame, current_event.slot); - } else { - message_timer = current_event.timer? current_event.timer * 110: messageDuration(message); - message_first_frame = message_last_frame = 0; - } - Common::Point p; - if (current_event.dst.x == 0 && current_event.dst.y == 0) { - p = Common::Point((actor_animation_position.left + actor_animation_position.right) / 2, - actor_animation_position.top); - } else { - p = current_event.dst; - } + message = current_event.message; + message_animation = NULL; + if (current_event.first_frame) { + message_timer = 0; + message_first_frame = current_event.first_frame; + message_last_frame = current_event.last_frame; + if (current_event.slot > 0) { + message_animation = custom_animation + (current_event.slot - 1); + //else if (!animation[current_event.slot].empty()) + // message_animation = animation + current_event.slot; + } else + message_animation = &actor_animation; + debug(0, "async message %d-%d (slot %u)", message_first_frame, message_last_frame, current_event.slot); + } else { + message_timer = current_event.timer ? current_event.timer * 110 : messageDuration(message); + message_first_frame = message_last_frame = 0; + } + Common::Point p; + if (current_event.dst.x == 0 && current_event.dst.y == 0) { + p = Common::Point((actor_animation_position.left + actor_animation_position.right) / 2, + actor_animation_position.top); + } else { + p = current_event.dst; + } - byte message_slot = current_event.slot; - if (message_slot != 0) { - --message_slot; - assert(message_slot < 4); - const Surface *s = custom_animation[message_slot].currentFrame(0); - if (s == NULL) - s = animation[message_slot].currentFrame(0); - if (s != NULL) { - p.x = s->x + s->w / 2; - p.y = s->y; - } else - warning("no animation in slot %u", message_slot); - } - message_pos = messagePosition(message, p); - message_color = current_event.color; + byte message_slot = current_event.slot; + if (message_slot != 0) { + --message_slot; + assert(message_slot < 4); + const Surface *s = custom_animation[message_slot].currentFrame(0); + if (s == NULL) + s = animation[message_slot].currentFrame(0); + if (s != NULL) { + p.x = s->x + s->w / 2; + p.y = s->y; + } else + warning("no animation in slot %u", message_slot); + } + message_pos = messagePosition(message, p); + message_color = current_event.color; - if (message_first_frame) - current_event.clear(); //async message, clearing event + if (message_first_frame) + current_event.clear(); //async message, clearing event } break; case SceneEvent::kPlayAnimation: { - byte slot = current_event.slot & 7; //0 - mark's - if (current_event.animation != 0) { - debug(0, "playing animation %u in slot %u(%02x)", current_event.animation, slot, current_event.slot); - if (slot != 0) { - --slot; - assert(slot < 4); - playAnimation(slot, current_event.animation, (current_event.slot & 0x80) != 0, (current_event.slot & 0x40) != 0, (current_event.slot & 0x20) != 0); - } else - actor_talking = true; - } else { - if (slot != 0) { - --slot; - debug(0, "cancelling animation in slot %u", slot); - assert(slot < 4); - custom_animation[slot].free(); - } else - actor_talking = true; - } - current_event.clear(); + byte slot = current_event.slot & 7; //0 - mark's + if (current_event.animation != 0) { + debug(0, "playing animation %u in slot %u(%02x)", current_event.animation, slot, current_event.slot); + if (slot != 0) { + --slot; + assert(slot < 4); + playAnimation(slot, current_event.animation, (current_event.slot & 0x80) != 0, (current_event.slot & 0x40) != 0, (current_event.slot & 0x20) != 0); + } else + actor_talking = true; + } else { + if (slot != 0) { + --slot; + debug(0, "cancelling animation in slot %u", slot); + assert(slot < 4); + custom_animation[slot].free(); + } else + actor_talking = true; + } + current_event.clear(); } break; case SceneEvent::kPauseAnimation: { - byte slot = current_event.slot & 7; //0 - mark's - if (slot != 0) { - --slot; - debug(1, "pause animation in slot %u", slot); - custom_animation[slot].paused = (current_event.slot & 0x80) != 0; - } else { - actor_talking = false; - } - current_event.clear(); + byte slot = current_event.slot & 7; //0 - mark's + if (slot != 0) { + --slot; + debug(1, "pause animation in slot %u", slot); + custom_animation[slot].paused = (current_event.slot & 0x80) != 0; + } else { + actor_talking = false; + } + current_event.clear(); } break; @@ -1097,8 +1096,8 @@ bool Scene::processEventQueue() { obj->enabled = current_event.color; obj->save(); current_event.clear(); - } - break; + } + break; case SceneEvent::kHideActor: hide_actor = current_event.color != 0; @@ -1141,7 +1140,7 @@ bool Scene::processEventQueue() { break; case SceneEvent::kFade: - _fade_timer = current_event.orientation != 0? 5: -5; + _fade_timer = current_event.orientation != 0 ? 5 : -5; current_event.clear(); break; @@ -1177,9 +1176,9 @@ bool Scene::processEventQueue() { void Scene::setPalette(unsigned mul) { //debug(0, "setPalette(%u)", mul); - byte p[3*256]; + byte p[3 * 256]; - for (int i = 0; i < 3*256; ++i) { + for (int i = 0; i < 3 * 256; ++i) { p[i] = (unsigned)palette[i] * mul; } @@ -1206,7 +1205,7 @@ Object *Scene::getObject(int id, int scene_id) { Common::Point Scene::messagePosition(const Common::String &str, Common::Point message_position) { Resources *res = Resources::instance(); int lines = 1; - for(uint i = 0; i < str.size(); ++i) + for (uint i = 0; i < str.size(); ++i) if (str[i] == '\n') ++lines; @@ -1247,7 +1246,7 @@ void Scene::displayMessage(const Common::String &str, byte color, const Common:: //assert(!str.empty()); //debug(0, "displayMessage: %s", str.c_str()); message = str; - message_pos = (pos.x | pos.y)? pos: messagePosition(str, position); + message_pos = (pos.x | pos.y) ? pos : messagePosition(str, position); message_color = color; message_timer = messageDuration(message); } @@ -1256,7 +1255,7 @@ void Scene::clear() { clearMessage(); events.clear(); current_event.clear(); - for(int i = 0; i < 4; ++i) { + for (int i = 0; i < 4; ++i) { animation[i].free(); custom_animation[i].free(); } diff --git a/engines/teenagent/scene.h b/engines/teenagent/scene.h index bc101847fa..32e784bb60 100644 --- a/engines/teenagent/scene.h +++ b/engines/teenagent/scene.h @@ -43,30 +43,30 @@ class Dialog; struct SceneEvent { enum Type { - kNone, //0 - kMessage, - kWalk, - kPlayAnimation, - kPlayActorAnimation, //4 - kPauseAnimation, - kClearAnimations, - kLoadScene, - kSetOn, //8 - kSetLan, - kPlayMusic, - kPlaySound, - kEnableObject, //12 - kHideActor, - kWaitForAnimation, - kWaitLanAnimationFrame, - kCreditsMessage, //16 - kCredits, - kTimer, - kEffect, - kFade, - kWait, - kSetFlag, - kQuit + kNone, //0 + kMessage, + kWalk, + kPlayAnimation, + kPlayActorAnimation, //4 + kPauseAnimation, + kClearAnimations, + kLoadScene, + kSetOn, //8 + kSetLan, + kPlayMusic, + kPlaySound, + kEnableObject, //12 + kHideActor, + kWaitForAnimation, + kWaitLanAnimationFrame, + kCreditsMessage, //16 + kCredits, + kTimer, + kEffect, + kFade, + kWait, + kSetFlag, + kQuit } type; Common::String message; @@ -93,8 +93,8 @@ struct SceneEvent { byte object; SceneEvent(Type type_) : - type(type_), message(), color(0xd1), slot(0), animation(0), timer(0), orientation(0), dst(), - scene(0), ons(0), lan(0), music(0), sound(0), object(0) {} + type(type_), message(), color(0xd1), slot(0), animation(0), timer(0), orientation(0), dst(), + scene(0), ons(0), lan(0), music(0), sound(0), object(0) {} void clear() { type = kNone; @@ -119,8 +119,8 @@ struct SceneEvent { void dump() const { debug(0, "event[%d]: \"%s\"[%02x], slot: %d, animation: %u, timer: %u, dst: (%d, %d) [%u], scene: %u, ons: %u, lan: %u, object: %u, music: %u, sound: %u", - (int)type, message.c_str(), color, slot, animation, timer, dst.x, dst.y, orientation, scene, ons, lan, object, music, sound - ); + (int)type, message.c_str(), color, slot, animation, timer, dst.x, dst.y, orientation, scene, ons, lan, object, music, sound + ); } }; @@ -144,7 +144,7 @@ public: void setOrientation(uint8 o) { orientation = o; } void push(const SceneEvent &event); byte peekFlagEvent(uint16 addr) const; - SceneEvent::Type last_event_type() const { return !events.empty()? events.back().type: SceneEvent::kNone; } + SceneEvent::Type last_event_type() const { return !events.empty() ? events.back().type : SceneEvent::kNone; } bool processEvent(const Common::Event &event); @@ -160,9 +160,9 @@ public: Object *findObject(const Common::Point &point); void loadObjectData(); - Animation * getAnimation(byte slot); - inline Animation * getActorAnimation() { return &actor_animation; } - inline const Common::String& getMessage() const { return message; } + Animation *getAnimation(byte slot); + inline Animation *getActorAnimation() { return &actor_animation; } + inline const Common::String &getMessage() const { return message; } void setPalette(unsigned mul); int lookupZoom(uint y) const; @@ -219,7 +219,7 @@ private: uint message_timer; byte message_first_frame; byte message_last_frame; - Animation * message_animation; + Animation *message_animation; typedef Common::List<SceneEvent> EventList; EventList events; @@ -240,17 +240,17 @@ private: struct DebugFeatures { enum { - kShowBack, - kShowLan, - kShowOns, - kShowOn, - kHidePath, - kMax + kShowBack, + kShowLan, + kShowOns, + kShowOn, + kHidePath, + kMax }; bool feature[kMax]; DebugFeatures() { - for(uint i = 0; i < kMax; ++i) { + for (uint i = 0; i < kMax; ++i) { feature[i] = true; } } diff --git a/engines/teenagent/surface.cpp b/engines/teenagent/surface.cpp index e8b5a8ad59..63312990ee 100644 --- a/engines/teenagent/surface.cpp +++ b/engines/teenagent/surface.cpp @@ -94,7 +94,7 @@ Common::Rect Surface::render(Graphics::Surface *surface, int dx, int dy, bool mi for (int i = src_rect.top; i < src_rect.bottom; ++i) { byte *dst = dst_base; for (int j = src_rect.left; j < src_rect.right; ++j) { - byte p = src[(mirror? w - j - 1: j)]; + byte p = src[(mirror ? w - j - 1 : j)]; if (p != 0xff) *dst++ = p; else @@ -105,10 +105,10 @@ Common::Rect Surface::render(Graphics::Surface *surface, int dx, int dy, bool mi } } else { byte *dst = (byte *)surface->getBasePtr(dst_rect.left, dst_rect.top); - for(int i = 0; i < dst_rect.height(); ++i) { + for (int i = 0; i < dst_rect.height(); ++i) { for (int j = 0; j < dst_rect.width(); ++j) { int px = j * 256 / zoom; - const byte *src = (const byte *)getBasePtr(src_rect.left + (mirror? w - px - 1: px), src_rect.top + i * 256 / zoom); + const byte *src = (const byte *)getBasePtr(src_rect.left + (mirror ? w - px - 1 : px), src_rect.top + i * 256 / zoom); byte p = *src; if (p != 0xff) dst[j] = p; diff --git a/engines/teenagent/surface.h b/engines/teenagent/surface.h index 64e45a7330..1771b2d683 100644 --- a/engines/teenagent/surface.h +++ b/engines/teenagent/surface.h @@ -26,7 +26,7 @@ #include "graphics/surface.h" namespace Common { - class SeekableReadStream; +class SeekableReadStream; } namespace TeenAgent { @@ -40,7 +40,7 @@ public: Surface(); ~Surface(); - void load(Common::SeekableReadStream&, Type type); + void load(Common::SeekableReadStream &, Type type); Common::Rect render(Graphics::Surface *surface, int dx = 0, int dy = 0, bool mirror = false, Common::Rect src_rect = Common::Rect(), uint zoom = 256) const; bool empty() const { return pixels == NULL; } diff --git a/engines/teenagent/surface_list.cpp b/engines/teenagent/surface_list.cpp index 7f7eb1dc38..31387ac3cb 100644 --- a/engines/teenagent/surface_list.cpp +++ b/engines/teenagent/surface_list.cpp @@ -61,8 +61,8 @@ void SurfaceList::free() { surfaces_n = 0; } -void SurfaceList::render(Graphics::Surface *surface, const Common::Rect & clip) const { - for(uint i = 0; i < surfaces_n; ++i) { +void SurfaceList::render(Graphics::Surface *surface, const Common::Rect &clip) const { + for (uint i = 0; i < surfaces_n; ++i) { const Surface &s = surfaces[i]; Common::Rect r(s.x, s.y, s.x + s.w, s.y + s.h); if (r.bottom < clip.bottom || !clip.intersects(r)) diff --git a/engines/teenagent/surface_list.h b/engines/teenagent/surface_list.h index fcb4fb25c5..2d7be0d52b 100644 --- a/engines/teenagent/surface_list.h +++ b/engines/teenagent/surface_list.h @@ -33,12 +33,12 @@ public: SurfaceList(); ~SurfaceList(); - void load(Common::SeekableReadStream&, Type type, int sub_hack = 0); + void load(Common::SeekableReadStream &, Type type, int sub_hack = 0); void free(); - void render(Graphics::Surface *surface, const Common::Rect & clip) const; + void render(Graphics::Surface *surface, const Common::Rect &clip) const; protected: - Surface * surfaces; + Surface *surfaces; uint surfaces_n; }; diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp index e6a248334c..fb228ef2fc 100644 --- a/engines/teenagent/teenagent.cpp +++ b/engines/teenagent/teenagent.cpp @@ -49,7 +49,7 @@ namespace TeenAgent { TeenAgentEngine::TeenAgentEngine(OSystem *system, const ADGameDescription *gd) : Engine(system), action(kActionNone), _gameDescription(gd), - _rnd("teenagent") { + _rnd("teenagent") { music = new MusicPlayer(); console = 0; @@ -70,10 +70,8 @@ bool TeenAgentEngine::trySelectedObject() { debug(0, "checking active object %u on %u", inv->id, dst_object->id); //mouse time challenge hack: - if ( - (res->dseg.get_byte(0) == 1 && inv->id == 49 && dst_object->id == 5) || - (res->dseg.get_byte(0) == 2 && inv->id == 29 && dst_object->id == 5) - ) { + if ((res->dseg.get_byte(0) == 1 && inv->id == 49 && dst_object->id == 5) || + (res->dseg.get_byte(0) == 2 && inv->id == 29 && dst_object->id == 5)) { //putting rock into hole or superglue on rock processCallback(0x8d57); return true; @@ -176,12 +174,12 @@ void TeenAgentEngine::init() { _mark_delay = 80; _game_delay = 110; - Resources * res = Resources::instance(); + Resources *res = Resources::instance(); use_hotspots.resize(42); byte *scene_hotspots = res->dseg.ptr(0xbb87); for (byte i = 0; i < 42; ++i) { Common::Array<UseHotspot> & hotspots = use_hotspots[i]; - byte * hotspots_ptr = res->dseg.ptr(READ_LE_UINT16(scene_hotspots + i * 2)); + byte *hotspots_ptr = res->dseg.ptr(READ_LE_UINT16(scene_hotspots + i * 2)); while (*hotspots_ptr) { UseHotspot h; h.load(hotspots_ptr); @@ -206,8 +204,7 @@ void TeenAgentEngine::deinit() { Common::Error TeenAgentEngine::loadGameState(int slot) { debug(0, "loading from slot %d", slot); - Common::ScopedPtr<Common::InSaveFile> - in(_saveFileMan->openForLoading(Common::String::format("teenagent.%02d", slot))); + Common::ScopedPtr<Common::InSaveFile> in(_saveFileMan->openForLoading(Common::String::format("teenagent.%02d", slot))); if (!in) in.reset(_saveFileMan->openForLoading(Common::String::format("teenagent.%d", slot))); @@ -275,7 +272,7 @@ int TeenAgentEngine::skipEvents() const { Common::EventManager *_event = _system->getEventManager(); Common::Event event; while (_event->pollEvent(event)) { - switch(event.type) { + switch (event.type) { case Common::EVENT_QUIT: case Common::EVENT_RTL: return -1; @@ -284,8 +281,8 @@ int TeenAgentEngine::skipEvents() const { case Common::EVENT_RBUTTONDOWN: return 1; case Common::EVENT_KEYDOWN: - if (event.kbd.ascii) - return 1; + if (event.kbd.ascii) + return 1; default: break; } @@ -324,10 +321,10 @@ bool TeenAgentEngine::showCDLogo() { free(bg); free(palette); - for(uint i = 0; i < 20; ++i) { + for (uint i = 0; i < 20; ++i) { int r = skipEvents(); if (r != 0) - return r > 0? true: false; + return r > 0 ? true : false; _system->delayMillis(100); } cdlogo.close(); @@ -368,13 +365,13 @@ bool TeenAgentEngine::showLogo() { free(palette); uint n = logo.fileCount(); - for(uint f = 0; f < 4; ++f) - for(uint i = 2; i <= n; ++i) { + for (uint f = 0; f < 4; ++f) + for (uint i = 2; i <= n; ++i) { { int r = skipEvents(); if (r != 0) { free(bg); - return r > 0? true: false; + return r > 0 ? true : false; } } _system->copyRectToScreen(bg, 320, 0, 0, 320, 200); @@ -448,14 +445,14 @@ bool TeenAgentEngine::showMetropolis() { memset(colors, 0, colorsSize); int logo_y = -56; - for(uint f = 0; f < 300; ++f) { + for (uint f = 0; f < 300; ++f) { { int r = skipEvents(); if (r != 0) { free(varia_6); free(varia_9); free(colors); - return r > 0? true: false; + return r > 0 ? true : false; } } @@ -467,19 +464,19 @@ bool TeenAgentEngine::showMetropolis() { { //generate colors matrix memmove(colors + 320, colors + 480, 8480); - for(uint c = 0; c < 17; ++c) { + for (uint c = 0; c < 17; ++c) { byte x = (_rnd.getRandomNumber(184) + 5) & 0xff; uint offset = 8800 + _rnd.getRandomNumber(158); colors[offset++] = x; colors[offset++] = x; } - for(uint y = 1; y < 56; ++y) { - for(uint x = 1; x < 160; ++x) { + for (uint y = 1; y < 56; ++y) { + for (uint x = 1; x < 160; ++x) { uint offset = y * 160 + x; uint v = - (uint)colors[offset - 161] + colors[offset - 160] + colors[offset - 159] + - (uint)colors[offset - 1] + colors[offset + 1] + - (uint)colors[offset + 161] + colors[offset + 160] + colors[offset + 159]; + (uint)colors[offset - 161] + colors[offset - 160] + colors[offset - 159] + + (uint)colors[offset - 1] + colors[offset + 1] + + (uint)colors[offset + 161] + colors[offset + 160] + colors[offset + 159]; v >>= 3; colors[offset + 8960] = v; } @@ -489,8 +486,8 @@ bool TeenAgentEngine::showMetropolis() { byte *dst = (byte *)surface->getBasePtr(0, 131); byte *src = varia_6; - for(uint y = 0; y < 68; ++y) { - for(uint x = 0; x < 320; ++x) { + for (uint y = 0; y < 68; ++y) { + for (uint x = 0; x < 320; ++x) { if (*src++ == 1) { *dst++ = colors[19 * 160 + y / 2 * 160 + x / 2]; } else @@ -500,9 +497,9 @@ bool TeenAgentEngine::showMetropolis() { _system->unlockScreen(); _system->copyRectToScreen( - varia_9 + (logo_y < 0? -logo_y * 320: 0), 320, - 0, logo_y >= 0? logo_y: 0, - 320, logo_y >= 0? 57: 57 + logo_y); + varia_9 + (logo_y < 0 ? -logo_y * 320 : 0), 320, + 0, logo_y >= 0 ? logo_y : 0, + 320, logo_y >= 0 ? 57 : 57 + logo_y); if (logo_y < 82 - 57) ++logo_y; @@ -582,12 +579,12 @@ Common::Error TeenAgentEngine::run() { switch (event.type) { case Common::EVENT_KEYDOWN: if ((event.kbd.hasFlags(Common::KBD_CTRL) && event.kbd.keycode == Common::KEYCODE_d) || - event.kbd.ascii == '~' || event.kbd.ascii == '#') { + event.kbd.ascii == '~' || event.kbd.ascii == '#') { console->attach(); } else if (event.kbd.hasFlags(0) && event.kbd.keycode == Common::KEYCODE_F5) { openMainMenuDialog(); } if (event.kbd.hasFlags(Common::KBD_CTRL) && event.kbd.keycode == Common::KEYCODE_f) { - _mark_delay = _mark_delay == 80? 40: 80; + _mark_delay = _mark_delay == 80 ? 40 : 80; debug(0, "mark_delay = %u", _mark_delay); } break; @@ -679,7 +676,7 @@ Common::Error TeenAgentEngine::run() { } } - inventory->render(surface, tick_game? 1: 0); + inventory->render(surface, tick_game ? 1 : 0); _system->unlockScreen(); @@ -689,7 +686,7 @@ Common::Error TeenAgentEngine::run() { uint32 next_tick = MIN(game_timer, mark_timer); if (next_tick > 0) { - _system->delayMillis(next_tick > 40? 40: next_tick); + _system->delayMillis(next_tick > 40 ? 40 : next_tick); } } while (!shouldQuit()); @@ -801,7 +798,7 @@ void TeenAgentEngine::displayCredits() { event.dst.y = 200; int lines = 1; - for(uint i = 0; i < event.message.size(); ++i) + for (uint i = 0; i < event.message.size(); ++i) if (event.message[i] == '\n') ++lines; event.dst.x = (320 - Resources::instance()->font7.render(NULL, 0, 0, event.message, 0xd1)) / 2; @@ -854,7 +851,7 @@ void TeenAgentEngine::moveRel(int16 x, int16 y, byte o, bool warp) { void TeenAgentEngine::playAnimation(uint16 id, byte slot, bool async, bool ignore, bool loop) { SceneEvent event(SceneEvent::kPlayAnimation); event.animation = id; - event.slot = (slot + 1) | (ignore? 0x20: 0) | (loop? 0x80: 0); + event.slot = (slot + 1) | (ignore ? 0x20 : 0) | (loop ? 0x80 : 0); scene->push(event); if (!async) waitAnimation(); @@ -863,7 +860,7 @@ void TeenAgentEngine::playAnimation(uint16 id, byte slot, bool async, bool ignor void TeenAgentEngine::playActorAnimation(uint16 id, bool async, bool ignore) { SceneEvent event(SceneEvent::kPlayActorAnimation); event.animation = id; - event.slot = ignore? 0x20: 0; + event.slot = ignore ? 0x20 : 0; scene->push(event); if (!async) waitAnimation(); @@ -890,7 +887,7 @@ void TeenAgentEngine::loadScene(byte id, uint16 x, uint16 y, byte o) { void TeenAgentEngine::enableOn(bool enable) { SceneEvent event(SceneEvent::kSetOn); event.ons = 0; - event.color = enable? 1: 0; + event.color = enable ? 1 : 0; scene->push(event); } diff --git a/engines/teenagent/teenagent.h b/engines/teenagent/teenagent.h index a054f72d25..737f07ba85 100644 --- a/engines/teenagent/teenagent.h +++ b/engines/teenagent/teenagent.h @@ -122,7 +122,7 @@ public: Scene *scene; Inventory *inventory; MusicPlayer *music; - Console * console; + Console *console; void setMusic(byte id); |