From b5a07fef8ebf29f7f44b15d9b34799c7e115fdad Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Sat, 21 Jul 2012 21:01:47 +0200 Subject: WINTERMUTE: Get rid of the C-prefix for class-definitions. --- engines/wintermute/ad/ad_actor.cpp | 166 ++++---- engines/wintermute/ad/ad_actor.h | 46 +- engines/wintermute/ad/ad_entity.cpp | 102 ++--- engines/wintermute/ad/ad_entity.h | 22 +- engines/wintermute/ad/ad_game.cpp | 276 ++++++------ engines/wintermute/ad/ad_game.h | 92 ++-- engines/wintermute/ad/ad_inventory.cpp | 22 +- engines/wintermute/ad/ad_inventory.h | 14 +- engines/wintermute/ad/ad_inventory_box.cpp | 42 +- engines/wintermute/ad/ad_inventory_box.h | 20 +- engines/wintermute/ad/ad_item.cpp | 80 ++-- engines/wintermute/ad/ad_item.h | 20 +- engines/wintermute/ad/ad_layer.cpp | 70 +-- engines/wintermute/ad/ad_layer.h | 20 +- engines/wintermute/ad/ad_node_state.cpp | 26 +- engines/wintermute/ad/ad_node_state.h | 12 +- engines/wintermute/ad/ad_object.cpp | 170 ++++---- engines/wintermute/ad/ad_object.h | 68 +-- engines/wintermute/ad/ad_path.cpp | 20 +- engines/wintermute/ad/ad_path.h | 20 +- engines/wintermute/ad/ad_path_point.cpp | 12 +- engines/wintermute/ad/ad_path_point.h | 12 +- engines/wintermute/ad/ad_region.cpp | 38 +- engines/wintermute/ad/ad_region.h | 16 +- engines/wintermute/ad/ad_response.cpp | 38 +- engines/wintermute/ad/ad_response.h | 18 +- engines/wintermute/ad/ad_response_box.cpp | 82 ++-- engines/wintermute/ad/ad_response_box.h | 42 +- engines/wintermute/ad/ad_response_context.cpp | 10 +- engines/wintermute/ad/ad_response_context.h | 8 +- engines/wintermute/ad/ad_rot_level.cpp | 22 +- engines/wintermute/ad/ad_rot_level.h | 10 +- engines/wintermute/ad/ad_scale_level.cpp | 22 +- engines/wintermute/ad/ad_scale_level.h | 10 +- engines/wintermute/ad/ad_scene.cpp | 340 +++++++-------- engines/wintermute/ad/ad_scene.h | 102 ++--- engines/wintermute/ad/ad_scene_node.cpp | 14 +- engines/wintermute/ad/ad_scene_node.h | 16 +- engines/wintermute/ad/ad_scene_state.cpp | 14 +- engines/wintermute/ad/ad_scene_state.h | 14 +- engines/wintermute/ad/ad_sentence.cpp | 40 +- engines/wintermute/ad/ad_sentence.h | 26 +- engines/wintermute/ad/ad_sprite_set.cpp | 46 +- engines/wintermute/ad/ad_sprite_set.h | 18 +- engines/wintermute/ad/ad_talk_def.cpp | 44 +- engines/wintermute/ad/ad_talk_def.h | 22 +- engines/wintermute/ad/ad_talk_holder.cpp | 42 +- engines/wintermute/ad/ad_talk_holder.h | 24 +- engines/wintermute/ad/ad_talk_node.cpp | 38 +- engines/wintermute/ad/ad_talk_node.h | 20 +- engines/wintermute/ad/ad_waypoint_group.cpp | 38 +- engines/wintermute/ad/ad_waypoint_group.h | 20 +- engines/wintermute/base/base.cpp | 16 +- engines/wintermute/base/base.h | 18 +- engines/wintermute/base/base_active_rect.cpp | 22 +- engines/wintermute/base/base_active_rect.h | 22 +- engines/wintermute/base/base_debugger.cpp | 66 +-- engines/wintermute/base/base_debugger.h | 34 +- engines/wintermute/base/base_dynamic_buffer.cpp | 34 +- engines/wintermute/base/base_dynamic_buffer.h | 6 +- engines/wintermute/base/base_fader.cpp | 28 +- engines/wintermute/base/base_fader.h | 8 +- engines/wintermute/base/base_file_manager.cpp | 78 ++-- engines/wintermute/base/base_file_manager.h | 16 +- engines/wintermute/base/base_frame.cpp | 70 +-- engines/wintermute/base/base_frame.h | 36 +- engines/wintermute/base/base_game.cpp | 468 ++++++++++----------- engines/wintermute/base/base_game.h | 138 +++--- engines/wintermute/base/base_keyboard_state.cpp | 42 +- engines/wintermute/base/base_keyboard_state.h | 14 +- engines/wintermute/base/base_named_object.cpp | 10 +- engines/wintermute/base/base_named_object.h | 10 +- engines/wintermute/base/base_object.cpp | 94 ++--- engines/wintermute/base/base_object.h | 40 +- engines/wintermute/base/base_parser.cpp | 26 +- engines/wintermute/base/base_parser.h | 8 +- .../wintermute/base/base_persistence_manager.cpp | 86 ++-- engines/wintermute/base/base_persistence_manager.h | 6 +- engines/wintermute/base/base_point.cpp | 10 +- engines/wintermute/base/base_point.h | 10 +- engines/wintermute/base/base_quick_msg.cpp | 6 +- engines/wintermute/base/base_quick_msg.h | 6 +- engines/wintermute/base/base_region.cpp | 66 +-- engines/wintermute/base/base_region.h | 20 +- engines/wintermute/base/base_registry.cpp | 34 +- engines/wintermute/base/base_registry.h | 6 +- engines/wintermute/base/base_save_thumb_helper.cpp | 10 +- engines/wintermute/base/base_save_thumb_helper.h | 12 +- engines/wintermute/base/base_script_holder.cpp | 70 +-- engines/wintermute/base/base_script_holder.h | 24 +- engines/wintermute/base/base_scriptable.cpp | 50 +-- engines/wintermute/base/base_scriptable.h | 44 +- engines/wintermute/base/base_sprite.cpp | 92 ++-- engines/wintermute/base/base_sprite.h | 32 +- engines/wintermute/base/base_string_table.cpp | 22 +- engines/wintermute/base/base_string_table.h | 6 +- engines/wintermute/base/base_sub_frame.cpp | 68 +-- engines/wintermute/base/base_sub_frame.h | 26 +- engines/wintermute/base/base_surface_storage.cpp | 34 +- engines/wintermute/base/base_surface_storage.h | 16 +- .../wintermute/base/base_transition_manager.cpp | 18 +- engines/wintermute/base/base_transition_manager.h | 6 +- engines/wintermute/base/base_viewport.cpp | 20 +- engines/wintermute/base/base_viewport.h | 12 +- engines/wintermute/base/file/BPkgFile.cpp | 7 +- engines/wintermute/base/file/BPkgFile.h | 4 +- engines/wintermute/base/file/base_disk_file.cpp | 2 +- engines/wintermute/base/file/base_disk_file.h | 2 +- engines/wintermute/base/file/base_file.cpp | 8 +- engines/wintermute/base/file/base_file.h | 6 +- engines/wintermute/base/file/base_file_entry.cpp | 4 +- engines/wintermute/base/file/base_file_entry.h | 10 +- engines/wintermute/base/file/base_package.cpp | 14 +- engines/wintermute/base/file/base_package.h | 6 +- engines/wintermute/base/file/base_resources.cpp | 2 +- engines/wintermute/base/file/base_resources.h | 2 +- .../wintermute/base/file/base_save_thumb_file.cpp | 14 +- .../wintermute/base/file/base_save_thumb_file.h | 6 +- engines/wintermute/base/font/base_font.cpp | 36 +- engines/wintermute/base/font/base_font.h | 12 +- engines/wintermute/base/font/base_font_bitmap.cpp | 44 +- engines/wintermute/base/font/base_font_bitmap.h | 14 +- engines/wintermute/base/font/base_font_storage.cpp | 20 +- engines/wintermute/base/font/base_font_storage.h | 16 +- .../wintermute/base/font/base_font_truetype.cpp | 78 ++-- engines/wintermute/base/font/base_font_truetype.h | 30 +- engines/wintermute/base/gfx/base_image.cpp | 20 +- engines/wintermute/base/gfx/base_image.h | 10 +- engines/wintermute/base/gfx/base_renderer.cpp | 54 +-- engines/wintermute/base/gfx/base_renderer.h | 24 +- engines/wintermute/base/gfx/base_surface.cpp | 34 +- engines/wintermute/base/gfx/base_surface.h | 6 +- .../base/gfx/osystem/base_render_osystem.cpp | 78 ++-- .../base/gfx/osystem/base_render_osystem.h | 20 +- .../base/gfx/osystem/base_surface_osystem.cpp | 72 ++-- .../base/gfx/osystem/base_surface_osystem.h | 8 +- engines/wintermute/base/particles/part_emitter.cpp | 112 ++--- engines/wintermute/base/particles/part_emitter.h | 34 +- engines/wintermute/base/particles/part_force.cpp | 6 +- engines/wintermute/base/particles/part_force.h | 8 +- .../wintermute/base/particles/part_particle.cpp | 42 +- engines/wintermute/base/particles/part_particle.h | 20 +- engines/wintermute/base/scriptables/script.cpp | 158 +++---- engines/wintermute/base/scriptables/script.h | 62 +-- .../wintermute/base/scriptables/script_engine.cpp | 110 ++--- .../wintermute/base/scriptables/script_engine.h | 38 +- .../base/scriptables/script_ext_array.cpp | 34 +- .../wintermute/base/scriptables/script_ext_array.h | 20 +- .../base/scriptables/script_ext_date.cpp | 28 +- .../wintermute/base/scriptables/script_ext_date.h | 16 +- .../base/scriptables/script_ext_file.cpp | 56 +-- .../wintermute/base/scriptables/script_ext_file.h | 16 +- .../base/scriptables/script_ext_math.cpp | 22 +- .../wintermute/base/scriptables/script_ext_math.h | 12 +- .../base/scriptables/script_ext_mem_buffer.cpp | 42 +- .../base/scriptables/script_ext_mem_buffer.h | 20 +- .../base/scriptables/script_ext_object.cpp | 14 +- .../base/scriptables/script_ext_object.h | 8 +- .../base/scriptables/script_ext_string.cpp | 44 +- .../base/scriptables/script_ext_string.h | 16 +- .../wintermute/base/scriptables/script_stack.cpp | 50 +-- engines/wintermute/base/scriptables/script_stack.h | 26 +- .../wintermute/base/scriptables/script_value.cpp | 158 +++---- engines/wintermute/base/scriptables/script_value.h | 50 +-- engines/wintermute/base/sound/base_sound.cpp | 46 +- engines/wintermute/base/sound/base_sound.h | 12 +- .../wintermute/base/sound/base_sound_buffer.cpp | 62 +-- engines/wintermute/base/sound/base_sound_buffer.h | 8 +- .../wintermute/base/sound/base_sound_manager.cpp | 44 +- engines/wintermute/base/sound/base_sound_manager.h | 18 +- engines/wintermute/coll_templ.h | 66 +-- engines/wintermute/detection.cpp | 6 +- engines/wintermute/persistent.cpp | 134 +++--- engines/wintermute/persistent.h | 16 +- engines/wintermute/platform_osystem.cpp | 66 +-- engines/wintermute/platform_osystem.h | 8 +- engines/wintermute/system/sys_class.cpp | 42 +- engines/wintermute/system/sys_class.h | 36 +- engines/wintermute/system/sys_class_registry.cpp | 46 +- engines/wintermute/system/sys_class_registry.h | 44 +- engines/wintermute/system/sys_instance.cpp | 4 +- engines/wintermute/system/sys_instance.h | 12 +- engines/wintermute/ui/ui_button.cpp | 100 ++--- engines/wintermute/ui/ui_button.h | 40 +- engines/wintermute/ui/ui_edit.cpp | 82 ++-- engines/wintermute/ui/ui_edit.h | 20 +- engines/wintermute/ui/ui_entity.cpp | 42 +- engines/wintermute/ui/ui_entity.h | 20 +- engines/wintermute/ui/ui_object.cpp | 72 ++-- engines/wintermute/ui/ui_object.h | 36 +- engines/wintermute/ui/ui_text.cpp | 52 +-- engines/wintermute/ui/ui_text.h | 16 +- engines/wintermute/ui/ui_tiled_image.cpp | 82 ++-- engines/wintermute/ui/ui_tiled_image.h | 14 +- engines/wintermute/ui/ui_window.cpp | 154 +++---- engines/wintermute/ui/ui_window.h | 38 +- engines/wintermute/utils/utils.cpp | 44 +- engines/wintermute/utils/utils.h | 4 +- engines/wintermute/video/video_player.cpp | 26 +- engines/wintermute/video/video_player.h | 10 +- engines/wintermute/video/video_theora_player.cpp | 72 ++-- engines/wintermute/video/video_theora_player.h | 20 +- engines/wintermute/wintermute.cpp | 16 +- engines/wintermute/wintermute.h | 10 +- 204 files changed, 4085 insertions(+), 4082 deletions(-) (limited to 'engines/wintermute') diff --git a/engines/wintermute/ad/ad_actor.cpp b/engines/wintermute/ad/ad_actor.cpp index 36f1aa8286..1da28cd93d 100644 --- a/engines/wintermute/ad/ad_actor.cpp +++ b/engines/wintermute/ad/ad_actor.cpp @@ -52,12 +52,12 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CAdActor, false) +IMPLEMENT_PERSISTENT(AdActor, false) ////////////////////////////////////////////////////////////////////////// -CAdActor::CAdActor(CBGame *inGame): CAdTalkHolder(inGame) { - _path = new CAdPath(_gameRef); +AdActor::AdActor(BaseGame *inGame): AdTalkHolder(inGame) { + _path = new AdPath(_gameRef); _type = OBJECT_ACTOR; _dir = DI_LEFT; @@ -67,7 +67,7 @@ CAdActor::CAdActor(CBGame *inGame): CAdTalkHolder(inGame) { _turnLeftSprite = NULL; _turnRightSprite = NULL; - _targetPoint = new CBPoint; + _targetPoint = new BasePoint; _afterWalkDir = DI_NONE; _animSprite2 = NULL; @@ -76,7 +76,7 @@ CAdActor::CAdActor(CBGame *inGame): CAdTalkHolder(inGame) { } ////////////////////////////////////////////////////////////////////////// -bool CAdActor::setDefaultAnimNames() { +bool AdActor::setDefaultAnimNames() { _talkAnimName = "talk"; _idleAnimName = "idle"; _walkAnimName = "walk"; @@ -86,7 +86,7 @@ bool CAdActor::setDefaultAnimNames() { } ////////////////////////////////////////////////////////////////////////// -CAdActor::~CAdActor() { +AdActor::~AdActor() { delete _path; delete _targetPoint; _path = NULL; @@ -123,10 +123,10 @@ CAdActor::~CAdActor() { ////////////////////////////////////////////////////////////////////////// -bool CAdActor::loadFile(const char *filename) { +bool AdActor::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { - _gameRef->LOG(0, "CAdActor::LoadFile failed for file '%s'", filename); + _gameRef->LOG(0, "AdActor::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -183,7 +183,7 @@ TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF(ANIMATION) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -bool CAdActor::loadBuffer(byte *buffer, bool complete) { +bool AdActor::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(ACTOR) TOKEN_TABLE(X) @@ -225,7 +225,7 @@ bool CAdActor::loadBuffer(byte *buffer, bool complete) { byte *params; int cmd; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); if (complete) { if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_ACTOR) { @@ -235,8 +235,8 @@ bool CAdActor::loadBuffer(byte *buffer, bool complete) { buffer = params; } - CAdGame *adGame = (CAdGame *)_gameRef; - CAdSpriteSet *spr = NULL; + AdGame *adGame = (AdGame *)_gameRef; + AdSpriteSet *spr = NULL; int ar = 0, ag = 0, ab = 0, alpha = 0; while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)¶ms)) > 0) { switch (cmd) { @@ -290,19 +290,19 @@ bool CAdActor::loadBuffer(byte *buffer, bool complete) { case TOKEN_WALK: delete _walkSprite; _walkSprite = NULL; - spr = new CAdSpriteSet(_gameRef, this); + spr = new AdSpriteSet(_gameRef, this); if (!spr || DID_FAIL(spr->loadBuffer(params, true, adGame->_texWalkLifeTime, CACHE_HALF))) cmd = PARSERR_GENERIC; else _walkSprite = spr; break; case TOKEN_TALK: - spr = new CAdSpriteSet(_gameRef, this); + spr = new AdSpriteSet(_gameRef, this); if (!spr || DID_FAIL(spr->loadBuffer(params, true, adGame->_texTalkLifeTime))) cmd = PARSERR_GENERIC; else _talkSprites.add(spr); break; case TOKEN_TALK_SPECIAL: - spr = new CAdSpriteSet(_gameRef, this); + spr = new AdSpriteSet(_gameRef, this); if (!spr || DID_FAIL(spr->loadBuffer(params, true, adGame->_texTalkLifeTime))) cmd = PARSERR_GENERIC; else _talkSpritesEx.add(spr); break; @@ -310,7 +310,7 @@ bool CAdActor::loadBuffer(byte *buffer, bool complete) { case TOKEN_STAND: delete _standSprite; _standSprite = NULL; - spr = new CAdSpriteSet(_gameRef, this); + spr = new AdSpriteSet(_gameRef, this); if (!spr || DID_FAIL(spr->loadBuffer(params, true, adGame->_texStandLifeTime))) cmd = PARSERR_GENERIC; else _standSprite = spr; break; @@ -318,7 +318,7 @@ bool CAdActor::loadBuffer(byte *buffer, bool complete) { case TOKEN_TURN_LEFT: delete _turnLeftSprite; _turnLeftSprite = NULL; - spr = new CAdSpriteSet(_gameRef, this); + spr = new AdSpriteSet(_gameRef, this); if (!spr || DID_FAIL(spr->loadBuffer(params, true))) cmd = PARSERR_GENERIC; else _turnLeftSprite = spr; break; @@ -326,7 +326,7 @@ bool CAdActor::loadBuffer(byte *buffer, bool complete) { case TOKEN_TURN_RIGHT: delete _turnRightSprite; _turnRightSprite = NULL; - spr = new CAdSpriteSet(_gameRef, this); + spr = new AdSpriteSet(_gameRef, this); if (!spr || DID_FAIL(spr->loadBuffer(params, true))) cmd = PARSERR_GENERIC; else _turnRightSprite = spr; break; @@ -337,7 +337,7 @@ bool CAdActor::loadBuffer(byte *buffer, bool complete) { case TOKEN_CURSOR: delete _cursor; - _cursor = new CBSprite(_gameRef); + _cursor = new BaseSprite(_gameRef); if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) { delete _cursor; _cursor = NULL; @@ -378,8 +378,8 @@ bool CAdActor::loadBuffer(byte *buffer, bool complete) { delete _currentBlockRegion; _blockRegion = NULL; _currentBlockRegion = NULL; - CBRegion *rgn = new CBRegion(_gameRef); - CBRegion *crgn = new CBRegion(_gameRef); + BaseRegion *rgn = new BaseRegion(_gameRef); + BaseRegion *crgn = new BaseRegion(_gameRef); if (!rgn || !crgn || DID_FAIL(rgn->loadBuffer(params, false))) { delete _blockRegion; delete _currentBlockRegion; @@ -399,8 +399,8 @@ bool CAdActor::loadBuffer(byte *buffer, bool complete) { delete _currentWptGroup; _wptGroup = NULL; _currentWptGroup = NULL; - CAdWaypointGroup *wpt = new CAdWaypointGroup(_gameRef); - CAdWaypointGroup *cwpt = new CAdWaypointGroup(_gameRef); + AdWaypointGroup *wpt = new AdWaypointGroup(_gameRef); + AdWaypointGroup *cwpt = new AdWaypointGroup(_gameRef); if (!wpt || !cwpt || DID_FAIL(wpt->loadBuffer(params, false))) { delete _wptGroup; delete _currentWptGroup; @@ -432,7 +432,7 @@ bool CAdActor::loadBuffer(byte *buffer, bool complete) { break; case TOKEN_ANIMATION: { - CAdSpriteSet *Anim = new CAdSpriteSet(_gameRef, this); + AdSpriteSet *Anim = new AdSpriteSet(_gameRef, this); if (!Anim || DID_FAIL(Anim->loadBuffer(params, false))) cmd = PARSERR_GENERIC; else _anims.add(Anim); } @@ -460,7 +460,7 @@ bool CAdActor::loadBuffer(byte *buffer, bool complete) { ////////////////////////////////////////////////////////////////////////// -void CAdActor::turnTo(TDirection dir) { +void AdActor::turnTo(TDirection dir) { int delta1, delta2, delta3, delta; delta1 = dir - _dir; @@ -486,7 +486,7 @@ void CAdActor::turnTo(TDirection dir) { ////////////////////////////////////////////////////////////////////////// -void CAdActor::goTo(int x, int y, TDirection afterWalkDir) { +void AdActor::goTo(int x, int y, TDirection afterWalkDir) { _afterWalkDir = afterWalkDir; if (x == _targetPoint->x && y == _targetPoint->y && _state == STATE_FOLLOWING_PATH) return; @@ -496,7 +496,7 @@ void CAdActor::goTo(int x, int y, TDirection afterWalkDir) { _targetPoint->x = x; _targetPoint->y = y; - ((CAdGame *)_gameRef)->_scene->correctTargetPoint(_posX, _posY, &_targetPoint->x, &_targetPoint->y, true, this); + ((AdGame *)_gameRef)->_scene->correctTargetPoint(_posX, _posY, &_targetPoint->x, &_targetPoint->y, true, this); _state = STATE_SEARCHING_PATH; @@ -504,12 +504,12 @@ void CAdActor::goTo(int x, int y, TDirection afterWalkDir) { ////////////////////////////////////////////////////////////////////////// -bool CAdActor::display() { +bool AdActor::display() { if (_active) updateSounds(); uint32 alpha; if (_alphaColor != 0) alpha = _alphaColor; - else alpha = _shadowable ? ((CAdGame *)_gameRef)->_scene->getAlphaAt(_posX, _posY, true) : 0xFFFFFFFF; + else alpha = _shadowable ? ((AdGame *)_gameRef)->_scene->getAlphaAt(_posX, _posY, true) : 0xFFFFFFFF; float scaleX, scaleY; getScale(&scaleX, &scaleY); @@ -518,14 +518,14 @@ bool CAdActor::display() { float rotate; if (_rotatable) { if (_rotateValid) rotate = _rotate; - else rotate = ((CAdGame *)_gameRef)->_scene->getRotationAt(_posX, _posY) + _relativeRotate; + else rotate = ((AdGame *)_gameRef)->_scene->getRotationAt(_posX, _posY) + _relativeRotate; } else rotate = 0.0f; if (_active) displaySpriteAttachments(true); if (_currentSprite && _active) { bool reg = _registrable; - if (_ignoreItems && ((CAdGame *)_gameRef)->_selectedItem) reg = false; + if (_ignoreItems && ((AdGame *)_gameRef)->_selectedItem) reg = false; _currentSprite->display(_posX, _posY, @@ -547,7 +547,7 @@ bool CAdActor::display() { ////////////////////////////////////////////////////////////////////////// -bool CAdActor::update() { +bool AdActor::update() { _currentSprite = NULL; if (_state == STATE_READY) { @@ -582,7 +582,7 @@ bool CAdActor::update() { if (_standSprite) { _currentSprite = _standSprite->getSprite(_dir); } else { - CAdSpriteSet *Anim = getAnimByName(_idleAnimName); + AdSpriteSet *Anim = getAnimByName(_idleAnimName); if (Anim) _currentSprite = Anim->getSprite(_dir); } } @@ -615,7 +615,7 @@ bool CAdActor::update() { if (_turnLeftSprite) { _tempSprite2 = _turnLeftSprite->getSprite(_dir); } else { - CAdSpriteSet *Anim = getAnimByName(_turnLeftAnimName); + AdSpriteSet *Anim = getAnimByName(_turnLeftAnimName); if (Anim) _tempSprite2 = Anim->getSprite(_dir); } @@ -644,7 +644,7 @@ bool CAdActor::update() { if (_turnRightSprite) { _tempSprite2 = _turnRightSprite->getSprite(_dir); } else { - CAdSpriteSet *Anim = getAnimByName(_turnRightAnimName); + AdSpriteSet *Anim = getAnimByName(_turnRightAnimName); if (Anim) _tempSprite2 = Anim->getSprite(_dir); } @@ -661,7 +661,7 @@ bool CAdActor::update() { ////////////////////////////////////////////////////////////////////////// case STATE_SEARCHING_PATH: // keep asking scene for the path - if (((CAdGame *)_gameRef)->_scene->getPath(CBPoint(_posX, _posY), *_targetPoint, _path, this)) + if (((AdGame *)_gameRef)->_scene->getPath(BasePoint(_posX, _posY), *_targetPoint, _path, this)) _state = STATE_WAITING_PATH; break; @@ -696,12 +696,12 @@ bool CAdActor::update() { if (_tempSprite2) { _tempSprite2->reset(); _currentSprite = _tempSprite2; - ((CAdGame *)_gameRef)->addSentence(_sentence); + ((AdGame *)_gameRef)->addSentence(_sentence); } } } else { _currentSprite = _tempSprite2; - ((CAdGame *)_gameRef)->addSentence(_sentence); + ((AdGame *)_gameRef)->addSentence(_sentence); } } break; @@ -714,7 +714,7 @@ bool CAdActor::update() { if (_standSprite) { _currentSprite = _standSprite->getSprite(_dir); } else { - CAdSpriteSet *Anim = getAnimByName(_idleAnimName); + AdSpriteSet *Anim = getAnimByName(_idleAnimName); if (Anim) _currentSprite = Anim->getSprite(_dir); } } @@ -726,7 +726,7 @@ bool CAdActor::update() { if (_currentSprite && !already_moved) { - _currentSprite->GetCurrentFrame(_zoomable ? ((CAdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY) : 100, _zoomable ? ((CAdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY) : 100); + _currentSprite->GetCurrentFrame(_zoomable ? ((AdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY) : 100, _zoomable ? ((AdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY) : 100); if (_currentSprite->_changed) { _posX += _currentSprite->_moveX; _posY += _currentSprite->_moveY; @@ -747,7 +747,7 @@ bool CAdActor::update() { ////////////////////////////////////////////////////////////////////////// -void CAdActor::followPath() { +void AdActor::followPath() { // skip current position _path->getFirst(); while (_path->getCurrent() != NULL) { @@ -758,7 +758,7 @@ void CAdActor::followPath() { // are there points to follow? if (_path->getCurrent() != NULL) { _state = STATE_FOLLOWING_PATH;; - initLine(CBPoint(_posX, _posY), *_path->getCurrent()); + initLine(BasePoint(_posX, _posY), *_path->getCurrent()); } else { if (_afterWalkDir != DI_NONE) turnTo(_afterWalkDir); else _state = STATE_READY; @@ -767,17 +767,17 @@ void CAdActor::followPath() { ////////////////////////////////////////////////////////////////////////// -void CAdActor::getNextStep() { +void AdActor::getNextStep() { if (_walkSprite) { _currentSprite = _walkSprite->getSprite(_dir); } else { - CAdSpriteSet *Anim = getAnimByName(_walkAnimName); + AdSpriteSet *Anim = getAnimByName(_walkAnimName); if (Anim) _currentSprite = Anim->getSprite(_dir); } if (!_currentSprite) return; - _currentSprite->GetCurrentFrame(_zoomable ? ((CAdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY) : 100, _zoomable ? ((CAdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY) : 100); + _currentSprite->GetCurrentFrame(_zoomable ? ((AdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY) : 100, _zoomable ? ((AdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY) : 100); if (!_currentSprite->_changed) return; @@ -796,7 +796,7 @@ void CAdActor::getNextStep() { maxStepX--; } - if (((CAdGame *)_gameRef)->_scene->isBlockedAt((int)_pFX,(int) _pFY, true, this)) { + if (((AdGame *)_gameRef)->_scene->isBlockedAt((int)_pFX,(int) _pFY, true, this)) { if (_pFCount == 0) { _state = _nextState; _nextState = STATE_READY; @@ -824,13 +824,13 @@ void CAdActor::getNextStep() { _state = _nextState; _nextState = STATE_READY; } - } else initLine(CBPoint(_posX, _posY), *_path->getCurrent()); + } else initLine(BasePoint(_posX, _posY), *_path->getCurrent()); } } ////////////////////////////////////////////////////////////////////////// -void CAdActor::initLine(CBPoint startPt, CBPoint endPt) { +void AdActor::initLine(BasePoint startPt, BasePoint endPt) { _pFCount = MAX((abs(endPt.x - startPt.x)) , (abs(endPt.y - startPt.y))); _pFStepX = (double)(endPt.x - startPt.x) / _pFCount; @@ -850,7 +850,7 @@ void CAdActor::initLine(CBPoint startPt, CBPoint endPt) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -bool CAdActor::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool AdActor::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // GoTo / GoToAsync ////////////////////////////////////////////////////////////////////////// @@ -869,19 +869,19 @@ bool CAdActor::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSt ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "GoToObject") == 0 || strcmp(name, "GoToObjectAsync") == 0) { stack->correctParams(1); - CScValue *Val = stack->pop(); + ScValue *Val = stack->pop(); if (!Val->isNative()) { script->runtimeError("actor.%s method accepts an entity refrence only", name); stack->pushNULL(); return STATUS_OK; } - CAdObject *Obj = (CAdObject *)Val->getNative(); + AdObject *Obj = (AdObject *)Val->getNative(); if (!Obj || Obj->_type != OBJECT_ENTITY) { script->runtimeError("actor.%s method accepts an entity refrence only", name); stack->pushNULL(); return STATUS_OK; } - CAdEntity *Ent = (CAdEntity *)Obj; + AdEntity *Ent = (AdEntity *)Obj; if (Ent->_walkToX == 0 && Ent->_walkToY == 0) goTo(Ent->_posX, Ent->_posY); else goTo(Ent->_walkToX, Ent->_walkToY, Ent->_walkToDir); if (strcmp(name, "GoToObjectAsync") != 0) script->waitForExclusive(this); @@ -895,11 +895,11 @@ bool CAdActor::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSt else if (strcmp(name, "TurnTo") == 0 || strcmp(name, "TurnToAsync") == 0) { stack->correctParams(1); int dir; - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); // turn to object? - if (val->isNative() && _gameRef->validObject((CBObject *)val->getNative())) { - CBObject *obj = (CBObject *)val->getNative(); + if (val->isNative() && _gameRef->validObject((BaseObject *)val->getNative())) { + BaseObject *obj = (BaseObject *)val->getNative(); int angle = (int)(atan2((double)(obj->_posY - _posY), (double)(obj->_posX - _posX)) * (180 / 3.14)); dir = (int)angleToDirection(angle); } @@ -968,12 +968,12 @@ bool CAdActor::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSt return STATUS_OK; } - else return CAdTalkHolder::scCallMethod(script, stack, thisStack, name); + else return AdTalkHolder::scCallMethod(script, stack, thisStack, name); } ////////////////////////////////////////////////////////////////////////// -CScValue *CAdActor::scGetProperty(const char *name) { +ScValue *AdActor::scGetProperty(const char *name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// @@ -1030,12 +1030,12 @@ CScValue *CAdActor::scGetProperty(const char *name) { return _scValue; } - else return CAdTalkHolder::scGetProperty(name); + else return AdTalkHolder::scGetProperty(name); } ////////////////////////////////////////////////////////////////////////// -bool CAdActor::scSetProperty(const char *name, CScValue *value) { +bool AdActor::scSetProperty(const char *name, ScValue *value) { ////////////////////////////////////////////////////////////////////////// // Direction ////////////////////////////////////////////////////////////////////////// @@ -1090,27 +1090,27 @@ bool CAdActor::scSetProperty(const char *name, CScValue *value) { return STATUS_OK; } - else return CAdTalkHolder::scSetProperty(name, value); + else return AdTalkHolder::scSetProperty(name, value); } ////////////////////////////////////////////////////////////////////////// -const char *CAdActor::scToString() { +const char *AdActor::scToString() { return "[actor object]"; } ////////////////////////////////////////////////////////////////////////// -CBSprite *CAdActor::getTalkStance(const char *stance) { +BaseSprite *AdActor::getTalkStance(const char *stance) { // forced stance? if (_forcedTalkAnimName && !_forcedTalkAnimUsed) { _forcedTalkAnimUsed = true; delete _animSprite; - _animSprite = new CBSprite(_gameRef, this); + _animSprite = new BaseSprite(_gameRef, this); if (_animSprite) { bool res = _animSprite->loadFile(_forcedTalkAnimName); if (DID_FAIL(res)) { - _gameRef->LOG(res, "CAdActor::GetTalkStance: error loading talk sprite (object:\"%s\" sprite:\"%s\")", _name, _forcedTalkAnimName); + _gameRef->LOG(res, "AdActor::GetTalkStance: error loading talk sprite (object:\"%s\" sprite:\"%s\")", _name, _forcedTalkAnimName); delete _animSprite; _animSprite = NULL; } else return _animSprite; @@ -1122,15 +1122,15 @@ CBSprite *CAdActor::getTalkStance(const char *stance) { return getTalkStanceOld(stance); // new way - CBSprite *ret = NULL; + BaseSprite *ret = NULL; // do we have an animation with this name? - CAdSpriteSet *Anim = getAnimByName(stance); + AdSpriteSet *Anim = getAnimByName(stance); if (Anim) ret = Anim->getSprite(_dir); // not - get a random talk if (!ret) { - CBArray TalkAnims; + BaseArray TalkAnims; for (int i = 0; i < _anims.getSize(); i++) { if (_talkAnimName.compareToIgnoreCase(_anims[i]->_name) == 0) TalkAnims.add(_anims[i]); @@ -1151,8 +1151,8 @@ CBSprite *CAdActor::getTalkStance(const char *stance) { } ////////////////////////////////////////////////////////////////////////// -CBSprite *CAdActor::getTalkStanceOld(const char *stance) { - CBSprite *ret = NULL; +BaseSprite *AdActor::getTalkStanceOld(const char *stance) { + BaseSprite *ret = NULL; if (stance != NULL) { // search special stances @@ -1187,8 +1187,8 @@ CBSprite *CAdActor::getTalkStanceOld(const char *stance) { } ////////////////////////////////////////////////////////////////////////// -bool CAdActor::persist(CBPersistMgr *persistMgr) { - CAdTalkHolder::persist(persistMgr); +bool AdActor::persist(BasePersistenceManager *persistMgr) { + AdTalkHolder::persist(persistMgr); persistMgr->transfer(TMEMBER_INT(_dir)); persistMgr->transfer(TMEMBER(_path)); @@ -1221,7 +1221,7 @@ bool CAdActor::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -TDirection CAdActor::angleToDirection(int angle) { +TDirection AdActor::angleToDirection(int angle) { TDirection ret = DI_DOWN;; if (angle > -112 && angle <= -67) ret = DI_UP; @@ -1238,22 +1238,22 @@ TDirection CAdActor::angleToDirection(int angle) { ////////////////////////////////////////////////////////////////////////// -int CAdActor::getHeight() { +int AdActor::getHeight() { // if no current sprite is set, set some if (_currentSprite == NULL) { if (_standSprite) _currentSprite = _standSprite->getSprite(_dir); else { - CAdSpriteSet *Anim = getAnimByName(_idleAnimName); + AdSpriteSet *Anim = getAnimByName(_idleAnimName); if (Anim) _currentSprite = Anim->getSprite(_dir); } } // and get height - return CAdTalkHolder::getHeight(); + return AdTalkHolder::getHeight(); } ////////////////////////////////////////////////////////////////////////// -CAdSpriteSet *CAdActor::getAnimByName(const Common::String &animName) { +AdSpriteSet *AdActor::getAnimByName(const Common::String &animName) { for (int i = 0; i < _anims.getSize(); i++) { if (animName.compareToIgnoreCase(_anims[i]->_name) == 0) return _anims[i]; @@ -1262,7 +1262,7 @@ CAdSpriteSet *CAdActor::getAnimByName(const Common::String &animName) { } ////////////////////////////////////////////////////////////////////////// -bool CAdActor::mergeAnims(const char *animsFilename) { +bool AdActor::mergeAnims(const char *animsFilename) { TOKEN_TABLE_START(commands) TOKEN_TABLE(ANIMATION) TOKEN_TABLE_END @@ -1270,21 +1270,21 @@ bool CAdActor::mergeAnims(const char *animsFilename) { byte *fileBuffer = _gameRef->_fileManager->readWholeFile(animsFilename); if (fileBuffer == NULL) { - _gameRef->LOG(0, "CAdActor::MergeAnims failed for file '%s'", animsFilename); + _gameRef->LOG(0, "AdActor::MergeAnims failed for file '%s'", animsFilename); return STATUS_FAILED; } byte *buffer = fileBuffer; byte *params; int cmd; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); bool Ret = STATUS_OK; while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)¶ms)) > 0) { switch (cmd) { case TOKEN_ANIMATION: { - CAdSpriteSet *Anim = new CAdSpriteSet(_gameRef, this); + AdSpriteSet *Anim = new AdSpriteSet(_gameRef, this); if (!Anim || DID_FAIL(Anim->loadBuffer(params, false))) { cmd = PARSERR_GENERIC; Ret = STATUS_FAILED; @@ -1298,9 +1298,9 @@ bool CAdActor::mergeAnims(const char *animsFilename) { } ////////////////////////////////////////////////////////////////////////// -bool CAdActor::playAnim(const char *filename) { +bool AdActor::playAnim(const char *filename) { // if we have an anim with this name, use it - CAdSpriteSet *Anim = getAnimByName(filename); + AdSpriteSet *Anim = getAnimByName(filename); if (Anim) { _animSprite2 = Anim->getSprite(_dir); if (_animSprite2) { @@ -1310,7 +1310,7 @@ bool CAdActor::playAnim(const char *filename) { } } // otherwise call the standard handler - return CAdTalkHolder::playAnim(filename); + return AdTalkHolder::playAnim(filename); } } // end of namespace WinterMute diff --git a/engines/wintermute/ad/ad_actor.h b/engines/wintermute/ad/ad_actor.h index 67e0630f83..3cce827b17 100644 --- a/engines/wintermute/ad/ad_actor.h +++ b/engines/wintermute/ad/ad_actor.h @@ -39,31 +39,31 @@ namespace WinterMute { -class CAdSpriteSet; -class CAdPath; -class CAdActor : public CAdTalkHolder { +class AdSpriteSet; +class AdPath; +class AdActor : public AdTalkHolder { public: TDirection angleToDirection(int angle); - DECLARE_PERSISTENT(CAdActor, CAdTalkHolder) + DECLARE_PERSISTENT(AdActor, AdTalkHolder) virtual int getHeight(); - CBSprite *getTalkStance(const char *stance); + BaseSprite *getTalkStance(const char *stance); virtual void goTo(int x, int y, TDirection afterWalkDir = DI_NONE); - CBPoint *_targetPoint; + BasePoint *_targetPoint; virtual bool update(); virtual bool display(); TDirection _targetDir; TDirection _afterWalkDir; virtual void turnTo(TDirection dir); - CAdPath *_path; - CAdSpriteSet *_walkSprite; - CAdSpriteSet *_standSprite; - CAdSpriteSet *_turnLeftSprite; - CAdSpriteSet *_turnRightSprite; - CBArray _talkSprites; - CBArray _talkSpritesEx; + AdPath *_path; + AdSpriteSet *_walkSprite; + AdSpriteSet *_standSprite; + AdSpriteSet *_turnLeftSprite; + AdSpriteSet *_turnRightSprite; + BaseArray _talkSprites; + BaseArray _talkSpritesEx; TDirection _dir; - CAdActor(CBGame *inGame/*=NULL*/); - virtual ~CAdActor(); + AdActor(BaseGame *inGame/*=NULL*/); + virtual ~AdActor(); bool loadFile(const char *filename); bool loadBuffer(byte *buffer, bool complete = true); @@ -73,23 +73,23 @@ public: Common::String _walkAnimName; Common::String _turnLeftAnimName; Common::String _turnRightAnimName; - CBArray _anims; + BaseArray _anims; virtual bool playAnim(const char *filename); - CAdSpriteSet *getAnimByName(const Common::String &animName); + AdSpriteSet *getAnimByName(const Common::String &animName); // scripting interface - virtual CScValue *scGetProperty(const char *name); - virtual bool scSetProperty(const char *name, CScValue *value); - virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual ScValue *scGetProperty(const char *name); + virtual bool scSetProperty(const char *name, ScValue *value); + virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); virtual const char *scToString(); private: bool setDefaultAnimNames(); - CBSprite *getTalkStanceOld(const char *stance); + BaseSprite *getTalkStanceOld(const char *stance); bool mergeAnims(const char *animsFilename); - CBSprite *_animSprite2; + BaseSprite *_animSprite2; - void initLine(CBPoint startPt, CBPoint endPt); + void initLine(BasePoint startPt, BasePoint endPt); void getNextStep(); void followPath(); double _pFStepX; diff --git a/engines/wintermute/ad/ad_entity.cpp b/engines/wintermute/ad/ad_entity.cpp index 5f32017264..06a551b252 100644 --- a/engines/wintermute/ad/ad_entity.cpp +++ b/engines/wintermute/ad/ad_entity.cpp @@ -55,10 +55,10 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CAdEntity, false) +IMPLEMENT_PERSISTENT(AdEntity, false) ////////////////////////////////////////////////////////////////////////// -CAdEntity::CAdEntity(CBGame *inGame): CAdTalkHolder(inGame) { +AdEntity::AdEntity(BaseGame *inGame): AdTalkHolder(inGame) { _type = OBJECT_ENTITY; _subtype = ENTITY_NORMAL; _region = NULL; @@ -72,7 +72,7 @@ CAdEntity::CAdEntity(CBGame *inGame): CAdTalkHolder(inGame) { ////////////////////////////////////////////////////////////////////////// -CAdEntity::~CAdEntity() { +AdEntity::~AdEntity() { _gameRef->unregisterObject(_region); delete _theora; @@ -84,10 +84,10 @@ CAdEntity::~CAdEntity() { ////////////////////////////////////////////////////////////////////////// -bool CAdEntity::loadFile(const char *filename) { +bool AdEntity::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { - _gameRef->LOG(0, "CAdEntity::LoadFile failed for file '%s'", filename); + _gameRef->LOG(0, "AdEntity::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -150,7 +150,7 @@ TOKEN_DEF(WALK_TO_DIR) TOKEN_DEF(SAVE_STATE) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -bool CAdEntity::loadBuffer(byte *buffer, bool complete) { +bool AdEntity::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(ENTITY) TOKEN_TABLE(SPRITE) @@ -198,7 +198,7 @@ bool CAdEntity::loadBuffer(byte *buffer, bool complete) { byte *params; int cmd; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); if (complete) { if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_ENTITY) { @@ -208,8 +208,8 @@ bool CAdEntity::loadBuffer(byte *buffer, bool complete) { buffer = params; } - CAdGame *adGame = (CAdGame *)_gameRef; - CBSprite *spr = NULL; + AdGame *adGame = (AdGame *)_gameRef; + BaseSprite *spr = NULL; int ar = 0, ag = 0, ab = 0, alpha = 0; while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)¶ms)) > 0) { switch (cmd) { @@ -228,21 +228,21 @@ bool CAdEntity::loadBuffer(byte *buffer, bool complete) { case TOKEN_SPRITE: { delete _sprite; _sprite = NULL; - spr = new CBSprite(_gameRef, this); + spr = new BaseSprite(_gameRef, this); if (!spr || DID_FAIL(spr->loadFile((char *)params))) cmd = PARSERR_GENERIC; else _sprite = spr; } break; case TOKEN_TALK: { - spr = new CBSprite(_gameRef, this); + spr = new BaseSprite(_gameRef, this); if (!spr || DID_FAIL(spr->loadFile((char *)params, adGame->_texTalkLifeTime))) cmd = PARSERR_GENERIC; else _talkSprites.add(spr); } break; case TOKEN_TALK_SPECIAL: { - spr = new CBSprite(_gameRef, this); + spr = new BaseSprite(_gameRef, this); if (!spr || DID_FAIL(spr->loadFile((char *)params, adGame->_texTalkLifeTime))) cmd = PARSERR_GENERIC; else _talkSpritesEx.add(spr); } @@ -305,7 +305,7 @@ bool CAdEntity::loadBuffer(byte *buffer, bool complete) { case TOKEN_CURSOR: delete _cursor; - _cursor = new CBSprite(_gameRef); + _cursor = new BaseSprite(_gameRef); if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) { delete _cursor; _cursor = NULL; @@ -320,7 +320,7 @@ bool CAdEntity::loadBuffer(byte *buffer, bool complete) { case TOKEN_REGION: { if (_region) _gameRef->unregisterObject(_region); _region = NULL; - CBRegion *rgn = new CBRegion(_gameRef); + BaseRegion *rgn = new BaseRegion(_gameRef); if (!rgn || DID_FAIL(rgn->loadBuffer(params, false))) cmd = PARSERR_GENERIC; else { _region = rgn; @@ -334,8 +334,8 @@ bool CAdEntity::loadBuffer(byte *buffer, bool complete) { _blockRegion = NULL; delete _currentBlockRegion; _currentBlockRegion = NULL; - CBRegion *rgn = new CBRegion(_gameRef); - CBRegion *crgn = new CBRegion(_gameRef); + BaseRegion *rgn = new BaseRegion(_gameRef); + BaseRegion *crgn = new BaseRegion(_gameRef); if (!rgn || !crgn || DID_FAIL(rgn->loadBuffer(params, false))) { delete _blockRegion; _blockRegion = NULL; @@ -355,8 +355,8 @@ bool CAdEntity::loadBuffer(byte *buffer, bool complete) { _wptGroup = NULL; delete _currentWptGroup; _currentWptGroup = NULL; - CAdWaypointGroup *wpt = new CAdWaypointGroup(_gameRef); - CAdWaypointGroup *cwpt = new CAdWaypointGroup(_gameRef); + AdWaypointGroup *wpt = new AdWaypointGroup(_gameRef); + AdWaypointGroup *cwpt = new AdWaypointGroup(_gameRef); if (!wpt || !cwpt || DID_FAIL(wpt->loadBuffer(params, false))) { delete _wptGroup; _wptGroup = NULL; @@ -380,7 +380,7 @@ bool CAdEntity::loadBuffer(byte *buffer, bool complete) { delete _sprite; _sprite = NULL; if (_gameRef->_editorMode) { - spr = new CBSprite(_gameRef, this); + spr = new BaseSprite(_gameRef, this); if (!spr || DID_FAIL(spr->loadFile("entity_sound.sprite"))) cmd = PARSERR_GENERIC; else _sprite = spr; } @@ -474,20 +474,20 @@ bool CAdEntity::loadBuffer(byte *buffer, bool complete) { _alphaColor = BYTETORGBA(ar, ag, ab, alpha); _state = STATE_READY; - if (_item && ((CAdGame *)_gameRef)->isItemTaken(_item)) _active = false; + if (_item && ((AdGame *)_gameRef)->isItemTaken(_item)) _active = false; return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CAdEntity::display() { +bool AdEntity::display() { if (_active) { updateSounds(); uint32 Alpha; if (_alphaColor != 0) Alpha = _alphaColor; - else Alpha = _shadowable ? ((CAdGame *)_gameRef)->_scene->getAlphaAt(_posX, _posY) : 0xFFFFFFFF; + else Alpha = _shadowable ? ((AdGame *)_gameRef)->_scene->getAlphaAt(_posX, _posY) : 0xFFFFFFFF; float ScaleX, ScaleY; getScale(&ScaleX, &ScaleY); @@ -495,15 +495,15 @@ bool CAdEntity::display() { float Rotate; if (_rotatable) { if (_rotateValid) Rotate = _rotate; - else Rotate = ((CAdGame *)_gameRef)->_scene->getRotationAt(_posX, _posY) + _relativeRotate; + else Rotate = ((AdGame *)_gameRef)->_scene->getRotationAt(_posX, _posY) + _relativeRotate; } else Rotate = 0.0f; bool Reg = _registrable; - if (_ignoreItems && ((CAdGame *)_gameRef)->_selectedItem) Reg = false; + if (_ignoreItems && ((AdGame *)_gameRef)->_selectedItem) Reg = false; if (_region && (Reg || _editorAlwaysRegister)) { - _gameRef->_renderer->_rectList.add(new CBActiveRect(_gameRef, _registerAlias, _region, _gameRef->_offsetX, _gameRef->_offsetY)); + _gameRef->_renderer->_rectList.add(new BaseActiveRect(_gameRef, _registerAlias, _region, _gameRef->_offsetX, _gameRef->_offsetY)); } displaySpriteAttachments(true); @@ -529,7 +529,7 @@ bool CAdEntity::display() { ////////////////////////////////////////////////////////////////////////// -bool CAdEntity::update() { +bool AdEntity::update() { _currentSprite = NULL; if (_state == STATE_READY && _animSprite) { @@ -577,11 +577,11 @@ bool CAdEntity::update() { _tempSprite2->reset(); _currentSprite = _tempSprite2; } - ((CAdGame *)_gameRef)->addSentence(_sentence); + ((AdGame *)_gameRef)->addSentence(_sentence); } } else { _currentSprite = _tempSprite2; - ((CAdGame *)_gameRef)->addSentence(_sentence); + ((AdGame *)_gameRef)->addSentence(_sentence); } } break; @@ -591,7 +591,7 @@ bool CAdEntity::update() { if (_currentSprite) { - _currentSprite->GetCurrentFrame(_zoomable ? ((CAdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY) : 100); + _currentSprite->GetCurrentFrame(_zoomable ? ((AdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY) : 100); if (_currentSprite->_changed) { _posX += _currentSprite->_moveX; _posY += _currentSprite->_moveY; @@ -625,7 +625,7 @@ bool CAdEntity::update() { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -bool CAdEntity::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool AdEntity::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // StopSound ////////////////////////////////////////////////////////////////////////// @@ -644,11 +644,11 @@ bool CAdEntity::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS stack->correctParams(4); const char *filename = stack->pop()->getString(); bool looping = stack->pop()->getBool(false); - CScValue *valAlpha = stack->pop(); + ScValue *valAlpha = stack->pop(); int startTime = stack->pop()->getInt(); delete _theora; - _theora = new CVidTheoraPlayer(_gameRef); + _theora = new VideoTheoraPlayer(_gameRef); if (_theora && DID_SUCCEED(_theora->initialize(filename))) { if (!valAlpha->isNULL()) _theora->setAlphaImage(valAlpha->getString()); _theora->play(VID_PLAY_POS, 0, 0, false, false, looping, startTime, _scale >= 0.0f ? _scale : -1.0f, _sFXVolume); @@ -732,7 +732,7 @@ bool CAdEntity::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS else if (strcmp(name, "CreateRegion") == 0) { stack->correctParams(0); if (!_region) { - _region = new CBRegion(_gameRef); + _region = new BaseRegion(_gameRef); _gameRef->registerObject(_region); } if (_region) stack->pushNative(_region, true); @@ -755,12 +755,12 @@ bool CAdEntity::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS return STATUS_OK; } - else return CAdTalkHolder::scCallMethod(script, stack, thisStack, name); + else return AdTalkHolder::scCallMethod(script, stack, thisStack, name); } ////////////////////////////////////////////////////////////////////////// -CScValue *CAdEntity::scGetProperty(const char *name) { +ScValue *AdEntity::scGetProperty(const char *name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// @@ -826,12 +826,12 @@ CScValue *CAdEntity::scGetProperty(const char *name) { return _scValue; } - else return CAdTalkHolder::scGetProperty(name); + else return AdTalkHolder::scGetProperty(name); } ////////////////////////////////////////////////////////////////////////// -bool CAdEntity::scSetProperty(const char *name, CScValue *value) { +bool AdEntity::scSetProperty(const char *name, ScValue *value) { ////////////////////////////////////////////////////////////////////////// // Item @@ -866,18 +866,18 @@ bool CAdEntity::scSetProperty(const char *name, CScValue *value) { return STATUS_OK; } - else return CAdTalkHolder::scSetProperty(name, value); + else return AdTalkHolder::scSetProperty(name, value); } ////////////////////////////////////////////////////////////////////////// -const char *CAdEntity::scToString() { +const char *AdEntity::scToString() { return "[entity object]"; } ////////////////////////////////////////////////////////////////////////// -bool CAdEntity::saveAsText(CBDynBuffer *buffer, int indent) { +bool AdEntity::saveAsText(BaseDynamicBuffer *buffer, int indent) { buffer->putTextIndent(indent, "ENTITY {\n"); buffer->putTextIndent(indent + 2, "NAME=\"%s\"\n", _name); if (_subtype == ENTITY_SOUND) @@ -942,13 +942,13 @@ bool CAdEntity::saveAsText(CBDynBuffer *buffer, int indent) { if (_cursor && _cursor->_filename) buffer->putTextIndent(indent + 2, "CURSOR=\"%s\"\n", _cursor->_filename); - CAdTalkHolder::saveAsText(buffer, indent + 2); + AdTalkHolder::saveAsText(buffer, indent + 2); if (_region) _region->saveAsText(buffer, indent + 2); if (_scProp) _scProp->saveAsText(buffer, indent + 2); - CAdObject::saveAsText(buffer, indent + 2); + AdObject::saveAsText(buffer, indent + 2); buffer->putTextIndent(indent, "}\n\n"); @@ -957,18 +957,18 @@ bool CAdEntity::saveAsText(CBDynBuffer *buffer, int indent) { ////////////////////////////////////////////////////////////////////////// -int CAdEntity::getHeight() { +int AdEntity::getHeight() { if (_region && !_sprite) { return _region->_rect.bottom - _region->_rect.top; } else { if (_currentSprite == NULL) _currentSprite = _sprite; - return CAdObject::getHeight(); + return AdObject::getHeight(); } } ////////////////////////////////////////////////////////////////////////// -void CAdEntity::updatePosition() { +void AdEntity::updatePosition() { if (_region && !_sprite) { _posX = _region->_rect.left + (_region->_rect.right - _region->_rect.left) / 2; _posY = _region->_rect.bottom; @@ -977,8 +977,8 @@ void CAdEntity::updatePosition() { ////////////////////////////////////////////////////////////////////////// -bool CAdEntity::persist(CBPersistMgr *persistMgr) { - CAdTalkHolder::persist(persistMgr); +bool AdEntity::persist(BasePersistenceManager *persistMgr) { + AdTalkHolder::persist(persistMgr); persistMgr->transfer(TMEMBER(_item)); persistMgr->transfer(TMEMBER(_region)); @@ -998,12 +998,12 @@ bool CAdEntity::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -void CAdEntity::setItem(const char *itemName) { - CBUtils::setString(&_item, itemName); +void AdEntity::setItem(const char *itemName) { + BaseUtils::setString(&_item, itemName); } ////////////////////////////////////////////////////////////////////////// -bool CAdEntity::setSprite(const char *filename) { +bool AdEntity::setSprite(const char *filename) { bool setCurrent = false; if (_currentSprite == _sprite) { _currentSprite = NULL; @@ -1012,7 +1012,7 @@ bool CAdEntity::setSprite(const char *filename) { delete _sprite; _sprite = NULL; - CBSprite *spr = new CBSprite(_gameRef, this); + BaseSprite *spr = new BaseSprite(_gameRef, this); if (!spr || DID_FAIL(spr->loadFile(filename))) { delete _sprite; _sprite = NULL; diff --git a/engines/wintermute/ad/ad_entity.h b/engines/wintermute/ad/ad_entity.h index 8b67d27c1f..9931327916 100644 --- a/engines/wintermute/ad/ad_entity.h +++ b/engines/wintermute/ad/ad_entity.h @@ -32,33 +32,33 @@ #include "engines/wintermute/ad/ad_talk_holder.h" namespace WinterMute { -class CVidTheoraPlayer; -class CAdEntity : public CAdTalkHolder { +class VideoTheoraPlayer; +class AdEntity : public AdTalkHolder { public: - CVidTheoraPlayer *_theora; + VideoTheoraPlayer *_theora; bool setSprite(const char *filename); int _walkToX; int _walkToY; TDirection _walkToDir; void setItem(const char *itemName); char *_item; - DECLARE_PERSISTENT(CAdEntity, CAdTalkHolder) + DECLARE_PERSISTENT(AdEntity, AdTalkHolder) void updatePosition(); virtual int getHeight(); - CBRegion *_region; - virtual bool saveAsText(CBDynBuffer *buffer, int indent); + BaseRegion *_region; + virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent); virtual bool update(); virtual bool display(); - CAdEntity(CBGame *inGame); - virtual ~CAdEntity(); + AdEntity(BaseGame *inGame); + virtual ~AdEntity(); bool loadFile(const char *filename); bool loadBuffer(byte *buffer, bool complete = true); TEntityType _subtype; // scripting interface - virtual CScValue *scGetProperty(const char *name); - virtual bool scSetProperty(const char *name, CScValue *value); - virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual ScValue *scGetProperty(const char *name); + virtual bool scSetProperty(const char *name, ScValue *value); + virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); virtual const char *scToString(); }; diff --git a/engines/wintermute/ad/ad_game.cpp b/engines/wintermute/ad/ad_game.cpp index 69cda25f29..e10ec1bf6d 100644 --- a/engines/wintermute/ad/ad_game.cpp +++ b/engines/wintermute/ad/ad_game.cpp @@ -63,14 +63,14 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CAdGame, true) +IMPLEMENT_PERSISTENT(AdGame, true) ////////////////////////////////////////////////////////////////////////// -CAdGame::CAdGame(): CBGame() { +AdGame::AdGame(): BaseGame() { _responseBox = NULL; _inventoryBox = NULL; - _scene = new CAdScene(_gameRef); + _scene = new AdScene(_gameRef); _scene->setName(""); registerObject(_scene); @@ -98,7 +98,7 @@ CAdGame::CAdGame(): CBGame() { _debugStartupScene = NULL; _startupScene = NULL; - _invObject = new CAdObject(this); + _invObject = new AdObject(this); _inventoryOwner = _invObject; _tempDisableSaveState = false; @@ -111,13 +111,13 @@ CAdGame::CAdGame(): CBGame() { ////////////////////////////////////////////////////////////////////////// -CAdGame::~CAdGame() { +AdGame::~AdGame() { cleanup(); } ////////////////////////////////////////////////////////////////////////// -bool CAdGame::cleanup() { +bool AdGame::cleanup() { int i; for (i = 0; i < _objects.getSize(); i++) { @@ -190,12 +190,12 @@ bool CAdGame::cleanup() { for (i = 0; i < _responsesGame.getSize(); i++) delete _responsesGame[i]; _responsesGame.removeAll(); - return CBGame::cleanup(); + return BaseGame::cleanup(); } ////////////////////////////////////////////////////////////////////////// -bool CAdGame::initLoop() { +bool AdGame::initLoop() { if (_scheduledScene && _transMgr->isReady()) { changeScene(_scheduledScene, _scheduledFadeIn); delete[] _scheduledScene; @@ -206,7 +206,7 @@ bool CAdGame::initLoop() { bool res; - res = CBGame::initLoop(); + res = BaseGame::initLoop(); if (DID_FAIL(res)) return res; if (_scene) res = _scene->initLoop(); @@ -218,14 +218,14 @@ bool CAdGame::initLoop() { ////////////////////////////////////////////////////////////////////////// -bool CAdGame::addObject(CAdObject *object) { +bool AdGame::addObject(AdObject *object) { _objects.add(object); return registerObject(object); } ////////////////////////////////////////////////////////////////////////// -bool CAdGame::removeObject(CAdObject *object) { +bool AdGame::removeObject(AdObject *object) { // in case the user called Scene.CreateXXX() and Game.DeleteXXX() if (_scene) { bool Res = _scene->removeObject(object); @@ -243,9 +243,9 @@ bool CAdGame::removeObject(CAdObject *object) { ////////////////////////////////////////////////////////////////////////// -bool CAdGame::changeScene(const char *filename, bool fadeIn) { +bool AdGame::changeScene(const char *filename, bool fadeIn) { if (_scene == NULL) { - _scene = new CAdScene(_gameRef); + _scene = new AdScene(_gameRef); registerObject(_scene); } else { _scene->applyEvent("SceneShutdown", true); @@ -287,13 +287,13 @@ bool CAdGame::changeScene(const char *filename, bool fadeIn) { ////////////////////////////////////////////////////////////////////////// -void CAdGame::addSentence(CAdSentence *sentence) { +void AdGame::addSentence(AdSentence *sentence) { _sentences.add(sentence); } ////////////////////////////////////////////////////////////////////////// -bool CAdGame::displaySentences(bool frozen) { +bool AdGame::displaySentences(bool frozen) { for (int i = 0; i < _sentences.getSize(); i++) { if (frozen && _sentences[i]->_freezable) continue; else _sentences[i]->display(); @@ -303,7 +303,7 @@ bool CAdGame::displaySentences(bool frozen) { ////////////////////////////////////////////////////////////////////////// -void CAdGame::finishSentences() { +void AdGame::finishSentences() { for (int i = 0; i < _sentences.getSize(); i++) { if (_sentences[i]->CanSkip()) { _sentences[i]->_duration = 0; @@ -316,15 +316,15 @@ void CAdGame::finishSentences() { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -bool CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool AdGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // ChangeScene ////////////////////////////////////////////////////////////////////////// if (strcmp(name, "ChangeScene") == 0) { stack->correctParams(3); const char *filename = stack->pop()->getString(); - CScValue *valFadeOut = stack->pop(); - CScValue *valFadeIn = stack->pop(); + ScValue *valFadeOut = stack->pop(); + ScValue *valFadeIn = stack->pop(); bool transOut = valFadeOut->isNULL() ? true : valFadeOut->getBool(); bool transIn = valFadeIn->isNULL() ? true : valFadeIn->getBool(); @@ -346,7 +346,7 @@ bool CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSta ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "LoadActor") == 0) { stack->correctParams(1); - CAdActor *act = new CAdActor(_gameRef); + AdActor *act = new AdActor(_gameRef); if (act && DID_SUCCEED(act->loadFile(stack->pop()->getString()))) { addObject(act); stack->pushNative(act, true); @@ -363,7 +363,7 @@ bool CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSta ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "LoadEntity") == 0) { stack->correctParams(1); - CAdEntity *ent = new CAdEntity(_gameRef); + AdEntity *ent = new AdEntity(_gameRef); if (ent && DID_SUCCEED(ent->loadFile(stack->pop()->getString()))) { addObject(ent); stack->pushNative(ent, true); @@ -380,8 +380,8 @@ bool CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSta ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "UnloadObject") == 0 || strcmp(name, "UnloadActor") == 0 || strcmp(name, "UnloadEntity") == 0 || strcmp(name, "DeleteEntity") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); - CAdObject *obj = (CAdObject *)val->getNative(); + ScValue *val = stack->pop(); + AdObject *obj = (AdObject *)val->getNative(); removeObject(obj); if (val->getType() == VAL_VARIABLE_REF) val->setNULL(); @@ -394,9 +394,9 @@ bool CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSta ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "CreateEntity") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); - CAdEntity *ent = new CAdEntity(_gameRef); + AdEntity *ent = new AdEntity(_gameRef); addObject(ent); if (!val->isNULL()) ent->setName(val->getString()); stack->pushNative(ent, true); @@ -408,9 +408,9 @@ bool CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSta ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "CreateItem") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); - CAdItem *item = new CAdItem(_gameRef); + AdItem *item = new AdItem(_gameRef); addItem(item); if (!val->isNULL()) item->setName(val->getString()); stack->pushNative(item, true); @@ -422,10 +422,10 @@ bool CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSta ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "DeleteItem") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); - CAdItem *item = NULL; - if (val->isNative()) item = (CAdItem *)val->getNative(); + AdItem *item = NULL; + if (val->isNative()) item = (AdItem *)val->getNative(); else item = getItemByName(val->getString()); if (item) { @@ -441,9 +441,9 @@ bool CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSta ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "QueryItem") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); - CAdItem *item = NULL; + AdItem *item = NULL; if (val->isInt()) { int index = val->getInt(); if (index >= 0 && index < _items.getSize()) item = _items[index]; @@ -465,13 +465,13 @@ bool CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSta stack->correctParams(6); int id = stack->pop()->getInt(); const char *text = stack->pop()->getString(); - CScValue *val1 = stack->pop(); - CScValue *val2 = stack->pop(); - CScValue *val3 = stack->pop(); - CScValue *val4 = stack->pop(); + ScValue *val1 = stack->pop(); + ScValue *val2 = stack->pop(); + ScValue *val3 = stack->pop(); + ScValue *val4 = stack->pop(); if (_responseBox) { - CAdResponse *res = new CAdResponse(_gameRef); + AdResponse *res = new AdResponse(_gameRef); if (res) { res->_iD = id; res->setText(text); @@ -573,7 +573,7 @@ bool CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSta ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "StartDlgBranch") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); Common::String branchName; if (val->isNULL()) { branchName.format("line%d", script->_currentLine); @@ -592,7 +592,7 @@ bool CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSta stack->correctParams(1); const char *branchName = NULL; - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); if (!val->isNULL()) branchName = val->getString(); endDlgBranch(branchName, script->_filename == NULL ? "" : script->_filename, script->_threadEvent == NULL ? "" : script->_threadEvent); @@ -648,10 +648,10 @@ bool CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSta else if (strcmp(name, "IsItemTaken") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); if (!val->isNULL()) { for (int i = 0; i < _inventories.getSize(); i++) { - CAdInventory *Inv = _inventories[i]; + AdInventory *Inv = _inventories[i]; for (int j = 0; j < Inv->_takenItems.getSize(); j++) { if (val->getNative() == Inv->_takenItems[j]) { @@ -703,7 +703,7 @@ bool CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSta const char *filename = stack->pop()->getString(); _gameRef->unregisterObject(_responseBox); - _responseBox = new CAdResponseBox(_gameRef); + _responseBox = new AdResponseBox(_gameRef); if (_responseBox && !DID_FAIL(_responseBox->loadFile(filename))) { registerObject(_responseBox); stack->pushBool(true); @@ -723,7 +723,7 @@ bool CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSta const char *filename = stack->pop()->getString(); _gameRef->unregisterObject(_inventoryBox); - _inventoryBox = new CAdInventoryBox(_gameRef); + _inventoryBox = new AdInventoryBox(_gameRef); if (_inventoryBox && !DID_FAIL(_inventoryBox->loadFile(filename))) { registerObject(_inventoryBox); stack->pushBool(true); @@ -784,7 +784,7 @@ bool CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSta if (width <= 0) width = _renderer->_width; if (height <= 0) height = _renderer->_height; - if (!_sceneViewport) _sceneViewport = new CBViewport(_gameRef); + if (!_sceneViewport) _sceneViewport = new BaseViewport(_gameRef); if (_sceneViewport) _sceneViewport->setRect(x, y, x + width, y + height); stack->pushBool(true); @@ -793,12 +793,12 @@ bool CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSta } - else return CBGame::scCallMethod(script, stack, thisStack, name); + else return BaseGame::scCallMethod(script, stack, thisStack, name); } ////////////////////////////////////////////////////////////////////////// -CScValue *CAdGame::scGetProperty(const char *name) { +ScValue *AdGame::scGetProperty(const char *name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// @@ -947,12 +947,12 @@ CScValue *CAdGame::scGetProperty(const char *name) { return _scValue; } - else return CBGame::scGetProperty(name); + else return BaseGame::scGetProperty(name); } ////////////////////////////////////////////////////////////////////////// -bool CAdGame::scSetProperty(const char *name, CScValue *value) { +bool AdGame::scSetProperty(const char *name, ScValue *value) { ////////////////////////////////////////////////////////////////////////// // SelectedItem @@ -964,7 +964,7 @@ bool CAdGame::scSetProperty(const char *name, CScValue *value) { _selectedItem = NULL; for (int i = 0; i < _items.getSize(); i++) { if (_items[i] == value->getNative()) { - _selectedItem = (CAdItem *)value->getNative(); + _selectedItem = (AdItem *)value->getNative(); break; } } @@ -1001,9 +1001,9 @@ bool CAdGame::scSetProperty(const char *name, CScValue *value) { if (value->isNULL()) _inventoryOwner = _invObject; else { - CBObject *Obj = (CBObject *)value->getNative(); + BaseObject *Obj = (BaseObject *)value->getNative(); if (Obj == this) _inventoryOwner = _invObject; - else if (_gameRef->validObject(Obj)) _inventoryOwner = (CAdObject *)Obj; + else if (_gameRef->validObject(Obj)) _inventoryOwner = (AdObject *)Obj; } if (_inventoryOwner && _inventoryBox) _inventoryBox->_scrollOffset = _inventoryOwner->getInventory()->_scrollOffset; @@ -1037,18 +1037,18 @@ bool CAdGame::scSetProperty(const char *name, CScValue *value) { if (value == NULL) { delete[] _startupScene; _startupScene = NULL; - } else CBUtils::setString(&_startupScene, value->getString()); + } else BaseUtils::setString(&_startupScene, value->getString()); return STATUS_OK; } - else return CBGame::scSetProperty(name, value); + else return BaseGame::scSetProperty(name, value); } ////////////////////////////////////////////////////////////////////////// -bool CAdGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisStack, char *name) { - CScValue *this_obj; +bool AdGame::ExternalCall(ScScript *script, ScStack *stack, ScStack *thisStack, char *name) { + ScValue *this_obj; ////////////////////////////////////////////////////////////////////////// // Actor @@ -1057,7 +1057,7 @@ bool CAdGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisSta stack->correctParams(0); this_obj = thisStack->getTop(); - this_obj->setNative(new CAdActor(_gameRef)); + this_obj->setNative(new AdActor(_gameRef)); stack->pushNULL(); } @@ -1068,14 +1068,14 @@ bool CAdGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisSta stack->correctParams(0); this_obj = thisStack->getTop(); - this_obj->setNative(new CAdEntity(_gameRef)); + this_obj->setNative(new AdEntity(_gameRef)); stack->pushNULL(); } ////////////////////////////////////////////////////////////////////////// // call parent - else return CBGame::ExternalCall(script, stack, thisStack, name); + else return BaseGame::ExternalCall(script, stack, thisStack, name); return STATUS_OK; @@ -1083,13 +1083,13 @@ bool CAdGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisSta ////////////////////////////////////////////////////////////////////////// -bool CAdGame::showCursor() { +bool AdGame::showCursor() { if (_cursorHidden) return STATUS_OK; if (_selectedItem && _gameRef->_state == GAME_RUNNING && _stateEx == GAME_NORMAL && _interactive) { if (_selectedItem->_cursorCombined) { - CBSprite *origLastCursor = _lastCursor; - CBGame::showCursor(); + BaseSprite *origLastCursor = _lastCursor; + BaseGame::showCursor(); _lastCursor = origLastCursor; } if (_activeObject && _selectedItem->_cursorHover && _activeObject->getExtendedFlag("usable")) { @@ -1098,15 +1098,15 @@ bool CAdGame::showCursor() { else return drawCursor(_selectedItem->_cursorNormal); } else return drawCursor(_selectedItem->_cursorNormal); - } else return CBGame::showCursor(); + } else return BaseGame::showCursor(); } ////////////////////////////////////////////////////////////////////////// -bool CAdGame::loadFile(const char *filename) { +bool AdGame::loadFile(const char *filename) { byte *buffer = _fileManager->readWholeFile(filename); if (buffer == NULL) { - _gameRef->LOG(0, "CAdGame::LoadFile failed for file '%s'", filename); + _gameRef->LOG(0, "AdGame::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -1139,7 +1139,7 @@ TOKEN_DEF(STARTUP_SCENE) TOKEN_DEF(DEBUG_STARTUP_SCENE) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -bool CAdGame::loadBuffer(byte *buffer, bool complete) { +bool AdGame::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(GAME) TOKEN_TABLE(AD_GAME) @@ -1156,14 +1156,14 @@ bool CAdGame::loadBuffer(byte *buffer, bool complete) { byte *params; byte *params2; int cmd = 1; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); bool itemFound = false, itemsFound = false; while (cmd > 0 && (cmd = parser.getCommand((char **)&buffer, commands, (char **)¶ms)) > 0) { switch (cmd) { case TOKEN_GAME: - if (DID_FAIL(CBGame::loadBuffer(params, false))) cmd = PARSERR_GENERIC; + if (DID_FAIL(BaseGame::loadBuffer(params, false))) cmd = PARSERR_GENERIC; break; case TOKEN_AD_GAME: @@ -1171,7 +1171,7 @@ bool CAdGame::loadBuffer(byte *buffer, bool complete) { switch (cmd) { case TOKEN_RESPONSE_BOX: delete _responseBox; - _responseBox = new CAdResponseBox(_gameRef); + _responseBox = new AdResponseBox(_gameRef); if (_responseBox && !DID_FAIL(_responseBox->loadFile((char *)params2))) registerObject(_responseBox); else { @@ -1183,7 +1183,7 @@ bool CAdGame::loadBuffer(byte *buffer, bool complete) { case TOKEN_INVENTORY_BOX: delete _inventoryBox; - _inventoryBox = new CAdInventoryBox(_gameRef); + _inventoryBox = new AdInventoryBox(_gameRef); if (_inventoryBox && !DID_FAIL(_inventoryBox->loadFile((char *)params2))) registerObject(_inventoryBox); else { @@ -1195,7 +1195,7 @@ bool CAdGame::loadBuffer(byte *buffer, bool complete) { case TOKEN_ITEMS: itemsFound = true; - CBUtils::setString(&_itemsFile, (char *)params2); + BaseUtils::setString(&_itemsFile, (char *)params2); if (DID_FAIL(loadItemsFile(_itemsFile))) { delete[] _itemsFile; _itemsFile = NULL; @@ -1212,7 +1212,7 @@ bool CAdGame::loadBuffer(byte *buffer, bool complete) { case TOKEN_SCENE_VIEWPORT: { Rect32 rc; parser.scanStr((char *)params2, "%d,%d,%d,%d", &rc.left, &rc.top, &rc.right, &rc.bottom); - if (!_sceneViewport) _sceneViewport = new CBViewport(_gameRef); + if (!_sceneViewport) _sceneViewport = new BaseViewport(_gameRef); if (_sceneViewport) _sceneViewport->setRect(rc.left, rc.top, rc.right, rc.bottom); } break; @@ -1222,11 +1222,11 @@ bool CAdGame::loadBuffer(byte *buffer, bool complete) { break; case TOKEN_STARTUP_SCENE: - CBUtils::setString(&_startupScene, (char *)params2); + BaseUtils::setString(&_startupScene, (char *)params2); break; case TOKEN_DEBUG_STARTUP_SCENE: - CBUtils::setString(&_debugStartupScene, (char *)params2); + BaseUtils::setString(&_debugStartupScene, (char *)params2); break; } } @@ -1252,9 +1252,9 @@ bool CAdGame::loadBuffer(byte *buffer, bool complete) { ////////////////////////////////////////////////////////////////////////// -bool CAdGame::persist(CBPersistMgr *persistMgr) { +bool AdGame::persist(BasePersistenceManager *persistMgr) { if (!persistMgr->_saving) cleanup(); - CBGame::persist(persistMgr); + BaseGame::persist(persistMgr); _dlgPendingBranches.persist(persistMgr); @@ -1303,27 +1303,27 @@ bool CAdGame::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -bool CAdGame::loadGame(const char *filename) { - bool ret = CBGame::loadGame(filename); - if (DID_SUCCEED(ret)) CSysClassRegistry::getInstance()->enumInstances(afterLoadRegion, "CAdRegion", NULL); +bool AdGame::loadGame(const char *filename) { + bool ret = BaseGame::loadGame(filename); + if (DID_SUCCEED(ret)) SystemClassRegistry::getInstance()->enumInstances(afterLoadRegion, "AdRegion", NULL); return ret; } ////////////////////////////////////////////////////////////////////////// -bool CAdGame::initAfterLoad() { - CBGame::initAfterLoad(); - CSysClassRegistry::getInstance()->enumInstances(afterLoadScene, "CAdScene", NULL); +bool AdGame::initAfterLoad() { + BaseGame::initAfterLoad(); + SystemClassRegistry::getInstance()->enumInstances(afterLoadScene, "AdScene", NULL); return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -void CAdGame::afterLoadScene(void *scene, void *data) { - ((CAdScene *)scene)->afterLoad(); +void AdGame::afterLoadScene(void *scene, void *data) { + ((AdScene *)scene)->afterLoad(); } ////////////////////////////////////////////////////////////////////////// -void CAdGame::setPrevSceneName(const char *name) { +void AdGame::setPrevSceneName(const char *name) { delete[] _prevSceneName; _prevSceneName = NULL; if (name) { @@ -1334,7 +1334,7 @@ void CAdGame::setPrevSceneName(const char *name) { ////////////////////////////////////////////////////////////////////////// -void CAdGame::setPrevSceneFilename(const char *name) { +void AdGame::setPrevSceneFilename(const char *name) { delete[] _prevSceneFilename; _prevSceneFilename = NULL; if (name) { @@ -1345,7 +1345,7 @@ void CAdGame::setPrevSceneFilename(const char *name) { ////////////////////////////////////////////////////////////////////////// -bool CAdGame::scheduleChangeScene(const char *filename, bool fadeIn) { +bool AdGame::scheduleChangeScene(const char *filename, bool fadeIn) { delete[] _scheduledScene; _scheduledScene = NULL; @@ -1362,8 +1362,8 @@ bool CAdGame::scheduleChangeScene(const char *filename, bool fadeIn) { ////////////////////////////////////////////////////////////////////////// -bool CAdGame::getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor) { - CBGame::getVersion(verMajor, verMinor, NULL, NULL); +bool AdGame::getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor) { + BaseGame::getVersion(verMajor, verMinor, NULL, NULL); if (extMajor) *extMajor = 0; if (extMinor) *extMinor = 0; @@ -1373,10 +1373,10 @@ bool CAdGame::getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *e ////////////////////////////////////////////////////////////////////////// -bool CAdGame::loadItemsFile(const char *filename, bool merge) { +bool AdGame::loadItemsFile(const char *filename, bool merge) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { - _gameRef->LOG(0, "CAdGame::LoadItemsFile failed for file '%s'", filename); + _gameRef->LOG(0, "AdGame::LoadItemsFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -1395,14 +1395,14 @@ bool CAdGame::loadItemsFile(const char *filename, bool merge) { ////////////////////////////////////////////////////////////////////////// -bool CAdGame::loadItemsBuffer(byte *buffer, bool merge) { +bool AdGame::loadItemsBuffer(byte *buffer, bool merge) { TOKEN_TABLE_START(commands) TOKEN_TABLE(ITEM) TOKEN_TABLE_END byte *params; int cmd; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); if (!merge) { while (_items.getSize() > 0) deleteItem(_items[0]); @@ -1411,11 +1411,11 @@ bool CAdGame::loadItemsBuffer(byte *buffer, bool merge) { while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)¶ms)) > 0) { switch (cmd) { case TOKEN_ITEM: { - CAdItem *item = new CAdItem(_gameRef); + AdItem *item = new AdItem(_gameRef); if (item && !DID_FAIL(item->loadBuffer(params, false))) { // delete item with the same name, if exists if (merge) { - CAdItem *PrevItem = getItemByName(item->_name); + AdItem *PrevItem = getItemByName(item->_name); if (PrevItem) deleteItem(PrevItem); } addItem(item); @@ -1443,7 +1443,7 @@ bool CAdGame::loadItemsBuffer(byte *buffer, bool merge) { ////////////////////////////////////////////////////////////////////////// -CAdSceneState *CAdGame::getSceneState(const char *filename, bool saving) { +AdSceneState *AdGame::getSceneState(const char *filename, bool saving) { char *filenameCor = new char[strlen(filename) + 1]; strcpy(filenameCor, filename); for (uint32 i = 0; i < strlen(filenameCor); i++) { @@ -1458,7 +1458,7 @@ CAdSceneState *CAdGame::getSceneState(const char *filename, bool saving) { } if (saving) { - CAdSceneState *ret = new CAdSceneState(_gameRef); + AdSceneState *ret = new AdSceneState(_gameRef); ret->setFilename(filenameCor); _sceneStates.add(ret); @@ -1473,18 +1473,18 @@ CAdSceneState *CAdGame::getSceneState(const char *filename, bool saving) { ////////////////////////////////////////////////////////////////////////// -bool CAdGame::windowLoadHook(CUIWindow *win, char **buffer, char **params) { +bool AdGame::windowLoadHook(UIWindow *win, char **buffer, char **params) { TOKEN_TABLE_START(commands) TOKEN_TABLE(ENTITY_CONTAINER) TOKEN_TABLE_END int cmd = PARSERR_GENERIC; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); cmd = parser.getCommand(buffer, commands, params); switch (cmd) { case TOKEN_ENTITY_CONTAINER: { - CUIEntity *ent = new CUIEntity(_gameRef); + UIEntity *ent = new UIEntity(_gameRef); if (!ent || DID_FAIL(ent->loadBuffer((byte *)*params, false))) { delete ent; ent = NULL; @@ -1507,12 +1507,12 @@ bool CAdGame::windowLoadHook(CUIWindow *win, char **buffer, char **params) { ////////////////////////////////////////////////////////////////////////// -bool CAdGame::windowScriptMethodHook(CUIWindow *win, CScScript *script, CScStack *stack, const char *name) { +bool AdGame::windowScriptMethodHook(UIWindow *win, ScScript *script, ScStack *stack, const char *name) { if (strcmp(name, "CreateEntityContainer") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); - CUIEntity *ent = new CUIEntity(_gameRef); + UIEntity *ent = new UIEntity(_gameRef); if (!val->isNULL()) ent->setName(val->getString()); stack->pushNative(ent, true); @@ -1525,7 +1525,7 @@ bool CAdGame::windowScriptMethodHook(CUIWindow *win, CScScript *script, CScStack ////////////////////////////////////////////////////////////////////////// -bool CAdGame::startDlgBranch(const char *branchName, const char *scriptName, const char *eventName) { +bool AdGame::startDlgBranch(const char *branchName, const char *scriptName, const char *eventName) { char *name = new char[strlen(branchName) + 1 + strlen(scriptName) + 1 + strlen(eventName) + 1]; if (name) { sprintf(name, "%s.%s.%s", branchName, scriptName, eventName); @@ -1536,7 +1536,7 @@ bool CAdGame::startDlgBranch(const char *branchName, const char *scriptName, con ////////////////////////////////////////////////////////////////////////// -bool CAdGame::endDlgBranch(const char *branchName, const char *scriptName, const char *eventName) { +bool AdGame::endDlgBranch(const char *branchName, const char *scriptName, const char *eventName) { char *name = NULL; bool deleteName = false; if (branchName == NULL && _dlgPendingBranches.getSize() > 0) { @@ -1583,7 +1583,7 @@ bool CAdGame::endDlgBranch(const char *branchName, const char *scriptName, const ////////////////////////////////////////////////////////////////////////// -bool CAdGame::clearBranchResponses(char *name) { +bool AdGame::clearBranchResponses(char *name) { for (int i = 0; i < _responsesBranch.getSize(); i++) { if (scumm_stricmp(name, _responsesBranch[i]->_context) == 0) { delete _responsesBranch[i]; @@ -1596,9 +1596,9 @@ bool CAdGame::clearBranchResponses(char *name) { ////////////////////////////////////////////////////////////////////////// -bool CAdGame::addBranchResponse(int ID) { +bool AdGame::addBranchResponse(int ID) { if (branchResponseUsed(ID)) return STATUS_OK; - CAdResponseContext *r = new CAdResponseContext(_gameRef); + AdResponseContext *r = new AdResponseContext(_gameRef); r->_iD = ID; r->setContext(_dlgPendingBranches.getSize() > 0 ? _dlgPendingBranches[_dlgPendingBranches.getSize() - 1] : NULL); _responsesBranch.add(r); @@ -1607,7 +1607,7 @@ bool CAdGame::addBranchResponse(int ID) { ////////////////////////////////////////////////////////////////////////// -bool CAdGame::branchResponseUsed(int ID) { +bool AdGame::branchResponseUsed(int ID) { char *Context = _dlgPendingBranches.getSize() > 0 ? _dlgPendingBranches[_dlgPendingBranches.getSize() - 1] : NULL; for (int i = 0; i < _responsesBranch.getSize(); i++) { if (_responsesBranch[i]->_iD == ID) { @@ -1619,9 +1619,9 @@ bool CAdGame::branchResponseUsed(int ID) { ////////////////////////////////////////////////////////////////////////// -bool CAdGame::addGameResponse(int ID) { +bool AdGame::addGameResponse(int ID) { if (gameResponseUsed(ID)) return STATUS_OK; - CAdResponseContext *r = new CAdResponseContext(_gameRef); + AdResponseContext *r = new AdResponseContext(_gameRef); r->_iD = ID; r->setContext(_dlgPendingBranches.getSize() > 0 ? _dlgPendingBranches[_dlgPendingBranches.getSize() - 1] : NULL); _responsesGame.add(r); @@ -1630,10 +1630,10 @@ bool CAdGame::addGameResponse(int ID) { ////////////////////////////////////////////////////////////////////////// -bool CAdGame::gameResponseUsed(int ID) { +bool AdGame::gameResponseUsed(int ID) { char *Context = _dlgPendingBranches.getSize() > 0 ? _dlgPendingBranches[_dlgPendingBranches.getSize() - 1] : NULL; for (int i = 0; i < _responsesGame.getSize(); i++) { - CAdResponseContext *RespContext = _responsesGame[i]; + AdResponseContext *RespContext = _responsesGame[i]; if (RespContext->_iD == ID) { if ((Context == NULL && RespContext->_context == NULL) || ((Context != NULL && RespContext->_context != NULL) && scumm_stricmp(Context, RespContext->_context) == 0)) return true; } @@ -1643,7 +1643,7 @@ bool CAdGame::gameResponseUsed(int ID) { ////////////////////////////////////////////////////////////////////////// -bool CAdGame::resetResponse(int ID) { +bool AdGame::resetResponse(int ID) { char *Context = _dlgPendingBranches.getSize() > 0 ? _dlgPendingBranches[_dlgPendingBranches.getSize() - 1] : NULL; int i; @@ -1672,7 +1672,7 @@ bool CAdGame::resetResponse(int ID) { ////////////////////////////////////////////////////////////////////////// -bool CAdGame::displayContent(bool doUpdate, bool displayAll) { +bool AdGame::displayContent(bool doUpdate, bool displayAll) { // init if (doUpdate) initLoop(); @@ -1740,7 +1740,7 @@ bool CAdGame::displayContent(bool doUpdate, bool displayAll) { } ////////////////////////////////////////////////////////////////////////// -bool CAdGame::registerInventory(CAdInventory *inv) { +bool AdGame::registerInventory(AdInventory *inv) { for (int i = 0; i < _inventories.getSize(); i++) { if (_inventories[i] == inv) return STATUS_OK; } @@ -1751,7 +1751,7 @@ bool CAdGame::registerInventory(CAdInventory *inv) { } ////////////////////////////////////////////////////////////////////////// -bool CAdGame::unregisterInventory(CAdInventory *inv) { +bool AdGame::unregisterInventory(AdInventory *inv) { for (int i = 0; i < _inventories.getSize(); i++) { if (_inventories[i] == inv) { unregisterObject(_inventories[i]); @@ -1763,9 +1763,9 @@ bool CAdGame::unregisterInventory(CAdInventory *inv) { } ////////////////////////////////////////////////////////////////////////// -bool CAdGame::isItemTaken(char *itemName) { +bool AdGame::isItemTaken(char *itemName) { for (int i = 0; i < _inventories.getSize(); i++) { - CAdInventory *Inv = _inventories[i]; + AdInventory *Inv = _inventories[i]; for (int j = 0; j < Inv->_takenItems.getSize(); j++) { if (scumm_stricmp(itemName, Inv->_takenItems[j]->_name) == 0) { @@ -1777,7 +1777,7 @@ bool CAdGame::isItemTaken(char *itemName) { } ////////////////////////////////////////////////////////////////////////// -CAdItem *CAdGame::getItemByName(const char *name) { +AdItem *AdGame::getItemByName(const char *name) { for (int i = 0; i < _items.getSize(); i++) { if (scumm_stricmp(_items[i]->_name, name) == 0) return _items[i]; } @@ -1786,14 +1786,14 @@ CAdItem *CAdGame::getItemByName(const char *name) { ////////////////////////////////////////////////////////////////////////// -bool CAdGame::addItem(CAdItem *item) { +bool AdGame::addItem(AdItem *item) { _items.add(item); return _gameRef->registerObject(item); } ////////////////////////////////////////////////////////////////////////// -bool CAdGame::resetContent() { +bool AdGame::resetContent() { // clear pending dialogs for (int i = 0; i < _dlgPendingBranches.getSize(); i++) { delete [] _dlgPendingBranches[i]; @@ -1823,12 +1823,12 @@ bool CAdGame::resetContent() { _tempDisableSaveState = true; - return CBGame::resetContent(); + return BaseGame::resetContent(); } ////////////////////////////////////////////////////////////////////////// -bool CAdGame::deleteItem(CAdItem *item) { +bool AdGame::deleteItem(AdItem *item) { if (!item) return STATUS_FAILED; if (_selectedItem == item) _selectedItem = NULL; @@ -1853,7 +1853,7 @@ bool CAdGame::deleteItem(CAdItem *item) { ////////////////////////////////////////////////////////////////////////// -bool CAdGame::addSpeechDir(const char *dir) { +bool AdGame::addSpeechDir(const char *dir) { if (!dir || dir[0] == '\0') return STATUS_FAILED; char *temp = new char[strlen(dir) + 2]; @@ -1874,7 +1874,7 @@ bool CAdGame::addSpeechDir(const char *dir) { ////////////////////////////////////////////////////////////////////////// -bool CAdGame::removeSpeechDir(const char *dir) { +bool AdGame::removeSpeechDir(const char *dir) { if (!dir || dir[0] == '\0') return STATUS_FAILED; char *temp = new char[strlen(dir) + 2]; @@ -1899,7 +1899,7 @@ bool CAdGame::removeSpeechDir(const char *dir) { ////////////////////////////////////////////////////////////////////////// -char *CAdGame::findSpeechFile(char *stringID) { +char *AdGame::findSpeechFile(char *stringID) { char *ret = new char[MAX_PATH_LENGTH]; for (int i = 0; i < _speechDirs.getSize(); i++) { @@ -1923,15 +1923,15 @@ char *CAdGame::findSpeechFile(char *stringID) { ////////////////////////////////////////////////////////////////////////// -bool CAdGame::validMouse() { +bool AdGame::validMouse() { Point32 pos; - CBPlatform::getCursorPos(&pos); + BasePlatform::getCursorPos(&pos); return _renderer->pointInViewport(&pos); } ////////////////////////////////////////////////////////////////////////// -bool CAdGame::onMouseLeftDown() { +bool AdGame::onMouseLeftDown() { if (!validMouse()) return STATUS_OK; if (_state == GAME_RUNNING && !_interactive) { if (_talkSkipButton == TALK_SKIP_LEFT || _talkSkipButton == TALK_SKIP_BOTH) { @@ -1953,16 +1953,16 @@ bool CAdGame::onMouseLeftDown() { if (_activeObject != NULL) _gameRef->_capturedObject = _gameRef->_activeObject; _mouseLeftDown = true; - CBPlatform::setCapture(/*_renderer->_window*/); + BasePlatform::setCapture(/*_renderer->_window*/); return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CAdGame::onMouseLeftUp() { +bool AdGame::onMouseLeftUp() { if (_activeObject) _activeObject->handleMouse(MOUSE_RELEASE, MOUSE_BUTTON_LEFT); - CBPlatform::releaseCapture(); + BasePlatform::releaseCapture(); _capturedObject = NULL; _mouseLeftDown = false; @@ -1978,7 +1978,7 @@ bool CAdGame::onMouseLeftUp() { } ////////////////////////////////////////////////////////////////////////// -bool CAdGame::onMouseLeftDblClick() { +bool AdGame::onMouseLeftDblClick() { if (!validMouse()) return STATUS_OK; if (_state == GAME_RUNNING && !_interactive) return STATUS_OK; @@ -1997,7 +1997,7 @@ bool CAdGame::onMouseLeftDblClick() { } ////////////////////////////////////////////////////////////////////////// -bool CAdGame::onMouseRightDown() { +bool AdGame::onMouseRightDown() { if (!validMouse()) return STATUS_OK; if (_state == GAME_RUNNING && !_interactive) { if (_talkSkipButton == TALK_SKIP_RIGHT || _talkSkipButton == TALK_SKIP_BOTH) { @@ -2022,7 +2022,7 @@ bool CAdGame::onMouseRightDown() { } ////////////////////////////////////////////////////////////////////////// -bool CAdGame::onMouseRightUp() { +bool AdGame::onMouseRightUp() { if (_activeObject) _activeObject->handleMouse(MOUSE_RELEASE, MOUSE_BUTTON_RIGHT); bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("RightRelease")); @@ -2037,7 +2037,7 @@ bool CAdGame::onMouseRightUp() { } ////////////////////////////////////////////////////////////////////////// -bool CAdGame::displayDebugInfo() { +bool AdGame::displayDebugInfo() { char str[100]; if (_gameRef->_debugDebugMode) { sprintf(str, "Mouse: %d, %d (scene: %d, %d)", _mousePos.x, _mousePos.y, _mousePos.x + _scene->getOffsetLeft(), _mousePos.y + _scene->getOffsetTop()); @@ -2046,12 +2046,12 @@ bool CAdGame::displayDebugInfo() { sprintf(str, "Scene: %s (prev: %s)", (_scene && _scene->_name) ? _scene->_name : "???", _prevSceneName ? _prevSceneName : "???"); _systemFont->drawText((byte *)str, 0, 110, _renderer->_width, TAL_RIGHT); } - return CBGame::displayDebugInfo(); + return BaseGame::displayDebugInfo(); } ////////////////////////////////////////////////////////////////////////// -bool CAdGame::onScriptShutdown(CScScript *script) { +bool AdGame::onScriptShutdown(ScScript *script) { if (_responseBox && _responseBox->_waitingScript == script) _responseBox->_waitingScript = NULL; diff --git a/engines/wintermute/ad/ad_game.h b/engines/wintermute/ad/ad_game.h index 09b3e09df0..b52fd2832f 100644 --- a/engines/wintermute/ad/ad_game.h +++ b/engines/wintermute/ad/ad_game.h @@ -32,19 +32,19 @@ #include "engines/wintermute/base/base_game.h" namespace WinterMute { -class CAdItem; -class CAdInventory; -class CAdSceneState; -class CAdScene; -class CAdItem; -class CAdObject; -class CAdSentence; -class CAdInventoryBox; -class CAdResponseContext; -class CAdResponseBox; -class CAdGame : public CBGame { +class AdItem; +class AdInventory; +class AdSceneState; +class AdScene; +class AdItem; +class AdObject; +class AdSentence; +class AdInventoryBox; +class AdResponseContext; +class AdResponseBox; +class AdGame : public BaseGame { public: - virtual bool onScriptShutdown(CScScript *script); + virtual bool onScriptShutdown(ScScript *script); virtual bool onMouseLeftDown(); virtual bool onMouseLeftUp(); @@ -60,25 +60,25 @@ public: bool _smartItemCursor; - CBArray _speechDirs; + BaseArray _speechDirs; bool addSpeechDir(const char *dir); bool removeSpeechDir(const char *dir); char *findSpeechFile(char *StringID); - bool deleteItem(CAdItem *Item); + bool deleteItem(AdItem *Item); char *_itemsFile; bool _tempDisableSaveState; virtual bool resetContent(); - bool addItem(CAdItem *item); - CAdItem *getItemByName(const char *name); - CBArray _items; - CAdObject *_inventoryOwner; + bool addItem(AdItem *item); + AdItem *getItemByName(const char *name); + BaseArray _items; + AdObject *_inventoryOwner; bool isItemTaken(char *itemName); - bool registerInventory(CAdInventory *inv); - bool unregisterInventory(CAdInventory *inv); + bool registerInventory(AdInventory *inv); + bool unregisterInventory(AdInventory *inv); - CAdObject *_invObject; - CBArray _inventories; + AdObject *_invObject; + BaseArray _inventories; virtual bool displayContent(bool update = true, bool displayAll = false); char *_debugStartupScene; char *_startupScene; @@ -92,11 +92,11 @@ public: bool clearBranchResponses(char *name); bool startDlgBranch(const char *branchName, const char *scriptName, const char *eventName); bool endDlgBranch(const char *branchName, const char *scriptName, const char *eventName); - virtual bool windowLoadHook(CUIWindow *win, char **buf, char **params); - virtual bool windowScriptMethodHook(CUIWindow *win, CScScript *script, CScStack *stack, const char *name); + virtual bool windowLoadHook(UIWindow *win, char **buf, char **params); + virtual bool windowScriptMethodHook(UIWindow *win, ScScript *script, ScStack *stack, const char *name); - CAdSceneState *getSceneState(const char *filename, bool saving); - CBViewport *_sceneViewport; + AdSceneState *getSceneState(const char *filename, bool saving); + BaseViewport *_sceneViewport; int _texItemLifeTime; int _texWalkLifeTime; int _texStandLifeTime; @@ -113,32 +113,32 @@ public: char *_prevSceneName; char *_prevSceneFilename; virtual bool loadGame(const char *filename); - CAdItem *_selectedItem; + AdItem *_selectedItem; bool cleanup(); - DECLARE_PERSISTENT(CAdGame, CBGame) + DECLARE_PERSISTENT(AdGame, BaseGame) void finishSentences(); bool showCursor(); TGameStateEx _stateEx; - CAdResponseBox *_responseBox; - CAdInventoryBox *_inventoryBox; + AdResponseBox *_responseBox; + AdInventoryBox *_inventoryBox; bool displaySentences(bool frozen); - void addSentence(CAdSentence *sentence); + void addSentence(AdSentence *sentence); bool changeScene(const char *filename, bool fadeIn); - bool removeObject(CAdObject *object); - bool addObject(CAdObject *object); - CAdScene *_scene; + bool removeObject(AdObject *object); + bool addObject(AdObject *object); + AdScene *_scene; bool initLoop(); - CAdGame(); - virtual ~CAdGame(); - CBArray _objects; - CBArray _sentences; + AdGame(); + virtual ~AdGame(); + BaseArray _objects; + BaseArray _sentences; - CBArray _sceneStates; - CBArray _dlgPendingBranches; + BaseArray _sceneStates; + BaseArray _dlgPendingBranches; - CBArray _responsesBranch; - CBArray _responsesGame; + BaseArray _responsesBranch; + BaseArray _responsesGame; virtual bool loadFile(const char *filename); virtual bool loadBuffer(byte *buffer, bool complete = true); @@ -147,12 +147,12 @@ public: bool loadItemsBuffer(byte *buffer, bool merge = false); - virtual bool ExternalCall(CScScript *script, CScStack *stack, CScStack *thisStack, char *name); + virtual bool ExternalCall(ScScript *script, ScStack *stack, ScStack *thisStack, char *name); // scripting interface - virtual CScValue *scGetProperty(const char *name); - virtual bool scSetProperty(const char *name, CScValue *value); - virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual ScValue *scGetProperty(const char *name); + virtual bool scSetProperty(const char *name, ScValue *value); + virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); bool validMouse(); }; diff --git a/engines/wintermute/ad/ad_inventory.cpp b/engines/wintermute/ad/ad_inventory.cpp index cfbc9e5029..fd56eef419 100644 --- a/engines/wintermute/ad/ad_inventory.cpp +++ b/engines/wintermute/ad/ad_inventory.cpp @@ -34,25 +34,25 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CAdInventory, false) +IMPLEMENT_PERSISTENT(AdInventory, false) ////////////////////////////////////////////////////////////////////////// -CAdInventory::CAdInventory(CBGame *inGame): CBObject(inGame) { +AdInventory::AdInventory(BaseGame *inGame): BaseObject(inGame) { _scrollOffset = 0; } ////////////////////////////////////////////////////////////////////////// -CAdInventory::~CAdInventory() { +AdInventory::~AdInventory() { _takenItems.removeAll(); // ref only } ////////////////////////////////////////////////////////////////////////// -bool CAdInventory::insertItem(const char *name, const char *insertAfter) { +bool AdInventory::insertItem(const char *name, const char *insertAfter) { if (name == NULL) return STATUS_FAILED; - CAdItem *item = ((CAdGame *)_gameRef)->getItemByName(name); + AdItem *item = ((AdGame *)_gameRef)->getItemByName(name); if (item == NULL) return STATUS_FAILED; int insertIndex = -1; @@ -74,12 +74,12 @@ bool CAdInventory::insertItem(const char *name, const char *insertAfter) { ////////////////////////////////////////////////////////////////////////// -bool CAdInventory::removeItem(const char *name) { +bool AdInventory::removeItem(const char *name) { if (name == NULL) return STATUS_FAILED; for (int i = 0; i < _takenItems.getSize(); i++) { if (scumm_stricmp(_takenItems[i]->_name, name) == 0) { - if (((CAdGame *)_gameRef)->_selectedItem == _takenItems[i])((CAdGame *)_gameRef)->_selectedItem = NULL; + if (((AdGame *)_gameRef)->_selectedItem == _takenItems[i])((AdGame *)_gameRef)->_selectedItem = NULL; _takenItems.removeAt(i); return STATUS_OK; } @@ -91,12 +91,12 @@ bool CAdInventory::removeItem(const char *name) { ////////////////////////////////////////////////////////////////////////// -bool CAdInventory::removeItem(CAdItem *item) { +bool AdInventory::removeItem(AdItem *item) { if (item == NULL) return STATUS_FAILED; for (int i = 0; i < _takenItems.getSize(); i++) { if (_takenItems[i] == item) { - if (((CAdGame *)_gameRef)->_selectedItem == _takenItems[i])((CAdGame *)_gameRef)->_selectedItem = NULL; + if (((AdGame *)_gameRef)->_selectedItem == _takenItems[i])((AdGame *)_gameRef)->_selectedItem = NULL; _takenItems.removeAt(i); return STATUS_OK; } @@ -106,9 +106,9 @@ bool CAdInventory::removeItem(CAdItem *item) { } ////////////////////////////////////////////////////////////////////////// -bool CAdInventory::persist(CBPersistMgr *persistMgr) { +bool AdInventory::persist(BasePersistenceManager *persistMgr) { - CBObject::persist(persistMgr); + BaseObject::persist(persistMgr); _takenItems.persist(persistMgr); persistMgr->transfer(TMEMBER(_scrollOffset)); diff --git a/engines/wintermute/ad/ad_inventory.h b/engines/wintermute/ad/ad_inventory.h index 84d9308d5d..6f7537633d 100644 --- a/engines/wintermute/ad/ad_inventory.h +++ b/engines/wintermute/ad/ad_inventory.h @@ -33,17 +33,17 @@ namespace WinterMute { -class CAdItem; +class AdItem; -class CAdInventory : public CBObject { +class AdInventory : public BaseObject { public: - DECLARE_PERSISTENT(CAdInventory, CBObject) + DECLARE_PERSISTENT(AdInventory, BaseObject) bool removeItem(const char *name); - bool removeItem(CAdItem *Item); + bool removeItem(AdItem *Item); bool insertItem(const char *name, const char *insertAfter = NULL); - CAdInventory(CBGame *inGame); - virtual ~CAdInventory(); - CBArray _takenItems; + AdInventory(BaseGame *inGame); + virtual ~AdInventory(); + BaseArray _takenItems; int _scrollOffset; }; diff --git a/engines/wintermute/ad/ad_inventory_box.cpp b/engines/wintermute/ad/ad_inventory_box.cpp index abe8676376..f835dd22d4 100644 --- a/engines/wintermute/ad/ad_inventory_box.cpp +++ b/engines/wintermute/ad/ad_inventory_box.cpp @@ -43,10 +43,10 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CAdInventoryBox, false) +IMPLEMENT_PERSISTENT(AdInventoryBox, false) ////////////////////////////////////////////////////////////////////////// -CAdInventoryBox::CAdInventoryBox(CBGame *inGame): CBObject(inGame) { +AdInventoryBox::AdInventoryBox(BaseGame *inGame): BaseObject(inGame) { _itemsArea.setEmpty(); _scrollOffset = 0; _spacing = 0; @@ -64,7 +64,7 @@ CAdInventoryBox::CAdInventoryBox(CBGame *inGame): CBObject(inGame) { ////////////////////////////////////////////////////////////////////////// -CAdInventoryBox::~CAdInventoryBox() { +AdInventoryBox::~AdInventoryBox() { _gameRef->unregisterObject(_window); _window = NULL; @@ -74,8 +74,8 @@ CAdInventoryBox::~CAdInventoryBox() { ////////////////////////////////////////////////////////////////////////// -bool CAdInventoryBox::listen(CBScriptHolder *param1, uint32 param2) { - CUIObject *obj = (CUIObject *)param1; +bool AdInventoryBox::listen(BaseScriptHolder *param1, uint32 param2) { + UIObject *obj = (UIObject *)param1; switch (obj->_type) { case UI_BUTTON: @@ -86,10 +86,10 @@ bool CAdInventoryBox::listen(CBScriptHolder *param1, uint32 param2) { _scrollOffset = MAX(_scrollOffset, 0); } else if (scumm_stricmp(obj->_name, "next") == 0) { _scrollOffset += _scrollBy; - } else return CBObject::listen(param1, param2); + } else return BaseObject::listen(param1, param2); break; default: - error("CAdInventoryBox::Listen - Unhandled enum"); + error("AdInventoryBox::Listen - Unhandled enum"); break; } @@ -98,8 +98,8 @@ bool CAdInventoryBox::listen(CBScriptHolder *param1, uint32 param2) { ////////////////////////////////////////////////////////////////////////// -bool CAdInventoryBox::display() { - CAdGame *adGame = (CAdGame *)_gameRef; +bool AdInventoryBox::display() { + AdGame *adGame = (AdGame *)_gameRef; if (!_visible) return STATUS_OK; @@ -137,8 +137,8 @@ bool CAdInventoryBox::display() { for (int i = 0; i < itemsX; i++) { int itemIndex = _scrollOffset + j * itemsX + i; if (itemIndex >= 0 && itemIndex < adGame->_inventoryOwner->getInventory()->_takenItems.getSize()) { - CAdItem *item = adGame->_inventoryOwner->getInventory()->_takenItems[itemIndex]; - if (item != ((CAdGame *)_gameRef)->_selectedItem || !_hideSelected) { + AdItem *item = adGame->_inventoryOwner->getInventory()->_takenItems[itemIndex]; + if (item != ((AdGame *)_gameRef)->_selectedItem || !_hideSelected) { item->update(); item->display(xxx, yyy); } @@ -155,10 +155,10 @@ bool CAdInventoryBox::display() { ////////////////////////////////////////////////////////////////////////// -bool CAdInventoryBox::loadFile(const char *filename) { +bool AdInventoryBox::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { - _gameRef->LOG(0, "CAdInventoryBox::LoadFile failed for file '%s'", filename); + _gameRef->LOG(0, "AdInventoryBox::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -193,7 +193,7 @@ TOKEN_DEF(HIDE_SELECTED) TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -bool CAdInventoryBox::loadBuffer(byte *buffer, bool complete) { +bool AdInventoryBox::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(INVENTORY_BOX) TOKEN_TABLE(TEMPLATE) @@ -213,7 +213,7 @@ bool CAdInventoryBox::loadBuffer(byte *buffer, bool complete) { byte *params; int cmd = 2; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); bool always_visible = false; _exclusive = false; @@ -241,7 +241,7 @@ bool CAdInventoryBox::loadBuffer(byte *buffer, bool complete) { case TOKEN_WINDOW: delete _window; - _window = new CUIWindow(_gameRef); + _window = new UIWindow(_gameRef); if (!_window || DID_FAIL(_window->loadBuffer(params, false))) { delete _window; _window = NULL; @@ -297,7 +297,7 @@ bool CAdInventoryBox::loadBuffer(byte *buffer, bool complete) { if (_exclusive) { delete _closeButton; - _closeButton = new CUIButton(_gameRef); + _closeButton = new UIButton(_gameRef); if (_closeButton) { _closeButton->setName("close"); _closeButton->setListener(this, _closeButton, 0); @@ -318,7 +318,7 @@ bool CAdInventoryBox::loadBuffer(byte *buffer, bool complete) { } ////////////////////////////////////////////////////////////////////////// -bool CAdInventoryBox::saveAsText(CBDynBuffer *buffer, int indent) { +bool AdInventoryBox::saveAsText(BaseDynamicBuffer *buffer, int indent) { buffer->putTextIndent(indent, "INVENTORY_BOX\n"); buffer->putTextIndent(indent, "{\n"); @@ -343,7 +343,7 @@ bool CAdInventoryBox::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent + 2, "\n"); // editor properties - CBBase::saveAsText(buffer, indent + 2); + BaseClass::saveAsText(buffer, indent + 2); buffer->putTextIndent(indent, "}\n"); return STATUS_OK; @@ -351,8 +351,8 @@ bool CAdInventoryBox::saveAsText(CBDynBuffer *buffer, int indent) { ////////////////////////////////////////////////////////////////////////// -bool CAdInventoryBox::persist(CBPersistMgr *persistMgr) { - CBObject::persist(persistMgr); +bool AdInventoryBox::persist(BasePersistenceManager *persistMgr) { + BaseObject::persist(persistMgr); persistMgr->transfer(TMEMBER(_closeButton)); persistMgr->transfer(TMEMBER(_hideSelected)); diff --git a/engines/wintermute/ad/ad_inventory_box.h b/engines/wintermute/ad/ad_inventory_box.h index 09d3ef409e..dfbf62be9a 100644 --- a/engines/wintermute/ad/ad_inventory_box.h +++ b/engines/wintermute/ad/ad_inventory_box.h @@ -33,30 +33,30 @@ #include "common/rect.h" namespace WinterMute { -class CUIButton; -class CUIWindow; +class UIButton; +class UIWindow; -class CAdInventoryBox : public CBObject { +class AdInventoryBox : public BaseObject { public: bool _hideSelected; - DECLARE_PERSISTENT(CAdInventoryBox, CBObject) + DECLARE_PERSISTENT(AdInventoryBox, BaseObject) bool _exclusive; int _scrollBy; int _itemHeight; int _itemWidth; bool _visible; virtual bool display(); - CUIButton *_closeButton; + UIButton *_closeButton; int _spacing; int _scrollOffset; Rect32 _itemsArea; - bool listen(CBScriptHolder *param1, uint32 param2); - CUIWindow *_window; - CAdInventoryBox(CBGame *inGame); - virtual ~CAdInventoryBox(); + bool listen(BaseScriptHolder *param1, uint32 param2); + UIWindow *_window; + AdInventoryBox(BaseGame *inGame); + virtual ~AdInventoryBox(); bool loadFile(const char *filename); bool loadBuffer(byte *buffer, bool complete = true); - virtual bool saveAsText(CBDynBuffer *buffer, int indent); + virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent); }; } // end of namespace WinterMute diff --git a/engines/wintermute/ad/ad_item.cpp b/engines/wintermute/ad/ad_item.cpp index 9c49a86bcb..781b924513 100644 --- a/engines/wintermute/ad/ad_item.cpp +++ b/engines/wintermute/ad/ad_item.cpp @@ -46,10 +46,10 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CAdItem, false) +IMPLEMENT_PERSISTENT(AdItem, false) ////////////////////////////////////////////////////////////////////////// -CAdItem::CAdItem(CBGame *inGame): CAdTalkHolder(inGame) { +AdItem::AdItem(BaseGame *inGame): AdTalkHolder(inGame) { _spriteHover = NULL; _cursorNormal = _cursorHover = NULL; @@ -70,7 +70,7 @@ CAdItem::CAdItem(CBGame *inGame): CAdTalkHolder(inGame) { ////////////////////////////////////////////////////////////////////////// -CAdItem::~CAdItem() { +AdItem::~AdItem() { delete _spriteHover; delete _cursorNormal; delete _cursorHover; @@ -84,10 +84,10 @@ CAdItem::~CAdItem() { ////////////////////////////////////////////////////////////////////////// -bool CAdItem::loadFile(const char *filename) { +bool AdItem::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { - _gameRef->LOG(0, "CAdItem::LoadFile failed for file '%s'", filename); + _gameRef->LOG(0, "AdItem::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -134,7 +134,7 @@ TOKEN_DEF(AMOUNT_STRING) TOKEN_DEF(AMOUNT) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -bool CAdItem::loadBuffer(byte *buffer, bool complete) { +bool AdItem::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(ITEM) TOKEN_TABLE(TEMPLATE) @@ -166,7 +166,7 @@ bool CAdItem::loadBuffer(byte *buffer, bool complete) { byte *params; int cmd = 2; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); if (complete) { if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_ITEM) { @@ -198,8 +198,8 @@ bool CAdItem::loadBuffer(byte *buffer, bool complete) { case TOKEN_IMAGE: case TOKEN_SPRITE: delete _sprite; - _sprite = new CBSprite(_gameRef, this); - if (!_sprite || DID_FAIL(_sprite->loadFile((char *)params, ((CAdGame *)_gameRef)->_texItemLifeTime))) { + _sprite = new BaseSprite(_gameRef, this); + if (!_sprite || DID_FAIL(_sprite->loadFile((char *)params, ((AdGame *)_gameRef)->_texItemLifeTime))) { delete _sprite; cmd = PARSERR_GENERIC; } @@ -208,8 +208,8 @@ bool CAdItem::loadBuffer(byte *buffer, bool complete) { case TOKEN_IMAGE_HOVER: case TOKEN_SPRITE_HOVER: delete _spriteHover; - _spriteHover = new CBSprite(_gameRef, this); - if (!_spriteHover || DID_FAIL(_spriteHover->loadFile((char *)params, ((CAdGame *)_gameRef)->_texItemLifeTime))) { + _spriteHover = new BaseSprite(_gameRef, this); + if (!_spriteHover || DID_FAIL(_spriteHover->loadFile((char *)params, ((AdGame *)_gameRef)->_texItemLifeTime))) { delete _spriteHover; cmd = PARSERR_GENERIC; } @@ -238,27 +238,27 @@ bool CAdItem::loadBuffer(byte *buffer, bool complete) { break; case TOKEN_AMOUNT_STRING: - CBUtils::setString(&_amountString, (char *)params); + BaseUtils::setString(&_amountString, (char *)params); break; case TOKEN_TALK: { - CBSprite *spr = new CBSprite(_gameRef, this); - if (!spr || DID_FAIL(spr->loadFile((char *)params, ((CAdGame *)_gameRef)->_texTalkLifeTime))) cmd = PARSERR_GENERIC; + BaseSprite *spr = new BaseSprite(_gameRef, this); + if (!spr || DID_FAIL(spr->loadFile((char *)params, ((AdGame *)_gameRef)->_texTalkLifeTime))) cmd = PARSERR_GENERIC; else _talkSprites.add(spr); } break; case TOKEN_TALK_SPECIAL: { - CBSprite *spr = new CBSprite(_gameRef, this); - if (!spr || DID_FAIL(spr->loadFile((char *)params, ((CAdGame *)_gameRef)->_texTalkLifeTime))) cmd = PARSERR_GENERIC; + BaseSprite *spr = new BaseSprite(_gameRef, this); + if (!spr || DID_FAIL(spr->loadFile((char *)params, ((AdGame *)_gameRef)->_texTalkLifeTime))) cmd = PARSERR_GENERIC; else _talkSpritesEx.add(spr); } break; case TOKEN_CURSOR: delete _cursorNormal; - _cursorNormal = new CBSprite(_gameRef); - if (!_cursorNormal || DID_FAIL(_cursorNormal->loadFile((char *)params, ((CAdGame *)_gameRef)->_texItemLifeTime))) { + _cursorNormal = new BaseSprite(_gameRef); + if (!_cursorNormal || DID_FAIL(_cursorNormal->loadFile((char *)params, ((AdGame *)_gameRef)->_texItemLifeTime))) { delete _cursorNormal; _cursorNormal = NULL; cmd = PARSERR_GENERIC; @@ -267,8 +267,8 @@ bool CAdItem::loadBuffer(byte *buffer, bool complete) { case TOKEN_CURSOR_HOVER: delete _cursorHover; - _cursorHover = new CBSprite(_gameRef); - if (!_cursorHover || DID_FAIL(_cursorHover->loadFile((char *)params, ((CAdGame *)_gameRef)->_texItemLifeTime))) { + _cursorHover = new BaseSprite(_gameRef); + if (!_cursorHover || DID_FAIL(_cursorHover->loadFile((char *)params, ((AdGame *)_gameRef)->_texItemLifeTime))) { delete _cursorHover; _cursorHover = NULL; cmd = PARSERR_GENERIC; @@ -319,7 +319,7 @@ bool CAdItem::loadBuffer(byte *buffer, bool complete) { ////////////////////////////////////////////////////////////////////////// -bool CAdItem::update() { +bool AdItem::update() { _currentSprite = NULL; if (_state == STATE_READY && _animSprite) { @@ -369,11 +369,11 @@ bool CAdItem::update() { _tempSprite2->reset(); _currentSprite = _tempSprite2; } - ((CAdGame *)_gameRef)->addSentence(_sentence); + ((AdGame *)_gameRef)->addSentence(_sentence); } } else { _currentSprite = _tempSprite2; - ((CAdGame *)_gameRef)->addSentence(_sentence); + ((AdGame *)_gameRef)->addSentence(_sentence); } } default: @@ -386,7 +386,7 @@ bool CAdItem::update() { ////////////////////////////////////////////////////////////////////////// -bool CAdItem::display(int x, int y) { +bool AdItem::display(int x, int y) { int width = 0; if (_currentSprite) { Rect32 rc; @@ -412,7 +412,7 @@ bool CAdItem::display(int x, int y) { } amountX += _amountOffsetX; - CBFont *font = _font ? _font : _gameRef->_systemFont; + BaseFont *font = _font ? _font : _gameRef->_systemFont; if (font) { if (_amountString) font->drawText((byte *)_amountString, amountX, amountY, width, _amountAlign); else { @@ -430,7 +430,7 @@ bool CAdItem::display(int x, int y) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -bool CAdItem::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool AdItem::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // SetHoverSprite ////////////////////////////////////////////////////////////////////////// @@ -444,7 +444,7 @@ bool CAdItem::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSta delete _spriteHover; _spriteHover = NULL; - CBSprite *spr = new CBSprite(_gameRef, this); + BaseSprite *spr = new BaseSprite(_gameRef, this); if (!spr || DID_FAIL(spr->loadFile(filename))) { stack->pushBool(false); script->runtimeError("Item.SetHoverSprite failed for file '%s'", filename); @@ -487,7 +487,7 @@ bool CAdItem::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSta delete _cursorNormal; _cursorNormal = NULL; - CBSprite *spr = new CBSprite(_gameRef); + BaseSprite *spr = new BaseSprite(_gameRef); if (!spr || DID_FAIL(spr->loadFile(filename))) { stack->pushBool(false); script->runtimeError("Item.SetNormalCursor failed for file '%s'", filename); @@ -530,7 +530,7 @@ bool CAdItem::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSta delete _cursorHover; _cursorHover = NULL; - CBSprite *spr = new CBSprite(_gameRef); + BaseSprite *spr = new BaseSprite(_gameRef); if (!spr || DID_FAIL(spr->loadFile(filename))) { stack->pushBool(false); script->runtimeError("Item.SetHoverCursor failed for file '%s'", filename); @@ -563,12 +563,12 @@ bool CAdItem::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSta return STATUS_OK; } - else return CAdTalkHolder::scCallMethod(script, stack, thisStack, name); + else return AdTalkHolder::scCallMethod(script, stack, thisStack, name); } ////////////////////////////////////////////////////////////////////////// -CScValue *CAdItem::scGetProperty(const char *name) { +ScValue *AdItem::scGetProperty(const char *name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// @@ -644,12 +644,12 @@ CScValue *CAdItem::scGetProperty(const char *name) { return _scValue; } - else return CAdTalkHolder::scGetProperty(name); + else return AdTalkHolder::scGetProperty(name); } ////////////////////////////////////////////////////////////////////////// -bool CAdItem::scSetProperty(const char *name, CScValue *value) { +bool AdItem::scSetProperty(const char *name, ScValue *value) { ////////////////////////////////////////////////////////////////////////// // Name ////////////////////////////////////////////////////////////////////////// @@ -706,7 +706,7 @@ bool CAdItem::scSetProperty(const char *name, CScValue *value) { delete[] _amountString; _amountString = NULL; } else { - CBUtils::setString(&_amountString, value->getString()); + BaseUtils::setString(&_amountString, value->getString()); } return STATUS_OK; } @@ -719,20 +719,20 @@ bool CAdItem::scSetProperty(const char *name, CScValue *value) { return STATUS_OK; } - else return CAdTalkHolder::scSetProperty(name, value); + else return AdTalkHolder::scSetProperty(name, value); } ////////////////////////////////////////////////////////////////////////// -const char *CAdItem::scToString() { +const char *AdItem::scToString() { return "[item]"; } ////////////////////////////////////////////////////////////////////////// -bool CAdItem::persist(CBPersistMgr *persistMgr) { +bool AdItem::persist(BasePersistenceManager *persistMgr) { - CAdTalkHolder::persist(persistMgr); + AdTalkHolder::persist(persistMgr); persistMgr->transfer(TMEMBER(_cursorCombined)); persistMgr->transfer(TMEMBER(_cursorHover)); @@ -751,10 +751,10 @@ bool CAdItem::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -bool CAdItem::getExtendedFlag(const char *flagName) { +bool AdItem::getExtendedFlag(const char *flagName) { if (!flagName) return false; else if (strcmp(flagName, "usable") == 0) return true; - else return CAdObject::getExtendedFlag(flagName); + else return AdObject::getExtendedFlag(flagName); } } // end of namespace WinterMute diff --git a/engines/wintermute/ad/ad_item.h b/engines/wintermute/ad/ad_item.h index 34b19a830f..11010c2a35 100644 --- a/engines/wintermute/ad/ad_item.h +++ b/engines/wintermute/ad/ad_item.h @@ -34,7 +34,7 @@ namespace WinterMute { -class CAdItem : public CAdTalkHolder { +class AdItem : public AdTalkHolder { public: bool _displayAmount; int _amount; @@ -45,23 +45,23 @@ public: bool update(); - DECLARE_PERSISTENT(CAdItem, CAdTalkHolder) + DECLARE_PERSISTENT(AdItem, AdTalkHolder) bool display(int x, int y); bool getExtendedFlag(const char *flagName); bool _inInventory; bool _cursorCombined; - CBSprite *_spriteHover; - CBSprite *_cursorNormal; - CBSprite *_cursorHover; - CAdItem(CBGame *inGame); - virtual ~CAdItem(); + BaseSprite *_spriteHover; + BaseSprite *_cursorNormal; + BaseSprite *_cursorHover; + AdItem(BaseGame *inGame); + virtual ~AdItem(); bool loadFile(const char *filename); bool loadBuffer(byte *buffer, bool complete = true); // scripting interface - virtual CScValue *scGetProperty(const char *name); - virtual bool scSetProperty(const char *name, CScValue *value); - virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual ScValue *scGetProperty(const char *name); + virtual bool scSetProperty(const char *name, ScValue *value); + virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); virtual const char *scToString(); }; diff --git a/engines/wintermute/ad/ad_layer.cpp b/engines/wintermute/ad/ad_layer.cpp index e23948ed87..2cd7ac26ce 100644 --- a/engines/wintermute/ad/ad_layer.cpp +++ b/engines/wintermute/ad/ad_layer.cpp @@ -41,10 +41,10 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CAdLayer, false) +IMPLEMENT_PERSISTENT(AdLayer, false) ////////////////////////////////////////////////////////////////////////// -CAdLayer::CAdLayer(CBGame *inGame): CBObject(inGame) { +AdLayer::AdLayer(BaseGame *inGame): BaseObject(inGame) { _main = false; _width = _height = 0; _active = true; @@ -53,7 +53,7 @@ CAdLayer::CAdLayer(CBGame *inGame): CBObject(inGame) { ////////////////////////////////////////////////////////////////////////// -CAdLayer::~CAdLayer() { +AdLayer::~AdLayer() { for (int i = 0; i < _nodes.getSize(); i++) delete _nodes[i]; _nodes.removeAll(); @@ -61,10 +61,10 @@ CAdLayer::~CAdLayer() { ////////////////////////////////////////////////////////////////////////// -bool CAdLayer::loadFile(const char *filename) { +bool AdLayer::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { - _gameRef->LOG(0, "CAdLayer::LoadFile failed for file '%s'", filename); + _gameRef->LOG(0, "AdLayer::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -99,7 +99,7 @@ TOKEN_DEF(CLOSE_UP) TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -bool CAdLayer::loadBuffer(byte *buffer, bool complete) { +bool AdLayer::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(LAYER) TOKEN_TABLE(TEMPLATE) @@ -120,7 +120,7 @@ bool CAdLayer::loadBuffer(byte *buffer, bool complete) { byte *params; int cmd; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); if (complete) { if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_LAYER) { @@ -165,8 +165,8 @@ bool CAdLayer::loadBuffer(byte *buffer, bool complete) { break; case TOKEN_REGION: { - CAdRegion *region = new CAdRegion(_gameRef); - CAdSceneNode *node = new CAdSceneNode(_gameRef); + AdRegion *region = new AdRegion(_gameRef); + AdSceneNode *node = new AdSceneNode(_gameRef); if (!region || !node || DID_FAIL(region->loadBuffer(params, false))) { cmd = PARSERR_GENERIC; delete region; @@ -181,8 +181,8 @@ bool CAdLayer::loadBuffer(byte *buffer, bool complete) { break; case TOKEN_ENTITY: { - CAdEntity *entity = new CAdEntity(_gameRef); - CAdSceneNode *node = new CAdSceneNode(_gameRef); + AdEntity *entity = new AdEntity(_gameRef); + AdSceneNode *node = new AdSceneNode(_gameRef); if (entity) entity->_zoomable = false; // scene entites default to NOT zoom if (!entity || !node || DID_FAIL(entity->loadBuffer(params, false))) { cmd = PARSERR_GENERIC; @@ -226,13 +226,13 @@ bool CAdLayer::loadBuffer(byte *buffer, bool complete) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -bool CAdLayer::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool AdLayer::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // GetNode ////////////////////////////////////////////////////////////////////////// if (strcmp(name, "GetNode") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); int node = -1; if (val->_type == VAL_INT) node = val->getInt(); @@ -267,16 +267,16 @@ bool CAdLayer::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSt ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "AddRegion") == 0 || strcmp(name, "AddEntity") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); - CAdSceneNode *node = new CAdSceneNode(_gameRef); + AdSceneNode *node = new AdSceneNode(_gameRef); if (strcmp(name, "AddRegion") == 0) { - CAdRegion *region = new CAdRegion(_gameRef); + AdRegion *region = new AdRegion(_gameRef); if (!val->isNULL()) region->setName(val->getString()); node->setRegion(region); stack->pushNative(region, true); } else { - CAdEntity *entity = new CAdEntity(_gameRef); + AdEntity *entity = new AdEntity(_gameRef); if (!val->isNULL()) entity->setName(val->getString()); node->setEntity(entity); stack->pushNative(entity, true); @@ -291,16 +291,16 @@ bool CAdLayer::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSt else if (strcmp(name, "InsertRegion") == 0 || strcmp(name, "InsertEntity") == 0) { stack->correctParams(2); int index = stack->pop()->getInt(); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); - CAdSceneNode *node = new CAdSceneNode(_gameRef); + AdSceneNode *node = new AdSceneNode(_gameRef); if (strcmp(name, "InsertRegion") == 0) { - CAdRegion *region = new CAdRegion(_gameRef); + AdRegion *region = new AdRegion(_gameRef); if (!val->isNULL()) region->setName(val->getString()); node->setRegion(region); stack->pushNative(region, true); } else { - CAdEntity *entity = new CAdEntity(_gameRef); + AdEntity *entity = new AdEntity(_gameRef); if (!val->isNULL()) entity->setName(val->getString()); node->setEntity(entity); stack->pushNative(entity, true); @@ -317,11 +317,11 @@ bool CAdLayer::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSt ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "DeleteNode") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); - CAdSceneNode *toDelete = NULL; + AdSceneNode *toDelete = NULL; if (val->isNative()) { - CBScriptable *temp = val->getNative(); + BaseScriptable *temp = val->getNative(); for (int i = 0; i < _nodes.getSize(); i++) { if (_nodes[i]->_region == temp || _nodes[i]->_entity == temp) { toDelete = _nodes[i]; @@ -351,12 +351,12 @@ bool CAdLayer::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSt return STATUS_OK; } - else return CBObject::scCallMethod(script, stack, thisStack, name); + else return BaseObject::scCallMethod(script, stack, thisStack, name); } ////////////////////////////////////////////////////////////////////////// -CScValue *CAdLayer::scGetProperty(const char *name) { +ScValue *AdLayer::scGetProperty(const char *name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// @@ -415,12 +415,12 @@ CScValue *CAdLayer::scGetProperty(const char *name) { return _scValue; } - else return CBObject::scGetProperty(name); + else return BaseObject::scGetProperty(name); } ////////////////////////////////////////////////////////////////////////// -bool CAdLayer::scSetProperty(const char *name, CScValue *value) { +bool AdLayer::scSetProperty(const char *name, ScValue *value) { ////////////////////////////////////////////////////////////////////////// // Name ////////////////////////////////////////////////////////////////////////// @@ -466,18 +466,18 @@ bool CAdLayer::scSetProperty(const char *name, CScValue *value) { return STATUS_OK; } - else return CBObject::scSetProperty(name, value); + else return BaseObject::scSetProperty(name, value); } ////////////////////////////////////////////////////////////////////////// -const char *CAdLayer::scToString() { +const char *AdLayer::scToString() { return "[layer]"; } ////////////////////////////////////////////////////////////////////////// -bool CAdLayer::saveAsText(CBDynBuffer *buffer, int indent) { +bool AdLayer::saveAsText(BaseDynamicBuffer *buffer, int indent) { buffer->putTextIndent(indent, "LAYER {\n"); buffer->putTextIndent(indent + 2, "NAME=\"%s\"\n", _name); buffer->putTextIndent(indent + 2, "CAPTION=\"%s\"\n", getCaption()); @@ -506,12 +506,12 @@ bool CAdLayer::saveAsText(CBDynBuffer *buffer, int indent) { _nodes[i]->_region->saveAsText(buffer, indent + 2); break; default: - error("CAdLayer::SaveAsText - Unhandled enum"); + error("AdLayer::SaveAsText - Unhandled enum"); break; } } - CBBase::saveAsText(buffer, indent + 2); + BaseClass::saveAsText(buffer, indent + 2); buffer->putTextIndent(indent, "}\n\n"); @@ -520,9 +520,9 @@ bool CAdLayer::saveAsText(CBDynBuffer *buffer, int indent) { ////////////////////////////////////////////////////////////////////////// -bool CAdLayer::persist(CBPersistMgr *persistMgr) { +bool AdLayer::persist(BasePersistenceManager *persistMgr) { - CBObject::persist(persistMgr); + BaseObject::persist(persistMgr); persistMgr->transfer(TMEMBER(_active)); persistMgr->transfer(TMEMBER(_closeUp)); diff --git a/engines/wintermute/ad/ad_layer.h b/engines/wintermute/ad/ad_layer.h index 0ccdb13ae7..b76cbf1d99 100644 --- a/engines/wintermute/ad/ad_layer.h +++ b/engines/wintermute/ad/ad_layer.h @@ -30,26 +30,26 @@ #define WINTERMUTE_ADLAYER_H namespace WinterMute { -class CAdSceneNode; -class CAdLayer : public CBObject { +class AdSceneNode; +class AdLayer : public BaseObject { public: bool _closeUp; - DECLARE_PERSISTENT(CAdLayer, CBObject) + DECLARE_PERSISTENT(AdLayer, BaseObject) bool _active; int _height; int _width; bool _main; - CAdLayer(CBGame *inGame); - virtual ~CAdLayer(); - CBArray _nodes; + AdLayer(BaseGame *inGame); + virtual ~AdLayer(); + BaseArray _nodes; bool loadFile(const char *filename); bool loadBuffer(byte *buffer, bool complete = true); - virtual bool saveAsText(CBDynBuffer *buffer, int indent); + virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent); // scripting interface - virtual CScValue *scGetProperty(const char *name); - virtual bool scSetProperty(const char *name, CScValue *value); - virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual ScValue *scGetProperty(const char *name); + virtual bool scSetProperty(const char *name, ScValue *value); + virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); virtual const char *scToString(); }; diff --git a/engines/wintermute/ad/ad_node_state.cpp b/engines/wintermute/ad/ad_node_state.cpp index 06f9c4cf95..12bd275614 100644 --- a/engines/wintermute/ad/ad_node_state.cpp +++ b/engines/wintermute/ad/ad_node_state.cpp @@ -38,11 +38,11 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CAdNodeState, false) +IMPLEMENT_PERSISTENT(AdNodeState, false) ////////////////////////////////////////////////////////////////////////// -CAdNodeState::CAdNodeState(CBGame *inGame): CBBase(inGame) { +AdNodeState::AdNodeState(BaseGame *inGame): BaseClass(inGame) { _name = NULL; _active = false; for (int i = 0; i < 7; i++) _caption[i] = NULL; @@ -53,7 +53,7 @@ CAdNodeState::CAdNodeState(CBGame *inGame): CBBase(inGame) { ////////////////////////////////////////////////////////////////////////// -CAdNodeState::~CAdNodeState() { +AdNodeState::~AdNodeState() { delete[] _name; delete[] _filename; delete[] _cursor; @@ -68,31 +68,31 @@ CAdNodeState::~CAdNodeState() { ////////////////////////////////////////////////////////////////////////// -void CAdNodeState::setName(const char *name) { +void AdNodeState::setName(const char *name) { delete[] _name; _name = NULL; - CBUtils::setString(&_name, name); + BaseUtils::setString(&_name, name); } ////////////////////////////////////////////////////////////////////////// -void CAdNodeState::setFilename(const char *filename) { +void AdNodeState::setFilename(const char *filename) { delete[] _filename; _filename = NULL; - CBUtils::setString(&_filename, filename); + BaseUtils::setString(&_filename, filename); } ////////////////////////////////////////////////////////////////////////// -void CAdNodeState::setCursor(const char *filename) { +void AdNodeState::setCursor(const char *filename) { delete[] _cursor; _cursor = NULL; - CBUtils::setString(&_cursor, filename); + BaseUtils::setString(&_cursor, filename); } ////////////////////////////////////////////////////////////////////////// -bool CAdNodeState::persist(CBPersistMgr *persistMgr) { +bool AdNodeState::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_gameRef)); persistMgr->transfer(TMEMBER(_active)); @@ -107,7 +107,7 @@ bool CAdNodeState::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -void CAdNodeState::setCaption(const char *caption, int caseVal) { +void AdNodeState::setCaption(const char *caption, int caseVal) { if (caseVal== 0) caseVal= 1; if (caseVal< 1 || caseVal> 7) return; @@ -121,7 +121,7 @@ void CAdNodeState::setCaption(const char *caption, int caseVal) { ////////////////////////////////////////////////////////////////////////// -char *CAdNodeState::getCaption(int caseVal) { +char *AdNodeState::getCaption(int caseVal) { if (caseVal== 0) caseVal= 1; if (caseVal< 1 || caseVal> 7 || _caption[caseVal- 1] == NULL) return ""; else return _caption[caseVal- 1]; @@ -129,7 +129,7 @@ char *CAdNodeState::getCaption(int caseVal) { ////////////////////////////////////////////////////////////////////////// -bool CAdNodeState::transferEntity(CAdEntity *entity, bool includingSprites, bool saving) { +bool AdNodeState::transferEntity(AdEntity *entity, bool includingSprites, bool saving) { if (!entity) return STATUS_FAILED; // hack! diff --git a/engines/wintermute/ad/ad_node_state.h b/engines/wintermute/ad/ad_node_state.h index 186f2ebbb2..fc7692a1bf 100644 --- a/engines/wintermute/ad/ad_node_state.h +++ b/engines/wintermute/ad/ad_node_state.h @@ -31,17 +31,17 @@ namespace WinterMute { -class CAdEntity; +class AdEntity; -class CAdNodeState : public CBBase { +class AdNodeState : public BaseClass { public: - bool transferEntity(CAdEntity *entity, bool includingSprites, bool saving); + bool transferEntity(AdEntity *entity, bool includingSprites, bool saving); void setName(const char *name); void setFilename(const char *filename); void setCursor(const char *filename); - DECLARE_PERSISTENT(CAdNodeState, CBBase) - CAdNodeState(CBGame *inGame); - virtual ~CAdNodeState(); + DECLARE_PERSISTENT(AdNodeState, BaseClass) + AdNodeState(BaseGame *inGame); + virtual ~AdNodeState(); char *_name; bool _active; char *_caption[7]; diff --git a/engines/wintermute/ad/ad_object.cpp b/engines/wintermute/ad/ad_object.cpp index 46f2e590fd..39593c482c 100644 --- a/engines/wintermute/ad/ad_object.cpp +++ b/engines/wintermute/ad/ad_object.cpp @@ -54,10 +54,10 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CAdObject, false) +IMPLEMENT_PERSISTENT(AdObject, false) ////////////////////////////////////////////////////////////////////////// -CAdObject::CAdObject(CBGame *inGame): CBObject(inGame) { +AdObject::AdObject(BaseGame *inGame): BaseObject(inGame) { _type = OBJECT_NONE; _state = _nextState = STATE_NONE; @@ -105,7 +105,7 @@ CAdObject::CAdObject(CBGame *inGame): CBObject(inGame) { ////////////////////////////////////////////////////////////////////////// -CAdObject::~CAdObject() { +AdObject::~AdObject() { _currentSprite = NULL; // reference only, don't delete delete _animSprite; _animSprite = NULL; @@ -130,7 +130,7 @@ CAdObject::~CAdObject() { if (_font) _gameRef->_fontStorage->removeFont(_font); if (_inventory) { - ((CAdGame *)_gameRef)->unregisterInventory(_inventory); + ((AdGame *)_gameRef)->unregisterInventory(_inventory); _inventory = NULL; } @@ -151,17 +151,17 @@ CAdObject::~CAdObject() { ////////////////////////////////////////////////////////////////////////// -bool CAdObject::playAnim(const char *filename) { +bool AdObject::playAnim(const char *filename) { delete _animSprite; _animSprite = NULL; - _animSprite = new CBSprite(_gameRef, this); + _animSprite = new BaseSprite(_gameRef, this); if (!_animSprite) { - _gameRef->LOG(0, "CAdObject::PlayAnim: error creating temp sprite (object:\"%s\" sprite:\"%s\")", _name, filename); + _gameRef->LOG(0, "AdObject::PlayAnim: error creating temp sprite (object:\"%s\" sprite:\"%s\")", _name, filename); return STATUS_FAILED; } bool res = _animSprite->loadFile(filename); if (DID_FAIL(res)) { - _gameRef->LOG(res, "CAdObject::PlayAnim: error loading temp sprite (object:\"%s\" sprite:\"%s\")", _name, filename); + _gameRef->LOG(res, "AdObject::PlayAnim: error loading temp sprite (object:\"%s\" sprite:\"%s\")", _name, filename); delete _animSprite; _animSprite = NULL; return res; @@ -173,13 +173,13 @@ bool CAdObject::playAnim(const char *filename) { ////////////////////////////////////////////////////////////////////////// -bool CAdObject::display() { +bool AdObject::display() { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CAdObject::update() { +bool AdObject::update() { return STATUS_OK; } @@ -187,7 +187,7 @@ bool CAdObject::update() { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -bool CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool AdObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // PlayAnim / PlayAnimAsync @@ -257,14 +257,14 @@ bool CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS stack->correctParams(5); const char *text = stack->pop()->getString(); - CScValue *soundVal = stack->pop(); + ScValue *soundVal = stack->pop(); int duration = stack->pop()->getInt(); - CScValue *valStances = stack->pop(); + ScValue *valStances = stack->pop(); const char *stances = valStances->isNULL() ? NULL : valStances->getString(); int align = 0; - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); if (val->isNULL()) align = TAL_CENTER; else align = val->getInt(); @@ -285,11 +285,11 @@ bool CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS else if (strcmp(name, "StickToRegion") == 0) { stack->correctParams(1); - CAdLayer *main = ((CAdGame *)_gameRef)->_scene->_mainLayer; + AdLayer *main = ((AdGame *)_gameRef)->_scene->_mainLayer; bool regFound = false; int i; - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); if (val->isNULL() || !main) { _stickRegion = NULL; regFound = true; @@ -303,7 +303,7 @@ bool CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS } } } else if (val->isNative()) { - CBScriptable *obj = val->getNative(); + BaseScriptable *obj = val->getNative(); for (i = 0; i < main->_nodes.getSize(); i++) { if (main->_nodes[i]->_type == OBJECT_REGION && main->_nodes[i]->_region == obj) { @@ -325,7 +325,7 @@ bool CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "SetFont") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); if (val->isNULL()) SetFont(NULL); else SetFont(val->getString()); @@ -351,11 +351,11 @@ bool CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS stack->correctParams(2); if (!_inventory) { - _inventory = new CAdInventory(_gameRef); - ((CAdGame *)_gameRef)->registerInventory(_inventory); + _inventory = new AdInventory(_gameRef); + ((AdGame *)_gameRef)->registerInventory(_inventory); } - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); if (!val->isNULL()) { const char *itemName = val->getString(); val = stack->pop(); @@ -363,7 +363,7 @@ bool CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS if (DID_FAIL(_inventory->insertItem(itemName, insertAfter))) script->runtimeError("Cannot add item '%s' to inventory", itemName); else { // hide associated entities - ((CAdGame *)_gameRef)->_scene->handleItemAssociations(itemName, false); + ((AdGame *)_gameRef)->_scene->handleItemAssociations(itemName, false); } } else script->runtimeError("TakeItem: item name expected"); @@ -379,16 +379,16 @@ bool CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS stack->correctParams(1); if (!_inventory) { - _inventory = new CAdInventory(_gameRef); - ((CAdGame *)_gameRef)->registerInventory(_inventory); + _inventory = new AdInventory(_gameRef); + ((AdGame *)_gameRef)->registerInventory(_inventory); } - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); if (!val->isNULL()) { if (DID_FAIL(_inventory->removeItem(val->getString()))) script->runtimeError("Cannot remove item '%s' from inventory", val->getString()); else { // show associated entities - ((CAdGame *)_gameRef)->_scene->handleItemAssociations(val->getString(), true); + ((AdGame *)_gameRef)->_scene->handleItemAssociations(val->getString(), true); } } else script->runtimeError("DropItem: item name expected"); @@ -403,13 +403,13 @@ bool CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS stack->correctParams(1); if (!_inventory) { - _inventory = new CAdInventory(_gameRef); - ((CAdGame *)_gameRef)->registerInventory(_inventory); + _inventory = new AdInventory(_gameRef); + ((AdGame *)_gameRef)->registerInventory(_inventory); } - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); if (val->_type == VAL_STRING) { - CAdItem *item = ((CAdGame *)_gameRef)->getItemByName(val->getString()); + AdItem *item = ((AdGame *)_gameRef)->getItemByName(val->getString()); if (item) stack->pushNative(item, true); else stack->pushNULL(); } else if (val->isNULL() || val->getInt() < 0 || val->getInt() >= _inventory->_takenItems.getSize()) @@ -427,11 +427,11 @@ bool CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS stack->correctParams(1); if (!_inventory) { - _inventory = new CAdInventory(_gameRef); - ((CAdGame *)_gameRef)->registerInventory(_inventory); + _inventory = new AdInventory(_gameRef); + ((AdGame *)_gameRef)->registerInventory(_inventory); } - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); if (!val->isNULL()) { for (int i = 0; i < _inventory->_takenItems.getSize(); i++) { if (val->getNative() == _inventory->_takenItems[i]) { @@ -457,7 +457,7 @@ bool CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS int offsetX = stack->pop()->getInt(); int offsetY = stack->pop()->getInt(); - CPartEmitter *emitter = createParticleEmitter(followParent, offsetX, offsetY); + PartEmitter *emitter = createParticleEmitter(followParent, offsetX, offsetY); if (emitter) stack->pushNative(_partEmitter, true); else stack->pushNULL(); @@ -489,7 +489,7 @@ bool CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS int offsetY = stack->pop()->getInt(); bool res; - CAdEntity *ent = new CAdEntity(_gameRef); + AdEntity *ent = new AdEntity(_gameRef); if (DID_FAIL(res = ent->loadFile(filename))) { delete ent; ent = NULL; @@ -516,10 +516,10 @@ bool CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "RemoveAttachment") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); bool found = false; if (val->isNative()) { - CBScriptable *obj = val->getNative(); + BaseScriptable *obj = val->getNative(); for (int i = 0; i < _attachmentsPre.getSize(); i++) { if (_attachmentsPre[i] == obj) { found = true; @@ -565,9 +565,9 @@ bool CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "GetAttachment") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); - CAdObject *ret = NULL; + AdObject *ret = NULL; if (val->isInt()) { int index = val->getInt(); int currIndex = 0; @@ -603,12 +603,12 @@ bool CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS return STATUS_OK; } - else return CBObject::scCallMethod(script, stack, thisStack, name); + else return BaseObject::scCallMethod(script, stack, thisStack, name); } ////////////////////////////////////////////////////////////////////////// -CScValue *CAdObject::scGetProperty(const char *name) { +ScValue *AdObject::scGetProperty(const char *name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// @@ -710,12 +710,12 @@ CScValue *CAdObject::scGetProperty(const char *name) { } - else return CBObject::scGetProperty(name); + else return BaseObject::scGetProperty(name); } ////////////////////////////////////////////////////////////////////////// -bool CAdObject::scSetProperty(const char *name, CScValue *value) { +bool AdObject::scSetProperty(const char *name, ScValue *value) { ////////////////////////////////////////////////////////////////////////// // Active @@ -781,18 +781,18 @@ bool CAdObject::scSetProperty(const char *name, CScValue *value) { return STATUS_OK; } - else return CBObject::scSetProperty(name, value); + else return BaseObject::scSetProperty(name, value); } ////////////////////////////////////////////////////////////////////////// -const char *CAdObject::scToString() { +const char *AdObject::scToString() { return "[ad object]"; } ////////////////////////////////////////////////////////////////////////// -bool CAdObject::SetFont(const char *filename) { +bool AdObject::SetFont(const char *filename) { if (_font) _gameRef->_fontStorage->removeFont(_font); if (filename) { _font = _gameRef->_fontStorage->addFont(filename); @@ -805,17 +805,17 @@ bool CAdObject::SetFont(const char *filename) { ////////////////////////////////////////////////////////////////////////// -int CAdObject::getHeight() { +int AdObject::getHeight() { if (!_currentSprite) return 0; else { - CBFrame *frame = _currentSprite->_frames[_currentSprite->_currentFrame]; + BaseFrame *frame = _currentSprite->_frames[_currentSprite->_currentFrame]; int ret = 0; for (int i = 0; i < frame->_subframes.getSize(); i++) { ret = MAX(ret, frame->_subframes[i]->_hotspotY); } if (_zoomable) { - float zoom = ((CAdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY); + float zoom = ((AdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY); ret = (int)(ret * zoom / 100); } return ret; @@ -824,8 +824,8 @@ int CAdObject::getHeight() { ////////////////////////////////////////////////////////////////////////// -void CAdObject::talk(const char *text, const char *sound, uint32 duration, const char *stances, TTextAlign Align) { - if (!_sentence) _sentence = new CAdSentence(_gameRef); +void AdObject::talk(const char *text, const char *sound, uint32 duration, const char *stances, TTextAlign Align) { + if (!_sentence) _sentence = new AdSentence(_gameRef); if (!_sentence) return; if (_forcedTalkAnimName && _forcedTalkAnimUsed) { @@ -852,7 +852,7 @@ void CAdObject::talk(const char *text, const char *sound, uint32 duration, const if (!sound) { char *key = _gameRef->_stringTable->getKey(text); if (key) { - sound = ((CAdGame *)_gameRef)->findSpeechFile(key); + sound = ((AdGame *)_gameRef)->findSpeechFile(key); delete [] key; if (sound) deleteSound = true; @@ -861,7 +861,7 @@ void CAdObject::talk(const char *text, const char *sound, uint32 duration, const // load sound and set duration appropriately if (sound) { - CBSound *snd = new CBSound(_gameRef); + BaseSound *snd = new BaseSound(_gameRef); if (snd && DID_SUCCEED(snd->setSound(sound, Audio::Mixer::kSpeechSoundType, true))) { _sentence->setSound(snd); if (_sentence->_duration <= 0) { @@ -883,8 +883,8 @@ void CAdObject::talk(const char *text, const char *sound, uint32 duration, const y = _posY; if (!_sceneIndependent && _subtitlesModRelative) { - x -= ((CAdGame *)_gameRef)->_scene->getOffsetLeft(); - y -= ((CAdGame *)_gameRef)->_scene->getOffsetTop(); + x -= ((AdGame *)_gameRef)->_scene->getOffsetLeft(); + y -= ((AdGame *)_gameRef)->_scene->getOffsetTop(); } @@ -920,8 +920,8 @@ void CAdObject::talk(const char *text, const char *sound, uint32 duration, const if (_subtitlesModRelative) { - _sentence->_pos.x += ((CAdGame *)_gameRef)->_scene->getOffsetLeft(); - _sentence->_pos.y += ((CAdGame *)_gameRef)->_scene->getOffsetTop(); + _sentence->_pos.x += ((AdGame *)_gameRef)->_scene->getOffsetLeft(); + _sentence->_pos.y += ((AdGame *)_gameRef)->_scene->getOffsetTop(); } _sentence->_fixedPos = !_subtitlesModRelative; @@ -936,7 +936,7 @@ void CAdObject::talk(const char *text, const char *sound, uint32 duration, const ////////////////////////////////////////////////////////////////////////// -bool CAdObject::reset() { +bool AdObject::reset() { if (_state == STATE_PLAYING_ANIM && _animSprite != NULL) { delete _animSprite; _animSprite = NULL; @@ -953,8 +953,8 @@ bool CAdObject::reset() { ////////////////////////////////////////////////////////////////////////// -bool CAdObject::persist(CBPersistMgr *persistMgr) { - CBObject::persist(persistMgr); +bool AdObject::persist(BasePersistenceManager *persistMgr) { + BaseObject::persist(persistMgr); persistMgr->transfer(TMEMBER(_active)); persistMgr->transfer(TMEMBER(_blockRegion)); @@ -998,46 +998,46 @@ bool CAdObject::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -bool CAdObject::updateSounds() { +bool AdObject::updateSounds() { if (_sentence && _sentence->_sound) updateOneSound(_sentence->_sound); - return CBObject::updateSounds(); + return BaseObject::updateSounds(); } ////////////////////////////////////////////////////////////////////////// -bool CAdObject::resetSoundPan() { +bool AdObject::resetSoundPan() { if (_sentence && _sentence->_sound) { _sentence->_sound->setPan(0.0f); } - return CBObject::resetSoundPan(); + return BaseObject::resetSoundPan(); } ////////////////////////////////////////////////////////////////////////// -bool CAdObject::getExtendedFlag(const char *flagName) { +bool AdObject::getExtendedFlag(const char *flagName) { if (!flagName) return false; else if (strcmp(flagName, "usable") == 0) return true; - else return CBObject::getExtendedFlag(flagName); + else return BaseObject::getExtendedFlag(flagName); } ////////////////////////////////////////////////////////////////////////// -bool CAdObject::saveAsText(CBDynBuffer *buffer, int indent) { +bool AdObject::saveAsText(BaseDynamicBuffer *buffer, int indent) { if (_blockRegion) _blockRegion->saveAsText(buffer, indent + 2, "BLOCKED_REGION"); if (_wptGroup) _wptGroup->saveAsText(buffer, indent + 2); - CBBase::saveAsText(buffer, indent + 2); + BaseClass::saveAsText(buffer, indent + 2); return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CAdObject::updateBlockRegion() { - CAdGame *adGame = (CAdGame *)_gameRef; +bool AdObject::updateBlockRegion() { + AdGame *adGame = (AdGame *)_gameRef; if (adGame->_scene) { if (_blockRegion && _currentBlockRegion) _currentBlockRegion->mimic(_blockRegion, _zoomable ? adGame->_scene->getScaleAt(_posY) : 100.0f, _posX, _posY); @@ -1049,20 +1049,20 @@ bool CAdObject::updateBlockRegion() { } ////////////////////////////////////////////////////////////////////////// -CAdInventory *CAdObject::getInventory() { +AdInventory *AdObject::getInventory() { if (!_inventory) { - _inventory = new CAdInventory(_gameRef); - ((CAdGame *)_gameRef)->registerInventory(_inventory); + _inventory = new AdInventory(_gameRef); + ((AdGame *)_gameRef)->registerInventory(_inventory); } return _inventory; } ////////////////////////////////////////////////////////////////////////// -bool CAdObject::afterMove() { - CAdRegion *newRegions[MAX_NUM_REGIONS]; +bool AdObject::afterMove() { + AdRegion *newRegions[MAX_NUM_REGIONS]; - ((CAdGame *)_gameRef)->_scene->getRegionsAt(_posX, _posY, newRegions, MAX_NUM_REGIONS); + ((AdGame *)_gameRef)->_scene->getRegionsAt(_posX, _posY, newRegions, MAX_NUM_REGIONS); for (int i = 0; i < MAX_NUM_REGIONS; i++) { if (!newRegions[i]) break; bool regFound = false; @@ -1087,20 +1087,20 @@ bool CAdObject::afterMove() { } ////////////////////////////////////////////////////////////////////////// -bool CAdObject::invalidateCurrRegions() { +bool AdObject::invalidateCurrRegions() { for (int i = 0; i < MAX_NUM_REGIONS; i++) _currentRegions[i] = NULL; return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CAdObject::getScale(float *scaleX, float *scaleY) { +bool AdObject::getScale(float *scaleX, float *scaleY) { if (_zoomable) { if (_scaleX >= 0 || _scaleY >= 0) { *scaleX = _scaleX < 0 ? 100 : _scaleX; *scaleY = _scaleY < 0 ? 100 : _scaleY; } else if (_scale >= 0) *scaleX = *scaleY = _scale; - else *scaleX = *scaleY = ((CAdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY) + _relativeScale; + else *scaleX = *scaleY = ((AdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY) + _relativeScale; } else { *scaleX = *scaleY = 100; } @@ -1108,7 +1108,7 @@ bool CAdObject::getScale(float *scaleX, float *scaleY) { } ////////////////////////////////////////////////////////////////////////// -bool CAdObject::updateSpriteAttachments() { +bool AdObject::updateSpriteAttachments() { for (int i = 0; i < _attachmentsPre.getSize(); i++) { _attachmentsPre[i]->update(); } @@ -1119,7 +1119,7 @@ bool CAdObject::updateSpriteAttachments() { } ////////////////////////////////////////////////////////////////////////// -bool CAdObject::displaySpriteAttachments(bool preDisplay) { +bool AdObject::displaySpriteAttachments(bool preDisplay) { if (preDisplay) { for (int i = 0; i < _attachmentsPre.getSize(); i++) { displaySpriteAttachment(_attachmentsPre[i]); @@ -1133,7 +1133,7 @@ bool CAdObject::displaySpriteAttachments(bool preDisplay) { } ////////////////////////////////////////////////////////////////////////// -bool CAdObject::displaySpriteAttachment(CAdObject *attachment) { +bool AdObject::displaySpriteAttachment(AdObject *attachment) { if (!attachment->_active) return STATUS_OK; float scaleX, scaleY; @@ -1171,13 +1171,13 @@ bool CAdObject::displaySpriteAttachment(CAdObject *attachment) { } ////////////////////////////////////////////////////////////////////////// -CPartEmitter *CAdObject::createParticleEmitter(bool followParent, int offsetX, int offsetY) { +PartEmitter *AdObject::createParticleEmitter(bool followParent, int offsetX, int offsetY) { _partFollowParent = followParent; _partOffsetX = offsetX; _partOffsetY = offsetY; if (!_partEmitter) { - _partEmitter = new CPartEmitter(_gameRef, this); + _partEmitter = new PartEmitter(_gameRef, this); if (_partEmitter) { _gameRef->registerObject(_partEmitter); } @@ -1187,7 +1187,7 @@ CPartEmitter *CAdObject::createParticleEmitter(bool followParent, int offsetX, i } ////////////////////////////////////////////////////////////////////////// -bool CAdObject::updatePartEmitter() { +bool AdObject::updatePartEmitter() { if (!_partEmitter) return STATUS_FAILED; if (_partFollowParent) { diff --git a/engines/wintermute/ad/ad_object.h b/engines/wintermute/ad/ad_object.h index dd123092a3..a8da8bd820 100644 --- a/engines/wintermute/ad/ad_object.h +++ b/engines/wintermute/ad/ad_object.h @@ -34,19 +34,19 @@ namespace WinterMute { -class CAdWaypointGroup; -class CAdRegion; -class CAdSentence; -class CBFont; -class CBRegion; -class CAdInventory; +class AdWaypointGroup; +class AdRegion; +class AdSentence; +class BaseFont; +class BaseRegion; +class AdInventory; #define MAX_NUM_REGIONS 10 -class CAdObject : public CBObject { +class AdObject : public BaseObject { public: - CPartEmitter *_partEmitter; - virtual CPartEmitter *createParticleEmitter(bool followParent = false, int offsetX = 0, int offsetY = 0); + PartEmitter *_partEmitter; + virtual PartEmitter *createParticleEmitter(bool followParent = false, int offsetX = 0, int offsetY = 0); virtual bool updatePartEmitter(); bool _partFollowParent; int _partOffsetX; @@ -58,7 +58,7 @@ public: int _subtitlesModX; int _subtitlesModY; int _subtitlesWidth; - CAdRegion *_stickRegion; + AdRegion *_stickRegion; bool _sceneIndependent; bool _ignoreItems; bool updateBlockRegion(); @@ -68,51 +68,51 @@ public: virtual bool resetSoundPan(); virtual bool updateSounds(); bool reset(); - DECLARE_PERSISTENT(CAdObject, CBObject) + DECLARE_PERSISTENT(AdObject, BaseObject) virtual void talk(const char *text, const char *sound = NULL, uint32 duration = 0, const char *stances = NULL, TTextAlign align = TAL_CENTER); virtual int getHeight(); - CAdSentence *_sentence; + AdSentence *_sentence; bool SetFont(const char *filename); virtual bool update(); virtual bool display(); bool _drawn; bool _active; virtual bool playAnim(const char *filename); - CBSprite *_animSprite; - CBSprite *_currentSprite; + BaseSprite *_animSprite; + BaseSprite *_currentSprite; TObjectState _state; TObjectState _nextState; TObjectType _type; - CAdObject(CBGame *inGame); - virtual ~CAdObject(); - CBFont *_font; - CBSprite *_tempSprite2; - CBRegion *_blockRegion; - CAdWaypointGroup *_wptGroup; - CBRegion *_currentBlockRegion; - CAdWaypointGroup *_currentWptGroup; - CAdInventory *getInventory(); - - virtual bool saveAsText(CBDynBuffer *buffer, int indent); + AdObject(BaseGame *inGame); + virtual ~AdObject(); + BaseFont *_font; + BaseSprite *_tempSprite2; + BaseRegion *_blockRegion; + AdWaypointGroup *_wptGroup; + BaseRegion *_currentBlockRegion; + AdWaypointGroup *_currentWptGroup; + AdInventory *getInventory(); + + virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent); virtual bool afterMove(); - CAdRegion *_currentRegions[MAX_NUM_REGIONS]; + AdRegion *_currentRegions[MAX_NUM_REGIONS]; // scripting interface - virtual CScValue *scGetProperty(const char *name); - virtual bool scSetProperty(const char *name, CScValue *value); - virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual ScValue *scGetProperty(const char *name); + virtual bool scSetProperty(const char *name, ScValue *value); + virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); virtual const char *scToString(); - CBArray _attachmentsPre; - CBArray _attachmentsPost; + BaseArray _attachmentsPre; + BaseArray _attachmentsPost; bool updateSpriteAttachments(); bool displaySpriteAttachments(bool preDisplay); - CAdObject *_registerAlias; + AdObject *_registerAlias; private: - bool displaySpriteAttachment(CAdObject *attachment); - CAdInventory *_inventory; + bool displaySpriteAttachment(AdObject *attachment); + AdInventory *_inventory; protected: bool getScale(float *scaleX, float *scaleY); diff --git a/engines/wintermute/ad/ad_path.cpp b/engines/wintermute/ad/ad_path.cpp index 780912ce08..cecfaa37d6 100644 --- a/engines/wintermute/ad/ad_path.cpp +++ b/engines/wintermute/ad/ad_path.cpp @@ -32,23 +32,23 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CAdPath, false) +IMPLEMENT_PERSISTENT(AdPath, false) ////////////////////////////////////////////////////////////////////////// -CAdPath::CAdPath(CBGame *inGame): CBBase(inGame) { +AdPath::AdPath(BaseGame *inGame): BaseClass(inGame) { _currIndex = -1; _ready = false; } ////////////////////////////////////////////////////////////////////////// -CAdPath::~CAdPath() { +AdPath::~AdPath() { reset(); } ////////////////////////////////////////////////////////////////////////// -void CAdPath::reset() { +void AdPath::reset() { for (int i = 0; i < _points.getSize(); i++) delete _points[i]; @@ -59,7 +59,7 @@ void CAdPath::reset() { ////////////////////////////////////////////////////////////////////////// -CBPoint *CAdPath::getFirst() { +BasePoint *AdPath::getFirst() { if (_points.getSize() > 0) { _currIndex = 0; return _points[_currIndex]; @@ -68,7 +68,7 @@ CBPoint *CAdPath::getFirst() { ////////////////////////////////////////////////////////////////////////// -CBPoint *CAdPath::getNext() { +BasePoint *AdPath::getNext() { _currIndex++; if (_currIndex < _points.getSize()) return _points[_currIndex]; else return NULL; @@ -76,20 +76,20 @@ CBPoint *CAdPath::getNext() { ////////////////////////////////////////////////////////////////////////// -CBPoint *CAdPath::getCurrent() { +BasePoint *AdPath::getCurrent() { if (_currIndex >= 0 && _currIndex < _points.getSize()) return _points[_currIndex]; else return NULL; } ////////////////////////////////////////////////////////////////////////// -void CAdPath::addPoint(CBPoint *point) { +void AdPath::addPoint(BasePoint *point) { _points.add(point); } ////////////////////////////////////////////////////////////////////////// -bool CAdPath::setReady(bool ready) { +bool AdPath::setReady(bool ready) { bool orig = _ready; _ready = ready; @@ -98,7 +98,7 @@ bool CAdPath::setReady(bool ready) { ////////////////////////////////////////////////////////////////////////// -bool CAdPath::persist(CBPersistMgr *persistMgr) { +bool AdPath::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_gameRef)); diff --git a/engines/wintermute/ad/ad_path.h b/engines/wintermute/ad/ad_path.h index f27362bfd9..958f52af03 100644 --- a/engines/wintermute/ad/ad_path.h +++ b/engines/wintermute/ad/ad_path.h @@ -34,19 +34,19 @@ #include "engines/wintermute/base/base.h" namespace WinterMute { -class CBPoint; -class CAdPath : public CBBase { +class BasePoint; +class AdPath : public BaseClass { public: - DECLARE_PERSISTENT(CAdPath, CBBase) - CBPoint *getCurrent(); + DECLARE_PERSISTENT(AdPath, BaseClass) + BasePoint *getCurrent(); bool setReady(bool ready = true); - void addPoint(CBPoint *point); - CBPoint *getNext(); - CBPoint *getFirst(); + void addPoint(BasePoint *point); + BasePoint *getNext(); + BasePoint *getFirst(); void reset(); - CAdPath(CBGame *inGame); - virtual ~CAdPath(); - CBArray _points; + AdPath(BaseGame *inGame); + virtual ~AdPath(); + BaseArray _points; int _currIndex; bool _ready; }; diff --git a/engines/wintermute/ad/ad_path_point.cpp b/engines/wintermute/ad/ad_path_point.cpp index d4b910a30f..d5d447eb9a 100644 --- a/engines/wintermute/ad/ad_path_point.cpp +++ b/engines/wintermute/ad/ad_path_point.cpp @@ -31,10 +31,10 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CAdPathPoint, false) +IMPLEMENT_PERSISTENT(AdPathPoint, false) ////////////////////////////////////////////////////////////////////////// -CAdPathPoint::CAdPathPoint() { +AdPathPoint::AdPathPoint() { x = y = 0; _distance = 0; @@ -44,7 +44,7 @@ CAdPathPoint::CAdPathPoint() { ////////////////////////////////////////////////////////////////////////// -CAdPathPoint::CAdPathPoint(int initX, int initY, int initDistance) { +AdPathPoint::AdPathPoint(int initX, int initY, int initDistance) { x = initX; y = initY; _distance = initDistance; @@ -55,15 +55,15 @@ CAdPathPoint::CAdPathPoint(int initX, int initY, int initDistance) { ////////////////////////////////////////////////////////////////////////// -CAdPathPoint::~CAdPathPoint() { +AdPathPoint::~AdPathPoint() { _origin = NULL; } ////////////////////////////////////////////////////////////////////////// -bool CAdPathPoint::persist(CBPersistMgr *persistMgr) { +bool AdPathPoint::persist(BasePersistenceManager *persistMgr) { - CBPoint::persist(persistMgr); + BasePoint::persist(persistMgr); persistMgr->transfer(TMEMBER(_distance)); persistMgr->transfer(TMEMBER(_marked)); diff --git a/engines/wintermute/ad/ad_path_point.h b/engines/wintermute/ad/ad_path_point.h index 2a58237bb9..ea0a5795d0 100644 --- a/engines/wintermute/ad/ad_path_point.h +++ b/engines/wintermute/ad/ad_path_point.h @@ -34,13 +34,13 @@ namespace WinterMute { -class CAdPathPoint : public CBPoint { +class AdPathPoint : public BasePoint { public: - DECLARE_PERSISTENT(CAdPathPoint, CBPoint) - CAdPathPoint(int initX, int initY, int initDistance); - CAdPathPoint(); - virtual ~CAdPathPoint(); - CAdPathPoint *_origin; + DECLARE_PERSISTENT(AdPathPoint, BasePoint) + AdPathPoint(int initX, int initY, int initDistance); + AdPathPoint(); + virtual ~AdPathPoint(); + AdPathPoint *_origin; bool _marked; int _distance; }; diff --git a/engines/wintermute/ad/ad_region.cpp b/engines/wintermute/ad/ad_region.cpp index ae65be5013..1bd6051bda 100644 --- a/engines/wintermute/ad/ad_region.cpp +++ b/engines/wintermute/ad/ad_region.cpp @@ -37,10 +37,10 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CAdRegion, false) +IMPLEMENT_PERSISTENT(AdRegion, false) ////////////////////////////////////////////////////////////////////////// -CAdRegion::CAdRegion(CBGame *inGame): CBRegion(inGame) { +AdRegion::AdRegion(BaseGame *inGame): BaseRegion(inGame) { _blocked = false; _decoration = false; _zoom = 0; @@ -49,15 +49,15 @@ CAdRegion::CAdRegion(CBGame *inGame): CBRegion(inGame) { ////////////////////////////////////////////////////////////////////////// -CAdRegion::~CAdRegion() { +AdRegion::~AdRegion() { } ////////////////////////////////////////////////////////////////////////// -bool CAdRegion::loadFile(const char *filename) { +bool AdRegion::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { - _gameRef->LOG(0, "CAdRegion::LoadFile failed for file '%s'", filename); + _gameRef->LOG(0, "AdRegion::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -95,7 +95,7 @@ TOKEN_DEF(PROPERTY) TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -bool CAdRegion::loadBuffer(byte *buffer, bool complete) { +bool AdRegion::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(REGION) TOKEN_TABLE(TEMPLATE) @@ -118,7 +118,7 @@ bool CAdRegion::loadBuffer(byte *buffer, bool complete) { byte *params; int cmd; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); if (complete) { if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_REGION) { @@ -170,7 +170,7 @@ bool CAdRegion::loadBuffer(byte *buffer, bool complete) { case TOKEN_POINT: { int x, y; parser.scanStr((char *)params, "%d,%d", &x, &y); - _points.add(new CBPoint(x, y)); + _points.add(new BasePoint(x, y)); } break; @@ -219,7 +219,7 @@ bool CAdRegion::loadBuffer(byte *buffer, bool complete) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -bool CAdRegion::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool AdRegion::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) { /* ////////////////////////////////////////////////////////////////////////// // SkipTo @@ -233,12 +233,12 @@ bool CAdRegion::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS return STATUS_OK; } - else*/ return CBRegion::scCallMethod(script, stack, thisStack, name); + else*/ return BaseRegion::scCallMethod(script, stack, thisStack, name); } ////////////////////////////////////////////////////////////////////////// -CScValue *CAdRegion::scGetProperty(const char *name) { +ScValue *AdRegion::scGetProperty(const char *name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// @@ -289,12 +289,12 @@ CScValue *CAdRegion::scGetProperty(const char *name) { return _scValue; } - else return CBRegion::scGetProperty(name); + else return BaseRegion::scGetProperty(name); } ////////////////////////////////////////////////////////////////////////// -bool CAdRegion::scSetProperty(const char *name, CScValue *value) { +bool AdRegion::scSetProperty(const char *name, ScValue *value) { ////////////////////////////////////////////////////////////////////////// // Name ////////////////////////////////////////////////////////////////////////// @@ -335,18 +335,18 @@ bool CAdRegion::scSetProperty(const char *name, CScValue *value) { return STATUS_OK; } - else return CBRegion::scSetProperty(name, value); + else return BaseRegion::scSetProperty(name, value); } ////////////////////////////////////////////////////////////////////////// -const char *CAdRegion::scToString() { +const char *AdRegion::scToString() { return "[ad region]"; } ////////////////////////////////////////////////////////////////////////// -bool CAdRegion::saveAsText(CBDynBuffer *buffer, int indent) { +bool AdRegion::saveAsText(BaseDynamicBuffer *buffer, int indent) { buffer->putTextIndent(indent, "REGION {\n"); buffer->putTextIndent(indent + 2, "NAME=\"%s\"\n", _name); buffer->putTextIndent(indent + 2, "CAPTION=\"%s\"\n", getCaption()); @@ -369,7 +369,7 @@ bool CAdRegion::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent + 2, "POINT {%d,%d}\n", _points[i]->x, _points[i]->y); } - CBBase::saveAsText(buffer, indent + 2); + BaseClass::saveAsText(buffer, indent + 2); buffer->putTextIndent(indent, "}\n\n"); @@ -378,8 +378,8 @@ bool CAdRegion::saveAsText(CBDynBuffer *buffer, int indent) { ////////////////////////////////////////////////////////////////////////// -bool CAdRegion::persist(CBPersistMgr *persistMgr) { - CBRegion::persist(persistMgr); +bool AdRegion::persist(BasePersistenceManager *persistMgr) { + BaseRegion::persist(persistMgr); persistMgr->transfer(TMEMBER(_alpha)); persistMgr->transfer(TMEMBER(_blocked)); diff --git a/engines/wintermute/ad/ad_region.h b/engines/wintermute/ad/ad_region.h index 62c5fd6ba3..7ee36dc970 100644 --- a/engines/wintermute/ad/ad_region.h +++ b/engines/wintermute/ad/ad_region.h @@ -33,23 +33,23 @@ namespace WinterMute { -class CAdRegion : public CBRegion { +class AdRegion : public BaseRegion { public: - DECLARE_PERSISTENT(CAdRegion, CBRegion) + DECLARE_PERSISTENT(AdRegion, BaseRegion) uint32 _alpha; float _zoom; bool _blocked; bool _decoration; - CAdRegion(CBGame *inGame); - virtual ~CAdRegion(); + AdRegion(BaseGame *inGame); + virtual ~AdRegion(); bool loadFile(const char *filename); bool loadBuffer(byte *buffer, bool complete = true); - virtual bool saveAsText(CBDynBuffer *buffer, int indent); + virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent); // scripting interface - virtual CScValue *scGetProperty(const char *name); - virtual bool scSetProperty(const char *name, CScValue *value); - virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual ScValue *scGetProperty(const char *name); + virtual bool scSetProperty(const char *name, ScValue *value); + virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); virtual const char *scToString(); }; diff --git a/engines/wintermute/ad/ad_response.cpp b/engines/wintermute/ad/ad_response.cpp index b653fbd36a..29398f547c 100644 --- a/engines/wintermute/ad/ad_response.cpp +++ b/engines/wintermute/ad/ad_response.cpp @@ -35,10 +35,10 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CAdResponse, false) +IMPLEMENT_PERSISTENT(AdResponse, false) ////////////////////////////////////////////////////////////////////////// -CAdResponse::CAdResponse(CBGame *inGame): CBObject(inGame) { +AdResponse::AdResponse(BaseGame *inGame): BaseObject(inGame) { _text = NULL; _textOrig = NULL; _icon = _iconHover = _iconPressed = NULL; @@ -49,7 +49,7 @@ CAdResponse::CAdResponse(CBGame *inGame): CBObject(inGame) { ////////////////////////////////////////////////////////////////////////// -CAdResponse::~CAdResponse() { +AdResponse::~AdResponse() { delete[] _text; delete[] _textOrig; delete _icon; @@ -65,18 +65,18 @@ CAdResponse::~CAdResponse() { ////////////////////////////////////////////////////////////////////////// -void CAdResponse::setText(const char *text) { - CBUtils::setString(&_text, text); - CBUtils::setString(&_textOrig, text); +void AdResponse::setText(const char *text) { + BaseUtils::setString(&_text, text); + BaseUtils::setString(&_textOrig, text); } ////////////////////////////////////////////////////////////////////////// -bool CAdResponse::setIcon(const char *filename) { +bool AdResponse::setIcon(const char *filename) { delete _icon; - _icon = new CBSprite(_gameRef); + _icon = new BaseSprite(_gameRef); if (!_icon || DID_FAIL(_icon->loadFile(filename))) { - _gameRef->LOG(0, "CAdResponse::setIcon failed for file '%s'", filename); + _gameRef->LOG(0, "AdResponse::setIcon failed for file '%s'", filename); delete _icon; _icon = NULL; return STATUS_FAILED; @@ -85,22 +85,22 @@ bool CAdResponse::setIcon(const char *filename) { } ////////////////////////////////////////////////////////////////////////// -bool CAdResponse::setFont(const char *filename) { +bool AdResponse::setFont(const char *filename) { if (_font) _gameRef->_fontStorage->removeFont(_font); _font = _gameRef->_fontStorage->addFont(filename); if (!_font) { - _gameRef->LOG(0, "CAdResponse::setFont failed for file '%s'", filename); + _gameRef->LOG(0, "AdResponse::setFont failed for file '%s'", filename); return STATUS_FAILED; } return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CAdResponse::setIconHover(const char *filename) { +bool AdResponse::setIconHover(const char *filename) { delete _iconHover; - _iconHover = new CBSprite(_gameRef); + _iconHover = new BaseSprite(_gameRef); if (!_iconHover || DID_FAIL(_iconHover->loadFile(filename))) { - _gameRef->LOG(0, "CAdResponse::setIconHover failed for file '%s'", filename); + _gameRef->LOG(0, "AdResponse::setIconHover failed for file '%s'", filename); delete _iconHover; _iconHover = NULL; return STATUS_FAILED; @@ -110,11 +110,11 @@ bool CAdResponse::setIconHover(const char *filename) { ////////////////////////////////////////////////////////////////////////// -bool CAdResponse::setIconPressed(const char *filename) { +bool AdResponse::setIconPressed(const char *filename) { delete _iconPressed; - _iconPressed = new CBSprite(_gameRef); + _iconPressed = new BaseSprite(_gameRef); if (!_iconPressed || DID_FAIL(_iconPressed->loadFile(filename))) { - _gameRef->LOG(0, "CAdResponse::setIconPressed failed for file '%s'", filename); + _gameRef->LOG(0, "AdResponse::setIconPressed failed for file '%s'", filename); delete _iconPressed; _iconPressed = NULL; return STATUS_FAILED; @@ -124,9 +124,9 @@ bool CAdResponse::setIconPressed(const char *filename) { ////////////////////////////////////////////////////////////////////////// -bool CAdResponse::persist(CBPersistMgr *persistMgr) { +bool AdResponse::persist(BasePersistenceManager *persistMgr) { - CBObject::persist(persistMgr); + BaseObject::persist(persistMgr); persistMgr->transfer(TMEMBER(_icon)); persistMgr->transfer(TMEMBER(_iconHover)); diff --git a/engines/wintermute/ad/ad_response.h b/engines/wintermute/ad/ad_response.h index da450b2229..0cb8f6628b 100644 --- a/engines/wintermute/ad/ad_response.h +++ b/engines/wintermute/ad/ad_response.h @@ -34,24 +34,24 @@ #include "engines/wintermute/ad/ad_types.h" namespace WinterMute { -class CBFont; -class CAdResponse : public CBObject { +class BaseFont; +class AdResponse : public BaseObject { public: - DECLARE_PERSISTENT(CAdResponse, CBObject) + DECLARE_PERSISTENT(AdResponse, BaseObject) bool setIcon(const char *filename); bool setFont(const char *filename); bool setIconHover(const char *filename); bool setIconPressed(const char *filename); void setText(const char *text); int _iD; - CBSprite *_icon; - CBSprite *_iconHover; - CBSprite *_iconPressed; - CBFont *_font; + BaseSprite *_icon; + BaseSprite *_iconHover; + BaseSprite *_iconPressed; + BaseFont *_font; char *_text; char *_textOrig; - CAdResponse(CBGame *inGame); - virtual ~CAdResponse(); + AdResponse(BaseGame *inGame); + virtual ~AdResponse(); TResponseType _responseType; }; diff --git a/engines/wintermute/ad/ad_response_box.cpp b/engines/wintermute/ad/ad_response_box.cpp index 2499c9a732..5b7e441abc 100644 --- a/engines/wintermute/ad/ad_response_box.cpp +++ b/engines/wintermute/ad/ad_response_box.cpp @@ -47,17 +47,17 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CAdResponseBox, false) +IMPLEMENT_PERSISTENT(AdResponseBox, false) ////////////////////////////////////////////////////////////////////////// -CAdResponseBox::CAdResponseBox(CBGame *inGame): CBObject(inGame) { +AdResponseBox::AdResponseBox(BaseGame *inGame): BaseObject(inGame) { _font = _fontHover = NULL; _window = NULL; - _shieldWindow = new CUIWindow(_gameRef); + _shieldWindow = new UIWindow(_gameRef); _horizontal = false; - CBPlatform::setRectEmpty(&_responseArea); + BasePlatform::setRectEmpty(&_responseArea); _scrollOffset = 0; _spacing = 0; @@ -71,7 +71,7 @@ CAdResponseBox::CAdResponseBox(CBGame *inGame): CBObject(inGame) { ////////////////////////////////////////////////////////////////////////// -CAdResponseBox::~CAdResponseBox() { +AdResponseBox::~AdResponseBox() { delete _window; _window = NULL; @@ -93,7 +93,7 @@ CAdResponseBox::~CAdResponseBox() { ////////////////////////////////////////////////////////////////////////// -void CAdResponseBox::clearResponses() { +void AdResponseBox::clearResponses() { for (int i = 0; i < _responses.getSize(); i++) { delete _responses[i]; } @@ -102,7 +102,7 @@ void CAdResponseBox::clearResponses() { ////////////////////////////////////////////////////////////////////////// -void CAdResponseBox::clearButtons() { +void AdResponseBox::clearButtons() { for (int i = 0; i < _respButtons.getSize(); i++) { delete _respButtons[i]; } @@ -111,7 +111,7 @@ void CAdResponseBox::clearButtons() { ////////////////////////////////////////////////////////////////////////// -bool CAdResponseBox::invalidateButtons() { +bool AdResponseBox::invalidateButtons() { for (int i = 0; i < _respButtons.getSize(); i++) { _respButtons[i]->_image = NULL; _respButtons[i]->_cursor = NULL; @@ -125,12 +125,12 @@ bool CAdResponseBox::invalidateButtons() { ////////////////////////////////////////////////////////////////////////// -bool CAdResponseBox::createButtons() { +bool AdResponseBox::createButtons() { clearButtons(); _scrollOffset = 0; for (int i = 0; i < _responses.getSize(); i++) { - CUIButton *btn = new CUIButton(_gameRef); + UIButton *btn = new UIButton(_gameRef); if (btn) { btn->_parent = _window; btn->_sharedFonts = btn->_sharedImages = true; @@ -187,10 +187,10 @@ bool CAdResponseBox::createButtons() { ////////////////////////////////////////////////////////////////////////// -bool CAdResponseBox::loadFile(const char *filename) { +bool AdResponseBox::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { - _gameRef->LOG(0, "CAdResponseBox::LoadFile failed for file '%s'", filename); + _gameRef->LOG(0, "AdResponseBox::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -223,7 +223,7 @@ TOKEN_DEF(VERTICAL_ALIGN) TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -bool CAdResponseBox::loadBuffer(byte *buffer, bool complete) { +bool AdResponseBox::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(RESPONSE_BOX) TOKEN_TABLE(TEMPLATE) @@ -242,7 +242,7 @@ bool CAdResponseBox::loadBuffer(byte *buffer, bool complete) { byte *params; int cmd; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); if (complete) { if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_RESPONSE_BOX) { @@ -260,7 +260,7 @@ bool CAdResponseBox::loadBuffer(byte *buffer, bool complete) { case TOKEN_WINDOW: delete _window; - _window = new CUIWindow(_gameRef); + _window = new UIWindow(_gameRef); if (!_window || DID_FAIL(_window->loadBuffer(params, false))) { delete _window; _window = NULL; @@ -310,7 +310,7 @@ bool CAdResponseBox::loadBuffer(byte *buffer, bool complete) { case TOKEN_CURSOR: delete _cursor; - _cursor = new CBSprite(_gameRef); + _cursor = new BaseSprite(_gameRef); if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) { delete _cursor; _cursor = NULL; @@ -335,7 +335,7 @@ bool CAdResponseBox::loadBuffer(byte *buffer, bool complete) { } ////////////////////////////////////////////////////////////////////////// -bool CAdResponseBox::saveAsText(CBDynBuffer *buffer, int indent) { +bool AdResponseBox::saveAsText(BaseDynamicBuffer *buffer, int indent) { buffer->putTextIndent(indent, "RESPONSE_BOX\n"); buffer->putTextIndent(indent, "{\n"); @@ -362,7 +362,7 @@ bool CAdResponseBox::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent + 2, "TEXT_ALIGN=\"%s\"\n", "center"); break; default: - error("CAdResponseBox::SaveAsText - Unhandled enum"); + error("AdResponseBox::SaveAsText - Unhandled enum"); break; } @@ -388,7 +388,7 @@ bool CAdResponseBox::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent + 2, "\n"); // editor properties - CBBase::saveAsText(buffer, indent + 2); + BaseClass::saveAsText(buffer, indent + 2); buffer->putTextIndent(indent, "}\n"); return STATUS_OK; @@ -396,10 +396,10 @@ bool CAdResponseBox::saveAsText(CBDynBuffer *buffer, int indent) { ////////////////////////////////////////////////////////////////////////// -bool CAdResponseBox::display() { +bool AdResponseBox::display() { Rect32 rect = _responseArea; if (_window) { - CBPlatform::offsetRect(&rect, _window->_posX, _window->_posY); + BasePlatform::offsetRect(&rect, _window->_posX, _window->_posY); //_window->display(); } @@ -482,8 +482,8 @@ bool CAdResponseBox::display() { ////////////////////////////////////////////////////////////////////////// -bool CAdResponseBox::listen(CBScriptHolder *param1, uint32 param2) { - CUIObject *obj = (CUIObject *)param1; +bool AdResponseBox::listen(BaseScriptHolder *param1, uint32 param2) { + UIObject *obj = (UIObject *)param1; switch (obj->_type) { case UI_BUTTON: @@ -496,11 +496,11 @@ bool CAdResponseBox::listen(CBScriptHolder *param1, uint32 param2) { handleResponse(_responses[param2]); _waitingScript = NULL; _gameRef->_state = GAME_RUNNING; - ((CAdGame *)_gameRef)->_stateEx = GAME_NORMAL; + ((AdGame *)_gameRef)->_stateEx = GAME_NORMAL; _ready = true; invalidateButtons(); clearResponses(); - } else return CBObject::listen(param1, param2); + } else return BaseObject::listen(param1, param2); break; default: error("AdResponseBox::Listen - Unhandled enum"); @@ -511,8 +511,8 @@ bool CAdResponseBox::listen(CBScriptHolder *param1, uint32 param2) { ////////////////////////////////////////////////////////////////////////// -bool CAdResponseBox::persist(CBPersistMgr *persistMgr) { - CBObject::persist(persistMgr); +bool AdResponseBox::persist(BasePersistenceManager *persistMgr) { + BaseObject::persist(persistMgr); persistMgr->transfer(TMEMBER(_font)); persistMgr->transfer(TMEMBER(_fontHover)); @@ -536,8 +536,8 @@ bool CAdResponseBox::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -bool CAdResponseBox::weedResponses() { - CAdGame *adGame = (CAdGame *)_gameRef; +bool AdResponseBox::weedResponses() { + AdGame *adGame = (AdGame *)_gameRef; for (int i = 0; i < _responses.getSize(); i++) { switch (_responses[i]->_responseType) { @@ -557,7 +557,7 @@ bool CAdResponseBox::weedResponses() { } break; default: - warning("CAdResponseBox::WeedResponses - Unhandled enum"); + warning("AdResponseBox::WeedResponses - Unhandled enum"); break; } } @@ -566,17 +566,17 @@ bool CAdResponseBox::weedResponses() { ////////////////////////////////////////////////////////////////////////// -void CAdResponseBox::setLastResponseText(const char *text, const char *textOrig) { - CBUtils::setString(&_lastResponseText, text); - CBUtils::setString(&_lastResponseTextOrig, textOrig); +void AdResponseBox::setLastResponseText(const char *text, const char *textOrig) { + BaseUtils::setString(&_lastResponseText, text); + BaseUtils::setString(&_lastResponseTextOrig, textOrig); } ////////////////////////////////////////////////////////////////////////// -bool CAdResponseBox::handleResponse(CAdResponse *response) { +bool AdResponseBox::handleResponse(AdResponse *response) { setLastResponseText(response->_text, response->_textOrig); - CAdGame *adGame = (CAdGame *)_gameRef; + AdGame *adGame = (AdGame *)_gameRef; switch (response->_responseType) { case RESPONSE_ONCE: @@ -587,7 +587,7 @@ bool CAdResponseBox::handleResponse(CAdResponse *response) { adGame->addGameResponse(response->_iD); break; default: - warning("CAdResponseBox::HandleResponse - Unhandled enum"); + warning("AdResponseBox::HandleResponse - Unhandled enum"); } return STATUS_OK; @@ -595,8 +595,8 @@ bool CAdResponseBox::handleResponse(CAdResponse *response) { ////////////////////////////////////////////////////////////////////////// -CBObject *CAdResponseBox::getNextAccessObject(CBObject *currObject) { - CBArray objects; +BaseObject *AdResponseBox::getNextAccessObject(BaseObject *currObject) { + BaseArray objects; getObjects(objects, true); if (objects.getSize() == 0) return NULL; @@ -615,8 +615,8 @@ CBObject *CAdResponseBox::getNextAccessObject(CBObject *currObject) { } ////////////////////////////////////////////////////////////////////////// -CBObject *CAdResponseBox::getPrevAccessObject(CBObject *currObject) { - CBArray objects; +BaseObject *AdResponseBox::getPrevAccessObject(BaseObject *currObject) { + BaseArray objects; getObjects(objects, true); if (objects.getSize() == 0) return NULL; @@ -635,7 +635,7 @@ CBObject *CAdResponseBox::getPrevAccessObject(CBObject *currObject) { } ////////////////////////////////////////////////////////////////////////// -bool CAdResponseBox::getObjects(CBArray &objects, bool interactiveOnly) { +bool AdResponseBox::getObjects(BaseArray &objects, bool interactiveOnly) { for (int i = 0; i < _respButtons.getSize(); i++) { objects.add(_respButtons[i]); } diff --git a/engines/wintermute/ad/ad_response_box.h b/engines/wintermute/ad/ad_response_box.h index 7c611ef2d6..f77ff3360c 100644 --- a/engines/wintermute/ad/ad_response_box.h +++ b/engines/wintermute/ad/ad_response_box.h @@ -34,23 +34,23 @@ namespace WinterMute { -class CUIButton; -class CUIWindow; -class CUIObject; -class CAdResponse; -class CAdResponseBox : public CBObject { +class UIButton; +class UIWindow; +class UIObject; +class AdResponse; +class AdResponseBox : public BaseObject { public: - CBObject *getNextAccessObject(CBObject *CurrObject); - CBObject *getPrevAccessObject(CBObject *CurrObject); - bool getObjects(CBArray &objects, bool interactiveOnly); + BaseObject *getNextAccessObject(BaseObject *CurrObject); + BaseObject *getPrevAccessObject(BaseObject *CurrObject); + bool getObjects(BaseArray &objects, bool interactiveOnly); - bool handleResponse(CAdResponse *response); + bool handleResponse(AdResponse *response); void setLastResponseText(const char *text, const char *textOrig); char *_lastResponseText; char *_lastResponseTextOrig; - DECLARE_PERSISTENT(CAdResponseBox, CBObject) - CScScript *_waitingScript; - virtual bool listen(CBScriptHolder *param1, uint32 param2); + DECLARE_PERSISTENT(AdResponseBox, BaseObject) + ScScript *_waitingScript; + virtual bool listen(BaseScriptHolder *param1, uint32 param2); typedef enum { EVENT_PREV, EVENT_NEXT, @@ -61,25 +61,25 @@ public: bool display(); int _spacing; int _scrollOffset; - CBFont *_fontHover; - CBFont *_font; + BaseFont *_fontHover; + BaseFont *_font; bool createButtons(); bool invalidateButtons(); void clearButtons(); void clearResponses(); - CAdResponseBox(CBGame *inGame); - virtual ~CAdResponseBox(); - CBArray _responses; - CBArray _respButtons; - CUIWindow *_window; - CUIWindow *_shieldWindow; + AdResponseBox(BaseGame *inGame); + virtual ~AdResponseBox(); + BaseArray _responses; + BaseArray _respButtons; + UIWindow *_window; + UIWindow *_shieldWindow; bool _horizontal; Rect32 _responseArea; int _verticalAlign; TTextAlign _align; bool loadFile(const char *filename); bool loadBuffer(byte *buffer, bool complete = true); - virtual bool saveAsText(CBDynBuffer *buffer, int indent); + virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent); }; } // end of namespace WinterMute diff --git a/engines/wintermute/ad/ad_response_context.cpp b/engines/wintermute/ad/ad_response_context.cpp index 02b819d6de..32d9415fe9 100644 --- a/engines/wintermute/ad/ad_response_context.cpp +++ b/engines/wintermute/ad/ad_response_context.cpp @@ -32,24 +32,24 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CAdResponseContext, false) +IMPLEMENT_PERSISTENT(AdResponseContext, false) ////////////////////////////////////////////////////////////////////////// -CAdResponseContext::CAdResponseContext(CBGame *inGame): CBBase(inGame) { +AdResponseContext::AdResponseContext(BaseGame *inGame): BaseClass(inGame) { _iD = 0; _context = NULL; } ////////////////////////////////////////////////////////////////////////// -CAdResponseContext::~CAdResponseContext() { +AdResponseContext::~AdResponseContext() { delete[] _context; _context = NULL; } ////////////////////////////////////////////////////////////////////////// -bool CAdResponseContext::persist(CBPersistMgr *persistMgr) { +bool AdResponseContext::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_gameRef)); persistMgr->transfer(TMEMBER(_context)); persistMgr->transfer(TMEMBER(_iD)); @@ -58,7 +58,7 @@ bool CAdResponseContext::persist(CBPersistMgr *persistMgr) { } ////////////////////////////////////////////////////////////////////////// -void CAdResponseContext::setContext(const char *context) { +void AdResponseContext::setContext(const char *context) { delete[] _context; _context = NULL; if (context) { diff --git a/engines/wintermute/ad/ad_response_context.h b/engines/wintermute/ad/ad_response_context.h index 79eaa27640..d0dc1546b7 100644 --- a/engines/wintermute/ad/ad_response_context.h +++ b/engines/wintermute/ad/ad_response_context.h @@ -34,14 +34,14 @@ namespace WinterMute { -class CAdResponseContext : public CBBase { +class AdResponseContext : public BaseClass { public: void setContext(const char *context); int _iD; char *_context; - DECLARE_PERSISTENT(CAdResponseContext, CBBase) - CAdResponseContext(CBGame *inGame); - virtual ~CAdResponseContext(); + DECLARE_PERSISTENT(AdResponseContext, BaseClass) + AdResponseContext(BaseGame *inGame); + virtual ~AdResponseContext(); }; diff --git a/engines/wintermute/ad/ad_rot_level.cpp b/engines/wintermute/ad/ad_rot_level.cpp index 0ffbaf6919..e758eaa1f6 100644 --- a/engines/wintermute/ad/ad_rot_level.cpp +++ b/engines/wintermute/ad/ad_rot_level.cpp @@ -36,27 +36,27 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CAdRotLevel, false) +IMPLEMENT_PERSISTENT(AdRotLevel, false) ////////////////////////////////////////////////////////////////////////// -CAdRotLevel::CAdRotLevel(CBGame *inGame): CBObject(inGame) { +AdRotLevel::AdRotLevel(BaseGame *inGame): BaseObject(inGame) { _posX = 0; _rotation = 0.0f; } ////////////////////////////////////////////////////////////////////////// -CAdRotLevel::~CAdRotLevel() { +AdRotLevel::~AdRotLevel() { } ////////////////////////////////////////////////////////////////////////// -bool CAdRotLevel::loadFile(const char *filename) { +bool AdRotLevel::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { - _gameRef->LOG(0, "CAdRotLevel::LoadFile failed for file '%s'", filename); + _gameRef->LOG(0, "AdRotLevel::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -82,7 +82,7 @@ TOKEN_DEF(ROTATION) TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -bool CAdRotLevel::loadBuffer(byte *buffer, bool complete) { +bool AdRotLevel::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(ROTATION_LEVEL) TOKEN_TABLE(TEMPLATE) @@ -93,7 +93,7 @@ bool CAdRotLevel::loadBuffer(byte *buffer, bool complete) { byte *params; int cmd; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); if (complete) { if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_ROTATION_LEVEL) { @@ -135,11 +135,11 @@ bool CAdRotLevel::loadBuffer(byte *buffer, bool complete) { ////////////////////////////////////////////////////////////////////////// -bool CAdRotLevel::saveAsText(CBDynBuffer *buffer, int indent) { +bool AdRotLevel::saveAsText(BaseDynamicBuffer *buffer, int indent) { buffer->putTextIndent(indent, "ROTATION_LEVEL {\n"); buffer->putTextIndent(indent + 2, "X=%d\n", _posX); buffer->putTextIndent(indent + 2, "ROTATION=%d\n", (int)_rotation); - CBBase::saveAsText(buffer, indent + 2); + BaseClass::saveAsText(buffer, indent + 2); buffer->putTextIndent(indent, "}\n"); return STATUS_OK; @@ -147,9 +147,9 @@ bool CAdRotLevel::saveAsText(CBDynBuffer *buffer, int indent) { ////////////////////////////////////////////////////////////////////////// -bool CAdRotLevel::persist(CBPersistMgr *persistMgr) { +bool AdRotLevel::persist(BasePersistenceManager *persistMgr) { - CBObject::persist(persistMgr); + BaseObject::persist(persistMgr); persistMgr->transfer(TMEMBER(_rotation)); diff --git a/engines/wintermute/ad/ad_rot_level.h b/engines/wintermute/ad/ad_rot_level.h index 2bd9519d65..4339a379a5 100644 --- a/engines/wintermute/ad/ad_rot_level.h +++ b/engines/wintermute/ad/ad_rot_level.h @@ -33,13 +33,13 @@ namespace WinterMute { -class CAdRotLevel : public CBObject { +class AdRotLevel : public BaseObject { public: - DECLARE_PERSISTENT(CAdRotLevel, CBObject) - CAdRotLevel(CBGame *inGame); - virtual ~CAdRotLevel(); + DECLARE_PERSISTENT(AdRotLevel, BaseObject) + AdRotLevel(BaseGame *inGame); + virtual ~AdRotLevel(); float _rotation; - virtual bool saveAsText(CBDynBuffer *buffer, int indent); + virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent); bool loadFile(const char *filename); bool loadBuffer(byte *buffer, bool complete = true); }; diff --git a/engines/wintermute/ad/ad_scale_level.cpp b/engines/wintermute/ad/ad_scale_level.cpp index 220d3c4b39..65e0cc4663 100644 --- a/engines/wintermute/ad/ad_scale_level.cpp +++ b/engines/wintermute/ad/ad_scale_level.cpp @@ -35,26 +35,26 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CAdScaleLevel, false) +IMPLEMENT_PERSISTENT(AdScaleLevel, false) ////////////////////////////////////////////////////////////////////////// -CAdScaleLevel::CAdScaleLevel(CBGame *inGame): CBObject(inGame) { +AdScaleLevel::AdScaleLevel(BaseGame *inGame): BaseObject(inGame) { _posY = 0; _scale = 100; } ////////////////////////////////////////////////////////////////////////// -CAdScaleLevel::~CAdScaleLevel() { +AdScaleLevel::~AdScaleLevel() { } ////////////////////////////////////////////////////////////////////////// -bool CAdScaleLevel::loadFile(const char *filename) { +bool AdScaleLevel::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { - _gameRef->LOG(0, "CAdScaleLevel::LoadFile failed for file '%s'", filename); + _gameRef->LOG(0, "AdScaleLevel::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -80,7 +80,7 @@ TOKEN_DEF(SCALE) TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -bool CAdScaleLevel::loadBuffer(byte *buffer, bool complete) { +bool AdScaleLevel::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(SCALE_LEVEL) TOKEN_TABLE(TEMPLATE) @@ -91,7 +91,7 @@ bool CAdScaleLevel::loadBuffer(byte *buffer, bool complete) { byte *params; int cmd; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); if (complete) { if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_SCALE_LEVEL) { @@ -133,11 +133,11 @@ bool CAdScaleLevel::loadBuffer(byte *buffer, bool complete) { ////////////////////////////////////////////////////////////////////////// -bool CAdScaleLevel::saveAsText(CBDynBuffer *buffer, int indent) { +bool AdScaleLevel::saveAsText(BaseDynamicBuffer *buffer, int indent) { buffer->putTextIndent(indent, "SCALE_LEVEL {\n"); buffer->putTextIndent(indent + 2, "Y=%d\n", _posY); buffer->putTextIndent(indent + 2, "SCALE=%d\n", (int)_scale); - CBBase::saveAsText(buffer, indent + 2); + BaseClass::saveAsText(buffer, indent + 2); buffer->putTextIndent(indent, "}\n"); return STATUS_OK; @@ -145,9 +145,9 @@ bool CAdScaleLevel::saveAsText(CBDynBuffer *buffer, int indent) { ////////////////////////////////////////////////////////////////////////// -bool CAdScaleLevel::persist(CBPersistMgr *persistMgr) { +bool AdScaleLevel::persist(BasePersistenceManager *persistMgr) { - CBObject::persist(persistMgr); + BaseObject::persist(persistMgr); persistMgr->transfer(TMEMBER(_scale)); diff --git a/engines/wintermute/ad/ad_scale_level.h b/engines/wintermute/ad/ad_scale_level.h index 4a81c00dda..5e84f8c9ce 100644 --- a/engines/wintermute/ad/ad_scale_level.h +++ b/engines/wintermute/ad/ad_scale_level.h @@ -34,13 +34,13 @@ namespace WinterMute { -class CAdScaleLevel : public CBObject { +class AdScaleLevel : public BaseObject { public: - DECLARE_PERSISTENT(CAdScaleLevel, CBObject) + DECLARE_PERSISTENT(AdScaleLevel, BaseObject) float _scale; - CAdScaleLevel(CBGame *inGame); - virtual ~CAdScaleLevel(); - virtual bool saveAsText(CBDynBuffer *buffer, int indent); + AdScaleLevel(BaseGame *inGame); + virtual ~AdScaleLevel(); + virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent); bool loadFile(const char *filename); bool loadBuffer(byte *buffer, bool complete = true); }; diff --git a/engines/wintermute/ad/ad_scene.cpp b/engines/wintermute/ad/ad_scene.cpp index 11030d6996..104fe6dd4d 100644 --- a/engines/wintermute/ad/ad_scene.cpp +++ b/engines/wintermute/ad/ad_scene.cpp @@ -62,17 +62,17 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CAdScene, false) +IMPLEMENT_PERSISTENT(AdScene, false) ////////////////////////////////////////////////////////////////////////// -CAdScene::CAdScene(CBGame *inGame): CBObject(inGame) { - _pfTarget = new CBPoint; +AdScene::AdScene(BaseGame *inGame): BaseObject(inGame) { + _pfTarget = new BasePoint; setDefaults(); } ////////////////////////////////////////////////////////////////////////// -CAdScene::~CAdScene() { +AdScene::~AdScene() { cleanup(); _gameRef->unregisterObject(_fader); delete _pfTarget; @@ -81,7 +81,7 @@ CAdScene::~CAdScene() { ////////////////////////////////////////////////////////////////////////// -void CAdScene::setDefaults() { +void AdScene::setDefaults() { _initialized = false; _pfReady = true; _pfTargetPath = NULL; @@ -128,7 +128,7 @@ void CAdScene::setDefaults() { _shieldWindow = NULL; - _fader = new CBFader(_gameRef); + _fader = new BaseFader(_gameRef); _gameRef->registerObject(_fader); _viewport = NULL; @@ -136,8 +136,8 @@ void CAdScene::setDefaults() { ////////////////////////////////////////////////////////////////////////// -void CAdScene::cleanup() { - CBObject::cleanup(); +void AdScene::cleanup() { + BaseObject::cleanup(); _mainLayer = NULL; // reference only @@ -184,7 +184,7 @@ void CAdScene::cleanup() { ////////////////////////////////////////////////////////////////////////// -bool CAdScene::getPath(CBPoint source, CBPoint target, CAdPath *path, CBObject *requester) { +bool AdScene::getPath(BasePoint source, BasePoint target, AdPath *path, BaseObject *requester) { if (!_pfReady) return false; else { _pfReady = false; @@ -200,7 +200,7 @@ bool CAdScene::getPath(CBPoint source, CBPoint target, CAdPath *path, CBObject * pfPointsStart(); // first point - //_pfPath.add(new CAdPathPoint(source.x, source.y, 0)); + //_pfPath.add(new AdPathPoint(source.x, source.y, 0)); // if we're one pixel stuck, get unstuck int startX = source.x; @@ -228,7 +228,7 @@ bool CAdScene::getPath(CBPoint source, CBPoint target, CAdPath *path, CBObject * //CorrectTargetPoint(&target.x, &target.y); // last point - //_pfPath.add(new CAdPathPoint(target.x, target.y, INT_MAX)); + //_pfPath.add(new AdPathPoint(target.x, target.y, INT_MAX)); pfPointsAdd(target.x, target.y, INT_MAX); // active waypoints @@ -245,7 +245,7 @@ bool CAdScene::getPath(CBPoint source, CBPoint target, CAdPath *path, CBObject * pfAddWaypointGroup(_objects[i]->_currentWptGroup, requester); } } - CAdGame *adGame = (CAdGame *)_gameRef; + AdGame *adGame = (AdGame *)_gameRef; for (i = 0; i < adGame->_objects.getSize(); i++) { if (adGame->_objects[i]->_active && adGame->_objects[i] != requester && adGame->_objects[i]->_currentWptGroup) { pfAddWaypointGroup(adGame->_objects[i]->_currentWptGroup, requester); @@ -258,26 +258,26 @@ bool CAdScene::getPath(CBPoint source, CBPoint target, CAdPath *path, CBObject * ////////////////////////////////////////////////////////////////////////// -void CAdScene::pfAddWaypointGroup(CAdWaypointGroup *wpt, CBObject *requester) { +void AdScene::pfAddWaypointGroup(AdWaypointGroup *wpt, BaseObject *requester) { if (!wpt->_active) return; for (int i = 0; i < wpt->_points.getSize(); i++) { if (isBlockedAt(wpt->_points[i]->x, wpt->_points[i]->y, true, requester)) continue; - //_pfPath.add(new CAdPathPoint(Wpt->_points[i]->x, Wpt->_points[i]->y, INT_MAX)); + //_pfPath.add(new AdPathPoint(Wpt->_points[i]->x, Wpt->_points[i]->y, INT_MAX)); pfPointsAdd(wpt->_points[i]->x, wpt->_points[i]->y, INT_MAX); } } ////////////////////////////////////////////////////////////////////////// -float CAdScene::getZoomAt(int x, int y) { +float AdScene::getZoomAt(int x, int y) { float ret = 100; bool found = false; if (_mainLayer) { for (int i = _mainLayer->_nodes.getSize() - 1; i >= 0; i--) { - CAdSceneNode *node = _mainLayer->_nodes[i]; + AdSceneNode *node = _mainLayer->_nodes[i]; if (node->_type == OBJECT_REGION && node->_region->_active && !node->_region->_blocked && node->_region->pointInRegion(x, y)) { if (node->_region->_zoom != 0) { ret = node->_region->_zoom; @@ -294,7 +294,7 @@ float CAdScene::getZoomAt(int x, int y) { ////////////////////////////////////////////////////////////////////////// -uint32 CAdScene::getAlphaAt(int x, int y, bool colorCheck) { +uint32 AdScene::getAlphaAt(int x, int y, bool colorCheck) { if (!_gameRef->_debugDebugMode) colorCheck = false; uint32 ret; @@ -303,7 +303,7 @@ uint32 CAdScene::getAlphaAt(int x, int y, bool colorCheck) { if (_mainLayer) { for (int i = _mainLayer->_nodes.getSize() - 1; i >= 0; i--) { - CAdSceneNode *node = _mainLayer->_nodes[i]; + AdSceneNode *node = _mainLayer->_nodes[i]; if (node->_type == OBJECT_REGION && node->_region->_active && (colorCheck || !node->_region->_blocked) && node->_region->pointInRegion(x, y)) { if (!node->_region->_blocked) ret = node->_region->_alpha; break; @@ -315,7 +315,7 @@ uint32 CAdScene::getAlphaAt(int x, int y, bool colorCheck) { ////////////////////////////////////////////////////////////////////////// -bool CAdScene::isBlockedAt(int x, int y, bool checkFreeObjects, CBObject *requester) { +bool AdScene::isBlockedAt(int x, int y, bool checkFreeObjects, BaseObject *requester) { bool ret = true; @@ -325,7 +325,7 @@ bool CAdScene::isBlockedAt(int x, int y, bool checkFreeObjects, CBObject *reques if (_objects[i]->_currentBlockRegion->pointInRegion(x, y)) return true; } } - CAdGame *adGame = (CAdGame *)_gameRef; + AdGame *adGame = (AdGame *)_gameRef; for (int i = 0; i < adGame->_objects.getSize(); i++) { if (adGame->_objects[i]->_active && adGame->_objects[i] != requester && adGame->_objects[i]->_currentBlockRegion) { if (adGame->_objects[i]->_currentBlockRegion->pointInRegion(x, y)) return true; @@ -336,7 +336,7 @@ bool CAdScene::isBlockedAt(int x, int y, bool checkFreeObjects, CBObject *reques if (_mainLayer) { for (int i = 0; i < _mainLayer->_nodes.getSize(); i++) { - CAdSceneNode *node = _mainLayer->_nodes[i]; + AdSceneNode *node = _mainLayer->_nodes[i]; /* if (Node->_type == OBJECT_REGION && Node->_region->_active && Node->_region->_blocked && Node->_region->PointInRegion(X, Y)) { @@ -357,7 +357,7 @@ bool CAdScene::isBlockedAt(int x, int y, bool checkFreeObjects, CBObject *reques ////////////////////////////////////////////////////////////////////////// -bool CAdScene::isWalkableAt(int x, int y, bool checkFreeObjects, CBObject *requester) { +bool AdScene::isWalkableAt(int x, int y, bool checkFreeObjects, BaseObject *requester) { bool ret = false; if (checkFreeObjects) { @@ -366,7 +366,7 @@ bool CAdScene::isWalkableAt(int x, int y, bool checkFreeObjects, CBObject *reque if (_objects[i]->_currentBlockRegion->pointInRegion(x, y)) return false; } } - CAdGame *adGame = (CAdGame *)_gameRef; + AdGame *adGame = (AdGame *)_gameRef; for (int i = 0; i < adGame->_objects.getSize(); i++) { if (adGame->_objects[i]->_active && adGame->_objects[i] != requester && adGame->_objects[i]->_currentBlockRegion) { if (adGame->_objects[i]->_currentBlockRegion->pointInRegion(x, y)) return false; @@ -377,7 +377,7 @@ bool CAdScene::isWalkableAt(int x, int y, bool checkFreeObjects, CBObject *reque if (_mainLayer) { for (int i = 0; i < _mainLayer->_nodes.getSize(); i++) { - CAdSceneNode *node = _mainLayer->_nodes[i]; + AdSceneNode *node = _mainLayer->_nodes[i]; if (node->_type == OBJECT_REGION && node->_region->_active && !node->_region->_decoration && node->_region->pointInRegion(x, y)) { if (node->_region->_blocked) { ret = false; @@ -391,7 +391,7 @@ bool CAdScene::isWalkableAt(int x, int y, bool checkFreeObjects, CBObject *reque ////////////////////////////////////////////////////////////////////////// -int CAdScene::getPointsDist(CBPoint p1, CBPoint p2, CBObject *requester) { +int AdScene::getPointsDist(BasePoint p1, BasePoint p2, BaseObject *requester) { double xStep, yStep, x, y; int xLength, yLength, xCount, yCount; int x1, y1, x2, y2; @@ -406,8 +406,8 @@ int CAdScene::getPointsDist(CBPoint p1, CBPoint p2, CBObject *requester) { if (xLength > yLength) { if (x1 > x2) { - CBUtils::swap(&x1, &x2); - CBUtils::swap(&y1, &y2); + BaseUtils::swap(&x1, &x2); + BaseUtils::swap(&y1, &y2); } yStep = (double)(y2 - y1) / (double)(x2 - x1); @@ -419,8 +419,8 @@ int CAdScene::getPointsDist(CBPoint p1, CBPoint p2, CBObject *requester) { } } else { if (y1 > y2) { - CBUtils::swap(&x1, &x2); - CBUtils::swap(&y1, &y2); + BaseUtils::swap(&x1, &x2); + BaseUtils::swap(&y1, &y2); } xStep = (double)(x2 - x1) / (double)(y2 - y1); @@ -436,11 +436,11 @@ int CAdScene::getPointsDist(CBPoint p1, CBPoint p2, CBObject *requester) { ////////////////////////////////////////////////////////////////////////// -void CAdScene::pathFinderStep() { +void AdScene::pathFinderStep() { int i; // get lowest unmarked int lowestDist = INT_MAX; - CAdPathPoint *lowestPt = NULL; + AdPathPoint *lowestPt = NULL; for (i = 0; i < _pfPointsNum; i++) if (!_pfPath[i]->_marked && _pfPath[i]->_distance < lowestDist) { @@ -459,7 +459,7 @@ void CAdScene::pathFinderStep() { // target point marked, generate path and terminate if (lowestPt->x == _pfTarget->x && lowestPt->y == _pfTarget->y) { while (lowestPt != NULL) { - _pfTargetPath->_points.insertAt(0, new CBPoint(lowestPt->x, lowestPt->y)); + _pfTargetPath->_points.insertAt(0, new BasePoint(lowestPt->x, lowestPt->y)); lowestPt = lowestPt->_origin; } @@ -481,18 +481,18 @@ void CAdScene::pathFinderStep() { ////////////////////////////////////////////////////////////////////////// -bool CAdScene::initLoop() { +bool AdScene::initLoop() { #ifdef _DEBUGxxxx int nu_steps = 0; uint32 start = _gameRef->_currentTime; - while (!_pfReady && CBPlatform::getTime() - start <= _pfMaxTime) { + while (!_pfReady && BasePlatform::getTime() - start <= _pfMaxTime) { PathFinderStep(); nu_steps++; } if (nu_steps > 0) _gameRef->LOG(0, "STAT: PathFinder iterations in one loop: %d (%s) _pfMaxTime=%d", nu_steps, _pfReady ? "finished" : "not yet done", _pfMaxTime); #else uint32 start = _gameRef->_currentTime; - while (!_pfReady && CBPlatform::getTime() - start <= _pfMaxTime) pathFinderStep(); + while (!_pfReady && BasePlatform::getTime() - start <= _pfMaxTime) pathFinderStep(); #endif return STATUS_OK; @@ -500,10 +500,10 @@ bool CAdScene::initLoop() { ////////////////////////////////////////////////////////////////////////// -bool CAdScene::loadFile(const char *filename) { +bool AdScene::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { - _gameRef->LOG(0, "CAdScene::LoadFile failed for file '%s'", filename); + _gameRef->LOG(0, "AdScene::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -565,7 +565,7 @@ TOKEN_DEF(PERSISTENT_STATE) TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -bool CAdScene::loadBuffer(byte *buffer, bool complete) { +bool AdScene::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(SCENE) TOKEN_TABLE(TEMPLATE) @@ -610,7 +610,7 @@ bool CAdScene::loadBuffer(byte *buffer, bool complete) { byte *params; int cmd; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); if (complete) { if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_SCENE) { @@ -639,7 +639,7 @@ bool CAdScene::loadBuffer(byte *buffer, bool complete) { break; case TOKEN_LAYER: { - CAdLayer *layer = new CAdLayer(_gameRef); + AdLayer *layer = new AdLayer(_gameRef); if (!layer || DID_FAIL(layer->loadBuffer(params, false))) { cmd = PARSERR_GENERIC; delete layer; @@ -657,7 +657,7 @@ bool CAdScene::loadBuffer(byte *buffer, bool complete) { break; case TOKEN_WAYPOINTS: { - CAdWaypointGroup *wpt = new CAdWaypointGroup(_gameRef); + AdWaypointGroup *wpt = new AdWaypointGroup(_gameRef); if (!wpt || DID_FAIL(wpt->loadBuffer(params, false))) { cmd = PARSERR_GENERIC; delete wpt; @@ -670,7 +670,7 @@ bool CAdScene::loadBuffer(byte *buffer, bool complete) { break; case TOKEN_SCALE_LEVEL: { - CAdScaleLevel *sl = new CAdScaleLevel(_gameRef); + AdScaleLevel *sl = new AdScaleLevel(_gameRef); if (!sl || DID_FAIL(sl->loadBuffer(params, false))) { cmd = PARSERR_GENERIC; delete sl; @@ -683,7 +683,7 @@ bool CAdScene::loadBuffer(byte *buffer, bool complete) { break; case TOKEN_ROTATION_LEVEL: { - CAdRotLevel *rl = new CAdRotLevel(_gameRef); + AdRotLevel *rl = new AdRotLevel(_gameRef); if (!rl || DID_FAIL(rl->loadBuffer(params, false))) { cmd = PARSERR_GENERIC; delete rl; @@ -696,7 +696,7 @@ bool CAdScene::loadBuffer(byte *buffer, bool complete) { break; case TOKEN_ENTITY: { - CAdEntity *entity = new CAdEntity(_gameRef); + AdEntity *entity = new AdEntity(_gameRef); if (!entity || DID_FAIL(entity->loadBuffer(params, false))) { cmd = PARSERR_GENERIC; delete entity; @@ -709,7 +709,7 @@ bool CAdScene::loadBuffer(byte *buffer, bool complete) { case TOKEN_CURSOR: delete _cursor; - _cursor = new CBSprite(_gameRef); + _cursor = new BaseSprite(_gameRef); if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) { delete _cursor; _cursor = NULL; @@ -820,7 +820,7 @@ bool CAdScene::loadBuffer(byte *buffer, bool complete) { case TOKEN_VIEWPORT: { Rect32 rc; parser.scanStr((char *)params, "%d,%d,%d,%d", &rc.left, &rc.top, &rc.right, &rc.bottom); - if (!_viewport) _viewport = new CBViewport(_gameRef); + if (!_viewport) _viewport = new BaseViewport(_gameRef); if (_viewport) _viewport->setRect(rc.left, rc.top, rc.right, rc.bottom, true); } @@ -856,11 +856,11 @@ bool CAdScene::loadBuffer(byte *buffer, bool complete) { } ////////////////////////////////////////////////////////////////////////// -bool CAdScene::traverseNodes(bool doUpdate) { +bool AdScene::traverseNodes(bool doUpdate) { if (!_initialized) return STATUS_OK; int j, k; - CAdGame *adGame = (CAdGame *)_gameRef; + AdGame *adGame = (AdGame *)_gameRef; ////////////////////////////////////////////////////////////////////////// @@ -949,7 +949,7 @@ bool CAdScene::traverseNodes(bool doUpdate) { // make layer exclusive if (!doUpdate) { if (_layers[j]->_closeUp && !_gameRef->_editorMode) { - if (!_shieldWindow) _shieldWindow = new CUIWindow(_gameRef); + if (!_shieldWindow) _shieldWindow = new UIWindow(_gameRef); if (_shieldWindow) { _shieldWindow->_posX = _shieldWindow->_posY = 0; _shieldWindow->_width = _gameRef->_renderer->_width; @@ -978,7 +978,7 @@ bool CAdScene::traverseNodes(bool doUpdate) { // for each node for (k = 0; k < _layers[j]->_nodes.getSize(); k++) { - CAdSceneNode *node = _layers[j]->_nodes[k]; + AdSceneNode *node = _layers[j]->_nodes[k]; switch (node->_type) { case OBJECT_ENTITY: if (node->_entity->_active && (_gameRef->_editorMode || !node->_entity->_editorOnly)) { @@ -1030,13 +1030,13 @@ bool CAdScene::traverseNodes(bool doUpdate) { ////////////////////////////////////////////////////////////////////////// -bool CAdScene::display() { +bool AdScene::display() { return traverseNodes(false); } ////////////////////////////////////////////////////////////////////////// -bool CAdScene::updateFreeObjects() { - CAdGame *adGame = (CAdGame *)_gameRef; +bool AdScene::updateFreeObjects() { + AdGame *adGame = (AdGame *)_gameRef; bool is3DSet; // *** update all active objects @@ -1067,10 +1067,10 @@ bool CAdScene::updateFreeObjects() { ////////////////////////////////////////////////////////////////////////// -bool CAdScene::displayRegionContent(CAdRegion *region, bool display3DOnly) { - CAdGame *adGame = (CAdGame *)_gameRef; - CBArray objects; - CAdObject *obj; +bool AdScene::displayRegionContent(AdRegion *region, bool display3DOnly) { + AdGame *adGame = (AdGame *)_gameRef; + BaseArray objects; + AdObject *obj; // global objects for (int i = 0; i < adGame->_objects.getSize(); i++) { @@ -1089,7 +1089,7 @@ bool CAdScene::displayRegionContent(CAdRegion *region, bool display3DOnly) { } // sort by _posY - qsort(objects.getData(), objects.getSize(), sizeof(CAdObject *), CAdScene::compareObjs); + qsort(objects.getData(), objects.getSize(), sizeof(AdObject *), AdScene::compareObjs); // display them for (int i = 0; i < objects.getSize(); i++) { @@ -1120,9 +1120,9 @@ bool CAdScene::displayRegionContent(CAdRegion *region, bool display3DOnly) { } ////////////////////////////////////////////////////////////////////////// -int CAdScene::compareObjs(const void *obj1, const void *obj2) { - CAdObject *object1 = *(CAdObject **)obj1; - CAdObject *object2 = *(CAdObject **)obj2; +int AdScene::compareObjs(const void *obj1, const void *obj2) { + AdObject *object1 = *(AdObject **)obj1; + AdObject *object2 = *(AdObject **)obj2; if (object1->_posY < object2->_posY) return -1; else if (object1->_posY > object2->_posY) return 1; @@ -1130,9 +1130,9 @@ int CAdScene::compareObjs(const void *obj1, const void *obj2) { } ////////////////////////////////////////////////////////////////////////// -bool CAdScene::displayRegionContentOld(CAdRegion *region) { - CAdGame *adGame = (CAdGame *)_gameRef; - CAdObject *obj; +bool AdScene::displayRegionContentOld(AdRegion *region) { + AdGame *adGame = (AdGame *)_gameRef; + AdObject *obj; // display all objects in region sorted by _posY do { @@ -1180,12 +1180,12 @@ bool CAdScene::displayRegionContentOld(CAdRegion *region) { ////////////////////////////////////////////////////////////////////////// -bool CAdScene::update() { +bool AdScene::update() { return traverseNodes(true); } ////////////////////////////////////////////////////////////////////////// -void CAdScene::scrollTo(int offsetX, int offsetY) { +void AdScene::scrollTo(int offsetX, int offsetY) { int viewportWidth, viewportHeight; getViewportSize(&viewportWidth, &viewportHeight); @@ -1210,19 +1210,19 @@ void CAdScene::scrollTo(int offsetX, int offsetY) { ////////////////////////////////////////////////////////////////////////// -void CAdScene::scrollToObject(CBObject *object) { +void AdScene::scrollToObject(BaseObject *object) { if (object) scrollTo(object->_posX, object->_posY - object->getHeight() / 2); } ////////////////////////////////////////////////////////////////////////// -void CAdScene::skipToObject(CBObject *object) { +void AdScene::skipToObject(BaseObject *object) { if (object) skipTo(object->_posX, object->_posY - object->getHeight() / 2); } ////////////////////////////////////////////////////////////////////////// -void CAdScene::skipTo(int offsetX, int offsetY) { +void AdScene::skipTo(int offsetX, int offsetY) { int viewportWidth, viewportHeight; getViewportSize(&viewportWidth, &viewportHeight); @@ -1240,13 +1240,13 @@ void CAdScene::skipTo(int offsetX, int offsetY) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -bool CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool AdScene::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // LoadActor ////////////////////////////////////////////////////////////////////////// if (strcmp(name, "LoadActor") == 0) { stack->correctParams(1); - CAdActor *act = new CAdActor(_gameRef); + AdActor *act = new AdActor(_gameRef); if (act && DID_SUCCEED(act->loadFile(stack->pop()->getString()))) { addObject(act); stack->pushNative(act, true); @@ -1263,7 +1263,7 @@ bool CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSt ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "LoadEntity") == 0) { stack->correctParams(1); - CAdEntity *ent = new CAdEntity(_gameRef); + AdEntity *ent = new AdEntity(_gameRef); if (ent && DID_SUCCEED(ent->loadFile(stack->pop()->getString()))) { addObject(ent); stack->pushNative(ent, true); @@ -1280,9 +1280,9 @@ bool CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSt ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "CreateEntity") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); - CAdEntity *ent = new CAdEntity(_gameRef); + AdEntity *ent = new AdEntity(_gameRef); addObject(ent); if (!val->isNULL()) ent->setName(val->getString()); stack->pushNative(ent, true); @@ -1294,8 +1294,8 @@ bool CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSt ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "UnloadObject") == 0 || strcmp(name, "UnloadActor") == 0 || strcmp(name, "UnloadEntity") == 0 || strcmp(name, "UnloadActor3D") == 0 || strcmp(name, "DeleteEntity") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); - CAdObject *obj = (CAdObject *)val->getNative(); + ScValue *val = stack->pop(); + AdObject *obj = (AdObject *)val->getNative(); removeObject(obj); if (val->getType() == VAL_VARIABLE_REF) val->setNULL(); @@ -1308,10 +1308,10 @@ bool CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSt ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "SkipTo") == 0) { stack->correctParams(2); - CScValue *val1 = stack->pop(); - CScValue *val2 = stack->pop(); + ScValue *val1 = stack->pop(); + ScValue *val2 = stack->pop(); if (val1->isNative()) { - skipToObject((CBObject *)val1->getNative()); + skipToObject((BaseObject *)val1->getNative()); } else { skipTo(val1->getInt(), val2->getInt()); } @@ -1324,10 +1324,10 @@ bool CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSt ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "ScrollTo") == 0 || strcmp(name, "ScrollToAsync") == 0) { stack->correctParams(2); - CScValue *val1 = stack->pop(); - CScValue *val2 = stack->pop(); + ScValue *val1 = stack->pop(); + ScValue *val2 = stack->pop(); if (val1->isNative()) { - scrollToObject((CBObject *)val1->getNative()); + scrollToObject((BaseObject *)val1->getNative()); } else { scrollTo(val1->getInt(), val2->getInt()); } @@ -1341,7 +1341,7 @@ bool CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSt ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "GetLayer") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); if (val->isInt()) { int layer = val->getInt(); if (layer < 0 || layer >= _layers.getSize()) stack->pushNULL(); @@ -1379,8 +1379,8 @@ bool CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSt stack->correctParams(1); const char *nodeName = stack->pop()->getString(); - CBObject *node = getNodeByName(nodeName); - if (node) stack->pushNative((CBScriptable *)node, true); + BaseObject *node = getNodeByName(nodeName); + if (node) stack->pushNative((BaseScriptable *)node, true); else stack->pushNULL(); return STATUS_OK; @@ -1391,9 +1391,9 @@ bool CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSt ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "GetFreeNode") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); - CAdObject *ret = NULL; + AdObject *ret = NULL; if (val->isInt()) { int index = val->getInt(); if (index >= 0 && index < _objects.getSize()) ret = _objects[index]; @@ -1419,14 +1419,14 @@ bool CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSt stack->correctParams(3); int x = stack->pop()->getInt(); int y = stack->pop()->getInt(); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); bool includeDecors = false; if (!val->isNULL()) includeDecors = val->getBool(); if (_mainLayer) { for (int i = _mainLayer->_nodes.getSize() - 1; i >= 0; i--) { - CAdSceneNode *node = _mainLayer->_nodes[i]; + AdSceneNode *node = _mainLayer->_nodes[i]; if (node->_type == OBJECT_REGION && node->_region->_active && node->_region->pointInRegion(x, y)) { if (node->_region->_decoration && !includeDecors) continue; @@ -1570,7 +1570,7 @@ bool CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSt if (width <= 0) width = _gameRef->_renderer->_width; if (height <= 0) height = _gameRef->_renderer->_height; - if (!_viewport) _viewport = new CBViewport(_gameRef); + if (!_viewport) _viewport = new BaseViewport(_gameRef); if (_viewport) _viewport->setRect(x, y, x + width, y + height); stack->pushBool(true); @@ -1583,9 +1583,9 @@ bool CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSt ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "AddLayer") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); - CAdLayer *layer = new CAdLayer(_gameRef); + AdLayer *layer = new AdLayer(_gameRef); if (!val->isNULL()) layer->setName(val->getString()); if (_mainLayer) { layer->_width = _mainLayer->_width; @@ -1604,9 +1604,9 @@ bool CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSt else if (strcmp(name, "InsertLayer") == 0) { stack->correctParams(2); int index = stack->pop()->getInt(); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); - CAdLayer *layer = new CAdLayer(_gameRef); + AdLayer *layer = new AdLayer(_gameRef); if (!val->isNULL()) layer->setName(val->getString()); if (_mainLayer) { layer->_width = _mainLayer->_width; @@ -1627,11 +1627,11 @@ bool CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSt ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "DeleteLayer") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); - CAdLayer *toDelete = NULL; + AdLayer *toDelete = NULL; if (val->isNative()) { - CBScriptable *temp = val->getNative(); + BaseScriptable *temp = val->getNative(); for (int i = 0; i < _layers.getSize(); i++) { if (_layers[i] == temp) { toDelete = _layers[i]; @@ -1666,12 +1666,12 @@ bool CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSt return STATUS_OK; } - else return CBObject::scCallMethod(script, stack, thisStack, name); + else return BaseObject::scCallMethod(script, stack, thisStack, name); } ////////////////////////////////////////////////////////////////////////// -CScValue *CAdScene::scGetProperty(const char *name) { +ScValue *AdScene::scGetProperty(const char *name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// @@ -1829,12 +1829,12 @@ CScValue *CAdScene::scGetProperty(const char *name) { return _scValue; } - else return CBObject::scGetProperty(name); + else return BaseObject::scGetProperty(name); } ////////////////////////////////////////////////////////////////////////// -bool CAdScene::scSetProperty(const char *name, CScValue *value) { +bool AdScene::scSetProperty(const char *name, ScValue *value) { ////////////////////////////////////////////////////////////////////////// // Name ////////////////////////////////////////////////////////////////////////// @@ -1931,25 +1931,25 @@ bool CAdScene::scSetProperty(const char *name, CScValue *value) { return STATUS_OK; } - else return CBObject::scSetProperty(name, value); + else return BaseObject::scSetProperty(name, value); } ////////////////////////////////////////////////////////////////////////// -const char *CAdScene::scToString() { +const char *AdScene::scToString() { return "[scene object]"; } ////////////////////////////////////////////////////////////////////////// -bool CAdScene::addObject(CAdObject *object) { +bool AdScene::addObject(AdObject *object) { _objects.add(object); return _gameRef->registerObject(object); } ////////////////////////////////////////////////////////////////////////// -bool CAdScene::removeObject(CAdObject *object) { +bool AdScene::removeObject(AdObject *object) { for (int i = 0; i < _objects.getSize(); i++) { if (_objects[i] == object) { _objects.removeAt(i); @@ -1961,7 +1961,7 @@ bool CAdScene::removeObject(CAdObject *object) { ////////////////////////////////////////////////////////////////////////// -bool CAdScene::saveAsText(CBDynBuffer *buffer, int indent) { +bool AdScene::saveAsText(BaseDynamicBuffer *buffer, int indent) { int i; buffer->putTextIndent(indent, "SCENE {\n"); @@ -2019,7 +2019,7 @@ bool CAdScene::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent + 2, "\n"); - CBBase::saveAsText(buffer, indent + 2); + BaseClass::saveAsText(buffer, indent + 2); // waypoints buffer->putTextIndent(indent + 2, "; ----- waypoints\n"); @@ -2059,13 +2059,13 @@ bool CAdScene::saveAsText(CBDynBuffer *buffer, int indent) { ////////////////////////////////////////////////////////////////////////// -bool CAdScene::sortScaleLevels() { +bool AdScene::sortScaleLevels() { bool changed; do { changed = false; for (int i = 0; i < _scaleLevels.getSize() - 1; i++) { if (_scaleLevels[i]->_posY > _scaleLevels[i + 1]->_posY) { - CAdScaleLevel *sl = _scaleLevels[i]; + AdScaleLevel *sl = _scaleLevels[i]; _scaleLevels[i] = _scaleLevels[i + 1]; _scaleLevels[i + 1] = sl; @@ -2080,13 +2080,13 @@ bool CAdScene::sortScaleLevels() { ////////////////////////////////////////////////////////////////////////// -bool CAdScene::sortRotLevels() { +bool AdScene::sortRotLevels() { bool changed; do { changed = false; for (int i = 0; i < _rotLevels.getSize() - 1; i++) { if (_rotLevels[i]->_posX > _rotLevels[i + 1]->_posX) { - CAdRotLevel *rl = _rotLevels[i]; + AdRotLevel *rl = _rotLevels[i]; _rotLevels[i] = _rotLevels[i + 1]; _rotLevels[i + 1] = rl; @@ -2101,12 +2101,12 @@ bool CAdScene::sortRotLevels() { ////////////////////////////////////////////////////////////////////////// -float CAdScene::getScaleAt(int Y) { - CAdScaleLevel *prev = NULL; - CAdScaleLevel *next = NULL; +float AdScene::getScaleAt(int Y) { + AdScaleLevel *prev = NULL; + AdScaleLevel *next = NULL; for (int i = 0; i < _scaleLevels.getSize(); i++) { - /* CAdScaleLevel *xxx = _scaleLevels[i];*/ + /* AdScaleLevel *xxx = _scaleLevels[i];*/ /* int j = _scaleLevels.getSize(); */ if (_scaleLevels[i]->_posY < Y) prev = _scaleLevels[i]; else { @@ -2127,8 +2127,8 @@ float CAdScene::getScaleAt(int Y) { ////////////////////////////////////////////////////////////////////////// -bool CAdScene::persist(CBPersistMgr *persistMgr) { - CBObject::persist(persistMgr); +bool AdScene::persist(BasePersistenceManager *persistMgr) { + BaseObject::persist(persistMgr); persistMgr->transfer(TMEMBER(_autoScroll)); persistMgr->transfer(TMEMBER(_editorColBlocked)); @@ -2187,12 +2187,12 @@ bool CAdScene::persist(CBPersistMgr *persistMgr) { } ////////////////////////////////////////////////////////////////////////// -bool CAdScene::afterLoad() { +bool AdScene::afterLoad() { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CAdScene::correctTargetPoint2(int startX, int startY, int *targetX, int *targetY, bool checkFreeObjects, CBObject *requester) { +bool AdScene::correctTargetPoint2(int startX, int startY, int *targetX, int *targetY, bool checkFreeObjects, BaseObject *requester) { double xStep, yStep, x, y; int xLength, yLength, xCount, yCount; int x1, y1, x2, y2; @@ -2251,7 +2251,7 @@ bool CAdScene::correctTargetPoint2(int startX, int startY, int *targetX, int *ta } ////////////////////////////////////////////////////////////////////////// -bool CAdScene::correctTargetPoint(int startX, int startY, int *argX, int *argY, bool checkFreeObjects, CBObject *requester) { +bool AdScene::correctTargetPoint(int startX, int startY, int *argX, int *argY, bool checkFreeObjects, BaseObject *requester) { int x = *argX; int y = *argY; @@ -2328,15 +2328,15 @@ bool CAdScene::correctTargetPoint(int startX, int startY, int *argX, int *argY, ////////////////////////////////////////////////////////////////////////// -void CAdScene::pfPointsStart() { +void AdScene::pfPointsStart() { _pfPointsNum = 0; } ////////////////////////////////////////////////////////////////////////// -void CAdScene::pfPointsAdd(int x, int y, int distance) { +void AdScene::pfPointsAdd(int x, int y, int distance) { if (_pfPointsNum >= _pfPath.getSize()) { - _pfPath.add(new CAdPathPoint(x, y, distance)); + _pfPath.add(new AdPathPoint(x, y, distance)); } else { _pfPath[_pfPointsNum]->x = x; _pfPath[_pfPointsNum]->y = y; @@ -2350,8 +2350,8 @@ void CAdScene::pfPointsAdd(int x, int y, int distance) { ////////////////////////////////////////////////////////////////////////// -bool CAdScene::getViewportOffset(int *offsetX, int *offsetY) { - CAdGame *adGame = (CAdGame *)_gameRef; +bool AdScene::getViewportOffset(int *offsetX, int *offsetY) { + AdGame *adGame = (AdGame *)_gameRef; if (_viewport && !_gameRef->_editorMode) { if (offsetX) *offsetX = _viewport->_offsetX; if (offsetY) *offsetY = _viewport->_offsetY; @@ -2367,8 +2367,8 @@ bool CAdScene::getViewportOffset(int *offsetX, int *offsetY) { ////////////////////////////////////////////////////////////////////////// -bool CAdScene::getViewportSize(int *width, int *height) { - CAdGame *adGame = (CAdGame *)_gameRef; +bool AdScene::getViewportSize(int *width, int *height) { + AdGame *adGame = (AdGame *)_gameRef; if (_viewport && !_gameRef->_editorMode) { if (width) *width = _viewport->getWidth(); if (height) *height = _viewport->getHeight(); @@ -2384,7 +2384,7 @@ bool CAdScene::getViewportSize(int *width, int *height) { ////////////////////////////////////////////////////////////////////////// -int CAdScene::getOffsetLeft() { +int AdScene::getOffsetLeft() { int viewportX; getViewportOffset(&viewportX); @@ -2393,7 +2393,7 @@ int CAdScene::getOffsetLeft() { ////////////////////////////////////////////////////////////////////////// -int CAdScene::getOffsetTop() { +int AdScene::getOffsetTop() { int viewportY; getViewportOffset(NULL, &viewportY); @@ -2402,7 +2402,7 @@ int CAdScene::getOffsetTop() { ////////////////////////////////////////////////////////////////////////// -bool CAdScene::pointInViewport(int x, int y) { +bool AdScene::pointInViewport(int x, int y) { int left, top, width, height; getViewportOffset(&left, &top); @@ -2413,21 +2413,21 @@ bool CAdScene::pointInViewport(int x, int y) { ////////////////////////////////////////////////////////////////////////// -void CAdScene::setOffset(int offsetLeft, int offsetTop) { +void AdScene::setOffset(int offsetLeft, int offsetTop) { _offsetLeft = offsetLeft; _offsetTop = offsetTop; } ////////////////////////////////////////////////////////////////////////// -CBObject *CAdScene::getNodeByName(const char *name) { - CBObject *ret = NULL; +BaseObject *AdScene::getNodeByName(const char *name) { + BaseObject *ret = NULL; // dependent objects for (int i = 0; i < _layers.getSize(); i++) { - CAdLayer *layer = _layers[i]; + AdLayer *layer = _layers[i]; for (int j = 0; j < layer->_nodes.getSize(); j++) { - CAdSceneNode *node = layer->_nodes[j]; + AdSceneNode *node = layer->_nodes[j]; if ((node->_type == OBJECT_ENTITY && !scumm_stricmp(name, node->_entity->_name)) || (node->_type == OBJECT_REGION && !scumm_stricmp(name, node->_region->_name))) { switch (node->_type) { @@ -2464,32 +2464,32 @@ CBObject *CAdScene::getNodeByName(const char *name) { ////////////////////////////////////////////////////////////////////////// -bool CAdScene::saveState() { +bool AdScene::saveState() { return persistState(true); } ////////////////////////////////////////////////////////////////////////// -bool CAdScene::loadState() { +bool AdScene::loadState() { return persistState(false); } ////////////////////////////////////////////////////////////////////////// -bool CAdScene::persistState(bool saving) { +bool AdScene::persistState(bool saving) { if (!_persistentState) return STATUS_OK; - CAdGame *adGame = (CAdGame *)_gameRef; - CAdSceneState *state = adGame->getSceneState(_filename, saving); + AdGame *adGame = (AdGame *)_gameRef; + AdSceneState *state = adGame->getSceneState(_filename, saving); if (!state) return STATUS_OK; - CAdNodeState *nodeState; + AdNodeState *nodeState; // dependent objects for (int i = 0; i < _layers.getSize(); i++) { - CAdLayer *layer = _layers[i]; + AdLayer *layer = _layers[i]; for (int j = 0; j < layer->_nodes.getSize(); j++) { - CAdSceneNode *node = layer->_nodes[j]; + AdSceneNode *node = layer->_nodes[j]; switch (node->_type) { case OBJECT_ENTITY: if (!node->_entity->_saveState) continue; @@ -2509,7 +2509,7 @@ bool CAdScene::persistState(bool saving) { } break; default: - warning("CAdScene::PersistState - unhandled enum"); + warning("AdScene::PersistState - unhandled enum"); break; } } @@ -2521,7 +2521,7 @@ bool CAdScene::persistState(bool saving) { if (_objects[i]->_type == OBJECT_ENTITY) { nodeState = state->getNodeState(_objects[i]->_name, saving); if (nodeState) { - nodeState->transferEntity((CAdEntity *)_objects[i], _persistentStateSprites, saving); + nodeState->transferEntity((AdEntity *)_objects[i], _persistentStateSprites, saving); //if(Saving) NodeState->_active = _objects[i]->_active; //else _objects[i]->_active = NodeState->_active; } @@ -2542,12 +2542,12 @@ bool CAdScene::persistState(bool saving) { ////////////////////////////////////////////////////////////////////////// -float CAdScene::getRotationAt(int x, int y) { - CAdRotLevel *prev = NULL; - CAdRotLevel *next = NULL; +float AdScene::getRotationAt(int x, int y) { + AdRotLevel *prev = NULL; + AdRotLevel *next = NULL; for (int i = 0; i < _rotLevels.getSize(); i++) { - /* CAdRotLevel *xxx = _rotLevels[i]; + /* AdRotLevel *xxx = _rotLevels[i]; int j = _rotLevels.getSize();*/ if (_rotLevels[i]->_posX < x) prev = _rotLevels[i]; else { @@ -2568,12 +2568,12 @@ float CAdScene::getRotationAt(int x, int y) { ////////////////////////////////////////////////////////////////////////// -bool CAdScene::handleItemAssociations(const char *itemName, bool show) { +bool AdScene::handleItemAssociations(const char *itemName, bool show) { for (int i = 0; i < _layers.getSize(); i++) { - CAdLayer *layer = _layers[i]; + AdLayer *layer = _layers[i]; for (int j = 0; j < layer->_nodes.getSize(); j++) { if (layer->_nodes[j]->_type == OBJECT_ENTITY) { - CAdEntity *ent = layer->_nodes[j]->_entity; + AdEntity *ent = layer->_nodes[j]->_entity; if (ent->_item && strcmp(ent->_item, itemName) == 0) ent->_active = show; } @@ -2582,7 +2582,7 @@ bool CAdScene::handleItemAssociations(const char *itemName, bool show) { for (int i = 0; i < _objects.getSize(); i++) { if (_objects[i]->_type == OBJECT_ENTITY) { - CAdEntity *ent = (CAdEntity *)_objects[i]; + AdEntity *ent = (AdEntity *)_objects[i]; if (ent->_item && strcmp(ent->_item, itemName) == 0) ent->_active = show; } } @@ -2592,11 +2592,11 @@ bool CAdScene::handleItemAssociations(const char *itemName, bool show) { ////////////////////////////////////////////////////////////////////////// -bool CAdScene::getRegionsAt(int x, int y, CAdRegion **regionList, int numRegions) { +bool AdScene::getRegionsAt(int x, int y, AdRegion **regionList, int numRegions) { int numUsed = 0; if (_mainLayer) { for (int i = _mainLayer->_nodes.getSize() - 1; i >= 0; i--) { - CAdSceneNode *node = _mainLayer->_nodes[i]; + AdSceneNode *node = _mainLayer->_nodes[i]; if (node->_type == OBJECT_REGION && node->_region->_active && node->_region->pointInRegion(x, y)) { if (numUsed < numRegions - 1) { regionList[numUsed] = node->_region; @@ -2613,14 +2613,14 @@ bool CAdScene::getRegionsAt(int x, int y, CAdRegion **regionList, int numRegions } ////////////////////////////////////////////////////////////////////////// -bool CAdScene::restoreDeviceObjects() { +bool AdScene::restoreDeviceObjects() { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -CBObject *CAdScene::getNextAccessObject(CBObject *currObject) { - CBArray objects; +BaseObject *AdScene::getNextAccessObject(BaseObject *currObject) { + BaseArray objects; getSceneObjects(objects, true); if (objects.getSize() == 0) return NULL; @@ -2639,8 +2639,8 @@ CBObject *CAdScene::getNextAccessObject(CBObject *currObject) { } ////////////////////////////////////////////////////////////////////////// -CBObject *CAdScene::getPrevAccessObject(CBObject *currObject) { - CBArray objects; +BaseObject *AdScene::getPrevAccessObject(BaseObject *currObject) { + BaseArray objects; getSceneObjects(objects, true); if (objects.getSize() == 0) return NULL; @@ -2660,24 +2660,24 @@ CBObject *CAdScene::getPrevAccessObject(CBObject *currObject) { ////////////////////////////////////////////////////////////////////////// -bool CAdScene::getSceneObjects(CBArray &objects, bool interactiveOnly) { +bool AdScene::getSceneObjects(BaseArray &objects, bool interactiveOnly) { for (int i = 0; i < _layers.getSize(); i++) { // close-up layer -> remove everything below it if (interactiveOnly && _layers[i]->_closeUp) objects.removeAll(); for (int j = 0; j < _layers[i]->_nodes.getSize(); j++) { - CAdSceneNode *node = _layers[i]->_nodes[j]; + AdSceneNode *node = _layers[i]->_nodes[j]; switch (node->_type) { case OBJECT_ENTITY: { - CAdEntity *ent = node->_entity; + AdEntity *ent = node->_entity; if (ent->_active && (ent->_registrable || !interactiveOnly)) objects.add(ent); } break; case OBJECT_REGION: { - CBArray regionObj; + BaseArray regionObj; getRegionObjects(node->_region, regionObj, interactiveOnly); for (int newIndex = 0; newIndex < regionObj.getSize(); newIndex++) { bool found = false; @@ -2693,14 +2693,14 @@ bool CAdScene::getSceneObjects(CBArray &objects, bool } break; default: - warning("CAdScene::GetSceneObjects - Unhandled enum"); + warning("AdScene::GetSceneObjects - Unhandled enum"); break; } } } // objects outside any region - CBArray regionObj; + BaseArray regionObj; getRegionObjects(NULL, regionObj, interactiveOnly); for (int newIndex = 0; newIndex < regionObj.getSize(); newIndex++) { bool found = false; @@ -2719,9 +2719,9 @@ bool CAdScene::getSceneObjects(CBArray &objects, bool ////////////////////////////////////////////////////////////////////////// -bool CAdScene::getRegionObjects(CAdRegion *region, CBArray &objects, bool interactiveOnly) { - CAdGame *adGame = (CAdGame *)_gameRef; - CAdObject *obj; +bool AdScene::getRegionObjects(AdRegion *region, BaseArray &objects, bool interactiveOnly) { + AdGame *adGame = (AdGame *)_gameRef; + AdObject *obj; // global objects for (int i = 0; i < adGame->_objects.getSize(); i++) { @@ -2744,7 +2744,7 @@ bool CAdScene::getRegionObjects(CAdRegion *region, CBArray &Objects, bool InteractiveOnly); - bool getRegionObjects(CAdRegion *Region, CBArray &Objects, bool InteractiveOnly); + BaseObject *getNextAccessObject(BaseObject *CurrObject); + BaseObject *getPrevAccessObject(BaseObject *CurrObject); + bool getSceneObjects(BaseArray &Objects, bool InteractiveOnly); + bool getRegionObjects(AdRegion *Region, BaseArray &Objects, bool InteractiveOnly); bool afterLoad(); - bool getRegionsAt(int X, int Y, CAdRegion **RegionList, int NumRegions); + bool getRegionsAt(int X, int Y, AdRegion **RegionList, int NumRegions); bool handleItemAssociations(const char *ItemName, bool Show); - CUIWindow *_shieldWindow; + UIWindow *_shieldWindow; float getRotationAt(int X, int Y); bool loadState(); bool saveState(); bool _persistentState; bool _persistentStateSprites; - CBObject *getNodeByName(const char *name); + BaseObject *getNodeByName(const char *name); void setOffset(int OffsetLeft, int OffsetTop); bool pointInViewport(int X, int Y); int getOffsetTop(); int getOffsetLeft(); bool getViewportSize(int *Width = NULL, int *Height = NULL); bool getViewportOffset(int *OffsetX = NULL, int *OffsetY = NULL); - CBViewport *_viewport; - CBFader *_fader; + BaseViewport *_viewport; + BaseFader *_fader; int _pfPointsNum; void pfPointsAdd(int X, int Y, int Distance); void pfPointsStart(); bool _initialized; - bool correctTargetPoint(int StartX, int StartY, int *X, int *Y, bool CheckFreeObjects = false, CBObject *Requester = NULL); - bool correctTargetPoint2(int StartX, int StartY, int *TargetX, int *TargetY, bool CheckFreeObjects, CBObject *Requester); - DECLARE_PERSISTENT(CAdScene, CBObject) - bool displayRegionContent(CAdRegion *Region = NULL, bool Display3DOnly = false); - bool displayRegionContentOld(CAdRegion *Region = NULL); + bool correctTargetPoint(int StartX, int StartY, int *X, int *Y, bool CheckFreeObjects = false, BaseObject *Requester = NULL); + bool correctTargetPoint2(int StartX, int StartY, int *TargetX, int *TargetY, bool CheckFreeObjects, BaseObject *Requester); + DECLARE_PERSISTENT(AdScene, BaseObject) + bool displayRegionContent(AdRegion *Region = NULL, bool Display3DOnly = false); + bool displayRegionContentOld(AdRegion *Region = NULL); static int compareObjs(const void *Obj1, const void *Obj2); bool updateFreeObjects(); @@ -87,14 +87,14 @@ public: float getScaleAt(int Y); bool sortScaleLevels(); bool sortRotLevels(); - virtual bool saveAsText(CBDynBuffer *buffer, int indent); + virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent); uint32 getAlphaAt(int X, int Y, bool ColorCheck = false); bool _paralaxScrolling; void skipTo(int OffsetX, int OffsetY); void setDefaults(); void cleanup(); - void skipToObject(CBObject *Object); - void scrollToObject(CBObject *Object); + void skipToObject(BaseObject *Object); + void scrollToObject(BaseObject *Object); void scrollTo(int OffsetX, int OffsetY); virtual bool update(); bool _autoScroll; @@ -113,22 +113,22 @@ public: uint32 _pfMaxTime; bool initLoop(); void pathFinderStep(); - bool isBlockedAt(int X, int Y, bool CheckFreeObjects = false, CBObject *Requester = NULL); - bool isWalkableAt(int X, int Y, bool CheckFreeObjects = false, CBObject *Requester = NULL); - CAdLayer *_mainLayer; + bool isBlockedAt(int X, int Y, bool CheckFreeObjects = false, BaseObject *Requester = NULL); + bool isWalkableAt(int X, int Y, bool CheckFreeObjects = false, BaseObject *Requester = NULL); + AdLayer *_mainLayer; float getZoomAt(int X, int Y); - bool getPath(CBPoint source, CBPoint target, CAdPath *path, CBObject *requester = NULL); - CAdScene(CBGame *inGame); - virtual ~CAdScene(); - CBArray _layers; - CBArray _objects; - CBArray _waypointGroups; + bool getPath(BasePoint source, BasePoint target, AdPath *path, BaseObject *requester = NULL); + AdScene(BaseGame *inGame); + virtual ~AdScene(); + BaseArray _layers; + BaseArray _objects; + BaseArray _waypointGroups; bool loadFile(const char *filename); bool loadBuffer(byte *buffer, bool complete = true); int _width; int _height; - bool addObject(CAdObject *Object); - bool removeObject(CAdObject *Object); + bool addObject(AdObject *Object); + bool removeObject(AdObject *Object); int _editorMarginH; int _editorMarginV; uint32 _editorColFrame; @@ -149,27 +149,27 @@ public: bool _editorShowDecor; bool _editorShowEntities; bool _editorShowScale; - CBArray _scaleLevels; - CBArray _rotLevels; + BaseArray _scaleLevels; + BaseArray _rotLevels; virtual bool restoreDeviceObjects(); - int getPointsDist(CBPoint p1, CBPoint p2, CBObject *requester = NULL); + int getPointsDist(BasePoint p1, BasePoint p2, BaseObject *requester = NULL); // scripting interface - virtual CScValue *scGetProperty(const char *name); - virtual bool scSetProperty(const char *name, CScValue *value); - virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual ScValue *scGetProperty(const char *name); + virtual bool scSetProperty(const char *name, ScValue *value); + virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); virtual const char *scToString(); private: bool persistState(bool Saving = true); - void pfAddWaypointGroup(CAdWaypointGroup *Wpt, CBObject *Requester = NULL); + void pfAddWaypointGroup(AdWaypointGroup *Wpt, BaseObject *Requester = NULL); bool _pfReady; - CBPoint *_pfTarget; - CAdPath *_pfTargetPath; - CBObject *_pfRequester; - CBArray _pfPath; + BasePoint *_pfTarget; + AdPath *_pfTargetPath; + BaseObject *_pfRequester; + BaseArray _pfPath; int _offsetTop; int _offsetLeft; diff --git a/engines/wintermute/ad/ad_scene_node.cpp b/engines/wintermute/ad/ad_scene_node.cpp index da7082105f..dbf68ff0ca 100644 --- a/engines/wintermute/ad/ad_scene_node.cpp +++ b/engines/wintermute/ad/ad_scene_node.cpp @@ -32,10 +32,10 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CAdSceneNode, false) +IMPLEMENT_PERSISTENT(AdSceneNode, false) ////////////////////////////////////////////////////////////////////////// -CAdSceneNode::CAdSceneNode(CBGame *inGame): CBObject(inGame) { +AdSceneNode::AdSceneNode(BaseGame *inGame): BaseObject(inGame) { _type = OBJECT_NONE; _region = NULL; _entity = NULL; @@ -43,7 +43,7 @@ CAdSceneNode::CAdSceneNode(CBGame *inGame): CBObject(inGame) { ////////////////////////////////////////////////////////////////////////// -CAdSceneNode::~CAdSceneNode() { +AdSceneNode::~AdSceneNode() { _gameRef->unregisterObject(_region); _region = NULL; @@ -53,7 +53,7 @@ CAdSceneNode::~CAdSceneNode() { ////////////////////////////////////////////////////////////////////////// -bool CAdSceneNode::setEntity(CAdEntity *entity) { +bool AdSceneNode::setEntity(AdEntity *entity) { _type = OBJECT_ENTITY; _entity = entity; return _gameRef->registerObject(entity); @@ -61,7 +61,7 @@ bool CAdSceneNode::setEntity(CAdEntity *entity) { ////////////////////////////////////////////////////////////////////////// -bool CAdSceneNode::setRegion(CAdRegion *region) { +bool AdSceneNode::setRegion(AdRegion *region) { _type = OBJECT_REGION; _region = region; return _gameRef->registerObject(region); @@ -69,9 +69,9 @@ bool CAdSceneNode::setRegion(CAdRegion *region) { ////////////////////////////////////////////////////////////////////////// -bool CAdSceneNode::persist(CBPersistMgr *persistMgr) { +bool AdSceneNode::persist(BasePersistenceManager *persistMgr) { - CBObject::persist(persistMgr); + BaseObject::persist(persistMgr); persistMgr->transfer(TMEMBER(_entity)); persistMgr->transfer(TMEMBER(_region)); diff --git a/engines/wintermute/ad/ad_scene_node.h b/engines/wintermute/ad/ad_scene_node.h index 1c25f91a2d..b56c351bc8 100644 --- a/engines/wintermute/ad/ad_scene_node.h +++ b/engines/wintermute/ad/ad_scene_node.h @@ -36,16 +36,16 @@ namespace WinterMute { -class CAdSceneNode : public CBObject { +class AdSceneNode : public BaseObject { public: - DECLARE_PERSISTENT(CAdSceneNode, CBObject) - bool setRegion(CAdRegion *region); - bool setEntity(CAdEntity *entity); - CAdEntity *_entity; - CAdRegion *_region; + DECLARE_PERSISTENT(AdSceneNode, BaseObject) + bool setRegion(AdRegion *region); + bool setEntity(AdEntity *entity); + AdEntity *_entity; + AdRegion *_region; TObjectType _type; - CAdSceneNode(CBGame *inGame); - virtual ~CAdSceneNode(); + AdSceneNode(BaseGame *inGame); + virtual ~AdSceneNode(); }; diff --git a/engines/wintermute/ad/ad_scene_state.cpp b/engines/wintermute/ad/ad_scene_state.cpp index 2ac36054a5..da7b417470 100644 --- a/engines/wintermute/ad/ad_scene_state.cpp +++ b/engines/wintermute/ad/ad_scene_state.cpp @@ -35,16 +35,16 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CAdSceneState, false) +IMPLEMENT_PERSISTENT(AdSceneState, false) ////////////////////////////////////////////////////////////////////////// -CAdSceneState::CAdSceneState(CBGame *inGame): CBBase(inGame) { +AdSceneState::AdSceneState(BaseGame *inGame): BaseClass(inGame) { _filename = NULL; } ////////////////////////////////////////////////////////////////////////// -CAdSceneState::~CAdSceneState() { +AdSceneState::~AdSceneState() { delete[] _filename; _filename = NULL; @@ -54,7 +54,7 @@ CAdSceneState::~CAdSceneState() { ////////////////////////////////////////////////////////////////////////// -bool CAdSceneState::persist(CBPersistMgr *persistMgr) { +bool AdSceneState::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_filename)); _nodeStates.persist(persistMgr); @@ -63,7 +63,7 @@ bool CAdSceneState::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -void CAdSceneState::setFilename(const char *filename) { +void AdSceneState::setFilename(const char *filename) { delete[] _filename; _filename = new char [strlen(filename) + 1]; if (_filename) strcpy(_filename, filename); @@ -71,13 +71,13 @@ void CAdSceneState::setFilename(const char *filename) { ////////////////////////////////////////////////////////////////////////// -CAdNodeState *CAdSceneState::getNodeState(char *name, bool saving) { +AdNodeState *AdSceneState::getNodeState(char *name, bool saving) { for (int i = 0; i < _nodeStates.getSize(); i++) { if (scumm_stricmp(_nodeStates[i]->_name, name) == 0) return _nodeStates[i]; } if (saving) { - CAdNodeState *ret = new CAdNodeState(_gameRef); + AdNodeState *ret = new AdNodeState(_gameRef); ret->setName(name); _nodeStates.add(ret); diff --git a/engines/wintermute/ad/ad_scene_state.h b/engines/wintermute/ad/ad_scene_state.h index 6df20e0578..7231ba52db 100644 --- a/engines/wintermute/ad/ad_scene_state.h +++ b/engines/wintermute/ad/ad_scene_state.h @@ -34,16 +34,16 @@ #include "engines/wintermute/coll_templ.h" namespace WinterMute { -class CAdNodeState; -class CAdSceneState : public CBBase { +class AdNodeState; +class AdSceneState : public BaseClass { public: - CAdNodeState *getNodeState(char *name, bool saving); + AdNodeState *getNodeState(char *name, bool saving); void setFilename(const char *filename); - DECLARE_PERSISTENT(CAdSceneState, CBBase) - CAdSceneState(CBGame *inGame); - virtual ~CAdSceneState(); + DECLARE_PERSISTENT(AdSceneState, BaseClass) + AdSceneState(BaseGame *inGame); + virtual ~AdSceneState(); char *_filename; - CBArray _nodeStates; + BaseArray _nodeStates; }; } // end of namespace WinterMute diff --git a/engines/wintermute/ad/ad_sentence.cpp b/engines/wintermute/ad/ad_sentence.cpp index 2607993aa0..ba59f57451 100644 --- a/engines/wintermute/ad/ad_sentence.cpp +++ b/engines/wintermute/ad/ad_sentence.cpp @@ -41,10 +41,10 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CAdSentence, false) +IMPLEMENT_PERSISTENT(AdSentence, false) ////////////////////////////////////////////////////////////////////////// -CAdSentence::CAdSentence(CBGame *inGame): CBBase(inGame) { +AdSentence::AdSentence(BaseGame *inGame): BaseClass(inGame) { _text = NULL; _stances = NULL; _tempStance = NULL; @@ -72,7 +72,7 @@ CAdSentence::CAdSentence(CBGame *inGame): CBBase(inGame) { ////////////////////////////////////////////////////////////////////////// -CAdSentence::~CAdSentence() { +AdSentence::~AdSentence() { delete _sound; delete[] _text; delete[] _stances; @@ -91,7 +91,7 @@ CAdSentence::~CAdSentence() { ////////////////////////////////////////////////////////////////////////// -void CAdSentence::setText(const char *text) { +void AdSentence::setText(const char *text) { if (_text) delete [] _text; _text = new char[strlen(text) + 1]; if (_text) strcpy(_text, text); @@ -99,7 +99,7 @@ void CAdSentence::setText(const char *text) { ////////////////////////////////////////////////////////////////////////// -void CAdSentence::setStances(const char *stances) { +void AdSentence::setStances(const char *stances) { if (_stances) delete [] _stances; if (stances) { _stances = new char[strlen(stances) + 1]; @@ -109,20 +109,20 @@ void CAdSentence::setStances(const char *stances) { ////////////////////////////////////////////////////////////////////////// -char *CAdSentence::getCurrentStance() { +char *AdSentence::getCurrentStance() { return getStance(_currentStance); } ////////////////////////////////////////////////////////////////////////// -char *CAdSentence::getNextStance() { +char *AdSentence::getNextStance() { _currentStance++; return getStance(_currentStance); } ////////////////////////////////////////////////////////////////////////// -char *CAdSentence::getStance(int stance) { +char *AdSentence::getStance(int stance) { if (_stances == NULL) return NULL; if (_tempStance) delete [] _tempStance; @@ -165,7 +165,7 @@ char *CAdSentence::getStance(int stance) { ////////////////////////////////////////////////////////////////////////// -bool CAdSentence::display() { +bool AdSentence::display() { if (!_font || !_text) return STATUS_FAILED; if (_sound && !_soundStarted) { @@ -178,8 +178,8 @@ bool CAdSentence::display() { int y = _pos.y; if (!_fixedPos) { - x = x - ((CAdGame *)_gameRef)->_scene->getOffsetLeft(); - y = y - ((CAdGame *)_gameRef)->_scene->getOffsetTop(); + x = x - ((AdGame *)_gameRef)->_scene->getOffsetLeft(); + y = y - ((AdGame *)_gameRef)->_scene->getOffsetTop(); } @@ -195,7 +195,7 @@ bool CAdSentence::display() { ////////////////////////////////////////////////////////////////////////// -void CAdSentence::setSound(CBSound *sound) { +void AdSentence::setSound(BaseSound *sound) { if (!sound) return; delete _sound; _sound = sound; @@ -204,14 +204,14 @@ void CAdSentence::setSound(CBSound *sound) { ////////////////////////////////////////////////////////////////////////// -bool CAdSentence::finish() { +bool AdSentence::finish() { if (_sound) _sound->stop(); return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CAdSentence::persist(CBPersistMgr *persistMgr) { +bool AdSentence::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_gameRef)); @@ -238,7 +238,7 @@ bool CAdSentence::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -bool CAdSentence::setupTalkFile(const char *soundFilename) { +bool AdSentence::setupTalkFile(const char *soundFilename) { delete _talkDef; _talkDef = NULL; _currentSprite = NULL; @@ -257,7 +257,7 @@ bool CAdSentence::setupTalkFile(const char *soundFilename) { } else return STATUS_OK; // no talk def file found - _talkDef = new CAdTalkDef(_gameRef); + _talkDef = new AdTalkDef(_gameRef); if (!_talkDef || DID_FAIL(_talkDef->loadFile(talkDefFileName.c_str()))) { delete _talkDef; _talkDef = NULL; @@ -270,7 +270,7 @@ bool CAdSentence::setupTalkFile(const char *soundFilename) { ////////////////////////////////////////////////////////////////////////// -bool CAdSentence::update(TDirection dir) { +bool AdSentence::update(TDirection dir) { if (!_talkDef) return STATUS_OK; uint32 currentTime; @@ -287,7 +287,7 @@ bool CAdSentence::update(TDirection dir) { if (_talkDef->_nodes[i]->isInTimeInterval(currentTime, dir)) { talkNodeFound = true; - CBSprite *newSprite = _talkDef->_nodes[i]->getSprite(dir); + BaseSprite *newSprite = _talkDef->_nodes[i]->getSprite(dir); if (newSprite != _currentSprite) newSprite->reset(); _currentSprite = newSprite; @@ -298,7 +298,7 @@ bool CAdSentence::update(TDirection dir) { // no talk node, try to use default sprite instead (if any) if (!talkNodeFound) { - CBSprite *newSprite = _talkDef->getDefaultSprite(dir); + BaseSprite *newSprite = _talkDef->getDefaultSprite(dir); if (newSprite) { if (newSprite != _currentSprite) newSprite->reset(); _currentSprite = newSprite; @@ -309,7 +309,7 @@ bool CAdSentence::update(TDirection dir) { } ////////////////////////////////////////////////////////////////////////// -bool CAdSentence::CanSkip() { +bool AdSentence::CanSkip() { // prevent accidental sentence skipping (TODO make configurable) return (_gameRef->_timer - _startTime) > 300; } diff --git a/engines/wintermute/ad/ad_sentence.h b/engines/wintermute/ad/ad_sentence.h index 40f99ea830..6883bd8893 100644 --- a/engines/wintermute/ad/ad_sentence.h +++ b/engines/wintermute/ad/ad_sentence.h @@ -37,28 +37,28 @@ #include "common/rect.h" namespace WinterMute { -class CAdTalkDef; -class CBFont; -class CBSprite; -class CBSound; -class CAdSentence : public CBBase { +class AdTalkDef; +class BaseFont; +class BaseSprite; +class BaseSound; +class AdSentence : public BaseClass { public: bool _freezable; bool _fixedPos; - CBSprite *_currentSprite; + BaseSprite *_currentSprite; char *_currentSkelAnim; bool update(TDirection dir = DI_DOWN); bool setupTalkFile(const char *soundFilename); - DECLARE_PERSISTENT(CAdSentence, CBBase) + DECLARE_PERSISTENT(AdSentence, BaseClass) bool finish(); - void setSound(CBSound *Sound); + void setSound(BaseSound *Sound); bool _soundStarted; - CBSound *_sound; + BaseSound *_sound; TTextAlign _align; bool display(); int _width; Point32 _pos; - CBFont *_font; + BaseFont *_font; char *getNextStance(); char *getCurrentStance(); void setStances(const char *stances); @@ -68,9 +68,9 @@ public: char *_stances; char *_text; uint32 _duration; - CAdSentence(CBGame *inGame); - virtual ~CAdSentence(); - CAdTalkDef *_talkDef; + AdSentence(BaseGame *inGame); + virtual ~AdSentence(); + AdTalkDef *_talkDef; bool CanSkip(); diff --git a/engines/wintermute/ad/ad_sprite_set.cpp b/engines/wintermute/ad/ad_sprite_set.cpp index f0925c6913..b594bd0467 100644 --- a/engines/wintermute/ad/ad_sprite_set.cpp +++ b/engines/wintermute/ad/ad_sprite_set.cpp @@ -35,10 +35,10 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CAdSpriteSet, false) +IMPLEMENT_PERSISTENT(AdSpriteSet, false) ////////////////////////////////////////////////////////////////////////// -CAdSpriteSet::CAdSpriteSet(CBGame *inGame, CBObject *owner): CBObject(inGame) { +AdSpriteSet::AdSpriteSet(BaseGame *inGame, BaseObject *owner): BaseObject(inGame) { _owner = owner; for (int i = 0; i < NUM_DIRECTIONS; i++) @@ -47,7 +47,7 @@ CAdSpriteSet::CAdSpriteSet(CBGame *inGame, CBObject *owner): CBObject(inGame) { ////////////////////////////////////////////////////////////////////////// -CAdSpriteSet::~CAdSpriteSet() { +AdSpriteSet::~AdSpriteSet() { for (int i = 0; i < NUM_DIRECTIONS; i++) { delete _sprites[i]; _sprites[i] = NULL; @@ -58,10 +58,10 @@ CAdSpriteSet::~CAdSpriteSet() { ////////////////////////////////////////////////////////////////////////// -bool CAdSpriteSet::loadFile(const char *filename, int lifeTime, TSpriteCacheType cacheType) { +bool AdSpriteSet::loadFile(const char *filename, int lifeTime, TSpriteCacheType cacheType) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { - _gameRef->LOG(0, "CAdSpriteSet::LoadFile failed for file '%s'", filename); + _gameRef->LOG(0, "AdSpriteSet::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -90,7 +90,7 @@ TOKEN_DEF(TEMPLATE) TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -bool CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteCacheType CacheType) { +bool AdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteCacheType CacheType) { TOKEN_TABLE_START(commands) TOKEN_TABLE(SPRITESET) TOKEN_TABLE(NAME) @@ -108,7 +108,7 @@ bool CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSprite byte *params; int cmd; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); if (complete) { if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_SPRITESET) { @@ -118,7 +118,7 @@ bool CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSprite buffer = params; } - CBSprite *spr = NULL; + BaseSprite *spr = NULL; while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)¶ms)) > 0) { switch (cmd) { case TOKEN_TEMPLATE: @@ -132,7 +132,7 @@ bool CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSprite case TOKEN_LEFT: delete _sprites[DI_LEFT]; _sprites[DI_LEFT] = NULL; - spr = new CBSprite(_gameRef, _owner); + spr = new BaseSprite(_gameRef, _owner); if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC; else _sprites[DI_LEFT] = spr; break; @@ -140,7 +140,7 @@ bool CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSprite case TOKEN_RIGHT: delete _sprites[DI_RIGHT]; _sprites[DI_RIGHT] = NULL; - spr = new CBSprite(_gameRef, _owner); + spr = new BaseSprite(_gameRef, _owner); if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC; else _sprites[DI_RIGHT] = spr; break; @@ -148,7 +148,7 @@ bool CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSprite case TOKEN_UP: delete _sprites[DI_UP]; _sprites[DI_UP] = NULL; - spr = new CBSprite(_gameRef, _owner); + spr = new BaseSprite(_gameRef, _owner); if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC; else _sprites[DI_UP] = spr; break; @@ -156,7 +156,7 @@ bool CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSprite case TOKEN_DOWN: delete _sprites[DI_DOWN]; _sprites[DI_DOWN] = NULL; - spr = new CBSprite(_gameRef, _owner); + spr = new BaseSprite(_gameRef, _owner); if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC; else _sprites[DI_DOWN] = spr; break; @@ -164,7 +164,7 @@ bool CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSprite case TOKEN_UP_LEFT: delete _sprites[DI_UPLEFT]; _sprites[DI_UPLEFT] = NULL; - spr = new CBSprite(_gameRef, _owner); + spr = new BaseSprite(_gameRef, _owner); if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC; else _sprites[DI_UPLEFT] = spr; break; @@ -172,7 +172,7 @@ bool CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSprite case TOKEN_UP_RIGHT: delete _sprites[DI_UPRIGHT]; _sprites[DI_UPRIGHT] = NULL; - spr = new CBSprite(_gameRef, _owner); + spr = new BaseSprite(_gameRef, _owner); if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC; else _sprites[DI_UPRIGHT] = spr; break; @@ -180,7 +180,7 @@ bool CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSprite case TOKEN_DOWN_LEFT: delete _sprites[DI_DOWNLEFT]; _sprites[DI_DOWNLEFT] = NULL; - spr = new CBSprite(_gameRef, _owner); + spr = new BaseSprite(_gameRef, _owner); if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC; else _sprites[DI_DOWNLEFT] = spr; break; @@ -188,7 +188,7 @@ bool CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSprite case TOKEN_DOWN_RIGHT: delete _sprites[DI_DOWNRIGHT]; _sprites[DI_DOWNRIGHT] = NULL; - spr = new CBSprite(_gameRef, _owner); + spr = new BaseSprite(_gameRef, _owner); if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC; else _sprites[DI_DOWNRIGHT] = spr; break; @@ -214,9 +214,9 @@ bool CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSprite ////////////////////////////////////////////////////////////////////////// -bool CAdSpriteSet::persist(CBPersistMgr *persistMgr) { +bool AdSpriteSet::persist(BasePersistenceManager *persistMgr) { - CBObject::persist(persistMgr); + BaseObject::persist(persistMgr); persistMgr->transfer(TMEMBER(_owner)); for (int i = 0; i < NUM_DIRECTIONS; i++) { @@ -228,12 +228,12 @@ bool CAdSpriteSet::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -CBSprite *CAdSpriteSet::getSprite(TDirection direction) { +BaseSprite *AdSpriteSet::getSprite(TDirection direction) { int dir = (int)direction; if (dir < 0) dir = 0; if (dir >= NUM_DIRECTIONS) dir = NUM_DIRECTIONS - 1; - CBSprite *ret = NULL; + BaseSprite *ret = NULL; // find nearest set sprite int numSteps = 0; @@ -258,7 +258,7 @@ CBSprite *CAdSpriteSet::getSprite(TDirection direction) { ////////////////////////////////////////////////////////////////////////// -bool CAdSpriteSet::saveAsText(CBDynBuffer *buffer, int indent) { +bool AdSpriteSet::saveAsText(BaseDynamicBuffer *buffer, int indent) { buffer->putTextIndent(indent, "SPRITESET {\n"); if (_name) buffer->putTextIndent(indent + 2, "NAME=\"%s\"\n", _name); for (int i = 0; i < NUM_DIRECTIONS; i++) { @@ -292,7 +292,7 @@ bool CAdSpriteSet::saveAsText(CBDynBuffer *buffer, int indent) { } } - CBBase::saveAsText(buffer, indent + 2); + BaseClass::saveAsText(buffer, indent + 2); buffer->putTextIndent(indent, "}\n"); @@ -300,7 +300,7 @@ bool CAdSpriteSet::saveAsText(CBDynBuffer *buffer, int indent) { } ////////////////////////////////////////////////////////////////////////// -bool CAdSpriteSet::containsSprite(CBSprite *sprite) { +bool AdSpriteSet::containsSprite(BaseSprite *sprite) { if (!sprite) return false; for (int i = 0; i < NUM_DIRECTIONS; i++) { diff --git a/engines/wintermute/ad/ad_sprite_set.h b/engines/wintermute/ad/ad_sprite_set.h index 993832cfa3..196d8a8e3a 100644 --- a/engines/wintermute/ad/ad_sprite_set.h +++ b/engines/wintermute/ad/ad_sprite_set.h @@ -35,18 +35,18 @@ namespace WinterMute { -class CAdSpriteSet : public CBObject { +class AdSpriteSet : public BaseObject { public: - bool containsSprite(CBSprite *sprite); - virtual bool saveAsText(CBDynBuffer *buffer, int indent = 0); - CBSprite *getSprite(TDirection direction); - DECLARE_PERSISTENT(CAdSpriteSet, CBObject) - CBObject *_owner; - CAdSpriteSet(CBGame *inGame, CBObject *owner = NULL); - virtual ~CAdSpriteSet(); + bool containsSprite(BaseSprite *sprite); + virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent = 0); + BaseSprite *getSprite(TDirection direction); + DECLARE_PERSISTENT(AdSpriteSet, BaseObject) + BaseObject *_owner; + AdSpriteSet(BaseGame *inGame, BaseObject *owner = NULL); + virtual ~AdSpriteSet(); bool loadFile(const char *filename, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL); bool loadBuffer(byte *buffer, bool complete = true, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL); - CBSprite *_sprites[NUM_DIRECTIONS]; + BaseSprite *_sprites[NUM_DIRECTIONS]; }; } // end of namespace WinterMute diff --git a/engines/wintermute/ad/ad_talk_def.cpp b/engines/wintermute/ad/ad_talk_def.cpp index 0cd62df603..979e8b2698 100644 --- a/engines/wintermute/ad/ad_talk_def.cpp +++ b/engines/wintermute/ad/ad_talk_def.cpp @@ -39,10 +39,10 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CAdTalkDef, false) +IMPLEMENT_PERSISTENT(AdTalkDef, false) ////////////////////////////////////////////////////////////////////////// -CAdTalkDef::CAdTalkDef(CBGame *inGame): CBObject(inGame) { +AdTalkDef::AdTalkDef(BaseGame *inGame): BaseObject(inGame) { _defaultSpriteFilename = NULL; _defaultSprite = NULL; @@ -52,7 +52,7 @@ CAdTalkDef::CAdTalkDef(CBGame *inGame): CBObject(inGame) { ////////////////////////////////////////////////////////////////////////// -CAdTalkDef::~CAdTalkDef() { +AdTalkDef::~AdTalkDef() { for (int i = 0; i < _nodes.getSize(); i++) delete _nodes[i]; _nodes.removeAll(); @@ -69,16 +69,16 @@ CAdTalkDef::~CAdTalkDef() { ////////////////////////////////////////////////////////////////////////// -bool CAdTalkDef::loadFile(const char *filename) { +bool AdTalkDef::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { - _gameRef->LOG(0, "CAdTalkDef::LoadFile failed for file '%s'", filename); + _gameRef->LOG(0, "AdTalkDef::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } bool ret; - CBUtils::setString(&_filename, filename); + BaseUtils::setString(&_filename, filename); if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing TALK file '%s'", filename); @@ -98,7 +98,7 @@ TOKEN_DEF(DEFAULT_SPRITE) TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -bool CAdTalkDef::loadBuffer(byte *buffer, bool complete) { +bool AdTalkDef::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(TALK) TOKEN_TABLE(TEMPLATE) @@ -111,7 +111,7 @@ bool CAdTalkDef::loadBuffer(byte *buffer, bool complete) { byte *params; int cmd; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); if (complete) { if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_TALK) { @@ -128,7 +128,7 @@ bool CAdTalkDef::loadBuffer(byte *buffer, bool complete) { break; case TOKEN_ACTION: { - CAdTalkNode *Node = new CAdTalkNode(_gameRef); + AdTalkNode *Node = new AdTalkNode(_gameRef); if (Node && DID_SUCCEED(Node->loadBuffer(params, false))) _nodes.add(Node); else { delete Node; @@ -139,16 +139,16 @@ bool CAdTalkDef::loadBuffer(byte *buffer, bool complete) { break; case TOKEN_DEFAULT_SPRITE: - CBUtils::setString(&_defaultSpriteFilename, (char *)params); + BaseUtils::setString(&_defaultSpriteFilename, (char *)params); break; case TOKEN_DEFAULT_SPRITESET_FILE: - CBUtils::setString(&_defaultSpriteSetFilename, (char *)params); + BaseUtils::setString(&_defaultSpriteSetFilename, (char *)params); break; case TOKEN_DEFAULT_SPRITESET: { delete _defaultSpriteSet; - _defaultSpriteSet = new CAdSpriteSet(_gameRef); + _defaultSpriteSet = new AdSpriteSet(_gameRef); if (!_defaultSpriteSet || DID_FAIL(_defaultSpriteSet->loadBuffer(params, false))) { delete _defaultSpriteSet; _defaultSpriteSet = NULL; @@ -179,12 +179,12 @@ bool CAdTalkDef::loadBuffer(byte *buffer, bool complete) { _defaultSpriteSet = NULL; if (_defaultSpriteFilename) { - _defaultSprite = new CBSprite(_gameRef); + _defaultSprite = new BaseSprite(_gameRef); if (!_defaultSprite || DID_FAIL(_defaultSprite->loadFile(_defaultSpriteFilename))) return STATUS_FAILED; } if (_defaultSpriteSetFilename) { - _defaultSpriteSet = new CAdSpriteSet(_gameRef); + _defaultSpriteSet = new AdSpriteSet(_gameRef); if (!_defaultSpriteSet || DID_FAIL(_defaultSpriteSet->loadFile(_defaultSpriteSetFilename))) return STATUS_FAILED; } @@ -194,9 +194,9 @@ bool CAdTalkDef::loadBuffer(byte *buffer, bool complete) { ////////////////////////////////////////////////////////////////////////// -bool CAdTalkDef::persist(CBPersistMgr *persistMgr) { +bool AdTalkDef::persist(BasePersistenceManager *persistMgr) { - CBObject::persist(persistMgr); + BaseObject::persist(persistMgr); persistMgr->transfer(TMEMBER(_defaultSprite)); persistMgr->transfer(TMEMBER(_defaultSpriteFilename)); @@ -210,7 +210,7 @@ bool CAdTalkDef::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -bool CAdTalkDef::saveAsText(CBDynBuffer *buffer, int indent) { +bool AdTalkDef::saveAsText(BaseDynamicBuffer *buffer, int indent) { buffer->putTextIndent(indent, "TALK {\n"); if (_defaultSpriteFilename) buffer->putTextIndent(indent + 2, "DEFAULT_SPRITE=\"%s\"\n", _defaultSpriteFilename); @@ -221,7 +221,7 @@ bool CAdTalkDef::saveAsText(CBDynBuffer *buffer, int indent) { _nodes[i]->saveAsText(buffer, indent + 2); buffer->putTextIndent(indent, "\n"); } - CBBase::saveAsText(buffer, indent + 2); + BaseClass::saveAsText(buffer, indent + 2); buffer->putTextIndent(indent, "}\n"); @@ -230,16 +230,16 @@ bool CAdTalkDef::saveAsText(CBDynBuffer *buffer, int indent) { ////////////////////////////////////////////////////////////////////////// -bool CAdTalkDef::loadDefaultSprite() { +bool AdTalkDef::loadDefaultSprite() { if (_defaultSpriteFilename && !_defaultSprite) { - _defaultSprite = new CBSprite(_gameRef); + _defaultSprite = new BaseSprite(_gameRef); if (!_defaultSprite || DID_FAIL(_defaultSprite->loadFile(_defaultSpriteFilename))) { delete _defaultSprite; _defaultSprite = NULL; return STATUS_FAILED; } else return STATUS_OK; } else if (_defaultSpriteSetFilename && !_defaultSpriteSet) { - _defaultSpriteSet = new CAdSpriteSet(_gameRef); + _defaultSpriteSet = new AdSpriteSet(_gameRef); if (!_defaultSpriteSet || DID_FAIL(_defaultSpriteSet->loadFile(_defaultSpriteSetFilename))) { delete _defaultSpriteSet; _defaultSpriteSet = NULL; @@ -250,7 +250,7 @@ bool CAdTalkDef::loadDefaultSprite() { ////////////////////////////////////////////////////////////////////////// -CBSprite *CAdTalkDef::getDefaultSprite(TDirection dir) { +BaseSprite *AdTalkDef::getDefaultSprite(TDirection dir) { loadDefaultSprite(); if (_defaultSprite) return _defaultSprite; else if (_defaultSpriteSet) return _defaultSpriteSet->getSprite(dir); diff --git a/engines/wintermute/ad/ad_talk_def.h b/engines/wintermute/ad/ad_talk_def.h index 0811f5b8f5..fa32a81041 100644 --- a/engines/wintermute/ad/ad_talk_def.h +++ b/engines/wintermute/ad/ad_talk_def.h @@ -33,24 +33,24 @@ #include "engines/wintermute/base/base_object.h" namespace WinterMute { -class CAdTalkNode; -class CAdSpriteSet; -class CAdTalkDef : public CBObject { +class AdTalkNode; +class AdSpriteSet; +class AdTalkDef : public BaseObject { public: char *_defaultSpriteSetFilename; - CAdSpriteSet *_defaultSpriteSet; - CBSprite *getDefaultSprite(TDirection Dir); + AdSpriteSet *_defaultSpriteSet; + BaseSprite *getDefaultSprite(TDirection Dir); bool loadDefaultSprite(); - DECLARE_PERSISTENT(CAdTalkDef, CBObject) + DECLARE_PERSISTENT(AdTalkDef, BaseObject) - CAdTalkDef(CBGame *inGame); - virtual ~CAdTalkDef(); + AdTalkDef(BaseGame *inGame); + virtual ~AdTalkDef(); bool loadFile(const char *filename); bool loadBuffer(byte *buffer, bool complete = true); - CBArray _nodes; + BaseArray _nodes; char *_defaultSpriteFilename; - CBSprite *_defaultSprite; - virtual bool saveAsText(CBDynBuffer *buffer, int indent = 0); + BaseSprite *_defaultSprite; + virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent = 0); }; } // end of namespace WinterMute diff --git a/engines/wintermute/ad/ad_talk_holder.cpp b/engines/wintermute/ad/ad_talk_holder.cpp index 28e62798c2..bd48ac601c 100644 --- a/engines/wintermute/ad/ad_talk_holder.cpp +++ b/engines/wintermute/ad/ad_talk_holder.cpp @@ -40,16 +40,16 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CAdTalkHolder, false) +IMPLEMENT_PERSISTENT(AdTalkHolder, false) ////////////////////////////////////////////////////////////////////////// -CAdTalkHolder::CAdTalkHolder(CBGame *inGame): CAdObject(inGame) { +AdTalkHolder::AdTalkHolder(BaseGame *inGame): AdObject(inGame) { _sprite = NULL; } ////////////////////////////////////////////////////////////////////////// -CAdTalkHolder::~CAdTalkHolder() { +AdTalkHolder::~AdTalkHolder() { delete _sprite; _sprite = NULL; @@ -63,19 +63,19 @@ CAdTalkHolder::~CAdTalkHolder() { } ////////////////////////////////////////////////////////////////////////// -CBSprite *CAdTalkHolder::getTalkStance(const char *stance) { - CBSprite *ret = NULL; +BaseSprite *AdTalkHolder::getTalkStance(const char *stance) { + BaseSprite *ret = NULL; // forced stance? if (_forcedTalkAnimName && !_forcedTalkAnimUsed) { _forcedTalkAnimUsed = true; delete _animSprite; - _animSprite = new CBSprite(_gameRef, this); + _animSprite = new BaseSprite(_gameRef, this); if (_animSprite) { bool res = _animSprite->loadFile(_forcedTalkAnimName); if (DID_FAIL(res)) { - _gameRef->LOG(res, "CAdTalkHolder::GetTalkStance: error loading talk sprite (object:\"%s\" sprite:\"%s\")", _name, _forcedTalkAnimName); + _gameRef->LOG(res, "AdTalkHolder::GetTalkStance: error loading talk sprite (object:\"%s\" sprite:\"%s\")", _name, _forcedTalkAnimName); delete _animSprite; _animSprite = NULL; } else return _animSprite; @@ -119,14 +119,14 @@ CBSprite *CAdTalkHolder::getTalkStance(const char *stance) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -bool CAdTalkHolder::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool AdTalkHolder::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // SetSprite ////////////////////////////////////////////////////////////////////////// if (strcmp(name, "SetSprite") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); bool setCurrent = false; if (_currentSprite && _currentSprite == _sprite) setCurrent = true; @@ -140,7 +140,7 @@ bool CAdTalkHolder::scCallMethod(CScScript *script, CScStack *stack, CScStack *t stack->pushBool(true); } else { const char *filename = val->getString(); - CBSprite *spr = new CBSprite(_gameRef, this); + BaseSprite *spr = new BaseSprite(_gameRef, this); if (!spr || DID_FAIL(spr->loadFile(filename))) { script->runtimeError("SetSprite method failed for file '%s'", filename); stack->pushBool(false); @@ -184,7 +184,7 @@ bool CAdTalkHolder::scCallMethod(CScScript *script, CScStack *stack, CScStack *t const char *filename = stack->pop()->getString(); bool Ex = stack->pop()->getBool(); - CBSprite *spr = new CBSprite(_gameRef, this); + BaseSprite *spr = new BaseSprite(_gameRef, this); if (!spr || DID_FAIL(spr->loadFile(filename))) { stack->pushBool(false); script->runtimeError("AddTalkSprite method failed for file '%s'", filename); @@ -255,7 +255,7 @@ bool CAdTalkHolder::scCallMethod(CScScript *script, CScStack *stack, CScStack *t bool setCurrent = false; bool setTemp2 = false; - CBSprite *spr = new CBSprite(_gameRef, this); + BaseSprite *spr = new BaseSprite(_gameRef, this); if (!spr || DID_FAIL(spr->loadFile(filename))) { stack->pushBool(false); script->runtimeError("SetTalkSprite method failed for file '%s'", filename); @@ -295,12 +295,12 @@ bool CAdTalkHolder::scCallMethod(CScScript *script, CScStack *stack, CScStack *t return STATUS_OK; } - else return CAdObject::scCallMethod(script, stack, thisStack, name); + else return AdObject::scCallMethod(script, stack, thisStack, name); } ////////////////////////////////////////////////////////////////////////// -CScValue *CAdTalkHolder::scGetProperty(const char *name) { +ScValue *AdTalkHolder::scGetProperty(const char *name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// @@ -311,12 +311,12 @@ CScValue *CAdTalkHolder::scGetProperty(const char *name) { return _scValue; } - else return CAdObject::scGetProperty(name); + else return AdObject::scGetProperty(name); } ////////////////////////////////////////////////////////////////////////// -bool CAdTalkHolder::scSetProperty(const char *name, CScValue *value) { +bool AdTalkHolder::scSetProperty(const char *name, ScValue *value) { /* ////////////////////////////////////////////////////////////////////////// // Item @@ -326,18 +326,18 @@ bool CAdTalkHolder::scSetProperty(const char *name, CScValue *value) { return STATUS_OK; } - else*/ return CAdObject::scSetProperty(name, value); + else*/ return AdObject::scSetProperty(name, value); } ////////////////////////////////////////////////////////////////////////// -const char *CAdTalkHolder::scToString() { +const char *AdTalkHolder::scToString() { return "[talk-holder object]"; } ////////////////////////////////////////////////////////////////////////// -bool CAdTalkHolder::saveAsText(CBDynBuffer *buffer, int indent) { +bool AdTalkHolder::saveAsText(BaseDynamicBuffer *buffer, int indent) { for (int i = 0; i < _talkSprites.getSize(); i++) { if (_talkSprites[i]->_filename) buffer->putTextIndent(indent + 2, "TALK=\"%s\"\n", _talkSprites[i]->_filename); @@ -353,8 +353,8 @@ bool CAdTalkHolder::saveAsText(CBDynBuffer *buffer, int indent) { ////////////////////////////////////////////////////////////////////////// -bool CAdTalkHolder::persist(CBPersistMgr *persistMgr) { - CAdObject::persist(persistMgr); +bool AdTalkHolder::persist(BasePersistenceManager *persistMgr) { + AdObject::persist(persistMgr); persistMgr->transfer(TMEMBER(_sprite)); _talkSprites.persist(persistMgr); diff --git a/engines/wintermute/ad/ad_talk_holder.h b/engines/wintermute/ad/ad_talk_holder.h index 50c2f3504b..8ad8ae1e52 100644 --- a/engines/wintermute/ad/ad_talk_holder.h +++ b/engines/wintermute/ad/ad_talk_holder.h @@ -33,21 +33,21 @@ namespace WinterMute { -class CAdTalkHolder : public CAdObject { +class AdTalkHolder : public AdObject { public: - DECLARE_PERSISTENT(CAdTalkHolder, CAdObject) - virtual CBSprite *getTalkStance(const char *stance); - virtual bool saveAsText(CBDynBuffer *buffer, int indent); - CBSprite *_sprite; - CBArray _talkSprites; - CBArray _talkSpritesEx; - CAdTalkHolder(CBGame *inGame); - virtual ~CAdTalkHolder(); + DECLARE_PERSISTENT(AdTalkHolder, AdObject) + virtual BaseSprite *getTalkStance(const char *stance); + virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent); + BaseSprite *_sprite; + BaseArray _talkSprites; + BaseArray _talkSpritesEx; + AdTalkHolder(BaseGame *inGame); + virtual ~AdTalkHolder(); // scripting interface - virtual CScValue *scGetProperty(const char *name); - virtual bool scSetProperty(const char *name, CScValue *value); - virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual ScValue *scGetProperty(const char *name); + virtual bool scSetProperty(const char *name, ScValue *value); + virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); virtual const char *scToString(); }; diff --git a/engines/wintermute/ad/ad_talk_node.cpp b/engines/wintermute/ad/ad_talk_node.cpp index 3b82d731c9..5325b1aeff 100644 --- a/engines/wintermute/ad/ad_talk_node.cpp +++ b/engines/wintermute/ad/ad_talk_node.cpp @@ -36,10 +36,10 @@ #include "engines/wintermute/utils/utils.h" namespace WinterMute { -IMPLEMENT_PERSISTENT(CAdTalkNode, false) +IMPLEMENT_PERSISTENT(AdTalkNode, false) ////////////////////////////////////////////////////////////////////////// -CAdTalkNode::CAdTalkNode(CBGame *inGame): CBBase(inGame) { +AdTalkNode::AdTalkNode(BaseGame *inGame): BaseClass(inGame) { _sprite = NULL; _spriteFilename = NULL; _spriteSet = NULL; @@ -53,7 +53,7 @@ CAdTalkNode::CAdTalkNode(CBGame *inGame): CBBase(inGame) { ////////////////////////////////////////////////////////////////////////// -CAdTalkNode::~CAdTalkNode() { +AdTalkNode::~AdTalkNode() { delete[] _spriteFilename; delete _sprite; delete[] _spriteSetFilename; @@ -80,7 +80,7 @@ TOKEN_DEF(PRECACHE) TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -bool CAdTalkNode::loadBuffer(byte *buffer, bool complete) { +bool AdTalkNode::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(ACTION) TOKEN_TABLE(SPRITESET_FILE) @@ -95,7 +95,7 @@ bool CAdTalkNode::loadBuffer(byte *buffer, bool complete) { byte *params; int cmd; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); if (complete) { if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_ACTION) { @@ -112,16 +112,16 @@ bool CAdTalkNode::loadBuffer(byte *buffer, bool complete) { while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)¶ms)) > 0) { switch (cmd) { case TOKEN_SPRITE: - CBUtils::setString(&_spriteFilename, (char *)params); + BaseUtils::setString(&_spriteFilename, (char *)params); break; case TOKEN_SPRITESET_FILE: - CBUtils::setString(&_spriteSetFilename, (char *)params); + BaseUtils::setString(&_spriteSetFilename, (char *)params); break; case TOKEN_SPRITESET: { delete _spriteSet; - _spriteSet = new CAdSpriteSet(_gameRef); + _spriteSet = new AdSpriteSet(_gameRef); if (!_spriteSet || DID_FAIL(_spriteSet->loadBuffer(params, false))) { delete _spriteSet; _spriteSet = NULL; @@ -143,7 +143,7 @@ bool CAdTalkNode::loadBuffer(byte *buffer, bool complete) { break; case TOKEN_COMMENT: - if (_gameRef->_editorMode) CBUtils::setString(&_comment, (char *)params); + if (_gameRef->_editorMode) BaseUtils::setString(&_comment, (char *)params); break; case TOKEN_EDITOR_PROPERTY: @@ -168,14 +168,14 @@ bool CAdTalkNode::loadBuffer(byte *buffer, bool complete) { if (_preCache && _spriteFilename) { delete _sprite; - _sprite = new CBSprite(_gameRef); + _sprite = new BaseSprite(_gameRef); if (!_sprite || DID_FAIL(_sprite->loadFile(_spriteFilename))) return STATUS_FAILED; } if (_preCache && _spriteSetFilename) { delete _spriteSet; - _spriteSet = new CAdSpriteSet(_gameRef); + _spriteSet = new AdSpriteSet(_gameRef); if (!_spriteSet || DID_FAIL(_spriteSet->loadFile(_spriteSetFilename))) return STATUS_FAILED; } @@ -186,7 +186,7 @@ bool CAdTalkNode::loadBuffer(byte *buffer, bool complete) { ////////////////////////////////////////////////////////////////////////// -bool CAdTalkNode::persist(CBPersistMgr *persistMgr) { +bool AdTalkNode::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_comment)); persistMgr->transfer(TMEMBER(_startTime)); persistMgr->transfer(TMEMBER(_endTime)); @@ -201,7 +201,7 @@ bool CAdTalkNode::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -bool CAdTalkNode::saveAsText(CBDynBuffer *buffer, int indent) { +bool AdTalkNode::saveAsText(BaseDynamicBuffer *buffer, int indent) { buffer->putTextIndent(indent, "ACTION {\n"); if (_comment) buffer->putTextIndent(indent + 2, "COMMENT=\"%s\"\n", _comment); buffer->putTextIndent(indent + 2, "START_TIME=%d\n", _startTime); @@ -211,7 +211,7 @@ bool CAdTalkNode::saveAsText(CBDynBuffer *buffer, int indent) { else if (_spriteSet) _spriteSet->saveAsText(buffer, indent + 2); if (_preCache) buffer->putTextIndent(indent + 2, "PRECACHE=\"%s\"\n", _preCache ? "TRUE" : "FALSE"); - CBBase::saveAsText(buffer, indent + 2); + BaseClass::saveAsText(buffer, indent + 2); buffer->putTextIndent(indent, "}\n"); @@ -220,9 +220,9 @@ bool CAdTalkNode::saveAsText(CBDynBuffer *buffer, int indent) { ////////////////////////////////////////////////////////////////////////// -bool CAdTalkNode::loadSprite() { +bool AdTalkNode::loadSprite() { if (_spriteFilename && !_sprite) { - _sprite = new CBSprite(_gameRef); + _sprite = new BaseSprite(_gameRef); if (!_sprite || DID_FAIL(_sprite->loadFile(_spriteFilename))) { delete _sprite; _sprite = NULL; @@ -231,7 +231,7 @@ bool CAdTalkNode::loadSprite() { } else if (_spriteSetFilename && !_spriteSet) { - _spriteSet = new CAdSpriteSet(_gameRef); + _spriteSet = new AdSpriteSet(_gameRef); if (!_spriteSet || DID_FAIL(_spriteSet->loadFile(_spriteSetFilename))) { delete _spriteSet; _spriteSet = NULL; @@ -244,7 +244,7 @@ bool CAdTalkNode::loadSprite() { ////////////////////////////////////////////////////////////////////////// -bool CAdTalkNode::isInTimeInterval(uint32 time, TDirection dir) { +bool AdTalkNode::isInTimeInterval(uint32 time, TDirection dir) { if (time >= _startTime) { if (_playToEnd) { if ((_spriteFilename && _sprite == NULL) || (_sprite && _sprite->_finished == false)) return true; @@ -256,7 +256,7 @@ bool CAdTalkNode::isInTimeInterval(uint32 time, TDirection dir) { ////////////////////////////////////////////////////////////////////////// -CBSprite *CAdTalkNode::getSprite(TDirection dir) { +BaseSprite *AdTalkNode::getSprite(TDirection dir) { loadSprite(); if (_sprite) return _sprite; else if (_spriteSet) return _spriteSet->getSprite(dir); diff --git a/engines/wintermute/ad/ad_talk_node.h b/engines/wintermute/ad/ad_talk_node.h index 55adf88e83..9e599b6af2 100644 --- a/engines/wintermute/ad/ad_talk_node.h +++ b/engines/wintermute/ad/ad_talk_node.h @@ -33,23 +33,23 @@ #include "engines/wintermute/base/base.h" namespace WinterMute { -class CAdSpriteSet; -class CBSprite; -class CAdTalkNode : public CBBase { +class AdSpriteSet; +class BaseSprite; +class AdTalkNode : public BaseClass { public: char *_spriteSetFilename; - CAdSpriteSet *_spriteSet; - CBSprite *getSprite(TDirection dir); + AdSpriteSet *_spriteSet; + BaseSprite *getSprite(TDirection dir); bool isInTimeInterval(uint32 time, TDirection dir); bool loadSprite(); - DECLARE_PERSISTENT(CAdTalkNode, CBBase) + DECLARE_PERSISTENT(AdTalkNode, BaseClass) - CAdTalkNode(CBGame *inGame); - virtual ~CAdTalkNode(); + AdTalkNode(BaseGame *inGame); + virtual ~AdTalkNode(); bool loadBuffer(byte *buffer, bool complete = true); - virtual bool saveAsText(CBDynBuffer *buffer, int indent = 0); + virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent = 0); char *_spriteFilename; - CBSprite *_sprite; + BaseSprite *_sprite; uint32 _startTime; uint32 _endTime; bool _playToEnd; diff --git a/engines/wintermute/ad/ad_waypoint_group.cpp b/engines/wintermute/ad/ad_waypoint_group.cpp index 4a902266ac..25e5345ee7 100644 --- a/engines/wintermute/ad/ad_waypoint_group.cpp +++ b/engines/wintermute/ad/ad_waypoint_group.cpp @@ -37,10 +37,10 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CAdWaypointGroup, false) +IMPLEMENT_PERSISTENT(AdWaypointGroup, false) ////////////////////////////////////////////////////////////////////////// -CAdWaypointGroup::CAdWaypointGroup(CBGame *inGame): CBObject(inGame) { +AdWaypointGroup::AdWaypointGroup(BaseGame *inGame): BaseObject(inGame) { _active = true; _editorSelectedPoint = -1; _lastMimicScale = -1; @@ -49,13 +49,13 @@ CAdWaypointGroup::CAdWaypointGroup(CBGame *inGame): CBObject(inGame) { ////////////////////////////////////////////////////////////////////////// -CAdWaypointGroup::~CAdWaypointGroup() { +AdWaypointGroup::~AdWaypointGroup() { cleanup(); } ////////////////////////////////////////////////////////////////////////// -void CAdWaypointGroup::cleanup() { +void AdWaypointGroup::cleanup() { for (int i = 0; i < _points.getSize(); i++) delete _points[i]; _points.removeAll(); @@ -64,10 +64,10 @@ void CAdWaypointGroup::cleanup() { ////////////////////////////////////////////////////////////////////////// -bool CAdWaypointGroup::loadFile(const char *filename) { +bool AdWaypointGroup::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { - _gameRef->LOG(0, "CAdWaypointGroup::LoadFile failed for file '%s'", filename); + _gameRef->LOG(0, "AdWaypointGroup::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -96,7 +96,7 @@ TOKEN_DEF(PROPERTY) TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -bool CAdWaypointGroup::loadBuffer(byte *buffer, bool complete) { +bool AdWaypointGroup::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(WAYPOINTS) TOKEN_TABLE(TEMPLATE) @@ -110,7 +110,7 @@ bool CAdWaypointGroup::loadBuffer(byte *buffer, bool complete) { byte *params; int cmd; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); if (complete) { if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_WAYPOINTS) { @@ -133,7 +133,7 @@ bool CAdWaypointGroup::loadBuffer(byte *buffer, bool complete) { case TOKEN_POINT: { int x, y; parser.scanStr((char *)params, "%d,%d", &x, &y); - _points.add(new CBPoint(x, y)); + _points.add(new BasePoint(x, y)); } break; @@ -164,7 +164,7 @@ bool CAdWaypointGroup::loadBuffer(byte *buffer, bool complete) { ////////////////////////////////////////////////////////////////////////// -bool CAdWaypointGroup::saveAsText(CBDynBuffer *buffer, int indent) { +bool AdWaypointGroup::saveAsText(BaseDynamicBuffer *buffer, int indent) { buffer->putTextIndent(indent, "WAYPOINTS {\n"); buffer->putTextIndent(indent + 2, "NAME=\"%s\"\n", _name); buffer->putTextIndent(indent + 2, "EDITOR_SELECTED=%s\n", _editorSelected ? "TRUE" : "FALSE"); @@ -172,7 +172,7 @@ bool CAdWaypointGroup::saveAsText(CBDynBuffer *buffer, int indent) { if (_scProp) _scProp->saveAsText(buffer, indent + 2); - CBBase::saveAsText(buffer, indent + 2); + BaseClass::saveAsText(buffer, indent + 2); for (int i = 0; i < _points.getSize(); i++) { buffer->putTextIndent(indent + 2, "POINT {%d,%d}\n", _points[i]->x, _points[i]->y); @@ -185,9 +185,9 @@ bool CAdWaypointGroup::saveAsText(CBDynBuffer *buffer, int indent) { ////////////////////////////////////////////////////////////////////////// -bool CAdWaypointGroup::persist(CBPersistMgr *persistMgr) { +bool AdWaypointGroup::persist(BasePersistenceManager *persistMgr) { - CBObject::persist(persistMgr); + BaseObject::persist(persistMgr); persistMgr->transfer(TMEMBER(_active)); persistMgr->transfer(TMEMBER(_editorSelectedPoint)); @@ -201,7 +201,7 @@ bool CAdWaypointGroup::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -CScValue *CAdWaypointGroup::scGetProperty(const char *name) { +ScValue *AdWaypointGroup::scGetProperty(const char *name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// @@ -220,12 +220,12 @@ CScValue *CAdWaypointGroup::scGetProperty(const char *name) { return _scValue; } - else return CBObject::scGetProperty(name); + else return BaseObject::scGetProperty(name); } ////////////////////////////////////////////////////////////////////////// -bool CAdWaypointGroup::scSetProperty(const char *name, CScValue *value) { +bool AdWaypointGroup::scSetProperty(const char *name, ScValue *value) { ////////////////////////////////////////////////////////////////////////// // Active ////////////////////////////////////////////////////////////////////////// @@ -234,12 +234,12 @@ bool CAdWaypointGroup::scSetProperty(const char *name, CScValue *value) { return STATUS_OK; } - else return CBObject::scSetProperty(name, value); + else return BaseObject::scSetProperty(name, value); } ////////////////////////////////////////////////////////////////////////// -bool CAdWaypointGroup::mimic(CAdWaypointGroup *wpt, float scale, int argX, int argY) { +bool AdWaypointGroup::mimic(AdWaypointGroup *wpt, float scale, int argX, int argY) { if (scale == _lastMimicScale && argX == _lastMimicX && argY == _lastMimicY) return STATUS_OK; cleanup(); @@ -248,7 +248,7 @@ bool CAdWaypointGroup::mimic(CAdWaypointGroup *wpt, float scale, int argX, int a int x = (int)((float)wpt->_points[i]->x * scale / 100.0f); int y = (int)((float)wpt->_points[i]->y * scale / 100.0f); - _points.add(new CBPoint(x + argX, y + argY)); + _points.add(new BasePoint(x + argX, y + argY)); } _lastMimicScale = scale; diff --git a/engines/wintermute/ad/ad_waypoint_group.h b/engines/wintermute/ad/ad_waypoint_group.h index 2cece9e88b..f23f7be859 100644 --- a/engines/wintermute/ad/ad_waypoint_group.h +++ b/engines/wintermute/ad/ad_waypoint_group.h @@ -32,25 +32,25 @@ #include "engines/wintermute/base/base_object.h" namespace WinterMute { -class CBPoint; -class CAdWaypointGroup : public CBObject { +class BasePoint; +class AdWaypointGroup : public BaseObject { public: float _lastMimicScale; int _lastMimicX; int _lastMimicY; void cleanup(); - bool mimic(CAdWaypointGroup *wpt, float scale = 100.0f, int x = 0, int y = 0); - DECLARE_PERSISTENT(CAdWaypointGroup, CBObject) - virtual bool saveAsText(CBDynBuffer *buffer, int indent); + bool mimic(AdWaypointGroup *wpt, float scale = 100.0f, int x = 0, int y = 0); + DECLARE_PERSISTENT(AdWaypointGroup, BaseObject) + virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent); bool _active; - CAdWaypointGroup(CBGame *inGame); + AdWaypointGroup(BaseGame *inGame); bool loadFile(const char *filename); bool loadBuffer(byte *buffer, bool complete = true); - virtual ~CAdWaypointGroup(); - CBArray _points; + virtual ~AdWaypointGroup(); + BaseArray _points; int _editorSelectedPoint; - virtual CScValue *scGetProperty(const char *name); - virtual bool scSetProperty(const char *name, CScValue *value); + virtual ScValue *scGetProperty(const char *name); + virtual bool scSetProperty(const char *name, ScValue *value); }; } // end of namespace WinterMute diff --git a/engines/wintermute/base/base.cpp b/engines/wintermute/base/base.cpp index 5fabe94312..4b62a7553a 100644 --- a/engines/wintermute/base/base.cpp +++ b/engines/wintermute/base/base.cpp @@ -35,27 +35,27 @@ namespace WinterMute { ////////////////////////////////////////////////////////////////////// -CBBase::CBBase(CBGame *gameOwner) { +BaseClass::BaseClass(BaseGame *gameOwner) { _gameRef = gameOwner; _persistable = true; } ////////////////////////////////////////////////////////////////////////// -CBBase::CBBase() { +BaseClass::BaseClass() { _gameRef = NULL; _persistable = true; } ////////////////////////////////////////////////////////////////////// -CBBase::~CBBase() { +BaseClass::~BaseClass() { _editorProps.clear(); } ////////////////////////////////////////////////////////////////////////// -const char *CBBase::getEditorProp(const char *propName, const char *initVal) { +const char *BaseClass::getEditorProp(const char *propName, const char *initVal) { _editorPropsIter = _editorProps.find(propName); if (_editorPropsIter != _editorProps.end()) return _editorPropsIter->_value.c_str(); @@ -65,7 +65,7 @@ const char *CBBase::getEditorProp(const char *propName, const char *initVal) { ////////////////////////////////////////////////////////////////////////// -bool CBBase::setEditorProp(const char *propName, const char *propValue) { +bool BaseClass::setEditorProp(const char *propName, const char *propValue) { if (propName == NULL) return STATUS_FAILED; if (propValue == NULL) { @@ -84,7 +84,7 @@ TOKEN_DEF(NAME) TOKEN_DEF(VALUE) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -bool CBBase::parseEditorProperty(byte *buffer, bool complete) { +bool BaseClass::parseEditorProperty(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(EDITOR_PROPERTY) TOKEN_TABLE(NAME) @@ -98,7 +98,7 @@ bool CBBase::parseEditorProperty(byte *buffer, bool complete) { byte *params; int cmd; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); if (complete) { if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_EDITOR_PROPERTY) { @@ -159,7 +159,7 @@ bool CBBase::parseEditorProperty(byte *buffer, bool complete) { ////////////////////////////////////////////////////////////////////////// -bool CBBase::saveAsText(CBDynBuffer *buffer, int indent) { +bool BaseClass::saveAsText(BaseDynamicBuffer *buffer, int indent) { _editorPropsIter = _editorProps.begin(); while (_editorPropsIter != _editorProps.end()) { buffer->putTextIndent(indent, "EDITOR_PROPERTY\n"); diff --git a/engines/wintermute/base/base.h b/engines/wintermute/base/base.h index e8c87f1f9e..0265ce97d5 100644 --- a/engines/wintermute/base/base.h +++ b/engines/wintermute/base/base.h @@ -37,21 +37,21 @@ namespace WinterMute { -class CBGame; -class CBDynBuffer; +class BaseGame; +class BaseDynamicBuffer; -class CBBase { +class BaseClass { public: bool _persistable; bool setEditorProp(const char *propName, const char *propValue); const char *getEditorProp(const char *propName, const char *initVal = NULL); - CBBase(TDynamicConstructor, TDynamicConstructor) {}; + BaseClass(TDynamicConstructor, TDynamicConstructor) {}; bool parseEditorProperty(byte *buffer, bool complete = true); - virtual bool saveAsText(CBDynBuffer *buffer, int indent = 0); - CBBase(); - CBGame *_gameRef; - CBBase(CBGame *GameOwner); - virtual ~CBBase(); + virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent = 0); + BaseClass(); + BaseGame *_gameRef; + BaseClass(BaseGame *GameOwner); + virtual ~BaseClass(); Common::HashMap _editorProps; Common::HashMap::iterator _editorPropsIter; diff --git a/engines/wintermute/base/base_active_rect.cpp b/engines/wintermute/base/base_active_rect.cpp index 5895b1acd5..493b35bf12 100644 --- a/engines/wintermute/base/base_active_rect.cpp +++ b/engines/wintermute/base/base_active_rect.cpp @@ -35,8 +35,8 @@ namespace WinterMute { ////////////////////////////////////////////////////////////////////// -CBActiveRect::CBActiveRect(CBGame *inGame): CBBase(inGame) { - CBPlatform::setRectEmpty(&_rect); +BaseActiveRect::BaseActiveRect(BaseGame *inGame): BaseClass(inGame) { + BasePlatform::setRectEmpty(&_rect); _owner = NULL; _frame = NULL; _region = NULL; @@ -48,10 +48,10 @@ CBActiveRect::CBActiveRect(CBGame *inGame): CBBase(inGame) { ////////////////////////////////////////////////////////////////////// -CBActiveRect::CBActiveRect(CBGame *inGame, CBObject *owner, CBSubFrame *frame, int x, int y, int width, int height, float zoomX, float zoomY, bool precise): CBBase(inGame) { +BaseActiveRect::BaseActiveRect(BaseGame *inGame, BaseObject *owner, BaseSubFrame *frame, int x, int y, int width, int height, float zoomX, float zoomY, bool precise): BaseClass(inGame) { _owner = owner; _frame = frame; - CBPlatform::setRect(&_rect, x, y, x + width, y + height); + BasePlatform::setRect(&_rect, x, y, x + width, y + height); _zoomX = zoomX; _zoomY = zoomY; _precise = precise; @@ -61,11 +61,11 @@ CBActiveRect::CBActiveRect(CBGame *inGame, CBObject *owner, CBSubFrame *frame, i } ////////////////////////////////////////////////////////////////////// -CBActiveRect::CBActiveRect(CBGame *inGame, CBObject *owner, CBRegion *region, int offsetX, int offsetY): CBBase(inGame) { +BaseActiveRect::BaseActiveRect(BaseGame *inGame, BaseObject *owner, BaseRegion *region, int offsetX, int offsetY): BaseClass(inGame) { _owner = owner; _region = region; - CBPlatform::copyRect(&_rect, ®ion->_rect); - CBPlatform::offsetRect(&_rect, -offsetX, -offsetY); + BasePlatform::copyRect(&_rect, ®ion->_rect); + BasePlatform::offsetRect(&_rect, -offsetX, -offsetY); _zoomX = 100; _zoomY = 100; _precise = true; @@ -77,7 +77,7 @@ CBActiveRect::CBActiveRect(CBGame *inGame, CBObject *owner, CBRegion *region, in ////////////////////////////////////////////////////////////////////// -CBActiveRect::~CBActiveRect() { +BaseActiveRect::~BaseActiveRect() { _owner = NULL; _frame = NULL; _region = NULL; @@ -85,11 +85,11 @@ CBActiveRect::~CBActiveRect() { ////////////////////////////////////////////////////////////////////////// -void CBActiveRect::clipRect() { +void BaseActiveRect::clipRect() { Rect32 rc; bool customViewport; _gameRef->getCurrentViewportRect(&rc, &customViewport); - CBRenderer *Rend = _gameRef->_renderer; + BaseRenderer *Rend = _gameRef->_renderer; if (!customViewport) { rc.left -= Rend->_drawOffsetX; @@ -101,7 +101,7 @@ void CBActiveRect::clipRect() { if (rc.left > _rect.left) _offsetX = rc.left - _rect.left; if (rc.top > _rect.top) _offsetY = rc.top - _rect.top; - CBPlatform::intersectRect(&_rect, &_rect, &rc); + BasePlatform::intersectRect(&_rect, &_rect, &rc); } } // end of namespace WinterMute diff --git a/engines/wintermute/base/base_active_rect.h b/engines/wintermute/base/base_active_rect.h index 7c9e8d4a39..0885b0e13e 100644 --- a/engines/wintermute/base/base_active_rect.h +++ b/engines/wintermute/base/base_active_rect.h @@ -33,25 +33,25 @@ #include "engines/wintermute/base/base.h" namespace WinterMute { -class CBRegion; -class CBSubFrame; -class CBObject; -class CBActiveRect: CBBase { +class BaseRegion; +class BaseSubFrame; +class BaseObject; +class BaseActiveRect: BaseClass { public: void clipRect(); bool _precise; float _zoomX; float _zoomY; - CBSubFrame *_frame; - CBObject *_owner; - CBRegion *_region; + BaseSubFrame *_frame; + BaseObject *_owner; + BaseRegion *_region; int _offsetX; int _offsetY; Rect32 _rect; - CBActiveRect(CBGame *inGameOwner = NULL); - CBActiveRect(CBGame *inGameOwner, CBObject *owner, CBSubFrame *frame, int x, int y, int width, int height, float zoomX = 100, float zoomY = 100, bool precise = true); - CBActiveRect(CBGame *inGame, CBObject *owner, CBRegion *region, int offsetX, int offsetY); - virtual ~CBActiveRect(); + BaseActiveRect(BaseGame *inGameOwner = NULL); + BaseActiveRect(BaseGame *inGameOwner, BaseObject *owner, BaseSubFrame *frame, int x, int y, int width, int height, float zoomX = 100, float zoomY = 100, bool precise = true); + BaseActiveRect(BaseGame *inGame, BaseObject *owner, BaseRegion *region, int offsetX, int offsetY); + virtual ~BaseActiveRect(); }; diff --git a/engines/wintermute/base/base_debugger.cpp b/engines/wintermute/base/base_debugger.cpp index 8adeea2b1f..ef4f1ce686 100644 --- a/engines/wintermute/base/base_debugger.cpp +++ b/engines/wintermute/base/base_debugger.cpp @@ -31,172 +31,172 @@ namespace WinterMute { ////////////////////////////////////////////////////////////////////////// -CBDebugger::CBDebugger(CBGame *inGame) : CBBase(inGame) { +BaseDebugger::BaseDebugger(BaseGame *inGame) : BaseClass(inGame) { _enabled = false; } ////////////////////////////////////////////////////////////////////////// -CBDebugger::~CBDebugger(void) { +BaseDebugger::~BaseDebugger(void) { } ////////////////////////////////////////////////////////////////////////// -bool CBDebugger::initialize() { +bool BaseDebugger::initialize() { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CBDebugger::shutdown() { +bool BaseDebugger::shutdown() { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CBDebugger::onGameInit() { +bool BaseDebugger::onGameInit() { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CBDebugger::onGameShutdown() { +bool BaseDebugger::onGameShutdown() { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CBDebugger::onGameTick() { +bool BaseDebugger::onGameTick() { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CBDebugger::onLog(unsigned int errorCode, const char *text) { +bool BaseDebugger::onLog(unsigned int errorCode, const char *text) { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CBDebugger::onScriptInit(CScScript *script) { +bool BaseDebugger::onScriptInit(ScScript *script) { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CBDebugger::onScriptEventThreadInit(CScScript *script, CScScript *parentScript, const char *name) { +bool BaseDebugger::onScriptEventThreadInit(ScScript *script, ScScript *parentScript, const char *name) { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CBDebugger::onScriptMethodThreadInit(CScScript *script, CScScript *parentScript, const char *name) { +bool BaseDebugger::onScriptMethodThreadInit(ScScript *script, ScScript *parentScript, const char *name) { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CBDebugger::onScriptShutdown(CScScript *script) { +bool BaseDebugger::onScriptShutdown(ScScript *script) { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CBDebugger::onScriptChangeLine(CScScript *script, int Line) { +bool BaseDebugger::onScriptChangeLine(ScScript *script, int Line) { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CBDebugger::onScriptChangeScope(CScScript *script, CScValue *scope) { +bool BaseDebugger::onScriptChangeScope(ScScript *script, ScValue *scope) { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CBDebugger::onScriptShutdownScope(CScScript *script, CScValue *scope) { +bool BaseDebugger::onScriptShutdownScope(ScScript *script, ScValue *scope) { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CBDebugger::onVariableInit(EWmeDebuggerVariableType type, CScScript *script, CScValue *scope, CScValue *var, const char *variableName) { +bool BaseDebugger::onVariableInit(EWmeDebuggerVariableType type, ScScript *script, ScValue *scope, ScValue *var, const char *variableName) { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CBDebugger::onVariableChangeValue(CScValue *var, CScValue *value) { +bool BaseDebugger::onVariableChangeValue(ScValue *var, ScValue *value) { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CBDebugger::onScriptHitBreakpoint(CScScript *script) { +bool BaseDebugger::onScriptHitBreakpoint(ScScript *script) { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// // IWmeDebugServer interface implementation -bool CBDebugger::attachClient(IWmeDebugClient *client) { +bool BaseDebugger::attachClient(IWmeDebugClient *client) { return false; } ////////////////////////////////////////////////////////////////////////// -bool CBDebugger::detachClient(IWmeDebugClient *client) { +bool BaseDebugger::detachClient(IWmeDebugClient *client) { return false; } ////////////////////////////////////////////////////////////////////////// -bool CBDebugger::queryData(IWmeDebugClient *client) { +bool BaseDebugger::queryData(IWmeDebugClient *client) { return false; } ////////////////////////////////////////////////////////////////////////// -int CBDebugger::getPropInt(const char *propName) { +int BaseDebugger::getPropInt(const char *propName) { return 0; } ////////////////////////////////////////////////////////////////////////// -double CBDebugger::getPropFloat(const char *propName) { +double BaseDebugger::getPropFloat(const char *propName) { return 0.0; } ////////////////////////////////////////////////////////////////////////// -const char *CBDebugger::getPropString(const char *propName) { +const char *BaseDebugger::getPropString(const char *propName) { return ""; } ////////////////////////////////////////////////////////////////////////// -bool CBDebugger::getPropBool(const char *propName) { +bool BaseDebugger::getPropBool(const char *propName) { return false; } ////////////////////////////////////////////////////////////////////////// -bool CBDebugger::setProp(const char *propName, int propValue) { +bool BaseDebugger::setProp(const char *propName, int propValue) { return false; } ////////////////////////////////////////////////////////////////////////// -bool CBDebugger::setProp(const char *propName, double propValue) { +bool BaseDebugger::setProp(const char *propName, double propValue) { return false; } ////////////////////////////////////////////////////////////////////////// -bool CBDebugger::setProp(const char *propName, const char *propValue) { +bool BaseDebugger::setProp(const char *propName, const char *propValue) { return false; } ////////////////////////////////////////////////////////////////////////// -bool CBDebugger::setProp(const char *propName, bool propValue) { +bool BaseDebugger::setProp(const char *propName, bool propValue) { return false; } ////////////////////////////////////////////////////////////////////////// -bool CBDebugger::resolveFilename(const char *relativeFilename, char *absFilenameBuf, int absBufSize) { +bool BaseDebugger::resolveFilename(const char *relativeFilename, char *absFilenameBuf, int absBufSize) { return false; } ////////////////////////////////////////////////////////////////////////// -bool CBDebugger::addBreakpoint(const char *scriptFilename, int line) { +bool BaseDebugger::addBreakpoint(const char *scriptFilename, int line) { return false; } ////////////////////////////////////////////////////////////////////////// -bool CBDebugger::removeBreakpoint(const char *scriptFilename, int line) { +bool BaseDebugger::removeBreakpoint(const char *scriptFilename, int line) { return false; } ////////////////////////////////////////////////////////////////////////// -bool CBDebugger::continueExecution() { +bool BaseDebugger::continueExecution() { return false; } diff --git a/engines/wintermute/base/base_debugger.h b/engines/wintermute/base/base_debugger.h index 35ea56eafe..7266e073d8 100644 --- a/engines/wintermute/base/base_debugger.h +++ b/engines/wintermute/base/base_debugger.h @@ -36,12 +36,12 @@ // TODO: The entire debugger should possibly be removed namespace WinterMute { -class CScScript; -class CScValue; -class CBDebugger : public CBBase, public IWmeDebugServer { +class ScScript; +class ScValue; +class BaseDebugger : public BaseClass, public IWmeDebugServer { public: - CBDebugger(CBGame *inGame); - virtual ~CBDebugger(void); + BaseDebugger(BaseGame *inGame); + virtual ~BaseDebugger(void); // initialization bool _enabled; @@ -53,18 +53,18 @@ public: bool onGameShutdown(); bool onGameTick(); bool onLog(unsigned int errorCode, const char *text); - bool onScriptInit(CScScript *script); - bool onScriptEventThreadInit(CScScript *script, CScScript *parentScript, const char *name); - bool onScriptMethodThreadInit(CScScript *script, CScScript *parentScript, const char *name); - - bool onScriptShutdown(CScScript *script); - bool onScriptChangeLine(CScScript *script, int line); - bool onScriptChangeScope(CScScript *script, CScValue *scope); - bool onScriptShutdownScope(CScScript *script, CScValue *scope); - bool onVariableInit(EWmeDebuggerVariableType type, CScScript *script, CScValue *scope, CScValue *var, const char *variableName); - bool onVariableChangeValue(CScValue *var, CScValue *value); - - bool onScriptHitBreakpoint(CScScript *script); + bool onScriptInit(ScScript *script); + bool onScriptEventThreadInit(ScScript *script, ScScript *parentScript, const char *name); + bool onScriptMethodThreadInit(ScScript *script, ScScript *parentScript, const char *name); + + bool onScriptShutdown(ScScript *script); + bool onScriptChangeLine(ScScript *script, int line); + bool onScriptChangeScope(ScScript *script, ScValue *scope); + bool onScriptShutdownScope(ScScript *script, ScValue *scope); + bool onVariableInit(EWmeDebuggerVariableType type, ScScript *script, ScValue *scope, ScValue *var, const char *variableName); + bool onVariableChangeValue(ScValue *var, ScValue *value); + + bool onScriptHitBreakpoint(ScScript *script); // IWmeDebugServer interface virtual bool attachClient(IWmeDebugClient *client); diff --git a/engines/wintermute/base/base_dynamic_buffer.cpp b/engines/wintermute/base/base_dynamic_buffer.cpp index 7453838219..8d6f88c9fe 100644 --- a/engines/wintermute/base/base_dynamic_buffer.cpp +++ b/engines/wintermute/base/base_dynamic_buffer.cpp @@ -32,7 +32,7 @@ namespace WinterMute { ////////////////////////////////////////////////////////////////////////// -CBDynBuffer::CBDynBuffer(CBGame *inGame, uint32 initSize, uint32 growBy): CBBase(inGame) { +BaseDynamicBuffer::BaseDynamicBuffer(BaseGame *inGame, uint32 initSize, uint32 growBy): BaseClass(inGame) { _buffer = NULL; _size = 0; _realSize = 0; @@ -46,13 +46,13 @@ CBDynBuffer::CBDynBuffer(CBGame *inGame, uint32 initSize, uint32 growBy): CBBase ////////////////////////////////////////////////////////////////////////// -CBDynBuffer::~CBDynBuffer() { +BaseDynamicBuffer::~BaseDynamicBuffer() { cleanup(); } ////////////////////////////////////////////////////////////////////////// -void CBDynBuffer::cleanup() { +void BaseDynamicBuffer::cleanup() { if (_buffer) free(_buffer); _buffer = NULL; _size = 0; @@ -63,20 +63,20 @@ void CBDynBuffer::cleanup() { ////////////////////////////////////////////////////////////////////////// -uint32 CBDynBuffer::getSize() { +uint32 BaseDynamicBuffer::getSize() { return _size; } ////////////////////////////////////////////////////////////////////////// -bool CBDynBuffer::init(uint32 initSize) { +bool BaseDynamicBuffer::init(uint32 initSize) { cleanup(); if (initSize == 0) initSize = _initSize; _buffer = (byte *)malloc(initSize); if (!_buffer) { - _gameRef->LOG(0, "CBDynBuffer::Init - Error allocating %d bytes", initSize); + _gameRef->LOG(0, "BaseDynamicBuffer::Init - Error allocating %d bytes", initSize); return STATUS_FAILED; } @@ -88,14 +88,14 @@ bool CBDynBuffer::init(uint32 initSize) { ////////////////////////////////////////////////////////////////////////// -bool CBDynBuffer::putBytes(byte *buffer, uint32 size) { +bool BaseDynamicBuffer::putBytes(byte *buffer, uint32 size) { if (!_initialized) init(); while (_offset + size > _realSize) { _realSize += _growBy; _buffer = (byte *)realloc(_buffer, _realSize); if (!_buffer) { - _gameRef->LOG(0, "CBDynBuffer::PutBytes - Error reallocating buffer to %d bytes", _realSize); + _gameRef->LOG(0, "BaseDynamicBuffer::PutBytes - Error reallocating buffer to %d bytes", _realSize); return STATUS_FAILED; } } @@ -109,11 +109,11 @@ bool CBDynBuffer::putBytes(byte *buffer, uint32 size) { ////////////////////////////////////////////////////////////////////////// -bool CBDynBuffer::getBytes(byte *buffer, uint32 size) { +bool BaseDynamicBuffer::getBytes(byte *buffer, uint32 size) { if (!_initialized) init(); if (_offset + size > _size) { - _gameRef->LOG(0, "CBDynBuffer::GetBytes - Buffer underflow"); + _gameRef->LOG(0, "BaseDynamicBuffer::GetBytes - Buffer underflow"); return STATUS_FAILED; } @@ -125,13 +125,13 @@ bool CBDynBuffer::getBytes(byte *buffer, uint32 size) { ////////////////////////////////////////////////////////////////////////// -void CBDynBuffer::putDWORD(uint32 val) { +void BaseDynamicBuffer::putDWORD(uint32 val) { putBytes((byte *)&val, sizeof(uint32)); } ////////////////////////////////////////////////////////////////////////// -uint32 CBDynBuffer::getDWORD() { +uint32 BaseDynamicBuffer::getDWORD() { uint32 ret; getBytes((byte *)&ret, sizeof(uint32)); return ret; @@ -139,7 +139,7 @@ uint32 CBDynBuffer::getDWORD() { ////////////////////////////////////////////////////////////////////////// -void CBDynBuffer::putString(const char *val) { +void BaseDynamicBuffer::putString(const char *val) { if (!val) putString("(null)"); else { putDWORD(strlen(val) + 1); @@ -149,7 +149,7 @@ void CBDynBuffer::putString(const char *val) { ////////////////////////////////////////////////////////////////////////// -char *CBDynBuffer::getString() { +char *BaseDynamicBuffer::getString() { uint32 len = getDWORD(); char *ret = (char *)(_buffer + _offset); _offset += len; @@ -160,7 +160,7 @@ char *CBDynBuffer::getString() { ////////////////////////////////////////////////////////////////////////// -void CBDynBuffer::putText(const char *fmt, ...) { +void BaseDynamicBuffer::putText(const char *fmt, ...) { va_list va; va_start(va, fmt); @@ -171,7 +171,7 @@ void CBDynBuffer::putText(const char *fmt, ...) { ////////////////////////////////////////////////////////////////////////// -void CBDynBuffer::putTextIndent(int indent, const char *fmt, ...) { +void BaseDynamicBuffer::putTextIndent(int indent, const char *fmt, ...) { va_list va; putText("%*s", indent, ""); @@ -183,7 +183,7 @@ void CBDynBuffer::putTextIndent(int indent, const char *fmt, ...) { ////////////////////////////////////////////////////////////////////////// -void CBDynBuffer::putTextForm(const char *format, va_list argptr) { +void BaseDynamicBuffer::putTextForm(const char *format, va_list argptr) { char buff[32768]; vsprintf(buff, format, argptr); putBytes((byte *)buff, strlen(buff)); diff --git a/engines/wintermute/base/base_dynamic_buffer.h b/engines/wintermute/base/base_dynamic_buffer.h index 5795fe5bd1..0567f874df 100644 --- a/engines/wintermute/base/base_dynamic_buffer.h +++ b/engines/wintermute/base/base_dynamic_buffer.h @@ -34,7 +34,7 @@ namespace WinterMute { -class CBDynBuffer : public CBBase { +class BaseDynamicBuffer : public BaseClass { public: bool _initialized; void putText(const char *fmt, ...); @@ -50,8 +50,8 @@ public: void cleanup(); uint32 _size; byte *_buffer; - CBDynBuffer(CBGame *inGame, uint32 initSize = 1000, uint32 growBy = 1000); - virtual ~CBDynBuffer(); + BaseDynamicBuffer(BaseGame *inGame, uint32 initSize = 1000, uint32 growBy = 1000); + virtual ~BaseDynamicBuffer(); private: uint32 _realSize; diff --git a/engines/wintermute/base/base_fader.cpp b/engines/wintermute/base/base_fader.cpp index b34e89e41a..4dcdf82347 100644 --- a/engines/wintermute/base/base_fader.cpp +++ b/engines/wintermute/base/base_fader.cpp @@ -38,10 +38,10 @@ namespace WinterMute { // Construction/Destruction ////////////////////////////////////////////////////////////////////// -IMPLEMENT_PERSISTENT(CBFader, false) +IMPLEMENT_PERSISTENT(BaseFader, false) ////////////////////////////////////////////////////////////////////////// -CBFader::CBFader(CBGame *inGame): CBObject(inGame) { +BaseFader::BaseFader(BaseGame *inGame): BaseObject(inGame) { _active = false; _red = _green = _blue = 0; _currentAlpha = 0x00; @@ -54,20 +54,20 @@ CBFader::CBFader(CBGame *inGame): CBObject(inGame) { ////////////////////////////////////////////////////////////////////////// -CBFader::~CBFader() { +BaseFader::~BaseFader() { } ////////////////////////////////////////////////////////////////////////// -bool CBFader::update() { +bool BaseFader::update() { if (!_active) return STATUS_OK; int alphaDelta = _targetAlpha - _sourceAlpha; uint32 time; - if (_system) time = CBPlatform::getTime() - _startTime; + if (_system) time = BasePlatform::getTime() - _startTime; else time = _gameRef->_timer - _startTime; if (time >= _duration) _currentAlpha = _targetAlpha; @@ -84,7 +84,7 @@ bool CBFader::update() { ////////////////////////////////////////////////////////////////////////// -bool CBFader::display() { +bool BaseFader::display() { if (!_active) return STATUS_OK; if (_currentAlpha > 0x00) return _gameRef->_renderer->fadeToColor(BYTETORGBA(_red, _green, _blue, _currentAlpha)); @@ -93,7 +93,7 @@ bool CBFader::display() { ////////////////////////////////////////////////////////////////////////// -bool CBFader::deactivate() { +bool BaseFader::deactivate() { _active = false; _ready = true; return STATUS_OK; @@ -101,7 +101,7 @@ bool CBFader::deactivate() { ////////////////////////////////////////////////////////////////////////// -bool CBFader::fadeIn(uint32 sourceColor, uint32 duration, bool system) { +bool BaseFader::fadeIn(uint32 sourceColor, uint32 duration, bool system) { _ready = false; _active = true; @@ -115,7 +115,7 @@ bool CBFader::fadeIn(uint32 sourceColor, uint32 duration, bool system) { _duration = duration; _system = system; - if (_system) _startTime = CBPlatform::getTime(); + if (_system) _startTime = BasePlatform::getTime(); else _startTime = _gameRef->_timer; return STATUS_OK; @@ -123,7 +123,7 @@ bool CBFader::fadeIn(uint32 sourceColor, uint32 duration, bool system) { ////////////////////////////////////////////////////////////////////////// -bool CBFader::fadeOut(uint32 targetColor, uint32 duration, bool system) { +bool BaseFader::fadeOut(uint32 targetColor, uint32 duration, bool system) { _ready = false; _active = true; @@ -138,7 +138,7 @@ bool CBFader::fadeOut(uint32 targetColor, uint32 duration, bool system) { _duration = duration; _system = system; - if (_system) _startTime = CBPlatform::getTime(); + if (_system) _startTime = BasePlatform::getTime(); else _startTime = _gameRef->_timer; @@ -147,15 +147,15 @@ bool CBFader::fadeOut(uint32 targetColor, uint32 duration, bool system) { ////////////////////////////////////////////////////////////////////////// -uint32 CBFader::getCurrentColor() { +uint32 BaseFader::getCurrentColor() { return BYTETORGBA(_red, _green, _blue, _currentAlpha); } ////////////////////////////////////////////////////////////////////////// -bool CBFader::persist(CBPersistMgr *persistMgr) { - CBObject::persist(persistMgr); +bool BaseFader::persist(BasePersistenceManager *persistMgr) { + BaseObject::persist(persistMgr); persistMgr->transfer(TMEMBER(_active)); persistMgr->transfer(TMEMBER(_blue)); diff --git a/engines/wintermute/base/base_fader.h b/engines/wintermute/base/base_fader.h index 679f5d0903..36dd8a1d53 100644 --- a/engines/wintermute/base/base_fader.h +++ b/engines/wintermute/base/base_fader.h @@ -34,7 +34,7 @@ namespace WinterMute { -class CBFader : public CBObject { +class BaseFader : public BaseObject { public: bool _system; uint32 getCurrentColor(); @@ -43,9 +43,9 @@ public: bool deactivate(); bool display(); bool update(); - DECLARE_PERSISTENT(CBFader, CBObject) - CBFader(CBGame *inGame); - virtual ~CBFader(); + DECLARE_PERSISTENT(BaseFader, BaseObject) + BaseFader(BaseGame *inGame); + virtual ~BaseFader(); bool _active; byte _red; byte _green; diff --git a/engines/wintermute/base/base_file_manager.cpp b/engines/wintermute/base/base_file_manager.cpp index 1cb0464a1f..a2c81b8a8c 100644 --- a/engines/wintermute/base/base_file_manager.cpp +++ b/engines/wintermute/base/base_file_manager.cpp @@ -58,7 +58,7 @@ namespace WinterMute { ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// -CBFileManager::CBFileManager(CBGame *inGame): CBBase(inGame) { +BaseFileManager::BaseFileManager(BaseGame *inGame): BaseClass(inGame) { _basePath = NULL; initPaths(); @@ -67,13 +67,13 @@ CBFileManager::CBFileManager(CBGame *inGame): CBBase(inGame) { ////////////////////////////////////////////////////////////////////// -CBFileManager::~CBFileManager() { +BaseFileManager::~BaseFileManager() { cleanup(); } ////////////////////////////////////////////////////////////////////////// -bool CBFileManager::cleanup() { +bool BaseFileManager::cleanup() { // delete registered paths for (uint32 i = 0; i < _singlePaths.size(); i++) delete [] _singlePaths[i]; @@ -114,7 +114,7 @@ bool CBFileManager::cleanup() { #define MAX_FILE_SIZE 10000000 ////////////////////////////////////////////////////////////////////// -byte *CBFileManager::readWholeFile(const Common::String &filename, uint32 *size, bool mustExist) { +byte *BaseFileManager::readWholeFile(const Common::String &filename, uint32 *size, bool mustExist) { byte *buffer = NULL; Common::SeekableReadStream *file = openFile(filename); @@ -153,14 +153,14 @@ byte *CBFileManager::readWholeFile(const Common::String &filename, uint32 *size, return buffer; } -Common::SeekableReadStream *CBFileManager::loadSaveGame(const Common::String &filename) { +Common::SeekableReadStream *BaseFileManager::loadSaveGame(const Common::String &filename) { Common::SaveFileManager *saveMan = g_wintermute->getSaveFileMan(); Common::InSaveFile *file = saveMan->openForLoading(filename); return file; } ////////////////////////////////////////////////////////////////////////// -bool CBFileManager::saveFile(const Common::String &filename, byte *buffer, uint32 bufferSize, bool compressed, byte *prefixBuffer, uint32 prefixSize) { +bool BaseFileManager::saveFile(const Common::String &filename, byte *buffer, uint32 bufferSize, bool compressed, byte *prefixBuffer, uint32 prefixSize) { // TODO warning("Implement SaveFile"); @@ -173,7 +173,7 @@ bool CBFileManager::saveFile(const Common::String &filename, byte *buffer, uint3 #if 0 RestoreCurrentDir(); - CBUtils::CreatePath(filename, false); + BaseUtils::CreatePath(filename, false); FILE *f = fopen(filename, "wb"); if (!f) { @@ -223,7 +223,7 @@ bool CBFileManager::saveFile(const Common::String &filename, byte *buffer, uint3 ////////////////////////////////////////////////////////////////////////// -bool CBFileManager::requestCD(int cd, char *packageFile, const char *filename) { +bool BaseFileManager::requestCD(int cd, char *packageFile, const char *filename) { // unmount all non-local packages for (uint32 i = 0; i < _packages.size(); i++) { if (_packages[i]->_cD > 0) _packages[i]->close(); @@ -235,7 +235,7 @@ bool CBFileManager::requestCD(int cd, char *packageFile, const char *filename) { ////////////////////////////////////////////////////////////////////////// -bool CBFileManager::addPath(TPathType type, const Common::String &path) { +bool BaseFileManager::addPath(TPathType type, const Common::String &path) { if (path.c_str() == NULL || strlen(path.c_str()) < 1) return STATUS_FAILED; bool slashed = (path[path.size() - 1] == '\\' || path[path.size() - 1] == '/'); @@ -245,7 +245,7 @@ bool CBFileManager::addPath(TPathType type, const Common::String &path) { strcpy(buffer, path.c_str()); if (!slashed) strcat(buffer, "\\"); - //CBPlatform::strlwr(buffer); + //BasePlatform::strlwr(buffer); switch (type) { case PATH_SINGLE: @@ -260,7 +260,7 @@ bool CBFileManager::addPath(TPathType type, const Common::String &path) { } ////////////////////////////////////////////////////////////////////////// -bool CBFileManager::reloadPaths() { +bool BaseFileManager::reloadPaths() { // delete registered paths for (uint32 i = 0; i < _singlePaths.size(); i++) delete [] _singlePaths[i]; @@ -276,7 +276,7 @@ bool CBFileManager::reloadPaths() { #define TEMP_BUFFER_SIZE 32768 ////////////////////////////////////////////////////////////////////////// -bool CBFileManager::initPaths() { +bool BaseFileManager::initPaths() { restoreCurrentDir(); AnsiString pathList; @@ -284,10 +284,10 @@ bool CBFileManager::initPaths() { // single files paths pathList = _gameRef->_registry->readString("Resource", "CustomPaths", ""); - numPaths = CBUtils::strNumEntries(pathList.c_str(), ';'); + numPaths = BaseUtils::strNumEntries(pathList.c_str(), ';'); for (int i = 0; i < numPaths; i++) { - char *path = CBUtils::strEntry(i, pathList.c_str(), ';'); + char *path = BaseUtils::strEntry(i, pathList.c_str(), ';'); if (path && strlen(path) > 0) { addPath(PATH_SINGLE, path); } @@ -301,10 +301,10 @@ bool CBFileManager::initPaths() { addPath(PATH_PACKAGE, "./"); pathList = _gameRef->_registry->readString("Resource", "PackagePaths", ""); - numPaths = CBUtils::strNumEntries(pathList.c_str(), ';'); + numPaths = BaseUtils::strNumEntries(pathList.c_str(), ';'); for (int i = 0; i < numPaths; i++) { - char *path = CBUtils::strEntry(i, pathList.c_str(), ';'); + char *path = BaseUtils::strEntry(i, pathList.c_str(), ';'); if (path && strlen(path) > 0) { addPath(PATH_PACKAGE, path); } @@ -318,7 +318,7 @@ bool CBFileManager::initPaths() { ////////////////////////////////////////////////////////////////////////// -bool CBFileManager::registerPackages() { +bool BaseFileManager::registerPackages() { restoreCurrentDir(); _gameRef->LOG(0, "Scanning packages..."); @@ -365,7 +365,7 @@ bool CBFileManager::registerPackages() { } ////////////////////////////////////////////////////////////////////////// -bool CBFileManager::registerPackage(const Common::String &filename , bool searchSignature) { +bool BaseFileManager::registerPackage(const Common::String &filename , bool searchSignature) { // FILE *f = fopen(filename, "rb"); Common::File *package = new Common::File(); package->open(filename); @@ -411,7 +411,7 @@ bool CBFileManager::registerPackage(const Common::String &filename , bool search } for (uint32 i = 0; i < hdr.NumDirs; i++) { - CBPackage *pkg = new CBPackage(_gameRef); + BasePackage *pkg = new BasePackage(_gameRef); if (!pkg) return STATUS_FAILED; pkg->_boundToExe = boundToExe; @@ -450,7 +450,7 @@ bool CBFileManager::registerPackage(const Common::String &filename , bool search name[nameLength - 1] = '\0'; - CBPlatform::strupr(name); + BasePlatform::strupr(name); offset = package->readUint32LE(); offset += absoluteOffset; @@ -464,7 +464,7 @@ bool CBFileManager::registerPackage(const Common::String &filename , bool search } _filesIter = _files.find(name); if (_filesIter == _files.end()) { - CBFileEntry *file = new CBFileEntry(_gameRef); + BaseFileEntry *file = new BaseFileEntry(_gameRef); file->_package = pkg; file->_offset = offset; file->_length = length; @@ -492,7 +492,7 @@ bool CBFileManager::registerPackage(const Common::String &filename , bool search } ////////////////////////////////////////////////////////////////////////// -bool CBFileManager::isValidPackage(const AnsiString &fileName) const { +bool BaseFileManager::isValidPackage(const AnsiString &fileName) const { AnsiString plainName = PathUtil::getFileNameWithoutExtension(fileName); // check for device-type specific packages @@ -503,7 +503,7 @@ bool CBFileManager::isValidPackage(const AnsiString &fileName) const { } ////////////////////////////////////////////////////////////////////////// -Common::File *CBFileManager::openPackage(const Common::String &name) { +Common::File *BaseFileManager::openPackage(const Common::String &name) { //TODO: Is it really necessary to do this when we have the ScummVM-system? //RestoreCurrentDir(); @@ -524,14 +524,14 @@ Common::File *CBFileManager::openPackage(const Common::String &name) { if (ret->isOpen()) { return ret; } - warning("CBFileManager::OpenPackage - Couldn't load file %s", name.c_str()); + warning("BaseFileManager::OpenPackage - Couldn't load file %s", name.c_str()); delete ret; return NULL; } ////////////////////////////////////////////////////////////////////////// -Common::File *CBFileManager::openSingleFile(const Common::String &name) { +Common::File *BaseFileManager::openSingleFile(const Common::String &name) { restoreCurrentDir(); Common::File *ret = NULL; @@ -556,7 +556,7 @@ Common::File *CBFileManager::openSingleFile(const Common::String &name) { ////////////////////////////////////////////////////////////////////////// -bool CBFileManager::getFullPath(const Common::String &filename, char *fullname) { +bool BaseFileManager::getFullPath(const Common::String &filename, char *fullname) { restoreCurrentDir(); Common::File f; @@ -586,12 +586,12 @@ bool CBFileManager::getFullPath(const Common::String &filename, char *fullname) ////////////////////////////////////////////////////////////////////////// -CBFileEntry *CBFileManager::getPackageEntry(const Common::String &filename) { +BaseFileEntry *BaseFileManager::getPackageEntry(const Common::String &filename) { char *upc_name = new char[strlen(filename.c_str()) + 1]; strcpy(upc_name, filename.c_str()); - CBPlatform::strupr(upc_name); + BasePlatform::strupr(upc_name); - CBFileEntry *ret = NULL; + BaseFileEntry *ret = NULL; _filesIter = _files.find(upc_name); if (_filesIter != _files.end()) ret = _filesIter->_value; @@ -600,7 +600,7 @@ CBFileEntry *CBFileManager::getPackageEntry(const Common::String &filename) { return ret; } -bool CBFileManager::hasFile(const Common::String &filename) { +bool BaseFileManager::hasFile(const Common::String &filename) { //TODO: Do this in a much simpler fashion Common::SeekableReadStream *stream = openFile(filename, true, false); if (!stream) { @@ -611,7 +611,7 @@ bool CBFileManager::hasFile(const Common::String &filename) { } ////////////////////////////////////////////////////////////////////////// -Common::SeekableReadStream *CBFileManager::openFile(const Common::String &filename, bool absPathWarning, bool keepTrackOf) { +Common::SeekableReadStream *BaseFileManager::openFile(const Common::String &filename, bool absPathWarning, bool keepTrackOf) { if (strcmp(filename.c_str(), "") == 0) return NULL; //_gameRef->LOG(0, "open file: %s", filename); /*#ifdef __WIN32__ @@ -631,7 +631,7 @@ Common::SeekableReadStream *CBFileManager::openFile(const Common::String &filena ////////////////////////////////////////////////////////////////////////// -bool CBFileManager::closeFile(Common::SeekableReadStream *File) { +bool BaseFileManager::closeFile(Common::SeekableReadStream *File) { for (uint32 i = 0; i < _openFiles.size(); i++) { if (_openFiles[i] == File) { delete _openFiles[i]; @@ -644,13 +644,13 @@ bool CBFileManager::closeFile(Common::SeekableReadStream *File) { ////////////////////////////////////////////////////////////////////////// -Common::SeekableReadStream *CBFileManager::openFileRaw(const Common::String &filename) { +Common::SeekableReadStream *BaseFileManager::openFileRaw(const Common::String &filename) { restoreCurrentDir(); Common::SeekableReadStream *ret = NULL; if (scumm_strnicmp(filename.c_str(), "savegame:", 9) == 0) { - CBSaveThumbFile *SaveThumbFile = new CBSaveThumbFile(_gameRef); + BaseSaveThumbFile *SaveThumbFile = new BaseSaveThumbFile(_gameRef); if (DID_SUCCEED(SaveThumbFile->open(filename))) { ret = SaveThumbFile->getMemStream(); } @@ -666,7 +666,7 @@ Common::SeekableReadStream *CBFileManager::openFileRaw(const Common::String &fil ret = openPkgFile(filename, this); if (ret) return ret; - ret = CBResources::getFile(filename); + ret = BaseResources::getFile(filename); if (ret) return ret; warning("BFileManager::OpenFileRaw - Failed to open %s", filename.c_str()); @@ -675,19 +675,19 @@ Common::SeekableReadStream *CBFileManager::openFileRaw(const Common::String &fil ////////////////////////////////////////////////////////////////////////// -bool CBFileManager::restoreCurrentDir() { +bool BaseFileManager::restoreCurrentDir() { if (!_basePath) return STATUS_OK; else { /*if (!chdir(_basePath)) return STATUS_OK; else return STATUS_FAILED;*/ - warning("CBFileManager::RestoreCurrentDir - ignored"); + warning("BaseFileManager::RestoreCurrentDir - ignored"); return STATUS_OK; } } ////////////////////////////////////////////////////////////////////////// -bool CBFileManager::setBasePath(const Common::String &path) { +bool BaseFileManager::setBasePath(const Common::String &path) { cleanup(); if (path.c_str()) { @@ -703,7 +703,7 @@ bool CBFileManager::setBasePath(const Common::String &path) { ////////////////////////////////////////////////////////////////////////// -bool CBFileManager::findPackageSignature(Common::File *f, uint32 *offset) { +bool BaseFileManager::findPackageSignature(Common::File *f, uint32 *offset) { byte buf[32768]; byte signature[8]; diff --git a/engines/wintermute/base/base_file_manager.h b/engines/wintermute/base/base_file_manager.h index 1bf3156ebe..469108bee8 100644 --- a/engines/wintermute/base/base_file_manager.h +++ b/engines/wintermute/base/base_file_manager.h @@ -38,8 +38,8 @@ class File; } namespace WinterMute { -class CBFile; -class CBFileManager: CBBase { +class BaseFile; +class BaseFileManager: BaseClass { public: bool findPackageSignature(Common::File *f, uint32 *offset); bool cleanup(); @@ -51,7 +51,7 @@ public: bool closeFile(Common::SeekableReadStream *File); bool hasFile(const Common::String &filename); Common::SeekableReadStream *openFile(const Common::String &filename, bool absPathWarning = true, bool keepTrackOf = true); - CBFileEntry *getPackageEntry(const Common::String &filename); + BaseFileEntry *getPackageEntry(const Common::String &filename); Common::File *openSingleFile(const Common::String &name); Common::File *openPackage(const Common::String &name); bool registerPackages(); @@ -65,17 +65,17 @@ public: Common::SeekableReadStream *loadSaveGame(const Common::String &filename); bool saveFile(const Common::String &filename, byte *buffer, uint32 bufferSize, bool compressed = false, byte *prefixBuffer = NULL, uint32 prefixSize = 0); byte *readWholeFile(const Common::String &filename, uint32 *size = NULL, bool mustExist = true); - CBFileManager(CBGame *inGame = NULL); - virtual ~CBFileManager(); + BaseFileManager(BaseGame *inGame = NULL); + virtual ~BaseFileManager(); Common::Array _singlePaths; Common::Array _packagePaths; - Common::Array _packages; + Common::Array _packages; Common::Array _openFiles; - Common::HashMap _files; + Common::HashMap _files; private: bool registerPackage(const Common::String &filename, bool searchSignature = false); - Common::HashMap::iterator _filesIter; + Common::HashMap::iterator _filesIter; bool isValidPackage(const AnsiString &fileName) const; }; diff --git a/engines/wintermute/base/base_frame.cpp b/engines/wintermute/base/base_frame.cpp index 468ad29858..2a729a882a 100644 --- a/engines/wintermute/base/base_frame.cpp +++ b/engines/wintermute/base/base_frame.cpp @@ -42,10 +42,10 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CBFrame, false) +IMPLEMENT_PERSISTENT(BaseFrame, false) ////////////////////////////////////////////////////////////////////// -CBFrame::CBFrame(CBGame *inGame): CBScriptable(inGame, true) { +BaseFrame::BaseFrame(BaseGame *inGame): BaseScriptable(inGame, true) { _delay = 0; _moveX = _moveY = 0; @@ -58,7 +58,7 @@ CBFrame::CBFrame(CBGame *inGame): CBScriptable(inGame, true) { ////////////////////////////////////////////////////////////////////// -CBFrame::~CBFrame() { +BaseFrame::~BaseFrame() { delete _sound; _sound = NULL; @@ -75,7 +75,7 @@ CBFrame::~CBFrame() { ////////////////////////////////////////////////////////////////////// -bool CBFrame::draw(int x, int y, CBObject *registerOwner, float zoomX, float zoomY, bool precise, uint32 alpha, bool allFrames, float rotate, TSpriteBlendMode blendMode) { +bool BaseFrame::draw(int x, int y, BaseObject *registerOwner, float zoomX, float zoomY, bool precise, uint32 alpha, bool allFrames, float rotate, TSpriteBlendMode blendMode) { bool res; for (int i = 0; i < _subframes.getSize(); i++) { @@ -87,7 +87,7 @@ bool CBFrame::draw(int x, int y, CBObject *registerOwner, float zoomX, float zoo ////////////////////////////////////////////////////////////////////////// -bool CBFrame::oneTimeDisplay(CBObject *owner, bool muted) { +bool BaseFrame::oneTimeDisplay(BaseObject *owner, bool muted) { if (_sound && !muted) { if (owner) owner->updateOneSound(_sound); _sound->play(); @@ -131,7 +131,7 @@ TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF(KILL_SOUND) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////// -bool CBFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) { +bool BaseFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) { TOKEN_TABLE_START(commands) TOKEN_TABLE(DELAY) TOKEN_TABLE(IMAGE) @@ -158,7 +158,7 @@ bool CBFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) { char *params; int cmd; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); Rect32 rect; int r = 255, g = 255, b = 255; int ar = 255, ag = 255, ab = 255, alpha = 255; @@ -170,7 +170,7 @@ bool CBFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) { bool decoration = false; bool mirrorX = false; bool mirrorY = false; - CBPlatform::setRectEmpty(&rect); + BasePlatform::setRectEmpty(&rect); char *surface_file = NULL; while ((cmd = parser.getCommand((char **)&buffer, commands, ¶ms)) > 0) { @@ -237,7 +237,7 @@ bool CBFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) { break; case TOKEN_SUBFRAME: { - CBSubFrame *subframe = new CBSubFrame(_gameRef); + BaseSubFrame *subframe = new BaseSubFrame(_gameRef); if (!subframe || DID_FAIL(subframe->loadBuffer((byte *)params, lifeTime, keepLoaded))) { delete subframe; cmd = PARSERR_GENERIC; @@ -250,7 +250,7 @@ bool CBFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) { delete _sound; _sound = NULL; } - _sound = new CBSound(_gameRef); + _sound = new BaseSound(_gameRef); if (!_sound || DID_FAIL(_sound->setSound(params, Audio::Mixer::kSFXSoundType, false))) { if (_gameRef->_soundMgr->_soundAvailable) _gameRef->LOG(0, "Error loading sound '%s'.", params); delete _sound; @@ -290,7 +290,7 @@ bool CBFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) { } - CBSubFrame *sub = new CBSubFrame(_gameRef); + BaseSubFrame *sub = new BaseSubFrame(_gameRef); if (surface_file != NULL) { if (custoTrans) sub->setSurface(surface_file, false, r, g, b, lifeTime, keepLoaded); else sub->setSurface(surface_file, true, 0, 0, 0, lifeTime, keepLoaded); @@ -305,7 +305,7 @@ bool CBFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) { if (custoTrans) sub->_transparent = BYTETORGBA(r, g, b, 0xFF); } - if (CBPlatform::isRectEmpty(&rect)) sub->setDefaultRect(); + if (BasePlatform::isRectEmpty(&rect)) sub->setDefaultRect(); else sub->_rect = rect; sub->_hotspotX = hotspotX; @@ -325,15 +325,15 @@ bool CBFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) { ////////////////////////////////////////////////////////////////////////// -bool CBFrame::getBoundingRect(Rect32 *rect, int x, int y, float scaleX, float scaleY) { +bool BaseFrame::getBoundingRect(Rect32 *rect, int x, int y, float scaleX, float scaleY) { if (!rect) return false; - CBPlatform::setRectEmpty(rect); + BasePlatform::setRectEmpty(rect); Rect32 subRect; for (int i = 0; i < _subframes.getSize(); i++) { _subframes[i]->getBoundingRect(&subRect, x, y, scaleX, scaleY); - CBPlatform::unionRect(rect, rect, &subRect); + BasePlatform::unionRect(rect, rect, &subRect); } return true; } @@ -341,7 +341,7 @@ bool CBFrame::getBoundingRect(Rect32 *rect, int x, int y, float scaleX, float sc ////////////////////////////////////////////////////////////////////////// -bool CBFrame::saveAsText(CBDynBuffer *buffer, int indent) { +bool BaseFrame::saveAsText(BaseDynamicBuffer *buffer, int indent) { buffer->putTextIndent(indent, "FRAME {\n"); buffer->putTextIndent(indent + 2, "DELAY = %d\n", _delay); @@ -369,7 +369,7 @@ bool CBFrame::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent + 2, "APPLY_EVENT=\"%s\"\n", _applyEvent[i]); } - CBBase::saveAsText(buffer, indent + 2); + BaseClass::saveAsText(buffer, indent + 2); buffer->putTextIndent(indent, "}\n\n"); @@ -379,8 +379,8 @@ bool CBFrame::saveAsText(CBDynBuffer *buffer, int indent) { ////////////////////////////////////////////////////////////////////////// -bool CBFrame::persist(CBPersistMgr *persistMgr) { - CBScriptable::persist(persistMgr); +bool BaseFrame::persist(BasePersistenceManager *persistMgr) { + BaseScriptable::persist(persistMgr); _applyEvent.persist(persistMgr); persistMgr->transfer(TMEMBER(_delay)); @@ -399,7 +399,7 @@ bool CBFrame::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -bool CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool BaseFrame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // GetSound @@ -417,12 +417,12 @@ bool CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSta ////////////////////////////////////////////////////////////////////////// if (strcmp(name, "SetSound") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); delete _sound; _sound = NULL; if (!val->isNULL()) { - _sound = new CBSound(_gameRef); + _sound = new BaseSound(_gameRef); if (!_sound || DID_FAIL(_sound->setSound(val->getString(), Audio::Mixer::kSFXSoundType, false))) { stack->pushBool(false); delete _sound; @@ -451,14 +451,14 @@ bool CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSta ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "DeleteSubframe") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); if (val->isInt()) { int index = val->getInt(-1); if (index < 0 || index >= _subframes.getSize()) { script->runtimeError("Frame.DeleteSubframe: Subframe index %d is out of range.", index); } } else { - CBSubFrame *sub = (CBSubFrame *)val->getNative(); + BaseSubFrame *sub = (BaseSubFrame *)val->getNative(); for (int i = 0; i < _subframes.getSize(); i++) { if (_subframes[i] == sub) { delete _subframes[i]; @@ -476,11 +476,11 @@ bool CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSta ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "AddSubframe") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); const char *filename = NULL; if (!val->isNULL()) filename = val->getString(); - CBSubFrame *sub = new CBSubFrame(_gameRef); + BaseSubFrame *sub = new BaseSubFrame(_gameRef); if (filename != NULL) { sub->setSurface(filename); sub->setDefaultRect(); @@ -499,11 +499,11 @@ bool CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSta int index = stack->pop()->getInt(); if (index < 0) index = 0; - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); const char *filename = NULL; if (!val->isNULL()) filename = val->getString(); - CBSubFrame *sub = new CBSubFrame(_gameRef); + BaseSubFrame *sub = new BaseSubFrame(_gameRef); if (filename != NULL) { sub->setSurface(filename); } @@ -565,14 +565,14 @@ bool CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSta ////////////////////////////////////////////////////////////////////////// else { if (_subframes.getSize() == 1) return _subframes[0]->scCallMethod(script, stack, thisStack, name); - else return CBScriptable::scCallMethod(script, stack, thisStack, name); + else return BaseScriptable::scCallMethod(script, stack, thisStack, name); } } ////////////////////////////////////////////////////////////////////////// -CScValue *CBFrame::scGetProperty(const char *name) { - if (!_scValue) _scValue = new CScValue(_gameRef); +ScValue *BaseFrame::scGetProperty(const char *name) { + if (!_scValue) _scValue = new ScValue(_gameRef); _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// @@ -642,13 +642,13 @@ CScValue *CBFrame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// else { if (_subframes.getSize() == 1) return _subframes[0]->scGetProperty(name); - else return CBScriptable::scGetProperty(name); + else return BaseScriptable::scGetProperty(name); } } ////////////////////////////////////////////////////////////////////////// -bool CBFrame::scSetProperty(const char *name, CScValue *value) { +bool BaseFrame::scSetProperty(const char *name, ScValue *value) { ////////////////////////////////////////////////////////////////////////// // Delay ////////////////////////////////////////////////////////////////////////// @@ -692,13 +692,13 @@ bool CBFrame::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// else { if (_subframes.getSize() == 1) return _subframes[0]->scSetProperty(name, value); - else return CBScriptable::scSetProperty(name, value); + else return BaseScriptable::scSetProperty(name, value); } } ////////////////////////////////////////////////////////////////////////// -const char *CBFrame::scToString() { +const char *BaseFrame::scToString() { return "[frame]"; } diff --git a/engines/wintermute/base/base_frame.h b/engines/wintermute/base/base_frame.h index f3dec4e16f..dcbf74bc47 100644 --- a/engines/wintermute/base/base_frame.h +++ b/engines/wintermute/base/base_frame.h @@ -33,37 +33,37 @@ #include "engines/wintermute/coll_templ.h" namespace WinterMute { -class CBSound; -class CBSubFrame; -class CBObject; -class CScScript; -class CScStack; -class CBFrame: public CBScriptable { +class BaseSound; +class BaseSubFrame; +class BaseObject; +class ScScript; +class ScStack; +class BaseFrame: public BaseScriptable { public: bool _killSound; bool _keyframe; - bool oneTimeDisplay(CBObject *owner, bool muted = false); - DECLARE_PERSISTENT(CBFrame, CBScriptable) - CBSound *_sound; + bool oneTimeDisplay(BaseObject *owner, bool muted = false); + DECLARE_PERSISTENT(BaseFrame, BaseScriptable) + BaseSound *_sound; bool _editorExpanded; bool getBoundingRect(Rect32 *rect, int x, int y, float scaleX = 100, float scaleY = 100); - bool saveAsText(CBDynBuffer *buffer, int indent); + bool saveAsText(BaseDynamicBuffer *buffer, int indent); int _moveY; int _moveX; uint32 _delay; - CBArray _subframes; - bool draw(int x, int y, CBObject *registerOwner = NULL, float zoomX = 100, float zoomY = 100, bool precise = true, uint32 Alpha = 0xFFFFFFFF, bool allFrames = false, float rotate = 0.0f, TSpriteBlendMode blendMode = BLEND_NORMAL); + BaseArray _subframes; + bool draw(int x, int y, BaseObject *registerOwner = NULL, float zoomX = 100, float zoomY = 100, bool precise = true, uint32 Alpha = 0xFFFFFFFF, bool allFrames = false, float rotate = 0.0f, TSpriteBlendMode blendMode = BLEND_NORMAL); bool loadBuffer(byte *buffer, int lifeTime, bool keepLoaded); - CBFrame(CBGame *inGame); - virtual ~CBFrame(); + BaseFrame(BaseGame *inGame); + virtual ~BaseFrame(); - CBArray _applyEvent; + BaseArray _applyEvent; // scripting interface - virtual CScValue *scGetProperty(const char *name); - virtual bool scSetProperty(const char *name, CScValue *value); - virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual ScValue *scGetProperty(const char *name); + virtual bool scSetProperty(const char *name, ScValue *value); + virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); virtual const char *scToString(); }; diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp index 00c852e02d..0adc938895 100644 --- a/engines/wintermute/base/base_game.cpp +++ b/engines/wintermute/base/base_game.cpp @@ -74,11 +74,11 @@ namespace WinterMute { // Construction/Destruction ////////////////////////////////////////////////////////////////////// -IMPLEMENT_PERSISTENT(CBGame, true) +IMPLEMENT_PERSISTENT(BaseGame, true) ////////////////////////////////////////////////////////////////////// -CBGame::CBGame(): CBObject(this) { +BaseGame::BaseGame(): BaseObject(this) { _shuttingDown = false; _state = GAME_RUNNING; @@ -143,8 +143,8 @@ CBGame::CBGame(): CBObject(this) { _useD3D = false; - _registry = new CBRegistry(this); - _stringTable = new CBStringTable(this); + _registry = new BaseRegistry(this); + _stringTable = new BaseStringTable(this); for (int i = 0; i < NUM_MUSIC_CHANNELS; i++) { _music[i] = NULL; @@ -205,7 +205,7 @@ CBGame::CBGame(): CBObject(this) { _indicatorHeight = 8; _richSavedGames = false; _savedGameExt = NULL; - CBUtils::setString(&_savedGameExt, "dsv"); + BaseUtils::setString(&_savedGameExt, "dsv"); _musicCrossfadeRunning = false; _musicCrossfadeStartTime = 0; @@ -222,7 +222,7 @@ CBGame::CBGame(): CBObject(this) { _loadImageX = _loadImageY = 0; _localSaveDir = NULL; - CBUtils::setString(&_localSaveDir, "saves"); + BaseUtils::setString(&_localSaveDir, "saves"); _saveDirChecked = false; _loadingIcon = NULL; @@ -238,7 +238,7 @@ CBGame::CBGame(): CBObject(this) { _lastCursor = NULL; - CBPlatform::setRectEmpty(&_mouseLockRect); + BasePlatform::setRectEmpty(&_mouseLockRect); _suppressScriptErrors = false; _lastMiniUpdate = 0; @@ -270,7 +270,7 @@ CBGame::CBGame(): CBObject(this) { ////////////////////////////////////////////////////////////////////// -CBGame::~CBGame() { +BaseGame::~BaseGame() { _shuttingDown = true; LOG(0, ""); @@ -330,12 +330,12 @@ CBGame::~CBGame() { _stringTable = NULL; DEBUG_DebugDisable(); - CBPlatform::outputDebugString("--- shutting down normally ---\n"); + BasePlatform::outputDebugString("--- shutting down normally ---\n"); } ////////////////////////////////////////////////////////////////////////// -bool CBGame::cleanup() { +bool BaseGame::cleanup() { delete _loadingIcon; _loadingIcon = NULL; @@ -414,50 +414,50 @@ bool CBGame::cleanup() { ////////////////////////////////////////////////////////////////////// -bool CBGame::initialize1() { +bool BaseGame::initialize1() { bool loaded = false; // Not really a loop, but a goto-replacement. while (!loaded) { - _surfaceStorage = new CBSurfaceStorage(this); + _surfaceStorage = new BaseSurfaceStorage(this); if (_surfaceStorage == NULL) break; - _fontStorage = new CBFontStorage(this); + _fontStorage = new BaseFontStorage(this); if (_fontStorage == NULL) break; - _fileManager = new CBFileManager(this); + _fileManager = new BaseFileManager(this); if (_fileManager == NULL) break; - _soundMgr = new CBSoundMgr(this); + _soundMgr = new BaseSoundMgr(this); if (_soundMgr == NULL) break; - _debugMgr = new CBDebugger(this); + _debugMgr = new BaseDebugger(this); if (_debugMgr == NULL) break; - _mathClass = new CSXMath(this); + _mathClass = new SXMath(this); if (_mathClass == NULL) break; - _scEngine = new CScEngine(this); + _scEngine = new ScEngine(this); if (_scEngine == NULL) break; - _videoPlayer = new CVidPlayer(this); + _videoPlayer = new VideoPlayer(this); if (_videoPlayer == NULL) break; - _transMgr = new CBTransitionMgr(this); + _transMgr = new BaseTransitionMgr(this); if (_transMgr == NULL) break; - _keyboardState = new CBKeyboardState(this); + _keyboardState = new BaseKeyboardState(this); if (_keyboardState == NULL) break; - _fader = new CBFader(this); + _fader = new BaseFader(this); if (_fader == NULL) break; registerObject(_fader); @@ -483,7 +483,7 @@ bool CBGame::initialize1() { ////////////////////////////////////////////////////////////////////// -bool CBGame::initialize2() { // we know whether we are going to be accelerated +bool BaseGame::initialize2() { // we know whether we are going to be accelerated _renderer = makeOSystemRenderer(this); if (_renderer == NULL) return STATUS_FAILED; @@ -492,7 +492,7 @@ bool CBGame::initialize2() { // we know whether we are going to be accelerated ////////////////////////////////////////////////////////////////////// -bool CBGame::initialize3() { // renderer is initialized +bool BaseGame::initialize3() { // renderer is initialized _posX = _renderer->_width / 2; _posY = _renderer->_height / 2; @@ -505,7 +505,7 @@ bool CBGame::initialize3() { // renderer is initialized ////////////////////////////////////////////////////////////////////// -void CBGame::DEBUG_DebugEnable(const char *filename) { +void BaseGame::DEBUG_DebugEnable(const char *filename) { _debugDebugMode = true; /* time_t timeNow; @@ -532,14 +532,14 @@ void CBGame::DEBUG_DebugEnable(const char *filename) { LOG(0, "%s ver %d.%d.%d%s, Compiled on " __DATE__ ", " __TIME__, DCGF_NAME, DCGF_VER_MAJOR, DCGF_VER_MINOR, DCGF_VER_BUILD, DCGF_VER_SUFFIX); //LOG(0, "Extensions: %s ver %d.%02d", EXT_NAME, EXT_VER_MAJOR, EXT_VER_MINOR); - AnsiString platform = CBPlatform::getPlatformName(); + AnsiString platform = BasePlatform::getPlatformName(); LOG(0, "Platform: %s", platform.c_str()); LOG(0, ""); } ////////////////////////////////////////////////////////////////////// -void CBGame::DEBUG_DebugDisable() { +void BaseGame::DEBUG_DebugDisable() { if (_debugLogFile != NULL) { LOG(0, "********** DEBUG LOG CLOSED ********************************************"); //fclose((FILE *)_debugLogFile); @@ -550,7 +550,7 @@ void CBGame::DEBUG_DebugDisable() { ////////////////////////////////////////////////////////////////////// -void CBGame::LOG(bool res, const char *fmt, ...) { +void BaseGame::LOG(bool res, const char *fmt, ...) { uint32 secs = g_system->getMillis() / 1000; uint32 hours = secs / 3600; secs = secs % 3600; @@ -580,17 +580,17 @@ void CBGame::LOG(bool res, const char *fmt, ...) { ////////////////////////////////////////////////////////////////////////// -void CBGame::setEngineLogCallback(ENGINE_LOG_CALLBACK callback, void *data) { +void BaseGame::setEngineLogCallback(ENGINE_LOG_CALLBACK callback, void *data) { _engineLogCallback = callback; _engineLogCallbackData = data; } ////////////////////////////////////////////////////////////////////// -bool CBGame::initLoop() { +bool BaseGame::initLoop() { _viewportSP = -1; - _currentTime = CBPlatform::getTime(); + _currentTime = BasePlatform::getTime(); getDebugMgr()->onGameTick(); _renderer->initLoop(); @@ -645,35 +645,35 @@ bool CBGame::initLoop() { ////////////////////////////////////////////////////////////////////// -bool CBGame::initInput() { +bool BaseGame::initInput() { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -int CBGame::getSequence() { +int BaseGame::getSequence() { return ++_sequence; } ////////////////////////////////////////////////////////////////////////// -void CBGame::setOffset(int offsetX, int offsetY) { +void BaseGame::setOffset(int offsetX, int offsetY) { _offsetX = offsetX; _offsetY = offsetY; } ////////////////////////////////////////////////////////////////////////// -void CBGame::getOffset(int *offsetX, int *offsetY) { +void BaseGame::getOffset(int *offsetX, int *offsetY) { if (offsetX != NULL) *offsetX = _offsetX; if (offsetY != NULL) *offsetY = _offsetY; } ////////////////////////////////////////////////////////////////////////// -bool CBGame::loadFile(const char *filename) { +bool BaseGame::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { - _gameRef->LOG(0, "CBGame::LoadFile failed for file '%s'", filename); + _gameRef->LOG(0, "BaseGame::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -740,7 +740,7 @@ TOKEN_DEF(GUID) TOKEN_DEF(COMPAT_KILL_METHOD_THREADS) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -bool CBGame::loadBuffer(byte *buffer, bool complete) { +bool BaseGame::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(GAME) TOKEN_TABLE(TEMPLATE) @@ -778,7 +778,7 @@ bool CBGame::loadBuffer(byte *buffer, bool complete) { byte *params; int cmd; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); if (complete) { if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_GAME) { @@ -819,7 +819,7 @@ bool CBGame::loadBuffer(byte *buffer, bool complete) { case TOKEN_CURSOR: delete _cursor; - _cursor = new CBSprite(_gameRef); + _cursor = new BaseSprite(_gameRef); if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) { delete _cursor; _cursor = NULL; @@ -830,7 +830,7 @@ bool CBGame::loadBuffer(byte *buffer, bool complete) { case TOKEN_ACTIVE_CURSOR: delete _activeCursor; _activeCursor = NULL; - _activeCursor = new CBSprite(_gameRef); + _activeCursor = new BaseSprite(_gameRef); if (!_activeCursor || DID_FAIL(_activeCursor->loadFile((char *)params))) { delete _activeCursor; _activeCursor = NULL; @@ -840,7 +840,7 @@ bool CBGame::loadBuffer(byte *buffer, bool complete) { case TOKEN_NONINTERACTIVE_CURSOR: delete _cursorNoninteractive; - _cursorNoninteractive = new CBSprite(_gameRef); + _cursorNoninteractive = new BaseSprite(_gameRef); if (!_cursorNoninteractive || DID_FAIL(_cursorNoninteractive->loadFile((char *)params))) { delete _cursorNoninteractive; _cursorNoninteractive = NULL; @@ -908,7 +908,7 @@ bool CBGame::loadBuffer(byte *buffer, bool complete) { break; case TOKEN_SAVE_IMAGE: - CBUtils::setString(&_saveImageName, (char *)params); + BaseUtils::setString(&_saveImageName, (char *)params); break; case TOKEN_SAVE_IMAGE_X: @@ -920,7 +920,7 @@ bool CBGame::loadBuffer(byte *buffer, bool complete) { break; case TOKEN_LOAD_IMAGE: - CBUtils::setString(&_loadImageName, (char *)params); + BaseUtils::setString(&_loadImageName, (char *)params); break; case TOKEN_LOAD_IMAGE_X: @@ -932,7 +932,7 @@ bool CBGame::loadBuffer(byte *buffer, bool complete) { break; case TOKEN_LOCAL_SAVE_DIR: - CBUtils::setString(&_localSaveDir, (char *)params); + BaseUtils::setString(&_localSaveDir, (char *)params); break; case TOKEN_COMPAT_KILL_METHOD_THREADS: @@ -960,7 +960,7 @@ bool CBGame::loadBuffer(byte *buffer, bool complete) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -bool CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // LOG ////////////////////////////////////////////////////////////////////////// @@ -975,7 +975,7 @@ bool CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStac // Caption ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "Caption") == 0) { - bool res = CBObject::scCallMethod(script, stack, thisStack, name); + bool res = BaseObject::scCallMethod(script, stack, thisStack, name); setWindowTitle(); return res; } @@ -1010,7 +1010,7 @@ bool CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStac else if (strcmp(name, "LoadStringTable") == 0) { stack->correctParams(2); const char *filename = stack->pop()->getString(); - CScValue *Val = stack->pop(); + ScValue *Val = stack->pop(); bool ClearOld; if (Val->isNULL()) ClearOld = true; @@ -1029,8 +1029,8 @@ bool CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStac ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "ValidObject") == 0) { stack->correctParams(1); - CBScriptable *obj = stack->pop()->getNative(); - if (validObject((CBObject *) obj)) stack->pushBool(true); + BaseScriptable *obj = stack->pop()->getNative(); + if (validObject((BaseObject *) obj)) stack->pushBool(true); else stack->pushBool(false); return STATUS_OK; @@ -1053,8 +1053,8 @@ bool CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStac ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "UnloadObject") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); - CBObject *obj = (CBObject *)val->getNative(); + ScValue *val = stack->pop(); + BaseObject *obj = (BaseObject *)val->getNative(); unregisterObject(obj); if (val->getType() == VAL_VARIABLE_REF) val->setNULL(); @@ -1067,7 +1067,7 @@ bool CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStac ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "LoadWindow") == 0) { stack->correctParams(1); - CUIWindow *win = new CUIWindow(_gameRef); + UIWindow *win = new UIWindow(_gameRef); if (win && DID_SUCCEED(win->loadFile(stack->pop()->getString()))) { _windows.add(win); registerObject(win); @@ -1085,7 +1085,7 @@ bool CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStac ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "ExpandString") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); char *str = new char[strlen(val->getString()) + 1]; strcpy(str, val->getString()); _stringTable->expand(&str); @@ -1106,10 +1106,10 @@ bool CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStac } const char *filename = stack->pop()->getString(); - CScValue *valLooping = stack->pop(); + ScValue *valLooping = stack->pop(); bool looping = valLooping->isNULL() ? true : valLooping->getBool(); - CScValue *valLoopStart = stack->pop(); + ScValue *valLoopStart = stack->pop(); uint32 loopStart = (uint32)(valLoopStart->isNULL() ? 0 : valLoopStart->getInt()); @@ -1311,7 +1311,7 @@ bool CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStac int length = 0; const char *filename = stack->pop()->getString(); - CBSound *sound = new CBSound(_gameRef); + BaseSound *sound = new BaseSound(_gameRef); if (sound && DID_SUCCEED(sound->setSound(filename, Audio::Mixer::kMusicSoundType, true))) { length = sound->getLength(); delete sound; @@ -1336,7 +1336,7 @@ bool CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStac p.x = x + _renderer->_drawOffsetX; p.y = y + _renderer->_drawOffsetY; - CBPlatform::setCursorPos(p.x, p.y); + BasePlatform::setCursorPos(p.x, p.y); stack->pushNULL(); return STATUS_OK; @@ -1352,10 +1352,10 @@ bool CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStac int right = stack->pop()->getInt(); int bottom = stack->pop()->getInt(); - if (right < left) CBUtils::swap(&left, &right); - if (bottom < top) CBUtils::swap(&top, &bottom); + if (right < left) BaseUtils::swap(&left, &right); + if (bottom < top) BaseUtils::swap(&top, &bottom); - CBPlatform::setRect(&_mouseLockRect, left, top, right, bottom); + BasePlatform::setRect(&_mouseLockRect, left, top, right, bottom); stack->pushNULL(); return STATUS_OK; @@ -1377,7 +1377,7 @@ bool CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStac stack->correctParams(6); const char *filename = stack->pop()->getString(); warning("PlayVideo: %s - not implemented yet", filename); - CScValue *valType = stack->pop(); + ScValue *valType = stack->pop(); int Type; if (valType->isNULL()) Type = (int)VID_PLAY_STRETCH; else Type = valType->getInt(); @@ -1386,7 +1386,7 @@ bool CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStac int yVal = stack->pop()->getInt(); bool FreezeMusic = stack->pop()->getBool(true); - CScValue *valSub = stack->pop(); + ScValue *valSub = stack->pop(); const char *SubtitleFile = valSub->isNULL() ? NULL : valSub->getString(); if (Type < (int)VID_PLAY_POS || Type > (int)VID_PLAY_CENTER) @@ -1414,7 +1414,7 @@ bool CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStac stack->correctParams(7); const char *filename = stack->pop()->getString(); - CScValue *valType = stack->pop(); + ScValue *valType = stack->pop(); int type; if (valType->isNULL()) type = (int)VID_PLAY_STRETCH; @@ -1425,13 +1425,13 @@ bool CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStac bool freezeMusic = stack->pop()->getBool(true); bool dropFrames = stack->pop()->getBool(true); - CScValue *valSub = stack->pop(); + ScValue *valSub = stack->pop(); const char *SubtitleFile = valSub->isNULL() ? NULL : valSub->getString(); if (type < (int)VID_PLAY_POS || type > (int)VID_PLAY_CENTER) type = (int)VID_PLAY_STRETCH; delete _theoraPlayer; - _theoraPlayer = new CVidTheoraPlayer(this); + _theoraPlayer = new VideoTheoraPlayer(this); if (_theoraPlayer && DID_SUCCEED(_theoraPlayer->initialize(filename, SubtitleFile))) { _theoraPlayer->_dontDropFrames = !dropFrames; if (DID_SUCCEED(_theoraPlayer->play((TVideoPlayback)type, xVal, yVal, true, freezeMusic))) { @@ -1776,7 +1776,7 @@ bool CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStac stack->correctParams(1); char filename[MAX_PATH_LENGTH]; - CScValue *Val = stack->pop(); + ScValue *Val = stack->pop(); warning("BGame::ScCallMethod - Screenshot not reimplemented"); //TODO int fileNum = 0; @@ -1789,7 +1789,7 @@ bool CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStac } bool ret = false; - CBImage *image = _gameRef->_renderer->takeScreenshot(); + BaseImage *image = _gameRef->_renderer->takeScreenshot(); if (image) { ret = DID_SUCCEED(image->saveBMPFile(filename)); delete image; @@ -1809,7 +1809,7 @@ bool CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStac int sizeY = stack->pop()->getInt(_renderer->_height); bool ret = false; - CBImage *image = _gameRef->_renderer->takeScreenshot(); + BaseImage *image = _gameRef->_renderer->takeScreenshot(); if (image) { ret = DID_SUCCEED(image->resize(sizeX, sizeY)); if (ret) ret = DID_SUCCEED(image->saveBMPFile(filename)); @@ -1825,9 +1825,9 @@ bool CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStac ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "CreateWindow") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); - CUIWindow *win = new CUIWindow(_gameRef); + UIWindow *win = new UIWindow(_gameRef); _windows.add(win); registerObject(win); if (!val->isNULL()) win->setName(val->getString()); @@ -1840,7 +1840,7 @@ bool CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStac ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "DeleteWindow") == 0) { stack->correctParams(1); - CBObject *obj = (CBObject *)stack->pop()->getNative(); + BaseObject *obj = (BaseObject *)stack->pop()->getNative(); for (int i = 0; i < _windows.getSize(); i++) { if (_windows[i] == obj) { unregisterObject(_windows[i]); @@ -1876,7 +1876,7 @@ bool CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStac ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "SetLoadingScreen") == 0) { stack->correctParams(3); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); _loadImageX = stack->pop()->getInt(); _loadImageY = stack->pop()->getInt(); @@ -1884,7 +1884,7 @@ bool CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStac delete[] _loadImageName; _loadImageName = NULL; } else { - CBUtils::setString(&_loadImageName, val->getString()); + BaseUtils::setString(&_loadImageName, val->getString()); } stack->pushNULL(); return STATUS_OK; @@ -1895,7 +1895,7 @@ bool CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStac ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "SetSavingScreen") == 0) { stack->correctParams(3); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); _saveImageX = stack->pop()->getInt(); _saveImageY = stack->pop()->getInt(); @@ -1903,7 +1903,7 @@ bool CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStac delete[] _saveImageName; _saveImageName = NULL; } else { - CBUtils::setString(&_saveImageName, val->getString()); + BaseUtils::setString(&_saveImageName, val->getString()); } stack->pushNULL(); return STATUS_OK; @@ -1976,7 +1976,7 @@ bool CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStac _loadingIconPersistent = stack->pop()->getBool(); delete _loadingIcon; - _loadingIcon = new CBSprite(this); + _loadingIcon = new BaseSprite(this); if (!_loadingIcon || DID_FAIL(_loadingIcon->loadFile(filename))) { delete _loadingIcon; _loadingIcon = NULL; @@ -2035,7 +2035,7 @@ bool CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStac else if (strcmp(name, "StoreSaveThumbnail") == 0) { stack->correctParams(0); delete _cachedThumbnail; - _cachedThumbnail = new CBSaveThumbHelper(this); + _cachedThumbnail = new BaseSaveThumbHelper(this); if (DID_FAIL(_cachedThumbnail->storeThumbnail())) { delete _cachedThumbnail; _cachedThumbnail = NULL; @@ -2143,12 +2143,12 @@ bool CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStac return STATUS_OK; } - else return CBObject::scCallMethod(script, stack, thisStack, name); + else return BaseObject::scCallMethod(script, stack, thisStack, name); } ////////////////////////////////////////////////////////////////////////// -CScValue *CBGame::scGetProperty(const char *name) { +ScValue *BaseGame::scGetProperty(const char *name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// @@ -2185,7 +2185,7 @@ CScValue *CBGame::scGetProperty(const char *name) { // WindowsTime (RO) ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "WindowsTime") == 0) { - _scValue->setInt((int)CBPlatform::getTime()); + _scValue->setInt((int)BasePlatform::getTime()); return _scValue; } @@ -2504,7 +2504,7 @@ CScValue *CBGame::scGetProperty(const char *name) { // Platform (RO) ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "Platform") == 0) { - _scValue->setString(CBPlatform::getPlatformName().c_str()); + _scValue->setString(BasePlatform::getPlatformName().c_str()); return _scValue; } @@ -2534,12 +2534,12 @@ CScValue *CBGame::scGetProperty(const char *name) { return _scValue; } - else return CBObject::scGetProperty(name); + else return BaseObject::scGetProperty(name); } ////////////////////////////////////////////////////////////////////////// -bool CBGame::scSetProperty(const char *name, CScValue *value) { +bool BaseGame::scSetProperty(const char *name, ScValue *value) { ////////////////////////////////////////////////////////////////////////// // Name ////////////////////////////////////////////////////////////////////////// @@ -2571,7 +2571,7 @@ bool CBGame::scSetProperty(const char *name, CScValue *value) { // Caption ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "Name") == 0) { - bool res = CBObject::scSetProperty(name, value); + bool res = BaseObject::scSetProperty(name, value); setWindowTitle(); return res; } @@ -2580,8 +2580,8 @@ bool CBGame::scSetProperty(const char *name, CScValue *value) { // MainObject ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "MainObject") == 0) { - CBScriptable *obj = value->getNative(); - if (obj == NULL || validObject((CBObject *)obj)) _mainObject = (CBObject *)obj; + BaseScriptable *obj = value->getNative(); + if (obj == NULL || validObject((BaseObject *)obj)) _mainObject = (BaseObject *)obj; return STATUS_OK; } @@ -2729,12 +2729,12 @@ bool CBGame::scSetProperty(const char *name, CScValue *value) { return STATUS_OK; } - else return CBObject::scSetProperty(name, value); + else return BaseObject::scSetProperty(name, value); } ////////////////////////////////////////////////////////////////////////// -const char *CBGame::scToString() { +const char *BaseGame::scToString() { return "[game object]"; } @@ -2742,7 +2742,7 @@ const char *CBGame::scToString() { #define QUICK_MSG_DURATION 3000 ////////////////////////////////////////////////////////////////////////// -bool CBGame::displayQuickMsg() { +bool BaseGame::displayQuickMsg() { if (_quickMessages.getSize() == 0 || !_systemFont) return STATUS_OK; // update @@ -2767,17 +2767,17 @@ bool CBGame::displayQuickMsg() { #define MAX_QUICK_MSG 5 ////////////////////////////////////////////////////////////////////////// -void CBGame::quickMessage(const char *text) { +void BaseGame::quickMessage(const char *text) { if (_quickMessages.getSize() >= MAX_QUICK_MSG) { delete _quickMessages[0]; _quickMessages.removeAt(0); } - _quickMessages.add(new CBQuickMsg(_gameRef, text)); + _quickMessages.add(new BaseQuickMsg(_gameRef, text)); } ////////////////////////////////////////////////////////////////////////// -void CBGame::quickMessageForm(char *fmt, ...) { +void BaseGame::quickMessageForm(char *fmt, ...) { char buff[256]; va_list va; @@ -2790,19 +2790,19 @@ void CBGame::quickMessageForm(char *fmt, ...) { ////////////////////////////////////////////////////////////////////////// -bool CBGame::registerObject(CBObject *object) { +bool BaseGame::registerObject(BaseObject *object) { _regObjects.add(object); return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CBGame::unregisterObject(CBObject *object) { +bool BaseGame::unregisterObject(BaseObject *object) { if (!object) return STATUS_OK; // is it a window? for (int i = 0; i < _windows.getSize(); i++) { - if ((CBObject *)_windows[i] == object) { + if ((BaseObject *)_windows[i] == object) { _windows.removeAt(i); // get new focused window @@ -2822,7 +2822,7 @@ bool CBGame::unregisterObject(CBObject *object) { for (int i = 0; i < _regObjects.getSize(); i++) { if (_regObjects[i] == object) { _regObjects.removeAt(i); - if (!_loadInProgress) CSysClassRegistry::getInstance()->enumInstances(invalidateValues, "CScValue", (void *)object); + if (!_loadInProgress) SystemClassRegistry::getInstance()->enumInstances(invalidateValues, "ScValue", (void *)object); delete object; return STATUS_OK; } @@ -2833,11 +2833,11 @@ bool CBGame::unregisterObject(CBObject *object) { ////////////////////////////////////////////////////////////////////////// -void CBGame::invalidateValues(void *value, void *data) { - CScValue *val = (CScValue *)value; +void BaseGame::invalidateValues(void *value, void *data) { + ScValue *val = (ScValue *)value; if (val->isNative() && val->getNative() == data) { - if (!val->_persistent && ((CBScriptable *)data)->_refCount == 1) { - ((CBScriptable *)data)->_refCount++; + if (!val->_persistent && ((BaseScriptable *)data)->_refCount == 1) { + ((BaseScriptable *)data)->_refCount++; } val->setNative(NULL); val->setNULL(); @@ -2847,7 +2847,7 @@ void CBGame::invalidateValues(void *value, void *data) { ////////////////////////////////////////////////////////////////////////// -bool CBGame::validObject(CBObject *object) { +bool BaseGame::validObject(BaseObject *object) { if (!object) return false; if (object == this) return true; @@ -2859,8 +2859,8 @@ bool CBGame::validObject(CBObject *object) { ////////////////////////////////////////////////////////////////////////// -bool CBGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisStack, char *name) { - CScValue *thisObj; +bool BaseGame::ExternalCall(ScScript *script, ScStack *stack, ScStack *thisStack, char *name) { + ScValue *thisObj; ////////////////////////////////////////////////////////////////////////// // LOG @@ -2947,8 +2947,8 @@ bool CBGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisStac else if (strcmp(name, "WaitFor") == 0) { stack->correctParams(1); - CBScriptable *obj = stack->pop()->getNative(); - if (validObject((CBObject *)obj)) script->waitForExclusive((CBObject *)obj); + BaseScriptable *obj = stack->pop()->getNative(); + if (validObject((BaseObject *)obj)) script->waitForExclusive((BaseObject *)obj); stack->pushNULL(); } @@ -2961,7 +2961,7 @@ bool CBGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisStac int from = stack->pop()->getInt(); int to = stack->pop()->getInt(); - stack->pushInt(CBUtils::randomInt(from, to)); + stack->pushInt(BaseUtils::randomInt(from, to)); } ////////////////////////////////////////////////////////////////////////// @@ -2983,7 +2983,7 @@ bool CBGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisStac int g = stack->pop()->getInt(); int b = stack->pop()->getInt(); int a; - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); if (val->isNULL()) a = 255; else a = val->getInt(); @@ -2999,7 +2999,7 @@ bool CBGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisStac int s = stack->pop()->getInt(); int l = stack->pop()->getInt(); - stack->pushInt(CBUtils::HSLtoRGB(h, s, l)); + stack->pushInt(BaseUtils::HSLtoRGB(h, s, l)); } ////////////////////////////////////////////////////////////////////////// @@ -3050,7 +3050,7 @@ bool CBGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisStac uint32 rgb = (uint32)stack->pop()->getInt(); byte H, S, L; - CBUtils::RGBtoHSL(rgb, &H, &S, &L); + BaseUtils::RGBtoHSL(rgb, &H, &S, &L); stack->pushInt(H); } @@ -3062,7 +3062,7 @@ bool CBGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisStac uint32 rgb = (uint32)stack->pop()->getInt(); byte H, S, L; - CBUtils::RGBtoHSL(rgb, &H, &S, &L); + BaseUtils::RGBtoHSL(rgb, &H, &S, &L); stack->pushInt(S); } @@ -3074,7 +3074,7 @@ bool CBGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisStac uint32 rgb = (uint32)stack->pop()->getInt(); byte H, S, L; - CBUtils::RGBtoHSL(rgb, &H, &S, &L); + BaseUtils::RGBtoHSL(rgb, &H, &S, &L); stack->pushInt(L); } @@ -3143,7 +3143,7 @@ bool CBGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisStac ////////////////////////////////////////////////////////////////////////// -bool CBGame::showCursor() { +bool BaseGame::showCursor() { if (_cursorHidden) return STATUS_OK; if (!_interactive && _gameRef->_state == GAME_RUNNING) { @@ -3160,7 +3160,7 @@ bool CBGame::showCursor() { ////////////////////////////////////////////////////////////////////////// -bool CBGame::SaveGame(int slot, const char *desc, bool quickSave) { +bool BaseGame::SaveGame(int slot, const char *desc, bool quickSave) { char filename[MAX_PATH_LENGTH + 1]; getSaveSlotFilename(slot, filename); @@ -3172,7 +3172,7 @@ bool CBGame::SaveGame(int slot, const char *desc, bool quickSave) { _indicatorDisplay = true; _indicatorProgress = 0; - CBPersistMgr *pm = new CBPersistMgr(_gameRef); + BasePersistenceManager *pm = new BasePersistenceManager(_gameRef); if (DID_FAIL(ret = pm->initSave(desc))) goto save_finish; if (!quickSave) { @@ -3188,8 +3188,8 @@ bool CBGame::SaveGame(int slot, const char *desc, bool quickSave) { } } - if (DID_FAIL(ret = CSysClassRegistry::getInstance()->saveTable(_gameRef, pm, quickSave))) goto save_finish; - if (DID_FAIL(ret = CSysClassRegistry::getInstance()->saveInstances(_gameRef, pm, quickSave))) goto save_finish; + if (DID_FAIL(ret = SystemClassRegistry::getInstance()->saveTable(_gameRef, pm, quickSave))) goto save_finish; + if (DID_FAIL(ret = SystemClassRegistry::getInstance()->saveInstances(_gameRef, pm, quickSave))) goto save_finish; if (DID_FAIL(ret = pm->saveFile(filename))) goto save_finish; _registry->writeInt("System", "MostRecentSaveSlot", slot); @@ -3206,8 +3206,8 @@ save_finish: // TODO: Remove gotos ////////////////////////////////////////////////////////////////////////// -bool CBGame::loadGame(int slot) { - //_gameRef->LOG(0, "Load start %d", CBUtils::GetUsedMemMB()); +bool BaseGame::loadGame(int slot) { + //_gameRef->LOG(0, "Load start %d", BaseUtils::GetUsedMemMB()); _loading = false; _scheduledLoadSlot = -1; @@ -3220,7 +3220,7 @@ bool CBGame::loadGame(int slot) { ////////////////////////////////////////////////////////////////////////// -bool CBGame::loadGame(const char *filename) { +bool BaseGame::loadGame(const char *filename) { LOG(0, "Loading game '%s'...", filename); getDebugMgr()->onGameShutdown(); @@ -3241,13 +3241,13 @@ bool CBGame::loadGame(const char *filename) { _loadInProgress = true; _indicatorDisplay = true; _indicatorProgress = 0; - CBPersistMgr *pm = new CBPersistMgr(_gameRef); + BasePersistenceManager *pm = new BasePersistenceManager(_gameRef); _debugAbsolutePathWarning = false; if (DID_FAIL(ret = pm->initLoad(filename))) goto load_finish; //if(DID_FAIL(ret = cleanup())) goto load_finish; - if (DID_FAIL(ret = CSysClassRegistry::getInstance()->loadTable(_gameRef, pm))) goto load_finish; - if (DID_FAIL(ret = CSysClassRegistry::getInstance()->loadInstances(_gameRef, pm))) goto load_finish; + if (DID_FAIL(ret = SystemClassRegistry::getInstance()->loadTable(_gameRef, pm))) goto load_finish; + if (DID_FAIL(ret = SystemClassRegistry::getInstance()->loadInstances(_gameRef, pm))) goto load_finish; // data initialization after load initAfterLoad(); @@ -3269,19 +3269,19 @@ load_finish: delete _saveLoadImage; _saveLoadImage = NULL; - //_gameRef->LOG(0, "Load end %d", CBUtils::GetUsedMemMB()); + //_gameRef->LOG(0, "Load end %d", BaseUtils::GetUsedMemMB()); return ret; } ////////////////////////////////////////////////////////////////////////// -bool CBGame::initAfterLoad() { - CSysClassRegistry::getInstance()->enumInstances(afterLoadRegion, "CBRegion", NULL); - CSysClassRegistry::getInstance()->enumInstances(afterLoadSubFrame, "CBSubFrame", NULL); - CSysClassRegistry::getInstance()->enumInstances(afterLoadSound, "CBSound", NULL); - CSysClassRegistry::getInstance()->enumInstances(afterLoadFont, "CBFontTT", NULL); - CSysClassRegistry::getInstance()->enumInstances(afterLoadScript, "CScScript", NULL); +bool BaseGame::initAfterLoad() { + SystemClassRegistry::getInstance()->enumInstances(afterLoadRegion, "BaseRegion", NULL); + SystemClassRegistry::getInstance()->enumInstances(afterLoadSubFrame, "BaseSubFrame", NULL); + SystemClassRegistry::getInstance()->enumInstances(afterLoadSound, "BaseSound", NULL); + SystemClassRegistry::getInstance()->enumInstances(afterLoadFont, "BaseFontTT", NULL); + SystemClassRegistry::getInstance()->enumInstances(afterLoadScript, "ScScript", NULL); _scEngine->refreshScriptBreakpoints(); @@ -3289,35 +3289,35 @@ bool CBGame::initAfterLoad() { } ////////////////////////////////////////////////////////////////////////// -void CBGame::afterLoadRegion(void *region, void *data) { - ((CBRegion *)region)->createRegion(); +void BaseGame::afterLoadRegion(void *region, void *data) { + ((BaseRegion *)region)->createRegion(); } ////////////////////////////////////////////////////////////////////////// -void CBGame::afterLoadSubFrame(void *subframe, void *data) { - ((CBSubFrame *)subframe)->setSurfaceSimple(); +void BaseGame::afterLoadSubFrame(void *subframe, void *data) { + ((BaseSubFrame *)subframe)->setSurfaceSimple(); } ////////////////////////////////////////////////////////////////////////// -void CBGame::afterLoadSound(void *sound, void *data) { - ((CBSound *)sound)->setSoundSimple(); +void BaseGame::afterLoadSound(void *sound, void *data) { + ((BaseSound *)sound)->setSoundSimple(); } ////////////////////////////////////////////////////////////////////////// -void CBGame::afterLoadFont(void *font, void *data) { - ((CBFont *)font)->afterLoad(); +void BaseGame::afterLoadFont(void *font, void *data) { + ((BaseFont *)font)->afterLoad(); } ////////////////////////////////////////////////////////////////////////// -void CBGame::afterLoadScript(void *script, void *data) { - ((CScScript *)script)->afterLoad(); +void BaseGame::afterLoadScript(void *script, void *data) { + ((ScScript *)script)->afterLoad(); } ////////////////////////////////////////////////////////////////////////// -bool CBGame::displayWindows(bool inGame) { +bool BaseGame::displayWindows(bool inGame) { bool res; // did we lose focus? focus topmost window @@ -3345,7 +3345,7 @@ bool CBGame::displayWindows(bool inGame) { ////////////////////////////////////////////////////////////////////////// -bool CBGame::playMusic(int channel, const char *filename, bool looping, uint32 loopStart) { +bool BaseGame::playMusic(int channel, const char *filename, bool looping, uint32 loopStart) { if (channel >= NUM_MUSIC_CHANNELS) { _gameRef->LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS); return STATUS_FAILED; @@ -3354,7 +3354,7 @@ bool CBGame::playMusic(int channel, const char *filename, bool looping, uint32 l delete _music[channel]; _music[channel] = NULL; - _music[channel] = new CBSound(_gameRef); + _music[channel] = new BaseSound(_gameRef); if (_music[channel] && DID_SUCCEED(_music[channel]->setSound(filename, Audio::Mixer::kMusicSoundType, true))) { if (_musicStartTime[channel]) { _music[channel]->setPositionTime(_musicStartTime[channel]); @@ -3371,7 +3371,7 @@ bool CBGame::playMusic(int channel, const char *filename, bool looping, uint32 l ////////////////////////////////////////////////////////////////////////// -bool CBGame::stopMusic(int channel) { +bool BaseGame::stopMusic(int channel) { if (channel >= NUM_MUSIC_CHANNELS) { _gameRef->LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS); return STATUS_FAILED; @@ -3387,7 +3387,7 @@ bool CBGame::stopMusic(int channel) { ////////////////////////////////////////////////////////////////////////// -bool CBGame::pauseMusic(int channel) { +bool BaseGame::pauseMusic(int channel) { if (channel >= NUM_MUSIC_CHANNELS) { _gameRef->LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS); return STATUS_FAILED; @@ -3399,7 +3399,7 @@ bool CBGame::pauseMusic(int channel) { ////////////////////////////////////////////////////////////////////////// -bool CBGame::resumeMusic(int channel) { +bool BaseGame::resumeMusic(int channel) { if (channel >= NUM_MUSIC_CHANNELS) { _gameRef->LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS); return STATUS_FAILED; @@ -3411,7 +3411,7 @@ bool CBGame::resumeMusic(int channel) { ////////////////////////////////////////////////////////////////////////// -bool CBGame::setMusicStartTime(int channel, uint32 time) { +bool BaseGame::setMusicStartTime(int channel, uint32 time) { if (channel >= NUM_MUSIC_CHANNELS) { _gameRef->LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS); return STATUS_FAILED; @@ -3424,7 +3424,7 @@ bool CBGame::setMusicStartTime(int channel, uint32 time) { ////////////////////////////////////////////////////////////////////////// -bool CBGame::loadSettings(const char *filename) { +bool BaseGame::loadSettings(const char *filename) { TOKEN_TABLE_START(commands) TOKEN_TABLE(SETTINGS) TOKEN_TABLE(GAME) @@ -3447,7 +3447,7 @@ bool CBGame::loadSettings(const char *filename) { byte *origBuffer = _gameRef->_fileManager->readWholeFile(filename); if (origBuffer == NULL) { - _gameRef->LOG(0, "CBGame::LoadSettings failed for file '%s'", filename); + _gameRef->LOG(0, "BaseGame::LoadSettings failed for file '%s'", filename); return STATUS_FAILED; } @@ -3456,7 +3456,7 @@ bool CBGame::loadSettings(const char *filename) { byte *buffer = origBuffer; byte *params; int cmd; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_SETTINGS) { _gameRef->LOG(0, "'SETTINGS' keyword expected in game settings file."); @@ -3520,7 +3520,7 @@ bool CBGame::loadSettings(const char *filename) { break; case TOKEN_SAVED_GAME_EXT: - CBUtils::setString(&_savedGameExt, (char *)params); + BaseUtils::setString(&_savedGameExt, (char *)params); break; case TOKEN_GUID: @@ -3547,11 +3547,11 @@ bool CBGame::loadSettings(const char *filename) { ////////////////////////////////////////////////////////////////////////// -bool CBGame::persist(CBPersistMgr *persistMgr) { +bool BaseGame::persist(BasePersistenceManager *persistMgr) { if (!persistMgr->_saving) cleanup(); - CBObject::persist(persistMgr); + BaseObject::persist(persistMgr); persistMgr->transfer(TMEMBER(_activeObject)); persistMgr->transfer(TMEMBER(_capturedObject)); @@ -3640,8 +3640,8 @@ bool CBGame::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -bool CBGame::focusWindow(CUIWindow *Window) { - CUIWindow *Prev = _focusedWindow; +bool BaseGame::focusWindow(UIWindow *Window) { + UIWindow *Prev = _focusedWindow; for (int i = 0; i < _windows.getSize(); i++) { if (_windows[i] == Window) { @@ -3662,7 +3662,7 @@ bool CBGame::focusWindow(CUIWindow *Window) { ////////////////////////////////////////////////////////////////////////// -bool CBGame::freeze(bool includingMusic) { +bool BaseGame::freeze(bool includingMusic) { if (_freezeLevel == 0) { _scEngine->pauseAll(); _soundMgr->pauseAll(includingMusic); @@ -3678,7 +3678,7 @@ bool CBGame::freeze(bool includingMusic) { ////////////////////////////////////////////////////////////////////////// -bool CBGame::unfreeze() { +bool BaseGame::unfreeze() { if (_freezeLevel == 0) return STATUS_OK; _freezeLevel--; @@ -3694,7 +3694,7 @@ bool CBGame::unfreeze() { ////////////////////////////////////////////////////////////////////////// -bool CBGame::handleKeypress(Common::Event *event, bool printable) { +bool BaseGame::handleKeypress(Common::Event *event, bool printable) { if (isVideoPlaying()) { if (event->kbd.keycode == Common::KEYCODE_ESCAPE) stopVideo(); @@ -3735,13 +3735,13 @@ bool CBGame::handleKeypress(Common::Event *event, bool printable) { return false; } -void CBGame::handleKeyRelease(Common::Event *event) { +void BaseGame::handleKeyRelease(Common::Event *event) { _keyboardState->handleKeyRelease(event); } ////////////////////////////////////////////////////////////////////////// -bool CBGame::handleMouseWheel(int Delta) { +bool BaseGame::handleMouseWheel(int Delta) { bool handled = false; if (_focusedWindow) { handled = _gameRef->_focusedWindow->handleMouseWheel(Delta); @@ -3771,7 +3771,7 @@ bool CBGame::handleMouseWheel(int Delta) { ////////////////////////////////////////////////////////////////////////// -bool CBGame::getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor) { +bool BaseGame::getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor) { if (verMajor) *verMajor = DCGF_VER_MAJOR; if (verMinor) *verMinor = DCGF_VER_MINOR; @@ -3783,7 +3783,7 @@ bool CBGame::getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *ex ////////////////////////////////////////////////////////////////////////// -void CBGame::setWindowTitle() { +void BaseGame::setWindowTitle() { if (_renderer) { char title[512]; strcpy(title, _caption[0]); @@ -3795,13 +3795,13 @@ void CBGame::setWindowTitle() { if (_textEncoding == TEXT_UTF8) { utf8Title = Utf8String(title); } else { - warning("CBGame::SetWindowTitle -Ignoring textencoding"); + warning("BaseGame::SetWindowTitle -Ignoring textencoding"); utf8Title = Utf8String(title); /* WideString wstr = StringUtil::AnsiToWide(Title); title = StringUtil::WideToUtf8(wstr);*/ } #if 0 - CBRenderOSystem *renderer = static_cast(_renderer); + BaseRenderOSystem *renderer = static_cast(_renderer); // TODO SDL_SetWindowTitle(renderer->GetSdlWindow(), title.c_str()); @@ -3811,10 +3811,10 @@ void CBGame::setWindowTitle() { ////////////////////////////////////////////////////////////////////////// -bool CBGame::getSaveSlotFilename(int slot, char *buffer) { +bool BaseGame::getSaveSlotFilename(int slot, char *buffer) { AnsiString dataDir = getDataDir(); //sprintf(Buffer, "%s/save%03d.%s", dataDir.c_str(), Slot, _savedGameExt); - CBPersistMgr *pm = new CBPersistMgr(_gameRef); + BasePersistenceManager *pm = new BasePersistenceManager(_gameRef); Common::String filename = pm->getFilenameForSlot(slot); delete pm; strcpy(buffer, filename.c_str()); @@ -3823,7 +3823,7 @@ bool CBGame::getSaveSlotFilename(int slot, char *buffer) { } ////////////////////////////////////////////////////////////////////////// -AnsiString CBGame::getDataDir() { +AnsiString BaseGame::getDataDir() { AnsiString userDir = PathUtil::getUserDirectory(); AnsiString baseDir = _registry->getBasePath(); return PathUtil::combine(userDir, baseDir); @@ -3831,12 +3831,12 @@ AnsiString CBGame::getDataDir() { ////////////////////////////////////////////////////////////////////////// -bool CBGame::getSaveSlotDescription(int slot, char *buffer) { +bool BaseGame::getSaveSlotDescription(int slot, char *buffer) { buffer[0] = '\0'; char filename[MAX_PATH_LENGTH + 1]; getSaveSlotFilename(slot, filename); - CBPersistMgr *pm = new CBPersistMgr(_gameRef); + BasePersistenceManager *pm = new BasePersistenceManager(_gameRef); if (!pm) return STATUS_FAILED; _debugAbsolutePathWarning = false; @@ -3855,11 +3855,11 @@ bool CBGame::getSaveSlotDescription(int slot, char *buffer) { ////////////////////////////////////////////////////////////////////////// -bool CBGame::isSaveSlotUsed(int slot) { +bool BaseGame::isSaveSlotUsed(int slot) { char filename[MAX_PATH_LENGTH + 1]; getSaveSlotFilename(slot, filename); - warning("CBGame::IsSaveSlotUsed(%d) - FIXME, ugly solution", slot); + warning("BaseGame::IsSaveSlotUsed(%d) - FIXME, ugly solution", slot); Common::SeekableReadStream *File = g_wintermute->getSaveFileMan()->openForLoading(filename); if (!File) return false; delete File; @@ -3868,10 +3868,10 @@ bool CBGame::isSaveSlotUsed(int slot) { ////////////////////////////////////////////////////////////////////////// -bool CBGame::emptySaveSlot(int slot) { +bool BaseGame::emptySaveSlot(int slot) { char filename[MAX_PATH_LENGTH + 1]; getSaveSlotFilename(slot, filename); - CBPersistMgr *pm = new CBPersistMgr(this); + BasePersistenceManager *pm = new BasePersistenceManager(this); g_wintermute->getSaveFileMan()->removeSavefile(pm->getFilenameForSlot(slot)); delete pm; return STATUS_OK; @@ -3879,7 +3879,7 @@ bool CBGame::emptySaveSlot(int slot) { ////////////////////////////////////////////////////////////////////////// -bool CBGame::setActiveObject(CBObject *obj) { +bool BaseGame::setActiveObject(BaseObject *obj) { // not-active when game is frozen if (obj && !_gameRef->_interactive && !obj->_nonIntMouseEvents) { obj = NULL; @@ -3899,7 +3899,7 @@ bool CBGame::setActiveObject(CBObject *obj) { ////////////////////////////////////////////////////////////////////////// -bool CBGame::pushViewport(CBViewport *viewport) { +bool BaseGame::pushViewport(BaseViewport *viewport) { _viewportSP++; if (_viewportSP >= _viewportStack.getSize()) _viewportStack.add(viewport); else _viewportStack[_viewportSP] = viewport; @@ -3911,7 +3911,7 @@ bool CBGame::pushViewport(CBViewport *viewport) { ////////////////////////////////////////////////////////////////////////// -bool CBGame::popViewport() { +bool BaseGame::popViewport() { _viewportSP--; if (_viewportSP < -1) _gameRef->LOG(0, "Fatal: Viewport stack underflow!"); @@ -3926,14 +3926,14 @@ bool CBGame::popViewport() { ////////////////////////////////////////////////////////////////////////// -bool CBGame::getCurrentViewportRect(Rect32 *rect, bool *custom) { +bool BaseGame::getCurrentViewportRect(Rect32 *rect, bool *custom) { if (rect == NULL) return STATUS_FAILED; else { if (_viewportSP >= 0) { - CBPlatform::copyRect(rect, _viewportStack[_viewportSP]->getRect()); + BasePlatform::copyRect(rect, _viewportStack[_viewportSP]->getRect()); if (custom) *custom = true; } else { - CBPlatform::setRect(rect, _renderer->_drawOffsetX, + BasePlatform::setRect(rect, _renderer->_drawOffsetX, _renderer->_drawOffsetY, _renderer->_width + _renderer->_drawOffsetX, _renderer->_height + _renderer->_drawOffsetY); @@ -3946,7 +3946,7 @@ bool CBGame::getCurrentViewportRect(Rect32 *rect, bool *custom) { ////////////////////////////////////////////////////////////////////////// -bool CBGame::getCurrentViewportOffset(int *offsetX, int *offsetY) { +bool BaseGame::getCurrentViewportOffset(int *offsetX, int *offsetY) { if (_viewportSP >= 0) { if (offsetX) *offsetX = _viewportStack[_viewportSP]->_offsetX; if (offsetY) *offsetY = _viewportStack[_viewportSP]->_offsetY; @@ -3960,42 +3960,42 @@ bool CBGame::getCurrentViewportOffset(int *offsetX, int *offsetY) { ////////////////////////////////////////////////////////////////////////// -bool CBGame::windowLoadHook(CUIWindow *win, char **buf, char **params) { +bool BaseGame::windowLoadHook(UIWindow *win, char **buf, char **params) { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -bool CBGame::windowScriptMethodHook(CUIWindow *win, CScScript *script, CScStack *stack, const char *name) { +bool BaseGame::windowScriptMethodHook(UIWindow *win, ScScript *script, ScStack *stack, const char *name) { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -void CBGame::setInteractive(bool state) { +void BaseGame::setInteractive(bool state) { _interactive = state; if (_transMgr) _transMgr->_origInteractive = state; } ////////////////////////////////////////////////////////////////////////// -void CBGame::resetMousePos() { +void BaseGame::resetMousePos() { Common::Point p; p.x = _mousePos.x + _renderer->_drawOffsetX; p.y = _mousePos.y + _renderer->_drawOffsetY; - CBPlatform::setCursorPos(p.x, p.y); + BasePlatform::setCursorPos(p.x, p.y); } ////////////////////////////////////////////////////////////////////////// -bool CBGame::displayContent(bool doUpdate, bool displayAll) { +bool BaseGame::displayContent(bool doUpdate, bool displayAll) { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CBGame::displayContentSimple() { +bool BaseGame::displayContentSimple() { // fill black _renderer->fill(0, 0, 0); if (_indicatorDisplay) displayIndicator(); @@ -4005,10 +4005,10 @@ bool CBGame::displayContentSimple() { ////////////////////////////////////////////////////////////////////////// -bool CBGame::displayIndicator() { +bool BaseGame::displayIndicator() { if (_saveLoadImage) { Rect32 rc; - CBPlatform::setRect(&rc, 0, 0, _saveLoadImage->getWidth(), _saveLoadImage->getHeight()); + BasePlatform::setRect(&rc, 0, 0, _saveLoadImage->getWidth(), _saveLoadImage->getHeight()); if (_loadInProgress) _saveLoadImage->displayTrans(_loadImageX, _loadImageY, rc); else _saveLoadImage->displayTrans(_saveImageX, _saveImageY, rc); } @@ -4023,7 +4023,7 @@ bool CBGame::displayIndicator() { } ////////////////////////////////////////////////////////////////////////// -bool CBGame::updateMusicCrossfade() { +bool BaseGame::updateMusicCrossfade() { /* byte GlobMusicVol = _soundMgr->getVolumePercent(SOUND_MUSIC); */ if (!_musicCrossfadeRunning) return STATUS_OK; @@ -4055,7 +4055,7 @@ bool CBGame::updateMusicCrossfade() { if (_musicCrossfadeSwap) { // swap channels - CBSound *dummy = _music[_musicCrossfadeChannel1]; + BaseSound *dummy = _music[_musicCrossfadeChannel1]; int dummyInt = _musicStartTime[_musicCrossfadeChannel1]; _music[_musicCrossfadeChannel1] = _music[_musicCrossfadeChannel2]; @@ -4078,7 +4078,7 @@ bool CBGame::updateMusicCrossfade() { ////////////////////////////////////////////////////////////////////////// -bool CBGame::resetContent() { +bool BaseGame::resetContent() { _scEngine->clearGlobals(); //_timer = 0; //_liveTimer = 0; @@ -4087,12 +4087,12 @@ bool CBGame::resetContent() { } ////////////////////////////////////////////////////////////////////////// -void CBGame::DEBUG_DumpClassRegistry() { +void BaseGame::DEBUG_DumpClassRegistry() { warning("DEBUG_DumpClassRegistry - untested"); Common::DumpFile *f = new Common::DumpFile; f->open("zz_class_reg_dump.log"); - CSysClassRegistry::getInstance()->dumpClasses(f); + SystemClassRegistry::getInstance()->dumpClasses(f); f->close(); delete f; @@ -4101,7 +4101,7 @@ void CBGame::DEBUG_DumpClassRegistry() { ////////////////////////////////////////////////////////////////////////// -bool CBGame::invalidateDeviceObjects() { +bool BaseGame::invalidateDeviceObjects() { for (int i = 0; i < _regObjects.getSize(); i++) { _regObjects[i]->invalidateDeviceObjects(); } @@ -4110,7 +4110,7 @@ bool CBGame::invalidateDeviceObjects() { ////////////////////////////////////////////////////////////////////////// -bool CBGame::restoreDeviceObjects() { +bool BaseGame::restoreDeviceObjects() { for (int i = 0; i < _regObjects.getSize(); i++) { _regObjects[i]->restoreDeviceObjects(); } @@ -4118,11 +4118,11 @@ bool CBGame::restoreDeviceObjects() { } ////////////////////////////////////////////////////////////////////////// -bool CBGame::setWaitCursor(const char *filename) { +bool BaseGame::setWaitCursor(const char *filename) { delete _cursorNoninteractive; _cursorNoninteractive = NULL; - _cursorNoninteractive = new CBSprite(_gameRef); + _cursorNoninteractive = new BaseSprite(_gameRef); if (!_cursorNoninteractive || DID_FAIL(_cursorNoninteractive->loadFile(filename))) { delete _cursorNoninteractive; _cursorNoninteractive = NULL; @@ -4131,14 +4131,14 @@ bool CBGame::setWaitCursor(const char *filename) { } ////////////////////////////////////////////////////////////////////////// -bool CBGame::isVideoPlaying() { +bool BaseGame::isVideoPlaying() { if (_videoPlayer->isPlaying()) return true; if (_theoraPlayer && _theoraPlayer->isPlaying()) return true; return false; } ////////////////////////////////////////////////////////////////////////// -bool CBGame::stopVideo() { +bool BaseGame::stopVideo() { if (_videoPlayer->isPlaying()) _videoPlayer->stop(); if (_theoraPlayer && _theoraPlayer->isPlaying()) { _theoraPlayer->stop(); @@ -4150,7 +4150,7 @@ bool CBGame::stopVideo() { ////////////////////////////////////////////////////////////////////////// -bool CBGame::drawCursor(CBSprite *cursor) { +bool BaseGame::drawCursor(BaseSprite *cursor) { if (!cursor) return STATUS_FAILED; if (cursor != _lastCursor) { cursor->reset(); @@ -4162,7 +4162,7 @@ bool CBGame::drawCursor(CBSprite *cursor) { ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// -bool CBGame::onActivate(bool activate, bool refreshMouse) { +bool BaseGame::onActivate(bool activate, bool refreshMouse) { if (_shuttingDown || !_renderer) return STATUS_OK; _renderer->_active = activate; @@ -4180,7 +4180,7 @@ bool CBGame::onActivate(bool activate, bool refreshMouse) { } ////////////////////////////////////////////////////////////////////////// -bool CBGame::onMouseLeftDown() { +bool BaseGame::onMouseLeftDown() { if (_activeObject) _activeObject->handleMouse(MOUSE_CLICK, MOUSE_BUTTON_LEFT); bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("LeftClick")); @@ -4192,16 +4192,16 @@ bool CBGame::onMouseLeftDown() { if (_activeObject != NULL) _capturedObject = _activeObject; _mouseLeftDown = true; - CBPlatform::setCapture(/*_renderer->_window*/); + BasePlatform::setCapture(/*_renderer->_window*/); return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CBGame::onMouseLeftUp() { +bool BaseGame::onMouseLeftUp() { if (_activeObject) _activeObject->handleMouse(MOUSE_RELEASE, MOUSE_BUTTON_LEFT); - CBPlatform::releaseCapture(); + BasePlatform::releaseCapture(); _capturedObject = NULL; _mouseLeftDown = false; @@ -4215,7 +4215,7 @@ bool CBGame::onMouseLeftUp() { } ////////////////////////////////////////////////////////////////////////// -bool CBGame::onMouseLeftDblClick() { +bool BaseGame::onMouseLeftDblClick() { if (_state == GAME_RUNNING && !_interactive) return STATUS_OK; if (_activeObject) _activeObject->handleMouse(MOUSE_DBLCLICK, MOUSE_BUTTON_LEFT); @@ -4230,7 +4230,7 @@ bool CBGame::onMouseLeftDblClick() { } ////////////////////////////////////////////////////////////////////////// -bool CBGame::onMouseRightDblClick() { +bool BaseGame::onMouseRightDblClick() { if (_state == GAME_RUNNING && !_interactive) return STATUS_OK; if (_activeObject) _activeObject->handleMouse(MOUSE_DBLCLICK, MOUSE_BUTTON_RIGHT); @@ -4245,7 +4245,7 @@ bool CBGame::onMouseRightDblClick() { } ////////////////////////////////////////////////////////////////////////// -bool CBGame::onMouseRightDown() { +bool BaseGame::onMouseRightDown() { if (_activeObject) _activeObject->handleMouse(MOUSE_CLICK, MOUSE_BUTTON_RIGHT); bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("RightClick")); @@ -4258,7 +4258,7 @@ bool CBGame::onMouseRightDown() { } ////////////////////////////////////////////////////////////////////////// -bool CBGame::onMouseRightUp() { +bool BaseGame::onMouseRightUp() { if (_activeObject) _activeObject->handleMouse(MOUSE_RELEASE, MOUSE_BUTTON_RIGHT); bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("RightRelease")); @@ -4271,7 +4271,7 @@ bool CBGame::onMouseRightUp() { } ////////////////////////////////////////////////////////////////////////// -bool CBGame::onMouseMiddleDown() { +bool BaseGame::onMouseMiddleDown() { if (_state == GAME_RUNNING && !_interactive) return STATUS_OK; if (_activeObject) _activeObject->handleMouse(MOUSE_CLICK, MOUSE_BUTTON_MIDDLE); @@ -4286,7 +4286,7 @@ bool CBGame::onMouseMiddleDown() { } ////////////////////////////////////////////////////////////////////////// -bool CBGame::onMouseMiddleUp() { +bool BaseGame::onMouseMiddleUp() { if (_activeObject) _activeObject->handleMouse(MOUSE_RELEASE, MOUSE_BUTTON_MIDDLE); bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("MiddleRelease")); @@ -4299,7 +4299,7 @@ bool CBGame::onMouseMiddleUp() { } ////////////////////////////////////////////////////////////////////////// -bool CBGame::onPaint() { +bool BaseGame::onPaint() { if (_renderer && _renderer->_windowed && _renderer->_ready) { _renderer->initLoop(); displayContent(false, true); @@ -4310,7 +4310,7 @@ bool CBGame::onPaint() { } ////////////////////////////////////////////////////////////////////////// -bool CBGame::onWindowClose() { +bool BaseGame::onWindowClose() { if (canHandleEvent("QuitGame")) { if (_state != GAME_FROZEN) _gameRef->applyEvent("QuitGame"); return STATUS_OK; @@ -4318,7 +4318,7 @@ bool CBGame::onWindowClose() { } ////////////////////////////////////////////////////////////////////////// -bool CBGame::displayDebugInfo() { +bool BaseGame::displayDebugInfo() { char str[100]; if (_debugShowFPS) { @@ -4359,15 +4359,15 @@ bool CBGame::displayDebugInfo() { } ////////////////////////////////////////////////////////////////////////// -CBDebugger *CBGame::getDebugMgr() { - if (!_debugMgr) _debugMgr = new CBDebugger(this); +BaseDebugger *BaseGame::getDebugMgr() { + if (!_debugMgr) _debugMgr = new BaseDebugger(this); return _debugMgr; } ////////////////////////////////////////////////////////////////////////// -void CBGame::getMousePos(Point32 *pos) { - CBPlatform::getCursorPos(pos); +void BaseGame::getMousePos(Point32 *pos) { + BasePlatform::getCursorPos(pos); pos->x -= _renderer->_drawOffsetX; pos->y -= _renderer->_drawOffsetY; @@ -4386,7 +4386,7 @@ void CBGame::getMousePos(Point32 *pos) { */ if (_mouseLockRect.left != 0 && _mouseLockRect.right != 0 && _mouseLockRect.top != 0 && _mouseLockRect.bottom != 0) { - if (!CBPlatform::ptInRect(&_mouseLockRect, *pos)) { + if (!BasePlatform::ptInRect(&_mouseLockRect, *pos)) { pos->x = MAX(_mouseLockRect.left, pos->x); pos->y = MAX(_mouseLockRect.top, pos->y); @@ -4398,52 +4398,52 @@ void CBGame::getMousePos(Point32 *pos) { newPos.x += _renderer->_drawOffsetX; newPos.y += _renderer->_drawOffsetY; - CBPlatform::setCursorPos(newPos.x, newPos.y); + BasePlatform::setCursorPos(newPos.x, newPos.y); } } } ////////////////////////////////////////////////////////////////////////// -bool CBGame::miniUpdate() { +bool BaseGame::miniUpdate() { if (!_miniUpdateEnabled) return STATUS_OK; - if (CBPlatform::getTime() - _lastMiniUpdate > 200) { + if (BasePlatform::getTime() - _lastMiniUpdate > 200) { if (_soundMgr) _soundMgr->initLoop(); - _lastMiniUpdate = CBPlatform::getTime(); + _lastMiniUpdate = BasePlatform::getTime(); } return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CBGame::onScriptShutdown(CScScript *script) { +bool BaseGame::onScriptShutdown(ScScript *script) { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CBGame::isLeftDoubleClick() { +bool BaseGame::isLeftDoubleClick() { return isDoubleClick(0); } ////////////////////////////////////////////////////////////////////////// -bool CBGame::isRightDoubleClick() { +bool BaseGame::isRightDoubleClick() { return isDoubleClick(1); } ////////////////////////////////////////////////////////////////////////// -bool CBGame::isDoubleClick(int buttonIndex) { +bool BaseGame::isDoubleClick(int buttonIndex) { uint32 maxDoubleCLickTime = 500; int maxMoveX = 4; int maxMoveY = 4; Point32 pos; - CBPlatform::getCursorPos(&pos); + BasePlatform::getCursorPos(&pos); int moveX = abs(pos.x - _lastClick[buttonIndex].posX); int moveY = abs(pos.y - _lastClick[buttonIndex].posY); - if (_lastClick[buttonIndex].time == 0 || CBPlatform::getTime() - _lastClick[buttonIndex].time > maxDoubleCLickTime || moveX > maxMoveX || moveY > maxMoveY) { - _lastClick[buttonIndex].time = CBPlatform::getTime(); + if (_lastClick[buttonIndex].time == 0 || BasePlatform::getTime() - _lastClick[buttonIndex].time > maxDoubleCLickTime || moveX > maxMoveX || moveY > maxMoveY) { + _lastClick[buttonIndex].time = BasePlatform::getTime(); _lastClick[buttonIndex].posX = pos.x; _lastClick[buttonIndex].posY = pos.y; return false; @@ -4454,7 +4454,7 @@ bool CBGame::isDoubleClick(int buttonIndex) { } ////////////////////////////////////////////////////////////////////////// -void CBGame::autoSaveOnExit() { +void BaseGame::autoSaveOnExit() { _soundMgr->saveSettings(); _registry->saveValues(); @@ -4465,12 +4465,12 @@ void CBGame::autoSaveOnExit() { } ////////////////////////////////////////////////////////////////////////// -void CBGame::addMem(int bytes) { +void BaseGame::addMem(int bytes) { _usedMem += bytes; } ////////////////////////////////////////////////////////////////////////// -AnsiString CBGame::getDeviceType() const { +AnsiString BaseGame::getDeviceType() const { return "computer"; } diff --git a/engines/wintermute/base/base_game.h b/engines/wintermute/base/base_game.h index 711eebfc98..77fa6b3a8b 100644 --- a/engines/wintermute/base/base_game.h +++ b/engines/wintermute/base/base_game.h @@ -41,33 +41,33 @@ namespace WinterMute { typedef void (*ENGINE_LOG_CALLBACK)(char *Text, bool Result, void *Data); -class CBSoundMgr; -class CBFader; -class CBFont; -class CBFileManager; -class CBTransitionMgr; -class CScEngine; -class CBFontStorage; -class CBStringTable; -class CBQuickMsg; -class CUIWindow; -class CBViewport; -class CBRenderer; -class CBRegistry; -class CBSaveThumbHelper; -class CBSurfaceStorage; -class CSXMath; -class CBKeyboardState; -class CVidPlayer; -class CVidTheoraPlayer; +class BaseSoundMgr; +class BaseFader; +class BaseFont; +class BaseFileManager; +class BaseTransitionMgr; +class ScEngine; +class BaseFontStorage; +class BaseStringTable; +class BaseQuickMsg; +class UIWindow; +class BaseViewport; +class BaseRenderer; +class BaseRegistry; +class BaseSaveThumbHelper; +class BaseSurfaceStorage; +class SXMath; +class BaseKeyboardState; +class VideoPlayer; +class VideoTheoraPlayer; #define NUM_MUSIC_CHANNELS 5 -class CBGame: public CBObject { +class BaseGame: public BaseObject { public: - DECLARE_PERSISTENT(CBGame, CBObject) + DECLARE_PERSISTENT(BaseGame, BaseObject) - virtual bool onScriptShutdown(CScScript *script); + virtual bool onScriptShutdown(ScScript *script); virtual bool onActivate(bool activate, bool refreshMouse); virtual bool onMouseLeftDown(); @@ -105,7 +105,7 @@ public: TTextEncoding _textEncoding; bool _textRTL; - CBSprite *_loadingIcon; + BaseSprite *_loadingIcon; int _loadingIconX; int _loadingIconY; int _loadingIconPersistent; @@ -136,7 +136,7 @@ protected: int _loadImageX; int _loadImageY; - CBSurface *_saveLoadImage; + BaseSurface *_saveLoadImage; bool displayIndicator(); bool _reportTextureFormat; @@ -157,32 +157,32 @@ public: int _offsetX; float _offsetPercentX; float _offsetPercentY; - CBObject *_mainObject; + BaseObject *_mainObject; bool initInput(); bool initLoop(); uint32 _currentTime; uint32 _deltaTime; - CBFont *_systemFont; - CBFont *_videoFont; + BaseFont *_systemFont; + BaseFont *_videoFont; bool initialize1(); bool initialize2(); bool initialize3(); - CBFileManager *_fileManager; - CBTransitionMgr *_transMgr; - CBDebugger *getDebugMgr(); + BaseFileManager *_fileManager; + BaseTransitionMgr *_transMgr; + BaseDebugger *getDebugMgr(); void LOG(bool res, const char *fmt, ...); - CBRenderer *_renderer; - CBSoundMgr *_soundMgr; - CScEngine *_scEngine; - CSXMath *_mathClass; - CBSurfaceStorage *_surfaceStorage; - CBFontStorage *_fontStorage; - CBGame(); + BaseRenderer *_renderer; + BaseSoundMgr *_soundMgr; + ScEngine *_scEngine; + SXMath *_mathClass; + BaseSurfaceStorage *_surfaceStorage; + BaseFontStorage *_fontStorage; + BaseGame(); - virtual ~CBGame(); + virtual ~BaseGame(); void DEBUG_DebugDisable(); void DEBUG_DebugEnable(const char *filename = NULL); bool _debugDebugMode; @@ -192,13 +192,13 @@ public: int _sequence; virtual bool loadFile(const char *filename); virtual bool loadBuffer(byte *buffer, bool complete = true); - CBArray _quickMessages; - CBArray _windows; - CBArray _viewportStack; + BaseArray _quickMessages; + BaseArray _windows; + BaseArray _viewportStack; int _viewportSP; - CBStringTable *_stringTable; + BaseStringTable *_stringTable; int _settingsResWidth; int _settingsResHeight; char *_settingsGameFile; @@ -215,15 +215,15 @@ protected: bool _settingsRequireSound; bool _settingsAllowDesktopRes; int _settingsTLMode; - CBFader *_fader; + BaseFader *_fader; virtual bool invalidateDeviceObjects(); virtual bool restoreDeviceObjects(); public: - virtual bool ExternalCall(CScScript *script, CScStack *stack, CScStack *thisStack, char *name); + virtual bool ExternalCall(ScScript *script, ScStack *stack, ScStack *thisStack, char *name); // scripting interface - virtual CScValue *scGetProperty(const char *name); - virtual bool scSetProperty(const char *name, CScValue *value); - virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual ScValue *scGetProperty(const char *name); + virtual bool scSetProperty(const char *name, ScValue *value); + virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); virtual const char *scToString(); // compatibility bits bool _compatKillMethodThreads; @@ -262,11 +262,11 @@ protected: public: bool unfreeze(); bool freeze(bool includingMusic = true); - bool focusWindow(CUIWindow *window); - CVidPlayer *_videoPlayer; - CVidTheoraPlayer *_theoraPlayer; + bool focusWindow(UIWindow *window); + VideoPlayer *_videoPlayer; + VideoTheoraPlayer *_theoraPlayer; bool _loadInProgress; - CUIWindow *_focusedWindow; + UIWindow *_focusedWindow; bool _editorForceScripts; protected: static void afterLoadRegion(void *region, void *data); @@ -283,7 +283,7 @@ public: bool pauseMusic(int channel); bool stopMusic(int channel); bool playMusic(int channel, const char *filename, bool looping = true, uint32 loopStart = 0); - CBSound *_music[NUM_MUSIC_CHANNELS]; + BaseSound *_music[NUM_MUSIC_CHANNELS]; bool _musicCrossfadeRunning; bool _musicCrossfadeSwap; uint32 _musicCrossfadeStartTime; @@ -291,7 +291,7 @@ public: int _musicCrossfadeChannel1; int _musicCrossfadeChannel2; bool displayWindows(bool inGame = false); - CBRegistry *_registry; + BaseRegistry *_registry; bool _useD3D; virtual bool cleanup(); virtual bool loadGame(int slot); @@ -299,9 +299,9 @@ public: virtual bool SaveGame(int slot, const char *desc, bool quickSave = false); virtual bool showCursor(); - CBSprite *_cursorNoninteractive; - CBObject *_activeObject; - CBKeyboardState *_keyboardState; + BaseSprite *_cursorNoninteractive; + BaseObject *_activeObject; + BaseKeyboardState *_keyboardState; bool _interactive; TGameState _state; TGameState _origState; @@ -314,11 +314,11 @@ public: uint32 _liveTimerDelta; uint32 _liveTimerLast; - CBObject *_capturedObject; + BaseObject *_capturedObject; Point32 _mousePos; - bool validObject(CBObject *object); - bool unregisterObject(CBObject *object); - bool registerObject(CBObject *object); + bool validObject(BaseObject *object); + bool unregisterObject(BaseObject *object); + bool registerObject(BaseObject *object); void quickMessage(const char *text); void quickMessageForm(char *fmt, ...); bool displayQuickMsg(); @@ -328,7 +328,7 @@ public: bool isVideoPlaying(); bool stopVideo(); - CBArray _regObjects; + BaseArray _regObjects; public: virtual bool displayContent(bool update = true, bool displayAll = false); virtual bool displayContentSimple(); @@ -336,18 +336,18 @@ public: void resetMousePos(); int _subtitlesSpeed; void setInteractive(bool state); - virtual bool windowLoadHook(CUIWindow *win, char **buf, char **params); - virtual bool windowScriptMethodHook(CUIWindow *win, CScScript *script, CScStack *stack, const char *name); + virtual bool windowLoadHook(UIWindow *win, char **buf, char **params); + virtual bool windowScriptMethodHook(UIWindow *win, ScScript *script, ScStack *stack, const char *name); bool getCurrentViewportOffset(int *offsetX = NULL, int *offsetY = NULL); bool getCurrentViewportRect(Rect32 *rect, bool *custom = NULL); bool popViewport(); - bool pushViewport(CBViewport *Viewport); - bool setActiveObject(CBObject *Obj); - CBSprite *_lastCursor; - bool drawCursor(CBSprite *Cursor); + bool pushViewport(BaseViewport *Viewport); + bool setActiveObject(BaseObject *Obj); + BaseSprite *_lastCursor; + bool drawCursor(BaseSprite *Cursor); virtual bool initAfterLoad(); - CBSaveThumbHelper *_cachedThumbnail; + BaseSaveThumbHelper *_cachedThumbnail; AnsiString getDataDir(); void addMem(int bytes); @@ -356,7 +356,7 @@ public: AnsiString getDeviceType() const; private: - CBDebugger *_debugMgr; + BaseDebugger *_debugMgr; struct LastClickInfo { LastClickInfo() { diff --git a/engines/wintermute/base/base_keyboard_state.cpp b/engines/wintermute/base/base_keyboard_state.cpp index 240f642b7f..ad014762d4 100644 --- a/engines/wintermute/base/base_keyboard_state.cpp +++ b/engines/wintermute/base/base_keyboard_state.cpp @@ -35,10 +35,10 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CBKeyboardState, false) +IMPLEMENT_PERSISTENT(BaseKeyboardState, false) ////////////////////////////////////////////////////////////////////////// -CBKeyboardState::CBKeyboardState(CBGame *inGame): CBScriptable(inGame) { +BaseKeyboardState::BaseKeyboardState(BaseGame *inGame): BaseScriptable(inGame) { _currentPrintable = false; _currentCharCode = 0; _currentKeyData = 0; @@ -54,17 +54,17 @@ CBKeyboardState::CBKeyboardState(CBGame *inGame): CBScriptable(inGame) { } ////////////////////////////////////////////////////////////////////////// -CBKeyboardState::~CBKeyboardState() { +BaseKeyboardState::~BaseKeyboardState() { delete[] _keyStates; } -void CBKeyboardState::handleKeyPress(Common::Event *event) { +void BaseKeyboardState::handleKeyPress(Common::Event *event) { if (event->type == Common::EVENT_KEYDOWN) { _keyStates[event->kbd.keycode] = true; } } -void CBKeyboardState::handleKeyRelease(Common::Event *event) { +void BaseKeyboardState::handleKeyRelease(Common::Event *event) { if (event->type == Common::EVENT_KEYUP) { _keyStates[event->kbd.keycode] = false; } @@ -73,13 +73,13 @@ void CBKeyboardState::handleKeyRelease(Common::Event *event) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -bool CBKeyboardState::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool BaseKeyboardState::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // IsKeyDown ////////////////////////////////////////////////////////////////////////// if (strcmp(name, "IsKeyDown") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); int vKey; if (val->_type == VAL_STRING && strlen(val->getString()) > 0) { @@ -98,12 +98,12 @@ bool CBKeyboardState::scCallMethod(CScScript *script, CScStack *stack, CScStack return STATUS_OK; } - else return CBScriptable::scCallMethod(script, stack, thisStack, name); + else return BaseScriptable::scCallMethod(script, stack, thisStack, name); } ////////////////////////////////////////////////////////////////////////// -CScValue *CBKeyboardState::scGetProperty(const char *name) { +ScValue *BaseKeyboardState::scGetProperty(const char *name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// @@ -168,12 +168,12 @@ CScValue *CBKeyboardState::scGetProperty(const char *name) { return _scValue; } - else return CBScriptable::scGetProperty(name); + else return BaseScriptable::scGetProperty(name); } ////////////////////////////////////////////////////////////////////////// -bool CBKeyboardState::scSetProperty(const char *name, CScValue *value) { +bool BaseKeyboardState::scSetProperty(const char *name, ScValue *value) { /* ////////////////////////////////////////////////////////////////////////// // Name @@ -184,18 +184,18 @@ bool CBKeyboardState::scSetProperty(const char *name, CScValue *value) { return STATUS_OK; } - else*/ return CBScriptable::scSetProperty(name, value); + else*/ return BaseScriptable::scSetProperty(name, value); } ////////////////////////////////////////////////////////////////////////// -const char *CBKeyboardState::scToString() { +const char *BaseKeyboardState::scToString() { return "[keyboard state]"; } ////////////////////////////////////////////////////////////////////////// -bool CBKeyboardState::readKey(Common::Event *event) { +bool BaseKeyboardState::readKey(Common::Event *event) { //_currentPrintable = (event->type == SDL_TEXTINPUT); // TODO _currentCharCode = keyCodeToVKey(event); if ((_currentCharCode <= Common::KEYCODE_z && _currentCharCode >= Common::KEYCODE_a) || @@ -215,9 +215,9 @@ bool CBKeyboardState::readKey(Common::Event *event) { ////////////////////////////////////////////////////////////////////////// -bool CBKeyboardState::persist(CBPersistMgr *persistMgr) { +bool BaseKeyboardState::persist(BasePersistenceManager *persistMgr) { //if(!persistMgr->_saving) cleanup(); - CBScriptable::persist(persistMgr); + BaseScriptable::persist(persistMgr); persistMgr->transfer(TMEMBER(_currentAlt)); persistMgr->transfer(TMEMBER(_currentCharCode)); @@ -237,25 +237,25 @@ bool CBKeyboardState::persist(CBPersistMgr *persistMgr) { } ////////////////////////////////////////////////////////////////////////// -bool CBKeyboardState::isShiftDown() { +bool BaseKeyboardState::isShiftDown() { int mod = g_system->getEventManager()->getModifierState(); return (mod & Common::KBD_SHIFT); } ////////////////////////////////////////////////////////////////////////// -bool CBKeyboardState::isControlDown() { +bool BaseKeyboardState::isControlDown() { int mod = g_system->getEventManager()->getModifierState(); return (mod & Common::KBD_CTRL); } ////////////////////////////////////////////////////////////////////////// -bool CBKeyboardState::isAltDown() { +bool BaseKeyboardState::isAltDown() { int mod = g_system->getEventManager()->getModifierState(); return (mod & Common::KBD_ALT); } ////////////////////////////////////////////////////////////////////////// -uint32 CBKeyboardState::keyCodeToVKey(Common::Event *event) { +uint32 BaseKeyboardState::keyCodeToVKey(Common::Event *event) { if (event->type != Common::EVENT_KEYDOWN) return 0; switch (event->kbd.keycode) { @@ -275,7 +275,7 @@ enum VKeyCodes { }; ////////////////////////////////////////////////////////////////////////// -Common::KeyCode CBKeyboardState::vKeyToKeyCode(uint32 vkey) { +Common::KeyCode BaseKeyboardState::vKeyToKeyCode(uint32 vkey) { // todo switch (vkey) { case VK_SPACE: diff --git a/engines/wintermute/base/base_keyboard_state.h b/engines/wintermute/base/base_keyboard_state.h index bdf268c601..8c4b1afb59 100644 --- a/engines/wintermute/base/base_keyboard_state.h +++ b/engines/wintermute/base/base_keyboard_state.h @@ -37,7 +37,7 @@ namespace WinterMute { -class CBKeyboardState : public CBScriptable { +class BaseKeyboardState : public BaseScriptable { public: uint32 _currentKeyData; uint32 _currentCharCode; @@ -47,9 +47,9 @@ public: bool _currentAlt; bool _currentControl; - DECLARE_PERSISTENT(CBKeyboardState, CBScriptable) - CBKeyboardState(CBGame *inGame); - virtual ~CBKeyboardState(); + DECLARE_PERSISTENT(BaseKeyboardState, BaseScriptable) + BaseKeyboardState(BaseGame *inGame); + virtual ~BaseKeyboardState(); bool readKey(Common::Event *event); void handleKeyPress(Common::Event *event); @@ -59,9 +59,9 @@ public: static bool isAltDown(); // scripting interface - virtual CScValue *scGetProperty(const char *name); - virtual bool scSetProperty(const char *name, CScValue *value); - virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual ScValue *scGetProperty(const char *name); + virtual bool scSetProperty(const char *name, ScValue *value); + virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); virtual const char *scToString(); private: diff --git a/engines/wintermute/base/base_named_object.cpp b/engines/wintermute/base/base_named_object.cpp index da76fb2047..97b9f53353 100644 --- a/engines/wintermute/base/base_named_object.cpp +++ b/engines/wintermute/base/base_named_object.cpp @@ -32,30 +32,30 @@ namespace WinterMute { ////////////////////////////////////////////////////////////////////////// -CBNamedObject::CBNamedObject(CBGame *inGame) : CBBase(inGame) { +BaseNamedObject::BaseNamedObject(BaseGame *inGame) : BaseClass(inGame) { _name = NULL; } ////////////////////////////////////////////////////////////////////////// -CBNamedObject::CBNamedObject() : CBBase() { +BaseNamedObject::BaseNamedObject() : BaseClass() { _name = NULL; } ////////////////////////////////////////////////////////////////////////// -CBNamedObject::CBNamedObject(TDynamicConstructor, TDynamicConstructor) { +BaseNamedObject::BaseNamedObject(TDynamicConstructor, TDynamicConstructor) { _name = NULL; } ////////////////////////////////////////////////////////////////////////// -CBNamedObject::~CBNamedObject(void) { +BaseNamedObject::~BaseNamedObject(void) { delete[] _name; _name = NULL; } ////////////////////////////////////////////////////////////////////// -void CBNamedObject::setName(const char *name) { +void BaseNamedObject::setName(const char *name) { delete[] _name; _name = new char [strlen(name) + 1]; diff --git a/engines/wintermute/base/base_named_object.h b/engines/wintermute/base/base_named_object.h index c03d1417a3..f7b496ead8 100644 --- a/engines/wintermute/base/base_named_object.h +++ b/engines/wintermute/base/base_named_object.h @@ -34,12 +34,12 @@ namespace WinterMute { -class CBNamedObject : public CBBase { +class BaseNamedObject : public BaseClass { public: - CBNamedObject(CBGame *inGame); - CBNamedObject(); - virtual ~CBNamedObject(void); - CBNamedObject(TDynamicConstructor, TDynamicConstructor); + BaseNamedObject(BaseGame *inGame); + BaseNamedObject(); + virtual ~BaseNamedObject(void); + BaseNamedObject(TDynamicConstructor, TDynamicConstructor); char *_name; void setName(const char *name); diff --git a/engines/wintermute/base/base_object.cpp b/engines/wintermute/base/base_object.cpp index 0a4a0638f0..4ab121ded9 100644 --- a/engines/wintermute/base/base_object.cpp +++ b/engines/wintermute/base/base_object.cpp @@ -40,10 +40,10 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CBObject, false) +IMPLEMENT_PERSISTENT(BaseObject, false) ////////////////////////////////////////////////////////////////////// -CBObject::CBObject(CBGame *inGame): CBScriptHolder(inGame) { +BaseObject::BaseObject(BaseGame *inGame): BaseScriptHolder(inGame) { _posX = _posY = 0; _movable = true; _zoomable = true; @@ -65,7 +65,7 @@ CBObject::CBObject(CBGame *inGame): CBScriptHolder(inGame) { _iD = _gameRef->getSequence(); - CBPlatform::setRectEmpty(&_rect); + BasePlatform::setRectEmpty(&_rect); _rectSet = false; _cursor = NULL; @@ -101,17 +101,17 @@ CBObject::CBObject(CBGame *inGame): CBScriptHolder(inGame) { ////////////////////////////////////////////////////////////////////// -CBObject::~CBObject() { +BaseObject::~BaseObject() { cleanup(); } ////////////////////////////////////////////////////////////////////////// -bool CBObject::cleanup() { +bool BaseObject::cleanup() { if (_gameRef && _gameRef->_activeObject == this) _gameRef->_activeObject = NULL; - CBScriptHolder::cleanup(); + BaseScriptHolder::cleanup(); delete[] _soundEvent; _soundEvent = NULL; @@ -137,7 +137,7 @@ bool CBObject::cleanup() { ////////////////////////////////////////////////////////////////////////// -void CBObject::setCaption(const char *caption, int caseVal) { // TODO: rename Case to something usefull +void BaseObject::setCaption(const char *caption, int caseVal) { // TODO: rename Case to something usefull if (caseVal == 0) caseVal = 1; if (caseVal < 1 || caseVal > 7) return; @@ -152,7 +152,7 @@ void CBObject::setCaption(const char *caption, int caseVal) { // TODO: rename Ca ////////////////////////////////////////////////////////////////////////// -const char *CBObject::getCaption(int caseVal) { +const char *BaseObject::getCaption(int caseVal) { if (caseVal == 0) caseVal = 1; if (caseVal < 1 || caseVal > 7 || _caption[caseVal - 1] == NULL) return ""; @@ -161,7 +161,7 @@ const char *CBObject::getCaption(int caseVal) { ////////////////////////////////////////////////////////////////////////// -bool CBObject::listen(CBScriptHolder *param1, uint32 param2) { +bool BaseObject::listen(BaseScriptHolder *param1, uint32 param2) { return STATUS_FAILED; } @@ -169,7 +169,7 @@ bool CBObject::listen(CBScriptHolder *param1, uint32 param2) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -bool CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool BaseObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // SkipTo @@ -291,9 +291,9 @@ bool CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSt bool looping; uint32 loopStart; - CScValue *val1 = stack->pop(); - CScValue *val2 = stack->pop(); - CScValue *val3 = stack->pop(); + ScValue *val1 = stack->pop(); + ScValue *val2 = stack->pop(); + ScValue *val3 = stack->pop(); if (val1->_type == VAL_BOOL) { filename = NULL; @@ -321,8 +321,8 @@ bool CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSt const char *filename; const char *eventName; - CScValue *val1 = stack->pop(); - CScValue *val2 = stack->pop(); + ScValue *val1 = stack->pop(); + ScValue *val2 = stack->pop(); if (val2->isNULL()) { filename = NULL; @@ -473,12 +473,12 @@ bool CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSt return STATUS_OK; } - else return CBScriptHolder::scCallMethod(script, stack, thisStack, name); + else return BaseScriptHolder::scCallMethod(script, stack, thisStack, name); } ////////////////////////////////////////////////////////////////////////// -CScValue *CBObject::scGetProperty(const char *name) { +ScValue *BaseObject::scGetProperty(const char *name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// @@ -666,12 +666,12 @@ CScValue *CBObject::scGetProperty(const char *name) { return _scValue; } - else return CBScriptHolder::scGetProperty(name); + else return BaseScriptHolder::scGetProperty(name); } ////////////////////////////////////////////////////////////////////////// -bool CBObject::scSetProperty(const char *name, CScValue *value) { +bool BaseObject::scSetProperty(const char *name, ScValue *value) { ////////////////////////////////////////////////////////////////////////// // Caption ////////////////////////////////////////////////////////////////////////// @@ -845,32 +845,32 @@ bool CBObject::scSetProperty(const char *name, CScValue *value) { return STATUS_OK; } - else return CBScriptHolder::scSetProperty(name, value); + else return BaseScriptHolder::scSetProperty(name, value); } ////////////////////////////////////////////////////////////////////////// -const char *CBObject::scToString() { +const char *BaseObject::scToString() { return "[object]"; } ////////////////////////////////////////////////////////////////////////// -bool CBObject::showCursor() { +bool BaseObject::showCursor() { if (_cursor) return _gameRef->drawCursor(_cursor); else return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -bool CBObject::saveAsText(CBDynBuffer *buffer, int indent) { +bool BaseObject::saveAsText(BaseDynamicBuffer *buffer, int indent) { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CBObject::persist(CBPersistMgr *persistMgr) { - CBScriptHolder::persist(persistMgr); +bool BaseObject::persist(BasePersistenceManager *persistMgr) { + BaseScriptHolder::persist(persistMgr); for (int i = 0; i < 7; i++) persistMgr->transfer(TMEMBER(_caption[i])); @@ -925,14 +925,14 @@ bool CBObject::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -bool CBObject::setCursor(const char *filename) { +bool BaseObject::setCursor(const char *filename) { if (!_sharedCursors) { delete _cursor; _cursor = NULL; } _sharedCursors = false; - _cursor = new CBSprite(_gameRef); + _cursor = new BaseSprite(_gameRef); if (!_cursor || DID_FAIL(_cursor->loadFile(filename))) { delete _cursor; _cursor = NULL; @@ -942,9 +942,9 @@ bool CBObject::setCursor(const char *filename) { ////////////////////////////////////////////////////////////////////////// -bool CBObject::setActiveCursor(const char *filename) { +bool BaseObject::setActiveCursor(const char *filename) { delete _activeCursor; - _activeCursor = new CBSprite(_gameRef); + _activeCursor = new BaseSprite(_gameRef); if (!_activeCursor || DID_FAIL(_activeCursor->loadFile(filename))) { delete _activeCursor; _activeCursor = NULL; @@ -954,31 +954,31 @@ bool CBObject::setActiveCursor(const char *filename) { ////////////////////////////////////////////////////////////////////////// -int CBObject::getHeight() { +int BaseObject::getHeight() { return 0; } ////////////////////////////////////////////////////////////////////////// -bool CBObject::handleMouse(TMouseEvent event, TMouseButton button) { +bool BaseObject::handleMouse(TMouseEvent event, TMouseButton button) { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CBObject::handleKeypress(Common::Event *event, bool printable) { +bool BaseObject::handleKeypress(Common::Event *event, bool printable) { return false; } ////////////////////////////////////////////////////////////////////////// -bool CBObject::handleMouseWheel(int delta) { +bool BaseObject::handleMouseWheel(int delta) { return false; } ////////////////////////////////////////////////////////////////////////// -bool CBObject::playSFX(const char *filename, bool looping, bool playNow, const char *eventName, uint32 loopStart) { +bool BaseObject::playSFX(const char *filename, bool looping, bool playNow, const char *eventName, uint32 loopStart) { // just play loaded sound if (filename == NULL && _sFX) { if (_gameRef->_editorMode || _sFXStart) { @@ -998,7 +998,7 @@ bool CBObject::playSFX(const char *filename, bool looping, bool playNow, const c // create new sound delete _sFX; - _sFX = new CBSound(_gameRef); + _sFX = new BaseSound(_gameRef); if (_sFX && DID_SUCCEED(_sFX->setSound(filename, Audio::Mixer::kSFXSoundType, true))) { _sFX->setVolumePercent(_sFXVolume); if (_sFXStart) { @@ -1020,7 +1020,7 @@ bool CBObject::playSFX(const char *filename, bool looping, bool playNow, const c ////////////////////////////////////////////////////////////////////////// -bool CBObject::stopSFX(bool deleteSound) { +bool BaseObject::stopSFX(bool deleteSound) { if (_sFX) { _sFX->stop(); if (deleteSound) { @@ -1033,21 +1033,21 @@ bool CBObject::stopSFX(bool deleteSound) { ////////////////////////////////////////////////////////////////////////// -bool CBObject::pauseSFX() { +bool BaseObject::pauseSFX() { if (_sFX) return _sFX->pause(); else return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -bool CBObject::resumeSFX() { +bool BaseObject::resumeSFX() { if (_sFX) return _sFX->resume(); else return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -bool CBObject::setSFXTime(uint32 time) { +bool BaseObject::setSFXTime(uint32 time) { _sFXStart = time; if (_sFX && _sFX->isPlaying()) return _sFX->setPositionTime(time); else return STATUS_OK; @@ -1055,7 +1055,7 @@ bool CBObject::setSFXTime(uint32 time) { ////////////////////////////////////////////////////////////////////////// -bool CBObject::setSFXVolume(int volume) { +bool BaseObject::setSFXVolume(int volume) { _sFXVolume = volume; if (_sFX) return _sFX->setVolumePercent(volume); else return STATUS_OK; @@ -1063,7 +1063,7 @@ bool CBObject::setSFXVolume(int volume) { ////////////////////////////////////////////////////////////////////////// -bool CBObject::updateSounds() { +bool BaseObject::updateSounds() { if (_soundEvent) { if (_sFX && !_sFX->isPlaying()) { applyEvent(_soundEvent); @@ -1077,7 +1077,7 @@ bool CBObject::updateSounds() { } ////////////////////////////////////////////////////////////////////////// -bool CBObject::updateOneSound(CBSound *sound) { +bool BaseObject::updateOneSound(BaseSound *sound) { bool Ret = STATUS_OK; if (sound) { @@ -1090,7 +1090,7 @@ bool CBObject::updateOneSound(CBSound *sound) { } ////////////////////////////////////////////////////////////////////////// -bool CBObject::resetSoundPan() { +bool BaseObject::resetSoundPan() { if (!_sFX) return STATUS_OK; else { return _sFX->setPan(0.0f); @@ -1099,19 +1099,19 @@ bool CBObject::resetSoundPan() { ////////////////////////////////////////////////////////////////////////// -bool CBObject::getExtendedFlag(const char *flagName) { +bool BaseObject::getExtendedFlag(const char *flagName) { return false; } ////////////////////////////////////////////////////////////////////////// -bool CBObject::isReady() { +bool BaseObject::isReady() { return _ready; } ////////////////////////////////////////////////////////////////////////// -void CBObject::setSoundEvent(const char *eventName) { +void BaseObject::setSoundEvent(const char *eventName) { delete[] _soundEvent; _soundEvent = NULL; if (eventName) { @@ -1121,7 +1121,7 @@ void CBObject::setSoundEvent(const char *eventName) { } ////////////////////////////////////////////////////////////////////////// -bool CBObject::afterMove() { +bool BaseObject::afterMove() { return STATUS_OK; } diff --git a/engines/wintermute/base/base_object.h b/engines/wintermute/base/base_object.h index 70dc69f53d..c05501b145 100644 --- a/engines/wintermute/base/base_object.h +++ b/engines/wintermute/base/base_object.h @@ -36,14 +36,14 @@ namespace WinterMute { -class CBSprite; -class CBSound; -class CBSurface; -class CBScriptHolder; -class CScValue; -class CScStack; -class CScScript; -class CBObject : public CBScriptHolder { +class BaseSprite; +class BaseSound; +class BaseSurface; +class BaseScriptHolder; +class ScValue; +class ScStack; +class ScScript; +class BaseObject : public BaseScriptHolder { public: TSpriteBlendMode _blendMode; virtual bool afterMove(); @@ -61,7 +61,7 @@ public: virtual bool getExtendedFlag(const char *flagName); virtual bool resetSoundPan(); virtual bool updateSounds(); - bool updateOneSound(CBSound *sound); + bool updateOneSound(BaseSound *sound); bool _autoSoundPanning; uint32 _sFXStart; int _sFXVolume; @@ -71,7 +71,7 @@ public: bool pauseSFX(); bool stopSFX(bool deleteSound = true); bool playSFX(const char *filename, bool looping = false, bool playNow = true, const char *eventName = NULL, uint32 loopStart = 0); - CBSound *_sFX; + BaseSound *_sFX; TSFXType _sFXType; float _sFXParam1; @@ -92,13 +92,13 @@ public: bool _editorAlwaysRegister; bool _editorOnly; bool _is3D; - DECLARE_PERSISTENT(CBObject, CBScriptHolder) + DECLARE_PERSISTENT(BaseObject, BaseScriptHolder) virtual bool showCursor(); - CBSprite *_cursor; + BaseSprite *_cursor; bool _sharedCursors; - CBSprite *_activeCursor; - virtual bool saveAsText(CBDynBuffer *buffer, int indent); - virtual bool listen(CBScriptHolder *param1, uint32 param2); + BaseSprite *_activeCursor; + virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent); + virtual bool listen(BaseScriptHolder *param1, uint32 param2); bool _ready; bool _registrable; bool _zoomable; @@ -107,8 +107,8 @@ public: bool _rectSet; int _iD; bool _movable; - CBObject(CBGame *inGame); - virtual ~CBObject(); + BaseObject(BaseGame *inGame); + virtual ~BaseObject(); char *_caption[7]; char *_soundEvent; int _posY; @@ -133,9 +133,9 @@ public: public: // scripting interface - virtual CScValue *scGetProperty(const char *name); - virtual bool scSetProperty(const char *name, CScValue *value); - virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual ScValue *scGetProperty(const char *name); + virtual bool scSetProperty(const char *name, ScValue *value); + virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); virtual const char *scToString(); }; diff --git a/engines/wintermute/base/base_parser.cpp b/engines/wintermute/base/base_parser.cpp index 0f185636aa..b07d98eca8 100644 --- a/engines/wintermute/base/base_parser.cpp +++ b/engines/wintermute/base/base_parser.cpp @@ -43,26 +43,26 @@ namespace WinterMute { ////////////////////////////////////////////////////////////////////// -CBParser::CBParser(CBGame *inGame): CBBase(inGame) { +BaseParser::BaseParser(BaseGame *inGame): BaseClass(inGame) { _whiteSpace = new char [strlen(WHITESPACE) + 1]; strcpy(_whiteSpace, WHITESPACE); } ////////////////////////////////////////////////////////////////////// -CBParser::~CBParser() { +BaseParser::~BaseParser() { if (_whiteSpace != NULL) delete [] _whiteSpace; } ////////////////////////////////////////////////////////////////////// -char *CBParser::getLastOffender() { +char *BaseParser::getLastOffender() { return _lastOffender; } ////////////////////////////////////////////////////////////////////// -int32 CBParser::getObject(char **buf, TokenDesc *tokens, char **name, char **data) { +int32 BaseParser::getObject(char **buf, TokenDesc *tokens, char **name, char **data) { skipCharacters(buf, _whiteSpace); // skip comment lines. @@ -113,7 +113,7 @@ int32 CBParser::getObject(char **buf, TokenDesc *tokens, char **name, char **dat ////////////////////////////////////////////////////////////////////// -int32 CBParser::getCommand(char **buf, TokenDesc *tokens, char **params) { +int32 BaseParser::getCommand(char **buf, TokenDesc *tokens, char **params) { if (!*buf) return PARSERR_TOKENNOTFOUND; _gameRef->miniUpdate(); char *name; @@ -122,7 +122,7 @@ int32 CBParser::getCommand(char **buf, TokenDesc *tokens, char **params) { ////////////////////////////////////////////////////////////////////// -void CBParser::skipCharacters(char **buf, const char *toSkip) { +void BaseParser::skipCharacters(char **buf, const char *toSkip) { char ch; while ((ch = **buf) != 0) { if (ch == '\n') _parserLine++; @@ -135,7 +135,7 @@ void CBParser::skipCharacters(char **buf, const char *toSkip) { ////////////////////////////////////////////////////////////////////// -char *CBParser::getSubText(char **buf, char open, char close) { +char *BaseParser::getSubText(char **buf, char open, char close) { if (**buf == 0 || **buf != open) return 0; ++*buf; // skip opening delimiter @@ -164,7 +164,7 @@ char *CBParser::getSubText(char **buf, char open, char close) { ////////////////////////////////////////////////////////////////////// -char *CBParser::getAssignmentText(char **buf) { +char *BaseParser::getAssignmentText(char **buf) { ++*buf; // skip the '=' skipCharacters(buf, _whiteSpace); char *result = *buf; @@ -192,7 +192,7 @@ char *CBParser::getAssignmentText(char **buf) { ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// -char *CBParser::getToken(char **buf) { +char *BaseParser::getToken(char **buf) { static char token[100]; char *b = *buf, * t = token; while (true) { @@ -240,7 +240,7 @@ char *CBParser::getToken(char **buf) { ////////////////////////////////////////////////////////////////////// -float CBParser::getTokenFloat(char **buf) { +float BaseParser::getTokenFloat(char **buf) { char *t = getToken(buf); if (!((*t >= '0' && *t <= '9') || *t == '-' || *t == '.')) { // Error situation. We handle this by return 0. @@ -252,7 +252,7 @@ float CBParser::getTokenFloat(char **buf) { ////////////////////////////////////////////////////////////////////// -int CBParser::getTokenInt(char **buf) { +int BaseParser::getTokenInt(char **buf) { char *t = getToken(buf); if (!((*t >= '0' && *t <= '9') || *t == '-')) { // Error situation. We handle this by return 0. @@ -264,14 +264,14 @@ int CBParser::getTokenInt(char **buf) { ////////////////////////////////////////////////////////////////////// -void CBParser::skipToken(char **buf, char *tok, char * /*msg*/) { +void BaseParser::skipToken(char **buf, char *tok, char * /*msg*/) { char *t = getToken(buf); if (strcmp(t, tok)) return; // Error } ////////////////////////////////////////////////////////////////////// -int CBParser::scanStr(const char *in, const char *format, ...) { +int BaseParser::scanStr(const char *in, const char *format, ...) { va_list arg; va_start(arg, format); diff --git a/engines/wintermute/base/base_parser.h b/engines/wintermute/base/base_parser.h index 53a02c0f68..a5c55ceb41 100644 --- a/engines/wintermute/base/base_parser.h +++ b/engines/wintermute/base/base_parser.h @@ -40,7 +40,7 @@ TOKEN_TOTAL_COUNT \ }; #define TOKEN_TABLE_START(name) \ - static CBParser::TokenDesc name [] = \ + static BaseParser::TokenDesc name [] = \ { #define TOKEN_TABLE(name) \ { TOKEN_ ## name, #name }, @@ -57,7 +57,7 @@ namespace WinterMute { -class CBParser : public CBBase { +class BaseParser : public BaseClass { public: struct TokenDesc { int32 id; @@ -67,8 +67,8 @@ public: public: int scanStr(const char *in, const char *format, ...); int32 getCommand(char **buf, TokenDesc *tokens, char **params); - CBParser(CBGame *inGame = NULL); - virtual ~CBParser(); + BaseParser(BaseGame *inGame = NULL); + virtual ~BaseParser(); private: char *getLastOffender(); void skipToken(char **buf, char *tok, char *msg = NULL); diff --git a/engines/wintermute/base/base_persistence_manager.cpp b/engines/wintermute/base/base_persistence_manager.cpp index 743eaf355b..18dc8ed11c 100644 --- a/engines/wintermute/base/base_persistence_manager.cpp +++ b/engines/wintermute/base/base_persistence_manager.cpp @@ -51,7 +51,7 @@ namespace WinterMute { #define SAVE_MAGIC_2 0x32564153 ////////////////////////////////////////////////////////////////////////// -CBPersistMgr::CBPersistMgr(CBGame *inGame, const char *savePrefix): CBBase(inGame) { +BasePersistenceManager::BasePersistenceManager(BaseGame *inGame, const char *savePrefix): BaseClass(inGame) { _saving = false; // _buffer = NULL; // _bufferSize = 0; @@ -80,13 +80,13 @@ CBPersistMgr::CBPersistMgr(CBGame *inGame, const char *savePrefix): CBBase(inGam ////////////////////////////////////////////////////////////////////////// -CBPersistMgr::~CBPersistMgr() { +BasePersistenceManager::~BasePersistenceManager() { cleanup(); } ////////////////////////////////////////////////////////////////////////// -void CBPersistMgr::cleanup() { +void BasePersistenceManager::cleanup() { /* if (_buffer) { if (_saving) free(_buffer); else delete [] _buffer; // allocated by file manager @@ -118,12 +118,12 @@ void CBPersistMgr::cleanup() { _saveStream = NULL; } -Common::String CBPersistMgr::getFilenameForSlot(int slot) const { +Common::String BasePersistenceManager::getFilenameForSlot(int slot) const { // 3 Digits, to allow for one save-slot for autosave + slot 1 - 100 (which will be numbered 0-99 filename-wise) return Common::String::format("%s-save%03d.wsv", _savePrefix.c_str(), slot); } -void CBPersistMgr::getSaveStateDesc(int slot, SaveStateDescriptor &desc) { +void BasePersistenceManager::getSaveStateDesc(int slot, SaveStateDescriptor &desc) { Common::String filename = getFilenameForSlot(slot); warning("Trying to list savegame %s in slot %d", filename.c_str(), slot); if (DID_FAIL(readHeader(filename))) { @@ -150,12 +150,12 @@ void CBPersistMgr::getSaveStateDesc(int slot, SaveStateDescriptor &desc) { desc.setPlayTime(0); } -void CBPersistMgr::deleteSaveSlot(int slot) { +void BasePersistenceManager::deleteSaveSlot(int slot) { Common::String filename = getFilenameForSlot(slot); g_system->getSavefileManager()->removeSavefile(filename); } -uint32 CBPersistMgr::getMaxUsedSlot() { +uint32 BasePersistenceManager::getMaxUsedSlot() { Common::String saveMask = Common::String::format("%s-save???.wsv", _savePrefix.c_str()); Common::StringArray saves = g_system->getSavefileManager()->listSavefiles(saveMask); Common::StringArray::iterator it = saves.begin(); @@ -168,7 +168,7 @@ uint32 CBPersistMgr::getMaxUsedSlot() { return ret; } -bool CBPersistMgr::getSaveExists(int slot) { +bool BasePersistenceManager::getSaveExists(int slot) { Common::String filename = getFilenameForSlot(slot); warning("Trying to list savegame %s in slot %d", filename.c_str(), slot); if (DID_FAIL(readHeader(filename))) { @@ -178,7 +178,7 @@ bool CBPersistMgr::getSaveExists(int slot) { } ////////////////////////////////////////////////////////////////////////// -bool CBPersistMgr::initSave(const char *desc) { +bool BasePersistenceManager::initSave(const char *desc) { if (!desc) return STATUS_FAILED; cleanup(); @@ -189,7 +189,7 @@ bool CBPersistMgr::initSave(const char *desc) { if (_saveStream) { // get thumbnails if (!_gameRef->_cachedThumbnail) { - _gameRef->_cachedThumbnail = new CBSaveThumbHelper(_gameRef); + _gameRef->_cachedThumbnail = new BaseSaveThumbHelper(_gameRef); if (DID_FAIL(_gameRef->_cachedThumbnail->storeThumbnail(true))) { delete _gameRef->_cachedThumbnail; _gameRef->_cachedThumbnail = NULL; @@ -252,7 +252,7 @@ bool CBPersistMgr::initSave(const char *desc) { return STATUS_OK; } -bool CBPersistMgr::readHeader(const Common::String &filename) { +bool BasePersistenceManager::readHeader(const Common::String &filename) { cleanup(); _saving = false; @@ -307,7 +307,7 @@ bool CBPersistMgr::readHeader(const Common::String &filename) { } ////////////////////////////////////////////////////////////////////////// -bool CBPersistMgr::initLoad(const char *filename) { +bool BasePersistenceManager::initLoad(const char *filename) { if (DID_FAIL(readHeader(filename))) { cleanup(); return STATUS_FAILED; @@ -356,13 +356,13 @@ bool CBPersistMgr::initLoad(const char *filename) { ////////////////////////////////////////////////////////////////////////// -bool CBPersistMgr::saveFile(const char *filename) { +bool BasePersistenceManager::saveFile(const char *filename) { return _gameRef->_fileManager->saveFile(filename, ((Common::MemoryWriteStreamDynamic *)_saveStream)->getData(), ((Common::MemoryWriteStreamDynamic *)_saveStream)->size(), _gameRef->_compressedSavegames, _richBuffer, _richBufferSize); } ////////////////////////////////////////////////////////////////////////// -bool CBPersistMgr::putBytes(byte *buffer, uint32 size) { +bool BasePersistenceManager::putBytes(byte *buffer, uint32 size) { _saveStream->write(buffer, size); if (_saveStream->err()) return STATUS_FAILED; @@ -370,7 +370,7 @@ bool CBPersistMgr::putBytes(byte *buffer, uint32 size) { } ////////////////////////////////////////////////////////////////////////// -bool CBPersistMgr::getBytes(byte *buffer, uint32 size) { +bool BasePersistenceManager::getBytes(byte *buffer, uint32 size) { _loadStream->read(buffer, size); if (_loadStream->err()) return STATUS_FAILED; @@ -378,20 +378,20 @@ bool CBPersistMgr::getBytes(byte *buffer, uint32 size) { } ////////////////////////////////////////////////////////////////////////// -void CBPersistMgr::putDWORD(uint32 val) { +void BasePersistenceManager::putDWORD(uint32 val) { _saveStream->writeUint32LE(val); } ////////////////////////////////////////////////////////////////////////// -uint32 CBPersistMgr::getDWORD() { +uint32 BasePersistenceManager::getDWORD() { uint32 ret = _loadStream->readUint32LE(); return ret; } ////////////////////////////////////////////////////////////////////////// -void CBPersistMgr::putString(const Common::String &val) { +void BasePersistenceManager::putString(const Common::String &val) { if (!val.size()) putString("(null)"); else { _saveStream->writeUint32LE(val.size()); @@ -399,7 +399,7 @@ void CBPersistMgr::putString(const Common::String &val) { } } -Common::String CBPersistMgr::getStringObj() { +Common::String BasePersistenceManager::getStringObj() { uint32 len = _loadStream->readUint32LE(); char *ret = new char[len + 1]; _loadStream->read(ret, len); @@ -416,7 +416,7 @@ Common::String CBPersistMgr::getStringObj() { } ////////////////////////////////////////////////////////////////////////// -char *CBPersistMgr::getString() { +char *BasePersistenceManager::getString() { uint32 len = _loadStream->readUint32LE(); char *ret = new char[len + 1]; _loadStream->read(ret, len); @@ -428,7 +428,7 @@ char *CBPersistMgr::getString() { } else return ret; } -bool CBPersistMgr::putTimeDate(const TimeDate &t) { +bool BasePersistenceManager::putTimeDate(const TimeDate &t) { _saveStream->writeSint32LE(t.tm_sec); _saveStream->writeSint32LE(t.tm_min); _saveStream->writeSint32LE(t.tm_hour); @@ -443,7 +443,7 @@ bool CBPersistMgr::putTimeDate(const TimeDate &t) { return STATUS_OK; } -TimeDate CBPersistMgr::getTimeDate() { +TimeDate BasePersistenceManager::getTimeDate() { TimeDate t; t.tm_sec = _loadStream->readSint32LE(); t.tm_min = _loadStream->readSint32LE(); @@ -455,13 +455,13 @@ TimeDate CBPersistMgr::getTimeDate() { return t; } -void CBPersistMgr::putFloat(float val) { +void BasePersistenceManager::putFloat(float val) { Common::String str = Common::String::format("F%f", val); _saveStream->writeUint32LE(str.size()); _saveStream->writeString(str); } -float CBPersistMgr::getFloat() { +float BasePersistenceManager::getFloat() { char *str = getString(); float value = 0.0f; int ret = sscanf(str, "F%f", &value); @@ -472,14 +472,14 @@ float CBPersistMgr::getFloat() { return value; } -void CBPersistMgr::putDouble(double val) { +void BasePersistenceManager::putDouble(double val) { Common::String str = Common::String::format("F%f", val); str.format("D%f", val); _saveStream->writeUint32LE(str.size()); _saveStream->writeString(str); } -double CBPersistMgr::getDouble() { +double BasePersistenceManager::getDouble() { char *str = getString(); double value = 0.0f; int ret = sscanf(str, "F%f", &value); @@ -492,7 +492,7 @@ double CBPersistMgr::getDouble() { ////////////////////////////////////////////////////////////////////////// // bool -bool CBPersistMgr::transfer(const char *name, bool *val) { +bool BasePersistenceManager::transfer(const char *name, bool *val) { if (_saving) { _saveStream->writeByte(*val); if (_saveStream->err()) @@ -509,7 +509,7 @@ bool CBPersistMgr::transfer(const char *name, bool *val) { ////////////////////////////////////////////////////////////////////////// // int -bool CBPersistMgr::transfer(const char *name, int *val) { +bool BasePersistenceManager::transfer(const char *name, int *val) { if (_saving) { _saveStream->writeSint32LE(*val); if (_saveStream->err()) @@ -526,7 +526,7 @@ bool CBPersistMgr::transfer(const char *name, int *val) { ////////////////////////////////////////////////////////////////////////// // DWORD -bool CBPersistMgr::transfer(const char *name, uint32 *val) { +bool BasePersistenceManager::transfer(const char *name, uint32 *val) { if (_saving) { _saveStream->writeUint32LE(*val); if (_saveStream->err()) @@ -543,7 +543,7 @@ bool CBPersistMgr::transfer(const char *name, uint32 *val) { ////////////////////////////////////////////////////////////////////////// // float -bool CBPersistMgr::transfer(const char *name, float *val) { +bool BasePersistenceManager::transfer(const char *name, float *val) { if (_saving) { putFloat(*val); if (_saveStream->err()) @@ -560,7 +560,7 @@ bool CBPersistMgr::transfer(const char *name, float *val) { ////////////////////////////////////////////////////////////////////////// // double -bool CBPersistMgr::transfer(const char *name, double *val) { +bool BasePersistenceManager::transfer(const char *name, double *val) { if (_saving) { putDouble(*val); if (_saveStream->err()) @@ -577,7 +577,7 @@ bool CBPersistMgr::transfer(const char *name, double *val) { ////////////////////////////////////////////////////////////////////////// // char* -bool CBPersistMgr::transfer(const char *name, char **val) { +bool BasePersistenceManager::transfer(const char *name, char **val) { if (_saving) { putString(*val); return STATUS_OK; @@ -594,7 +594,7 @@ bool CBPersistMgr::transfer(const char *name, char **val) { ////////////////////////////////////////////////////////////////////////// // const char* -bool CBPersistMgr::transfer(const char *name, const char **val) { +bool BasePersistenceManager::transfer(const char *name, const char **val) { if (_saving) { putString(*val); return STATUS_OK; @@ -611,7 +611,7 @@ bool CBPersistMgr::transfer(const char *name, const char **val) { ////////////////////////////////////////////////////////////////////////// // Common::String -bool CBPersistMgr::transfer(const char *name, Common::String *val) { +bool BasePersistenceManager::transfer(const char *name, Common::String *val) { if (_saving) { putString(*val); return STATUS_OK; @@ -632,7 +632,7 @@ bool CBPersistMgr::transfer(const char *name, Common::String *val) { } ////////////////////////////////////////////////////////////////////////// -bool CBPersistMgr::transfer(const char *name, AnsiStringArray &val) { +bool BasePersistenceManager::transfer(const char *name, AnsiStringArray &val) { size_t size; if (_saving) { @@ -662,7 +662,7 @@ bool CBPersistMgr::transfer(const char *name, AnsiStringArray &val) { ////////////////////////////////////////////////////////////////////////// // BYTE -bool CBPersistMgr::transfer(const char *name, byte *val) { +bool BasePersistenceManager::transfer(const char *name, byte *val) { if (_saving) { _saveStream->writeByte(*val); if (_saveStream->err()) @@ -679,7 +679,7 @@ bool CBPersistMgr::transfer(const char *name, byte *val) { ////////////////////////////////////////////////////////////////////////// // RECT -bool CBPersistMgr::transfer(const char *name, Rect32 *val) { +bool BasePersistenceManager::transfer(const char *name, Rect32 *val) { if (_saving) { _saveStream->writeSint32LE(val->left); _saveStream->writeSint32LE(val->top); @@ -702,7 +702,7 @@ bool CBPersistMgr::transfer(const char *name, Rect32 *val) { ////////////////////////////////////////////////////////////////////////// // POINT -bool CBPersistMgr::transfer(const char *name, Point32 *val) { +bool BasePersistenceManager::transfer(const char *name, Point32 *val) { if (_saving) { _saveStream->writeSint32LE(val->x); _saveStream->writeSint32LE(val->y); @@ -721,7 +721,7 @@ bool CBPersistMgr::transfer(const char *name, Point32 *val) { ////////////////////////////////////////////////////////////////////////// // Vector2 -bool CBPersistMgr::transfer(const char *name, Vector2 *val) { +bool BasePersistenceManager::transfer(const char *name, Vector2 *val) { if (_saving) { putFloat(val->x); putFloat(val->y); @@ -740,11 +740,11 @@ bool CBPersistMgr::transfer(const char *name, Vector2 *val) { ////////////////////////////////////////////////////////////////////////// // generic pointer -bool CBPersistMgr::transfer(const char *name, void *val) { +bool BasePersistenceManager::transfer(const char *name, void *val) { int classID = -1, instanceID = -1; if (_saving) { - CSysClassRegistry::getInstance()->getPointerID(*(void **)val, &classID, &instanceID); + SystemClassRegistry::getInstance()->getPointerID(*(void **)val, &classID, &instanceID); if (*(void **)val != NULL && (classID == -1 || instanceID == -1)) { _gameRef->LOG(0, "Warning: invalid instance '%s'", name); } @@ -755,7 +755,7 @@ bool CBPersistMgr::transfer(const char *name, void *val) { classID = _loadStream->readUint32LE(); instanceID = _loadStream->readUint32LE(); - *(void **)val = CSysClassRegistry::getInstance()->idToPointer(classID, instanceID); + *(void **)val = SystemClassRegistry::getInstance()->idToPointer(classID, instanceID); } return STATUS_OK; @@ -763,7 +763,7 @@ bool CBPersistMgr::transfer(const char *name, void *val) { ////////////////////////////////////////////////////////////////////////// -bool CBPersistMgr::checkVersion(byte verMajor, byte verMinor, byte verBuild) { +bool BasePersistenceManager::checkVersion(byte verMajor, byte verMinor, byte verBuild) { if (_saving) return true; // it's ok if we are same or newer than the saved game diff --git a/engines/wintermute/base/base_persistence_manager.h b/engines/wintermute/base/base_persistence_manager.h index f2fd42ceca..a400c612dc 100644 --- a/engines/wintermute/base/base_persistence_manager.h +++ b/engines/wintermute/base/base_persistence_manager.h @@ -42,7 +42,7 @@ namespace WinterMute { class Vector2; -class CBPersistMgr : public CBBase { +class BasePersistenceManager : public BaseClass { public: char *_savedDescription; TimeDate _savedTimestamp; @@ -94,8 +94,8 @@ public: bool transfer(const char *name, Common::String *val); bool transfer(const char *name, Vector2 *val); bool transfer(const char *name, AnsiStringArray &Val); - CBPersistMgr(CBGame *inGame = NULL, const char *savePrefix = NULL); - virtual ~CBPersistMgr(); + BasePersistenceManager(BaseGame *inGame = NULL, const char *savePrefix = NULL); + virtual ~BasePersistenceManager(); bool checkVersion(byte verMajor, byte verMinor, byte verBuild); uint32 _thumbnailDataSize; diff --git a/engines/wintermute/base/base_point.cpp b/engines/wintermute/base/base_point.cpp index e878f34387..76d8d85c70 100644 --- a/engines/wintermute/base/base_point.cpp +++ b/engines/wintermute/base/base_point.cpp @@ -32,28 +32,28 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CBPoint, false) +IMPLEMENT_PERSISTENT(BasePoint, false) ////////////////////////////////////////////////////////////////////////// -CBPoint::CBPoint() { +BasePoint::BasePoint() { x = y = 0; } ////////////////////////////////////////////////////////////////////////// -CBPoint::~CBPoint() { +BasePoint::~BasePoint() { } ////////////////////////////////////////////////////////////////////////// -CBPoint::CBPoint(int initX, int initY) { +BasePoint::BasePoint(int initX, int initY) { x = initX; y = initY; } ////////////////////////////////////////////////////////////////////////// -bool CBPoint::persist(CBPersistMgr *persistMgr) { +bool BasePoint::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(x)); persistMgr->transfer(TMEMBER(y)); diff --git a/engines/wintermute/base/base_point.h b/engines/wintermute/base/base_point.h index 363ab1f919..35d310b8d9 100644 --- a/engines/wintermute/base/base_point.h +++ b/engines/wintermute/base/base_point.h @@ -34,14 +34,14 @@ namespace WinterMute { -class CBPoint: public CBBase { +class BasePoint: public BaseClass { public: - DECLARE_PERSISTENT(CBPoint, CBBase) - CBPoint(); - CBPoint(int initX, int initY); + DECLARE_PERSISTENT(BasePoint, BaseClass) + BasePoint(); + BasePoint(int initX, int initY); int y; int x; - virtual ~CBPoint(); + virtual ~BasePoint(); }; diff --git a/engines/wintermute/base/base_quick_msg.cpp b/engines/wintermute/base/base_quick_msg.cpp index ac1001a2fe..856a214f80 100644 --- a/engines/wintermute/base/base_quick_msg.cpp +++ b/engines/wintermute/base/base_quick_msg.cpp @@ -33,7 +33,7 @@ namespace WinterMute { ////////////////////////////////////////////////////////////////////////// -CBQuickMsg::CBQuickMsg(CBGame *inGame, const char *text): CBBase(inGame) { +BaseQuickMsg::BaseQuickMsg(BaseGame *inGame, const char *text): BaseClass(inGame) { _text = new char [strlen(text) + 1]; if (_text) strcpy(_text, text); _startTime = _gameRef->_currentTime; @@ -41,13 +41,13 @@ CBQuickMsg::CBQuickMsg(CBGame *inGame, const char *text): CBBase(inGame) { ////////////////////////////////////////////////////////////////////////// -CBQuickMsg::~CBQuickMsg() { +BaseQuickMsg::~BaseQuickMsg() { if (_text) delete [] _text; } ////////////////////////////////////////////////////////////////////////// -char *CBQuickMsg::getText() { +char *BaseQuickMsg::getText() { return _text; } diff --git a/engines/wintermute/base/base_quick_msg.h b/engines/wintermute/base/base_quick_msg.h index 9a68929932..f2f9144bc0 100644 --- a/engines/wintermute/base/base_quick_msg.h +++ b/engines/wintermute/base/base_quick_msg.h @@ -33,13 +33,13 @@ namespace WinterMute { -class CBQuickMsg : public CBBase { +class BaseQuickMsg : public BaseClass { public: char *getText(); uint32 _startTime; char *_text; - CBQuickMsg(CBGame *inGame, const char *Text); - virtual ~CBQuickMsg(); + BaseQuickMsg(BaseGame *inGame, const char *Text); + virtual ~BaseQuickMsg(); }; diff --git a/engines/wintermute/base/base_region.cpp b/engines/wintermute/base/base_region.cpp index 3e513f9fb8..e336b92789 100644 --- a/engines/wintermute/base/base_region.cpp +++ b/engines/wintermute/base/base_region.cpp @@ -40,43 +40,43 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CBRegion, false) +IMPLEMENT_PERSISTENT(BaseRegion, false) ////////////////////////////////////////////////////////////////////////// -CBRegion::CBRegion(CBGame *inGame): CBObject(inGame) { +BaseRegion::BaseRegion(BaseGame *inGame): BaseObject(inGame) { _active = true; _editorSelectedPoint = -1; _lastMimicScale = -1; _lastMimicX = _lastMimicY = INT_MIN; - CBPlatform::setRectEmpty(&_rect); + BasePlatform::setRectEmpty(&_rect); } ////////////////////////////////////////////////////////////////////////// -CBRegion::~CBRegion() { +BaseRegion::~BaseRegion() { cleanup(); } ////////////////////////////////////////////////////////////////////////// -void CBRegion::cleanup() { +void BaseRegion::cleanup() { for (int i = 0; i < _points.getSize(); i++) delete _points[i]; _points.removeAll(); - CBPlatform::setRectEmpty(&_rect); + BasePlatform::setRectEmpty(&_rect); _editorSelectedPoint = -1; } ////////////////////////////////////////////////////////////////////////// -bool CBRegion::createRegion() { +bool BaseRegion::createRegion() { return DID_SUCCEED(getBoundingRect(&_rect)); } ////////////////////////////////////////////////////////////////////////// -bool CBRegion::pointInRegion(int x, int y) { +bool BaseRegion::pointInRegion(int x, int y) { if (_points.getSize() < 3) return false; Point32 pt; @@ -89,16 +89,16 @@ bool CBRegion::pointInRegion(int x, int y) { rect.top = y - 1; rect.bottom = y + 2; - if (CBPlatform::ptInRect(&_rect, pt)) return ptInPolygon(x, y); + if (BasePlatform::ptInRect(&_rect, pt)) return ptInPolygon(x, y); else return false; } ////////////////////////////////////////////////////////////////////////// -bool CBRegion::loadFile(const char *filename) { +bool BaseRegion::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { - _gameRef->LOG(0, "CBRegion::LoadFile failed for file '%s'", filename); + _gameRef->LOG(0, "BaseRegion::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -128,7 +128,7 @@ TOKEN_DEF(EDITOR_SELECTED_POINT) TOKEN_DEF(PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -bool CBRegion::loadBuffer(byte *buffer, bool complete) { +bool BaseRegion::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(REGION) TOKEN_TABLE(TEMPLATE) @@ -143,7 +143,7 @@ bool CBRegion::loadBuffer(byte *buffer, bool complete) { byte *params; int cmd; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); if (complete) { if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_REGION) { @@ -179,7 +179,7 @@ bool CBRegion::loadBuffer(byte *buffer, bool complete) { case TOKEN_POINT: { int x, y; parser.scanStr((char *)params, "%d,%d", &x, &y); - _points.add(new CBPoint(x, y)); + _points.add(new BasePoint(x, y)); } break; @@ -210,7 +210,7 @@ bool CBRegion::loadBuffer(byte *buffer, bool complete) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -bool CBRegion::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool BaseRegion::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // AddPoint @@ -220,7 +220,7 @@ bool CBRegion::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSt int x = stack->pop()->getInt(); int y = stack->pop()->getInt(); - _points.add(new CBPoint(x, y)); + _points.add(new BasePoint(x, y)); createRegion(); stack->pushBool(true); @@ -238,7 +238,7 @@ bool CBRegion::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSt int y = stack->pop()->getInt(); if (Index >= 0 && Index < _points.getSize()) { - _points.insertAt(Index, new CBPoint(x, y)); + _points.insertAt(Index, new BasePoint(x, y)); createRegion(); stack->pushBool(true); @@ -295,7 +295,7 @@ bool CBRegion::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSt int index = stack->pop()->getInt(); if (index >= 0 && index < _points.getSize()) { - CScValue *val = stack->getPushValue(); + ScValue *val = stack->getPushValue(); if (val) { val->setProperty("X", _points[index]->x); val->setProperty("Y", _points[index]->y); @@ -305,12 +305,12 @@ bool CBRegion::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSt return STATUS_OK; } - else return CBObject::scCallMethod(script, stack, thisStack, name); + else return BaseObject::scCallMethod(script, stack, thisStack, name); } ////////////////////////////////////////////////////////////////////////// -CScValue *CBRegion::scGetProperty(const char *name) { +ScValue *BaseRegion::scGetProperty(const char *name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// @@ -345,12 +345,12 @@ CScValue *CBRegion::scGetProperty(const char *name) { return _scValue; } - else return CBObject::scGetProperty(name); + else return BaseObject::scGetProperty(name); } ////////////////////////////////////////////////////////////////////////// -bool CBRegion::scSetProperty(const char *name, CScValue *value) { +bool BaseRegion::scSetProperty(const char *name, ScValue *value) { ////////////////////////////////////////////////////////////////////////// // Name ////////////////////////////////////////////////////////////////////////// @@ -367,18 +367,18 @@ bool CBRegion::scSetProperty(const char *name, CScValue *value) { return STATUS_OK; } - else return CBObject::scSetProperty(name, value); + else return BaseObject::scSetProperty(name, value); } ////////////////////////////////////////////////////////////////////////// -const char *CBRegion::scToString() { +const char *BaseRegion::scToString() { return "[region]"; } ////////////////////////////////////////////////////////////////////////// -bool CBRegion::saveAsText(CBDynBuffer *buffer, int indent, const char *nameOverride) { +bool BaseRegion::saveAsText(BaseDynamicBuffer *buffer, int indent, const char *nameOverride) { if (!nameOverride) buffer->putTextIndent(indent, "REGION {\n"); else buffer->putTextIndent(indent, "%s {\n", nameOverride); @@ -406,9 +406,9 @@ bool CBRegion::saveAsText(CBDynBuffer *buffer, int indent, const char *nameOverr ////////////////////////////////////////////////////////////////////////// -bool CBRegion::persist(CBPersistMgr *persistMgr) { +bool BaseRegion::persist(BasePersistenceManager *persistMgr) { - CBObject::persist(persistMgr); + BaseObject::persist(persistMgr); persistMgr->transfer(TMEMBER(_active)); persistMgr->transfer(TMEMBER(_editorSelectedPoint)); @@ -426,7 +426,7 @@ typedef struct { } dPoint; ////////////////////////////////////////////////////////////////////////// -bool CBRegion::ptInPolygon(int x, int y) { +bool BaseRegion::ptInPolygon(int x, int y) { if (_points.getSize() < 3) return false; int counter = 0; @@ -465,8 +465,8 @@ bool CBRegion::ptInPolygon(int x, int y) { ////////////////////////////////////////////////////////////////////////// -bool CBRegion::getBoundingRect(Rect32 *rect) { - if (_points.getSize() == 0) CBPlatform::setRectEmpty(rect); +bool BaseRegion::getBoundingRect(Rect32 *rect) { + if (_points.getSize() == 0) BasePlatform::setRectEmpty(rect); else { int MinX = INT_MAX, MinY = INT_MAX, MaxX = INT_MIN, MaxY = INT_MIN; @@ -477,14 +477,14 @@ bool CBRegion::getBoundingRect(Rect32 *rect) { MaxX = MAX(MaxX, _points[i]->x); MaxY = MAX(MaxY, _points[i]->y); } - CBPlatform::setRect(rect, MinX, MinY, MaxX, MaxY); + BasePlatform::setRect(rect, MinX, MinY, MaxX, MaxY); } return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CBRegion::mimic(CBRegion *region, float scale, int x, int y) { +bool BaseRegion::mimic(BaseRegion *region, float scale, int x, int y) { if (scale == _lastMimicScale && x == _lastMimicX && y == _lastMimicY) return STATUS_OK; cleanup(); @@ -495,7 +495,7 @@ bool CBRegion::mimic(CBRegion *region, float scale, int x, int y) { xVal = (int)((float)region->_points[i]->x * scale / 100.0f); yVal = (int)((float)region->_points[i]->y * scale / 100.0f); - _points.add(new CBPoint(xVal + x, yVal + y)); + _points.add(new BasePoint(xVal + x, yVal + y)); } _lastMimicScale = scale; diff --git a/engines/wintermute/base/base_region.h b/engines/wintermute/base/base_region.h index 0c35d99bd9..a15e0cca2a 100644 --- a/engines/wintermute/base/base_region.h +++ b/engines/wintermute/base/base_region.h @@ -34,32 +34,32 @@ namespace WinterMute { -class CBRegion : public CBObject { +class BaseRegion : public BaseObject { public: float _lastMimicScale; int _lastMimicX; int _lastMimicY; void cleanup(); - bool mimic(CBRegion *region, float scale = 100.0f, int x = 0, int y = 0); + bool mimic(BaseRegion *region, float scale = 100.0f, int x = 0, int y = 0); bool getBoundingRect(Rect32 *rect); bool ptInPolygon(int x, int y); - DECLARE_PERSISTENT(CBRegion, CBObject) + DECLARE_PERSISTENT(BaseRegion, BaseObject) bool _active; int _editorSelectedPoint; - CBRegion(CBGame *inGame); - virtual ~CBRegion(); + BaseRegion(BaseGame *inGame); + virtual ~BaseRegion(); bool pointInRegion(int x, int y); bool createRegion(); bool loadFile(const char *filename); bool loadBuffer(byte *buffer, bool complete = true); Rect32 _rect; - CBArray _points; - virtual bool saveAsText(CBDynBuffer *buffer, int indent, const char *nameOverride = NULL); + BaseArray _points; + virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent, const char *nameOverride = NULL); // scripting interface - virtual CScValue *scGetProperty(const char *name); - virtual bool scSetProperty(const char *name, CScValue *value); - virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual ScValue *scGetProperty(const char *name); + virtual bool scSetProperty(const char *name, ScValue *value); + virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); virtual const char *scToString(); }; diff --git a/engines/wintermute/base/base_registry.cpp b/engines/wintermute/base/base_registry.cpp index 350a34b61e..dfab1b5076 100644 --- a/engines/wintermute/base/base_registry.cpp +++ b/engines/wintermute/base/base_registry.cpp @@ -38,7 +38,7 @@ namespace WinterMute { ////////////////////////////////////////////////////////////////////////// -CBRegistry::CBRegistry(CBGame *inGame): CBBase(inGame) { +BaseRegistry::BaseRegistry(BaseGame *inGame): BaseClass(inGame) { _iniName = NULL; setIniName("./wme.ini"); @@ -47,7 +47,7 @@ CBRegistry::CBRegistry(CBGame *inGame): CBBase(inGame) { ////////////////////////////////////////////////////////////////////////// -CBRegistry::~CBRegistry() { +BaseRegistry::~BaseRegistry() { saveValues(); delete[] _iniName; _iniName = NULL; @@ -56,7 +56,7 @@ CBRegistry::~CBRegistry() { ////////////////////////////////////////////////////////////////////////// -AnsiString CBRegistry::readString(const AnsiString &subKey, const AnsiString &key, const AnsiString &init) { +AnsiString BaseRegistry::readString(const AnsiString &subKey, const AnsiString &key, const AnsiString &init) { AnsiString ret = ""; bool found = false; @@ -69,14 +69,14 @@ AnsiString CBRegistry::readString(const AnsiString &subKey, const AnsiString &ke ////////////////////////////////////////////////////////////////////////// -bool CBRegistry::writeString(const AnsiString &subKey, const AnsiString &key, const AnsiString &value) { +bool BaseRegistry::writeString(const AnsiString &subKey, const AnsiString &key, const AnsiString &value) { _values[subKey][key] = value; return true; } ////////////////////////////////////////////////////////////////////////// -int CBRegistry::readInt(const AnsiString &subKey, const AnsiString &key, int init) { +int BaseRegistry::readInt(const AnsiString &subKey, const AnsiString &key, int init) { if (subKey == "Audio") { if (key == "MasterVolume") { if (ConfMan.hasKey("master_volume")) { @@ -111,7 +111,7 @@ int CBRegistry::readInt(const AnsiString &subKey, const AnsiString &key, int ini ////////////////////////////////////////////////////////////////////////// -bool CBRegistry::writeInt(const AnsiString &subKey, const AnsiString &key, int value) { +bool BaseRegistry::writeInt(const AnsiString &subKey, const AnsiString &key, int value) { if (subKey == "Audio") { if (key == "MasterVolume") { ConfMan.setInt("master_volume", value); @@ -133,19 +133,19 @@ bool CBRegistry::writeInt(const AnsiString &subKey, const AnsiString &key, int v ////////////////////////////////////////////////////////////////////////// -bool CBRegistry::readBool(const AnsiString &subKey, const AnsiString &key, bool init) { +bool BaseRegistry::readBool(const AnsiString &subKey, const AnsiString &key, bool init) { return (readInt(subKey, key, (int)init) != 0); } ////////////////////////////////////////////////////////////////////////// -bool CBRegistry::writeBool(const AnsiString &subKey, const AnsiString &key, bool value) { +bool BaseRegistry::writeBool(const AnsiString &subKey, const AnsiString &key, bool value) { return writeInt(subKey, key, (int)value); } ////////////////////////////////////////////////////////////////////////// -void CBRegistry::setIniName(const char *name) { +void BaseRegistry::setIniName(const char *name) { delete[] _iniName; _iniName = NULL; @@ -160,30 +160,30 @@ void CBRegistry::setIniName(const char *name) { ////////////////////////////////////////////////////////////////////////// -char *CBRegistry::getIniName() { +char *BaseRegistry::getIniName() { return _iniName; } ////////////////////////////////////////////////////////////////////////// -void CBRegistry::loadValues(bool local) { +void BaseRegistry::loadValues(bool local) { if (local) loadXml("settings.xml", _localValues); else loadXml(PathUtil::combine(_gameRef->getDataDir(), "settings.xml"), _values); } ////////////////////////////////////////////////////////////////////////// -void CBRegistry::saveValues() { +void BaseRegistry::saveValues() { saveXml(PathUtil::combine(_gameRef->getDataDir(), "settings.xml"), _values); } ////////////////////////////////////////////////////////////////////////// -void CBRegistry::setBasePath(const char *basePath) { +void BaseRegistry::setBasePath(const char *basePath) { _basePath = PathUtil::getFileNameWithoutExtension(basePath); loadValues(false); } ////////////////////////////////////////////////////////////////////////// -AnsiString CBRegistry::getValue(PathValueMap &values, const AnsiString path, const AnsiString &key, bool &found) { +AnsiString BaseRegistry::getValue(PathValueMap &values, const AnsiString path, const AnsiString &key, bool &found) { found = false; PathValueMap::iterator it = values.find(path); if (it == values.end()) return ""; @@ -198,7 +198,7 @@ AnsiString CBRegistry::getValue(PathValueMap &values, const AnsiString path, con } ////////////////////////////////////////////////////////////////////////// -void CBRegistry::loadXml(const AnsiString fileName, PathValueMap &values) { +void BaseRegistry::loadXml(const AnsiString fileName, PathValueMap &values) { TiXmlDocument doc(fileName.c_str()); if (!doc.LoadFile()) return; @@ -215,8 +215,8 @@ void CBRegistry::loadXml(const AnsiString fileName, PathValueMap &values) { ////////////////////////////////////////////////////////////////////////// -void CBRegistry::saveXml(const AnsiString fileName, PathValueMap &values) { - CBUtils::createPath(fileName.c_str()); +void BaseRegistry::saveXml(const AnsiString fileName, PathValueMap &values) { + BaseUtils::createPath(fileName.c_str()); TiXmlDocument doc; doc.LinkEndChild(new TiXmlDeclaration("1.0", "utf-8", "")); diff --git a/engines/wintermute/base/base_registry.h b/engines/wintermute/base/base_registry.h index 06e052cd03..1d67c18e85 100644 --- a/engines/wintermute/base/base_registry.h +++ b/engines/wintermute/base/base_registry.h @@ -33,7 +33,7 @@ namespace WinterMute { -class CBRegistry : public CBBase { +class BaseRegistry : public BaseClass { public: void setIniName(const char *name); char *getIniName(); @@ -43,8 +43,8 @@ public: int readInt(const AnsiString &subKey, const AnsiString &key, int init = 0); bool writeString(const AnsiString &subKey, const AnsiString &key, const AnsiString &value); AnsiString readString(const AnsiString &subKey, const AnsiString &key, const AnsiString &init = ""); - CBRegistry(CBGame *inGame); - virtual ~CBRegistry(); + BaseRegistry(BaseGame *inGame); + virtual ~BaseRegistry(); void setBasePath(const char *basePath); AnsiString getBasePath() const { diff --git a/engines/wintermute/base/base_save_thumb_helper.cpp b/engines/wintermute/base/base_save_thumb_helper.cpp index bee63aa307..68cfb8a7ea 100644 --- a/engines/wintermute/base/base_save_thumb_helper.cpp +++ b/engines/wintermute/base/base_save_thumb_helper.cpp @@ -34,18 +34,18 @@ namespace WinterMute { ////////////////////////////////////////////////////////////////////////// -CBSaveThumbHelper::CBSaveThumbHelper(CBGame *inGame): CBBase(inGame) { +BaseSaveThumbHelper::BaseSaveThumbHelper(BaseGame *inGame): BaseClass(inGame) { _thumbnail = NULL; } ////////////////////////////////////////////////////////////////////////// -CBSaveThumbHelper::~CBSaveThumbHelper(void) { +BaseSaveThumbHelper::~BaseSaveThumbHelper(void) { delete _thumbnail; _thumbnail = NULL; } ////////////////////////////////////////////////////////////////////////// -bool CBSaveThumbHelper::storeThumbnail(bool doFlip) { +bool BaseSaveThumbHelper::storeThumbnail(bool doFlip) { delete _thumbnail; _thumbnail = NULL; @@ -60,12 +60,12 @@ bool CBSaveThumbHelper::storeThumbnail(bool doFlip) { _gameRef->_renderer->flip(); } - CBImage *screenshot = _gameRef->_renderer->takeScreenshot(); + BaseImage *screenshot = _gameRef->_renderer->takeScreenshot(); if (!screenshot) return STATUS_FAILED; // normal thumbnail if (_gameRef->_thumbnailWidth > 0 && _gameRef->_thumbnailHeight > 0) { - _thumbnail = new CBImage(_gameRef); + _thumbnail = new BaseImage(_gameRef); _thumbnail->copyFrom(screenshot, _gameRef->_thumbnailWidth, _gameRef->_thumbnailHeight); } diff --git a/engines/wintermute/base/base_save_thumb_helper.h b/engines/wintermute/base/base_save_thumb_helper.h index e8cdbdc00d..ef2615a668 100644 --- a/engines/wintermute/base/base_save_thumb_helper.h +++ b/engines/wintermute/base/base_save_thumb_helper.h @@ -33,16 +33,16 @@ namespace WinterMute { -class CBImage; +class BaseImage; -class CBSaveThumbHelper : public CBBase { +class BaseSaveThumbHelper : public BaseClass { public: - CBSaveThumbHelper(CBGame *inGame); - virtual ~CBSaveThumbHelper(void); + BaseSaveThumbHelper(BaseGame *inGame); + virtual ~BaseSaveThumbHelper(void); bool storeThumbnail(bool doFlip = false); - CBImage *_thumbnail; - CBImage *_richThumbnail; + BaseImage *_thumbnail; + BaseImage *_richThumbnail; }; } // end of namespace WinterMute diff --git a/engines/wintermute/base/base_script_holder.cpp b/engines/wintermute/base/base_script_holder.cpp index 5192f76f6e..f803a9191f 100644 --- a/engines/wintermute/base/base_script_holder.cpp +++ b/engines/wintermute/base/base_script_holder.cpp @@ -37,10 +37,10 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CBScriptHolder, false) +IMPLEMENT_PERSISTENT(BaseScriptHolder, false) ////////////////////////////////////////////////////////////////////// -CBScriptHolder::CBScriptHolder(CBGame *inGame): CBScriptable(inGame) { +BaseScriptHolder::BaseScriptHolder(BaseGame *inGame): BaseScriptable(inGame) { setName(""); _freezable = true; @@ -49,13 +49,13 @@ CBScriptHolder::CBScriptHolder(CBGame *inGame): CBScriptable(inGame) { ////////////////////////////////////////////////////////////////////// -CBScriptHolder::~CBScriptHolder() { +BaseScriptHolder::~BaseScriptHolder() { cleanup(); } ////////////////////////////////////////////////////////////////////////// -bool CBScriptHolder::cleanup() { +bool BaseScriptHolder::cleanup() { delete[] _filename; _filename = NULL; @@ -71,7 +71,7 @@ bool CBScriptHolder::cleanup() { } ////////////////////////////////////////////////////////////////////// -void CBScriptHolder::setFilename(const char *filename) { +void BaseScriptHolder::setFilename(const char *filename) { if (_filename != NULL) delete [] _filename; _filename = new char [strlen(filename) + 1]; @@ -80,13 +80,13 @@ void CBScriptHolder::setFilename(const char *filename) { ////////////////////////////////////////////////////////////////////////// -bool CBScriptHolder::applyEvent(const char *eventName, bool unbreakable) { +bool BaseScriptHolder::applyEvent(const char *eventName, bool unbreakable) { int numHandlers = 0; bool ret = STATUS_FAILED; for (int i = 0; i < _scripts.getSize(); i++) { if (!_scripts[i]->_thread) { - CScScript *handler = _scripts[i]->invokeEventHandler(eventName, unbreakable); + ScScript *handler = _scripts[i]->invokeEventHandler(eventName, unbreakable); if (handler) { //_scripts.add(handler); numHandlers++; @@ -101,7 +101,7 @@ bool CBScriptHolder::applyEvent(const char *eventName, bool unbreakable) { ////////////////////////////////////////////////////////////////////////// -bool CBScriptHolder::listen(CBScriptHolder *param1, uint32 param2) { +bool BaseScriptHolder::listen(BaseScriptHolder *param1, uint32 param2) { return STATUS_FAILED; } @@ -109,7 +109,7 @@ bool CBScriptHolder::listen(CBScriptHolder *param1, uint32 param2) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -bool CBScriptHolder::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool BaseScriptHolder::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // DEBUG_CrashMe ////////////////////////////////////////////////////////////////////////// @@ -127,7 +127,7 @@ bool CBScriptHolder::scCallMethod(CScScript *script, CScStack *stack, CScStack * ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "ApplyEvent") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); bool ret; ret = applyEvent(val->getString()); @@ -203,12 +203,12 @@ bool CBScriptHolder::scCallMethod(CScScript *script, CScStack *stack, CScStack * stack->pushBool(ret); return STATUS_OK; - } else return CBScriptable::scCallMethod(script, stack, thisStack, name); + } else return BaseScriptable::scCallMethod(script, stack, thisStack, name); } ////////////////////////////////////////////////////////////////////////// -CScValue *CBScriptHolder::scGetProperty(const char *name) { +ScValue *BaseScriptHolder::scGetProperty(const char *name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// @@ -235,36 +235,36 @@ CScValue *CBScriptHolder::scGetProperty(const char *name) { return _scValue; } - else return CBScriptable::scGetProperty(name); + else return BaseScriptable::scGetProperty(name); } ////////////////////////////////////////////////////////////////////////// -bool CBScriptHolder::scSetProperty(const char *name, CScValue *value) { +bool BaseScriptHolder::scSetProperty(const char *name, ScValue *value) { ////////////////////////////////////////////////////////////////////////// // Name ////////////////////////////////////////////////////////////////////////// if (strcmp(name, "Name") == 0) { setName(value->getString()); return STATUS_OK; - } else return CBScriptable::scSetProperty(name, value); + } else return BaseScriptable::scSetProperty(name, value); } ////////////////////////////////////////////////////////////////////////// -const char *CBScriptHolder::scToString() { +const char *BaseScriptHolder::scToString() { return "[script_holder]"; } ////////////////////////////////////////////////////////////////////////// -bool CBScriptHolder::saveAsText(CBDynBuffer *buffer, int indent) { - return CBBase::saveAsText(buffer, indent); +bool BaseScriptHolder::saveAsText(BaseDynamicBuffer *buffer, int indent) { + return BaseClass::saveAsText(buffer, indent); } ////////////////////////////////////////////////////////////////////////// -bool CBScriptHolder::persist(CBPersistMgr *persistMgr) { - CBScriptable::persist(persistMgr); +bool BaseScriptHolder::persist(BasePersistenceManager *persistMgr) { + BaseScriptable::persist(persistMgr); persistMgr->transfer(TMEMBER(_filename)); persistMgr->transfer(TMEMBER(_freezable)); @@ -276,21 +276,21 @@ bool CBScriptHolder::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -bool CBScriptHolder::addScript(const char *filename) { +bool BaseScriptHolder::addScript(const char *filename) { for (int i = 0; i < _scripts.getSize(); i++) { if (scumm_stricmp(_scripts[i]->_filename, filename) == 0) { if (_scripts[i]->_state != SCRIPT_FINISHED) { - _gameRef->LOG(0, "CBScriptHolder::AddScript - trying to add script '%s' mutiple times (obj: '%s')", filename, _name); + _gameRef->LOG(0, "BaseScriptHolder::AddScript - trying to add script '%s' mutiple times (obj: '%s')", filename, _name); return STATUS_OK; } } } - CScScript *scr = _gameRef->_scEngine->runScript(filename, this); + ScScript *scr = _gameRef->_scEngine->runScript(filename, this); if (!scr) { if (_gameRef->_editorForceScripts) { // editor hack - scr = new CScScript(_gameRef, _gameRef->_scEngine); + scr = new ScScript(_gameRef, _gameRef->_scEngine); scr->_filename = new char[strlen(filename) + 1]; strcpy(scr->_filename, filename); scr->_state = SCRIPT_ERROR; @@ -311,7 +311,7 @@ bool CBScriptHolder::addScript(const char *filename) { ////////////////////////////////////////////////////////////////////////// -bool CBScriptHolder::removeScript(CScScript *script) { +bool BaseScriptHolder::removeScript(ScScript *script) { for (int i = 0; i < _scripts.getSize(); i++) { if (_scripts[i] == script) { _scripts.removeAt(i); @@ -322,7 +322,7 @@ bool CBScriptHolder::removeScript(CScScript *script) { } ////////////////////////////////////////////////////////////////////////// -bool CBScriptHolder::canHandleEvent(const char *EventName) { +bool BaseScriptHolder::canHandleEvent(const char *EventName) { for (int i = 0; i < _scripts.getSize(); i++) { if (!_scripts[i]->_thread && _scripts[i]->canHandleEvent(EventName)) return true; } @@ -331,7 +331,7 @@ bool CBScriptHolder::canHandleEvent(const char *EventName) { ////////////////////////////////////////////////////////////////////////// -bool CBScriptHolder::canHandleMethod(const char *MethodName) { +bool BaseScriptHolder::canHandleMethod(const char *MethodName) { for (int i = 0; i < _scripts.getSize(); i++) { if (!_scripts[i]->_thread && _scripts[i]->canHandleMethod(MethodName)) return true; } @@ -345,7 +345,7 @@ TOKEN_DEF(NAME) TOKEN_DEF(VALUE) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -bool CBScriptHolder::parseProperty(byte *buffer, bool complete) { +bool BaseScriptHolder::parseProperty(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(PROPERTY) TOKEN_TABLE(NAME) @@ -354,7 +354,7 @@ bool CBScriptHolder::parseProperty(byte *buffer, bool complete) { byte *params; int cmd; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); if (complete) { if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_PROPERTY) { @@ -403,7 +403,7 @@ bool CBScriptHolder::parseProperty(byte *buffer, bool complete) { } - CScValue *val = new CScValue(_gameRef); + ScValue *val = new ScValue(_gameRef); val->setString(propValue); scSetProperty(propName, val); @@ -418,7 +418,7 @@ bool CBScriptHolder::parseProperty(byte *buffer, bool complete) { ////////////////////////////////////////////////////////////////////////// -void CBScriptHolder::makeFreezable(bool freezable) { +void BaseScriptHolder::makeFreezable(bool freezable) { _freezable = freezable; for (int i = 0; i < _scripts.getSize(); i++) _scripts[i]->_freezable = freezable; @@ -427,11 +427,11 @@ void CBScriptHolder::makeFreezable(bool freezable) { ////////////////////////////////////////////////////////////////////////// -CScScript *CBScriptHolder::invokeMethodThread(const char *methodName) { +ScScript *BaseScriptHolder::invokeMethodThread(const char *methodName) { for (int i = _scripts.getSize() - 1; i >= 0; i--) { if (_scripts[i]->canHandleMethod(methodName)) { - CScScript *thread = new CScScript(_gameRef, _scripts[i]->_engine); + ScScript *thread = new ScScript(_gameRef, _scripts[i]->_engine); if (thread) { bool ret = thread->createMethodThread(_scripts[i], methodName); if (DID_SUCCEED(ret)) { @@ -450,7 +450,7 @@ CScScript *CBScriptHolder::invokeMethodThread(const char *methodName) { ////////////////////////////////////////////////////////////////////////// -void CBScriptHolder::scDebuggerDesc(char *buf, int bufSize) { +void BaseScriptHolder::scDebuggerDesc(char *buf, int bufSize) { strcpy(buf, scToString()); if (_name && strcmp(_name, "") != 0) { strcat(buf, " Name: "); @@ -466,7 +466,7 @@ void CBScriptHolder::scDebuggerDesc(char *buf, int bufSize) { ////////////////////////////////////////////////////////////////////////// // IWmeObject ////////////////////////////////////////////////////////////////////////// -bool CBScriptHolder::sendEvent(const char *eventName) { +bool BaseScriptHolder::sendEvent(const char *eventName) { return DID_SUCCEED(applyEvent(eventName)); } diff --git a/engines/wintermute/base/base_script_holder.h b/engines/wintermute/base/base_script_holder.h index 0e5bc1b7ec..52711572c1 100644 --- a/engines/wintermute/base/base_script_holder.h +++ b/engines/wintermute/base/base_script_holder.h @@ -35,21 +35,21 @@ namespace WinterMute { -class CBScriptHolder : public CBScriptable { +class BaseScriptHolder : public BaseScriptable { public: - DECLARE_PERSISTENT(CBScriptHolder, CBScriptable) + DECLARE_PERSISTENT(BaseScriptHolder, BaseScriptable) - CBScriptHolder(CBGame *inGame); - virtual ~CBScriptHolder(); - virtual CScScript *invokeMethodThread(const char *methodName); + BaseScriptHolder(BaseGame *inGame); + virtual ~BaseScriptHolder(); + virtual ScScript *invokeMethodThread(const char *methodName); virtual void makeFreezable(bool freezable); bool canHandleEvent(const char *eventName); virtual bool canHandleMethod(const char *eventMethod); bool cleanup(); - bool removeScript(CScScript *script); + bool removeScript(ScScript *script); bool addScript(const char *filename); - virtual bool saveAsText(CBDynBuffer *buffer, int indent); - virtual bool listen(CBScriptHolder *param1, uint32 param2); + virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent); + virtual bool listen(BaseScriptHolder *param1, uint32 param2); bool applyEvent(const char *eventName, bool unbreakable = false); void setFilename(const char *filename); bool parseProperty(byte *buffer, bool complete = true); @@ -57,11 +57,11 @@ public: bool _freezable; bool _ready; - CBArray _scripts; + BaseArray _scripts; // scripting interface - virtual CScValue *scGetProperty(const char *name); - virtual bool scSetProperty(const char *name, CScValue *value); - virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual ScValue *scGetProperty(const char *name); + virtual bool scSetProperty(const char *name, ScValue *value); + virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); virtual const char *scToString(); virtual void scDebuggerDesc(char *buf, int bufSize); // IWmeObject diff --git a/engines/wintermute/base/base_scriptable.cpp b/engines/wintermute/base/base_scriptable.cpp index e9489fa407..6da67db3fb 100644 --- a/engines/wintermute/base/base_scriptable.cpp +++ b/engines/wintermute/base/base_scriptable.cpp @@ -33,14 +33,14 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CBScriptable, false) +IMPLEMENT_PERSISTENT(BaseScriptable, false) ////////////////////////////////////////////////////////////////////////// -CBScriptable::CBScriptable(CBGame *inGame, bool noValue, bool persistable): CBNamedObject(inGame) { +BaseScriptable::BaseScriptable(BaseGame *inGame, bool noValue, bool persistable): BaseNamedObject(inGame) { _refCount = 0; if (noValue) _scValue = NULL; - else _scValue = new CScValue(_gameRef); + else _scValue = new ScValue(_gameRef); _persistable = persistable; @@ -49,7 +49,7 @@ CBScriptable::CBScriptable(CBGame *inGame, bool noValue, bool persistable): CBNa ////////////////////////////////////////////////////////////////////////// -CBScriptable::~CBScriptable() { +BaseScriptable::~BaseScriptable() { //if(_refCount>0) _gameRef->LOG(0, "Warning: Destroying object, _refCount=%d", _refCount); delete _scValue; delete _scProp; @@ -61,7 +61,7 @@ CBScriptable::~CBScriptable() { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -bool CBScriptable::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool BaseScriptable::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) { /* stack->correctParams(0); stack->pushNULL(); @@ -74,72 +74,72 @@ bool CBScriptable::scCallMethod(CScScript *script, CScStack *stack, CScStack *th ////////////////////////////////////////////////////////////////////////// -CScValue *CBScriptable::scGetProperty(const char *name) { - if (!_scProp) _scProp = new CScValue(_gameRef); +ScValue *BaseScriptable::scGetProperty(const char *name) { + if (!_scProp) _scProp = new ScValue(_gameRef); if (_scProp) return _scProp->getProp(name); else return NULL; } ////////////////////////////////////////////////////////////////////////// -bool CBScriptable::scSetProperty(const char *name, CScValue *value) { - if (!_scProp) _scProp = new CScValue(_gameRef); +bool BaseScriptable::scSetProperty(const char *name, ScValue *value) { + if (!_scProp) _scProp = new ScValue(_gameRef); if (_scProp) return _scProp->setProp(name, value); else return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -const char *CBScriptable::scToString() { +const char *BaseScriptable::scToString() { return "[native object]"; } ////////////////////////////////////////////////////////////////////////// -void *CBScriptable::scToMemBuffer() { +void *BaseScriptable::scToMemBuffer() { return (void *)NULL; } ////////////////////////////////////////////////////////////////////////// -int CBScriptable::scToInt() { +int BaseScriptable::scToInt() { return 0; } ////////////////////////////////////////////////////////////////////////// -double CBScriptable::scToFloat() { +double BaseScriptable::scToFloat() { return 0.0f; } ////////////////////////////////////////////////////////////////////////// -bool CBScriptable::scToBool() { +bool BaseScriptable::scToBool() { return false; } ////////////////////////////////////////////////////////////////////////// -void CBScriptable::scSetString(const char *val) { +void BaseScriptable::scSetString(const char *val) { } ////////////////////////////////////////////////////////////////////////// -void CBScriptable::scSetInt(int val) { +void BaseScriptable::scSetInt(int val) { } ////////////////////////////////////////////////////////////////////////// -void CBScriptable::scSetFloat(double val) { +void BaseScriptable::scSetFloat(double val) { } ////////////////////////////////////////////////////////////////////////// -void CBScriptable::scSetBool(bool val) { +void BaseScriptable::scSetBool(bool val) { } ////////////////////////////////////////////////////////////////////////// -bool CBScriptable::persist(CBPersistMgr *persistMgr) { +bool BaseScriptable::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_gameRef)); persistMgr->transfer(TMEMBER(_refCount)); persistMgr->transfer(TMEMBER(_scProp)); @@ -150,25 +150,25 @@ bool CBScriptable::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -int CBScriptable::scCompare(CBScriptable *val) { +int BaseScriptable::scCompare(BaseScriptable *val) { if (this < val) return -1; else if (this > val) return 1; else return 0; } ////////////////////////////////////////////////////////////////////////// -void CBScriptable::scDebuggerDesc(char *buf, int bufSize) { +void BaseScriptable::scDebuggerDesc(char *buf, int bufSize) { strcpy(buf, scToString()); } ////////////////////////////////////////////////////////////////////////// -bool CBScriptable::canHandleMethod(const char *eventMethod) { +bool BaseScriptable::canHandleMethod(const char *eventMethod) { return false; } ////////////////////////////////////////////////////////////////////////// -CScScript *CBScriptable::invokeMethodThread(const char *methodName) { +ScScript *BaseScriptable::invokeMethodThread(const char *methodName) { return NULL; } @@ -176,12 +176,12 @@ CScScript *CBScriptable::invokeMethodThread(const char *methodName) { ////////////////////////////////////////////////////////////////////////// // IWmeDebugObject ////////////////////////////////////////////////////////////////////////// -const char *CBScriptable::dbgGetNativeClass() { +const char *BaseScriptable::dbgGetNativeClass() { return getClassName(); } ////////////////////////////////////////////////////////////////////////// -IWmeDebugProp *CBScriptable::dbgGetProperty(const char *name) { +IWmeDebugProp *BaseScriptable::dbgGetProperty(const char *name) { return scGetProperty(name); } diff --git a/engines/wintermute/base/base_scriptable.h b/engines/wintermute/base/base_scriptable.h index 166f3c0bd1..b9283ed349 100644 --- a/engines/wintermute/base/base_scriptable.h +++ b/engines/wintermute/base/base_scriptable.h @@ -36,23 +36,23 @@ namespace WinterMute { -class CScValue; -class CScStack; -class CScScript; +class ScValue; +class ScStack; +class ScScript; -class CBScriptable : public CBNamedObject, public IWmeDebugObject { +class BaseScriptable : public BaseNamedObject, public IWmeDebugObject { public: - virtual CScScript *invokeMethodThread(const char *methodName); - DECLARE_PERSISTENT(CBScriptable, CBNamedObject) + virtual ScScript *invokeMethodThread(const char *methodName); + DECLARE_PERSISTENT(BaseScriptable, BaseNamedObject) - CBScriptable(CBGame *inGame, bool noValue = false, bool persistable = true); - virtual ~CBScriptable(); + BaseScriptable(BaseGame *inGame, bool noValue = false, bool persistable = true); + virtual ~BaseScriptable(); // high level scripting interface virtual bool canHandleMethod(const char *eventMethod); - virtual bool scSetProperty(const char *name, CScValue *value); - virtual CScValue *scGetProperty(const char *name); - virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual bool scSetProperty(const char *name, ScValue *value); + virtual ScValue *scGetProperty(const char *name); + virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); virtual const char *scToString(); virtual void *scToMemBuffer(); virtual int scToInt(); @@ -62,11 +62,11 @@ public: virtual void scSetInt(int val); virtual void scSetFloat(double val); virtual void scSetBool(bool val); - virtual int scCompare(CBScriptable *val); + virtual int scCompare(BaseScriptable *val); virtual void scDebuggerDesc(char *buf, int bufSize); int _refCount; - CScValue *_scValue; - CScValue *_scProp; + ScValue *_scValue; + ScValue *_scProp; public: // IWmeDebugObject @@ -76,14 +76,14 @@ public: }; // Implemented in their respective .cpp-files -CBScriptable *makeSXArray(CBGame *inGame, CScStack *stack); -CBScriptable *makeSXDate(CBGame *inGame, CScStack *stack); -CBScriptable *makeSXFile(CBGame *inGame, CScStack *stack); -CBScriptable *makeSXMath(CBGame *inGame); -CBScriptable *makeSXMemBuffer(CBGame *inGame, CScStack *stack); -CBScriptable *makeSXObject(CBGame *inGame, CScStack *stack); -CBScriptable *makeSXStore(CBGame *inGame); -CBScriptable *makeSXString(CBGame *inGame, CScStack *stack); +BaseScriptable *makeSXArray(BaseGame *inGame, ScStack *stack); +BaseScriptable *makeSXDate(BaseGame *inGame, ScStack *stack); +BaseScriptable *makeSXFile(BaseGame *inGame, ScStack *stack); +BaseScriptable *makeSXMath(BaseGame *inGame); +BaseScriptable *makeSXMemBuffer(BaseGame *inGame, ScStack *stack); +BaseScriptable *makeSXObject(BaseGame *inGame, ScStack *stack); +BaseScriptable *makeSXStore(BaseGame *inGame); +BaseScriptable *makeSXString(BaseGame *inGame, ScStack *stack); } // end of namespace WinterMute diff --git a/engines/wintermute/base/base_sprite.cpp b/engines/wintermute/base/base_sprite.cpp index ba55d1b88b..046a40bacf 100644 --- a/engines/wintermute/base/base_sprite.cpp +++ b/engines/wintermute/base/base_sprite.cpp @@ -45,10 +45,10 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CBSprite, false) +IMPLEMENT_PERSISTENT(BaseSprite, false) ////////////////////////////////////////////////////////////////////// -CBSprite::CBSprite(CBGame *inGame, CBObject *Owner): CBScriptHolder(inGame) { +BaseSprite::BaseSprite(BaseGame *inGame, BaseObject *Owner): BaseScriptHolder(inGame) { _editorAllFrames = false; _owner = Owner; setDefaults(); @@ -56,13 +56,13 @@ CBSprite::CBSprite(CBGame *inGame, CBObject *Owner): CBScriptHolder(inGame) { ////////////////////////////////////////////////////////////////////// -CBSprite::~CBSprite() { +BaseSprite::~BaseSprite() { cleanup(); } ////////////////////////////////////////////////////////////////////////// -void CBSprite::setDefaults() { +void BaseSprite::setDefaults() { _currentFrame = -1; _looping = false; _lastFrameTime = 0; @@ -87,8 +87,8 @@ void CBSprite::setDefaults() { ////////////////////////////////////////////////////////////////////////// -void CBSprite::cleanup() { - CBScriptHolder::cleanup(); +void BaseSprite::cleanup() { + BaseScriptHolder::cleanup(); for (int i = 0; i < _frames.getSize(); i++) delete _frames[i]; @@ -102,7 +102,7 @@ void CBSprite::cleanup() { ////////////////////////////////////////////////////////////////////////// -bool CBSprite::draw(int x, int y, CBObject *registerOwner, float zoomX, float zoomY, uint32 alpha) { +bool BaseSprite::draw(int x, int y, BaseObject *registerOwner, float zoomX, float zoomY, uint32 alpha) { GetCurrentFrame(zoomX, zoomY); if (_currentFrame < 0 || _currentFrame >= _frames.getSize()) return STATUS_OK; @@ -122,10 +122,10 @@ bool CBSprite::draw(int x, int y, CBObject *registerOwner, float zoomX, float zo ////////////////////////////////////////////////////////////////////// -bool CBSprite::loadFile(const char *filename, int lifeTime, TSpriteCacheType cacheType) { +bool BaseSprite::loadFile(const char *filename, int lifeTime, TSpriteCacheType cacheType) { Common::SeekableReadStream *file = _gameRef->_fileManager->openFile(filename); if (!file) { - _gameRef->LOG(0, "CBSprite::LoadFile failed for file '%s'", filename); + _gameRef->LOG(0, "BaseSprite::LoadFile failed for file '%s'", filename); if (_gameRef->_debugDebugMode) return loadFile("invalid_debug.bmp", lifeTime, cacheType); else return loadFile("invalid.bmp", lifeTime, cacheType); } else { @@ -137,8 +137,8 @@ bool CBSprite::loadFile(const char *filename, int lifeTime, TSpriteCacheType cac AnsiString ext = PathUtil::getExtension(filename); if (StringUtil::startsWith(filename, "savegame:", true) || StringUtil::compareNoCase(ext, "bmp") || StringUtil::compareNoCase(ext, "tga") || StringUtil::compareNoCase(ext, "png") || StringUtil::compareNoCase(ext, "jpg")) { - CBFrame *frame = new CBFrame(_gameRef); - CBSubFrame *subframe = new CBSubFrame(_gameRef); + BaseFrame *frame = new BaseFrame(_gameRef); + BaseSubFrame *subframe = new BaseSubFrame(_gameRef); subframe->setSurface(filename, true, 0, 0, 0, lifeTime, true); if (subframe->_surface == NULL) { _gameRef->LOG(0, "Error loading simple sprite '%s'", filename); @@ -146,7 +146,7 @@ bool CBSprite::loadFile(const char *filename, int lifeTime, TSpriteCacheType cac delete frame; delete subframe; } else { - CBPlatform::setRect(&subframe->_rect, 0, 0, subframe->_surface->getWidth(), subframe->_surface->getHeight()); + BasePlatform::setRect(&subframe->_rect, 0, 0, subframe->_surface->getWidth(), subframe->_surface->getHeight()); frame->_subframes.add(subframe); _frames.add(frame); _currentFrame = 0; @@ -187,7 +187,7 @@ TOKEN_DEF(EDITOR_BG_ALPHA) TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////// -bool CBSprite::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteCacheType cacheType) { +bool BaseSprite::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteCacheType cacheType) { TOKEN_TABLE_START(commands) TOKEN_TABLE(CONTINUOUS) TOKEN_TABLE(SPRITE) @@ -208,7 +208,7 @@ bool CBSprite::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteCach byte *params; int cmd; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); cleanup(); @@ -222,7 +222,7 @@ bool CBSprite::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteCach } int frameCount = 1; - CBFrame *frame; + BaseFrame *frame; while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)¶ms)) > 0) { switch (cmd) { case TOKEN_CONTINUOUS: @@ -287,7 +287,7 @@ bool CBSprite::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteCach int FrameLifeTime = lifeTime; if (cacheType == CACHE_HALF && frameCount % 2 != 1) FrameLifeTime = -1; - frame = new CBFrame(_gameRef); + frame = new BaseFrame(_gameRef); if (DID_FAIL(frame->loadBuffer(params, FrameLifeTime, _streamedKeepLoaded))) { delete frame; @@ -318,7 +318,7 @@ bool CBSprite::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteCach ////////////////////////////////////////////////////////////////////// -void CBSprite::reset() { +void BaseSprite::reset() { if (_frames.getSize() > 0) _currentFrame = 0; else _currentFrame = -1; @@ -331,7 +331,7 @@ void CBSprite::reset() { ////////////////////////////////////////////////////////////////////// -bool CBSprite::GetCurrentFrame(float zoomX, float zoomY) { +bool BaseSprite::GetCurrentFrame(float zoomX, float zoomY) { //if(_owner && _owner->_freezable && _gameRef->_state == GAME_FROZEN) return true; if (_currentFrame == -1) return false; @@ -383,7 +383,7 @@ bool CBSprite::GetCurrentFrame(float zoomX, float zoomY) { ////////////////////////////////////////////////////////////////////// -bool CBSprite::display(int X, int Y, CBObject *Register, float ZoomX, float ZoomY, uint32 Alpha, float Rotate, TSpriteBlendMode BlendMode) { +bool BaseSprite::display(int X, int Y, BaseObject *Register, float ZoomX, float ZoomY, uint32 Alpha, float Rotate, TSpriteBlendMode BlendMode) { if (_currentFrame < 0 || _currentFrame >= _frames.getSize()) return STATUS_OK; // on change... @@ -401,34 +401,34 @@ bool CBSprite::display(int X, int Y, CBObject *Register, float ZoomX, float Zoom ////////////////////////////////////////////////////////////////////////// -CBSurface *CBSprite::getSurface() { +BaseSurface *BaseSprite::getSurface() { // only used for animated textures for 3D models if (_currentFrame < 0 || _currentFrame >= _frames.getSize()) return NULL; - CBFrame *Frame = _frames[_currentFrame]; + BaseFrame *Frame = _frames[_currentFrame]; if (Frame && Frame->_subframes.getSize() > 0) { - CBSubFrame *Subframe = Frame->_subframes[0]; + BaseSubFrame *Subframe = Frame->_subframes[0]; if (Subframe) return Subframe->_surface; else return NULL; } else return NULL; } ////////////////////////////////////////////////////////////////////////// -bool CBSprite::getBoundingRect(Rect32 *rect, int x, int y, float scaleX, float scaleY) { +bool BaseSprite::getBoundingRect(Rect32 *rect, int x, int y, float scaleX, float scaleY) { if (!rect) return false; - CBPlatform::setRectEmpty(rect); + BasePlatform::setRectEmpty(rect); for (int i = 0; i < _frames.getSize(); i++) { Rect32 frame; Rect32 temp; - CBPlatform::copyRect(&temp, rect); + BasePlatform::copyRect(&temp, rect); _frames[i]->getBoundingRect(&frame, x, y, scaleX, scaleY); - CBPlatform::unionRect(rect, &temp, &frame); + BasePlatform::unionRect(rect, &temp, &frame); } return true; } ////////////////////////////////////////////////////////////////////////// -bool CBSprite::saveAsText(CBDynBuffer *buffer, int indent) { +bool BaseSprite::saveAsText(BaseDynamicBuffer *buffer, int indent) { buffer->putTextIndent(indent, "SPRITE {\n"); buffer->putTextIndent(indent + 2, "NAME=\"%s\"\n", _name); buffer->putTextIndent(indent + 2, "LOOPING=%s\n", _looping ? "TRUE" : "FALSE"); @@ -451,7 +451,7 @@ bool CBSprite::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent + 2, "EDITOR_BG_ALPHA=%d\n", _editorBgAlpha); } - CBScriptHolder::saveAsText(buffer, indent + 2); + BaseScriptHolder::saveAsText(buffer, indent + 2); int i; @@ -472,8 +472,8 @@ bool CBSprite::saveAsText(CBDynBuffer *buffer, int indent) { ////////////////////////////////////////////////////////////////////////// -bool CBSprite::persist(CBPersistMgr *persistMgr) { - CBScriptHolder::persist(persistMgr); +bool BaseSprite::persist(BasePersistenceManager *persistMgr) { + BaseScriptHolder::persist(persistMgr); persistMgr->transfer(TMEMBER(_canBreak)); persistMgr->transfer(TMEMBER(_changed)); @@ -507,7 +507,7 @@ bool CBSprite::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -bool CBSprite::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool BaseSprite::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // GetFrame ////////////////////////////////////////////////////////////////////////// @@ -526,14 +526,14 @@ bool CBSprite::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSt ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "DeleteFrame") == 0) { stack->correctParams(1); - CScValue *Val = stack->pop(); + ScValue *Val = stack->pop(); if (Val->isInt()) { int Index = Val->getInt(-1); if (Index < 0 || Index >= _frames.getSize()) { script->runtimeError("Sprite.DeleteFrame: Frame index %d is out of range.", Index); } } else { - CBFrame *Frame = (CBFrame *)Val->getNative(); + BaseFrame *Frame = (BaseFrame *)Val->getNative(); for (int i = 0; i < _frames.getSize(); i++) { if (_frames[i] == Frame) { if (i == _currentFrame) _lastFrameTime = 0; @@ -562,13 +562,13 @@ bool CBSprite::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSt ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "AddFrame") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); const char *filename = NULL; if (!val->isNULL()) filename = val->getString(); - CBFrame *frame = new CBFrame(_gameRef); + BaseFrame *frame = new BaseFrame(_gameRef); if (filename != NULL) { - CBSubFrame *sub = new CBSubFrame(_gameRef); + BaseSubFrame *sub = new BaseSubFrame(_gameRef); if (DID_SUCCEED(sub->setSurface(filename))) { sub->setDefaultRect(); frame->_subframes.add(sub); @@ -589,14 +589,14 @@ bool CBSprite::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSt if (index < 0) index = 0; - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); const char *filename = NULL; if (!val->isNULL()) filename = val->getString(); - CBFrame *frame = new CBFrame(_gameRef); + BaseFrame *frame = new BaseFrame(_gameRef); if (filename != NULL) { - CBSubFrame *sub = new CBSubFrame(_gameRef); + BaseSubFrame *sub = new BaseSubFrame(_gameRef); if (DID_SUCCEED(sub->setSurface(filename))) frame->_subframes.add(sub); else delete sub; } @@ -629,12 +629,12 @@ bool CBSprite::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSt return STATUS_OK; } - else return CBScriptHolder::scCallMethod(script, stack, thisStack, name); + else return BaseScriptHolder::scCallMethod(script, stack, thisStack, name); } ////////////////////////////////////////////////////////////////////////// -CScValue *CBSprite::scGetProperty(const char *name) { +ScValue *BaseSprite::scGetProperty(const char *name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// @@ -702,12 +702,12 @@ CScValue *CBSprite::scGetProperty(const char *name) { return _scValue; } - else return CBScriptHolder::scGetProperty(name); + else return BaseScriptHolder::scGetProperty(name); } ////////////////////////////////////////////////////////////////////////// -bool CBSprite::scSetProperty(const char *name, CScValue *value) { +bool BaseSprite::scSetProperty(const char *name, ScValue *value) { ////////////////////////////////////////////////////////////////////////// // CurrentFrame ////////////////////////////////////////////////////////////////////////// @@ -736,18 +736,18 @@ bool CBSprite::scSetProperty(const char *name, CScValue *value) { return STATUS_OK; } - else return CBScriptHolder::scSetProperty(name, value); + else return BaseScriptHolder::scSetProperty(name, value); } ////////////////////////////////////////////////////////////////////////// -const char *CBSprite::scToString() { +const char *BaseSprite::scToString() { return "[sprite]"; } ////////////////////////////////////////////////////////////////////////// -bool CBSprite::killAllSounds() { +bool BaseSprite::killAllSounds() { for (int i = 0; i < _frames.getSize(); i++) { if (_frames[i]->_sound) _frames[i]->_sound->stop(); diff --git a/engines/wintermute/base/base_sprite.h b/engines/wintermute/base/base_sprite.h index 8f3ce84eb4..6ddec287d6 100644 --- a/engines/wintermute/base/base_sprite.h +++ b/engines/wintermute/base/base_sprite.h @@ -34,13 +34,13 @@ #include "engines/wintermute/base/base_script_holder.h" namespace WinterMute { -class CBFrame; -class CBSurface; -class CBObject; -class CBSprite: public CBScriptHolder { +class BaseFrame; +class BaseSurface; +class BaseObject; +class BaseSprite: public BaseScriptHolder { public: bool killAllSounds(); - CBSurface *getSurface(); + BaseSurface *getSurface(); char *_editorBgFile; int _editorBgOffsetX; int _editorBgOffsetY; @@ -50,38 +50,38 @@ public: void cleanup(); void setDefaults(); bool _precise; - DECLARE_PERSISTENT(CBSprite, CBScriptHolder) + DECLARE_PERSISTENT(BaseSprite, BaseScriptHolder) bool _editorAllFrames; bool getBoundingRect(Rect32 *rect, int x, int y, float scaleX = 100, float scaleY = 100); int _moveY; int _moveX; - bool display(int x, int y, CBObject *registerOwner = NULL, float zoomX = 100, float zoomY = 100, uint32 alpha = 0xFFFFFFFF, float rotate = 0.0f, TSpriteBlendMode blendMode = BLEND_NORMAL); + bool display(int x, int y, BaseObject *registerOwner = NULL, float zoomX = 100, float zoomY = 100, uint32 alpha = 0xFFFFFFFF, float rotate = 0.0f, TSpriteBlendMode blendMode = BLEND_NORMAL); bool GetCurrentFrame(float zoomX = 100, float zoomY = 100); bool _canBreak; bool _editorMuted; bool _continuous; void reset(); - CBObject *_owner; + BaseObject *_owner; bool _changed; bool _paused; bool _finished; bool loadBuffer(byte *buffer, bool compete = true, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL); bool loadFile(const char *filename, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL); uint32 _lastFrameTime; - bool draw(int x, int y, CBObject *Register = NULL, float zoomX = 100, float zoomY = 100, uint32 alpha = 0xFFFFFFFF); + bool draw(int x, int y, BaseObject *Register = NULL, float zoomX = 100, float zoomY = 100, uint32 alpha = 0xFFFFFFFF); bool _looping; int _currentFrame; bool addFrame(const char *filename, uint32 delay = 0, int hotspotX = 0, int hotspotY = 0, Rect32 *rect = NULL); - CBSprite(CBGame *inGame, CBObject *owner = NULL); - virtual ~CBSprite(); - CBArray _frames; - bool saveAsText(CBDynBuffer *buffer, int indent); + BaseSprite(BaseGame *inGame, BaseObject *owner = NULL); + virtual ~BaseSprite(); + BaseArray _frames; + bool saveAsText(BaseDynamicBuffer *buffer, int indent); // scripting interface - virtual CScValue *scGetProperty(const char *name); - virtual bool scSetProperty(const char *name, CScValue *value); - virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual ScValue *scGetProperty(const char *name); + virtual bool scSetProperty(const char *name, ScValue *value); + virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); virtual const char *scToString(); }; diff --git a/engines/wintermute/base/base_string_table.cpp b/engines/wintermute/base/base_string_table.cpp index c7789add9d..7ac79d4745 100644 --- a/engines/wintermute/base/base_string_table.cpp +++ b/engines/wintermute/base/base_string_table.cpp @@ -36,13 +36,13 @@ namespace WinterMute { ////////////////////////////////////////////////////////////////////////// -CBStringTable::CBStringTable(CBGame *inGame): CBBase(inGame) { +BaseStringTable::BaseStringTable(BaseGame *inGame): BaseClass(inGame) { } ////////////////////////////////////////////////////////////////////////// -CBStringTable::~CBStringTable() { +BaseStringTable::~BaseStringTable() { // delete strings _strings.clear(); @@ -50,7 +50,7 @@ CBStringTable::~CBStringTable() { ////////////////////////////////////////////////////////////////////////// -bool CBStringTable::addString(const char *key, const char *val, bool reportDuplicities) { +bool BaseStringTable::addString(const char *key, const char *val, bool reportDuplicities) { if (key == NULL || val == NULL) return STATUS_FAILED; if (scumm_stricmp(key, "@right-to-left") == 0) { @@ -70,7 +70,7 @@ bool CBStringTable::addString(const char *key, const char *val, bool reportDupli } ////////////////////////////////////////////////////////////////////////// -char *CBStringTable::getKey(const char *str) { +char *BaseStringTable::getKey(const char *str) { if (str == NULL || str[0] != '/') return NULL; const char *value = strchr(str + 1, '/'); @@ -79,7 +79,7 @@ char *CBStringTable::getKey(const char *str) { char *key = new char[value - str]; strncpy(key, str + 1, value - str - 1); key[value - str - 1] = '\0'; - CBPlatform::strlwr(key); + BasePlatform::strlwr(key); char *new_str; @@ -102,7 +102,7 @@ char *CBStringTable::getKey(const char *str) { } ////////////////////////////////////////////////////////////////////////// -void CBStringTable::expand(char **str, bool forceExpand) { +void BaseStringTable::expand(char **str, bool forceExpand) { if (_gameRef->_doNotExpandStrings && !forceExpand) return; if (str == NULL || *str == NULL || *str[0] != '/') return; @@ -113,7 +113,7 @@ void CBStringTable::expand(char **str, bool forceExpand) { char *key = new char[value - *str]; strncpy(key, *str + 1, value - *str - 1); key[value - *str - 1] = '\0'; - CBPlatform::strlwr(key); + BasePlatform::strlwr(key); value++; @@ -137,7 +137,7 @@ void CBStringTable::expand(char **str, bool forceExpand) { ////////////////////////////////////////////////////////////////////////// -const char *CBStringTable::expandStatic(const char *string, bool forceExpand) { +const char *BaseStringTable::expandStatic(const char *string, bool forceExpand) { if (_gameRef->_doNotExpandStrings && !forceExpand) return string; if (string == NULL || string[0] == '\0' || string[0] != '/') return string; @@ -148,7 +148,7 @@ const char *CBStringTable::expandStatic(const char *string, bool forceExpand) { char *key = new char[value - string]; strncpy(key, string + 1, value - string - 1); key[value - string - 1] = '\0'; - CBPlatform::strlwr(key); + BasePlatform::strlwr(key); value++; @@ -169,7 +169,7 @@ const char *CBStringTable::expandStatic(const char *string, bool forceExpand) { ////////////////////////////////////////////////////////////////////////// -bool CBStringTable::loadFile(const char *filename, bool clearOld) { +bool BaseStringTable::loadFile(const char *filename, bool clearOld) { _gameRef->LOG(0, "Loading string table..."); if (clearOld) _strings.clear(); @@ -177,7 +177,7 @@ bool CBStringTable::loadFile(const char *filename, bool clearOld) { uint32 size; byte *buffer = _gameRef->_fileManager->readWholeFile(filename, &size); if (buffer == NULL) { - _gameRef->LOG(0, "CBStringTable::LoadFile failed for file '%s'", filename); + _gameRef->LOG(0, "BaseStringTable::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } diff --git a/engines/wintermute/base/base_string_table.h b/engines/wintermute/base/base_string_table.h index c612c33a41..ac46aaee43 100644 --- a/engines/wintermute/base/base_string_table.h +++ b/engines/wintermute/base/base_string_table.h @@ -35,14 +35,14 @@ namespace WinterMute { -class CBStringTable : public CBBase { +class BaseStringTable : public BaseClass { public: const char *expandStatic(const char *string, bool forceExpand = false); bool loadFile(const char *filename, bool deleteAll = true); void expand(char **str, bool forceExpand = false); bool addString(const char *key, const char *val, bool reportDuplicities = true); - CBStringTable(CBGame *inGame); - virtual ~CBStringTable(); + BaseStringTable(BaseGame *inGame); + virtual ~BaseStringTable(); Common::HashMap _strings; char *getKey(const char *str); private: diff --git a/engines/wintermute/base/base_sub_frame.cpp b/engines/wintermute/base/base_sub_frame.cpp index adce6c6b75..d6a8c2490f 100644 --- a/engines/wintermute/base/base_sub_frame.cpp +++ b/engines/wintermute/base/base_sub_frame.cpp @@ -40,16 +40,16 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CBSubFrame, false) +IMPLEMENT_PERSISTENT(BaseSubFrame, false) ////////////////////////////////////////////////////////////////////////// -CBSubFrame::CBSubFrame(CBGame *inGame): CBScriptable(inGame, true) { +BaseSubFrame::BaseSubFrame(BaseGame *inGame): BaseScriptable(inGame, true) { _surface = NULL; _hotspotX = _hotspotY = 0; _alpha = 0xFFFFFFFF; _transparent = 0xFFFF00FF; - CBPlatform::setRectEmpty(&_rect); + BasePlatform::setRectEmpty(&_rect); _editorSelected = false; @@ -67,7 +67,7 @@ CBSubFrame::CBSubFrame(CBGame *inGame): CBScriptable(inGame, true) { ////////////////////////////////////////////////////////////////////////// -CBSubFrame::~CBSubFrame() { +BaseSubFrame::~BaseSubFrame() { if (_surface) _gameRef->_surfaceStorage->removeSurface(_surface); delete[] _surfaceFilename; _surfaceFilename = NULL; @@ -90,7 +90,7 @@ TOKEN_DEF(EDITOR_SELECTED) TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////// -bool CBSubFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) { +bool BaseSubFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) { TOKEN_TABLE_START(commands) TOKEN_TABLE(IMAGE) TOKEN_TABLE(TRANSPARENT) @@ -109,12 +109,12 @@ bool CBSubFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) { char *params; int cmd; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); Rect32 rect; int r = 255, g = 255, b = 255; int ar = 255, ag = 255, ab = 255, alpha = 255; bool custoTrans = false; - CBPlatform::setRectEmpty(&rect); + BasePlatform::setRectEmpty(&rect); char *surfaceFile = NULL; delete _surface; @@ -196,7 +196,7 @@ bool CBSubFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) { return STATUS_FAILED; } */ - if (CBPlatform::isRectEmpty(&rect)) setDefaultRect(); + if (BasePlatform::isRectEmpty(&rect)) setDefaultRect(); else _rect = rect; return STATUS_OK; @@ -204,14 +204,14 @@ bool CBSubFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) { ////////////////////////////////////////////////////////////////////// -bool CBSubFrame::draw(int x, int y, CBObject *registerOwner, float zoomX, float zoomY, bool precise, uint32 alpha, float rotate, TSpriteBlendMode blendMode) { +bool BaseSubFrame::draw(int x, int y, BaseObject *registerOwner, float zoomX, float zoomY, bool precise, uint32 alpha, float rotate, TSpriteBlendMode blendMode) { if (!_surface) return STATUS_OK; if (registerOwner != NULL && !_decoration) { if (zoomX == 100 && zoomY == 100) { - _gameRef->_renderer->_rectList.add(new CBActiveRect(_gameRef, registerOwner, this, x - _hotspotX + _rect.left, y - _hotspotY + _rect.top, _rect.right - _rect.left, _rect.bottom - _rect.top, zoomX, zoomY, precise)); + _gameRef->_renderer->_rectList.add(new BaseActiveRect(_gameRef, registerOwner, this, x - _hotspotX + _rect.left, y - _hotspotY + _rect.top, _rect.right - _rect.left, _rect.bottom - _rect.top, zoomX, zoomY, precise)); } else { - _gameRef->_renderer->_rectList.add(new CBActiveRect(_gameRef, registerOwner, this, (int)(x - (_hotspotX + _rect.left) * (zoomX / 100)), (int)(y - (_hotspotY + _rect.top) * (zoomY / 100)), (int)((_rect.right - _rect.left) * (zoomX / 100)), (int)((_rect.bottom - _rect.top) * (zoomY / 100)), zoomX, zoomY, precise)); + _gameRef->_renderer->_rectList.add(new BaseActiveRect(_gameRef, registerOwner, this, (int)(x - (_hotspotX + _rect.left) * (zoomX / 100)), (int)(y - (_hotspotY + _rect.top) * (zoomY / 100)), (int)((_rect.right - _rect.left) * (zoomX / 100)), (int)((_rect.bottom - _rect.top) * (zoomY / 100)), zoomX, zoomY, precise)); } } if (_gameRef->_suspendedRendering) return STATUS_OK; @@ -233,13 +233,13 @@ bool CBSubFrame::draw(int x, int y, CBObject *registerOwner, float zoomX, float ////////////////////////////////////////////////////////////////////////// -bool CBSubFrame::getBoundingRect(Rect32 *rect, int x, int y, float scaleX, float scaleY) { +bool BaseSubFrame::getBoundingRect(Rect32 *rect, int x, int y, float scaleX, float scaleY) { if (!rect) return false; float ratioX = scaleX / 100.0f; float ratioY = scaleY / 100.0f; - CBPlatform::setRect(rect, + BasePlatform::setRect(rect, (int)(x - _hotspotX * ratioX), (int)(y - _hotspotY * ratioY), (int)(x - _hotspotX * ratioX + (_rect.right - _rect.left) * ratioX), @@ -249,7 +249,7 @@ bool CBSubFrame::getBoundingRect(Rect32 *rect, int x, int y, float scaleX, float ////////////////////////////////////////////////////////////////////////// -bool CBSubFrame::saveAsText(CBDynBuffer *buffer, int indent, bool complete) { +bool BaseSubFrame::saveAsText(BaseDynamicBuffer *buffer, int indent, bool complete) { if (complete) buffer->putTextIndent(indent, "SUBFRAME {\n"); @@ -260,9 +260,9 @@ bool CBSubFrame::saveAsText(CBDynBuffer *buffer, int indent, bool complete) { buffer->putTextIndent(indent + 2, "TRANSPARENT { %d,%d,%d }\n", RGBCOLGetR(_transparent), RGBCOLGetG(_transparent), RGBCOLGetB(_transparent)); Rect32 rect; - CBPlatform::setRectEmpty(&rect); - if (_surface) CBPlatform::setRect(&rect, 0, 0, _surface->getWidth(), _surface->getHeight()); - if (!CBPlatform::equalRect(&rect, &_rect)) + BasePlatform::setRectEmpty(&rect); + if (_surface) BasePlatform::setRect(&rect, 0, 0, _surface->getWidth(), _surface->getHeight()); + if (!BasePlatform::equalRect(&rect, &_rect)) buffer->putTextIndent(indent + 2, "RECT { %d,%d,%d,%d }\n", _rect.left, _rect.top, _rect.right, _rect.bottom); if (_hotspotX != 0 || _hotspotY != 0) @@ -291,7 +291,7 @@ bool CBSubFrame::saveAsText(CBDynBuffer *buffer, int indent, bool complete) { if (_editorSelected) buffer->putTextIndent(indent + 2, "EDITOR_SELECTED=%s\n", _editorSelected ? "TRUE" : "FALSE"); - CBBase::saveAsText(buffer, indent + 2); + BaseClass::saveAsText(buffer, indent + 2); if (complete) @@ -302,17 +302,17 @@ bool CBSubFrame::saveAsText(CBDynBuffer *buffer, int indent, bool complete) { ////////////////////////////////////////////////////////////////////////// -void CBSubFrame::setDefaultRect() { +void BaseSubFrame::setDefaultRect() { if (_surface) { - CBPlatform::setRect(&_rect, 0, 0, _surface->getWidth(), _surface->getHeight()); - } else CBPlatform::setRectEmpty(&_rect); + BasePlatform::setRect(&_rect, 0, 0, _surface->getWidth(), _surface->getHeight()); + } else BasePlatform::setRectEmpty(&_rect); } ////////////////////////////////////////////////////////////////////////// -bool CBSubFrame::persist(CBPersistMgr *persistMgr) { +bool BaseSubFrame::persist(BasePersistenceManager *persistMgr) { - CBScriptable::persist(persistMgr); + BaseScriptable::persist(persistMgr); persistMgr->transfer(TMEMBER(_2DOnly)); persistMgr->transfer(TMEMBER(_3DOnly)); @@ -342,7 +342,7 @@ bool CBSubFrame::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -bool CBSubFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool BaseSubFrame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // GetImage @@ -360,7 +360,7 @@ bool CBSubFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "SetImage") == 0) { stack->correctParams(1); - CScValue *Val = stack->pop(); + ScValue *Val = stack->pop(); if (Val->isNULL()) { if (_surface) _gameRef->_surfaceStorage->removeSurface(_surface); @@ -378,13 +378,13 @@ bool CBSubFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this return STATUS_OK; } - else return CBScriptable::scCallMethod(script, stack, thisStack, name); + else return BaseScriptable::scCallMethod(script, stack, thisStack, name); } ////////////////////////////////////////////////////////////////////////// -CScValue *CBSubFrame::scGetProperty(const char *name) { - if (!_scValue) _scValue = new CScValue(_gameRef); +ScValue *BaseSubFrame::scGetProperty(const char *name) { + if (!_scValue) _scValue = new ScValue(_gameRef); _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// @@ -468,12 +468,12 @@ CScValue *CBSubFrame::scGetProperty(const char *name) { return _scValue; } - else return CBScriptable::scGetProperty(name); + else return BaseScriptable::scGetProperty(name); } ////////////////////////////////////////////////////////////////////////// -bool CBSubFrame::scSetProperty(const char *name, CScValue *value) { +bool BaseSubFrame::scSetProperty(const char *name, ScValue *value) { ////////////////////////////////////////////////////////////////////////// // AlphaColor ////////////////////////////////////////////////////////////////////////// @@ -538,18 +538,18 @@ bool CBSubFrame::scSetProperty(const char *name, CScValue *value) { return STATUS_OK; } - else return CBScriptable::scSetProperty(name, value); + else return BaseScriptable::scSetProperty(name, value); } ////////////////////////////////////////////////////////////////////////// -const char *CBSubFrame::scToString() { +const char *BaseSubFrame::scToString() { return "[subframe]"; } ////////////////////////////////////////////////////////////////////////// -bool CBSubFrame::setSurface(const char *filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime, bool keepLoaded) { +bool BaseSubFrame::setSurface(const char *filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime, bool keepLoaded) { if (_surface) { _gameRef->_surfaceStorage->removeSurface(_surface); _surface = NULL; @@ -576,7 +576,7 @@ bool CBSubFrame::setSurface(const char *filename, bool defaultCK, byte ckRed, by ////////////////////////////////////////////////////////////////////////// -bool CBSubFrame::setSurfaceSimple() { +bool BaseSubFrame::setSurfaceSimple() { if (!_surfaceFilename) { _surface = NULL; return STATUS_OK; diff --git a/engines/wintermute/base/base_sub_frame.h b/engines/wintermute/base/base_sub_frame.h index 6fb24c0e4f..52b1d76c01 100644 --- a/engines/wintermute/base/base_sub_frame.h +++ b/engines/wintermute/base/base_sub_frame.h @@ -34,25 +34,25 @@ #include "engines/wintermute/base/base_scriptable.h" namespace WinterMute { -class CBObject; -class CBSurface; -class CBSubFrame : public CBScriptable { +class BaseObject; +class BaseSurface; +class BaseSubFrame : public BaseScriptable { public: bool _mirrorX; bool _mirrorY; bool _decoration; bool setSurface(const char *filename, bool defaultCK = true, byte ckRed = 0, byte ckGreen = 0, byte ckBlue = 0, int lifeTime = -1, bool keepLoaded = false); bool setSurfaceSimple(); - DECLARE_PERSISTENT(CBSubFrame, CBScriptable) + DECLARE_PERSISTENT(BaseSubFrame, BaseScriptable) void setDefaultRect(); uint32 _transparent; - bool saveAsText(CBDynBuffer *buffer, int indent) { return saveAsText(buffer, indent, true); } - bool saveAsText(CBDynBuffer *buffer, int indent, bool complete); + bool saveAsText(BaseDynamicBuffer *buffer, int indent) { return saveAsText(buffer, indent, true); } + bool saveAsText(BaseDynamicBuffer *buffer, int indent, bool complete); bool _editorSelected; - CBSubFrame(CBGame *inGame); - virtual ~CBSubFrame(); + BaseSubFrame(BaseGame *inGame); + virtual ~BaseSubFrame(); bool loadBuffer(byte *buffer, int lifeTime, bool keepLoaded); - bool draw(int x, int y, CBObject *registerOwner = NULL, float zoomX = 100, float zoomY = 100, bool precise = true, uint32 alpha = 0xFFFFFFFF, float rotate = 0.0f, TSpriteBlendMode blendMode = BLEND_NORMAL); + bool draw(int x, int y, BaseObject *registerOwner = NULL, float zoomX = 100, float zoomY = 100, bool precise = true, uint32 alpha = 0xFFFFFFFF, float rotate = 0.0f, TSpriteBlendMode blendMode = BLEND_NORMAL); bool getBoundingRect(Rect32 *rect, int x, int y, float scaleX = 100, float scaleY = 100); int _hotspotX; @@ -71,12 +71,12 @@ public: bool _2DOnly; bool _3DOnly; - CBSurface *_surface; + BaseSurface *_surface; // scripting interface - virtual CScValue *scGetProperty(const char *name); - virtual bool scSetProperty(const char *name, CScValue *value); - virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual ScValue *scGetProperty(const char *name); + virtual bool scSetProperty(const char *name, ScValue *value); + virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); virtual const char *scToString(); }; diff --git a/engines/wintermute/base/base_surface_storage.cpp b/engines/wintermute/base/base_surface_storage.cpp index 06c2f1b0cc..7067c2a607 100644 --- a/engines/wintermute/base/base_surface_storage.cpp +++ b/engines/wintermute/base/base_surface_storage.cpp @@ -36,24 +36,24 @@ namespace WinterMute { -//IMPLEMENT_PERSISTENT(CBSurfaceStorage, true); +//IMPLEMENT_PERSISTENT(BaseSurfaceStorage, true); ////////////////////////////////////////////////////////////////////// -CBSurfaceStorage::CBSurfaceStorage(CBGame *inGame): CBBase(inGame) { +BaseSurfaceStorage::BaseSurfaceStorage(BaseGame *inGame): BaseClass(inGame) { _lastCleanupTime = 0; } ////////////////////////////////////////////////////////////////////// -CBSurfaceStorage::~CBSurfaceStorage() { +BaseSurfaceStorage::~BaseSurfaceStorage() { cleanup(true); } ////////////////////////////////////////////////////////////////////////// -bool CBSurfaceStorage::cleanup(bool warn) { +bool BaseSurfaceStorage::cleanup(bool warn) { for (uint32 i = 0; i < _surfaces.size(); i++) { - if (warn) _gameRef->LOG(0, "CBSurfaceStorage warning: purging surface '%s', usage:%d", _surfaces[i]->getFileName(), _surfaces[i]->_referenceCount); + if (warn) _gameRef->LOG(0, "BaseSurfaceStorage warning: purging surface '%s', usage:%d", _surfaces[i]->getFileName(), _surfaces[i]->_referenceCount); delete _surfaces[i]; } _surfaces.clear(); @@ -63,7 +63,7 @@ bool CBSurfaceStorage::cleanup(bool warn) { ////////////////////////////////////////////////////////////////////////// -bool CBSurfaceStorage::initLoop() { +bool BaseSurfaceStorage::initLoop() { if (_gameRef->_smartCache && _gameRef->_liveTimer - _lastCleanupTime >= _gameRef->_surfaceGCCycleTime) { _lastCleanupTime = _gameRef->_liveTimer; sortSurfaces(); @@ -81,7 +81,7 @@ bool CBSurfaceStorage::initLoop() { ////////////////////////////////////////////////////////////////////// -bool CBSurfaceStorage::removeSurface(CBSurface *surface) { +bool BaseSurfaceStorage::removeSurface(BaseSurface *surface) { for (uint32 i = 0; i < _surfaces.size(); i++) { if (_surfaces[i] == surface) { _surfaces[i]->_referenceCount--; @@ -97,7 +97,7 @@ bool CBSurfaceStorage::removeSurface(CBSurface *surface) { ////////////////////////////////////////////////////////////////////// -CBSurface *CBSurfaceStorage::addSurface(const char *filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime, bool keepLoaded) { +BaseSurface *BaseSurfaceStorage::addSurface(const char *filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime, bool keepLoaded) { for (uint32 i = 0; i < _surfaces.size(); i++) { if (scumm_stricmp(_surfaces[i]->getFileName(), filename) == 0) { _surfaces[i]->_referenceCount++; @@ -113,7 +113,7 @@ CBSurface *CBSurfaceStorage::addSurface(const char *filename, bool defaultCK, by return addSurface("invalid.bmp", defaultCK, ckRed, ckGreen, ckBlue, lifeTime, keepLoaded); } - CBSurface *surface; + BaseSurface *surface; surface = _gameRef->_renderer->createSurface(); if (!surface) return NULL; @@ -130,12 +130,12 @@ CBSurface *CBSurfaceStorage::addSurface(const char *filename, bool defaultCK, by ////////////////////////////////////////////////////////////////////// -bool CBSurfaceStorage::restoreAll() { +bool BaseSurfaceStorage::restoreAll() { bool ret; for (uint32 i = 0; i < _surfaces.size(); i++) { ret = _surfaces[i]->restore(); if (ret != STATUS_OK) { - _gameRef->LOG(0, "CBSurfaceStorage::RestoreAll failed"); + _gameRef->LOG(0, "BaseSurfaceStorage::RestoreAll failed"); return ret; } } @@ -145,7 +145,7 @@ bool CBSurfaceStorage::restoreAll() { /* ////////////////////////////////////////////////////////////////////////// -bool CBSurfaceStorage::persist(CBPersistMgr *persistMgr) +bool BaseSurfaceStorage::persist(BasePersistenceManager *persistMgr) { if(!persistMgr->_saving) cleanup(false); @@ -160,16 +160,16 @@ bool CBSurfaceStorage::persist(CBPersistMgr *persistMgr) ////////////////////////////////////////////////////////////////////////// -bool CBSurfaceStorage::sortSurfaces() { - qsort(&_surfaces[0], _surfaces.size(), sizeof(CBSurface *), surfaceSortCB); +bool BaseSurfaceStorage::sortSurfaces() { + qsort(&_surfaces[0], _surfaces.size(), sizeof(BaseSurface *), surfaceSortCB); return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -int CBSurfaceStorage::surfaceSortCB(const void *arg1, const void *arg2) { - CBSurface *s1 = *((CBSurface **)arg1); - CBSurface *s2 = *((CBSurface **)arg2); +int BaseSurfaceStorage::surfaceSortCB(const void *arg1, const void *arg2) { + BaseSurface *s1 = *((BaseSurface **)arg1); + BaseSurface *s2 = *((BaseSurface **)arg2); // sort by life time if (s1->_lifeTime <= 0 && s2->_lifeTime > 0) return 1; diff --git a/engines/wintermute/base/base_surface_storage.h b/engines/wintermute/base/base_surface_storage.h index 58f25e6875..350210b95e 100644 --- a/engines/wintermute/base/base_surface_storage.h +++ b/engines/wintermute/base/base_surface_storage.h @@ -33,23 +33,23 @@ #include "common/array.h" namespace WinterMute { -class CBSurface; -class CBSurfaceStorage : public CBBase { +class BaseSurface; +class BaseSurfaceStorage : public BaseClass { public: uint32 _lastCleanupTime; bool initLoop(); bool sortSurfaces(); static int surfaceSortCB(const void *arg1, const void *arg2); bool cleanup(bool Warn = false); - //DECLARE_PERSISTENT(CBSurfaceStorage, CBBase); + //DECLARE_PERSISTENT(BaseSurfaceStorage, BaseClass); bool restoreAll(); - CBSurface *addSurface(const char *filename, bool defaultCK = true, byte ckRed = 0, byte ckGreen = 0, byte ckBlue = 0, int lifeTime = -1, bool keepLoaded = false); - bool removeSurface(CBSurface *surface); - CBSurfaceStorage(CBGame *inGame); - virtual ~CBSurfaceStorage(); + BaseSurface *addSurface(const char *filename, bool defaultCK = true, byte ckRed = 0, byte ckGreen = 0, byte ckBlue = 0, int lifeTime = -1, bool keepLoaded = false); + bool removeSurface(BaseSurface *surface); + BaseSurfaceStorage(BaseGame *inGame); + virtual ~BaseSurfaceStorage(); - Common::Array _surfaces; + Common::Array _surfaces; }; } // end of namespace WinterMute diff --git a/engines/wintermute/base/base_transition_manager.cpp b/engines/wintermute/base/base_transition_manager.cpp index 30a1a32e6a..b524636af7 100644 --- a/engines/wintermute/base/base_transition_manager.cpp +++ b/engines/wintermute/base/base_transition_manager.cpp @@ -34,7 +34,7 @@ namespace WinterMute { ////////////////////////////////////////////////////////////////////////// -CBTransitionMgr::CBTransitionMgr(CBGame *inGame): CBBase(inGame) { +BaseTransitionMgr::BaseTransitionMgr(BaseGame *inGame): BaseClass(inGame) { _state = TRANS_MGR_READY; _type = TRANSITION_NONE; _origInteractive = false; @@ -46,19 +46,19 @@ CBTransitionMgr::CBTransitionMgr(CBGame *inGame): CBBase(inGame) { ////////////////////////////////////////////////////////////////////////// -CBTransitionMgr::~CBTransitionMgr() { +BaseTransitionMgr::~BaseTransitionMgr() { } ////////////////////////////////////////////////////////////////////////// -bool CBTransitionMgr::isReady() { +bool BaseTransitionMgr::isReady() { return (_state == TRANS_MGR_READY); } ////////////////////////////////////////////////////////////////////////// -bool CBTransitionMgr::start(TTransitionType type, bool nonInteractive) { +bool BaseTransitionMgr::start(TTransitionType type, bool nonInteractive) { if (_state != TRANS_MGR_READY) return STATUS_OK; if (type == TRANSITION_NONE || type >= NUM_TRANSITION_TYPES) { @@ -83,12 +83,12 @@ bool CBTransitionMgr::start(TTransitionType type, bool nonInteractive) { #define FADE_DURATION 200 ////////////////////////////////////////////////////////////////////////// -bool CBTransitionMgr::update() { +bool BaseTransitionMgr::update() { if (isReady()) return STATUS_OK; if (!_started) { _started = true; - _lastTime = CBPlatform::getTime(); + _lastTime = BasePlatform::getTime(); } switch (_type) { @@ -97,7 +97,7 @@ bool CBTransitionMgr::update() { break; case TRANSITION_FADE_OUT: { - uint32 time = CBPlatform::getTime() - _lastTime; + uint32 time = BasePlatform::getTime() - _lastTime; int alpha = (int)(255 - (float)time / (float)FADE_DURATION * 255); alpha = MIN(255, MAX(alpha, 0)); _gameRef->_renderer->fade((uint16)alpha); @@ -108,7 +108,7 @@ bool CBTransitionMgr::update() { break; case TRANSITION_FADE_IN: { - uint32 time = CBPlatform::getTime() - _lastTime; + uint32 time = BasePlatform::getTime() - _lastTime; int alpha = (int)((float)time / (float)FADE_DURATION * 255); alpha = MIN(255, MAX(alpha, 0)); _gameRef->_renderer->fade((uint16)alpha); @@ -118,7 +118,7 @@ bool CBTransitionMgr::update() { } break; default: - error("CBTransitionMgr::Update - unhandled enum NUM_TRANSITION_TYPES"); + error("BaseTransitionMgr::Update - unhandled enum NUM_TRANSITION_TYPES"); } if (isReady()) { diff --git a/engines/wintermute/base/base_transition_manager.h b/engines/wintermute/base/base_transition_manager.h index 9b84c653e9..104f327fb8 100644 --- a/engines/wintermute/base/base_transition_manager.h +++ b/engines/wintermute/base/base_transition_manager.h @@ -33,7 +33,7 @@ namespace WinterMute { -class CBTransitionMgr : public CBBase { +class BaseTransitionMgr : public BaseClass { public: bool _started; uint32 _lastTime; @@ -43,8 +43,8 @@ public: bool start(TTransitionType type, bool nonInteractive = false); bool isReady(); TTransMgrState _state; - CBTransitionMgr(CBGame *inGame); - virtual ~CBTransitionMgr(); + BaseTransitionMgr(BaseGame *inGame); + virtual ~BaseTransitionMgr(); TTransitionType _type; }; diff --git a/engines/wintermute/base/base_viewport.cpp b/engines/wintermute/base/base_viewport.cpp index 83cbc5b0f0..ad875ec00d 100644 --- a/engines/wintermute/base/base_viewport.cpp +++ b/engines/wintermute/base/base_viewport.cpp @@ -32,24 +32,24 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CBViewport, false) +IMPLEMENT_PERSISTENT(BaseViewport, false) ////////////////////////////////////////////////////////////////////////// -CBViewport::CBViewport(CBGame *inGame): CBBase(inGame) { - CBPlatform::setRectEmpty(&_rect); +BaseViewport::BaseViewport(BaseGame *inGame): BaseClass(inGame) { + BasePlatform::setRectEmpty(&_rect); _mainObject = NULL; _offsetX = _offsetY = 0; } ////////////////////////////////////////////////////////////////////////// -CBViewport::~CBViewport() { +BaseViewport::~BaseViewport() { } ////////////////////////////////////////////////////////////////////////// -bool CBViewport::persist(CBPersistMgr *persistMgr) { +bool BaseViewport::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_gameRef)); @@ -63,7 +63,7 @@ bool CBViewport::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -bool CBViewport::setRect(int left, int top, int right, int bottom, bool noCheck) { +bool BaseViewport::setRect(int left, int top, int right, int bottom, bool noCheck) { if (!noCheck) { left = MAX(left, 0); top = MAX(top, 0); @@ -71,7 +71,7 @@ bool CBViewport::setRect(int left, int top, int right, int bottom, bool noCheck) bottom = MIN(bottom, _gameRef->_renderer->_height); } - CBPlatform::setRect(&_rect, left, top, right, bottom); + BasePlatform::setRect(&_rect, left, top, right, bottom); _offsetX = left; _offsetY = top; return STATUS_OK; @@ -79,19 +79,19 @@ bool CBViewport::setRect(int left, int top, int right, int bottom, bool noCheck) ////////////////////////////////////////////////////////////////////////// -Rect32 *CBViewport::getRect() { +Rect32 *BaseViewport::getRect() { return &_rect; } ////////////////////////////////////////////////////////////////////////// -int CBViewport::getWidth() { +int BaseViewport::getWidth() { return _rect.right - _rect.left; } ////////////////////////////////////////////////////////////////////////// -int CBViewport::getHeight() { +int BaseViewport::getHeight() { return _rect.bottom - _rect.top; } diff --git a/engines/wintermute/base/base_viewport.h b/engines/wintermute/base/base_viewport.h index 795e6f404f..33e9448082 100644 --- a/engines/wintermute/base/base_viewport.h +++ b/engines/wintermute/base/base_viewport.h @@ -33,19 +33,19 @@ #include "engines/wintermute/base/base.h" namespace WinterMute { -class CBObject; -class CBViewport : public CBBase { +class BaseObject; +class BaseViewport : public BaseClass { public: int getHeight(); int getWidth(); Rect32 *getRect(); bool setRect(int left, int top, int right, int bottom, bool noCheck = false); - DECLARE_PERSISTENT(CBViewport, CBBase) + DECLARE_PERSISTENT(BaseViewport, BaseClass) int _offsetY; int _offsetX; - CBObject *_mainObject; - CBViewport(CBGame *inGame = NULL); - virtual ~CBViewport(); + BaseObject *_mainObject; + BaseViewport(BaseGame *inGame = NULL); + virtual ~BaseViewport(); private: Rect32 _rect; }; diff --git a/engines/wintermute/base/file/BPkgFile.cpp b/engines/wintermute/base/file/BPkgFile.cpp index 3acde9c1ff..5e1ebc5922 100644 --- a/engines/wintermute/base/file/BPkgFile.cpp +++ b/engines/wintermute/base/file/BPkgFile.cpp @@ -39,6 +39,9 @@ namespace WinterMute { +// This file is only needed until the next merge/rebase, as wrapCompressedStream now can set a known size +// as such it is not renamed to follow the convention of the rest of the files. + // HACK: wrapCompressedStream might set the size to 0, so we need a way to override it. class CBPkgFile : public Common::SeekableReadStream { uint32 _size; @@ -65,8 +68,8 @@ public: } }; -Common::SeekableReadStream *openPkgFile(const Common::String &filename, CBFileManager *fileManager) { - CBFileEntry *fileEntry; +Common::SeekableReadStream *openPkgFile(const Common::String &filename, BaseFileManager *fileManager) { + BaseFileEntry *fileEntry; Common::SeekableReadStream *file = NULL; char fileName[MAX_PATH_LENGTH]; strcpy(fileName, filename.c_str()); diff --git a/engines/wintermute/base/file/BPkgFile.h b/engines/wintermute/base/file/BPkgFile.h index 4356ae5519..ca1b1f837d 100644 --- a/engines/wintermute/base/file/BPkgFile.h +++ b/engines/wintermute/base/file/BPkgFile.h @@ -41,8 +41,8 @@ class File; namespace WinterMute { -class CBFileManager; -Common::SeekableReadStream *openPkgFile(const Common::String &filename, CBFileManager *fileManager); +class BaseFileManager; +Common::SeekableReadStream *openPkgFile(const Common::String &filename, BaseFileManager *fileManager); } // end of namespace WinterMute diff --git a/engines/wintermute/base/file/base_disk_file.cpp b/engines/wintermute/base/file/base_disk_file.cpp index 99bf9cff3f..6c89fc22f1 100644 --- a/engines/wintermute/base/file/base_disk_file.cpp +++ b/engines/wintermute/base/file/base_disk_file.cpp @@ -45,7 +45,7 @@ void correctSlashes(char *fileName) { } } -Common::SeekableReadStream *openDiskFile(const Common::String &filename, CBFileManager *fileManager) { +Common::SeekableReadStream *openDiskFile(const Common::String &filename, BaseFileManager *fileManager) { char fullPath[MAX_PATH_LENGTH]; uint32 prefixSize = 0; Common::SeekableReadStream *file = NULL; diff --git a/engines/wintermute/base/file/base_disk_file.h b/engines/wintermute/base/file/base_disk_file.h index 23e1a0a315..e688a12b50 100644 --- a/engines/wintermute/base/file/base_disk_file.h +++ b/engines/wintermute/base/file/base_disk_file.h @@ -35,7 +35,7 @@ class SeekableReadStream; namespace WinterMute { -Common::SeekableReadStream *openDiskFile(const Common::String &filename, CBFileManager *fileManager); +Common::SeekableReadStream *openDiskFile(const Common::String &filename, BaseFileManager *fileManager); } // end of namespace WinterMute diff --git a/engines/wintermute/base/file/base_file.cpp b/engines/wintermute/base/file/base_file.cpp index 88a64cb147..d4109bb259 100644 --- a/engines/wintermute/base/file/base_file.cpp +++ b/engines/wintermute/base/file/base_file.cpp @@ -38,24 +38,24 @@ namespace WinterMute { ////////////////////////////////////////////////////////////////////////// -CBFile::CBFile(CBGame *inGame): CBBase(inGame) { +BaseFile::BaseFile(BaseGame *inGame): BaseClass(inGame) { _pos = 0; _size = 0; } ////////////////////////////////////////////////////////////////////////// -CBFile::~CBFile() { +BaseFile::~BaseFile() { } ////////////////////////////////////////////////////////////////////////// -bool CBFile::isEOF() { +bool BaseFile::isEOF() { return _pos == _size; } -Common::SeekableReadStream *CBFile::getMemStream() { +Common::SeekableReadStream *BaseFile::getMemStream() { uint32 oldPos = getPos(); seek(0); byte *data = new byte[getSize()]; diff --git a/engines/wintermute/base/file/base_file.h b/engines/wintermute/base/file/base_file.h index b29fc41299..1a144414fc 100644 --- a/engines/wintermute/base/file/base_file.h +++ b/engines/wintermute/base/file/base_file.h @@ -40,7 +40,7 @@ class SeekableReadStream; namespace WinterMute { -class CBFile : public CBBase { +class BaseFile : public BaseClass { protected: uint32 _pos; uint32 _size; @@ -56,8 +56,8 @@ public: virtual bool close() = 0; virtual bool open(const Common::String &filename) = 0; virtual bool isEOF(); - CBFile(CBGame *inGame); - virtual ~CBFile(); + BaseFile(BaseGame *inGame); + virtual ~BaseFile(); // Temporary solution to allow usage in ScummVM-code: virtual Common::SeekableReadStream *getMemStream(); }; diff --git a/engines/wintermute/base/file/base_file_entry.cpp b/engines/wintermute/base/file/base_file_entry.cpp index 3b6f4c7c16..d3e0fee7b0 100644 --- a/engines/wintermute/base/file/base_file_entry.cpp +++ b/engines/wintermute/base/file/base_file_entry.cpp @@ -31,7 +31,7 @@ namespace WinterMute { ////////////////////////////////////////////////////////////////////////// -CBFileEntry::CBFileEntry(CBGame *inGame): CBBase(inGame) { +BaseFileEntry::BaseFileEntry(BaseGame *inGame): BaseClass(inGame) { _package = NULL; _length = _compressedLength = _offset = _flags = 0; _filename = ""; @@ -43,7 +43,7 @@ CBFileEntry::CBFileEntry(CBGame *inGame): CBBase(inGame) { ////////////////////////////////////////////////////////////////////////// -CBFileEntry::~CBFileEntry() { +BaseFileEntry::~BaseFileEntry() { _package = NULL; // ref only } diff --git a/engines/wintermute/base/file/base_file_entry.h b/engines/wintermute/base/file/base_file_entry.h index ed80821004..0e0375e42d 100644 --- a/engines/wintermute/base/file/base_file_entry.h +++ b/engines/wintermute/base/file/base_file_entry.h @@ -34,9 +34,9 @@ namespace WinterMute { -class CBPackage; +class BasePackage; -class CBFileEntry : public CBBase { +class BaseFileEntry : public BaseClass { public: uint32 _timeDate2; uint32 _timeDate1; @@ -46,9 +46,9 @@ public: uint32 _compressedLength; uint32 _length; uint32 _offset; - CBPackage *_package; - CBFileEntry(CBGame *inGame); - virtual ~CBFileEntry(); + BasePackage *_package; + BaseFileEntry(BaseGame *inGame); + virtual ~BaseFileEntry(); }; diff --git a/engines/wintermute/base/file/base_package.cpp b/engines/wintermute/base/file/base_package.cpp index fab6409c00..03a80f3d8d 100644 --- a/engines/wintermute/base/file/base_package.cpp +++ b/engines/wintermute/base/file/base_package.cpp @@ -40,7 +40,7 @@ namespace WinterMute { ////////////////////////////////////////////////////////////////////////// -CBPackage::CBPackage(CBGame *inGame): CBBase(inGame) { +BasePackage::BasePackage(BaseGame *inGame): BaseClass(inGame) { _file = NULL; _name = NULL; _cD = 0; @@ -50,14 +50,14 @@ CBPackage::CBPackage(CBGame *inGame): CBBase(inGame) { ////////////////////////////////////////////////////////////////////////// -CBPackage::~CBPackage() { +BasePackage::~BasePackage() { if (_name) delete [] _name; closeFilePointer(_file); } ////////////////////////////////////////////////////////////////////////// -bool CBPackage::open() { +bool BasePackage::open() { if (_file) return STATUS_OK; else { _file = getFilePointer(); @@ -67,7 +67,7 @@ bool CBPackage::open() { ////////////////////////////////////////////////////////////////////////// -bool CBPackage::close() { +bool BasePackage::close() { delete _file; _file = NULL; return STATUS_OK; @@ -75,7 +75,7 @@ bool CBPackage::close() { ////////////////////////////////////////////////////////////////////////// -bool CBPackage::read(Common::SeekableReadStream *file, uint32 offset, byte *buffer, uint32 size) { +bool BasePackage::read(Common::SeekableReadStream *file, uint32 offset, byte *buffer, uint32 size) { bool ret; if (DID_FAIL(ret = open())) return ret; else { @@ -86,7 +86,7 @@ bool CBPackage::read(Common::SeekableReadStream *file, uint32 offset, byte *buff } ////////////////////////////////////////////////////////////////////////// -Common::SeekableReadStream *CBPackage::getFilePointer() { +Common::SeekableReadStream *BasePackage::getFilePointer() { Common::File *file = _gameRef->_fileManager->openPackage(_name); if (!file) { _gameRef->_fileManager->requestCD(_cD, _name, ""); @@ -96,7 +96,7 @@ Common::SeekableReadStream *CBPackage::getFilePointer() { } ////////////////////////////////////////////////////////////////////////// -void CBPackage::closeFilePointer(Common::SeekableReadStream *&file) { +void BasePackage::closeFilePointer(Common::SeekableReadStream *&file) { delete file; file = NULL; } diff --git a/engines/wintermute/base/file/base_package.h b/engines/wintermute/base/file/base_package.h index 52fc4f9677..bf45087f91 100644 --- a/engines/wintermute/base/file/base_package.h +++ b/engines/wintermute/base/file/base_package.h @@ -38,7 +38,7 @@ class SeekableReadStream; namespace WinterMute { -class CBPackage : public CBBase { +class BasePackage : public BaseClass { public: Common::SeekableReadStream *getFilePointer(); void closeFilePointer(Common::SeekableReadStream *&file); @@ -51,8 +51,8 @@ public: char *_name; int _cD; Common::SeekableReadStream *_file; - CBPackage(CBGame *inGame); - virtual ~CBPackage(); + BasePackage(BaseGame *inGame); + virtual ~BasePackage(); }; diff --git a/engines/wintermute/base/file/base_resources.cpp b/engines/wintermute/base/file/base_resources.cpp index 09cbae88fe..9b1c9fee04 100644 --- a/engines/wintermute/base/file/base_resources.cpp +++ b/engines/wintermute/base/file/base_resources.cpp @@ -2806,7 +2806,7 @@ unsigned char systemfont[] = { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 } ; -Common::SeekableReadStream *CBResources::getFile(const Common::String &fileName) { +Common::SeekableReadStream *BaseResources::getFile(const Common::String &fileName) { if (scumm_stricmp(fileName.c_str(), "invalid.bmp") == 0) { return new Common::MemoryReadStream(invalid, sizeof(invalid), DisposeAfterUse::NO); } else if (scumm_stricmp(fileName.c_str(), "invalid_debug.bmp") == 0) { diff --git a/engines/wintermute/base/file/base_resources.h b/engines/wintermute/base/file/base_resources.h index 6ec0541b5c..6316cecd15 100644 --- a/engines/wintermute/base/file/base_resources.h +++ b/engines/wintermute/base/file/base_resources.h @@ -34,7 +34,7 @@ namespace WinterMute { -class CBResources { +class BaseResources { public: static Common::SeekableReadStream *getFile(const Common::String &fileName); }; diff --git a/engines/wintermute/base/file/base_save_thumb_file.cpp b/engines/wintermute/base/file/base_save_thumb_file.cpp index 68200d3fc6..a2295b70a5 100644 --- a/engines/wintermute/base/file/base_save_thumb_file.cpp +++ b/engines/wintermute/base/file/base_save_thumb_file.cpp @@ -39,19 +39,19 @@ namespace WinterMute { ////////////////////////////////////////////////////////////////////////// -CBSaveThumbFile::CBSaveThumbFile(CBGame *inGame): CBFile(inGame) { +BaseSaveThumbFile::BaseSaveThumbFile(BaseGame *inGame): BaseFile(inGame) { _data = NULL; } ////////////////////////////////////////////////////////////////////////// -CBSaveThumbFile::~CBSaveThumbFile() { +BaseSaveThumbFile::~BaseSaveThumbFile() { close(); } ////////////////////////////////////////////////////////////////////////// -bool CBSaveThumbFile::open(const Common::String &filename) { +bool BaseSaveThumbFile::open(const Common::String &filename) { close(); if (scumm_strnicmp(filename.c_str(), "savegame:", 9) != 0) return STATUS_FAILED; @@ -71,7 +71,7 @@ bool CBSaveThumbFile::open(const Common::String &filename) { char slotFilename[MAX_PATH_LENGTH + 1]; _gameRef->getSaveSlotFilename(slot, slotFilename); - CBPersistMgr *pm = new CBPersistMgr(_gameRef); + BasePersistenceManager *pm = new BasePersistenceManager(_gameRef); if (!pm) return STATUS_FAILED; _gameRef->_debugAbsolutePathWarning = false; @@ -97,7 +97,7 @@ bool CBSaveThumbFile::open(const Common::String &filename) { ////////////////////////////////////////////////////////////////////////// -bool CBSaveThumbFile::close() { +bool BaseSaveThumbFile::close() { delete[] _data; _data = NULL; @@ -109,7 +109,7 @@ bool CBSaveThumbFile::close() { ////////////////////////////////////////////////////////////////////////// -bool CBSaveThumbFile::read(void *buffer, uint32 size) { +bool BaseSaveThumbFile::read(void *buffer, uint32 size) { if (!_data || _pos + size > _size) return STATUS_FAILED; memcpy(buffer, (byte *)_data + _pos, size); @@ -120,7 +120,7 @@ bool CBSaveThumbFile::read(void *buffer, uint32 size) { ////////////////////////////////////////////////////////////////////////// -bool CBSaveThumbFile::seek(uint32 pos, int whence) { +bool BaseSaveThumbFile::seek(uint32 pos, int whence) { if (!_data) return STATUS_FAILED; uint32 newPos = 0; diff --git a/engines/wintermute/base/file/base_save_thumb_file.h b/engines/wintermute/base/file/base_save_thumb_file.h index 42566581e2..6065f10f81 100644 --- a/engines/wintermute/base/file/base_save_thumb_file.h +++ b/engines/wintermute/base/file/base_save_thumb_file.h @@ -35,10 +35,10 @@ namespace WinterMute { //TODO: Get rid of this -class CBSaveThumbFile : public CBFile { +class BaseSaveThumbFile : public BaseFile { public: - CBSaveThumbFile(CBGame *Game); - virtual ~CBSaveThumbFile(); + BaseSaveThumbFile(BaseGame *Game); + virtual ~BaseSaveThumbFile(); virtual bool seek(uint32 pos, int whence = SEEK_SET); virtual bool read(void *buffer, uint32 size); virtual bool close(); diff --git a/engines/wintermute/base/font/base_font.cpp b/engines/wintermute/base/font/base_font.cpp index 8976cfdabd..0c86517fc7 100644 --- a/engines/wintermute/base/font/base_font.cpp +++ b/engines/wintermute/base/font/base_font.cpp @@ -40,42 +40,42 @@ namespace WinterMute { // Construction/Destruction ////////////////////////////////////////////////////////////////////// -IMPLEMENT_PERSISTENT(CBFont, false) +IMPLEMENT_PERSISTENT(BaseFont, false) ////////////////////////////////////////////////////////////////////// -CBFont::CBFont(CBGame *inGame): CBObject(inGame) { +BaseFont::BaseFont(BaseGame *inGame): BaseObject(inGame) { } ////////////////////////////////////////////////////////////////////// -CBFont::~CBFont() { +BaseFont::~BaseFont() { } ////////////////////////////////////////////////////////////////////// -void CBFont::drawText(byte *text, int x, int y, int width, TTextAlign align, int max_height, int maxLength) { +void BaseFont::drawText(byte *text, int x, int y, int width, TTextAlign align, int max_height, int maxLength) { } ////////////////////////////////////////////////////////////////////// -int CBFont::getTextHeight(byte *text, int width) { +int BaseFont::getTextHeight(byte *text, int width) { return 0; } ////////////////////////////////////////////////////////////////////// -int CBFont::getTextWidth(byte *text, int maxLength) { +int BaseFont::getTextWidth(byte *text, int maxLength) { return 0; } /* ////////////////////////////////////////////////////////////////////// -bool CBFont::loadFile(const char * Filename) +bool BaseFont::loadFile(const char * Filename) { BYTE* Buffer = _gameRef->_fileManager->readWholeFile(filename); if(Buffer==NULL){ - _gameRef->LOG(0, "CBFont::LoadFile failed for file '%s'", filename); + _gameRef->LOG(0, "BaseFont::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -96,7 +96,7 @@ TOKEN_DEF_START TOKEN_DEF (FONT) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////// -bool CBFont::loadBuffer(byte * Buffer) +bool BaseFont::loadBuffer(byte * Buffer) { TOKEN_TABLE_START(commands) TOKEN_TABLE (FONT) @@ -104,7 +104,7 @@ bool CBFont::loadBuffer(byte * Buffer) char* params; int cmd; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); if(parser.GetCommand ((char**)&Buffer, commands, (char**)¶ms)!=TOKEN_FONT){ _gameRef->LOG(0, "'FONT' keyword expected."); @@ -138,23 +138,23 @@ bool CBFont::loadBuffer(byte * Buffer) */ ////////////////////////////////////////////////////////////////////////// -int CBFont::getLetterHeight() { +int BaseFont::getLetterHeight() { return 0; } ////////////////////////////////////////////////////////////////////////// -bool CBFont::persist(CBPersistMgr *persistMgr) { +bool BaseFont::persist(BasePersistenceManager *persistMgr) { - CBObject::persist(persistMgr); + BaseObject::persist(persistMgr); return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -CBFont *CBFont::createFromFile(CBGame *gameRef, const char *filename) { +BaseFont *BaseFont::createFromFile(BaseGame *gameRef, const char *filename) { if (isTrueType(gameRef, filename)) { - CBFontTT *font = new CBFontTT(gameRef); + BaseFontTT *font = new BaseFontTT(gameRef); if (font) { if (DID_FAIL(font->loadFile(filename))) { delete font; @@ -163,7 +163,7 @@ CBFont *CBFont::createFromFile(CBGame *gameRef, const char *filename) { } return font; } else { - CBFontBitmap *font = new CBFontBitmap(gameRef); + BaseFontBitmap *font = new BaseFontBitmap(gameRef); if (font) { if (DID_FAIL(font->loadFile(filename))) { delete font; @@ -180,7 +180,7 @@ TOKEN_DEF(FONT) TOKEN_DEF(TTFONT) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -bool CBFont::isTrueType(CBGame *gameRef, const char *filename) { +bool BaseFont::isTrueType(BaseGame *gameRef, const char *filename) { TOKEN_TABLE_START(commands) TOKEN_TABLE(FONT) TOKEN_TABLE(TTFONT) @@ -193,7 +193,7 @@ bool CBFont::isTrueType(CBGame *gameRef, const char *filename) { byte *WorkBuffer = buffer; char *params; - CBParser parser(gameRef); + BaseParser parser(gameRef); bool ret = false; if (parser.getCommand((char **)&WorkBuffer, commands, (char **)¶ms) == TOKEN_TTFONT) diff --git a/engines/wintermute/base/font/base_font.h b/engines/wintermute/base/font/base_font.h index 3df3090bb9..695bce2af3 100644 --- a/engines/wintermute/base/font/base_font.h +++ b/engines/wintermute/base/font/base_font.h @@ -35,9 +35,9 @@ namespace WinterMute { -class CBFont: public CBObject { +class BaseFont: public BaseObject { public: - DECLARE_PERSISTENT(CBFont, CBObject) + DECLARE_PERSISTENT(BaseFont, BaseObject) virtual int getTextWidth(byte *text, int maxLength = -1); virtual int getTextHeight(byte *text, int width); virtual void drawText(byte *text, int x, int y, int width, TTextAlign align = TAL_LEFT, int max_height = -1, int maxLength = -1); @@ -45,15 +45,15 @@ public: virtual void initLoop() {}; virtual void afterLoad() {}; - CBFont(CBGame *inGame); - virtual ~CBFont(); + BaseFont(BaseGame *inGame); + virtual ~BaseFont(); - static CBFont *createFromFile(CBGame *game, const char *filename); + static BaseFont *createFromFile(BaseGame *game, const char *filename); private: //bool loadBuffer(byte * Buffer); //bool loadFile(const char* Filename); - static bool isTrueType(CBGame *game, const char *filename); + static bool isTrueType(BaseGame *game, const char *filename); }; } // end of namespace WinterMute diff --git a/engines/wintermute/base/font/base_font_bitmap.cpp b/engines/wintermute/base/font/base_font_bitmap.cpp index ef730afb0a..a913cc52ba 100644 --- a/engines/wintermute/base/font/base_font_bitmap.cpp +++ b/engines/wintermute/base/font/base_font_bitmap.cpp @@ -45,10 +45,10 @@ namespace WinterMute { // Construction/Destruction ////////////////////////////////////////////////////////////////////// -IMPLEMENT_PERSISTENT(CBFontBitmap, false) +IMPLEMENT_PERSISTENT(BaseFontBitmap, false) ////////////////////////////////////////////////////////////////////// -CBFontBitmap::CBFontBitmap(CBGame *inGame): CBFont(inGame) { +BaseFontBitmap::BaseFontBitmap(BaseGame *inGame): BaseFont(inGame) { _subframe = NULL; _sprite = NULL; _widthsFrame = 0; @@ -61,7 +61,7 @@ CBFontBitmap::CBFontBitmap(CBGame *inGame): CBFont(inGame) { ////////////////////////////////////////////////////////////////////// -CBFontBitmap::~CBFontBitmap() { +BaseFontBitmap::~BaseFontBitmap() { delete _subframe; delete _sprite; _subframe = NULL; @@ -70,19 +70,19 @@ CBFontBitmap::~CBFontBitmap() { ////////////////////////////////////////////////////////////////////// -void CBFontBitmap::drawText(byte *text, int x, int y, int width, TTextAlign align, int max_height, int maxLength) { +void BaseFontBitmap::drawText(byte *text, int x, int y, int width, TTextAlign align, int max_height, int maxLength) { textHeightDraw(text, x, y, width, align, true, max_height, maxLength); } ////////////////////////////////////////////////////////////////////// -int CBFontBitmap::getTextHeight(byte *text, int width) { +int BaseFontBitmap::getTextHeight(byte *text, int width) { return textHeightDraw(text, 0, 0, width, TAL_LEFT, false); } ////////////////////////////////////////////////////////////////////// -int CBFontBitmap::getTextWidth(byte *text, int maxLength) { +int BaseFontBitmap::getTextWidth(byte *text, int maxLength) { AnsiString str; if (_gameRef->_textEncoding == TEXT_UTF8) { @@ -106,7 +106,7 @@ int CBFontBitmap::getTextWidth(byte *text, int maxLength) { ////////////////////////////////////////////////////////////////////// -int CBFontBitmap::textHeightDraw(byte *text, int x, int y, int width, TTextAlign align, bool draw, int maxHeight, int maxLength) { +int BaseFontBitmap::textHeightDraw(byte *text, int x, int y, int width, TTextAlign align, bool draw, int maxHeight, int maxLength) { if (maxLength == 0) return 0; if (text == NULL || text[0] == '\0') return _tileHeight; @@ -187,7 +187,7 @@ int CBFontBitmap::textHeightDraw(byte *text, int x, int y, int width, TTextAlign StartX = x; break; default: - error("CBFontBitmap::TextHeightDraw - Unhandled enum"); + error("BaseFontBitmap::TextHeightDraw - Unhandled enum"); break; } for (i = start; i < end + 1; i++) { @@ -213,7 +213,7 @@ int CBFontBitmap::textHeightDraw(byte *text, int x, int y, int width, TTextAlign ////////////////////////////////////////////////////////////////////// -void CBFontBitmap::drawChar(byte c, int x, int y) { +void BaseFontBitmap::drawChar(byte c, int x, int y) { if (_fontextFix) c--; int row, col; @@ -227,7 +227,7 @@ void CBFontBitmap::drawChar(byte c, int x, int y) { if (_wholeCell) tileWidth = _tileWidth; else tileWidth = _widths[c]; - CBPlatform::setRect(&rect, col * _tileWidth, row * _tileHeight, col * _tileWidth + tileWidth, (row + 1)*_tileHeight); + BasePlatform::setRect(&rect, col * _tileWidth, row * _tileHeight, col * _tileWidth + tileWidth, (row + 1)*_tileHeight); bool handled = false; if (_sprite) { _sprite->GetCurrentFrame(); @@ -243,10 +243,10 @@ void CBFontBitmap::drawChar(byte c, int x, int y) { ////////////////////////////////////////////////////////////////////// -bool CBFontBitmap::loadFile(const char *filename) { +bool BaseFontBitmap::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { - _gameRef->LOG(0, "CBFontBitmap::LoadFile failed for file '%s'", filename); + _gameRef->LOG(0, "BaseFontBitmap::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -282,7 +282,7 @@ TOKEN_DEF(WIDTHS_FRAME) TOKEN_DEF(PAINT_WHOLE_CELL) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////// -bool CBFontBitmap::loadBuffer(byte *buffer) { +bool BaseFontBitmap::loadBuffer(byte *buffer) { TOKEN_TABLE_START(commands) TOKEN_TABLE(FONTEXT_FIX) TOKEN_TABLE(FONT) @@ -304,7 +304,7 @@ bool CBFontBitmap::loadBuffer(byte *buffer) { char *params; int cmd; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_FONT) { _gameRef->LOG(0, "'FONT' keyword expected."); @@ -401,7 +401,7 @@ bool CBFontBitmap::loadBuffer(byte *buffer) { if (spriteFile != NULL) { delete _sprite; - _sprite = new CBSprite(_gameRef, this); + _sprite = new BaseSprite(_gameRef, this); if (!_sprite || DID_FAIL(_sprite->loadFile(spriteFile))) { delete _sprite; _sprite = NULL; @@ -409,7 +409,7 @@ bool CBFontBitmap::loadBuffer(byte *buffer) { } if (surfaceFile != NULL && !_sprite) { - _subframe = new CBSubFrame(_gameRef); + _subframe = new BaseSubFrame(_gameRef); if (custoTrans) _subframe->setSurface(surfaceFile, false, r, g, b); else _subframe->setSurface(surfaceFile); } @@ -454,9 +454,9 @@ bool CBFontBitmap::loadBuffer(byte *buffer) { ////////////////////////////////////////////////////////////////////////// -bool CBFontBitmap::persist(CBPersistMgr *persistMgr) { +bool BaseFontBitmap::persist(BasePersistenceManager *persistMgr) { - CBFont::persist(persistMgr); + BaseFont::persist(persistMgr); persistMgr->transfer(TMEMBER(_numColumns)); persistMgr->transfer(TMEMBER(_subframe)); @@ -480,15 +480,15 @@ bool CBFontBitmap::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -int CBFontBitmap::getCharWidth(byte index) { +int BaseFontBitmap::getCharWidth(byte index) { if (_fontextFix) index--; return _widths[index]; } ////////////////////////////////////////////////////////////////////////// -bool CBFontBitmap::getWidths() { - CBSurface *surf = NULL; +bool BaseFontBitmap::getWidths() { + BaseSurface *surf = NULL; if (_sprite) { if (_widthsFrame >= 0 && _widthsFrame < _sprite->_frames.getSize()) { @@ -533,7 +533,7 @@ bool CBFontBitmap::getWidths() { } ////////////////////////////////////////////////////////////////////////// -int CBFontBitmap::getLetterHeight() { +int BaseFontBitmap::getLetterHeight() { return _tileHeight; } diff --git a/engines/wintermute/base/font/base_font_bitmap.h b/engines/wintermute/base/font/base_font_bitmap.h index 8af530cbc9..8a4f5af570 100644 --- a/engines/wintermute/base/font/base_font_bitmap.h +++ b/engines/wintermute/base/font/base_font_bitmap.h @@ -33,10 +33,10 @@ #include "engines/wintermute/base/font/base_font.h" namespace WinterMute { -class CBSubFrame; -class CBFontBitmap : public CBFont { +class BaseSubFrame; +class BaseFontBitmap : public BaseFont { public: - DECLARE_PERSISTENT(CBFontBitmap, CBFont) + DECLARE_PERSISTENT(BaseFontBitmap, BaseFont) bool loadBuffer(byte *Buffer); bool loadFile(const char *filename); virtual int getTextWidth(byte *text, int maxLength = -1); @@ -44,19 +44,19 @@ public: virtual void drawText(byte *text, int x, int y, int width, TTextAlign align = TAL_LEFT, int max_height = -1, int maxLength = -1); virtual int getLetterHeight(); - CBFontBitmap(CBGame *inGame); - virtual ~CBFontBitmap(); + BaseFontBitmap(BaseGame *inGame); + virtual ~BaseFontBitmap(); bool getWidths(); - CBSprite *_sprite; + BaseSprite *_sprite; int _widthsFrame; bool _fontextFix; int _numColumns; int _tileHeight; int _tileWidth; byte _widths[NUM_CHARACTERS]; - CBSubFrame *_subframe; + BaseSubFrame *_subframe; bool _wholeCell; private: diff --git a/engines/wintermute/base/font/base_font_storage.cpp b/engines/wintermute/base/font/base_font_storage.cpp index 13f779f2cb..220a16e14f 100644 --- a/engines/wintermute/base/font/base_font_storage.cpp +++ b/engines/wintermute/base/font/base_font_storage.cpp @@ -39,19 +39,19 @@ namespace WinterMute { // Construction/Destruction ////////////////////////////////////////////////////////////////////// -IMPLEMENT_PERSISTENT(CBFontStorage, true) +IMPLEMENT_PERSISTENT(BaseFontStorage, true) ////////////////////////////////////////////////////////////////////////// -CBFontStorage::CBFontStorage(CBGame *inGame): CBBase(inGame) { +BaseFontStorage::BaseFontStorage(BaseGame *inGame): BaseClass(inGame) { } ////////////////////////////////////////////////////////////////////////// -CBFontStorage::~CBFontStorage() { +BaseFontStorage::~BaseFontStorage() { cleanup(true); } ////////////////////////////////////////////////////////////////////////// -bool CBFontStorage::cleanup(bool warn) { +bool BaseFontStorage::cleanup(bool warn) { for (int i = 0; i < _fonts.getSize(); i++) { if (warn) _gameRef->LOG(0, "Removing orphan font '%s'", _fonts[i]->_filename); delete _fonts[i]; @@ -62,7 +62,7 @@ bool CBFontStorage::cleanup(bool warn) { } ////////////////////////////////////////////////////////////////////////// -bool CBFontStorage::initLoop() { +bool BaseFontStorage::initLoop() { for (int i = 0; i < _fonts.getSize(); i++) { _fonts[i]->initLoop(); } @@ -70,7 +70,7 @@ bool CBFontStorage::initLoop() { } ////////////////////////////////////////////////////////////////////////// -CBFont *CBFontStorage::addFont(const char *filename) { +BaseFont *BaseFontStorage::addFont(const char *filename) { if (!filename) return NULL; for (int i = 0; i < _fonts.getSize(); i++) { @@ -81,7 +81,7 @@ CBFont *CBFontStorage::addFont(const char *filename) { } /* - CBFont* font = new CBFont(_gameRef); + BaseFont* font = new BaseFont(_gameRef); if (!font) return NULL; if (DID_FAIL(font->loadFile(filename))) { @@ -94,7 +94,7 @@ CBFont *CBFontStorage::addFont(const char *filename) { return font; } */ - CBFont *font = CBFont::createFromFile(_gameRef, filename); + BaseFont *font = BaseFont::createFromFile(_gameRef, filename); if (font) { font->_refCount = 1; _fonts.add(font); @@ -104,7 +104,7 @@ CBFont *CBFontStorage::addFont(const char *filename) { ////////////////////////////////////////////////////////////////////////// -bool CBFontStorage::removeFont(CBFont *font) { +bool BaseFontStorage::removeFont(BaseFont *font) { if (!font) return STATUS_FAILED; for (int i = 0; i < _fonts.getSize(); i++) { @@ -122,7 +122,7 @@ bool CBFontStorage::removeFont(CBFont *font) { ////////////////////////////////////////////////////////////////////////// -bool CBFontStorage::persist(CBPersistMgr *persistMgr) { +bool BaseFontStorage::persist(BasePersistenceManager *persistMgr) { if (!persistMgr->_saving) cleanup(false); diff --git a/engines/wintermute/base/font/base_font_storage.h b/engines/wintermute/base/font/base_font_storage.h index 7c88e9a2f4..2c9c6817c3 100644 --- a/engines/wintermute/base/font/base_font_storage.h +++ b/engines/wintermute/base/font/base_font_storage.h @@ -36,17 +36,17 @@ namespace WinterMute { -class CBFont; +class BaseFont; -class CBFontStorage : public CBBase { +class BaseFontStorage : public BaseClass { public: - DECLARE_PERSISTENT(CBFontStorage, CBBase) + DECLARE_PERSISTENT(BaseFontStorage, BaseClass) bool cleanup(bool warn = false); - bool removeFont(CBFont *font); - CBFont *addFont(const char *filename); - CBFontStorage(CBGame *inGame); - virtual ~CBFontStorage(); - CBArray _fonts; + bool removeFont(BaseFont *font); + BaseFont *addFont(const char *filename); + BaseFontStorage(BaseGame *inGame); + virtual ~BaseFontStorage(); + BaseArray _fonts; bool initLoop(); }; diff --git a/engines/wintermute/base/font/base_font_truetype.cpp b/engines/wintermute/base/font/base_font_truetype.cpp index a52922fb76..bcf8621a40 100644 --- a/engines/wintermute/base/font/base_font_truetype.cpp +++ b/engines/wintermute/base/font/base_font_truetype.cpp @@ -46,10 +46,10 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CBFontTT, false) +IMPLEMENT_PERSISTENT(BaseFontTT, false) ////////////////////////////////////////////////////////////////////////// -CBFontTT::CBFontTT(CBGame *inGame): CBFont(inGame) { +BaseFontTT::BaseFontTT(BaseGame *inGame): BaseFont(inGame) { _fontHeight = 12; _isBold = _isItalic = _isUnderline = _isStriked = false; @@ -71,7 +71,7 @@ CBFontTT::CBFontTT(CBGame *inGame): CBFont(inGame) { } ////////////////////////////////////////////////////////////////////////// -CBFontTT::~CBFontTT(void) { +BaseFontTT::~BaseFontTT(void) { clearCache(); for (int i = 0; i < _layers.getSize(); i++) { @@ -97,7 +97,7 @@ CBFontTT::~CBFontTT(void) { ////////////////////////////////////////////////////////////////////////// -void CBFontTT::clearCache() { +void BaseFontTT::clearCache() { for (int i = 0; i < NUM_CACHED_TEXTS; i++) { if (_cachedTexts[i]) delete _cachedTexts[i]; _cachedTexts[i] = NULL; @@ -105,7 +105,7 @@ void CBFontTT::clearCache() { } ////////////////////////////////////////////////////////////////////////// -void CBFontTT::initLoop() { +void BaseFontTT::initLoop() { // we need more aggressive cache management on iOS not to waste too much memory on fonts if (_gameRef->_constrainedMemory) { // purge all cached images not used in the last frame @@ -121,7 +121,7 @@ void CBFontTT::initLoop() { } ////////////////////////////////////////////////////////////////////////// -int CBFontTT::getTextWidth(byte *text, int maxLength) { +int BaseFontTT::getTextWidth(byte *text, int maxLength) { WideString textStr; if (_gameRef->_textEncoding == TEXT_UTF8) textStr = StringUtil::utf8ToWide((char *)text); @@ -138,7 +138,7 @@ int CBFontTT::getTextWidth(byte *text, int maxLength) { } ////////////////////////////////////////////////////////////////////////// -int CBFontTT::getTextHeight(byte *text, int width) { +int BaseFontTT::getTextHeight(byte *text, int width) { WideString textStr; if (_gameRef->_textEncoding == TEXT_UTF8) textStr = StringUtil::utf8ToWide((char *)text); @@ -153,7 +153,7 @@ int CBFontTT::getTextHeight(byte *text, int width) { ////////////////////////////////////////////////////////////////////////// -void CBFontTT::drawText(byte *text, int x, int y, int width, TTextAlign align, int maxHeight, int maxLength) { +void BaseFontTT::drawText(byte *text, int x, int y, int width, TTextAlign align, int maxHeight, int maxLength) { if (text == NULL || strcmp((char *)text, "") == 0) return; WideString textStr = (char *)text; @@ -166,12 +166,12 @@ void CBFontTT::drawText(byte *text, int x, int y, int width, TTextAlign align, i textStr = Common::String(textStr.c_str(), (uint32)maxLength); //text = text.substr(0, MaxLength); // TODO: Remove - CBRenderer *renderer = _gameRef->_renderer; + BaseRenderer *renderer = _gameRef->_renderer; // find cached surface, if exists int minPriority = INT_MAX; int minIndex = -1; - CBSurface *surface = NULL; + BaseSurface *surface = NULL; int textOffset = 0; for (int i = 0; i < NUM_CACHED_TEXTS; i++) { @@ -201,7 +201,7 @@ void CBFontTT::drawText(byte *text, int x, int y, int width, TTextAlign align, i if (surface) { // write surface to cache if (_cachedTexts[minIndex] != NULL) delete _cachedTexts[minIndex]; - _cachedTexts[minIndex] = new CBCachedTTFontText; + _cachedTexts[minIndex] = new BaseCachedTTFontText; _cachedTexts[minIndex]->_surface = surface; _cachedTexts[minIndex]->_align = align; @@ -219,7 +219,7 @@ void CBFontTT::drawText(byte *text, int x, int y, int width, TTextAlign align, i // and paint it if (surface) { Rect32 rc; - CBPlatform::setRect(&rc, 0, 0, surface->getWidth(), surface->getHeight()); + BasePlatform::setRect(&rc, 0, 0, surface->getWidth(), surface->getHeight()); for (int i = 0; i < _layers.getSize(); i++) { uint32 color = _layers[i]->_color; uint32 origForceAlpha = renderer->_forceAlphaColor; @@ -237,7 +237,7 @@ void CBFontTT::drawText(byte *text, int x, int y, int width, TTextAlign align, i } ////////////////////////////////////////////////////////////////////////// -CBSurface *CBFontTT::renderTextToTexture(const WideString &text, int width, TTextAlign align, int maxHeight, int &textOffset) { +BaseSurface *BaseFontTT::renderTextToTexture(const WideString &text, int width, TTextAlign align, int maxHeight, int &textOffset) { //TextLineList lines; // TODO //WrapText(text, width, maxHeight, lines); @@ -256,7 +256,7 @@ CBSurface *CBFontTT::renderTextToTexture(const WideString &text, int width, TTex static bool hasWarned = false; if (!hasWarned) { hasWarned = true; - warning("CBFontTT::RenderTextToTexture - Not fully ported yet"); + warning("BaseFontTT::RenderTextToTexture - Not fully ported yet"); } debugC(kWinterMuteDebugFont, "%s %d %d %d %d", text.c_str(), RGBCOLGetR(_layers[0]->_color), RGBCOLGetG(_layers[0]->_color), RGBCOLGetB(_layers[0]->_color), RGBCOLGetA(_layers[0]->_color)); @@ -274,7 +274,7 @@ CBSurface *CBFontTT::renderTextToTexture(const WideString &text, int width, TTex heightOffset += (int)_lineHeight; } - CBSurface *retSurface = _gameRef->_renderer->createSurface(); + BaseSurface *retSurface = _gameRef->_renderer->createSurface(); Graphics::Surface *convertedSurface = surface->convertTo(Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8 , 0)); retSurface->putSurface(*convertedSurface, true); convertedSurface->free(); @@ -363,7 +363,7 @@ CBSurface *CBFontTT::renderTextToTexture(const WideString &text, int width, TTex posY += GetLineHeight(); } - CBSurfaceOSystem *wmeSurface = new CBSurfaceOSystem(_gameRef); + BaseSurfaceOSystem *wmeSurface = new BaseSurfaceOSystem(_gameRef); if (DID_SUCCEED(wmeSurface->CreateFromSDLSurface(surface))) { SDL_FreeSurface(surface); return wmeSurface; @@ -377,9 +377,9 @@ CBSurface *CBFontTT::renderTextToTexture(const WideString &text, int width, TTex } ////////////////////////////////////////////////////////////////////////// -void CBFontTT::blitSurface(Graphics::Surface *src, Graphics::Surface *target, Common::Rect *targetRect) { +void BaseFontTT::blitSurface(Graphics::Surface *src, Graphics::Surface *target, Common::Rect *targetRect) { //SDL_BlitSurface(src, NULL, target, targetRect); - warning("CBFontTT::BlitSurface - not ported yet"); + warning("BaseFontTT::BlitSurface - not ported yet"); #if 0 for (int y = 0; y < src->h; y++) { if (targetRect->y + y < 0 || targetRect->y + y >= target->h) continue; @@ -401,16 +401,16 @@ void CBFontTT::blitSurface(Graphics::Surface *src, Graphics::Surface *target, Co } ////////////////////////////////////////////////////////////////////////// -int CBFontTT::getLetterHeight() { +int BaseFontTT::getLetterHeight() { return (int)getLineHeight(); } ////////////////////////////////////////////////////////////////////// -bool CBFontTT::loadFile(const char *filename) { +bool BaseFontTT::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { - _gameRef->LOG(0, "CBFontTT::LoadFile failed for file '%s'", filename); + _gameRef->LOG(0, "BaseFontTT::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -444,7 +444,7 @@ TOKEN_DEF(OFFSET_X) TOKEN_DEF(OFFSET_Y) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////// -bool CBFontTT::loadBuffer(byte *buffer) { +bool BaseFontTT::loadBuffer(byte *buffer) { TOKEN_TABLE_START(commands) TOKEN_TABLE(TTFONT) TOKEN_TABLE(SIZE) @@ -462,7 +462,7 @@ bool CBFontTT::loadBuffer(byte *buffer) { char *params; int cmd; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_TTFONT) { _gameRef->LOG(0, "'TTFONT' keyword expected."); @@ -483,7 +483,7 @@ bool CBFontTT::loadBuffer(byte *buffer) { break; case TOKEN_FILENAME: - CBUtils::setString(&_fontFile, params); + BaseUtils::setString(&_fontFile, params); break; case TOKEN_BOLD: @@ -521,7 +521,7 @@ bool CBFontTT::loadBuffer(byte *buffer) { break; case TOKEN_LAYER: { - CBTTFontLayer *Layer = new CBTTFontLayer; + BaseTTFontLayer *Layer = new BaseTTFontLayer; if (Layer && DID_SUCCEED(parseLayer(Layer, (byte *)params))) _layers.add(Layer); else { delete Layer; @@ -540,19 +540,19 @@ bool CBFontTT::loadBuffer(byte *buffer) { // create at least one layer if (_layers.getSize() == 0) { - CBTTFontLayer *Layer = new CBTTFontLayer; + BaseTTFontLayer *Layer = new BaseTTFontLayer; Layer->_color = BaseColor; _layers.add(Layer); } - if (!_fontFile) CBUtils::setString(&_fontFile, "arial.ttf"); + if (!_fontFile) BaseUtils::setString(&_fontFile, "arial.ttf"); return initFont(); } ////////////////////////////////////////////////////////////////////////// -bool CBFontTT::parseLayer(CBTTFontLayer *layer, byte *buffer) { +bool BaseFontTT::parseLayer(BaseTTFontLayer *layer, byte *buffer) { TOKEN_TABLE_START(commands) TOKEN_TABLE(OFFSET_X) TOKEN_TABLE(OFFSET_Y) @@ -562,7 +562,7 @@ bool CBFontTT::parseLayer(CBTTFontLayer *layer, byte *buffer) { char *params; int cmd; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)¶ms)) > 0) { switch (cmd) { @@ -595,8 +595,8 @@ bool CBFontTT::parseLayer(CBTTFontLayer *layer, byte *buffer) { ////////////////////////////////////////////////////////////////////////// -bool CBFontTT::persist(CBPersistMgr *persistMgr) { - CBFont::persist(persistMgr); +bool BaseFontTT::persist(BasePersistenceManager *persistMgr) { + BaseFont::persist(persistMgr); persistMgr->transfer(TMEMBER(_isBold)); persistMgr->transfer(TMEMBER(_isItalic)); @@ -616,7 +616,7 @@ bool CBFontTT::persist(CBPersistMgr *persistMgr) { numLayers = _layers.getSize(); persistMgr->transfer(TMEMBER(numLayers)); for (int i = 0; i < numLayers; i++) { - CBTTFontLayer *layer = new CBTTFontLayer; + BaseTTFontLayer *layer = new BaseTTFontLayer; layer->persist(persistMgr); _layers.add(layer); } @@ -632,18 +632,18 @@ bool CBFontTT::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -void CBFontTT::afterLoad() { +void BaseFontTT::afterLoad() { initFont(); } ////////////////////////////////////////////////////////////////////////// -bool CBFontTT::initFont() { +bool BaseFontTT::initFont() { if (!_fontFile) return STATUS_FAILED; Common::SeekableReadStream *file = _gameRef->_fileManager->openFile(_fontFile); if (!file) { // the requested font file is not in wme file space; try loading a system font - AnsiString fontFileName = PathUtil::combine(CBPlatform::getSystemFontPath(), PathUtil::getFileName(_fontFile)); + AnsiString fontFileName = PathUtil::combine(BasePlatform::getSystemFontPath(), PathUtil::getFileName(_fontFile)); file = _gameRef->_fileManager->openFile(fontFileName.c_str(), false); if (!file) { _gameRef->LOG(0, "Error loading TrueType font '%s'", _fontFile); @@ -659,7 +659,7 @@ bool CBFontTT::initFont() { } if (!_font) { _font = _fallbackFont = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont); - warning("BFontTT::InitFont - Couldn't load %s", _fontFile); + warning("BaseFontTT::InitFont - Couldn't load %s", _fontFile); } _lineHeight = _font->getFontHeight(); return STATUS_OK; @@ -673,8 +673,8 @@ bool CBFontTT::initFont() { _fTStream = (FT_Stream)new byte[sizeof(*_fTStream)]; memset(_fTStream, 0, sizeof(*_fTStream)); - _fTStream->read = CBFontTT::FTReadSeekProc; - _fTStream->close = CBFontTT::FTCloseProc; + _fTStream->read = BaseFontTT::FTReadSeekProc; + _fTStream->close = BaseFontTT::FTCloseProc; _fTStream->descriptor.pointer = file; _fTStream->size = file->GetSize(); @@ -725,7 +725,7 @@ bool CBFontTT::initFont() { } ////////////////////////////////////////////////////////////////////////// -void CBFontTT::measureText(const WideString &text, int maxWidth, int maxHeight, int &textWidth, int &textHeight) { +void BaseFontTT::measureText(const WideString &text, int maxWidth, int maxHeight, int &textWidth, int &textHeight) { //TextLineList lines; // TODO: This function gets called a lot, so warnings like these drown out the usefull information static bool hasWarned = false; diff --git a/engines/wintermute/base/font/base_font_truetype.h b/engines/wintermute/base/font/base_font_truetype.h index 4d8e71a3ff..8a8459b070 100644 --- a/engines/wintermute/base/font/base_font_truetype.h +++ b/engines/wintermute/base/font/base_font_truetype.h @@ -40,22 +40,22 @@ namespace WinterMute { -class CBFontTT : public CBFont { +class BaseFontTT : public BaseFont { private: ////////////////////////////////////////////////////////////////////////// - class CBCachedTTFontText { + class BaseCachedTTFontText { public: WideString _text; int _width; TTextAlign _align; int _maxHeight; int _maxLength; - CBSurface *_surface; + BaseSurface *_surface; int _priority; int _textOffset; bool _marked; - CBCachedTTFontText() { + BaseCachedTTFontText() { //_text = L""; _text = ""; _width = _maxHeight = _maxLength = -1; @@ -66,21 +66,21 @@ private: _marked = false; } - virtual ~CBCachedTTFontText() { + virtual ~BaseCachedTTFontText() { if (_surface) delete _surface; } }; public: ////////////////////////////////////////////////////////////////////////// - class CBTTFontLayer { + class BaseTTFontLayer { public: - CBTTFontLayer() { + BaseTTFontLayer() { _offsetX = _offsetY = 0; _color = 0x00000000; } - bool persist(CBPersistMgr *persistMgr) { + bool persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_offsetX)); persistMgr->transfer(TMEMBER(_offsetY)); persistMgr->transfer(TMEMBER(_color)); @@ -114,9 +114,9 @@ public: public: - DECLARE_PERSISTENT(CBFontTT, CBFont) - CBFontTT(CBGame *inGame); - virtual ~CBFontTT(void); + DECLARE_PERSISTENT(BaseFontTT, BaseFont) + BaseFontTT(BaseGame *inGame); + virtual ~BaseFontTT(void); virtual int getTextWidth(byte *text, int maxLength = -1); virtual int getTextHeight(byte *text, int width); @@ -134,16 +134,16 @@ public: void initLoop(); private: - bool parseLayer(CBTTFontLayer *layer, byte *buffer); + bool parseLayer(BaseTTFontLayer *layer, byte *buffer); void wrapText(const WideString &text, int maxWidth, int maxHeight, TextLineList &lines); void measureText(const WideString &text, int maxWidth, int maxHeight, int &textWidth, int &textHeight); - CBSurface *renderTextToTexture(const WideString &text, int width, TTextAlign align, int maxHeight, int &textOffset); + BaseSurface *renderTextToTexture(const WideString &text, int width, TTextAlign align, int maxHeight, int &textOffset); void blitSurface(Graphics::Surface *src, Graphics::Surface *target, Common::Rect *targetRect); - CBCachedTTFontText *_cachedTexts[NUM_CACHED_TEXTS]; + BaseCachedTTFontText *_cachedTexts[NUM_CACHED_TEXTS]; bool initFont(); @@ -170,7 +170,7 @@ public: int _fontHeight; char *_fontFile; - CBArray _layers; + BaseArray _layers; void clearCache(); }; diff --git a/engines/wintermute/base/gfx/base_image.cpp b/engines/wintermute/base/gfx/base_image.cpp index fb6b23db2b..533c3a866e 100644 --- a/engines/wintermute/base/gfx/base_image.cpp +++ b/engines/wintermute/base/gfx/base_image.cpp @@ -44,7 +44,7 @@ namespace WinterMute { ////////////////////////////////////////////////////////////////////// -CBImage::CBImage(CBGame *inGame, FIBITMAP *bitmap): CBBase(inGame) { +BaseImage::BaseImage(BaseGame *inGame, FIBITMAP *bitmap): BaseClass(inGame) { #if 0 _bitmap = bitmap; #endif @@ -57,7 +57,7 @@ CBImage::CBImage(CBGame *inGame, FIBITMAP *bitmap): CBBase(inGame) { ////////////////////////////////////////////////////////////////////// -CBImage::~CBImage() { +BaseImage::~BaseImage() { /* delete _bitmap; */ delete _decoder; if (_deletableSurface) { @@ -69,7 +69,7 @@ CBImage::~CBImage() { #endif } -bool CBImage::loadFile(const Common::String &filename) { +bool BaseImage::loadFile(const Common::String &filename) { _filename = filename; _filename.toLowercase(); if (StringUtil::startsWith(filename, "savegame:", true)) { @@ -83,7 +83,7 @@ bool CBImage::loadFile(const Common::String &filename) { } else if (_filename.hasSuffix(".jpg")) { _decoder = new Graphics::JPEGDecoder(); } else { - error("CBImage::loadFile : Unsupported fileformat %s", filename.c_str()); + error("BaseImage::loadFile : Unsupported fileformat %s", filename.c_str()); } _filename = filename; Common::SeekableReadStream *file = _gameRef->_fileManager->openFile(filename.c_str()); @@ -97,7 +97,7 @@ bool CBImage::loadFile(const Common::String &filename) { return STATUS_OK; } -byte CBImage::getAlphaAt(int x, int y) { +byte BaseImage::getAlphaAt(int x, int y) { if (!_surface) return 0xFF; uint32 color = *(uint32 *)_surface->getBasePtr(x, y); byte r, g, b, a; @@ -105,13 +105,13 @@ byte CBImage::getAlphaAt(int x, int y) { return a; } -void CBImage::copyFrom(Graphics::Surface *surface) { +void BaseImage::copyFrom(Graphics::Surface *surface) { _surface = _deletableSurface = new Graphics::Surface(); _deletableSurface->copyFrom(*surface); } ////////////////////////////////////////////////////////////////////////// -bool CBImage::saveBMPFile(const char *filename) { +bool BaseImage::saveBMPFile(const char *filename) { #if 0 if (!_bitmap) return STATUS_FAILED; @@ -123,7 +123,7 @@ bool CBImage::saveBMPFile(const char *filename) { ////////////////////////////////////////////////////////////////////////// -bool CBImage::resize(int newWidth, int newHeight) { +bool BaseImage::resize(int newWidth, int newHeight) { #if 0 if (!_bitmap) return STATUS_FAILED; @@ -143,7 +143,7 @@ bool CBImage::resize(int newWidth, int newHeight) { ////////////////////////////////////////////////////////////////////////// -bool CBImage::writeBMPToStream(Common::WriteStream *stream) { +bool BaseImage::writeBMPToStream(Common::WriteStream *stream) { if (!_surface) return false; /* The following is just copied over and inverted to write-ops from the BMP-decoder */ @@ -247,7 +247,7 @@ bool CBImage::writeBMPToStream(Common::WriteStream *stream) { ////////////////////////////////////////////////////////////////////////// -bool CBImage::copyFrom(CBImage *origImage, int newWidth, int newHeight) { +bool BaseImage::copyFrom(BaseImage *origImage, int newWidth, int newHeight) { #if 0 if (_bitmap) FreeImage_Unload(_bitmap); diff --git a/engines/wintermute/base/gfx/base_image.h b/engines/wintermute/base/gfx/base_image.h index 6cda3e6b46..4b43e36a6d 100644 --- a/engines/wintermute/base/gfx/base_image.h +++ b/engines/wintermute/base/gfx/base_image.h @@ -40,12 +40,12 @@ struct FIBITMAP; namespace WinterMute { -class CBSurface; -class CBImage: CBBase { +class BaseSurface; +class BaseImage: BaseClass { public: - CBImage(CBGame *inGame, FIBITMAP *bitmap = NULL); - ~CBImage(); + BaseImage(BaseGame *inGame, FIBITMAP *bitmap = NULL); + ~BaseImage(); bool loadFile(const Common::String &filename); const Graphics::Surface *getSurface() const { @@ -58,7 +58,7 @@ public: bool writeBMPToStream(Common::WriteStream *stream); bool resize(int newWidth, int newHeight); bool saveBMPFile(const char *filename); - bool copyFrom(CBImage *origImage, int newWidth = 0, int newHeight = 0); + bool copyFrom(BaseImage *origImage, int newWidth = 0, int newHeight = 0); void copyFrom(Graphics::Surface *surface); private: Common::String _filename; diff --git a/engines/wintermute/base/gfx/base_renderer.cpp b/engines/wintermute/base/gfx/base_renderer.cpp index a8c19362f6..c46115d70a 100644 --- a/engines/wintermute/base/gfx/base_renderer.cpp +++ b/engines/wintermute/base/gfx/base_renderer.cpp @@ -37,7 +37,7 @@ namespace WinterMute { ////////////////////////////////////////////////////////////////////// -CBRenderer::CBRenderer(CBGame *inGame): CBBase(inGame) { +BaseRenderer::BaseRenderer(BaseGame *inGame): BaseClass(inGame) { _window = 0; _clipperWindow = 0; _active = false; @@ -46,7 +46,7 @@ CBRenderer::CBRenderer(CBGame *inGame): CBBase(inGame) { _forceAlphaColor = 0x00; _width = _height = _bPP = 0; - CBPlatform::setRectEmpty(&_monitorRect); + BasePlatform::setRectEmpty(&_monitorRect); _realWidth = _realHeight = 0; _drawOffsetX = _drawOffsetY = 0; @@ -54,26 +54,26 @@ CBRenderer::CBRenderer(CBGame *inGame): CBBase(inGame) { ////////////////////////////////////////////////////////////////////// -CBRenderer::~CBRenderer() { +BaseRenderer::~BaseRenderer() { deleteRectList(); unclipCursor(); } ////////////////////////////////////////////////////////////////////// -void CBRenderer::initLoop() { +void BaseRenderer::initLoop() { deleteRectList(); } ////////////////////////////////////////////////////////////////////// -CBObject *CBRenderer::getObjectAt(int x, int y) { +BaseObject *BaseRenderer::getObjectAt(int x, int y) { Point32 point; point.x = x; point.y = y; for (int i = _rectList.getSize() - 1; i >= 0; i--) { - if (CBPlatform::ptInRect(&_rectList[i]->_rect, point)) { + if (BasePlatform::ptInRect(&_rectList[i]->_rect, point)) { if (_rectList[i]->_precise) { // frame if (_rectList[i]->_frame) { @@ -100,12 +100,12 @@ CBObject *CBRenderer::getObjectAt(int x, int y) { } } - return (CBObject *)NULL; + return (BaseObject *)NULL; } ////////////////////////////////////////////////////////////////////////// -void CBRenderer::deleteRectList() { +void BaseRenderer::deleteRectList() { for (int i = 0; i < _rectList.getSize(); i++) { delete _rectList[i]; } @@ -115,58 +115,58 @@ void CBRenderer::deleteRectList() { ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// -bool CBRenderer::switchFullscreen() { +bool BaseRenderer::switchFullscreen() { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////// -bool CBRenderer::flip() { +bool BaseRenderer::flip() { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////// -bool CBRenderer::initRenderer(int width, int height, bool windowed) { +bool BaseRenderer::initRenderer(int width, int height, bool windowed) { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////// -void CBRenderer::onWindowChange() { +void BaseRenderer::onWindowChange() { } ////////////////////////////////////////////////////////////////////// -bool CBRenderer::fill(byte r, byte g, byte b, Common::Rect *rect) { +bool BaseRenderer::fill(byte r, byte g, byte b, Common::Rect *rect) { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -bool CBRenderer::windowedBlt() { +bool BaseRenderer::windowedBlt() { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -bool CBRenderer::setup2D(bool Force) { +bool BaseRenderer::setup2D(bool Force) { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -bool CBRenderer::setupLines() { +bool BaseRenderer::setupLines() { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -bool CBRenderer::drawLine(int x1, int y1, int x2, int y2, uint32 color) { +bool BaseRenderer::drawLine(int x1, int y1, int x2, int y2, uint32 color) { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -bool CBRenderer::drawRect(int x1, int y1, int x2, int y2, uint32 color, int width) { +bool BaseRenderer::drawRect(int x1, int y1, int x2, int y2, uint32 color, int width) { for (int i = 0; i < width; i++) { drawLine(x1 + i, y1 + i, x2 - i, y1 + i, color); // up drawLine(x1 + i, y2 - i, x2 - i + 1, y2 - i, color); // down @@ -179,31 +179,31 @@ bool CBRenderer::drawRect(int x1, int y1, int x2, int y2, uint32 color, int widt ////////////////////////////////////////////////////////////////////////// -bool CBRenderer::fade(uint16 alpha) { +bool BaseRenderer::fade(uint16 alpha) { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -bool CBRenderer::fadeToColor(uint32 color, Common::Rect *rect) { +bool BaseRenderer::fadeToColor(uint32 color, Common::Rect *rect) { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -bool CBRenderer::setViewport(int left, int top, int right, int bottom) { +bool BaseRenderer::setViewport(int left, int top, int right, int bottom) { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -bool CBRenderer::setScreenViewport() { +bool BaseRenderer::setScreenViewport() { return setViewport(_drawOffsetX, _drawOffsetY, _width + _drawOffsetX, _height + _drawOffsetY); } ////////////////////////////////////////////////////////////////////////// -bool CBRenderer::setViewport(Rect32 *rect) { +bool BaseRenderer::setViewport(Rect32 *rect) { return setViewport(rect->left + _drawOffsetX, rect->top + _drawOffsetY, rect->right + _drawOffsetX, @@ -212,13 +212,13 @@ bool CBRenderer::setViewport(Rect32 *rect) { ////////////////////////////////////////////////////////////////////////// -CBImage *CBRenderer::takeScreenshot() { +BaseImage *BaseRenderer::takeScreenshot() { return NULL; } ////////////////////////////////////////////////////////////////////////// -bool CBRenderer::clipCursor() { +bool BaseRenderer::clipCursor() { /* if (!_windowed) { Rect32 rc; @@ -237,7 +237,7 @@ bool CBRenderer::clipCursor() { } ////////////////////////////////////////////////////////////////////////// -bool CBRenderer::unclipCursor() { +bool BaseRenderer::unclipCursor() { /* if (!_windowed) ::ClipCursor(NULL); */ @@ -245,7 +245,7 @@ bool CBRenderer::unclipCursor() { } ////////////////////////////////////////////////////////////////////////// -bool CBRenderer::pointInViewport(Point32 *p) { +bool BaseRenderer::pointInViewport(Point32 *p) { if (p->x < _drawOffsetX) return false; if (p->y < _drawOffsetY) return false; if (p->x > _drawOffsetX + _width) return false; diff --git a/engines/wintermute/base/gfx/base_renderer.h b/engines/wintermute/base/gfx/base_renderer.h index d743f19791..118cda0ec6 100644 --- a/engines/wintermute/base/gfx/base_renderer.h +++ b/engines/wintermute/base/gfx/base_renderer.h @@ -36,11 +36,11 @@ namespace WinterMute { -class CBImage; -class CBActiveRect; -class CBObject; -class CBSurface; -class CBRenderer: public CBBase { +class BaseImage; +class BaseActiveRect; +class BaseObject; +class BaseSurface; +class BaseRenderer: public BaseClass { public: int _realWidth; int _realHeight; @@ -48,7 +48,7 @@ public: int _drawOffsetY; virtual void dumpData(const char *filename) {}; - virtual CBImage *takeScreenshot(); + virtual BaseImage *takeScreenshot(); virtual bool setViewport(int left, int top, int right, int bottom); virtual bool setViewport(Rect32 *Rect); virtual bool setScreenViewport(); @@ -56,8 +56,8 @@ public: virtual bool fadeToColor(uint32 Color, Common::Rect *rect = NULL); virtual bool drawLine(int x1, int y1, int x2, int y2, uint32 color); virtual bool drawRect(int x1, int y1, int x2, int y2, uint32 color, int width = 1); - CBRenderer(CBGame *inGame = NULL); - virtual ~CBRenderer(); + BaseRenderer(BaseGame *inGame = NULL); + virtual ~BaseRenderer(); virtual bool setProjection() { return STATUS_OK; }; @@ -89,12 +89,12 @@ public: return 1.0f; } - virtual CBSurface *createSurface() = 0; + virtual BaseSurface *createSurface() = 0; bool clipCursor(); bool unclipCursor(); - CBObject *getObjectAt(int x, int y); + BaseObject *getObjectAt(int x, int y); void deleteRectList(); virtual bool startSpriteBatch() { @@ -118,10 +118,10 @@ public: int _height; int _width; - CBArray _rectList; + BaseArray _rectList; }; -CBRenderer *makeOSystemRenderer(CBGame *inGame); // Implemented in BRenderSDL.cpp +BaseRenderer *makeOSystemRenderer(BaseGame *inGame); // Implemented in BRenderSDL.cpp } // end of namespace WinterMute diff --git a/engines/wintermute/base/gfx/base_surface.cpp b/engines/wintermute/base/gfx/base_surface.cpp index 73b385d180..684236ac7f 100644 --- a/engines/wintermute/base/gfx/base_surface.cpp +++ b/engines/wintermute/base/gfx/base_surface.cpp @@ -33,7 +33,7 @@ namespace WinterMute { ////////////////////////////////////////////////////////////////////// -CBSurface::CBSurface(CBGame *inGame): CBBase(inGame) { +BaseSurface::BaseSurface(BaseGame *inGame): BaseClass(inGame) { _referenceCount = 0; _width = _height = 0; @@ -53,87 +53,87 @@ CBSurface::CBSurface(CBGame *inGame): CBBase(inGame) { ////////////////////////////////////////////////////////////////////// -CBSurface::~CBSurface() { +BaseSurface::~BaseSurface() { if (_pixelOpReady) endPixelOp(); } ////////////////////////////////////////////////////////////////////// -bool CBSurface::create(const char *filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime, bool keepLoaded) { +bool BaseSurface::create(const char *filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime, bool keepLoaded) { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////// -bool CBSurface::restore() { +bool BaseSurface::restore() { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////// -bool CBSurface::isTransparentAt(int x, int y) { +bool BaseSurface::isTransparentAt(int x, int y) { return false; } ////////////////////////////////////////////////////////////////////// -bool CBSurface::displayHalfTrans(int x, int y, Rect32 rect) { +bool BaseSurface::displayHalfTrans(int x, int y, Rect32 rect) { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -bool CBSurface::displayTransform(int x, int y, int hotX, int hotY, Rect32 rect, float zoomX, float zoomY, uint32 alpha, float rotate, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { +bool BaseSurface::displayTransform(int x, int y, int hotX, int hotY, Rect32 rect, float zoomX, float zoomY, uint32 alpha, float rotate, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { return displayTransZoom(x, y, rect, zoomX, zoomY, alpha, blendMode, mirrorX, mirrorY); } ////////////////////////////////////////////////////////////////////////// -bool CBSurface::create(int Width, int Height) { +bool BaseSurface::create(int Width, int Height) { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -bool CBSurface::startPixelOp() { +bool BaseSurface::startPixelOp() { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -bool CBSurface::endPixelOp() { +bool BaseSurface::endPixelOp() { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -bool CBSurface::getPixel(int x, int y, byte *r, byte *g, byte *b, byte *a) { +bool BaseSurface::getPixel(int x, int y, byte *r, byte *g, byte *b, byte *a) { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -bool CBSurface::putPixel(int x, int y, byte r, byte g, byte b, int a) { +bool BaseSurface::putPixel(int x, int y, byte r, byte g, byte b, int a) { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -bool CBSurface::comparePixel(int x, int y, byte r, byte g, byte b, int a) { +bool BaseSurface::comparePixel(int x, int y, byte r, byte g, byte b, int a) { return false; } ////////////////////////////////////////////////////////////////////// -bool CBSurface::isTransparentAtLite(int x, int y) { +bool BaseSurface::isTransparentAtLite(int x, int y) { return false; } ////////////////////////////////////////////////////////////////////////// -bool CBSurface::invalidate() { +bool BaseSurface::invalidate() { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -bool CBSurface::prepareToDraw() { +bool BaseSurface::prepareToDraw() { _lastUsedTime = _gameRef->_liveTimer; if (!_valid) { @@ -144,7 +144,7 @@ bool CBSurface::prepareToDraw() { ////////////////////////////////////////////////////////////////////////// -void CBSurface::setSize(int width, int height) { +void BaseSurface::setSize(int width, int height) { _width = width; _height = height; } diff --git a/engines/wintermute/base/gfx/base_surface.h b/engines/wintermute/base/gfx/base_surface.h index 22c1fb83b8..9a72cbb236 100644 --- a/engines/wintermute/base/gfx/base_surface.h +++ b/engines/wintermute/base/gfx/base_surface.h @@ -35,7 +35,7 @@ namespace WinterMute { -class CBSurface: public CBBase { +class BaseSurface: public BaseClass { public: virtual bool invalidate(); virtual bool prepareToDraw(); @@ -50,8 +50,8 @@ public: bool _keepLoaded; bool _pixelOpReady; - CBSurface(CBGame *inGame); - virtual ~CBSurface(); + BaseSurface(BaseGame *inGame); + virtual ~BaseSurface(); virtual bool displayHalfTrans(int x, int y, Rect32 rect); virtual bool isTransparentAt(int x, int y); diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp index dbd2511928..ec69a80095 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp @@ -41,7 +41,7 @@ namespace WinterMute { -RenderTicket::RenderTicket(CBSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, bool mirrorX, bool mirrorY) : _owner(owner), +RenderTicket::RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, bool mirrorX, bool mirrorY) : _owner(owner), _srcRect(*srcRect), _dstRect(*dstRect), _drawNum(0), _isValid(true), _wantsDraw(true), _hasAlpha(true) { _colorMod = 0; _mirror = TransparentSurface::FLIP_NONE; @@ -89,14 +89,14 @@ bool RenderTicket::operator==(RenderTicket &t) { return true; } -CBRenderer *makeOSystemRenderer(CBGame *inGame) { - return new CBRenderOSystem(inGame); +BaseRenderer *makeOSystemRenderer(BaseGame *inGame) { + return new BaseRenderOSystem(inGame); } // TODO: Redo everything here. ////////////////////////////////////////////////////////////////////////// -CBRenderOSystem::CBRenderOSystem(CBGame *inGame) : CBRenderer(inGame) { +BaseRenderOSystem::BaseRenderOSystem(BaseGame *inGame) : BaseRenderer(inGame) { _renderSurface = new Graphics::Surface(); _drawNum = 1; _needsFlip = true; @@ -110,7 +110,7 @@ CBRenderOSystem::CBRenderOSystem(CBGame *inGame) : CBRenderer(inGame) { } ////////////////////////////////////////////////////////////////////////// -CBRenderOSystem::~CBRenderOSystem() { +BaseRenderOSystem::~BaseRenderOSystem() { _renderSurface->free(); delete _renderSurface; #if 0 @@ -121,7 +121,7 @@ CBRenderOSystem::~CBRenderOSystem() { } ////////////////////////////////////////////////////////////////////////// -bool CBRenderOSystem::initRenderer(int width, int height, bool windowed) { +bool BaseRenderOSystem::initRenderer(int width, int height, bool windowed) { //if (SDL_Init(SDL_INIT_VIDEO) < 0) return STATUS_FAILED; #if 0 @@ -237,20 +237,20 @@ bool CBRenderOSystem::initRenderer(int width, int height, bool windowed) { return STATUS_OK; } -void CBRenderOSystem::setAlphaMod(byte alpha) { +void BaseRenderOSystem::setAlphaMod(byte alpha) { byte r = RGBCOLGetR(_colorMod); byte g = RGBCOLGetB(_colorMod); byte b = RGBCOLGetB(_colorMod); _colorMod = BS_ARGB(alpha, r, g, b); } -void CBRenderOSystem::setColorMod(byte r, byte g, byte b) { +void BaseRenderOSystem::setColorMod(byte r, byte g, byte b) { byte alpha = RGBCOLGetA(_colorMod); _colorMod = BS_ARGB(alpha, r, g, b); } ////////////////////////////////////////////////////////////////////////// -bool CBRenderOSystem::flip() { +bool BaseRenderOSystem::flip() { if (!_disableDirtyRects) { drawTickets(); } @@ -270,7 +270,7 @@ bool CBRenderOSystem::flip() { } ////////////////////////////////////////////////////////////////////////// -bool CBRenderOSystem::fill(byte r, byte g, byte b, Common::Rect *rect) { +bool BaseRenderOSystem::fill(byte r, byte g, byte b, Common::Rect *rect) { //SDL_SetRenderDrawColor(_renderer, r, g, b, 0xFF); //SDL_RenderClear(_renderer); _clearColor = _renderSurface->format.ARGBToColor(0xFF, r, g, b); @@ -285,20 +285,20 @@ bool CBRenderOSystem::fill(byte r, byte g, byte b, Common::Rect *rect) { } ////////////////////////////////////////////////////////////////////////// -bool CBRenderOSystem::fade(uint16 Alpha) { +bool BaseRenderOSystem::fade(uint16 Alpha) { uint32 dwAlpha = 255 - Alpha; return fadeToColor(dwAlpha << 24); } ////////////////////////////////////////////////////////////////////////// -bool CBRenderOSystem::fadeToColor(uint32 Color, Common::Rect *rect) { +bool BaseRenderOSystem::fadeToColor(uint32 Color, Common::Rect *rect) { // This particular warning is rather messy, as this function is called a ton, // thus we avoid printing it more than once. static bool hasWarned = false; if (!hasWarned) { - warning("CBRenderOSystem::FadeToColor - Breaks when using dirty rects"); - warning("Implement CBRenderOSystem::FadeToColor"); // TODO. + warning("BaseRenderOSystem::FadeToColor - Breaks when using dirty rects"); + warning("Implement BaseRenderOSystem::FadeToColor"); // TODO. hasWarned = true; } @@ -347,7 +347,7 @@ bool CBRenderOSystem::fadeToColor(uint32 Color, Common::Rect *rect) { return STATUS_OK; } -void CBRenderOSystem::drawSurface(CBSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, bool mirrorX, bool mirrorY) { +void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, bool mirrorX, bool mirrorY) { if (_disableDirtyRects) { RenderTicket renderTicket(owner, surf, srcRect, dstRect, mirrorX, mirrorY); // HINT: The surface-data contains other info than it should. @@ -375,13 +375,13 @@ void CBRenderOSystem::drawSurface(CBSurfaceOSystem *owner, const Graphics::Surfa drawFromTicket(ticket); } -void CBRenderOSystem::invalidateTicket(RenderTicket *renderTicket) { +void BaseRenderOSystem::invalidateTicket(RenderTicket *renderTicket) { addDirtyRect(renderTicket->_dstRect); renderTicket->_isValid = false; // renderTicket->_canDelete = true; // TODO: Maybe readd this, to avoid even more duplicates. } -void CBRenderOSystem::invalidateTicketsFromSurface(CBSurfaceOSystem *surf) { +void BaseRenderOSystem::invalidateTicketsFromSurface(BaseSurfaceOSystem *surf) { RenderQueueIterator it; for (it = _renderQueue.begin(); it != _renderQueue.end(); it++) { if ((*it)->_owner == surf) { @@ -390,7 +390,7 @@ void CBRenderOSystem::invalidateTicketsFromSurface(CBSurfaceOSystem *surf) { } } -void CBRenderOSystem::drawFromTicket(RenderTicket *renderTicket) { +void BaseRenderOSystem::drawFromTicket(RenderTicket *renderTicket) { renderTicket->_wantsDraw = true; // A new item always has _drawNum == 0 if (renderTicket->_drawNum == 0) { @@ -445,7 +445,7 @@ void CBRenderOSystem::drawFromTicket(RenderTicket *renderTicket) { } } -void CBRenderOSystem::addDirtyRect(const Common::Rect &rect) { +void BaseRenderOSystem::addDirtyRect(const Common::Rect &rect) { if (!_dirtyRect) { _dirtyRect = new Common::Rect(rect); } else { @@ -455,7 +455,7 @@ void CBRenderOSystem::addDirtyRect(const Common::Rect &rect) { // warning("AddDirtyRect: %d %d %d %d", rect.left, rect.top, rect.right, rect.bottom); } -void CBRenderOSystem::drawTickets() { +void BaseRenderOSystem::drawTickets() { RenderQueueIterator it = _renderQueue.begin(); // Clean out the old tickets int decrement = 0; @@ -511,7 +511,7 @@ void CBRenderOSystem::drawTickets() { } // Replacement for SDL2's SDL_RenderCopy -void CBRenderOSystem::drawFromSurface(const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, Common::Rect *clipRect, uint32 mirror) { +void BaseRenderOSystem::drawFromSurface(const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, Common::Rect *clipRect, uint32 mirror) { TransparentSurface src(*surf, false); bool doDelete = false; if (!clipRect) { @@ -527,10 +527,10 @@ void CBRenderOSystem::drawFromSurface(const Graphics::Surface *surf, Common::Rec } ////////////////////////////////////////////////////////////////////////// -bool CBRenderOSystem::drawLine(int x1, int y1, int x2, int y2, uint32 color) { +bool BaseRenderOSystem::drawLine(int x1, int y1, int x2, int y2, uint32 color) { static bool hasWarned = false; if (!hasWarned) { - warning("CBRenderOSystem::DrawLine - not fully ported yet"); + warning("BaseRenderOSystem::DrawLine - not fully ported yet"); hasWarned = true; } byte r = RGBCOLGetR(color); @@ -558,10 +558,10 @@ bool CBRenderOSystem::drawLine(int x1, int y1, int x2, int y2, uint32 color) { } ////////////////////////////////////////////////////////////////////////// -CBImage *CBRenderOSystem::takeScreenshot() { +BaseImage *BaseRenderOSystem::takeScreenshot() { // TODO: Fix this - warning("CBRenderOSystem::TakeScreenshot() - not ported yet"); - CBImage *screenshot = new CBImage(_gameRef); + warning("BaseRenderOSystem::TakeScreenshot() - not ported yet"); + BaseImage *screenshot = new BaseImage(_gameRef); screenshot->copyFrom(_renderSurface); return screenshot; #if 0 @@ -584,13 +584,13 @@ CBImage *CBRenderOSystem::takeScreenshot() { memcpy(bits, src, bytespp * viewport.w); } - return new CBImage(_gameRef, dib); + return new BaseImage(_gameRef, dib); #endif return NULL; } ////////////////////////////////////////////////////////////////////////// -bool CBRenderOSystem::switchFullscreen() { +bool BaseRenderOSystem::switchFullscreen() { /*if (_windowed) SDL_SetWindowFullscreen(_win, SDL_TRUE); else SDL_SetWindowFullscreen(_win, SDL_FALSE); @@ -602,7 +602,7 @@ bool CBRenderOSystem::switchFullscreen() { } ////////////////////////////////////////////////////////////////////////// -const char *CBRenderOSystem::getName() { +const char *BaseRenderOSystem::getName() { if (_name.empty()) { #if 0 if (_renderer) { @@ -616,7 +616,7 @@ const char *CBRenderOSystem::getName() { } ////////////////////////////////////////////////////////////////////////// -bool CBRenderOSystem::setViewport(int left, int top, int right, int bottom) { +bool BaseRenderOSystem::setViewport(int left, int top, int right, int bottom) { Common::Rect rect; // TODO: Hopefully this is the same logic that ScummVM uses. rect.left = (int16)(left + _borderLeft); @@ -632,7 +632,7 @@ bool CBRenderOSystem::setViewport(int left, int top, int right, int bottom) { } ////////////////////////////////////////////////////////////////////////// -void CBRenderOSystem::modTargetRect(Common::Rect *rect) { +void BaseRenderOSystem::modTargetRect(Common::Rect *rect) { #if 0 SDL_Rect viewportRect; SDL_RenderGetViewport(GetSdlRenderer(), &viewportRect); @@ -645,7 +645,7 @@ void CBRenderOSystem::modTargetRect(Common::Rect *rect) { } ////////////////////////////////////////////////////////////////////////// -void CBRenderOSystem::pointFromScreen(Point32 *point) { +void BaseRenderOSystem::pointFromScreen(Point32 *point) { #if 0 SDL_Rect viewportRect; SDL_RenderGetViewport(GetSdlRenderer(), &viewportRect); @@ -657,7 +657,7 @@ void CBRenderOSystem::pointFromScreen(Point32 *point) { ////////////////////////////////////////////////////////////////////////// -void CBRenderOSystem::pointToScreen(Point32 *point) { +void BaseRenderOSystem::pointToScreen(Point32 *point) { #if 0 SDL_Rect viewportRect; SDL_RenderGetViewport(GetSdlRenderer(), &viewportRect); @@ -668,19 +668,19 @@ void CBRenderOSystem::pointToScreen(Point32 *point) { } ////////////////////////////////////////////////////////////////////////// -void CBRenderOSystem::dumpData(const char *filename) { - warning("CBRenderOSystem::DumpData(%s) - not reimplemented yet", filename); // TODO +void BaseRenderOSystem::dumpData(const char *filename) { + warning("BaseRenderOSystem::DumpData(%s) - not reimplemented yet", filename); // TODO #if 0 FILE *f = fopen(filename, "wt"); if (!f) return; - CBSurfaceStorage *Mgr = _gameRef->_surfaceStorage; + BaseSurfaceStorage *Mgr = _gameRef->_surfaceStorage; int TotalKB = 0; int TotalLoss = 0; fprintf(f, "Filename;Usage;Size;KBytes\n"); for (int i = 0; i < Mgr->_surfaces.getSize(); i++) { - CBSurfaceOSystem *Surf = (CBSurfaceOSystem *)Mgr->_surfaces[i]; + BaseSurfaceOSystem *Surf = (BaseSurfaceOSystem *)Mgr->_surfaces[i]; if (!Surf->_filename) continue; if (!Surf->_valid) continue; @@ -702,8 +702,8 @@ void CBRenderOSystem::dumpData(const char *filename) { #endif } -CBSurface *CBRenderOSystem::createSurface() { - return new CBSurfaceOSystem(_gameRef); +BaseSurface *BaseRenderOSystem::createSurface() { + return new BaseSurfaceOSystem(_gameRef); } } // end of namespace WinterMute diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.h b/engines/wintermute/base/gfx/osystem/base_render_osystem.h index 8a8eb88ede..75c745ecf7 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.h +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.h @@ -35,11 +35,11 @@ #include "common/list.h" namespace WinterMute { -class CBSurfaceOSystem; +class BaseSurfaceOSystem; class RenderTicket { Graphics::Surface *_surface; public: - RenderTicket(CBSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRest, bool mirrorX = false, bool mirrorY = false); + RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRest, bool mirrorX = false, bool mirrorY = false); RenderTicket() : _isValid(true), _wantsDraw(false), _drawNum(0) {} ~RenderTicket(); const Graphics::Surface *getSurface() { return _surface; } @@ -53,14 +53,14 @@ public: uint32 _drawNum; uint32 _colorMod; - CBSurfaceOSystem *_owner; + BaseSurfaceOSystem *_owner; bool operator==(RenderTicket &a); }; -class CBRenderOSystem : public CBRenderer { +class BaseRenderOSystem : public BaseRenderer { public: - CBRenderOSystem(CBGame *inGame); - ~CBRenderOSystem(); + BaseRenderOSystem(BaseGame *inGame); + ~BaseRenderOSystem(); const char *getName(); @@ -75,12 +75,12 @@ public: bool drawLine(int x1, int y1, int x2, int y2, uint32 color); - CBImage *takeScreenshot(); + BaseImage *takeScreenshot(); void setAlphaMod(byte alpha); void setColorMod(byte r, byte g, byte b); void invalidateTicket(RenderTicket *renderTicket); - void invalidateTicketsFromSurface(CBSurfaceOSystem *surf); + void invalidateTicketsFromSurface(BaseSurfaceOSystem *surf); void drawFromTicket(RenderTicket *renderTicket); bool setViewport(int left, int top, int right, int bottom); @@ -98,8 +98,8 @@ public: return _ratioY; } - void drawSurface(CBSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, bool mirrorX, bool mirrorY); - CBSurface *createSurface(); + void drawSurface(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, bool mirrorX, bool mirrorY); + BaseSurface *createSurface(); private: void addDirtyRect(const Common::Rect &rect); void drawTickets(); diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp index 87c5731b49..0de31349fd 100644 --- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp @@ -46,7 +46,7 @@ namespace WinterMute { ////////////////////////////////////////////////////////////////////////// -CBSurfaceOSystem::CBSurfaceOSystem(CBGame *inGame) : CBSurface(inGame) { +BaseSurfaceOSystem::BaseSurfaceOSystem(BaseGame *inGame) : BaseSurface(inGame) { _surface = new Graphics::Surface(); _alphaMask = NULL; _hasAlpha = true; @@ -56,7 +56,7 @@ CBSurfaceOSystem::CBSurfaceOSystem(CBGame *inGame) : CBSurface(inGame) { } ////////////////////////////////////////////////////////////////////////// -CBSurfaceOSystem::~CBSurfaceOSystem() { +BaseSurfaceOSystem::~BaseSurfaceOSystem() { //TODO if (_surface) { _surface->free(); @@ -68,7 +68,7 @@ CBSurfaceOSystem::~CBSurfaceOSystem() { _alphaMask = NULL; _gameRef->addMem(-_width * _height * 4); - CBRenderOSystem *renderer = static_cast(_gameRef->_renderer); + BaseRenderOSystem *renderer = static_cast(_gameRef->_renderer); renderer->invalidateTicketsFromSurface(this); } @@ -91,8 +91,8 @@ bool hasTransparency(Graphics::Surface *surf) { } ////////////////////////////////////////////////////////////////////////// -bool CBSurfaceOSystem::create(const char *filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime, bool keepLoaded) { - /* CBRenderOSystem *renderer = static_cast(_gameRef->_renderer); */ +bool BaseSurfaceOSystem::create(const char *filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime, bool keepLoaded) { + /* BaseRenderOSystem *renderer = static_cast(_gameRef->_renderer); */ _filename = filename; // const Graphics::Surface *surface = image->getSurface(); @@ -116,8 +116,8 @@ bool CBSurfaceOSystem::create(const char *filename, bool defaultCK, byte ckRed, return STATUS_OK; } -void CBSurfaceOSystem::finishLoad() { - CBImage *image = new CBImage(_gameRef); +void BaseSurfaceOSystem::finishLoad() { + BaseImage *image = new BaseImage(_gameRef); image->loadFile(_filename); _width = image->getSurface()->w; @@ -191,8 +191,8 @@ void CBSurfaceOSystem::finishLoad() { } ////////////////////////////////////////////////////////////////////////// -void CBSurfaceOSystem::genAlphaMask(Graphics::Surface *surface) { - warning("CBSurfaceOSystem::GenAlphaMask - Not ported yet"); +void BaseSurfaceOSystem::genAlphaMask(Graphics::Surface *surface) { + warning("BaseSurfaceOSystem::GenAlphaMask - Not ported yet"); return; delete[] _alphaMask; @@ -237,8 +237,8 @@ void CBSurfaceOSystem::genAlphaMask(Graphics::Surface *surface) { } ////////////////////////////////////////////////////////////////////////// -uint32 CBSurfaceOSystem::getPixel(Graphics::Surface *surface, int x, int y) { - warning("CBSurfaceOSystem::GetPixel - Not ported yet"); +uint32 BaseSurfaceOSystem::getPixel(Graphics::Surface *surface, int x, int y) { + warning("BaseSurfaceOSystem::GetPixel - Not ported yet"); int bpp = surface->format.bytesPerPixel; /* Here p is the address to the pixel we want to retrieve */ uint8 *p = (uint8 *)surface->pixels + y * surface->pitch + x * bpp; @@ -273,10 +273,10 @@ uint32 CBSurfaceOSystem::getPixel(Graphics::Surface *surface, int x, int y) { } ////////////////////////////////////////////////////////////////////////// -bool CBSurfaceOSystem::create(int width, int height) { - warning("CBSurfaceOSystem::Create not ported yet"); //TODO +bool BaseSurfaceOSystem::create(int width, int height) { + warning("BaseSurfaceOSystem::Create not ported yet"); //TODO #if 0 - CBRenderOSystem *renderer = static_cast(_gameRef->_renderer); + BaseRenderOSystem *renderer = static_cast(_gameRef->_renderer); _texture = SDL_CreateTexture(renderer->GetSdlRenderer(), SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, Width, Height); #endif _width = width; @@ -290,10 +290,10 @@ bool CBSurfaceOSystem::create(int width, int height) { } ////////////////////////////////////////////////////////////////////////// -bool CBSurfaceOSystem::createFromSDLSurface(Graphics::Surface *surface) { - warning("CBSurfaceOSystem::CreateFromSDLSurface not ported yet"); //TODO +bool BaseSurfaceOSystem::createFromSDLSurface(Graphics::Surface *surface) { + warning("BaseSurfaceOSystem::CreateFromSDLSurface not ported yet"); //TODO #if 0 - CBRenderOSystem *renderer = static_cast(_gameRef->_renderer); + BaseRenderOSystem *renderer = static_cast(_gameRef->_renderer); _texture = SDL_CreateTextureFromSurface(renderer->GetSdlRenderer(), surface); #endif if (_surface) { @@ -314,12 +314,12 @@ bool CBSurfaceOSystem::createFromSDLSurface(Graphics::Surface *surface) { } ////////////////////////////////////////////////////////////////////////// -bool CBSurfaceOSystem::isTransparentAt(int x, int y) { +bool BaseSurfaceOSystem::isTransparentAt(int x, int y) { // This particular warning is rather messy, as this function is called a ton, // thus we avoid printing it more than once. static bool hasWarned = false; if (!hasWarned) { - warning("CBSurfaceOSystem::IsTransparentAt not ported yet"); + warning("BaseSurfaceOSystem::IsTransparentAt not ported yet"); hasWarned = true; } #if 0 @@ -340,14 +340,14 @@ bool CBSurfaceOSystem::isTransparentAt(int x, int y) { } ////////////////////////////////////////////////////////////////////////// -bool CBSurfaceOSystem::isTransparentAtLite(int x, int y) { +bool BaseSurfaceOSystem::isTransparentAtLite(int x, int y) { //if (!_lockPixels) return false; // This particular warning is rather messy, as this function is called a ton, // thus we avoid printing it more than once. static bool hasWarned = false; if (!hasWarned) { - warning("CBSurfaceOSystem::IsTransparentAtLite not ported yet"); + warning("BaseSurfaceOSystem::IsTransparentAtLite not ported yet"); hasWarned = true; } if (_surface->format.bytesPerPixel == 4) { @@ -387,57 +387,57 @@ bool CBSurfaceOSystem::isTransparentAtLite(int x, int y) { } ////////////////////////////////////////////////////////////////////////// -bool CBSurfaceOSystem::startPixelOp() { +bool BaseSurfaceOSystem::startPixelOp() { //SDL_LockTexture(_texture, NULL, &_lockPixels, &_lockPitch); // Any pixel-op makes the caching useless: - CBRenderOSystem *renderer = static_cast(_gameRef->_renderer); + BaseRenderOSystem *renderer = static_cast(_gameRef->_renderer); renderer->invalidateTicketsFromSurface(this); return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CBSurfaceOSystem::endPixelOp() { +bool BaseSurfaceOSystem::endPixelOp() { //SDL_UnlockTexture(_texture); return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CBSurfaceOSystem::display(int x, int y, Rect32 rect, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { +bool BaseSurfaceOSystem::display(int x, int y, Rect32 rect, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { return drawSprite(x, y, &rect, 100, 100, 0xFFFFFFFF, true, blendMode, mirrorX, mirrorY); } ////////////////////////////////////////////////////////////////////////// -bool CBSurfaceOSystem::displayTrans(int x, int y, Rect32 rect, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { +bool BaseSurfaceOSystem::displayTrans(int x, int y, Rect32 rect, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { return drawSprite(x, y, &rect, 100, 100, alpha, false, blendMode, mirrorX, mirrorY); } ////////////////////////////////////////////////////////////////////////// -bool CBSurfaceOSystem::displayTransOffset(int x, int y, Rect32 rect, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY, int offsetX, int offsetY) { +bool BaseSurfaceOSystem::displayTransOffset(int x, int y, Rect32 rect, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY, int offsetX, int offsetY) { return drawSprite(x, y, &rect, 100, 100, alpha, false, blendMode, mirrorX, mirrorY, offsetX, offsetY); } ////////////////////////////////////////////////////////////////////////// -bool CBSurfaceOSystem::displayTransZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { +bool BaseSurfaceOSystem::displayTransZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { return drawSprite(x, y, &rect, zoomX, zoomY, alpha, false, blendMode, mirrorX, mirrorY); } ////////////////////////////////////////////////////////////////////////// -bool CBSurfaceOSystem::displayZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha, bool Transparent, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { +bool BaseSurfaceOSystem::displayZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha, bool Transparent, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { return drawSprite(x, y, &rect, zoomX, zoomY, alpha, !Transparent, blendMode, mirrorX, mirrorY); } ////////////////////////////////////////////////////////////////////////// -bool CBSurfaceOSystem::displayTransform(int x, int y, int hotX, int hotY, Rect32 rect, float zoomX, float zoomY, uint32 alpha, float rotate, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { +bool BaseSurfaceOSystem::displayTransform(int x, int y, int hotX, int hotY, Rect32 rect, float zoomX, float zoomY, uint32 alpha, float rotate, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { return drawSprite(x, y, &rect, zoomX, zoomY, alpha, false, blendMode, mirrorX, mirrorY); } ////////////////////////////////////////////////////////////////////////// -bool CBSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, float zoomX, float zoomY, uint32 alpha, bool alphaDisable, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY, int offsetX, int offsetY) { - CBRenderOSystem *renderer = static_cast(_gameRef->_renderer); +bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, float zoomX, float zoomY, uint32 alpha, bool alphaDisable, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY, int offsetX, int offsetY) { + BaseRenderOSystem *renderer = static_cast(_gameRef->_renderer); if (!_loaded) { finishLoad(); @@ -450,7 +450,7 @@ bool CBSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, float zoomX, float // thus we avoid printing it more than once. static bool hasWarned = false; if (!hasWarned) { - warning("CBSurfaceOSystem::DrawSprite not fully ported yet"); // TODO. + warning("BaseSurfaceOSystem::DrawSprite not fully ported yet"); // TODO. hasWarned = true; } @@ -508,7 +508,7 @@ bool CBSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, float zoomX, float hasAlpha = false; } if (alphaDisable) { - warning("CBSurfaceOSystem::drawSprite - AlphaDisable ignored"); + warning("BaseSurfaceOSystem::drawSprite - AlphaDisable ignored"); } renderer->drawSurface(this, _surface, &srcRect, &position, mirrorX, mirrorY); @@ -519,11 +519,11 @@ bool CBSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, float zoomX, float return STATUS_OK; } -bool CBSurfaceOSystem::putSurface(const Graphics::Surface &surface, bool hasAlpha) { +bool BaseSurfaceOSystem::putSurface(const Graphics::Surface &surface, bool hasAlpha) { _loaded = true; _surface->copyFrom(surface); _hasAlpha = hasAlpha; - CBRenderOSystem *renderer = static_cast(_gameRef->_renderer); + BaseRenderOSystem *renderer = static_cast(_gameRef->_renderer); renderer->invalidateTicketsFromSurface(this); return STATUS_OK; diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.h b/engines/wintermute/base/gfx/osystem/base_surface_osystem.h index 091e8ccba8..bece031fe7 100644 --- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.h +++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.h @@ -35,11 +35,11 @@ namespace WinterMute { struct TransparentSurface; -class CBImage; -class CBSurfaceOSystem : public CBSurface { +class BaseImage; +class BaseSurfaceOSystem : public BaseSurface { public: - CBSurfaceOSystem(CBGame *inGame); - ~CBSurfaceOSystem(); + BaseSurfaceOSystem(BaseGame *inGame); + ~BaseSurfaceOSystem(); bool create(const char *filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime = -1, bool keepLoaded = false); bool create(int width, int height); diff --git a/engines/wintermute/base/particles/part_emitter.cpp b/engines/wintermute/base/particles/part_emitter.cpp index b3b05b6e65..212f11d2f6 100644 --- a/engines/wintermute/base/particles/part_emitter.cpp +++ b/engines/wintermute/base/particles/part_emitter.cpp @@ -43,13 +43,13 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CPartEmitter, false) +IMPLEMENT_PERSISTENT(PartEmitter, false) ////////////////////////////////////////////////////////////////////////// -CPartEmitter::CPartEmitter(CBGame *inGame, CBScriptHolder *Owner) : CBObject(inGame) { +PartEmitter::PartEmitter(BaseGame *inGame, BaseScriptHolder *Owner) : BaseObject(inGame) { _width = _height = 0; - CBPlatform::setRectEmpty(&_border); + BasePlatform::setRectEmpty(&_border); _borderThicknessLeft = _borderThicknessRight = _borderThicknessTop = _borderThicknessBottom = 0; _angle1 = _angle2 = 0; @@ -94,7 +94,7 @@ CPartEmitter::CPartEmitter(CBGame *inGame, CBScriptHolder *Owner) : CBObject(inG ////////////////////////////////////////////////////////////////////////// -CPartEmitter::~CPartEmitter(void) { +PartEmitter::~PartEmitter(void) { for (int i = 0; i < _particles.getSize(); i++) { delete _particles[i]; } @@ -116,7 +116,7 @@ CPartEmitter::~CPartEmitter(void) { } ////////////////////////////////////////////////////////////////////////// -bool CPartEmitter::addSprite(const char *filename) { +bool PartEmitter::addSprite(const char *filename) { if (!filename) return STATUS_FAILED; // do we already have the file? @@ -139,7 +139,7 @@ bool CPartEmitter::addSprite(const char *filename) { } ////////////////////////////////////////////////////////////////////////// -bool CPartEmitter::removeSprite(const char *filename) { +bool PartEmitter::removeSprite(const char *filename) { for (int i = 0; i < _sprites.getSize(); i++) { if (scumm_stricmp(filename, _sprites[i]) == 0) { delete [] _sprites[i]; @@ -151,34 +151,34 @@ bool CPartEmitter::removeSprite(const char *filename) { } ////////////////////////////////////////////////////////////////////////// -bool CPartEmitter::initParticle(CPartParticle *particle, uint32 currentTime, uint32 timerDelta) { +bool PartEmitter::initParticle(PartParticle *particle, uint32 currentTime, uint32 timerDelta) { if (!particle) return STATUS_FAILED; if (_sprites.getSize() == 0) return STATUS_FAILED; - int posX = CBUtils::randomInt(_posX, _posX + _width); - int posY = CBUtils::randomInt(_posY, _posY + _height); - float posZ = CBUtils::randomFloat(0.0f, 100.0f); + int posX = BaseUtils::randomInt(_posX, _posX + _width); + int posY = BaseUtils::randomInt(_posY, _posY + _height); + float posZ = BaseUtils::randomFloat(0.0f, 100.0f); float velocity; if (_velocityZBased) velocity = _velocity1 + posZ * (_velocity2 - _velocity1) / 100; - else velocity = CBUtils::randomFloat(_velocity1, _velocity2); + else velocity = BaseUtils::randomFloat(_velocity1, _velocity2); float scale; if (_scaleZBased) scale = _scale1 + posZ * (_scale2 - _scale1) / 100; - else scale = CBUtils::randomFloat(_scale1, _scale2); + else scale = BaseUtils::randomFloat(_scale1, _scale2); int lifeTime; if (_lifeTimeZBased) lifeTime = _lifeTime2 - posZ * (_lifeTime2 - _lifeTime1) / 100; - else lifeTime = CBUtils::randomInt(_lifeTime1, _lifeTime2); + else lifeTime = BaseUtils::randomInt(_lifeTime1, _lifeTime2); - float angle = CBUtils::randomAngle(_angle1, _angle2); - int spriteIndex = CBUtils::randomInt(0, _sprites.getSize() - 1); + float angle = BaseUtils::randomAngle(_angle1, _angle2); + int spriteIndex = BaseUtils::randomInt(0, _sprites.getSize() - 1); - float rotation = CBUtils::randomAngle(_rotation1, _rotation2); - float angVelocity = CBUtils::randomFloat(_angVelocity1, _angVelocity2); - float growthRate = CBUtils::randomFloat(_growthRate1, _growthRate2); + float rotation = BaseUtils::randomAngle(_rotation1, _rotation2); + float angVelocity = BaseUtils::randomFloat(_angVelocity1, _angVelocity2); + float growthRate = BaseUtils::randomFloat(_growthRate1, _growthRate2); - if (!CBPlatform::isRectEmpty(&_border)) { + if (!BasePlatform::isRectEmpty(&_border)) { int thicknessLeft = (int)(_borderThicknessLeft - (float)_borderThicknessLeft * posZ / 100.0f); int thicknessRight = (int)(_borderThicknessRight - (float)_borderThicknessRight * posZ / 100.0f); int thicknessTop = (int)(_borderThicknessTop - (float)_borderThicknessTop * posZ / 100.0f); @@ -195,14 +195,14 @@ bool CPartEmitter::initParticle(CPartParticle *particle, uint32 currentTime, uin Vector2 vecVel(0, velocity); Matrix4 matRot; - matRot.rotationZ(Common::deg2rad(CBUtils::normalizeAngle(angle - 180))); + matRot.rotationZ(Common::deg2rad(BaseUtils::normalizeAngle(angle - 180))); matRot.transformVector2(vecVel); if (_alphaTimeBased) { particle->_alpha1 = _alpha1; particle->_alpha2 = _alpha2; } else { - int alpha = CBUtils::randomInt(_alpha1, _alpha2); + int alpha = BaseUtils::randomInt(_alpha1, _alpha2); particle->_alpha1 = alpha; particle->_alpha2 = alpha; } @@ -226,13 +226,13 @@ bool CPartEmitter::initParticle(CPartParticle *particle, uint32 currentTime, uin } ////////////////////////////////////////////////////////////////////////// -bool CPartEmitter::update() { +bool PartEmitter::update() { if (!_running) return STATUS_OK; else return updateInternal(_gameRef->_timer, _gameRef->_timerDelta); } ////////////////////////////////////////////////////////////////////////// -bool CPartEmitter::updateInternal(uint32 currentTime, uint32 timerDelta) { +bool PartEmitter::updateInternal(uint32 currentTime, uint32 timerDelta) { int numLive = 0; for (int i = 0; i < _particles.getSize(); i++) { @@ -263,10 +263,10 @@ bool CPartEmitter::updateInternal(uint32 currentTime, uint32 timerDelta) { } } - CPartParticle *particle; + PartParticle *particle; if (firstDeadIndex >= 0) particle = _particles[firstDeadIndex]; else { - particle = new CPartParticle(_gameRef); + particle = new PartParticle(_gameRef); _particles.add(particle); } initParticle(particle, currentTime, timerDelta); @@ -288,7 +288,7 @@ bool CPartEmitter::updateInternal(uint32 currentTime, uint32 timerDelta) { } ////////////////////////////////////////////////////////////////////////// -bool CPartEmitter::display(CBRegion *region) { +bool PartEmitter::display(BaseRegion *region) { if (_sprites.getSize() <= 1) _gameRef->_renderer->startSpriteBatch(); for (int i = 0; i < _particles.getSize(); i++) { @@ -305,7 +305,7 @@ bool CPartEmitter::display(CBRegion *region) { } ////////////////////////////////////////////////////////////////////////// -bool CPartEmitter::start() { +bool PartEmitter::start() { for (int i = 0; i < _particles.getSize(); i++) { _particles[i]->_isDead = true; } @@ -329,16 +329,16 @@ bool CPartEmitter::start() { } ////////////////////////////////////////////////////////////////////////// -bool CPartEmitter::sortParticlesByZ() { +bool PartEmitter::sortParticlesByZ() { // sort particles by _posY - qsort(_particles.getData(), _particles.getSize(), sizeof(CPartParticle *), CPartEmitter::compareZ); + qsort(_particles.getData(), _particles.getSize(), sizeof(PartParticle *), PartEmitter::compareZ); return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -int CPartEmitter::compareZ(const void *obj1, const void *obj2) { - CPartParticle *p1 = *(CPartParticle **)obj1; - CPartParticle *p2 = *(CPartParticle **)obj2; +int PartEmitter::compareZ(const void *obj1, const void *obj2) { + PartParticle *p1 = *(PartParticle **)obj1; + PartParticle *p2 = *(PartParticle **)obj2; if (p1->_posZ < p2->_posZ) return -1; else if (p1->_posZ > p2->_posZ) return 1; @@ -346,14 +346,14 @@ int CPartEmitter::compareZ(const void *obj1, const void *obj2) { } ////////////////////////////////////////////////////////////////////////// -bool CPartEmitter::setBorder(int x, int y, int width, int height) { - CBPlatform::setRect(&_border, x, y, x + width, y + height); +bool PartEmitter::setBorder(int x, int y, int width, int height) { + BasePlatform::setRect(&_border, x, y, x + width, y + height); return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CPartEmitter::setBorderThickness(int thicknessLeft, int thicknessRight, int thicknessTop, int thicknessBottom) { +bool PartEmitter::setBorderThickness(int thicknessLeft, int thicknessRight, int thicknessTop, int thicknessBottom) { _borderThicknessLeft = thicknessLeft; _borderThicknessRight = thicknessRight; _borderThicknessTop = thicknessTop; @@ -363,8 +363,8 @@ bool CPartEmitter::setBorderThickness(int thicknessLeft, int thicknessRight, int } ////////////////////////////////////////////////////////////////////////// -CPartForce *CPartEmitter::addForceByName(const char *name) { - CPartForce *force = NULL; +PartForce *PartEmitter::addForceByName(const char *name) { + PartForce *force = NULL; for (int i = 0; i < _forces.getSize(); i++) { if (scumm_stricmp(name, _forces[i]->_name) == 0) { @@ -373,7 +373,7 @@ CPartForce *CPartEmitter::addForceByName(const char *name) { } } if (!force) { - force = new CPartForce(_gameRef); + force = new PartForce(_gameRef); if (force) { force->setName(name); _forces.add(force); @@ -384,8 +384,8 @@ CPartForce *CPartEmitter::addForceByName(const char *name) { ////////////////////////////////////////////////////////////////////////// -bool CPartEmitter::addForce(const char *name, CPartForce::TForceType type, int posX, int posY, float angle, float strength) { - CPartForce *force = addForceByName(name); +bool PartEmitter::addForce(const char *name, PartForce::TForceType type, int posX, int posY, float angle, float strength) { + PartForce *force = addForceByName(name); if (!force) return STATUS_FAILED; force->_type = type; @@ -393,14 +393,14 @@ bool CPartEmitter::addForce(const char *name, CPartForce::TForceType type, int p force->_direction = Vector2(0, strength); Matrix4 matRot; - matRot.rotationZ(Common::deg2rad(CBUtils::normalizeAngle(angle - 180))); + matRot.rotationZ(Common::deg2rad(BaseUtils::normalizeAngle(angle - 180))); matRot.transformVector2(force->_direction); return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CPartEmitter::removeForce(const char *name) { +bool PartEmitter::removeForce(const char *name) { for (int i = 0; i < _forces.getSize(); i++) { if (scumm_stricmp(name, _forces[i]->_name) == 0) { delete _forces[i]; @@ -415,7 +415,7 @@ bool CPartEmitter::removeForce(const char *name) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -bool CPartEmitter::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool PartEmitter::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // SetBorder ////////////////////////////////////////////////////////////////////////// @@ -524,7 +524,7 @@ bool CPartEmitter::scCallMethod(CScScript *script, CScStack *stack, CScStack *th float angle = stack->pop()->getFloat(); float strength = stack->pop()->getFloat(); - stack->pushBool(DID_SUCCEED(addForce(forceName, CPartForce::FORCE_GLOBAL, 0, 0, angle, strength))); + stack->pushBool(DID_SUCCEED(addForce(forceName, PartForce::FORCE_GLOBAL, 0, 0, angle, strength))); return STATUS_OK; } @@ -540,7 +540,7 @@ bool CPartEmitter::scCallMethod(CScScript *script, CScStack *stack, CScStack *th float angle = stack->pop()->getFloat(); float strength = stack->pop()->getFloat(); - stack->pushBool(DID_SUCCEED(addForce(forceName, CPartForce::FORCE_GLOBAL, posX, posY, angle, strength))); + stack->pushBool(DID_SUCCEED(addForce(forceName, PartForce::FORCE_GLOBAL, posX, posY, angle, strength))); return STATUS_OK; } @@ -557,11 +557,11 @@ bool CPartEmitter::scCallMethod(CScScript *script, CScStack *stack, CScStack *th return STATUS_OK; } - else return CBObject::scCallMethod(script, stack, thisStack, name); + else return BaseObject::scCallMethod(script, stack, thisStack, name); } ////////////////////////////////////////////////////////////////////////// -CScValue *CPartEmitter::scGetProperty(const char *name) { +ScValue *PartEmitter::scGetProperty(const char *name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// @@ -828,12 +828,12 @@ CScValue *CPartEmitter::scGetProperty(const char *name) { return _scValue; } - else return CBObject::scGetProperty(name); + else return BaseObject::scGetProperty(name); } ////////////////////////////////////////////////////////////////////////// -bool CPartEmitter::scSetProperty(const char *name, CScValue *value) { +bool PartEmitter::scSetProperty(const char *name, ScValue *value) { ////////////////////////////////////////////////////////////////////////// // X ////////////////////////////////////////////////////////////////////////// @@ -1081,16 +1081,16 @@ bool CPartEmitter::scSetProperty(const char *name, CScValue *value) { else if (strcmp(name, "EmitEvent") == 0) { delete[] _emitEvent; _emitEvent = NULL; - if (!value->isNULL()) CBUtils::setString(&_emitEvent, value->getString()); + if (!value->isNULL()) BaseUtils::setString(&_emitEvent, value->getString()); return STATUS_OK; } - else return CBObject::scSetProperty(name, value); + else return BaseObject::scSetProperty(name, value); } ////////////////////////////////////////////////////////////////////////// -const char *CPartEmitter::scToString() { +const char *PartEmitter::scToString() { return "[particle emitter]"; } @@ -1098,8 +1098,8 @@ const char *CPartEmitter::scToString() { ////////////////////////////////////////////////////////////////////////// -bool CPartEmitter::persist(CBPersistMgr *persistMgr) { - CBObject::persist(persistMgr); +bool PartEmitter::persist(BasePersistenceManager *persistMgr) { + BaseObject::persist(persistMgr); persistMgr->transfer(TMEMBER(_width)); persistMgr->transfer(TMEMBER(_height)); @@ -1171,7 +1171,7 @@ bool CPartEmitter::persist(CBPersistMgr *persistMgr) { } else { persistMgr->transfer(TMEMBER(numForces)); for (int i = 0; i < numForces; i++) { - CPartForce *force = new CPartForce(_gameRef); + PartForce *force = new PartForce(_gameRef); force->persist(persistMgr); _forces.add(force); } @@ -1187,7 +1187,7 @@ bool CPartEmitter::persist(CBPersistMgr *persistMgr) { } else { persistMgr->transfer(TMEMBER(numParticles)); for (int i = 0; i < numParticles; i++) { - CPartParticle *particle = new CPartParticle(_gameRef); + PartParticle *particle = new PartParticle(_gameRef); particle->persist(persistMgr); _particles.add(particle); } diff --git a/engines/wintermute/base/particles/part_emitter.h b/engines/wintermute/base/particles/part_emitter.h index cff0a1ec83..6575544db0 100644 --- a/engines/wintermute/base/particles/part_emitter.h +++ b/engines/wintermute/base/particles/part_emitter.h @@ -34,14 +34,14 @@ #include "engines/wintermute/base/particles/part_force.h" namespace WinterMute { -class CBRegion; -class CPartParticle; -class CPartEmitter : public CBObject { +class BaseRegion; +class PartParticle; +class PartEmitter : public BaseObject { public: - DECLARE_PERSISTENT(CPartEmitter, CBObject) + DECLARE_PERSISTENT(PartEmitter, BaseObject) - CPartEmitter(CBGame *inGame, CBScriptHolder *Owner); - virtual ~CPartEmitter(void); + PartEmitter(BaseGame *inGame, BaseScriptHolder *Owner); + virtual ~PartEmitter(void); int _width; int _height; @@ -98,13 +98,13 @@ public: bool _useRegion; char *_emitEvent; - CBScriptHolder *_owner; + BaseScriptHolder *_owner; bool start(); bool update(); bool display() { return display(NULL); } // To avoid shadowing the inherited display-function. - bool display(CBRegion *region); + bool display(BaseRegion *region); bool sortParticlesByZ(); bool addSprite(const char *filename); @@ -112,26 +112,26 @@ public: bool setBorder(int x, int y, int width, int height); bool setBorderThickness(int thicknessLeft, int thicknessRight, int thicknessTop, int thicknessBottom); - bool addForce(const char *name, CPartForce::TForceType type, int posX, int posY, float angle, float strength); + bool addForce(const char *name, PartForce::TForceType type, int posX, int posY, float angle, float strength); bool removeForce(const char *name); - CBArray _forces; + BaseArray _forces; // scripting interface - virtual CScValue *scGetProperty(const char *name); - virtual bool scSetProperty(const char *name, CScValue *value); - virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual ScValue *scGetProperty(const char *name); + virtual bool scSetProperty(const char *name, ScValue *value); + virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); virtual const char *scToString(); private: - CPartForce *addForceByName(const char *name); + PartForce *addForceByName(const char *name); int static compareZ(const void *obj1, const void *obj2); - bool initParticle(CPartParticle *particle, uint32 currentTime, uint32 timerDelta); + bool initParticle(PartParticle *particle, uint32 currentTime, uint32 timerDelta); bool updateInternal(uint32 currentTime, uint32 timerDelta); uint32 _lastGenTime; - CBArray _particles; - CBArray _sprites; + BaseArray _particles; + BaseArray _sprites; }; } // end of namespace WinterMute diff --git a/engines/wintermute/base/particles/part_force.cpp b/engines/wintermute/base/particles/part_force.cpp index 2f330c21b0..ba60e8b41c 100644 --- a/engines/wintermute/base/particles/part_force.cpp +++ b/engines/wintermute/base/particles/part_force.cpp @@ -34,7 +34,7 @@ namespace WinterMute { ////////////////////////////////////////////////////////////////////////// -CPartForce::CPartForce(CBGame *inGame) : CBNamedObject(inGame) { +PartForce::PartForce(BaseGame *inGame) : BaseNamedObject(inGame) { _pos = Vector2(0.0f, 0.0f); _direction = Vector2(0.0f, 0.0f); _type = FORCE_POINT; @@ -42,12 +42,12 @@ CPartForce::CPartForce(CBGame *inGame) : CBNamedObject(inGame) { ////////////////////////////////////////////////////////////////////////// -CPartForce::~CPartForce(void) { +PartForce::~PartForce(void) { } ////////////////////////////////////////////////////////////////////////// -bool CPartForce::persist(CBPersistMgr *persistMgr) { +bool PartForce::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_name)); persistMgr->transfer(TMEMBER(_pos)); persistMgr->transfer(TMEMBER(_direction)); diff --git a/engines/wintermute/base/particles/part_force.h b/engines/wintermute/base/particles/part_force.h index f0a6d66c43..ec79ab7238 100644 --- a/engines/wintermute/base/particles/part_force.h +++ b/engines/wintermute/base/particles/part_force.h @@ -36,20 +36,20 @@ namespace WinterMute { -class CPartForce : public CBNamedObject { +class PartForce : public BaseNamedObject { public: enum TForceType { FORCE_POINT, FORCE_GLOBAL }; - CPartForce(CBGame *inGame); - virtual ~CPartForce(void); + PartForce(BaseGame *inGame); + virtual ~PartForce(void); Vector2 _pos; Vector2 _direction; TForceType _type; - bool persist(CBPersistMgr *PersistMgr); + bool persist(BasePersistenceManager *PersistMgr); }; } // end of namespace WinterMute diff --git a/engines/wintermute/base/particles/part_particle.cpp b/engines/wintermute/base/particles/part_particle.cpp index 931f7558c7..93b9f3659d 100644 --- a/engines/wintermute/base/particles/part_particle.cpp +++ b/engines/wintermute/base/particles/part_particle.cpp @@ -39,7 +39,7 @@ namespace WinterMute { ////////////////////////////////////////////////////////////////////////// -CPartParticle::CPartParticle(CBGame *inGame) : CBBase(inGame) { +PartParticle::PartParticle(BaseGame *inGame) : BaseClass(inGame) { _pos = Vector2(0.0f, 0.0f); _posZ = 0.0f; _velocity = Vector2(0.0f, 0.0f); @@ -48,7 +48,7 @@ CPartParticle::CPartParticle(CBGame *inGame) : CBBase(inGame) { _creationTime = 0; _lifeTime = 0; _isDead = true; - CBPlatform::setRectEmpty(&_border); + BasePlatform::setRectEmpty(&_border); _state = PARTICLE_NORMAL; _fadeStart = 0; @@ -66,13 +66,13 @@ CPartParticle::CPartParticle(CBGame *inGame) : CBBase(inGame) { ////////////////////////////////////////////////////////////////////////// -CPartParticle::~CPartParticle(void) { +PartParticle::~PartParticle(void) { delete _sprite; _sprite = NULL; } ////////////////////////////////////////////////////////////////////////// -bool CPartParticle::setSprite(const char *filename) { +bool PartParticle::setSprite(const char *filename) { if (_sprite && _sprite->_filename && scumm_stricmp(filename, _sprite->_filename) == 0) { _sprite->reset(); return STATUS_OK; @@ -81,22 +81,22 @@ bool CPartParticle::setSprite(const char *filename) { delete _sprite; _sprite = NULL; - CSysClassRegistry::getInstance()->_disabled = true; - _sprite = new CBSprite(_gameRef, _gameRef); + SystemClassRegistry::getInstance()->_disabled = true; + _sprite = new BaseSprite(_gameRef, _gameRef); if (_sprite && DID_SUCCEED(_sprite->loadFile(filename))) { - CSysClassRegistry::getInstance()->_disabled = false; + SystemClassRegistry::getInstance()->_disabled = false; return STATUS_OK; } else { delete _sprite; _sprite = NULL; - CSysClassRegistry::getInstance()->_disabled = false; + SystemClassRegistry::getInstance()->_disabled = false; return STATUS_FAILED; } } ////////////////////////////////////////////////////////////////////////// -bool CPartParticle::update(CPartEmitter *emitter, uint32 currentTime, uint32 timerDelta) { +bool PartParticle::update(PartEmitter *emitter, uint32 currentTime, uint32 timerDelta) { if (_state == PARTICLE_FADEIN) { if (currentTime - _fadeStart >= (uint32)_fadeTime) { _state = PARTICLE_NORMAL; @@ -123,11 +123,11 @@ bool CPartParticle::update(CPartEmitter *emitter, uint32 currentTime, uint32 tim } // particle hit the border - if (!_isDead && !CBPlatform::isRectEmpty(&_border)) { + if (!_isDead && !BasePlatform::isRectEmpty(&_border)) { Point32 p; p.x = (int32)_pos.x; p.y = (int32)_pos.y; - if (!CBPlatform::ptInRect(&_border, p)) + if (!BasePlatform::ptInRect(&_border, p)) fadeOut(currentTime, emitter->_fadeOutTime); } if (_state != PARTICLE_NORMAL) return STATUS_OK; @@ -144,13 +144,13 @@ bool CPartParticle::update(CPartEmitter *emitter, uint32 currentTime, uint32 tim float elapsedTime = (float)timerDelta / 1000.f; for (int i = 0; i < emitter->_forces.getSize(); i++) { - CPartForce *force = emitter->_forces[i]; + PartForce *force = emitter->_forces[i]; switch (force->_type) { - case CPartForce::FORCE_GLOBAL: + case PartForce::FORCE_GLOBAL: _velocity += force->_direction * elapsedTime; break; - case CPartForce::FORCE_POINT: { + case PartForce::FORCE_POINT: { Vector2 vecDist = force->_pos - _pos; float dist = fabs(vecDist.length()); @@ -165,7 +165,7 @@ bool CPartParticle::update(CPartEmitter *emitter, uint32 currentTime, uint32 tim // update rotation _rotation += _angVelocity * elapsedTime; - _rotation = CBUtils::normalizeAngle(_rotation); + _rotation = BaseUtils::normalizeAngle(_rotation); // update scale if (_exponentialGrowth) @@ -182,7 +182,7 @@ bool CPartParticle::update(CPartEmitter *emitter, uint32 currentTime, uint32 tim } ////////////////////////////////////////////////////////////////////////// -bool CPartParticle::display(CPartEmitter *emitter) { +bool PartParticle::display(PartEmitter *emitter) { if (!_sprite) return STATUS_FAILED; if (_isDead) return STATUS_OK; @@ -197,7 +197,7 @@ bool CPartParticle::display(CPartEmitter *emitter) { ////////////////////////////////////////////////////////////////////////// -bool CPartParticle::fadeIn(uint32 currentTime, int fadeTime) { +bool PartParticle::fadeIn(uint32 currentTime, int fadeTime) { _currentAlpha = 0; _fadeStart = currentTime; _fadeTime = fadeTime; @@ -207,7 +207,7 @@ bool CPartParticle::fadeIn(uint32 currentTime, int fadeTime) { } ////////////////////////////////////////////////////////////////////////// -bool CPartParticle::fadeOut(uint32 currentTime, int fadeTime) { +bool PartParticle::fadeOut(uint32 currentTime, int fadeTime) { //_currentAlpha = 255; _fadeStartAlpha = _currentAlpha; _fadeStart = currentTime; @@ -218,7 +218,7 @@ bool CPartParticle::fadeOut(uint32 currentTime, int fadeTime) { } ////////////////////////////////////////////////////////////////////////// -bool CPartParticle::persist(CBPersistMgr *persistMgr) { +bool PartParticle::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_alpha1)); persistMgr->transfer(TMEMBER(_alpha2)); persistMgr->transfer(TMEMBER(_border)); @@ -244,9 +244,9 @@ bool CPartParticle::persist(CBPersistMgr *persistMgr) { } else { char *filename; persistMgr->transfer(TMEMBER(filename)); - CSysClassRegistry::getInstance()->_disabled = true; + SystemClassRegistry::getInstance()->_disabled = true; setSprite(filename); - CSysClassRegistry::getInstance()->_disabled = false; + SystemClassRegistry::getInstance()->_disabled = false; delete[] filename; filename = NULL; } diff --git a/engines/wintermute/base/particles/part_particle.h b/engines/wintermute/base/particles/part_particle.h index 0b256d44ec..8b0c6eea36 100644 --- a/engines/wintermute/base/particles/part_particle.h +++ b/engines/wintermute/base/particles/part_particle.h @@ -36,18 +36,18 @@ namespace WinterMute { -class CPartEmitter; -class CBSprite; -class CBPersistMgr; +class PartEmitter; +class BaseSprite; +class BasePersistenceManager; -class CPartParticle : public CBBase { +class PartParticle : public BaseClass { public: enum TParticleState { PARTICLE_NORMAL, PARTICLE_FADEIN, PARTICLE_FADEOUT }; - CPartParticle(CBGame *inGame); - virtual ~CPartParticle(void); + PartParticle(BaseGame *inGame); + virtual ~PartParticle(void); float _growthRate; bool _exponentialGrowth; @@ -63,21 +63,21 @@ public: float _posZ; Vector2 _velocity; float _scale; - CBSprite *_sprite; + BaseSprite *_sprite; uint32 _creationTime; int _lifeTime; bool _isDead; TParticleState _state; - bool update(CPartEmitter *emitter, uint32 currentTime, uint32 timerDelta); - bool display(CPartEmitter *emitter); + bool update(PartEmitter *emitter, uint32 currentTime, uint32 timerDelta); + bool display(PartEmitter *emitter); bool setSprite(const char *filename); bool fadeIn(uint32 currentTime, int fadeTime); bool fadeOut(uint32 currentTime, int fadeTime); - bool persist(CBPersistMgr *PersistMgr); + bool persist(BasePersistenceManager *PersistMgr); private: uint32 _fadeStart; int _fadeTime; diff --git a/engines/wintermute/base/scriptables/script.cpp b/engines/wintermute/base/scriptables/script.cpp index a9646e0045..45544831e3 100644 --- a/engines/wintermute/base/scriptables/script.cpp +++ b/engines/wintermute/base/scriptables/script.cpp @@ -36,10 +36,10 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CScScript, false) +IMPLEMENT_PERSISTENT(ScScript, false) ////////////////////////////////////////////////////////////////////////// -CScScript::CScScript(CBGame *inGame, CScEngine *Engine): CBBase(inGame) { +ScScript::ScScript(BaseGame *inGame, ScEngine *Engine): BaseClass(inGame) { _buffer = NULL; _bufferSize = _iP = 0; _scriptStream = NULL; @@ -98,11 +98,11 @@ CScScript::CScScript(CBGame *inGame, CScEngine *Engine): CBBase(inGame) { ////////////////////////////////////////////////////////////////////////// -CScScript::~CScScript() { +ScScript::~ScScript() { cleanup(); } -void CScScript::readHeader() { +void ScScript::readHeader() { uint32 oldPos = _scriptStream->pos(); _scriptStream->seek(0); _header.magic = _scriptStream->readUint32LE(); @@ -118,7 +118,7 @@ void CScScript::readHeader() { ////////////////////////////////////////////////////////////////////////// -bool CScScript::initScript() { +bool ScScript::initScript() { if (!_scriptStream) { _scriptStream = new Common::MemoryReadStream(_buffer, _bufferSize); } @@ -139,13 +139,13 @@ bool CScScript::initScript() { initTables(); // init stacks - _scopeStack = new CScStack(_gameRef); - _callStack = new CScStack(_gameRef); - _thisStack = new CScStack(_gameRef); - _stack = new CScStack(_gameRef); + _scopeStack = new ScStack(_gameRef); + _callStack = new ScStack(_gameRef); + _thisStack = new ScStack(_gameRef); + _stack = new ScStack(_gameRef); - _operand = new CScValue(_gameRef); - _reg1 = new CScValue(_gameRef); + _operand = new ScValue(_gameRef); + _reg1 = new ScValue(_gameRef); // skip to the beginning @@ -165,7 +165,7 @@ bool CScScript::initScript() { ////////////////////////////////////////////////////////////////////////// -bool CScScript::initTables() { +bool ScScript::initTables() { uint32 OrigIP = _iP; readHeader(); @@ -240,7 +240,7 @@ bool CScScript::initTables() { ////////////////////////////////////////////////////////////////////////// -bool CScScript::create(const char *filename, byte *buffer, uint32 size, CBScriptHolder *owner) { +bool ScScript::create(const char *filename, byte *buffer, uint32 size, BaseScriptHolder *owner) { cleanup(); _thread = false; @@ -263,7 +263,7 @@ bool CScScript::create(const char *filename, byte *buffer, uint32 size, CBScript if (DID_FAIL(res)) return res; // establish global variables table - _globals = new CScValue(_gameRef); + _globals = new ScValue(_gameRef); _owner = owner; @@ -272,7 +272,7 @@ bool CScScript::create(const char *filename, byte *buffer, uint32 size, CBScript ////////////////////////////////////////////////////////////////////////// -bool CScScript::createThread(CScScript *original, uint32 initIP, const char *eventName) { +bool ScScript::createThread(ScScript *original, uint32 initIP, const char *eventName) { cleanup(); _thread = true; @@ -316,7 +316,7 @@ bool CScScript::createThread(CScScript *original, uint32 initIP, const char *eve ////////////////////////////////////////////////////////////////////////// -bool CScScript::createMethodThread(CScScript *original, const char *methodName) { +bool ScScript::createMethodThread(ScScript *original, const char *methodName) { uint32 ip = original->getMethodPos(methodName); if (ip == 0) return STATUS_FAILED; @@ -360,7 +360,7 @@ bool CScScript::createMethodThread(CScScript *original, const char *methodName) ////////////////////////////////////////////////////////////////////////// -void CScScript::cleanup() { +void ScScript::cleanup() { if (_buffer) delete [] _buffer; _buffer = NULL; @@ -430,7 +430,7 @@ void CScScript::cleanup() { ////////////////////////////////////////////////////////////////////////// -uint32 CScScript::getDWORD() { +uint32 ScScript::getDWORD() { _scriptStream->seek((int32)_iP); uint32 ret = _scriptStream->readUint32LE(); _iP += sizeof(uint32); @@ -439,7 +439,7 @@ uint32 CScScript::getDWORD() { } ////////////////////////////////////////////////////////////////////////// -double CScScript::getFloat() { +double ScScript::getFloat() { _scriptStream->seek((int32)_iP); byte buffer[8]; _scriptStream->read(buffer, 8); @@ -459,7 +459,7 @@ double CScScript::getFloat() { ////////////////////////////////////////////////////////////////////////// -char *CScScript::getString() { +char *ScScript::getString() { char *ret = (char *)(_buffer + _iP); while (*(char *)(_buffer + _iP) != '\0') _iP++; _iP++; // string terminator @@ -470,17 +470,17 @@ char *CScScript::getString() { ////////////////////////////////////////////////////////////////////////// -bool CScScript::executeInstruction() { +bool ScScript::executeInstruction() { bool ret = STATUS_OK; uint32 dw; const char *str = NULL; - //CScValue* op = new CScValue(_gameRef); + //ScValue* op = new ScValue(_gameRef); _operand->cleanup(); - CScValue *op1; - CScValue *op2; + ScValue *op1; + ScValue *op2; uint32 inst = getDWORD(); switch (inst) { @@ -557,7 +557,7 @@ bool CScScript::executeInstruction() { char *MethodName = new char[strlen(str) + 1]; strcpy(MethodName, str); - CScValue *var = _stack->pop(); + ScValue *var = _stack->pop(); if (var->_type == VAL_VARIABLE_REF) var = var->_valRef; bool res = STATUS_FAILED; @@ -591,7 +591,7 @@ bool CScScript::executeInstruction() { break; } /* - CScValue* val = var->getProp(MethodName); + ScValue* val = var->getProp(MethodName); if(val){ dw = GetFuncPos(val->getString()); if(dw==0){ @@ -660,7 +660,7 @@ bool CScScript::executeInstruction() { break; case II_PUSH_VAR: { - CScValue *var = getVar(_symbols[getDWORD()]); + ScValue *var = getVar(_symbols[getDWORD()]); if (false && /*var->_type==VAL_OBJECT ||*/ var->_type == VAL_NATIVE) { _operand->setReference(var); _stack->push(_operand); @@ -669,7 +669,7 @@ bool CScScript::executeInstruction() { } case II_PUSH_VAR_REF: { - CScValue *var = getVar(_symbols[getDWORD()]); + ScValue *var = getVar(_symbols[getDWORD()]); _operand->setReference(var); _stack->push(_operand); break; @@ -677,9 +677,9 @@ bool CScScript::executeInstruction() { case II_POP_VAR: { char *VarName = _symbols[getDWORD()]; - CScValue *var = getVar(VarName); + ScValue *var = getVar(VarName); if (var) { - CScValue *val = _stack->pop(); + ScValue *val = _stack->pop(); if (!val) { runtimeError("Script stack corruption detected. Please report this script at WME bug reports forum."); var->setNULL(); @@ -740,7 +740,7 @@ bool CScScript::executeInstruction() { case II_PUSH_BY_EXP: { str = _stack->pop()->getString(); - CScValue *val = _stack->pop()->getProp(str); + ScValue *val = _stack->pop()->getProp(str); if (val) _stack->push(val); else _stack->pushNULL(); @@ -749,8 +749,8 @@ bool CScScript::executeInstruction() { case II_POP_BY_EXP: { str = _stack->pop()->getString(); - CScValue *var = _stack->pop(); - CScValue *val = _stack->pop(); + ScValue *var = _stack->pop(); + ScValue *val = _stack->pop(); if (val == NULL) { runtimeError("Script stack corruption detected. Please report this script at WME bug reports forum."); @@ -778,7 +778,7 @@ bool CScScript::executeInstruction() { case II_JMP_FALSE: { dw = getDWORD(); //if(!_stack->pop()->getBool()) _iP = dw; - CScValue *val = _stack->pop(); + ScValue *val = _stack->pop(); if (!val) { runtimeError("Script corruption detected. Did you use '=' instead of '==' for comparison?"); } else { @@ -916,7 +916,7 @@ bool CScScript::executeInstruction() { } */ - _operand->setBool(CScValue::compare(op1, op2) == 0); + _operand->setBool(ScValue::compare(op1, op2) == 0); _stack->push(_operand); break; @@ -940,7 +940,7 @@ bool CScScript::executeInstruction() { } */ - _operand->setBool(CScValue::compare(op1, op2) != 0); + _operand->setBool(ScValue::compare(op1, op2) != 0); _stack->push(_operand); break; @@ -955,7 +955,7 @@ bool CScScript::executeInstruction() { else _operand->setBool(op1->getInt() < op2->getInt()); */ - _operand->setBool(CScValue::compare(op1, op2) < 0); + _operand->setBool(ScValue::compare(op1, op2) < 0); _stack->push(_operand); break; @@ -970,7 +970,7 @@ bool CScScript::executeInstruction() { else _operand->setBool(op1->getInt() > op2->getInt()); */ - _operand->setBool(CScValue::compare(op1, op2) > 0); + _operand->setBool(ScValue::compare(op1, op2) > 0); _stack->push(_operand); break; @@ -985,7 +985,7 @@ bool CScScript::executeInstruction() { else _operand->setBool(op1->getInt() <= op2->getInt()); */ - _operand->setBool(CScValue::compare(op1, op2) <= 0); + _operand->setBool(ScValue::compare(op1, op2) <= 0); _stack->push(_operand); break; @@ -1000,7 +1000,7 @@ bool CScScript::executeInstruction() { else _operand->setBool(op1->getInt() >= op2->getInt()); */ - _operand->setBool(CScValue::compare(op1, op2) >= 0); + _operand->setBool(ScValue::compare(op1, op2) >= 0); _stack->push(_operand); break; @@ -1009,7 +1009,7 @@ bool CScScript::executeInstruction() { op1 = _stack->pop(); //_operand->setBool(op1->getType()==op2->getType() && op1->getFloat()==op2->getFloat()); - _operand->setBool(CScValue::compareStrict(op1, op2) == 0); + _operand->setBool(ScValue::compareStrict(op1, op2) == 0); _stack->push(_operand); break; @@ -1019,7 +1019,7 @@ bool CScScript::executeInstruction() { op1 = _stack->pop(); //_operand->setBool(op1->getType()!=op2->getType() || op1->getFloat()!=op2->getFloat()); - _operand->setBool(CScValue::compareStrict(op1, op2) != 0); + _operand->setBool(ScValue::compareStrict(op1, op2) != 0); _stack->push(_operand); break; @@ -1059,7 +1059,7 @@ bool CScScript::executeInstruction() { ////////////////////////////////////////////////////////////////////////// -uint32 CScScript::getFuncPos(const char *name) { +uint32 ScScript::getFuncPos(const char *name) { for (uint32 i = 0; i < _numFunctions; i++) { if (strcmp(name, _functions[i].name) == 0) return _functions[i].pos; @@ -1069,7 +1069,7 @@ uint32 CScScript::getFuncPos(const char *name) { ////////////////////////////////////////////////////////////////////////// -uint32 CScScript::getMethodPos(const char *name) { +uint32 ScScript::getMethodPos(const char *name) { for (uint32 i = 0; i < _numMethods; i++) { if (strcmp(name, _methods[i].name) == 0) return _methods[i].pos; @@ -1079,8 +1079,8 @@ uint32 CScScript::getMethodPos(const char *name) { ////////////////////////////////////////////////////////////////////////// -CScValue *CScScript::getVar(char *name) { - CScValue *ret = NULL; +ScValue *ScScript::getVar(char *name) { + ScValue *ret = NULL; // scope locals if (_scopeStack->_sP >= 0) { @@ -1103,8 +1103,8 @@ CScValue *CScScript::getVar(char *name) { if (ret == NULL) { //RuntimeError("Variable '%s' is inaccessible in the current block. Consider changing the script.", name); _gameRef->LOG(0, "Warning: variable '%s' is inaccessible in the current block. Consider changing the script (script:%s, line:%d)", name, _filename, _currentLine); - CScValue *val = new CScValue(_gameRef); - CScValue *scope = _scopeStack->getTop(); + ScValue *val = new ScValue(_gameRef); + ScValue *scope = _scopeStack->getTop(); if (scope) { scope->setProp(name, val); ret = _scopeStack->getTop()->getProp(name); @@ -1120,7 +1120,7 @@ CScValue *CScScript::getVar(char *name) { ////////////////////////////////////////////////////////////////////////// -bool CScScript::waitFor(CBObject *object) { +bool ScScript::waitFor(BaseObject *object) { if (_unbreakable) { runtimeError("Script cannot be interrupted."); return STATUS_OK; @@ -1133,14 +1133,14 @@ bool CScScript::waitFor(CBObject *object) { ////////////////////////////////////////////////////////////////////////// -bool CScScript::waitForExclusive(CBObject *object) { +bool ScScript::waitForExclusive(BaseObject *object) { _engine->resetObject(object); return waitFor(object); } ////////////////////////////////////////////////////////////////////////// -bool CScScript::sleep(uint32 duration) { +bool ScScript::sleep(uint32 duration) { if (_unbreakable) { runtimeError("Script cannot be interrupted."); return STATUS_OK; @@ -1148,7 +1148,7 @@ bool CScScript::sleep(uint32 duration) { _state = SCRIPT_SLEEPING; if (_gameRef->_state == GAME_FROZEN) { - _waitTime = CBPlatform::getTime() + duration; + _waitTime = BasePlatform::getTime() + duration; _waitFrozen = true; } else { _waitTime = _gameRef->_timer + duration; @@ -1159,7 +1159,7 @@ bool CScScript::sleep(uint32 duration) { ////////////////////////////////////////////////////////////////////////// -bool CScScript::finish(bool includingThreads) { +bool ScScript::finish(bool includingThreads) { if (_state != SCRIPT_FINISHED && includingThreads) { _state = SCRIPT_FINISHED; finishThreads(); @@ -1171,14 +1171,14 @@ bool CScScript::finish(bool includingThreads) { ////////////////////////////////////////////////////////////////////////// -bool CScScript::run() { +bool ScScript::run() { _state = SCRIPT_RUNNING; return STATUS_OK; } ////////////////////////////////////////////////////////////////////// -void CScScript::runtimeError(const char *fmt, ...) { +void ScScript::runtimeError(const char *fmt, ...) { char buff[256]; va_list va; @@ -1195,7 +1195,7 @@ void CScScript::runtimeError(const char *fmt, ...) { ////////////////////////////////////////////////////////////////////////// -bool CScScript::persist(CBPersistMgr *persistMgr) { +bool ScScript::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_gameRef)); @@ -1257,13 +1257,13 @@ bool CScScript::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -CScScript *CScScript::invokeEventHandler(const char *eventName, bool unbreakable) { +ScScript *ScScript::invokeEventHandler(const char *eventName, bool unbreakable) { //if(_state!=SCRIPT_PERSISTENT) return NULL; uint32 pos = getEventPos(eventName); if (!pos) return NULL; - CScScript *thread = new CScScript(_gameRef, _engine); + ScScript *thread = new ScScript(_gameRef, _engine); if (thread) { bool ret = thread->createThread(this, pos, eventName); if (DID_SUCCEED(ret)) { @@ -1281,7 +1281,7 @@ CScScript *CScScript::invokeEventHandler(const char *eventName, bool unbreakable ////////////////////////////////////////////////////////////////////////// -uint32 CScScript::getEventPos(const char *name) { +uint32 ScScript::getEventPos(const char *name) { for (int i = _numEvents - 1; i >= 0; i--) { if (scumm_stricmp(name, _events[i].name) == 0) return _events[i].pos; } @@ -1290,19 +1290,19 @@ uint32 CScScript::getEventPos(const char *name) { ////////////////////////////////////////////////////////////////////////// -bool CScScript::canHandleEvent(const char *eventName) { +bool ScScript::canHandleEvent(const char *eventName) { return getEventPos(eventName) != 0; } ////////////////////////////////////////////////////////////////////////// -bool CScScript::canHandleMethod(const char *methodName) { +bool ScScript::canHandleMethod(const char *methodName) { return getMethodPos(methodName) != 0; } ////////////////////////////////////////////////////////////////////////// -bool CScScript::pause() { +bool ScScript::pause() { if (_state == SCRIPT_PAUSED) { _gameRef->LOG(0, "Attempting to pause a paused script ('%s', line %d)", _filename, _currentLine); return STATUS_FAILED; @@ -1318,7 +1318,7 @@ bool CScScript::pause() { ////////////////////////////////////////////////////////////////////////// -bool CScScript::resume() { +bool ScScript::resume() { if (_state != SCRIPT_PAUSED) return STATUS_OK; _state = _origState; @@ -1327,7 +1327,7 @@ bool CScScript::resume() { ////////////////////////////////////////////////////////////////////////// -CScScript::TExternalFunction *CScScript::getExternal(char *name) { +ScScript::TExternalFunction *ScScript::getExternal(char *name) { for (uint32 i = 0; i < _numExternals; i++) { if (strcmp(name, _externals[i].name) == 0) return &_externals[i]; @@ -1337,7 +1337,7 @@ CScScript::TExternalFunction *CScScript::getExternal(char *name) { ////////////////////////////////////////////////////////////////////////// -bool CScScript::externalCall(CScStack *stack, CScStack *thisStack, CScScript::TExternalFunction *function) { +bool ScScript::externalCall(ScStack *stack, ScStack *thisStack, ScScript::TExternalFunction *function) { _gameRef->LOG(0, "External functions are not supported on this platform."); stack->correctParams(0); @@ -1347,7 +1347,7 @@ bool CScScript::externalCall(CScStack *stack, CScStack *thisStack, CScScript::TE ////////////////////////////////////////////////////////////////////////// -bool CScScript::copyParameters(CScStack *stack) { +bool ScScript::copyParameters(ScStack *stack) { int i; int NumParams = stack->pop()->getInt(); for (i = NumParams - 1; i >= 0; i--) { @@ -1362,9 +1362,9 @@ bool CScScript::copyParameters(CScStack *stack) { ////////////////////////////////////////////////////////////////////////// -bool CScScript::finishThreads() { +bool ScScript::finishThreads() { for (int i = 0; i < _engine->_scripts.getSize(); i++) { - CScScript *scr = _engine->_scripts[i]; + ScScript *scr = _engine->_scripts[i]; if (scr->_thread && scr->_state != SCRIPT_FINISHED && scr->_owner == _owner && scumm_stricmp(scr->_filename, _filename) == 0) scr->finish(true); } @@ -1374,18 +1374,18 @@ bool CScScript::finishThreads() { ////////////////////////////////////////////////////////////////////////// // IWmeDebugScript interface implementation -int CScScript::dbgGetLine() { +int ScScript::dbgGetLine() { return _currentLine; } ////////////////////////////////////////////////////////////////////////// -const char *CScScript::dbgGetFilename() { +const char *ScScript::dbgGetFilename() { return _filename; } ////////////////////////////////////////////////////////////////////////// -bool CScScript::dbgSendScript(IWmeDebugClient *client) { +bool ScScript::dbgSendScript(IWmeDebugClient *client) { if (_methodThread) client->onScriptMethodThreadInit(this, _parentScript, _threadEvent); else if (_thread) client->onScriptEventThreadInit(this, _parentScript, _threadEvent); else client->onScriptInit(this); @@ -1395,14 +1395,14 @@ bool CScScript::dbgSendScript(IWmeDebugClient *client) { } ////////////////////////////////////////////////////////////////////////// -bool CScScript::dbgSendVariables(IWmeDebugClient *client) { +bool ScScript::dbgSendVariables(IWmeDebugClient *client) { // send script globals _globals->dbgSendVariables(client, WME_DBGVAR_SCRIPT, this, 0); // send scope variables if (_scopeStack->_sP >= 0) { for (int i = 0; i <= _scopeStack->_sP; i++) { - // CScValue *Scope = _scopeStack->GetAt(i); + // ScValue *Scope = _scopeStack->GetAt(i); //Scope->DbgSendVariables(Client, WME_DBGVAR_SCOPE, this, (unsigned int)Scope); } } @@ -1411,35 +1411,35 @@ bool CScScript::dbgSendVariables(IWmeDebugClient *client) { ////////////////////////////////////////////////////////////////////////// -TScriptState CScScript::dbgGetState() { +TScriptState ScScript::dbgGetState() { return _state; } ////////////////////////////////////////////////////////////////////////// -int CScScript::dbgGetNumBreakpoints() { +int ScScript::dbgGetNumBreakpoints() { return _breakpoints.getSize(); } ////////////////////////////////////////////////////////////////////////// -int CScScript::dbgGetBreakpoint(int index) { +int ScScript::dbgGetBreakpoint(int index) { if (index >= 0 && index < _breakpoints.getSize()) return _breakpoints[index]; else return -1; } ////////////////////////////////////////////////////////////////////////// -bool CScScript::dbgSetTracingMode(bool isTracing) { +bool ScScript::dbgSetTracingMode(bool isTracing) { _tracingMode = isTracing; return true; } ////////////////////////////////////////////////////////////////////////// -bool CScScript::dbgGetTracingMode() { +bool ScScript::dbgGetTracingMode() { return _tracingMode; } ////////////////////////////////////////////////////////////////////////// -void CScScript::afterLoad() { +void ScScript::afterLoad() { if (_buffer == NULL) { byte *buffer = _engine->getCompiledScript(_filename, &_bufferSize); if (!buffer) { diff --git a/engines/wintermute/base/scriptables/script.h b/engines/wintermute/base/scriptables/script.h index 899e1f3098..3bb4bc48a7 100644 --- a/engines/wintermute/base/scriptables/script.h +++ b/engines/wintermute/base/scriptables/script.h @@ -37,50 +37,50 @@ #include "engines/wintermute/wme_debugger.h" namespace WinterMute { -class CBScriptHolder; -class CBObject; -class CScEngine; -class CScStack; -class CScScript : public CBBase, public IWmeDebugScript { +class BaseScriptHolder; +class BaseObject; +class ScEngine; +class ScStack; +class ScScript : public BaseClass, public IWmeDebugScript { public: bool dbgSendScript(IWmeDebugClient *client); bool dbgSendVariables(IWmeDebugClient *client); - CBArray _breakpoints; + BaseArray _breakpoints; bool _tracingMode; - CScScript *_parentScript; + ScScript *_parentScript; bool _unbreakable; bool finishThreads(); - bool copyParameters(CScStack *stack); + bool copyParameters(ScStack *stack); void afterLoad(); - CScValue *_operand; - CScValue *_reg1; + ScValue *_operand; + ScValue *_reg1; bool _freezable; bool resume(); bool pause(); bool canHandleEvent(const char *eventName); bool canHandleMethod(const char *methodName); - bool createThread(CScScript *original, uint32 initIP, const char *eventName); - bool createMethodThread(CScScript *original, const char *methodName); - CScScript *invokeEventHandler(const char *eventName, bool unbreakable = false); + bool createThread(ScScript *original, uint32 initIP, const char *eventName); + bool createMethodThread(ScScript *original, const char *methodName); + ScScript *invokeEventHandler(const char *eventName, bool unbreakable = false); uint32 _timeSlice; - DECLARE_PERSISTENT(CScScript, CBBase) + DECLARE_PERSISTENT(ScScript, BaseClass) void runtimeError(const char *fmt, ...); bool run(); bool finish(bool includingThreads = false); bool sleep(uint32 duration); - bool waitForExclusive(CBObject *object); - bool waitFor(CBObject *object); + bool waitForExclusive(BaseObject *object); + bool waitFor(BaseObject *object); uint32 _waitTime; bool _waitFrozen; - CBObject *_waitObject; - CScScript *_waitScript; + BaseObject *_waitObject; + ScScript *_waitScript; TScriptState _state; TScriptState _origState; - CScValue *getVar(char *name); + ScValue *getVar(char *name); uint32 getFuncPos(const char *name); uint32 getEventPos(const char *name); uint32 getMethodPos(const char *name); @@ -122,19 +122,19 @@ public: } TExternalFunction; - CScStack *_callStack; - CScStack *_thisStack; - CScStack *_scopeStack; - CScStack *_stack; - CScValue *_globals; - CScEngine *_engine; + ScStack *_callStack; + ScStack *_thisStack; + ScStack *_scopeStack; + ScStack *_stack; + ScValue *_globals; + ScEngine *_engine; int _currentLine; bool executeInstruction(); char *getString(); uint32 getDWORD(); double getFloat(); void cleanup(); - bool create(const char *filename, byte *buffer, uint32 size, CBScriptHolder *owner); + bool create(const char *filename, byte *buffer, uint32 size, BaseScriptHolder *owner); uint32 _iP; private: void readHeader(); @@ -142,8 +142,8 @@ private: byte *_buffer; public: Common::SeekableReadStream *_scriptStream; - CScScript(CBGame *inGame, CScEngine *Engine); - virtual ~CScScript(); + ScScript(BaseGame *inGame, ScEngine *Engine); + virtual ~ScScript(); char *_filename; char **_symbols; uint32 _numSymbols; @@ -158,9 +158,9 @@ public: bool _thread; bool _methodThread; char *_threadEvent; - CBScriptHolder *_owner; - CScScript::TExternalFunction *getExternal(char *name); - bool externalCall(CScStack *stack, CScStack *thisStack, CScScript::TExternalFunction *function); + BaseScriptHolder *_owner; + ScScript::TExternalFunction *getExternal(char *name); + bool externalCall(ScStack *stack, ScStack *thisStack, ScScript::TExternalFunction *function); private: bool initScript(); bool initTables(); diff --git a/engines/wintermute/base/scriptables/script_engine.cpp b/engines/wintermute/base/scriptables/script_engine.cpp index 387093ac4a..44add054c5 100644 --- a/engines/wintermute/base/scriptables/script_engine.cpp +++ b/engines/wintermute/base/scriptables/script_engine.cpp @@ -41,29 +41,29 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CScEngine, true) +IMPLEMENT_PERSISTENT(ScEngine, true) #define COMPILER_DLL "dcscomp.dll" ////////////////////////////////////////////////////////////////////////// -CScEngine::CScEngine(CBGame *inGame): CBBase(inGame) { +ScEngine::ScEngine(BaseGame *inGame): BaseClass(inGame) { _gameRef->LOG(0, "Initializing scripting engine..."); if (_compilerAvailable) _gameRef->LOG(0, " Script compiler bound successfuly"); else _gameRef->LOG(0, " Script compiler is NOT available"); - _globals = new CScValue(_gameRef); + _globals = new ScValue(_gameRef); // register 'Game' as global variable if (!_globals->propExists("Game")) { - CScValue val(_gameRef); + ScValue val(_gameRef); val.setNative(_gameRef, true); _globals->setProp("Game", &val); } // register 'Math' as global variable if (!_globals->propExists("Math")) { - CScValue val(_gameRef); + ScValue val(_gameRef); val.setNative(_gameRef->_mathClass, true); _globals->setProp("Math", &val); } @@ -81,7 +81,7 @@ CScEngine::CScEngine(CBGame *inGame): CBBase(inGame) { ////////////////////////////////////////////////////////////////////////// -CScEngine::~CScEngine() { +ScEngine::~ScEngine() { _gameRef->LOG(0, "Shutting down scripting engine"); saveBreakpoints(); @@ -98,7 +98,7 @@ CScEngine::~CScEngine() { ////////////////////////////////////////////////////////////////////////// -bool CScEngine::cleanup() { +bool ScEngine::cleanup() { for (int i = 0; i < _scripts.getSize(); i++) { if (!_scripts[i]->_thread && _scripts[i]->_owner) _scripts[i]->_owner->removeScript(_scripts[i]); delete _scripts[i]; @@ -120,25 +120,25 @@ bool CScEngine::cleanup() { ////////////////////////////////////////////////////////////////////////// -byte *CScEngine::loadFile(void *data, char *filename, uint32 *size) { - CBGame *gameRef = (CBGame *)data; +byte *ScEngine::loadFile(void *data, char *filename, uint32 *size) { + BaseGame *gameRef = (BaseGame *)data; return gameRef->_fileManager->readWholeFile(filename, size); } ////////////////////////////////////////////////////////////////////////// -void CScEngine::closeFile(void *data, byte *buffer) { +void ScEngine::closeFile(void *data, byte *buffer) { delete [] buffer; } ////////////////////////////////////////////////////////////////////////// -void CScEngine::parseElement(void *data, int line, int type, void *elementData) { +void ScEngine::parseElement(void *data, int line, int type, void *elementData) { } ////////////////////////////////////////////////////////////////////////// -CScScript *CScEngine::runScript(const char *filename, CBScriptHolder *owner) { +ScScript *ScEngine::runScript(const char *filename, BaseScriptHolder *owner) { byte *compBuffer; uint32 compSize; @@ -147,7 +147,7 @@ CScScript *CScEngine::runScript(const char *filename, CBScriptHolder *owner) { if (!compBuffer) return NULL; // add new script - CScScript *script = new CScScript(_gameRef, this); + ScScript *script = new ScScript(_gameRef, this); bool ret = script->create(filename, compBuffer, compSize, owner); if (DID_FAIL(ret)) { _gameRef->LOG(ret, "Error running script '%s'...", filename); @@ -155,7 +155,7 @@ CScScript *CScEngine::runScript(const char *filename, CBScriptHolder *owner) { return NULL; } else { // publish the "self" pseudo-variable - CScValue val(_gameRef); + ScValue val(_gameRef); if (owner)val.setNative(owner, true); else val.setNULL(); @@ -171,12 +171,12 @@ CScScript *CScEngine::runScript(const char *filename, CBScriptHolder *owner) { ////////////////////////////////////////////////////////////////////////// -byte *CScEngine::getCompiledScript(const char *filename, uint32 *outSize, bool ignoreCache) { +byte *ScEngine::getCompiledScript(const char *filename, uint32 *outSize, bool ignoreCache) { // is script in cache? if (!ignoreCache) { for (int i = 0; i < MAX_CACHED_SCRIPTS; i++) { if (_cachedScripts[i] && scumm_stricmp(_cachedScripts[i]->_filename.c_str(), filename) == 0) { - _cachedScripts[i]->_timestamp = CBPlatform::getTime(); + _cachedScripts[i]->_timestamp = BasePlatform::getTime(); *outSize = _cachedScripts[i]->_size; return _cachedScripts[i]->_buffer; } @@ -191,7 +191,7 @@ byte *CScEngine::getCompiledScript(const char *filename, uint32 *outSize, bool i byte *buffer = _gameRef->_fileManager->readWholeFile(filename, &size); if (!buffer) { - _gameRef->LOG(0, "CScEngine::GetCompiledScript - error opening script '%s'", filename); + _gameRef->LOG(0, "ScEngine::GetCompiledScript - error opening script '%s'", filename); return NULL; } @@ -201,7 +201,7 @@ byte *CScEngine::getCompiledScript(const char *filename, uint32 *outSize, bool i compSize = size; } else { if (!_compilerAvailable) { - _gameRef->LOG(0, "CScEngine::GetCompiledScript - script '%s' needs to be compiled but compiler is not available", filename); + _gameRef->LOG(0, "ScEngine::GetCompiledScript - script '%s' needs to be compiled but compiler is not available", filename); delete [] buffer; return NULL; } @@ -216,7 +216,7 @@ byte *CScEngine::getCompiledScript(const char *filename, uint32 *outSize, bool i CScCachedScript *cachedScript = new CScCachedScript(filename, compBuffer, compSize); if (cachedScript) { int index = 0; - uint32 MinTime = CBPlatform::getTime(); + uint32 MinTime = BasePlatform::getTime(); for (int i = 0; i < MAX_CACHED_SCRIPTS; i++) { if (_cachedScripts[i] == NULL) { index = i; @@ -244,7 +244,7 @@ byte *CScEngine::getCompiledScript(const char *filename, uint32 *outSize, bool i ////////////////////////////////////////////////////////////////////////// -bool CScEngine::tick() { +bool ScEngine::tick() { if (_scripts.getSize() == 0) return STATUS_OK; @@ -275,7 +275,7 @@ bool CScEngine::tick() { case SCRIPT_SLEEPING: { if (_scripts[i]->_waitFrozen) { - if (_scripts[i]->_waitTime <= CBPlatform::getTime()) _scripts[i]->run(); + if (_scripts[i]->_waitTime <= BasePlatform::getTime()) _scripts[i]->run(); } else { if (_scripts[i]->_waitTime <= _gameRef->_timer) _scripts[i]->run(); } @@ -300,7 +300,7 @@ bool CScEngine::tick() { break; } default: - //warning("CScEngine::Tick - Unhandled enum"); + //warning("ScEngine::Tick - Unhandled enum"); break; } // switch } // for each script @@ -314,25 +314,25 @@ bool CScEngine::tick() { // time sliced script if (_scripts[i]->_timeSlice > 0) { - uint32 StartTime = CBPlatform::getTime(); - while (_scripts[i]->_state == SCRIPT_RUNNING && CBPlatform::getTime() - StartTime < _scripts[i]->_timeSlice) { + uint32 StartTime = BasePlatform::getTime(); + while (_scripts[i]->_state == SCRIPT_RUNNING && BasePlatform::getTime() - StartTime < _scripts[i]->_timeSlice) { _currentScript = _scripts[i]; _scripts[i]->executeInstruction(); } - if (_isProfiling && _scripts[i]->_filename) addScriptTime(_scripts[i]->_filename, CBPlatform::getTime() - StartTime); + if (_isProfiling && _scripts[i]->_filename) addScriptTime(_scripts[i]->_filename, BasePlatform::getTime() - StartTime); } // normal script else { uint32 startTime = 0; bool isProfiling = _isProfiling; - if (isProfiling) startTime = CBPlatform::getTime(); + if (isProfiling) startTime = BasePlatform::getTime(); while (_scripts[i]->_state == SCRIPT_RUNNING) { _currentScript = _scripts[i]; _scripts[i]->executeInstruction(); } - if (isProfiling && _scripts[i]->_filename) addScriptTime(_scripts[i]->_filename, CBPlatform::getTime() - startTime); + if (isProfiling && _scripts[i]->_filename) addScriptTime(_scripts[i]->_filename, BasePlatform::getTime() - startTime); } _currentScript = NULL; } @@ -344,7 +344,7 @@ bool CScEngine::tick() { ////////////////////////////////////////////////////////////////////////// -bool CScEngine::tickUnbreakable() { +bool ScEngine::tickUnbreakable() { // execute unbreakable scripts for (int i = 0; i < _scripts.getSize(); i++) { if (!_scripts[i]->_unbreakable) continue; @@ -363,7 +363,7 @@ bool CScEngine::tickUnbreakable() { ////////////////////////////////////////////////////////////////////////// -bool CScEngine::removeFinishedScripts() { +bool ScEngine::removeFinishedScripts() { // remove finished scripts for (int i = 0; i < _scripts.getSize(); i++) { if (_scripts[i]->_state == SCRIPT_FINISHED || _scripts[i]->_state == SCRIPT_ERROR) { @@ -379,7 +379,7 @@ bool CScEngine::removeFinishedScripts() { ////////////////////////////////////////////////////////////////////////// -int CScEngine::getNumScripts(int *running, int *waiting, int *persistent) { +int ScEngine::getNumScripts(int *running, int *waiting, int *persistent) { int numRunning = 0, numWaiting = 0, numPersistent = 0, numTotal = 0; for (int i = 0; i < _scripts.getSize(); i++) { @@ -397,7 +397,7 @@ int CScEngine::getNumScripts(int *running, int *waiting, int *persistent) { numPersistent++; break; default: - warning("CScEngine::GetNumScripts - unhandled enum"); + warning("ScEngine::GetNumScripts - unhandled enum"); break; } numTotal++; @@ -411,7 +411,7 @@ int CScEngine::getNumScripts(int *running, int *waiting, int *persistent) { ////////////////////////////////////////////////////////////////////////// -bool CScEngine::emptyScriptCache() { +bool ScEngine::emptyScriptCache() { for (int i = 0; i < MAX_CACHED_SCRIPTS; i++) { if (_cachedScripts[i]) { delete _cachedScripts[i]; @@ -423,7 +423,7 @@ bool CScEngine::emptyScriptCache() { ////////////////////////////////////////////////////////////////////////// -bool CScEngine::resetObject(CBObject *Object) { +bool ScEngine::resetObject(BaseObject *Object) { // terminate all scripts waiting for this object for (int i = 0; i < _scripts.getSize(); i++) { if (_scripts[i]->_state == SCRIPT_WAITING && _scripts[i]->_waitObject == Object) { @@ -437,7 +437,7 @@ bool CScEngine::resetObject(CBObject *Object) { } ////////////////////////////////////////////////////////////////////////// -bool CScEngine::resetScript(CScScript *script) { +bool ScEngine::resetScript(ScScript *script) { // terminate all scripts waiting for this script for (int i = 0; i < _scripts.getSize(); i++) { if (_scripts[i]->_state == SCRIPT_WAITING_SCRIPT && _scripts[i]->_waitScript == script) { @@ -448,7 +448,7 @@ bool CScEngine::resetScript(CScScript *script) { } ////////////////////////////////////////////////////////////////////////// -bool CScEngine::persist(CBPersistMgr *persistMgr) { +bool ScEngine::persist(BasePersistenceManager *persistMgr) { if (!persistMgr->_saving) cleanup(); persistMgr->transfer(TMEMBER(_gameRef)); @@ -461,7 +461,7 @@ bool CScEngine::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -void CScEngine::editorCleanup() { +void ScEngine::editorCleanup() { for (int i = 0; i < _scripts.getSize(); i++) { if (_scripts[i]->_owner == NULL && (_scripts[i]->_state == SCRIPT_FINISHED || _scripts[i]->_state == SCRIPT_ERROR)) { delete _scripts[i]; @@ -473,7 +473,7 @@ void CScEngine::editorCleanup() { ////////////////////////////////////////////////////////////////////////// -bool CScEngine::pauseAll() { +bool ScEngine::pauseAll() { for (int i = 0; i < _scripts.getSize(); i++) { if (_scripts[i] != _currentScript) _scripts[i]->pause(); } @@ -483,7 +483,7 @@ bool CScEngine::pauseAll() { ////////////////////////////////////////////////////////////////////////// -bool CScEngine::resumeAll() { +bool ScEngine::resumeAll() { for (int i = 0; i < _scripts.getSize(); i++) _scripts[i]->resume(); @@ -492,7 +492,7 @@ bool CScEngine::resumeAll() { ////////////////////////////////////////////////////////////////////////// -bool CScEngine::isValidScript(CScScript *script) { +bool ScEngine::isValidScript(ScScript *script) { for (int i = 0; i < _scripts.getSize(); i++) { if (_scripts[i] == script) return true; } @@ -500,13 +500,13 @@ bool CScEngine::isValidScript(CScScript *script) { } ////////////////////////////////////////////////////////////////////////// -bool CScEngine::clearGlobals(bool includingNatives) { +bool ScEngine::clearGlobals(bool includingNatives) { _globals->CleanProps(includingNatives); return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CScEngine::dbgSendScripts(IWmeDebugClient *client) { +bool ScEngine::dbgSendScripts(IWmeDebugClient *client) { // send global variables _globals->dbgSendVariables(client, WME_DBGVAR_GLOBAL, NULL, 0); @@ -526,7 +526,7 @@ bool CScEngine::dbgSendScripts(IWmeDebugClient *client) { } ////////////////////////////////////////////////////////////////////////// -bool CScEngine::addBreakpoint(const char *scriptFilename, int line) { +bool ScEngine::addBreakpoint(const char *scriptFilename, int line) { if (!_gameRef->getDebugMgr()->_enabled) return STATUS_OK; CScBreakpoint *bp = NULL; @@ -553,7 +553,7 @@ bool CScEngine::addBreakpoint(const char *scriptFilename, int line) { } ////////////////////////////////////////////////////////////////////////// -bool CScEngine::removeBreakpoint(const char *scriptFilename, int line) { +bool ScEngine::removeBreakpoint(const char *scriptFilename, int line) { if (!_gameRef->getDebugMgr()->_enabled) return STATUS_OK; for (int i = 0; i < _breakpoints.getSize(); i++) { @@ -578,7 +578,7 @@ bool CScEngine::removeBreakpoint(const char *scriptFilename, int line) { } ////////////////////////////////////////////////////////////////////////// -bool CScEngine::refreshScriptBreakpoints() { +bool ScEngine::refreshScriptBreakpoints() { if (!_gameRef->getDebugMgr()->_enabled) return STATUS_OK; for (int i = 0; i < _scripts.getSize(); i++) { @@ -588,7 +588,7 @@ bool CScEngine::refreshScriptBreakpoints() { } ////////////////////////////////////////////////////////////////////////// -bool CScEngine::refreshScriptBreakpoints(CScScript *script) { +bool ScEngine::refreshScriptBreakpoints(ScScript *script) { if (!_gameRef->getDebugMgr()->_enabled) return STATUS_OK; if (!script || !script->_filename) return STATUS_FAILED; @@ -605,7 +605,7 @@ bool CScEngine::refreshScriptBreakpoints(CScScript *script) { } ////////////////////////////////////////////////////////////////////////// -bool CScEngine::saveBreakpoints() { +bool ScEngine::saveBreakpoints() { if (!_gameRef->getDebugMgr()->_enabled) return STATUS_OK; @@ -628,7 +628,7 @@ bool CScEngine::saveBreakpoints() { } ////////////////////////////////////////////////////////////////////////// -bool CScEngine::loadBreakpoints() { +bool ScEngine::loadBreakpoints() { if (!_gameRef->getDebugMgr()->_enabled) return STATUS_OK; char key[100]; @@ -639,8 +639,8 @@ bool CScEngine::loadBreakpoints() { sprintf(key, "Breakpoint%d", i); AnsiString breakpoint = _gameRef->_registry->readString("Debug", key, ""); - char *path = CBUtils::strEntry(0, breakpoint.c_str(), ':'); - char *line = CBUtils::strEntry(1, breakpoint.c_str(), ':'); + char *path = BaseUtils::strEntry(0, breakpoint.c_str(), ':'); + char *line = BaseUtils::strEntry(1, breakpoint.c_str(), ':'); if (path != NULL && line != NULL) addBreakpoint(path, atoi(line)); delete[] path; @@ -654,7 +654,7 @@ bool CScEngine::loadBreakpoints() { ////////////////////////////////////////////////////////////////////////// -void CScEngine::addScriptTime(const char *filename, uint32 time) { +void ScEngine::addScriptTime(const char *filename, uint32 time) { if (!_isProfiling) return; AnsiString fileName = filename; @@ -664,19 +664,19 @@ void CScEngine::addScriptTime(const char *filename, uint32 time) { ////////////////////////////////////////////////////////////////////////// -void CScEngine::enableProfiling() { +void ScEngine::enableProfiling() { if (_isProfiling) return; // destroy old data, if any _scriptTimes.clear(); - _profilingStartTime = CBPlatform::getTime(); + _profilingStartTime = BasePlatform::getTime(); _isProfiling = true; } ////////////////////////////////////////////////////////////////////////// -void CScEngine::disableProfiling() { +void ScEngine::disableProfiling() { if (!_isProfiling) return; dumpStats(); @@ -685,9 +685,9 @@ void CScEngine::disableProfiling() { ////////////////////////////////////////////////////////////////////////// -void CScEngine::dumpStats() { +void ScEngine::dumpStats() { error("DumpStats not ported to ScummVM yet"); - /* uint32 totalTime = CBPlatform::getTime() - _profilingStartTime; + /* uint32 totalTime = BasePlatform::getTime() - _profilingStartTime; typedef std::vector > TimeVector; TimeVector times; diff --git a/engines/wintermute/base/scriptables/script_engine.h b/engines/wintermute/base/scriptables/script_engine.h index 81dc13a73c..06d61b4156 100644 --- a/engines/wintermute/base/scriptables/script_engine.h +++ b/engines/wintermute/base/scriptables/script_engine.h @@ -39,16 +39,16 @@ namespace WinterMute { #define MAX_CACHED_SCRIPTS 20 -class CScScript; -class CScValue; -class CBObject; -class CBScriptHolder; -class CScEngine : public CBBase { +class ScScript; +class ScValue; +class BaseObject; +class BaseScriptHolder; +class ScEngine : public BaseClass { public: class CScCachedScript { public: CScCachedScript(const char *filename, byte *buffer, uint32 size) { - _timestamp = CBPlatform::getTime(); + _timestamp = BasePlatform::getTime(); _buffer = new byte[size]; if (_buffer) memcpy(_buffer, buffer, size); _size = size; @@ -76,7 +76,7 @@ public: } Common::String _filename; - CBArray _lines; + BaseArray _lines; }; @@ -85,42 +85,42 @@ public: public: bool dbgSendScripts(IWmeDebugClient *client); - CBArray _breakpoints; + BaseArray _breakpoints; bool addBreakpoint(const char *scriptFilename, int line); bool removeBreakpoint(const char *scriptFilename, int line); bool refreshScriptBreakpoints(); - bool refreshScriptBreakpoints(CScScript *script); + bool refreshScriptBreakpoints(ScScript *script); bool saveBreakpoints(); bool loadBreakpoints(); bool clearGlobals(bool includingNatives = false); bool tickUnbreakable(); bool removeFinishedScripts(); - bool isValidScript(CScScript *script); + bool isValidScript(ScScript *script); - CScScript *_currentScript; + ScScript *_currentScript; bool resumeAll(); bool pauseAll(); void editorCleanup(); - bool resetObject(CBObject *Object); - bool resetScript(CScScript *script); + bool resetObject(BaseObject *Object); + bool resetScript(ScScript *script); bool emptyScriptCache(); byte *getCompiledScript(const char *filename, uint32 *outSize, bool ignoreCache = false); - DECLARE_PERSISTENT(CScEngine, CBBase) + DECLARE_PERSISTENT(ScEngine, BaseClass) bool cleanup(); int getNumScripts(int *running = NULL, int *waiting = NULL, int *persistent = NULL); bool tick(); - CScValue *_globals; - CScScript *runScript(const char *filename, CBScriptHolder *owner = NULL); + ScValue *_globals; + ScScript *runScript(const char *filename, BaseScriptHolder *owner = NULL); static const bool _compilerAvailable = false; - CScEngine(CBGame *inGame); - virtual ~CScEngine(); + ScEngine(BaseGame *inGame); + virtual ~ScEngine(); static byte *loadFile(void *data, char *filename, uint32 *size); static void closeFile(void *data, byte *buffer); static void parseElement(void *data, int line, int type, void *elementData); - CBArray _scripts; + BaseArray _scripts; void enableProfiling(); void disableProfiling(); diff --git a/engines/wintermute/base/scriptables/script_ext_array.cpp b/engines/wintermute/base/scriptables/script_ext_array.cpp index a1b8249cb1..41059b2d80 100644 --- a/engines/wintermute/base/scriptables/script_ext_array.cpp +++ b/engines/wintermute/base/scriptables/script_ext_array.cpp @@ -34,16 +34,16 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CSXArray, false) +IMPLEMENT_PERSISTENT(SXArray, false) -CBScriptable *makeSXArray(CBGame *inGame, CScStack *stack) { - return new CSXArray(inGame, stack); +BaseScriptable *makeSXArray(BaseGame *inGame, ScStack *stack) { + return new SXArray(inGame, stack); } ////////////////////////////////////////////////////////////////////////// -CSXArray::CSXArray(CBGame *inGame, CScStack *stack): CBScriptable(inGame) { +SXArray::SXArray(BaseGame *inGame, ScStack *stack): BaseScriptable(inGame) { _length = 0; - _values = new CScValue(_gameRef); + _values = new ScValue(_gameRef); int numParams = stack->pop()->getInt(0); @@ -59,27 +59,27 @@ CSXArray::CSXArray(CBGame *inGame, CScStack *stack): CBScriptable(inGame) { } ////////////////////////////////////////////////////////////////////////// -CSXArray::CSXArray(CBGame *inGame): CBScriptable(inGame) { +SXArray::SXArray(BaseGame *inGame): BaseScriptable(inGame) { _length = 0; - _values = new CScValue(_gameRef); + _values = new ScValue(_gameRef); } ////////////////////////////////////////////////////////////////////////// -CSXArray::~CSXArray() { +SXArray::~SXArray() { delete _values; _values = NULL; } ////////////////////////////////////////////////////////////////////////// -const char *CSXArray::scToString() { +const char *SXArray::scToString() { static char dummy[32768]; // TODO: Get rid of static. strcpy(dummy, ""); char propName[20]; for (int i = 0; i < _length; i++) { sprintf(propName, "%d", i); - CScValue *val = _values->getProp(propName); + ScValue *val = _values->getProp(propName); if (val) { if (strlen(dummy) + strlen(val->getString()) < 32768) { strcat(dummy, val->getString()); @@ -93,7 +93,7 @@ const char *CSXArray::scToString() { ////////////////////////////////////////////////////////////////////////// -bool CSXArray::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool SXArray::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // Push ////////////////////////////////////////////////////////////////////////// @@ -134,7 +134,7 @@ bool CSXArray::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSt ////////////////////////////////////////////////////////////////////////// -CScValue *CSXArray::scGetProperty(const char *name) { +ScValue *SXArray::scGetProperty(const char *name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// @@ -166,7 +166,7 @@ CScValue *CSXArray::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -bool CSXArray::scSetProperty(const char *name, CScValue *value) { +bool SXArray::scSetProperty(const char *name, ScValue *value) { ////////////////////////////////////////////////////////////////////////// // Length ////////////////////////////////////////////////////////////////////////// @@ -199,8 +199,8 @@ bool CSXArray::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// -bool CSXArray::persist(CBPersistMgr *persistMgr) { - CBScriptable::persist(persistMgr); +bool SXArray::persist(BasePersistenceManager *persistMgr) { + BaseScriptable::persist(persistMgr); persistMgr->transfer(TMEMBER(_length)); persistMgr->transfer(TMEMBER(_values)); @@ -210,7 +210,7 @@ bool CSXArray::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -bool CSXArray::validNumber(const char *origStr, char *outStr) { +bool SXArray::validNumber(const char *origStr, char *outStr) { bool isNumber = true; for (uint32 i = 0; i < strlen(origStr); i++) { if (!(origStr[i] >= '0' && origStr[i] <= '9')) { @@ -227,7 +227,7 @@ bool CSXArray::validNumber(const char *origStr, char *outStr) { } ////////////////////////////////////////////////////////////////////////// -bool CSXArray::push(CScValue *val) { +bool SXArray::push(ScValue *val) { char paramName[20]; _length++; sprintf(paramName, "%d", _length - 1); diff --git a/engines/wintermute/base/scriptables/script_ext_array.h b/engines/wintermute/base/scriptables/script_ext_array.h index b873416572..3f8d703f85 100644 --- a/engines/wintermute/base/scriptables/script_ext_array.h +++ b/engines/wintermute/base/scriptables/script_ext_array.h @@ -33,20 +33,20 @@ namespace WinterMute { -class CSXArray : public CBScriptable { +class SXArray : public BaseScriptable { public: - bool push(CScValue *Val); + bool push(ScValue *Val); bool validNumber(const char *origStr, char *outStr); - DECLARE_PERSISTENT(CSXArray, CBScriptable) - CSXArray(CBGame *inGame, CScStack *stack); - CSXArray(CBGame *inGame); - virtual ~CSXArray(); - CScValue *scGetProperty(const char *name); - bool scSetProperty(const char *name, CScValue *value); - bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + DECLARE_PERSISTENT(SXArray, BaseScriptable) + SXArray(BaseGame *inGame, ScStack *stack); + SXArray(BaseGame *inGame); + virtual ~SXArray(); + ScValue *scGetProperty(const char *name); + bool scSetProperty(const char *name, ScValue *value); + bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); const char *scToString(); int _length; - CScValue *_values; + ScValue *_values; }; } // end of namespace WinterMute diff --git a/engines/wintermute/base/scriptables/script_ext_date.cpp b/engines/wintermute/base/scriptables/script_ext_date.cpp index 211c0d34f0..322fb9bc5b 100644 --- a/engines/wintermute/base/scriptables/script_ext_date.cpp +++ b/engines/wintermute/base/scriptables/script_ext_date.cpp @@ -32,19 +32,19 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CSXDate, false) +IMPLEMENT_PERSISTENT(SXDate, false) -CBScriptable *makeSXDate(CBGame *inGame, CScStack *stack) { - return new CSXDate(inGame, stack); +BaseScriptable *makeSXDate(BaseGame *inGame, ScStack *stack) { + return new SXDate(inGame, stack); } ////////////////////////////////////////////////////////////////////////// -CSXDate::CSXDate(CBGame *inGame, CScStack *stack): CBScriptable(inGame) { +SXDate::SXDate(BaseGame *inGame, ScStack *stack): BaseScriptable(inGame) { stack->correctParams(6); memset(&_tm, 0, sizeof(_tm)); - CScValue *valYear = stack->pop(); + ScValue *valYear = stack->pop(); _tm.tm_year = valYear->getInt() - 1900; _tm.tm_mon = stack->pop()->getInt() - 1; _tm.tm_mday = stack->pop()->getInt(); @@ -59,12 +59,12 @@ CSXDate::CSXDate(CBGame *inGame, CScStack *stack): CBScriptable(inGame) { ////////////////////////////////////////////////////////////////////////// -CSXDate::~CSXDate() { +SXDate::~SXDate() { } ////////////////////////////////////////////////////////////////////////// -const char *CSXDate::scToString() { +const char *SXDate::scToString() { // TODO: Make this more stringy, and less ISO 8601-like _strRep.format("%04d-%02d-%02d - %02d:%02d:%02d", _tm.tm_year, _tm.tm_mon, _tm.tm_mday, _tm.tm_hour, _tm.tm_min, _tm.tm_sec); return _strRep.c_str(); @@ -75,7 +75,7 @@ const char *CSXDate::scToString() { ////////////////////////////////////////////////////////////////////////// -bool CSXDate::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool SXDate::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // GetYear ////////////////////////////////////////////////////////////////////////// @@ -207,7 +207,7 @@ bool CSXDate::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSta ////////////////////////////////////////////////////////////////////////// -CScValue *CSXDate::scGetProperty(const char *name) { +ScValue *SXDate::scGetProperty(const char *name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// @@ -223,7 +223,7 @@ CScValue *CSXDate::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -bool CSXDate::scSetProperty(const char *name, CScValue *value) { +bool SXDate::scSetProperty(const char *name, ScValue *value) { /* ////////////////////////////////////////////////////////////////////////// // Name @@ -238,9 +238,9 @@ bool CSXDate::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// -bool CSXDate::persist(CBPersistMgr *persistMgr) { +bool SXDate::persist(BasePersistenceManager *persistMgr) { - CBScriptable::persist(persistMgr); + BaseScriptable::persist(persistMgr); persistMgr->transfer(TMEMBER(_tm.tm_year)); persistMgr->transfer(TMEMBER(_tm.tm_mon)); persistMgr->transfer(TMEMBER(_tm.tm_mday)); @@ -251,9 +251,9 @@ bool CSXDate::persist(CBPersistMgr *persistMgr) { } ////////////////////////////////////////////////////////////////////////// -int CSXDate::scCompare(CBScriptable *Value) { +int SXDate::scCompare(BaseScriptable *Value) { TimeDate time1 = _tm; - TimeDate time2 = ((CSXDate *)Value)->_tm; + TimeDate time2 = ((SXDate *)Value)->_tm; if (time1.tm_year < time2.tm_year) { return -1; diff --git a/engines/wintermute/base/scriptables/script_ext_date.h b/engines/wintermute/base/scriptables/script_ext_date.h index 82f6af1f1d..b2df4abe94 100644 --- a/engines/wintermute/base/scriptables/script_ext_date.h +++ b/engines/wintermute/base/scriptables/script_ext_date.h @@ -34,15 +34,15 @@ namespace WinterMute { -class CSXDate : public CBScriptable { +class SXDate : public BaseScriptable { public: - int scCompare(CBScriptable *Value); - DECLARE_PERSISTENT(CSXDate, CBScriptable) - CSXDate(CBGame *inGame, CScStack *Stack); - virtual ~CSXDate(); - CScValue *scGetProperty(const char *name); - bool scSetProperty(const char *name, CScValue *value); - bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + int scCompare(BaseScriptable *Value); + DECLARE_PERSISTENT(SXDate, BaseScriptable) + SXDate(BaseGame *inGame, ScStack *Stack); + virtual ~SXDate(); + ScValue *scGetProperty(const char *name); + bool scSetProperty(const char *name, ScValue *value); + bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); const char *scToString(); char *_string; TimeDate _tm; diff --git a/engines/wintermute/base/scriptables/script_ext_file.cpp b/engines/wintermute/base/scriptables/script_ext_file.cpp index 58c0416b43..ffa362a938 100644 --- a/engines/wintermute/base/scriptables/script_ext_file.cpp +++ b/engines/wintermute/base/scriptables/script_ext_file.cpp @@ -42,19 +42,19 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CSXFile, false) +IMPLEMENT_PERSISTENT(SXFile, false) -CBScriptable *makeSXFile(CBGame *inGame, CScStack *stack) { - return new CSXFile(inGame, stack); +BaseScriptable *makeSXFile(BaseGame *inGame, ScStack *stack) { + return new SXFile(inGame, stack); } ////////////////////////////////////////////////////////////////////////// -CSXFile::CSXFile(CBGame *inGame, CScStack *stack): CBScriptable(inGame) { +SXFile::SXFile(BaseGame *inGame, ScStack *stack): BaseScriptable(inGame) { stack->correctParams(1); - CScValue *Val = stack->pop(); + ScValue *Val = stack->pop(); _filename = NULL; - if (!Val->isNULL()) CBUtils::setString(&_filename, Val->getString()); + if (!Val->isNULL()) BaseUtils::setString(&_filename, Val->getString()); _readFile = NULL; _writeFile = NULL; @@ -65,12 +65,12 @@ CSXFile::CSXFile(CBGame *inGame, CScStack *stack): CBScriptable(inGame) { ////////////////////////////////////////////////////////////////////////// -CSXFile::~CSXFile() { +SXFile::~SXFile() { cleanup(); } ////////////////////////////////////////////////////////////////////////// -void CSXFile::cleanup() { +void SXFile::cleanup() { delete[] _filename; _filename = NULL; close(); @@ -78,7 +78,7 @@ void CSXFile::cleanup() { ////////////////////////////////////////////////////////////////////////// -void CSXFile::close() { +void SXFile::close() { if (_readFile) { _gameRef->_fileManager->closeFile(_readFile); _readFile = NULL; @@ -93,14 +93,14 @@ void CSXFile::close() { } ////////////////////////////////////////////////////////////////////////// -const char *CSXFile::scToString() { +const char *SXFile::scToString() { if (_filename) return _filename; else return "[file object]"; } #define FILE_BUFFER_SIZE 32768 ////////////////////////////////////////////////////////////////////////// -bool CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool SXFile::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // SetFilename ////////////////////////////////////////////////////////////////////////// @@ -108,7 +108,7 @@ bool CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSta stack->correctParams(1); const char *filename = stack->pop()->getString(); cleanup(); - CBUtils::setString(&_filename, filename); + BaseUtils::setString(&_filename, filename); stack->pushNULL(); return STATUS_OK; } @@ -182,7 +182,7 @@ bool CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSta else if (strcmp(name, "Delete") == 0) { stack->correctParams(0); close(); - stack->pushBool(CBPlatform::deleteFile(_filename) != false); + stack->pushBool(BasePlatform::deleteFile(_filename) != false); return STATUS_OK; } @@ -195,7 +195,7 @@ bool CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSta bool Overwrite = stack->pop()->getBool(true); close(); - stack->pushBool(CBPlatform::copyFile(_filename, Dest, !Overwrite) != false); + stack->pushBool(BasePlatform::copyFile(_filename, Dest, !Overwrite) != false); return STATUS_OK; } @@ -593,12 +593,12 @@ bool CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSta } - else return CBScriptable::scCallMethod(script, stack, thisStack, name); + else return BaseScriptable::scCallMethod(script, stack, thisStack, name); } ////////////////////////////////////////////////////////////////////////// -CScValue *CSXFile::scGetProperty(const char *name) { +ScValue *SXFile::scGetProperty(const char *name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// @@ -649,12 +649,12 @@ CScValue *CSXFile::scGetProperty(const char *name) { return _scValue; } - else return CBScriptable::scGetProperty(name); + else return BaseScriptable::scGetProperty(name); } ////////////////////////////////////////////////////////////////////////// -bool CSXFile::scSetProperty(const char *name, CScValue *value) { +bool SXFile::scSetProperty(const char *name, ScValue *value) { /* ////////////////////////////////////////////////////////////////////////// // Length @@ -672,11 +672,11 @@ bool CSXFile::scSetProperty(const char *name, CScValue *value) { } return STATUS_OK; } - else*/ return CBScriptable::scSetProperty(name, value); + else*/ return BaseScriptable::scSetProperty(name, value); } ////////////////////////////////////////////////////////////////////////// -uint32 CSXFile::getPos() { +uint32 SXFile::getPos() { if (_mode == 1 && _readFile) return _readFile->pos(); else if ((_mode == 2 || _mode == 3) && _writeFile) { @@ -689,11 +689,11 @@ uint32 CSXFile::getPos() { } ////////////////////////////////////////////////////////////////////////// -bool CSXFile::setPos(uint32 pos, int whence) { +bool SXFile::setPos(uint32 pos, int whence) { if (_mode == 1 && _readFile) return _readFile->seek(pos, whence); else if ((_mode == 2 || _mode == 3) && _writeFile) { - error("CSXFile - seeking in WriteFile not supported"); + error("SXFile - seeking in WriteFile not supported"); return false; // return fseek((FILE *)_writeFile, pos, (int)origin) == 0; } @@ -701,11 +701,11 @@ bool CSXFile::setPos(uint32 pos, int whence) { } ////////////////////////////////////////////////////////////////////////// -uint32 CSXFile::getLength() { +uint32 SXFile::getLength() { if (_mode == 1 && _readFile) return _readFile->size(); else if ((_mode == 2 || _mode == 3) && _writeFile) { - error("CSXFile - reading length for WriteFile not supported"); + error("SXFile - reading length for WriteFile not supported"); return 0; /* uint32 currentPos = ftell((FILE *)_writeFile); @@ -717,9 +717,9 @@ uint32 CSXFile::getLength() { } ////////////////////////////////////////////////////////////////////////// -bool CSXFile::persist(CBPersistMgr *persistMgr) { +bool SXFile::persist(BasePersistenceManager *persistMgr) { - CBScriptable::persist(persistMgr); + BaseScriptable::persist(persistMgr); persistMgr->transfer(TMEMBER(_filename)); persistMgr->transfer(TMEMBER(_mode)); @@ -767,12 +767,12 @@ bool CSXFile::persist(CBPersistMgr *persistMgr) { } // Should replace fopen(..., "wb+") and fopen(..., "w+") -Common::WriteStream *CSXFile::openForWrite(const Common::String &filename, bool binary) { +Common::WriteStream *SXFile::openForWrite(const Common::String &filename, bool binary) { error("SXFile::openForWrite - WriteFiles not supported"); } // Should replace fopen(..., "ab+") and fopen(..., "a+") -Common::WriteStream *CSXFile::openForAppend(const Common::String &filename, bool binary) { +Common::WriteStream *SXFile::openForAppend(const Common::String &filename, bool binary) { error("SXFile::openForAppend - WriteFiles not supported"); } diff --git a/engines/wintermute/base/scriptables/script_ext_file.h b/engines/wintermute/base/scriptables/script_ext_file.h index 5a6811fe57..4d78feb044 100644 --- a/engines/wintermute/base/scriptables/script_ext_file.h +++ b/engines/wintermute/base/scriptables/script_ext_file.h @@ -35,17 +35,17 @@ namespace WinterMute { -class CBFile; +class BaseFile; -class CSXFile : public CBScriptable { +class SXFile : public BaseScriptable { public: - DECLARE_PERSISTENT(CSXFile, CBScriptable) - CScValue *scGetProperty(const char *name); - bool scSetProperty(const char *name, CScValue *value); - bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + DECLARE_PERSISTENT(SXFile, BaseScriptable) + ScValue *scGetProperty(const char *name); + bool scSetProperty(const char *name, ScValue *value); + bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); const char *scToString(); - CSXFile(CBGame *inGame, CScStack *Stack); - virtual ~CSXFile(); + SXFile(BaseGame *inGame, ScStack *Stack); + virtual ~SXFile(); private: Common::SeekableReadStream *_readFile; Common::WriteStream *_writeFile; diff --git a/engines/wintermute/base/scriptables/script_ext_math.cpp b/engines/wintermute/base/scriptables/script_ext_math.cpp index 22b08087b7..1c37a15aa9 100644 --- a/engines/wintermute/base/scriptables/script_ext_math.cpp +++ b/engines/wintermute/base/scriptables/script_ext_math.cpp @@ -40,26 +40,26 @@ namespace WinterMute { ////////////////////////////////////////////////////////////////////// -IMPLEMENT_PERSISTENT(CSXMath, true) +IMPLEMENT_PERSISTENT(SXMath, true) -CBScriptable *makeSXMath(CBGame *inGame) { - return new CSXMath(inGame); +BaseScriptable *makeSXMath(BaseGame *inGame) { + return new SXMath(inGame); } ////////////////////////////////////////////////////////////////////////// -CSXMath::CSXMath(CBGame *inGame): CBScriptable(inGame) { +SXMath::SXMath(BaseGame *inGame): BaseScriptable(inGame) { } ////////////////////////////////////////////////////////////////////////// -CSXMath::~CSXMath() { +SXMath::~SXMath() { } ////////////////////////////////////////////////////////////////////////// -bool CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool SXMath::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // Abs ////////////////////////////////////////////////////////////////////////// @@ -250,7 +250,7 @@ bool CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSta ////////////////////////////////////////////////////////////////////////// -CScValue *CSXMath::scGetProperty(const char *name) { +ScValue *SXMath::scGetProperty(const char *name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// @@ -274,21 +274,21 @@ CScValue *CSXMath::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -double CSXMath::degreeToRadian(double value) { +double SXMath::degreeToRadian(double value) { return value * (M_PI / 180.0f); } ////////////////////////////////////////////////////////////////////////// -double CSXMath::radianToDegree(double value) { +double SXMath::radianToDegree(double value) { return value * (180.0f / M_PI); } ////////////////////////////////////////////////////////////////////////// -bool CSXMath::persist(CBPersistMgr *persistMgr) { +bool SXMath::persist(BasePersistenceManager *persistMgr) { - CBScriptable::persist(persistMgr); + BaseScriptable::persist(persistMgr); return STATUS_OK; } diff --git a/engines/wintermute/base/scriptables/script_ext_math.h b/engines/wintermute/base/scriptables/script_ext_math.h index 422521233f..393342e5ca 100644 --- a/engines/wintermute/base/scriptables/script_ext_math.h +++ b/engines/wintermute/base/scriptables/script_ext_math.h @@ -34,13 +34,13 @@ namespace WinterMute { -class CSXMath : public CBScriptable { +class SXMath : public BaseScriptable { public: - DECLARE_PERSISTENT(CSXMath, CBScriptable) - CSXMath(CBGame *inGame); - virtual ~CSXMath(); - virtual CScValue *scGetProperty(const char *name); - virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + DECLARE_PERSISTENT(SXMath, BaseScriptable) + SXMath(BaseGame *inGame); + virtual ~SXMath(); + virtual ScValue *scGetProperty(const char *name); + virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); private: double degreeToRadian(double value); diff --git a/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp b/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp index df2bf188ff..79ba978002 100644 --- a/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp +++ b/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp @@ -35,14 +35,14 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CSXMemBuffer, false) +IMPLEMENT_PERSISTENT(SXMemBuffer, false) -CBScriptable *makeSXMemBuffer(CBGame *inGame, CScStack *stack) { - return new CSXMemBuffer(inGame, stack); +BaseScriptable *makeSXMemBuffer(BaseGame *inGame, ScStack *stack) { + return new SXMemBuffer(inGame, stack); } ////////////////////////////////////////////////////////////////////////// -CSXMemBuffer::CSXMemBuffer(CBGame *inGame, CScStack *stack): CBScriptable(inGame) { +SXMemBuffer::SXMemBuffer(BaseGame *inGame, ScStack *stack): BaseScriptable(inGame) { stack->correctParams(1); _buffer = NULL; _size = 0; @@ -52,31 +52,31 @@ CSXMemBuffer::CSXMemBuffer(CBGame *inGame, CScStack *stack): CBScriptable(inGame } ////////////////////////////////////////////////////////////////////////// -CSXMemBuffer::CSXMemBuffer(CBGame *inGame, void *Buffer): CBScriptable(inGame) { +SXMemBuffer::SXMemBuffer(BaseGame *inGame, void *Buffer): BaseScriptable(inGame) { _size = 0; _buffer = Buffer; } ////////////////////////////////////////////////////////////////////////// -CSXMemBuffer::~CSXMemBuffer() { +SXMemBuffer::~SXMemBuffer() { cleanup(); } ////////////////////////////////////////////////////////////////////////// -void *CSXMemBuffer::scToMemBuffer() { +void *SXMemBuffer::scToMemBuffer() { return _buffer; } ////////////////////////////////////////////////////////////////////////// -void CSXMemBuffer::cleanup() { +void SXMemBuffer::cleanup() { if (_size) free(_buffer); _buffer = NULL; _size = 0; } ////////////////////////////////////////////////////////////////////////// -bool CSXMemBuffer::resize(int newSize) { +bool SXMemBuffer::resize(int newSize) { int oldSize = _size; if (_size == 0) { @@ -102,7 +102,7 @@ bool CSXMemBuffer::resize(int newSize) { } ////////////////////////////////////////////////////////////////////////// -bool CSXMemBuffer::checkBounds(CScScript *script, int start, int length) { +bool SXMemBuffer::checkBounds(ScScript *script, int start, int length) { if (_buffer == NULL) { script->runtimeError("Cannot use Set/Get methods on an uninitialized memory buffer"); return false; @@ -118,13 +118,13 @@ bool CSXMemBuffer::checkBounds(CScScript *script, int start, int length) { } ////////////////////////////////////////////////////////////////////////// -const char *CSXMemBuffer::scToString() { +const char *SXMemBuffer::scToString() { return "[membuffer object]"; } ////////////////////////////////////////////////////////////////////////// -bool CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool SXMemBuffer::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // SetSize ////////////////////////////////////////////////////////////////////////// @@ -264,7 +264,7 @@ bool CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack *th stack->pushNULL(); else { void *pointer = *(void **)((byte *)_buffer + start); - CSXMemBuffer *buf = new CSXMemBuffer(_gameRef, pointer); + SXMemBuffer *buf = new SXMemBuffer(_gameRef, pointer); stack->pushNative(buf, false); } return STATUS_OK; @@ -395,7 +395,7 @@ bool CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack *th else if (strcmp(name, "SetPointer") == 0) { stack->correctParams(2); int start = stack->pop()->getInt(); - /* CScValue *Val = */ stack->pop(); + /* ScValue *Val = */ stack->pop(); if (!checkBounds(script, start, sizeof(void *))) stack->pushBool(false); @@ -433,7 +433,7 @@ bool CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack *th ////////////////////////////////////////////////////////////////////////// -CScValue *CSXMemBuffer::scGetProperty(const char *name) { +ScValue *SXMemBuffer::scGetProperty(const char *name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// @@ -452,12 +452,12 @@ CScValue *CSXMemBuffer::scGetProperty(const char *name) { return _scValue; } - else return CBScriptable::scGetProperty(name); + else return BaseScriptable::scGetProperty(name); } ////////////////////////////////////////////////////////////////////////// -bool CSXMemBuffer::scSetProperty(const char *name, CScValue *value) { +bool SXMemBuffer::scSetProperty(const char *name, ScValue *value) { /* ////////////////////////////////////////////////////////////////////////// // Length @@ -475,14 +475,14 @@ bool CSXMemBuffer::scSetProperty(const char *name, CScValue *value) { } return STATUS_OK; } - else*/ return CBScriptable::scSetProperty(name, value); + else*/ return BaseScriptable::scSetProperty(name, value); } ////////////////////////////////////////////////////////////////////////// -bool CSXMemBuffer::persist(CBPersistMgr *persistMgr) { +bool SXMemBuffer::persist(BasePersistenceManager *persistMgr) { - CBScriptable::persist(persistMgr); + BaseScriptable::persist(persistMgr); persistMgr->transfer(TMEMBER(_size)); @@ -500,7 +500,7 @@ bool CSXMemBuffer::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -int CSXMemBuffer::scCompare(CBScriptable *val) { +int SXMemBuffer::scCompare(BaseScriptable *val) { if (_buffer == val->scToMemBuffer()) return 0; else return 1; } diff --git a/engines/wintermute/base/scriptables/script_ext_mem_buffer.h b/engines/wintermute/base/scriptables/script_ext_mem_buffer.h index a9d78e50e4..c325181e3f 100644 --- a/engines/wintermute/base/scriptables/script_ext_mem_buffer.h +++ b/engines/wintermute/base/scriptables/script_ext_mem_buffer.h @@ -34,24 +34,24 @@ namespace WinterMute { -class CSXMemBuffer : public CBScriptable { +class SXMemBuffer : public BaseScriptable { public: - virtual int scCompare(CBScriptable *Val); - DECLARE_PERSISTENT(CSXMemBuffer, CBScriptable) - CScValue *scGetProperty(const char *name); - bool scSetProperty(const char *name, CScValue *value); - bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual int scCompare(BaseScriptable *Val); + DECLARE_PERSISTENT(SXMemBuffer, BaseScriptable) + ScValue *scGetProperty(const char *name); + bool scSetProperty(const char *name, ScValue *value); + bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); const char *scToString(); - CSXMemBuffer(CBGame *inGame, CScStack *stack); - CSXMemBuffer(CBGame *inGame, void *buffer); - virtual ~CSXMemBuffer(); + SXMemBuffer(BaseGame *inGame, ScStack *stack); + SXMemBuffer(BaseGame *inGame, void *buffer); + virtual ~SXMemBuffer(); virtual void *scToMemBuffer(); int _size; private: bool resize(int newSize); void *_buffer; void cleanup(); - bool checkBounds(CScScript *script, int start, int length); + bool checkBounds(ScScript *script, int start, int length); }; } // end of namespace WinterMute diff --git a/engines/wintermute/base/scriptables/script_ext_object.cpp b/engines/wintermute/base/scriptables/script_ext_object.cpp index cb0d32d1a3..b72e3e4b97 100644 --- a/engines/wintermute/base/scriptables/script_ext_object.cpp +++ b/engines/wintermute/base/scriptables/script_ext_object.cpp @@ -36,14 +36,14 @@ namespace WinterMute { // Construction/Destruction ////////////////////////////////////////////////////////////////////// -IMPLEMENT_PERSISTENT(CSXObject, false) +IMPLEMENT_PERSISTENT(SXObject, false) -CBScriptable *makeSXObject(CBGame *inGame, CScStack *stack) { - return new CSXObject(inGame, stack); +BaseScriptable *makeSXObject(BaseGame *inGame, ScStack *stack) { + return new SXObject(inGame, stack); } ////////////////////////////////////////////////////////////////////////// -CSXObject::CSXObject(CBGame *inGame, CScStack *stack): CBObject(inGame) { +SXObject::SXObject(BaseGame *inGame, ScStack *stack): BaseObject(inGame) { int numParams = stack->pop()->getInt(0); for (int i = 0; i < numParams; i++) { addScript(stack->pop()->getString()); @@ -52,14 +52,14 @@ CSXObject::CSXObject(CBGame *inGame, CScStack *stack): CBObject(inGame) { ////////////////////////////////////////////////////////////////////////// -CSXObject::~CSXObject() { +SXObject::~SXObject() { } ////////////////////////////////////////////////////////////////////////// -bool CSXObject::persist(CBPersistMgr *persistMgr) { - CBObject::persist(persistMgr); +bool SXObject::persist(BasePersistenceManager *persistMgr) { + BaseObject::persist(persistMgr); return STATUS_OK; } diff --git a/engines/wintermute/base/scriptables/script_ext_object.h b/engines/wintermute/base/scriptables/script_ext_object.h index b4e869d5b3..d744c58042 100644 --- a/engines/wintermute/base/scriptables/script_ext_object.h +++ b/engines/wintermute/base/scriptables/script_ext_object.h @@ -34,11 +34,11 @@ namespace WinterMute { -class CSXObject : public CBObject { +class SXObject : public BaseObject { public: - DECLARE_PERSISTENT(CSXObject, CBObject) - CSXObject(CBGame *inGame, CScStack *Stack); - virtual ~CSXObject(); + DECLARE_PERSISTENT(SXObject, BaseObject) + SXObject(BaseGame *inGame, ScStack *Stack); + virtual ~SXObject(); }; diff --git a/engines/wintermute/base/scriptables/script_ext_string.cpp b/engines/wintermute/base/scriptables/script_ext_string.cpp index bd7541fadd..e645772b6f 100644 --- a/engines/wintermute/base/scriptables/script_ext_string.cpp +++ b/engines/wintermute/base/scriptables/script_ext_string.cpp @@ -37,19 +37,19 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CSXString, false) +IMPLEMENT_PERSISTENT(SXString, false) -CBScriptable *makeSXString(CBGame *inGame, CScStack *stack) { - return new CSXString(inGame, stack); +BaseScriptable *makeSXString(BaseGame *inGame, ScStack *stack) { + return new SXString(inGame, stack); } ////////////////////////////////////////////////////////////////////////// -CSXString::CSXString(CBGame *inGame, CScStack *stack): CBScriptable(inGame) { +SXString::SXString(BaseGame *inGame, ScStack *stack): BaseScriptable(inGame) { _string = NULL; _capacity = 0; stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); if (val->isInt()) { _capacity = MAX(0, val->getInt()); @@ -66,13 +66,13 @@ CSXString::CSXString(CBGame *inGame, CScStack *stack): CBScriptable(inGame) { ////////////////////////////////////////////////////////////////////////// -CSXString::~CSXString() { +SXString::~SXString() { if (_string) delete [] _string; } ////////////////////////////////////////////////////////////////////////// -void CSXString::setStringVal(const char *val) { +void SXString::setStringVal(const char *val) { int len = strlen(val); if (len >= _capacity) { _capacity = len + 1; @@ -86,20 +86,20 @@ void CSXString::setStringVal(const char *val) { ////////////////////////////////////////////////////////////////////////// -const char *CSXString::scToString() { +const char *SXString::scToString() { if (_string) return _string; else return "[null string]"; } ////////////////////////////////////////////////////////////////////////// -void CSXString::scSetString(const char *val) { +void SXString::scSetString(const char *val) { setStringVal(val); } ////////////////////////////////////////////////////////////////////////// -bool CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool SXString::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // Substring ////////////////////////////////////////////////////////////////////////// @@ -108,7 +108,7 @@ bool CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS int start = stack->pop()->getInt(); int end = stack->pop()->getInt(); - if (end < start) CBUtils::swap(&start, &end); + if (end < start) BaseUtils::swap(&start, &end); //try { WideString str; @@ -138,7 +138,7 @@ bool CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS stack->correctParams(2); int start = stack->pop()->getInt(); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); int len = val->getInt(); if (!val->isNULL() && len <= 0) { @@ -245,11 +245,11 @@ bool CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "Split") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); char separators[MAX_PATH_LENGTH] = ","; if (!val->isNULL()) strcpy(separators, val->getString()); - CSXArray *array = new CSXArray(_gameRef); + SXArray *array = new SXArray(_gameRef); if (!array) { stack->pushNULL(); return STATUS_OK; @@ -299,9 +299,9 @@ bool CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS WideString &part = (*it); if (_gameRef->_textEncoding == TEXT_UTF8) - val = new CScValue(_gameRef, StringUtil::wideToUtf8(part).c_str()); + val = new ScValue(_gameRef, StringUtil::wideToUtf8(part).c_str()); else - val = new CScValue(_gameRef, StringUtil::wideToAnsi(part).c_str()); + val = new ScValue(_gameRef, StringUtil::wideToAnsi(part).c_str()); array->push(val); delete val; @@ -317,7 +317,7 @@ bool CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS ////////////////////////////////////////////////////////////////////////// -CScValue *CSXString::scGetProperty(const char *name) { +ScValue *SXString::scGetProperty(const char *name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// @@ -352,7 +352,7 @@ CScValue *CSXString::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -bool CSXString::scSetProperty(const char *name, CScValue *value) { +bool SXString::scSetProperty(const char *name, ScValue *value) { ////////////////////////////////////////////////////////////////////////// // Capacity ////////////////////////////////////////////////////////////////////////// @@ -377,9 +377,9 @@ bool CSXString::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// -bool CSXString::persist(CBPersistMgr *persistMgr) { +bool SXString::persist(BasePersistenceManager *persistMgr) { - CBScriptable::persist(persistMgr); + BaseScriptable::persist(persistMgr); persistMgr->transfer(TMEMBER(_capacity)); @@ -397,8 +397,8 @@ bool CSXString::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -int CSXString::scCompare(CBScriptable *val) { - return strcmp(_string, ((CSXString *)val)->_string); +int SXString::scCompare(BaseScriptable *val) { + return strcmp(_string, ((SXString *)val)->_string); } } // end of namespace WinterMute diff --git a/engines/wintermute/base/scriptables/script_ext_string.h b/engines/wintermute/base/scriptables/script_ext_string.h index 52a1524dde..9a3bbfc80b 100644 --- a/engines/wintermute/base/scriptables/script_ext_string.h +++ b/engines/wintermute/base/scriptables/script_ext_string.h @@ -34,19 +34,19 @@ namespace WinterMute { -class CSXString : public CBScriptable { +class SXString : public BaseScriptable { public: - virtual int scCompare(CBScriptable *Val); - DECLARE_PERSISTENT(CSXString, CBScriptable) - CScValue *scGetProperty(const char *name); - bool scSetProperty(const char *name, CScValue *value); - bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual int scCompare(BaseScriptable *Val); + DECLARE_PERSISTENT(SXString, BaseScriptable) + ScValue *scGetProperty(const char *name); + bool scSetProperty(const char *name, ScValue *value); + bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); void scSetString(const char *val); const char *scToString(); void setStringVal(const char *val); - CSXString(CBGame *inGame, CScStack *Stack); - virtual ~CSXString(); + SXString(BaseGame *inGame, ScStack *Stack); + virtual ~SXString(); private: char *_string; diff --git a/engines/wintermute/base/scriptables/script_stack.cpp b/engines/wintermute/base/scriptables/script_stack.cpp index 188cb2d15c..74cc7a57ee 100644 --- a/engines/wintermute/base/scriptables/script_stack.cpp +++ b/engines/wintermute/base/scriptables/script_stack.cpp @@ -32,16 +32,16 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CScStack, false) +IMPLEMENT_PERSISTENT(ScStack, false) ////////////////////////////////////////////////////////////////////////// -CScStack::CScStack(CBGame *inGame): CBBase(inGame) { +ScStack::ScStack(BaseGame *inGame): BaseClass(inGame) { _sP = -1; } ////////////////////////////////////////////////////////////////////////// -CScStack::~CScStack() { +ScStack::~ScStack() { #if _DEBUG //_gameRef->LOG(0, "STAT: Stack size: %d, SP=%d", _values.getSize(), _sP); @@ -55,7 +55,7 @@ CScStack::~CScStack() { ////////////////////////////////////////////////////////////////////////// -CScValue *CScStack::pop() { +ScValue *ScStack::pop() { if (_sP < 0) { _gameRef->LOG(0, "Fatal: Stack underflow"); return NULL; @@ -66,14 +66,14 @@ CScValue *CScStack::pop() { ////////////////////////////////////////////////////////////////////////// -void CScStack::push(CScValue *val) { +void ScStack::push(ScValue *val) { _sP++; if (_sP < _values.getSize()) { _values[_sP]->cleanup(); _values[_sP]->copy(val); } else { - CScValue *copyVal = new CScValue(_gameRef); + ScValue *copyVal = new ScValue(_gameRef); copyVal->copy(val); _values.add(copyVal); } @@ -81,11 +81,11 @@ void CScStack::push(CScValue *val) { ////////////////////////////////////////////////////////////////////////// -CScValue *CScStack::getPushValue() { +ScValue *ScStack::getPushValue() { _sP++; if (_sP >= _values.getSize()) { - CScValue *val = new CScValue(_gameRef); + ScValue *val = new ScValue(_gameRef); _values.add(val); } _values[_sP]->cleanup(); @@ -95,14 +95,14 @@ CScValue *CScStack::getPushValue() { ////////////////////////////////////////////////////////////////////////// -CScValue *CScStack::getTop() { +ScValue *ScStack::getTop() { if (_sP < 0 || _sP >= _values.getSize()) return NULL; else return _values[_sP]; } ////////////////////////////////////////////////////////////////////////// -CScValue *CScStack::getAt(int index) { +ScValue *ScStack::getAt(int index) { index = _sP - index; if (index < 0 || index >= _values.getSize()) return NULL; else return _values[index]; @@ -110,7 +110,7 @@ CScValue *CScStack::getAt(int index) { ////////////////////////////////////////////////////////////////////////// -void CScStack::correctParams(uint32 expectedParams) { +void ScStack::correctParams(uint32 expectedParams) { uint32 nuParams = (uint32)pop()->getInt(); if (expectedParams < nuParams) { // too many params @@ -124,7 +124,7 @@ void CScStack::correctParams(uint32 expectedParams) { } else if (expectedParams > nuParams) { // need more params while (expectedParams > nuParams) { //Push(null_val); - CScValue *nullVal = new CScValue(_gameRef); + ScValue *nullVal = new ScValue(_gameRef); nullVal->setNULL(); _values.insertAt(_sP - nuParams + 1, nullVal); nuParams++; @@ -140,9 +140,9 @@ void CScStack::correctParams(uint32 expectedParams) { ////////////////////////////////////////////////////////////////////////// -void CScStack::pushNULL() { +void ScStack::pushNULL() { /* - CScValue* val = new CScValue(_gameRef); + ScValue* val = new ScValue(_gameRef); val->setNULL(); Push(val); delete val; @@ -152,9 +152,9 @@ void CScStack::pushNULL() { ////////////////////////////////////////////////////////////////////////// -void CScStack::pushInt(int val) { +void ScStack::pushInt(int val) { /* - CScValue* val = new CScValue(_gameRef); + ScValue* val = new ScValue(_gameRef); val->setInt(Val); Push(val); delete val; @@ -164,9 +164,9 @@ void CScStack::pushInt(int val) { ////////////////////////////////////////////////////////////////////////// -void CScStack::pushFloat(double val) { +void ScStack::pushFloat(double val) { /* - CScValue* val = new CScValue(_gameRef); + ScValue* val = new ScValue(_gameRef); val->setFloat(Val); Push(val); delete val; @@ -176,9 +176,9 @@ void CScStack::pushFloat(double val) { ////////////////////////////////////////////////////////////////////////// -void CScStack::pushBool(bool val) { +void ScStack::pushBool(bool val) { /* - CScValue* val = new CScValue(_gameRef); + ScValue* val = new ScValue(_gameRef); val->setBool(Val); Push(val); delete val; @@ -188,9 +188,9 @@ void CScStack::pushBool(bool val) { ////////////////////////////////////////////////////////////////////////// -void CScStack::pushString(const char *val) { +void ScStack::pushString(const char *val) { /* - CScValue* val = new CScValue(_gameRef); + ScValue* val = new ScValue(_gameRef); val->setString(Val); Push(val); delete val; @@ -200,9 +200,9 @@ void CScStack::pushString(const char *val) { ////////////////////////////////////////////////////////////////////////// -void CScStack::pushNative(CBScriptable *val, bool persistent) { +void ScStack::pushNative(BaseScriptable *val, bool persistent) { /* - CScValue* val = new CScValue(_gameRef); + ScValue* val = new ScValue(_gameRef); val->setNative(Val, Persistent); Push(val); delete val; @@ -213,7 +213,7 @@ void CScStack::pushNative(CBScriptable *val, bool persistent) { ////////////////////////////////////////////////////////////////////////// -bool CScStack::persist(CBPersistMgr *persistMgr) { +bool ScStack::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_gameRef)); diff --git a/engines/wintermute/base/scriptables/script_stack.h b/engines/wintermute/base/scriptables/script_stack.h index 6460f901fe..3aacad0765 100644 --- a/engines/wintermute/base/scriptables/script_stack.h +++ b/engines/wintermute/base/scriptables/script_stack.h @@ -36,27 +36,27 @@ namespace WinterMute { -class CScValue; -class CBScriptable; +class ScValue; +class BaseScriptable; -class CScStack : public CBBase { +class ScStack : public BaseClass { public: - CScValue *getAt(int Index); - CScValue *getPushValue(); - DECLARE_PERSISTENT(CScStack, CBBase) - void pushNative(CBScriptable *val, bool persistent); + ScValue *getAt(int Index); + ScValue *getPushValue(); + DECLARE_PERSISTENT(ScStack, BaseClass) + void pushNative(BaseScriptable *val, bool persistent); void pushString(const char *val); void pushBool(bool val); void pushInt(int val); void pushFloat(double val); void pushNULL(); void correctParams(uint32 expectedParams); - CScValue *getTop(); - void push(CScValue *val); - CScValue *pop(); - CScStack(CBGame *inGame); - virtual ~CScStack(); - CBArray _values; + ScValue *getTop(); + void push(ScValue *val); + ScValue *pop(); + ScStack(BaseGame *inGame); + virtual ~ScStack(); + BaseArray _values; int _sP; }; diff --git a/engines/wintermute/base/scriptables/script_value.cpp b/engines/wintermute/base/scriptables/script_value.cpp index da47ed299f..0d8c34e719 100644 --- a/engines/wintermute/base/scriptables/script_value.cpp +++ b/engines/wintermute/base/scriptables/script_value.cpp @@ -40,10 +40,10 @@ namespace WinterMute { // Construction/Destruction ////////////////////////////////////////////////////////////////////// -IMPLEMENT_PERSISTENT(CScValue, false) +IMPLEMENT_PERSISTENT(ScValue, false) ////////////////////////////////////////////////////////////////////////// -CScValue::CScValue(CBGame *inGame): CBBase(inGame) { +ScValue::ScValue(BaseGame *inGame): BaseClass(inGame) { _type = VAL_NULL; _valBool = false; @@ -58,7 +58,7 @@ CScValue::CScValue(CBGame *inGame): CBBase(inGame) { ////////////////////////////////////////////////////////////////////////// -CScValue::CScValue(CBGame *inGame, bool val): CBBase(inGame) { +ScValue::ScValue(BaseGame *inGame, bool val): BaseClass(inGame) { _type = VAL_BOOL; _valBool = val; @@ -73,7 +73,7 @@ CScValue::CScValue(CBGame *inGame, bool val): CBBase(inGame) { ////////////////////////////////////////////////////////////////////////// -CScValue::CScValue(CBGame *inGame, int val): CBBase(inGame) { +ScValue::ScValue(BaseGame *inGame, int val): BaseClass(inGame) { _type = VAL_INT; _valInt = val; @@ -88,7 +88,7 @@ CScValue::CScValue(CBGame *inGame, int val): CBBase(inGame) { ////////////////////////////////////////////////////////////////////////// -CScValue::CScValue(CBGame *inGame, double val): CBBase(inGame) { +ScValue::ScValue(BaseGame *inGame, double val): BaseClass(inGame) { _type = VAL_FLOAT; _valFloat = val; @@ -103,7 +103,7 @@ CScValue::CScValue(CBGame *inGame, double val): CBBase(inGame) { ////////////////////////////////////////////////////////////////////////// -CScValue::CScValue(CBGame *inGame, const char *val): CBBase(inGame) { +ScValue::ScValue(BaseGame *inGame, const char *val): BaseClass(inGame) { _type = VAL_STRING; _valString = NULL; setStringVal(val); @@ -119,7 +119,7 @@ CScValue::CScValue(CBGame *inGame, const char *val): CBBase(inGame) { ////////////////////////////////////////////////////////////////////////// -void CScValue::cleanup(bool ignoreNatives) { +void ScValue::cleanup(bool ignoreNatives) { deleteProps(); if (_valString) delete [] _valString; @@ -150,13 +150,13 @@ void CScValue::cleanup(bool ignoreNatives) { ////////////////////////////////////////////////////////////////////////// -CScValue::~CScValue() { +ScValue::~ScValue() { cleanup(); } ////////////////////////////////////////////////////////////////////////// -CScValue *CScValue::getProp(const char *name) { +ScValue *ScValue::getProp(const char *name) { if (_type == VAL_VARIABLE_REF) return _valRef->getProp(name); if (_type == VAL_STRING && strcmp(name, "Length") == 0) { @@ -176,7 +176,7 @@ CScValue *CScValue::getProp(const char *name) { return _gameRef->_scValue; } - CScValue *ret = NULL; + ScValue *ret = NULL; if (_type == VAL_NATIVE && _valNative) ret = _valNative->scGetProperty(name); @@ -188,7 +188,7 @@ CScValue *CScValue::getProp(const char *name) { } ////////////////////////////////////////////////////////////////////////// -bool CScValue::deleteProp(const char *name) { +bool ScValue::deleteProp(const char *name) { if (_type == VAL_VARIABLE_REF) return _valRef->deleteProp(name); _valIter = _valObject.find(name); @@ -203,7 +203,7 @@ bool CScValue::deleteProp(const char *name) { ////////////////////////////////////////////////////////////////////////// -bool CScValue::setProp(const char *name, CScValue *val, bool copyWhole, bool setAsConst) { +bool ScValue::setProp(const char *name, ScValue *val, bool copyWhole, bool setAsConst) { if (_type == VAL_VARIABLE_REF) return _valRef->setProp(name, val); @@ -213,14 +213,14 @@ bool CScValue::setProp(const char *name, CScValue *val, bool copyWhole, bool set } if (DID_FAIL(ret)) { - CScValue *newVal = NULL; + ScValue *newVal = NULL; _valIter = _valObject.find(name); if (_valIter != _valObject.end()) { newVal = _valIter->_value; } if (!newVal) - newVal = new CScValue(_gameRef); + newVal = new ScValue(_gameRef); else newVal->cleanup(); newVal->copy(val, copyWhole); @@ -235,7 +235,7 @@ bool CScValue::setProp(const char *name, CScValue *val, bool copyWhole, bool set delete _valIter->_value; _valIter->_value = NULL; } - CScValue* val = new CScValue(_gameRef); + ScValue* val = new ScValue(_gameRef); val->Copy(Val, CopyWhole); val->_isConstVar = SetAsConst; _valObject[Name] = val; @@ -249,7 +249,7 @@ bool CScValue::setProp(const char *name, CScValue *val, bool copyWhole, bool set ////////////////////////////////////////////////////////////////////////// -bool CScValue::propExists(const char *name) { +bool ScValue::propExists(const char *name) { if (_type == VAL_VARIABLE_REF) return _valRef->propExists(name); _valIter = _valObject.find(name); @@ -259,10 +259,10 @@ bool CScValue::propExists(const char *name) { ////////////////////////////////////////////////////////////////////////// -void CScValue::deleteProps() { +void ScValue::deleteProps() { _valIter = _valObject.begin(); while (_valIter != _valObject.end()) { - delete(CScValue *)_valIter->_value; + delete(ScValue *)_valIter->_value; _valIter++; } _valObject.clear(); @@ -270,7 +270,7 @@ void CScValue::deleteProps() { ////////////////////////////////////////////////////////////////////////// -void CScValue::CleanProps(bool includingNatives) { +void ScValue::CleanProps(bool includingNatives) { _valIter = _valObject.begin(); while (_valIter != _valObject.end()) { if (!_valIter->_value->_isConstVar && (!_valIter->_value->isNative() || includingNatives)) _valIter->_value->setNULL(); @@ -279,7 +279,7 @@ void CScValue::CleanProps(bool includingNatives) { } ////////////////////////////////////////////////////////////////////////// -bool CScValue::isNULL() { +bool ScValue::isNULL() { if (_type == VAL_VARIABLE_REF) return _valRef->isNULL(); @@ -288,7 +288,7 @@ bool CScValue::isNULL() { ////////////////////////////////////////////////////////////////////////// -bool CScValue::isNative() { +bool ScValue::isNative() { if (_type == VAL_VARIABLE_REF) return _valRef->isNative(); @@ -297,7 +297,7 @@ bool CScValue::isNative() { ////////////////////////////////////////////////////////////////////////// -bool CScValue::isString() { +bool ScValue::isString() { if (_type == VAL_VARIABLE_REF) return _valRef->isString(); @@ -306,7 +306,7 @@ bool CScValue::isString() { ////////////////////////////////////////////////////////////////////////// -bool CScValue::isFloat() { +bool ScValue::isFloat() { if (_type == VAL_VARIABLE_REF) return _valRef->isFloat(); @@ -315,7 +315,7 @@ bool CScValue::isFloat() { ////////////////////////////////////////////////////////////////////////// -bool CScValue::isInt() { +bool ScValue::isInt() { if (_type == VAL_VARIABLE_REF) return _valRef->isInt(); @@ -324,7 +324,7 @@ bool CScValue::isInt() { ////////////////////////////////////////////////////////////////////////// -bool CScValue::isBool() { +bool ScValue::isBool() { if (_type == VAL_VARIABLE_REF) return _valRef->isBool(); @@ -333,7 +333,7 @@ bool CScValue::isBool() { ////////////////////////////////////////////////////////////////////////// -bool CScValue::isObject() { +bool ScValue::isObject() { if (_type == VAL_VARIABLE_REF) return _valRef->isObject(); @@ -342,7 +342,7 @@ bool CScValue::isObject() { ////////////////////////////////////////////////////////////////////////// -TValType CScValue::getTypeTolerant() { +TValType ScValue::getTypeTolerant() { if (_type == VAL_VARIABLE_REF) return _valRef->getType(); @@ -351,7 +351,7 @@ TValType CScValue::getTypeTolerant() { ////////////////////////////////////////////////////////////////////////// -void CScValue::setBool(bool val) { +void ScValue::setBool(bool val) { if (_type == VAL_VARIABLE_REF) { _valRef->setBool(val); return; @@ -368,7 +368,7 @@ void CScValue::setBool(bool val) { ////////////////////////////////////////////////////////////////////////// -void CScValue::setInt(int val) { +void ScValue::setInt(int val) { if (_type == VAL_VARIABLE_REF) { _valRef->setInt(val); return; @@ -385,7 +385,7 @@ void CScValue::setInt(int val) { ////////////////////////////////////////////////////////////////////////// -void CScValue::setFloat(double val) { +void ScValue::setFloat(double val) { if (_type == VAL_VARIABLE_REF) { _valRef->setFloat(val); return; @@ -402,7 +402,7 @@ void CScValue::setFloat(double val) { ////////////////////////////////////////////////////////////////////////// -void CScValue::setString(const char *val) { +void ScValue::setString(const char *val) { if (_type == VAL_VARIABLE_REF) { _valRef->setString(val); return; @@ -418,12 +418,12 @@ void CScValue::setString(const char *val) { else _type = VAL_NULL; } -void CScValue::setString(const Common::String &val) { +void ScValue::setString(const Common::String &val) { setString(val.c_str()); } ////////////////////////////////////////////////////////////////////////// -void CScValue::setStringVal(const char *val) { +void ScValue::setStringVal(const char *val) { if (_valString) { delete [] _valString; _valString = NULL; @@ -442,7 +442,7 @@ void CScValue::setStringVal(const char *val) { ////////////////////////////////////////////////////////////////////////// -void CScValue::setNULL() { +void ScValue::setNULL() { if (_type == VAL_VARIABLE_REF) { _valRef->setNULL(); return; @@ -460,7 +460,7 @@ void CScValue::setNULL() { ////////////////////////////////////////////////////////////////////////// -void CScValue::setNative(CBScriptable *val, bool persistent) { +void ScValue::setNative(BaseScriptable *val, bool persistent) { if (_type == VAL_VARIABLE_REF) { _valRef->setNative(val, persistent); return; @@ -487,7 +487,7 @@ void CScValue::setNative(CBScriptable *val, bool persistent) { ////////////////////////////////////////////////////////////////////////// -void CScValue::setObject() { +void ScValue::setObject() { if (_type == VAL_VARIABLE_REF) { _valRef->setObject(); return; @@ -499,14 +499,14 @@ void CScValue::setObject() { ////////////////////////////////////////////////////////////////////////// -void CScValue::setReference(CScValue *val) { +void ScValue::setReference(ScValue *val) { _valRef = val; _type = VAL_VARIABLE_REF; } ////////////////////////////////////////////////////////////////////////// -bool CScValue::getBool(bool defaultVal) { +bool ScValue::getBool(bool defaultVal) { if (_type == VAL_VARIABLE_REF) return _valRef->getBool(); @@ -533,7 +533,7 @@ bool CScValue::getBool(bool defaultVal) { ////////////////////////////////////////////////////////////////////////// -int CScValue::getInt(int defaultVal) { +int ScValue::getInt(int defaultVal) { if (_type == VAL_VARIABLE_REF) return _valRef->getInt(); switch (_type) { @@ -559,7 +559,7 @@ int CScValue::getInt(int defaultVal) { ////////////////////////////////////////////////////////////////////////// -double CScValue::getFloat(double defaultVal) { +double ScValue::getFloat(double defaultVal) { if (_type == VAL_VARIABLE_REF) return _valRef->getFloat(); @@ -585,7 +585,7 @@ double CScValue::getFloat(double defaultVal) { } ////////////////////////////////////////////////////////////////////////// -void *CScValue::getMemBuffer() { +void *ScValue::getMemBuffer() { if (_type == VAL_VARIABLE_REF) return _valRef->getMemBuffer(); @@ -596,7 +596,7 @@ void *CScValue::getMemBuffer() { ////////////////////////////////////////////////////////////////////////// -const char *CScValue::getString() { +const char *ScValue::getString() { if (_type == VAL_VARIABLE_REF) return _valRef->getString(); @@ -646,7 +646,7 @@ const char *CScValue::getString() { ////////////////////////////////////////////////////////////////////////// -CBScriptable *CScValue::getNative() { +BaseScriptable *ScValue::getNative() { if (_type == VAL_VARIABLE_REF) return _valRef->getNative(); @@ -656,13 +656,13 @@ CBScriptable *CScValue::getNative() { ////////////////////////////////////////////////////////////////////////// -TValType CScValue::getType() { +TValType ScValue::getType() { return _type; } ////////////////////////////////////////////////////////////////////////// -void CScValue::copy(CScValue *orig, bool copyWhole) { +void ScValue::copy(ScValue *orig, bool copyWhole) { _gameRef = orig->_gameRef; if (_valNative && !_persistent) { @@ -694,7 +694,7 @@ void CScValue::copy(CScValue *orig, bool copyWhole) { if (orig->_type == VAL_OBJECT && orig->_valObject.size() > 0) { orig->_valIter = orig->_valObject.begin(); while (orig->_valIter != orig->_valObject.end()) { - _valObject[orig->_valIter->_key] = new CScValue(_gameRef); + _valObject[orig->_valIter->_key] = new ScValue(_gameRef); _valObject[orig->_valIter->_key]->copy(orig->_valIter->_value); orig->_valIter++; } @@ -703,7 +703,7 @@ void CScValue::copy(CScValue *orig, bool copyWhole) { ////////////////////////////////////////////////////////////////////////// -void CScValue::setValue(CScValue *val) { +void ScValue::setValue(ScValue *val) { if (val->_type == VAL_VARIABLE_REF) { setValue(val->_valRef); return; @@ -725,7 +725,7 @@ void CScValue::setValue(CScValue *val) { _valNative->scSetString(val->getString()); break; default: - warning("CScValue::setValue - unhandled enum"); + warning("ScValue::setValue - unhandled enum"); break; } } @@ -735,7 +735,7 @@ void CScValue::setValue(CScValue *val) { ////////////////////////////////////////////////////////////////////////// -bool CScValue::persist(CBPersistMgr *persistMgr) { +bool ScValue::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_gameRef)); persistMgr->transfer(TMEMBER(_persistent)); @@ -760,7 +760,7 @@ bool CScValue::persist(CBPersistMgr *persistMgr) { _valIter++; } } else { - CScValue *val; + ScValue *val; persistMgr->transfer("", &size); for (int i = 0; i < size; i++) { persistMgr->transfer("", &str); @@ -819,7 +819,7 @@ bool CScValue::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -bool CScValue::saveAsText(CBDynBuffer *buffer, int indent) { +bool ScValue::saveAsText(BaseDynamicBuffer *buffer, int indent) { _valIter = _valObject.begin(); while (_valIter != _valObject.end()) { buffer->putTextIndent(indent, "PROPERTY {\n"); @@ -835,7 +835,7 @@ bool CScValue::saveAsText(CBDynBuffer *buffer, int indent) { ////////////////////////////////////////////////////////////////////////// // -1 ... left is less, 0 ... equals, 1 ... left is greater -int CScValue::compare(CScValue *val1, CScValue *val2) { +int ScValue::compare(ScValue *val1, ScValue *val2) { // both natives? if (val1->isNative() && val2->isNative()) { // same class? @@ -871,14 +871,14 @@ int CScValue::compare(CScValue *val1, CScValue *val2) { ////////////////////////////////////////////////////////////////////////// -int CScValue::compareStrict(CScValue *val1, CScValue *val2) { +int ScValue::compareStrict(ScValue *val1, ScValue *val2) { if (val1->getTypeTolerant() != val2->getTypeTolerant()) return -1; - else return CScValue::compare(val1, val2); + else return ScValue::compare(val1, val2); } ////////////////////////////////////////////////////////////////////////// -bool CScValue::dbgSendVariables(IWmeDebugClient *client, EWmeDebuggerVariableType type, CScScript *script, unsigned int scopeID) { +bool ScValue::dbgSendVariables(IWmeDebugClient *client, EWmeDebuggerVariableType type, ScScript *script, unsigned int scopeID) { _valIter = _valObject.begin(); while (_valIter != _valObject.end()) { client->onVariableInit(type, script, scopeID, _valIter->_value, _valIter->_key.c_str()); @@ -889,24 +889,24 @@ bool CScValue::dbgSendVariables(IWmeDebugClient *client, EWmeDebuggerVariableTyp ////////////////////////////////////////////////////////////////////////// -bool CScValue::setProperty(const char *propName, int value) { - CScValue *val = new CScValue(_gameRef, value); +bool ScValue::setProperty(const char *propName, int value) { + ScValue *val = new ScValue(_gameRef, value); bool ret = DID_SUCCEED(setProp(propName, val)); delete val; return ret; } ////////////////////////////////////////////////////////////////////////// -bool CScValue::setProperty(const char *propName, const char *value) { - CScValue *val = new CScValue(_gameRef, value); +bool ScValue::setProperty(const char *propName, const char *value) { + ScValue *val = new ScValue(_gameRef, value); bool ret = DID_SUCCEED(setProp(propName, val)); delete val; return ret; } ////////////////////////////////////////////////////////////////////////// -bool CScValue::setProperty(const char *propName, double value) { - CScValue *val = new CScValue(_gameRef, value); +bool ScValue::setProperty(const char *propName, double value) { + ScValue *val = new ScValue(_gameRef, value); bool ret = DID_SUCCEED(setProp(propName, val)); delete val; return ret; @@ -914,8 +914,8 @@ bool CScValue::setProperty(const char *propName, double value) { ////////////////////////////////////////////////////////////////////////// -bool CScValue::setProperty(const char *propName, bool value) { - CScValue *val = new CScValue(_gameRef, value); +bool ScValue::setProperty(const char *propName, bool value) { + ScValue *val = new ScValue(_gameRef, value); bool ret = DID_SUCCEED(setProp(propName, val)); delete val; return ret; @@ -923,8 +923,8 @@ bool CScValue::setProperty(const char *propName, bool value) { ////////////////////////////////////////////////////////////////////////// -bool CScValue::setProperty(const char *propName) { - CScValue *val = new CScValue(_gameRef); +bool ScValue::setProperty(const char *propName) { + ScValue *val = new ScValue(_gameRef); bool ret = DID_SUCCEED(setProp(propName, val)); delete val; return ret; @@ -934,7 +934,7 @@ bool CScValue::setProperty(const char *propName) { ////////////////////////////////////////////////////////////////////////// // IWmeDebugProp ////////////////////////////////////////////////////////////////////////// -EWmeDebuggerPropType CScValue::dbgGetType() { +EWmeDebuggerPropType ScValue::dbgGetType() { switch (getType()) { case VAL_NULL: return WME_DBGPROP_NULL; @@ -956,70 +956,70 @@ EWmeDebuggerPropType CScValue::dbgGetType() { } ////////////////////////////////////////////////////////////////////////// -int CScValue::dbgGetValInt() { +int ScValue::dbgGetValInt() { return getInt(); } ////////////////////////////////////////////////////////////////////////// -double CScValue::dbgGetValFloat() { +double ScValue::dbgGetValFloat() { return getFloat(); } ////////////////////////////////////////////////////////////////////////// -bool CScValue::dbgGetValBool() { +bool ScValue::dbgGetValBool() { return getBool(); } ////////////////////////////////////////////////////////////////////////// -const char *CScValue::dbgGetValString() { +const char *ScValue::dbgGetValString() { return getString(); } ////////////////////////////////////////////////////////////////////////// -IWmeDebugObject *CScValue::dbgGetValNative() { +IWmeDebugObject *ScValue::dbgGetValNative() { return getNative(); } ////////////////////////////////////////////////////////////////////////// -bool CScValue::dbgSetVal(int value) { +bool ScValue::dbgSetVal(int value) { setInt(value); return true; } ////////////////////////////////////////////////////////////////////////// -bool CScValue::dbgSetVal(double value) { +bool ScValue::dbgSetVal(double value) { setFloat(value); return true; } ////////////////////////////////////////////////////////////////////////// -bool CScValue::dbgSetVal(bool value) { +bool ScValue::dbgSetVal(bool value) { setBool(value); return true; } ////////////////////////////////////////////////////////////////////////// -bool CScValue::dbgSetVal(const char *value) { +bool ScValue::dbgSetVal(const char *value) { setString(value); return true; } ////////////////////////////////////////////////////////////////////////// -bool CScValue::dbgSetVal() { +bool ScValue::dbgSetVal() { setNULL(); return true; } ////////////////////////////////////////////////////////////////////////// -int CScValue::dbgGetNumProperties() { +int ScValue::dbgGetNumProperties() { if (_valNative && _valNative->_scProp) return _valNative->_scProp->dbgGetNumProperties(); else return _valObject.size(); } ////////////////////////////////////////////////////////////////////////// -bool CScValue::dbgGetProperty(int index, const char **name, IWmeDebugProp **value) { +bool ScValue::dbgGetProperty(int index, const char **name, IWmeDebugProp **value) { if (_valNative && _valNative->_scProp) return _valNative->_scProp->dbgGetProperty(index, name, value); else { @@ -1039,7 +1039,7 @@ bool CScValue::dbgGetProperty(int index, const char **name, IWmeDebugProp **valu } ////////////////////////////////////////////////////////////////////////// -bool CScValue::dbgGetDescription(char *buf, int bufSize) { +bool ScValue::dbgGetDescription(char *buf, int bufSize) { if (_type == VAL_VARIABLE_REF) return _valRef->dbgGetDescription(buf, bufSize); diff --git a/engines/wintermute/base/scriptables/script_value.h b/engines/wintermute/base/scriptables/script_value.h index eaee3ed773..7a684d2334 100644 --- a/engines/wintermute/base/scriptables/script_value.h +++ b/engines/wintermute/base/scriptables/script_value.h @@ -38,25 +38,25 @@ namespace WinterMute { -class CScScript; -class CBScriptable; +class ScScript; +class BaseScriptable; -class CScValue : public CBBase, public IWmeDebugProp { +class ScValue : public BaseClass, public IWmeDebugProp { public: - bool dbgSendVariables(IWmeDebugClient *client, EWmeDebuggerVariableType type, CScScript *script, unsigned int scopeID); + bool dbgSendVariables(IWmeDebugClient *client, EWmeDebuggerVariableType type, ScScript *script, unsigned int scopeID); - static int compare(CScValue *val1, CScValue *val2); - static int compareStrict(CScValue *val1, CScValue *val2); + static int compare(ScValue *val1, ScValue *val2); + static int compareStrict(ScValue *val1, ScValue *val2); TValType getTypeTolerant(); void cleanup(bool ignoreNatives = false); - DECLARE_PERSISTENT(CScValue, CBBase) + DECLARE_PERSISTENT(ScValue, BaseClass) bool _isConstVar; - bool saveAsText(CBDynBuffer *buffer, int indent); - void setValue(CScValue *val); + bool saveAsText(BaseDynamicBuffer *buffer, int indent); + void setValue(ScValue *val); bool _persistent; bool propExists(const char *name); - void copy(CScValue *orig, bool copyWhole = false); + void copy(ScValue *orig, bool copyWhole = false); void setStringVal(const char *val); TValType getType(); bool getBool(bool defaultVal = false); @@ -64,7 +64,7 @@ public: double getFloat(double defaultVal = 0.0f); const char *getString(); void *getMemBuffer(); - CBScriptable *getNative(); + BaseScriptable *getNative(); bool deleteProp(const char *name); void deleteProps(); void CleanProps(bool includingNatives); @@ -74,9 +74,9 @@ public: void setString(const char *val); void setString(const Common::String &val); void setNULL(); - void setNative(CBScriptable *val, bool persistent = false); + void setNative(BaseScriptable *val, bool persistent = false); void setObject(); - void setReference(CScValue *val); + void setReference(ScValue *val); bool isNULL(); bool isNative(); bool isString(); @@ -84,10 +84,10 @@ public: bool isFloat(); bool isInt(); bool isObject(); - bool setProp(const char *name, CScValue *val, bool copyWhole = false, bool setAsConst = false); - CScValue *getProp(const char *name); - CBScriptable *_valNative; - CScValue *_valRef; + bool setProp(const char *name, ScValue *val, bool copyWhole = false, bool setAsConst = false); + ScValue *getProp(const char *name); + BaseScriptable *_valNative; + ScValue *_valRef; protected: bool _valBool; int _valInt; @@ -95,14 +95,14 @@ protected: char *_valString; public: TValType _type; - CScValue(CBGame *inGame); - CScValue(CBGame *inGame, bool Val); - CScValue(CBGame *inGame, int Val); - CScValue(CBGame *inGame, double Val); - CScValue(CBGame *inGame, const char *Val); - virtual ~CScValue(); - Common::HashMap _valObject; - Common::HashMap::iterator _valIter; + ScValue(BaseGame *inGame); + ScValue(BaseGame *inGame, bool Val); + ScValue(BaseGame *inGame, int Val); + ScValue(BaseGame *inGame, double Val); + ScValue(BaseGame *inGame, const char *Val); + virtual ~ScValue(); + Common::HashMap _valObject; + Common::HashMap::iterator _valIter; bool setProperty(const char *propName, int value); bool setProperty(const char *propName, const char *value); diff --git a/engines/wintermute/base/sound/base_sound.cpp b/engines/wintermute/base/sound/base_sound.cpp index e1819e3c65..06421e8632 100644 --- a/engines/wintermute/base/sound/base_sound.cpp +++ b/engines/wintermute/base/sound/base_sound.cpp @@ -33,10 +33,10 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CBSound, false) +IMPLEMENT_PERSISTENT(BaseSound, false) ////////////////////////////////////////////////////////////////////////// -CBSound::CBSound(CBGame *inGame): CBBase(inGame) { +BaseSound::BaseSound(BaseGame *inGame): BaseClass(inGame) { _sound = NULL; _soundFilename = NULL; @@ -56,7 +56,7 @@ CBSound::CBSound(CBGame *inGame): CBBase(inGame) { ////////////////////////////////////////////////////////////////////////// -CBSound::~CBSound() { +BaseSound::~BaseSound() { if (_sound) _gameRef->_soundMgr->removeSound(_sound); _sound = NULL; @@ -66,7 +66,7 @@ CBSound::~CBSound() { ////////////////////////////////////////////////////////////////////////// -bool CBSound::setSound(const char *filename, Audio::Mixer::SoundType type, bool streamed) { +bool BaseSound::setSound(const char *filename, Audio::Mixer::SoundType type, bool streamed) { if (_sound) { _gameRef->_soundMgr->removeSound(_sound); _sound = NULL; @@ -88,7 +88,7 @@ bool CBSound::setSound(const char *filename, Audio::Mixer::SoundType type, bool ////////////////////////////////////////////////////////////////////////// -bool CBSound::setSoundSimple() { +bool BaseSound::setSoundSimple() { _sound = _gameRef->_soundMgr->addSound(_soundFilename, _soundType, _soundStreamed); if (_sound) { if (_soundPosition) _sound->setPosition(_soundPosition); @@ -104,14 +104,14 @@ bool CBSound::setSoundSimple() { ////////////////////////////////////////////////////////////////////////// -uint32 CBSound::getLength() { +uint32 BaseSound::getLength() { if (_sound) return _sound->getLength(); else return 0; } ////////////////////////////////////////////////////////////////////////// -bool CBSound::play(bool looping) { +bool BaseSound::play(bool looping) { if (_sound) { _soundPaused = false; return _sound->play(looping, _soundPosition); @@ -120,7 +120,7 @@ bool CBSound::play(bool looping) { ////////////////////////////////////////////////////////////////////////// -bool CBSound::stop() { +bool BaseSound::stop() { if (_sound) { _soundPaused = false; return _sound->stop(); @@ -129,7 +129,7 @@ bool CBSound::stop() { ////////////////////////////////////////////////////////////////////////// -bool CBSound::pause(bool freezePaused) { +bool BaseSound::pause(bool freezePaused) { if (_sound) { _soundPaused = true; if (freezePaused) _sound->_freezePaused = true; @@ -139,7 +139,7 @@ bool CBSound::pause(bool freezePaused) { ////////////////////////////////////////////////////////////////////////// -bool CBSound::resume() { +bool BaseSound::resume() { if (_sound && _soundPaused) { _soundPaused = false; return _sound->resume(); @@ -148,7 +148,7 @@ bool CBSound::resume() { ////////////////////////////////////////////////////////////////////////// -bool CBSound::persist(CBPersistMgr *persistMgr) { +bool BaseSound::persist(BasePersistenceManager *persistMgr) { if (persistMgr->_saving && _sound) { _soundPlaying = _sound->isPlaying(); _soundLooping = _sound->_looping; @@ -182,19 +182,19 @@ bool CBSound::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -bool CBSound::isPlaying() { +bool BaseSound::isPlaying() { return _sound && _sound->isPlaying(); } ////////////////////////////////////////////////////////////////////////// -bool CBSound::isPaused() { +bool BaseSound::isPaused() { return _sound && _soundPaused; } ////////////////////////////////////////////////////////////////////////// -bool CBSound::setPositionTime(uint32 time) { +bool BaseSound::setPositionTime(uint32 time) { if (!_sound) return STATUS_FAILED; _soundPosition = time; bool ret = _sound->setPosition(_soundPosition); @@ -205,7 +205,7 @@ bool CBSound::setPositionTime(uint32 time) { ////////////////////////////////////////////////////////////////////////// -uint32 CBSound::getPositionTime() { +uint32 BaseSound::getPositionTime() { if (!_sound) return 0; if (!_sound->isPlaying()) @@ -214,42 +214,42 @@ uint32 CBSound::getPositionTime() { } ////////////////////////////////////////////////////////////////////////// -bool CBSound::setVolumePercent(int percent) { +bool BaseSound::setVolumePercent(int percent) { if (!_sound) return STATUS_FAILED; else return _sound->setPrivateVolume(percent * 255 / 100); } ////////////////////////////////////////////////////////////////////////// -bool CBSound::setVolume(int volume) { +bool BaseSound::setVolume(int volume) { if (!_sound) return STATUS_FAILED; else return _sound->setPrivateVolume(volume); } ////////////////////////////////////////////////////////////////////////// -bool CBSound::setPrivateVolume(int volume) { +bool BaseSound::setPrivateVolume(int volume) { if (!_sound) return STATUS_FAILED; else return _sound->_privateVolume = volume; } ////////////////////////////////////////////////////////////////////////// -int CBSound::getVolumePercent() { +int BaseSound::getVolumePercent() { if (!_sound) return 0; else return _sound->_privateVolume * 100 / 255; } ////////////////////////////////////////////////////////////////////////// -int CBSound::getVolume() { +int BaseSound::getVolume() { if (!_sound) return 0; else return _sound->_privateVolume; } ////////////////////////////////////////////////////////////////////////// -bool CBSound::setLoopStart(uint32 pos) { +bool BaseSound::setLoopStart(uint32 pos) { if (!_sound) return STATUS_FAILED; else { @@ -259,7 +259,7 @@ bool CBSound::setLoopStart(uint32 pos) { } ////////////////////////////////////////////////////////////////////////// -bool CBSound::setPan(float pan) { +bool BaseSound::setPan(float pan) { if (_sound) return _sound->setPan(pan); else return STATUS_FAILED; @@ -267,7 +267,7 @@ bool CBSound::setPan(float pan) { ////////////////////////////////////////////////////////////////////////// -bool CBSound::ApplyFX(TSFXType type, float param1, float param2, float param3, float param4) { +bool BaseSound::ApplyFX(TSFXType type, float param1, float param2, float param3, float param4) { if (!_sound) return STATUS_OK; diff --git a/engines/wintermute/base/sound/base_sound.h b/engines/wintermute/base/sound/base_sound.h index ef52194090..0b033de47d 100644 --- a/engines/wintermute/base/sound/base_sound.h +++ b/engines/wintermute/base/sound/base_sound.h @@ -36,8 +36,8 @@ namespace WinterMute { -class CBSoundBuffer; -class CBSound : public CBBase { +class BaseSoundBuffer; +class BaseSound : public BaseClass { public: bool setPan(float pan); int _soundPrivateVolume; @@ -57,7 +57,7 @@ public: bool _soundLooping; uint32 _soundLoopStart; uint32 _soundPosition; - DECLARE_PERSISTENT(CBSound, CBBase) + DECLARE_PERSISTENT(BaseSound, BaseClass) bool resume(); bool pause(bool freezePaused = false); bool stop(); @@ -68,8 +68,8 @@ public: char *_soundFilename; bool setSoundSimple(); bool setSound(const char *filename, Audio::Mixer::SoundType type = Audio::Mixer::kSFXSoundType, bool streamed = false); - CBSound(CBGame *inGame); - virtual ~CBSound(); + BaseSound(BaseGame *inGame); + virtual ~BaseSound(); bool ApplyFX(TSFXType type = SFX_NONE, float param1 = 0, float param2 = 0, float param3 = 0, float param4 = 0); @@ -79,7 +79,7 @@ private: float _sFXParam2; float _sFXParam3; float _sFXParam4; - CBSoundBuffer *_sound; + BaseSoundBuffer *_sound; }; diff --git a/engines/wintermute/base/sound/base_sound_buffer.cpp b/engines/wintermute/base/sound/base_sound_buffer.cpp index a868f99823..b8c19c2985 100644 --- a/engines/wintermute/base/sound/base_sound_buffer.cpp +++ b/engines/wintermute/base/sound/base_sound_buffer.cpp @@ -50,7 +50,7 @@ namespace WinterMute { #define MAX_NONSTREAMED_FILE_SIZE 1024*1024 ////////////////////////////////////////////////////////////////////////// -CBSoundBuffer::CBSoundBuffer(CBGame *inGame): CBBase(inGame) { +BaseSoundBuffer::BaseSoundBuffer(BaseGame *inGame): BaseClass(inGame) { _stream = NULL; _handle = NULL; // _sync = NULL; @@ -71,7 +71,7 @@ CBSoundBuffer::CBSoundBuffer(CBGame *inGame): CBBase(inGame) { ////////////////////////////////////////////////////////////////////////// -CBSoundBuffer::~CBSoundBuffer() { +BaseSoundBuffer::~BaseSoundBuffer() { stop(); if (_handle) { @@ -88,13 +88,13 @@ CBSoundBuffer::~CBSoundBuffer() { ////////////////////////////////////////////////////////////////////////// -void CBSoundBuffer::setStreaming(bool Streamed, uint32 NumBlocks, uint32 BlockSize) { +void BaseSoundBuffer::setStreaming(bool Streamed, uint32 NumBlocks, uint32 BlockSize) { _streamed = Streamed; } ////////////////////////////////////////////////////////////////////////// -bool CBSoundBuffer::loadFromFile(const char *filename, bool forceReload) { +bool BaseSoundBuffer::loadFromFile(const char *filename, bool forceReload) { warning("BSoundBuffer::LoadFromFile(%s,%d)", filename, forceReload); #if 0 if (_stream) { @@ -132,15 +132,15 @@ bool CBSoundBuffer::loadFromFile(const char *filename, bool forceReload) { if (!_stream) { return STATUS_FAILED; } - CBUtils::setString(&_filename, filename); + BaseUtils::setString(&_filename, filename); return STATUS_OK; #if 0 BASS_FILEPROCS fileProc; - fileProc.close = CBSoundBuffer::FileCloseProc; - fileProc.read = CBSoundBuffer::FileReadProc; - fileProc.seek = CBSoundBuffer::FileSeekProc; - fileProc.length = CBSoundBuffer::FileLenProc; + fileProc.close = BaseSoundBuffer::FileCloseProc; + fileProc.read = BaseSoundBuffer::FileReadProc; + fileProc.seek = BaseSoundBuffer::FileSeekProc; + fileProc.length = BaseSoundBuffer::FileLenProc; _stream = BASS_StreamCreateFileUser(STREAMFILE_NOBUFFER, 0, &fileProc, (void *)_file); if (!_stream) { @@ -148,7 +148,7 @@ bool CBSoundBuffer::loadFromFile(const char *filename, bool forceReload) { return STATUS_FAILED; } - CBUtils::setString(&_filename, filename); + BaseUtils::setString(&_filename, filename); /* bool res; @@ -196,7 +196,7 @@ bool CBSoundBuffer::loadFromFile(const char *filename, bool forceReload) { ////////////////////////////////////////////////////////////////////////// -bool CBSoundBuffer::play(bool looping, uint32 startSample) { +bool BaseSoundBuffer::play(bool looping, uint32 startSample) { if (startSample != 0) { warning("BSoundBuffer::Play - Should start playback at %d, but currently we don't", startSample); } @@ -220,7 +220,7 @@ bool CBSoundBuffer::play(bool looping, uint32 startSample) { } ////////////////////////////////////////////////////////////////////////// -void CBSoundBuffer::setLooping(bool looping) { +void BaseSoundBuffer::setLooping(bool looping) { warning("BSoundBuffer::SetLooping(%d) - won't change a playing sound", looping); _looping = looping; #if 0 @@ -233,7 +233,7 @@ void CBSoundBuffer::setLooping(bool looping) { } ////////////////////////////////////////////////////////////////////////// -bool CBSoundBuffer::resume() { +bool BaseSoundBuffer::resume() { if (_stream && _handle) { g_system->getMixer()->pauseHandle(*_handle, false); } @@ -242,7 +242,7 @@ bool CBSoundBuffer::resume() { ////////////////////////////////////////////////////////////////////////// -bool CBSoundBuffer::stop() { +bool BaseSoundBuffer::stop() { if (_stream && _handle) { g_system->getMixer()->stopHandle(*_handle); } @@ -251,7 +251,7 @@ bool CBSoundBuffer::stop() { ////////////////////////////////////////////////////////////////////////// -bool CBSoundBuffer::pause() { +bool BaseSoundBuffer::pause() { if (_stream && _handle) { g_system->getMixer()->pauseHandle(*_handle, true); } @@ -260,7 +260,7 @@ bool CBSoundBuffer::pause() { } ////////////////////////////////////////////////////////////////////////// -uint32 CBSoundBuffer::getLength() { +uint32 BaseSoundBuffer::getLength() { if (_stream) { uint32 len = _stream->getLength().msecs(); return len * 1000; @@ -270,17 +270,17 @@ uint32 CBSoundBuffer::getLength() { ////////////////////////////////////////////////////////////////////////// -void CBSoundBuffer::setType(Audio::Mixer::SoundType type) { +void BaseSoundBuffer::setType(Audio::Mixer::SoundType type) { _type = type; } ////////////////////////////////////////////////////////////////////////// -void CBSoundBuffer::updateVolume() { +void BaseSoundBuffer::updateVolume() { setVolume(_privateVolume); } ////////////////////////////////////////////////////////////////////////// -bool CBSoundBuffer::setVolume(int volume) { +bool BaseSoundBuffer::setVolume(int volume) { _volume = volume * _gameRef->_soundMgr->getMasterVolume() / 255; if (_stream && _handle) { byte vol = (byte)(_volume); @@ -291,14 +291,14 @@ bool CBSoundBuffer::setVolume(int volume) { ////////////////////////////////////////////////////////////////////////// -bool CBSoundBuffer::setPrivateVolume(int volume) { +bool BaseSoundBuffer::setPrivateVolume(int volume) { _privateVolume = volume; return setVolume(_privateVolume); } ////////////////////////////////////////////////////////////////////////// -bool CBSoundBuffer::isPlaying() { +bool BaseSoundBuffer::isPlaying() { if (_stream && _handle) { return _freezePaused || g_system->getMixer()->isSoundHandleActive(*_handle); } else { @@ -308,7 +308,7 @@ bool CBSoundBuffer::isPlaying() { ////////////////////////////////////////////////////////////////////////// -uint32 CBSoundBuffer::getPosition() { +uint32 BaseSoundBuffer::getPosition() { if (_stream && _handle) { uint32 pos = g_system->getMixer()->getSoundElapsedTime(*_handle); return pos; @@ -318,8 +318,8 @@ uint32 CBSoundBuffer::getPosition() { ////////////////////////////////////////////////////////////////////////// -bool CBSoundBuffer::setPosition(uint32 pos) { - warning("CBSoundBuffer::SetPosition - not implemented yet"); +bool BaseSoundBuffer::setPosition(uint32 pos) { + warning("BaseSoundBuffer::SetPosition - not implemented yet"); #if 0 if (_stream) { QWORD pos = BASS_ChannelSeconds2Bytes(_stream, (float)Pos / 1000.0f); @@ -330,7 +330,7 @@ bool CBSoundBuffer::setPosition(uint32 pos) { } ////////////////////////////////////////////////////////////////////////// -bool CBSoundBuffer::setLoopStart(uint32 pos) { +bool BaseSoundBuffer::setLoopStart(uint32 pos) { _loopStart = pos; #if 0 if (_stream) { @@ -340,7 +340,7 @@ bool CBSoundBuffer::setLoopStart(uint32 pos) { } if (_loopStart > 0) { QWORD len = BASS_ChannelGetLength(_stream, BASS_POS_BYTE); - _sync = BASS_ChannelSetSync(_stream, BASS_SYNC_POS | BASS_SYNC_MIXTIME, len, CBSoundBuffer::LoopSyncProc, (void *)this); + _sync = BASS_ChannelSetSync(_stream, BASS_SYNC_POS | BASS_SYNC_MIXTIME, len, BaseSoundBuffer::LoopSyncProc, (void *)this); } } #endif @@ -348,8 +348,8 @@ bool CBSoundBuffer::setLoopStart(uint32 pos) { } #if 0 ////////////////////////////////////////////////////////////////////////// -void CBSoundBuffer::LoopSyncProc(HSYNC handle, uint32 channel, uint32 data, void *user) { - CBSoundBuffer *soundBuf = static_cast(user); +void BaseSoundBuffer::LoopSyncProc(HSYNC handle, uint32 channel, uint32 data, void *user) { + BaseSoundBuffer *soundBuf = static_cast(user); QWORD pos = BASS_ChannelSeconds2Bytes(channel, (float)soundBuf->GetLoopStart() / 1000.0f); if (!BASS_ChannelSetPosition(channel, pos, BASS_POS_BYTE)) @@ -357,7 +357,7 @@ void CBSoundBuffer::LoopSyncProc(HSYNC handle, uint32 channel, uint32 data, void } #endif ////////////////////////////////////////////////////////////////////////// -bool CBSoundBuffer::setPan(float pan) { +bool BaseSoundBuffer::setPan(float pan) { if (_handle) { g_system->getMixer()->setChannelBalance(*_handle, (int8)(pan * 127)); } @@ -365,8 +365,8 @@ bool CBSoundBuffer::setPan(float pan) { } ////////////////////////////////////////////////////////////////////////// -bool CBSoundBuffer::applyFX(TSFXType type, float param1, float param2, float param3, float param4) { - warning("CBSoundBuffer::ApplyFX - not implemented yet"); +bool BaseSoundBuffer::applyFX(TSFXType type, float param1, float param2, float param3, float param4) { + warning("BaseSoundBuffer::ApplyFX - not implemented yet"); switch (type) { case SFX_ECHO: break; diff --git a/engines/wintermute/base/sound/base_sound_buffer.h b/engines/wintermute/base/sound/base_sound_buffer.h index a491bd49ad..9c85a02b39 100644 --- a/engines/wintermute/base/sound/base_sound_buffer.h +++ b/engines/wintermute/base/sound/base_sound_buffer.h @@ -41,12 +41,12 @@ class SoundHandle; namespace WinterMute { -class CBFile; -class CBSoundBuffer : public CBBase { +class BaseFile; +class BaseSoundBuffer : public BaseClass { public: - CBSoundBuffer(CBGame *inGame); - virtual ~CBSoundBuffer(); + BaseSoundBuffer(BaseGame *inGame); + virtual ~BaseSoundBuffer(); bool pause(); diff --git a/engines/wintermute/base/sound/base_sound_manager.cpp b/engines/wintermute/base/sound/base_sound_manager.cpp index c2174dea6a..22b22a5db6 100644 --- a/engines/wintermute/base/sound/base_sound_manager.cpp +++ b/engines/wintermute/base/sound/base_sound_manager.cpp @@ -44,24 +44,24 @@ namespace WinterMute { // Construction/Destruction ////////////////////////////////////////////////////////////////////// -//IMPLEMENT_PERSISTENT(CBSoundMgr, true); +//IMPLEMENT_PERSISTENT(BaseSoundMgr, true); ////////////////////////////////////////////////////////////////////////// -CBSoundMgr::CBSoundMgr(CBGame *inGame): CBBase(inGame) { +BaseSoundMgr::BaseSoundMgr(BaseGame *inGame): BaseClass(inGame) { _soundAvailable = false; _volumeMaster = 255; } ////////////////////////////////////////////////////////////////////////// -CBSoundMgr::~CBSoundMgr() { +BaseSoundMgr::~BaseSoundMgr() { saveSettings(); cleanup(); } ////////////////////////////////////////////////////////////////////////// -bool CBSoundMgr::cleanup() { +bool BaseSoundMgr::cleanup() { for (uint32 i = 0; i < _sounds.size(); i++) delete _sounds[i]; _sounds.clear(); @@ -72,14 +72,14 @@ bool CBSoundMgr::cleanup() { } ////////////////////////////////////////////////////////////////////////// -void CBSoundMgr::saveSettings() { +void BaseSoundMgr::saveSettings() { if (_soundAvailable) { _gameRef->_registry->writeInt("Audio", "MasterVolume", _volumeMaster); } } ////////////////////////////////////////////////////////////////////////// -bool CBSoundMgr::initialize() { +bool BaseSoundMgr::initialize() { _soundAvailable = false; if (!g_system->getMixer()->isReady()) { @@ -93,7 +93,7 @@ bool CBSoundMgr::initialize() { ////////////////////////////////////////////////////////////////////////// -bool CBSoundMgr::initLoop() { +bool BaseSoundMgr::initLoop() { if (!_soundAvailable) return STATUS_OK; #if 0 @@ -105,11 +105,11 @@ bool CBSoundMgr::initLoop() { ////////////////////////////////////////////////////////////////////////// -CBSoundBuffer *CBSoundMgr::addSound(const char *filename, Audio::Mixer::SoundType type, bool streamed) { +BaseSoundBuffer *BaseSoundMgr::addSound(const char *filename, Audio::Mixer::SoundType type, bool streamed) { if (!_soundAvailable) return NULL; - CBSoundBuffer *sound; + BaseSoundBuffer *sound; // try to switch WAV to OGG file (if available) AnsiString ext = PathUtil::getExtension(filename); @@ -123,7 +123,7 @@ CBSoundBuffer *CBSoundMgr::addSound(const char *filename, Audio::Mixer::SoundTyp } } - sound = new CBSoundBuffer(_gameRef); + sound = new BaseSoundBuffer(_gameRef); if (!sound) return NULL; sound->setStreaming(streamed); @@ -149,7 +149,7 @@ CBSoundBuffer *CBSoundMgr::addSound(const char *filename, Audio::Mixer::SoundTyp } ////////////////////////////////////////////////////////////////////////// -bool CBSoundMgr::addSound(CBSoundBuffer *sound, Audio::Mixer::SoundType type) { +bool BaseSoundMgr::addSound(BaseSoundBuffer *sound, Audio::Mixer::SoundType type) { if (!sound) return STATUS_FAILED; @@ -163,7 +163,7 @@ bool CBSoundMgr::addSound(CBSoundBuffer *sound, Audio::Mixer::SoundType type) { } ////////////////////////////////////////////////////////////////////////// -bool CBSoundMgr::removeSound(CBSoundBuffer *sound) { +bool BaseSoundMgr::removeSound(BaseSoundBuffer *sound) { for (uint32 i = 0; i < _sounds.size(); i++) { if (_sounds[i] == sound) { delete _sounds[i]; @@ -177,7 +177,7 @@ bool CBSoundMgr::removeSound(CBSoundBuffer *sound) { ////////////////////////////////////////////////////////////////////////// -bool CBSoundMgr::setVolume(Audio::Mixer::SoundType type, int volume) { +bool BaseSoundMgr::setVolume(Audio::Mixer::SoundType type, int volume) { if (!_soundAvailable) return STATUS_OK; @@ -200,13 +200,13 @@ bool CBSoundMgr::setVolume(Audio::Mixer::SoundType type, int volume) { } ////////////////////////////////////////////////////////////////////////// -bool CBSoundMgr::setVolumePercent(Audio::Mixer::SoundType type, byte percent) { +bool BaseSoundMgr::setVolumePercent(Audio::Mixer::SoundType type, byte percent) { return setVolume(type, percent * 255 / 100); } ////////////////////////////////////////////////////////////////////////// -byte CBSoundMgr::getVolumePercent(Audio::Mixer::SoundType type) { +byte BaseSoundMgr::getVolumePercent(Audio::Mixer::SoundType type) { int volume = 0; switch (type) { @@ -225,7 +225,7 @@ byte CBSoundMgr::getVolumePercent(Audio::Mixer::SoundType type) { ////////////////////////////////////////////////////////////////////////// -bool CBSoundMgr::setMasterVolume(byte value) { +bool BaseSoundMgr::setMasterVolume(byte value) { _volumeMaster = value; for (uint32 i = 0; i < _sounds.size(); i++) { _sounds[i]->updateVolume(); @@ -234,25 +234,25 @@ bool CBSoundMgr::setMasterVolume(byte value) { } ////////////////////////////////////////////////////////////////////////// -bool CBSoundMgr::setMasterVolumePercent(byte percent) { +bool BaseSoundMgr::setMasterVolumePercent(byte percent) { setMasterVolume(percent * 255 / 100); return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -byte CBSoundMgr::getMasterVolumePercent() { +byte BaseSoundMgr::getMasterVolumePercent() { return getMasterVolume() * 100 / 255; } ////////////////////////////////////////////////////////////////////////// -byte CBSoundMgr::getMasterVolume() { +byte BaseSoundMgr::getMasterVolume() { return (byte)_volumeMaster; } ////////////////////////////////////////////////////////////////////////// -bool CBSoundMgr::pauseAll(bool includingMusic) { +bool BaseSoundMgr::pauseAll(bool includingMusic) { for (uint32 i = 0; i < _sounds.size(); i++) { if (_sounds[i]->isPlaying() && (_sounds[i]->_type != Audio::Mixer::kMusicSoundType || includingMusic)) { @@ -266,7 +266,7 @@ bool CBSoundMgr::pauseAll(bool includingMusic) { ////////////////////////////////////////////////////////////////////////// -bool CBSoundMgr::resumeAll() { +bool BaseSoundMgr::resumeAll() { for (uint32 i = 0; i < _sounds.size(); i++) { if (_sounds[i]->_freezePaused) { @@ -280,7 +280,7 @@ bool CBSoundMgr::resumeAll() { ////////////////////////////////////////////////////////////////////////// -float CBSoundMgr::posToPan(int x, int y) { +float BaseSoundMgr::posToPan(int x, int y) { float relPos = (float)x / ((float)_gameRef->_renderer->_width); float minPan = -0.7f; diff --git a/engines/wintermute/base/sound/base_sound_manager.h b/engines/wintermute/base/sound/base_sound_manager.h index 2c05bbfcb8..53caffbe61 100644 --- a/engines/wintermute/base/sound/base_sound_manager.h +++ b/engines/wintermute/base/sound/base_sound_manager.h @@ -35,14 +35,14 @@ #include "common/array.h" namespace WinterMute { -class CBSoundBuffer; -class CBSoundMgr : public CBBase { +class BaseSoundBuffer; +class BaseSoundMgr : public BaseClass { public: float posToPan(int x, int y); bool resumeAll(); bool pauseAll(bool includingMusic = true); bool cleanup(); - //DECLARE_PERSISTENT(CBSoundMgr, CBBase); + //DECLARE_PERSISTENT(BaseSoundMgr, BaseClass); byte getMasterVolumePercent(); byte getMasterVolume(); bool setMasterVolume(byte percent); @@ -52,15 +52,15 @@ public: bool setVolume(Audio::Mixer::SoundType type, int volume); uint32 _volumeOriginal; int _volumeMaster; - bool removeSound(CBSoundBuffer *sound); - CBSoundBuffer *addSound(const char *filename, Audio::Mixer::SoundType type = Audio::Mixer::kSFXSoundType, bool streamed = false); - bool addSound(CBSoundBuffer *sound, Audio::Mixer::SoundType type = Audio::Mixer::kSFXSoundType); + bool removeSound(BaseSoundBuffer *sound); + BaseSoundBuffer *addSound(const char *filename, Audio::Mixer::SoundType type = Audio::Mixer::kSFXSoundType, bool streamed = false); + bool addSound(BaseSoundBuffer *sound, Audio::Mixer::SoundType type = Audio::Mixer::kSFXSoundType); bool initLoop(); bool initialize(); bool _soundAvailable; - CBSoundMgr(CBGame *inGame); - virtual ~CBSoundMgr(); - Common::Array _sounds; + BaseSoundMgr(BaseGame *inGame); + virtual ~BaseSoundMgr(); + Common::Array _sounds; void saveSettings(); }; diff --git a/engines/wintermute/coll_templ.h b/engines/wintermute/coll_templ.h index 865e60b447..252531e4d2 100644 --- a/engines/wintermute/coll_templ.h +++ b/engines/wintermute/coll_templ.h @@ -70,16 +70,16 @@ bool DCCompareElements(const TYPE *pElement1, const ARG_TYPE *pElement2) { return *pElement1 == *pElement2; } -//class CBPersistMgr; +//class BasePersistenceManager; ///////////////////////////////////////////////////////////////////////////// -// CBArray +// BaseArray ///////////////////////////////////////////////////////////////////////////// template -class CBArray { +class BaseArray { public: // Construction - CBArray(); + BaseArray(); // Attributes int getSize() const; @@ -90,7 +90,7 @@ public: // Clean up void freeExtra(); void removeAll(); - bool persist(CBPersistMgr *persistMgr); + bool persist(BasePersistenceManager *persistMgr); // Accessing elements TYPE getAt(int nIndex) const; @@ -104,8 +104,8 @@ public: // Potentially growing the array void setAtGrow(int nIndex, ARG_TYPE newElement); int add(ARG_TYPE newElement); - int append(const CBArray &src); - void copy(const CBArray &src); + int append(const BaseArray &src); + void copy(const BaseArray &src); // overloaded operator helpers TYPE operator[](int nIndex) const; @@ -114,7 +114,7 @@ public: // Operations that move elements around void insertAt(int nIndex, ARG_TYPE newElement, int nCount = 1); void removeAt(int nIndex, int nCount = 1); - void insertAt(int nStartIndex, CBArray *pNewArray); + void insertAt(int nStartIndex, BaseArray *pNewArray); // Implementation protected: @@ -124,71 +124,71 @@ protected: int _nGrowBy; // grow amount public: - ~CBArray(); + ~BaseArray(); }; ///////////////////////////////////////////////////////////////////////////// -// CBArray inline functions +// BaseArray inline functions ///////////////////////////////////////////////////////////////////////////// template -inline int CBArray::getSize() const { +inline int BaseArray::getSize() const { return _nSize; } template -inline int CBArray::getUpperBound() const { +inline int BaseArray::getUpperBound() const { return _nSize - 1; } template -inline void CBArray::removeAll() { +inline void BaseArray::removeAll() { setSize(0, -1); } template -inline TYPE CBArray::getAt(int nIndex) const { +inline TYPE BaseArray::getAt(int nIndex) const { return _pData[nIndex]; } template -inline void CBArray::setAt(int nIndex, ARG_TYPE newElement) { +inline void BaseArray::setAt(int nIndex, ARG_TYPE newElement) { _pData[nIndex] = newElement; } template -inline TYPE &CBArray::elementAt(int nIndex) { +inline TYPE &BaseArray::elementAt(int nIndex) { return _pData[nIndex]; } template -inline const TYPE *CBArray::getData() const { +inline const TYPE *BaseArray::getData() const { return (const TYPE *)_pData; } template -inline TYPE *CBArray::getData() { +inline TYPE *BaseArray::getData() { return (TYPE *)_pData; } template -inline int CBArray::add(ARG_TYPE newElement) { +inline int BaseArray::add(ARG_TYPE newElement) { int nIndex = _nSize; setAtGrow(nIndex, newElement); return nIndex; } template -inline TYPE CBArray::operator[](int nIndex) const { +inline TYPE BaseArray::operator[](int nIndex) const { return getAt(nIndex); } template -inline TYPE &CBArray::operator[](int nIndex) { +inline TYPE &BaseArray::operator[](int nIndex) { return elementAt(nIndex); } ///////////////////////////////////////////////////////////////////////////// -// CBArray out-of-line functions +// BaseArray out-of-line functions ///////////////////////////////////////////////////////////////////////////// template -CBArray::CBArray() { +BaseArray::BaseArray() { _pData = NULL; _nSize = _nMaxSize = _nGrowBy = 0; } ///////////////////////////////////////////////////////////////////////////// template -CBArray::~CBArray() { +BaseArray::~BaseArray() { if (_pData != NULL) { DCDestructElements(_pData, _nSize); delete[](byte *)_pData; @@ -197,7 +197,7 @@ CBArray::~CBArray() { ///////////////////////////////////////////////////////////////////////////// template -void CBArray::setSize(int nNewSize, int nGrowBy) { +void BaseArray::setSize(int nNewSize, int nGrowBy) { if (nGrowBy != -1) _nGrowBy = nGrowBy; // set new size @@ -257,7 +257,7 @@ void CBArray::setSize(int nNewSize, int nGrowBy) { ///////////////////////////////////////////////////////////////////////////// template -int CBArray::append(const CBArray &src) { +int BaseArray::append(const BaseArray &src) { int nOldSize = _nSize; setSize(_nSize + src._nSize); DCCopyElements(_pData + nOldSize, src._pData, src._nSize); @@ -266,14 +266,14 @@ int CBArray::append(const CBArray &src) { ///////////////////////////////////////////////////////////////////////////// template -void CBArray::copy(const CBArray &src) { +void BaseArray::copy(const BaseArray &src) { setSize(src._nSize); DCCopyElements(_pData, src._pData, src._nSize); } ///////////////////////////////////////////////////////////////////////////// template -void CBArray::freeExtra() { +void BaseArray::freeExtra() { if (_nSize != _nMaxSize) { // shrink to desired size TYPE *pNewData = NULL; @@ -292,7 +292,7 @@ void CBArray::freeExtra() { ///////////////////////////////////////////////////////////////////////////// template -void CBArray::setAtGrow(int nIndex, ARG_TYPE newElement) { +void BaseArray::setAtGrow(int nIndex, ARG_TYPE newElement) { if (nIndex >= _nSize) setSize(nIndex + 1, -1); _pData[nIndex] = newElement; @@ -300,7 +300,7 @@ void CBArray::setAtGrow(int nIndex, ARG_TYPE newElement) { ///////////////////////////////////////////////////////////////////////////// template -void CBArray::insertAt(int nIndex, ARG_TYPE newElement, int nCount /*=1*/) { +void BaseArray::insertAt(int nIndex, ARG_TYPE newElement, int nCount /*=1*/) { if (nIndex >= _nSize) { // adding after the end of the array setSize(nIndex + nCount, -1); // grow so nIndex is valid @@ -325,7 +325,7 @@ void CBArray::insertAt(int nIndex, ARG_TYPE newElement, int nCou ///////////////////////////////////////////////////////////////////////////// template -void CBArray::removeAt(int nIndex, int nCount) { +void BaseArray::removeAt(int nIndex, int nCount) { // just remove a range int nMoveCount = _nSize - (nIndex + nCount); DCDestructElements(&_pData[nIndex], nCount); @@ -337,7 +337,7 @@ void CBArray::removeAt(int nIndex, int nCount) { ///////////////////////////////////////////////////////////////////////////// template -void CBArray::insertAt(int nStartIndex, CBArray *pNewArray) { +void BaseArray::insertAt(int nStartIndex, BaseArray *pNewArray) { if (pNewArray->GetSize() > 0) { InsertAt(nStartIndex, pNewArray->GetAt(0), pNewArray->GetSize()); for (int i = 0; i < pNewArray->GetSize(); i++) @@ -348,7 +348,7 @@ void CBArray::insertAt(int nStartIndex, CBArray *pNewArray) { ///////////////////////////////////////////////////////////////////////////// template -bool CBArray::persist(CBPersistMgr *persistMgr) { +bool BaseArray::persist(BasePersistenceManager *persistMgr) { int i, j; if (persistMgr->_saving) { j = getSize(); diff --git a/engines/wintermute/detection.cpp b/engines/wintermute/detection.cpp index 0abe78fa35..285c3ffaeb 100644 --- a/engines/wintermute/detection.cpp +++ b/engines/wintermute/detection.cpp @@ -112,7 +112,7 @@ public: SaveStateList listSaves(const char *target) const { SaveStateList saves; - WinterMute::CBPersistMgr pm(NULL, target); + WinterMute::BasePersistenceManager pm(NULL, target); for (int i = 0; i < getMaximumSaveSlot(); i++) { if (pm.getSaveExists(i)) { SaveStateDescriptor desc; @@ -128,12 +128,12 @@ public: } void removeSaveState(const char *target, int slot) const { - WinterMute::CBPersistMgr pm(NULL, target); + WinterMute::BasePersistenceManager pm(NULL, target); pm.deleteSaveSlot(slot); } virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const { - WinterMute::CBPersistMgr pm(NULL, target); + WinterMute::BasePersistenceManager pm(NULL, target); SaveStateDescriptor retVal; retVal.setDescription("Invalid savegame"); pm.getSaveStateDesc(slot, retVal); diff --git a/engines/wintermute/persistent.cpp b/engines/wintermute/persistent.cpp index 205b448880..6473b52bee 100644 --- a/engines/wintermute/persistent.cpp +++ b/engines/wintermute/persistent.cpp @@ -88,80 +88,80 @@ #include "engines/wintermute/video/video_theora_player.h" #include "engines/wintermute/system/sys_class.h" -// CSysClass adds these objects to the registry, thus they aren't as leaked as they look +// SystemClass adds these objects to the registry, thus they aren't as leaked as they look #define REGISTER_CLASS(class_name, persistent_class)\ - new WinterMute::CSysClass(class_name::_className, class_name::persistBuild, class_name::persistLoad, persistent_class); + new WinterMute::SystemClass(class_name::_className, class_name::persistBuild, class_name::persistLoad, persistent_class); namespace WinterMute { -// This is done in a separate file, to avoid including the kitchensink in CSysClassRegistry. -void CSysClassRegistry::registerClasses() { - REGISTER_CLASS(CAdActor, false) - REGISTER_CLASS(CAdEntity, false) - REGISTER_CLASS(CAdGame, true) - REGISTER_CLASS(CAdInventory, false) - REGISTER_CLASS(CAdInventoryBox, false) - REGISTER_CLASS(CAdItem, false) - REGISTER_CLASS(CAdLayer, false) - REGISTER_CLASS(CAdNodeState, false) - REGISTER_CLASS(CAdObject, false) - REGISTER_CLASS(CAdPath, false) - REGISTER_CLASS(CAdPathPoint, false) - REGISTER_CLASS(CAdRegion, false) - REGISTER_CLASS(CAdResponse, false) - REGISTER_CLASS(CAdResponseBox, false) - REGISTER_CLASS(CAdResponseContext, false) - REGISTER_CLASS(CAdRotLevel, false) - REGISTER_CLASS(CAdScaleLevel, false) - REGISTER_CLASS(CAdScene, false) - REGISTER_CLASS(CAdSceneNode, false) - REGISTER_CLASS(CAdSceneState, false) - REGISTER_CLASS(CAdSentence, false) - REGISTER_CLASS(CAdSpriteSet, false) - REGISTER_CLASS(CAdTalkDef, false) - REGISTER_CLASS(CAdTalkHolder, false) - REGISTER_CLASS(CAdTalkNode, false) - REGISTER_CLASS(CAdWaypointGroup, false) +// This is done in a separate file, to avoid including the kitchensink in SystemClassRegistry. +void SystemClassRegistry::registerClasses() { + REGISTER_CLASS(AdActor, false) + REGISTER_CLASS(AdEntity, false) + REGISTER_CLASS(AdGame, true) + REGISTER_CLASS(AdInventory, false) + REGISTER_CLASS(AdInventoryBox, false) + REGISTER_CLASS(AdItem, false) + REGISTER_CLASS(AdLayer, false) + REGISTER_CLASS(AdNodeState, false) + REGISTER_CLASS(AdObject, false) + REGISTER_CLASS(AdPath, false) + REGISTER_CLASS(AdPathPoint, false) + REGISTER_CLASS(AdRegion, false) + REGISTER_CLASS(AdResponse, false) + REGISTER_CLASS(AdResponseBox, false) + REGISTER_CLASS(AdResponseContext, false) + REGISTER_CLASS(AdRotLevel, false) + REGISTER_CLASS(AdScaleLevel, false) + REGISTER_CLASS(AdScene, false) + REGISTER_CLASS(AdSceneNode, false) + REGISTER_CLASS(AdSceneState, false) + REGISTER_CLASS(AdSentence, false) + REGISTER_CLASS(AdSpriteSet, false) + REGISTER_CLASS(AdTalkDef, false) + REGISTER_CLASS(AdTalkHolder, false) + REGISTER_CLASS(AdTalkNode, false) + REGISTER_CLASS(AdWaypointGroup, false) - REGISTER_CLASS(CBFader, false) - REGISTER_CLASS(CBFont, false) - REGISTER_CLASS(CBFontBitmap, false) - REGISTER_CLASS(CBFontStorage, true) - REGISTER_CLASS(CBFontTT, false) - REGISTER_CLASS(CBFrame, false) - REGISTER_CLASS(CBGame, true) - REGISTER_CLASS(CBKeyboardState, false) - REGISTER_CLASS(CBObject, false) - REGISTER_CLASS(CBPoint, false) - REGISTER_CLASS(CBRegion, false) - REGISTER_CLASS(CBScriptable, false) - REGISTER_CLASS(CBScriptHolder, false) - REGISTER_CLASS(CBSound, false) - REGISTER_CLASS(CBSprite, false) - REGISTER_CLASS(CBSubFrame, false) + REGISTER_CLASS(BaseFader, false) + REGISTER_CLASS(BaseFont, false) + REGISTER_CLASS(BaseFontBitmap, false) + REGISTER_CLASS(BaseFontStorage, true) + REGISTER_CLASS(BaseFontTT, false) + REGISTER_CLASS(BaseFrame, false) + REGISTER_CLASS(BaseGame, true) + REGISTER_CLASS(BaseKeyboardState, false) + REGISTER_CLASS(BaseObject, false) + REGISTER_CLASS(BasePoint, false) + REGISTER_CLASS(BaseRegion, false) + REGISTER_CLASS(BaseScriptable, false) + REGISTER_CLASS(BaseScriptHolder, false) + REGISTER_CLASS(BaseSound, false) + REGISTER_CLASS(BaseSprite, false) + REGISTER_CLASS(BaseSubFrame, false) - REGISTER_CLASS(CBViewport, false) - REGISTER_CLASS(CPartEmitter, false) - REGISTER_CLASS(CScEngine, true) - REGISTER_CLASS(CScScript, false) - REGISTER_CLASS(CScStack, false) - REGISTER_CLASS(CScValue, false) - REGISTER_CLASS(CSXArray, false) - REGISTER_CLASS(CSXDate, false) - REGISTER_CLASS(CSXFile, false) - REGISTER_CLASS(CSXMath, true) - REGISTER_CLASS(CSXMemBuffer, false) - REGISTER_CLASS(CSXObject, false) - REGISTER_CLASS(CSXString, false) + REGISTER_CLASS(BaseViewport, false) + REGISTER_CLASS(PartEmitter, false) + REGISTER_CLASS(ScEngine, true) + REGISTER_CLASS(ScScript, false) + REGISTER_CLASS(ScStack, false) + REGISTER_CLASS(ScValue, false) + REGISTER_CLASS(SXArray, false) + REGISTER_CLASS(SXDate, false) + REGISTER_CLASS(SXFile, false) + REGISTER_CLASS(SXMath, true) + REGISTER_CLASS(SXMemBuffer, false) + REGISTER_CLASS(SXObject, false) + REGISTER_CLASS(SXString, false) - REGISTER_CLASS(CUIButton, false) - REGISTER_CLASS(CUIEdit, false) - REGISTER_CLASS(CUIEntity, false) - REGISTER_CLASS(CUIObject, false) - REGISTER_CLASS(CUIText, false) - REGISTER_CLASS(CUITiledImage, false) - REGISTER_CLASS(CUIWindow, false) - REGISTER_CLASS(CVidTheoraPlayer, false) + REGISTER_CLASS(UIButton, false) + REGISTER_CLASS(UIEdit, false) + REGISTER_CLASS(UIEntity, false) + REGISTER_CLASS(UIObject, false) + REGISTER_CLASS(UIText, false) + REGISTER_CLASS(UITiledImage, false) + REGISTER_CLASS(UIWindow, false) + REGISTER_CLASS(VideoTheoraPlayer, false) warning("TODO: Clean this up at some proper time"); } diff --git a/engines/wintermute/persistent.h b/engines/wintermute/persistent.h index a5dac465b3..4d7d08735c 100644 --- a/engines/wintermute/persistent.h +++ b/engines/wintermute/persistent.h @@ -31,11 +31,11 @@ namespace WinterMute { -class CBPersistMgr; +class BasePersistenceManager; // persistence support typedef void *(*PERSISTBUILD)(void); -typedef bool(*PERSISTLOAD)(void *, CBPersistMgr *); +typedef bool(*PERSISTLOAD)(void *, BasePersistenceManager *); typedef void (*SYS_INSTANCE_CALLBACK)(void *Instance, void *Data); } // end of namespace WinterMute @@ -47,9 +47,9 @@ namespace WinterMute { static const char _className[];\ static void* persistBuild(void);\ virtual const char* getClassName();\ - static bool persistLoad(void* Instance, CBPersistMgr* PersistMgr);\ + static bool persistLoad(void* Instance, BasePersistenceManager* PersistMgr);\ class_name(TDynamicConstructor p1, TDynamicConstructor p2):parent_class(p1, p2){ /*memset(this, 0, sizeof(class_name));*/ };\ - virtual bool persist(CBPersistMgr* PersistMgr);\ + virtual bool persist(BasePersistenceManager* PersistMgr);\ void* operator new (size_t size);\ void operator delete(void* p);\ @@ -60,7 +60,7 @@ namespace WinterMute { return ::new class_name(DYNAMIC_CONSTRUCTOR, DYNAMIC_CONSTRUCTOR);\ }\ \ - bool class_name::persistLoad(void* Instance, CBPersistMgr* PersistMgr){\ + bool class_name::persistLoad(void* Instance, BasePersistenceManager* PersistMgr){\ return ((class_name*)Instance)->persist(PersistMgr);\ }\ \ @@ -68,16 +68,16 @@ namespace WinterMute { return #class_name;\ }\ \ - /*CSysClass Register##class_name(class_name::_className, class_name::PersistBuild, class_name::PersistLoad, persistent_class);*/\ + /*SystemClass Register##class_name(class_name::_className, class_name::PersistBuild, class_name::PersistLoad, persistent_class);*/\ \ void* class_name::operator new (size_t size){\ void* ret = ::operator new(size);\ - CSysClassRegistry::getInstance()->registerInstance(#class_name, ret);\ + SystemClassRegistry::getInstance()->registerInstance(#class_name, ret);\ return ret;\ }\ \ void class_name::operator delete (void* p){\ - CSysClassRegistry::getInstance()->unregisterInstance(#class_name, p);\ + SystemClassRegistry::getInstance()->unregisterInstance(#class_name, p);\ ::operator delete(p);\ }\ diff --git a/engines/wintermute/platform_osystem.cpp b/engines/wintermute/platform_osystem.cpp index 2be73b7256..028a85ada1 100644 --- a/engines/wintermute/platform_osystem.cpp +++ b/engines/wintermute/platform_osystem.cpp @@ -40,16 +40,16 @@ namespace WinterMute { -CBGame *CBPlatform::_gameRef = NULL; +BaseGame *BasePlatform::_gameRef = NULL; #define CLASS_NAME "GF_FRAME" -int CBPlatform::initialize(CBGame *inGame, int argc, char *argv[]) { +int BasePlatform::initialize(BaseGame *inGame, int argc, char *argv[]) { _gameRef = inGame; return true; } ////////////////////////////////////////////////////////////////////////// -void CBPlatform::handleEvent(Common::Event *event) { +void BasePlatform::handleEvent(Common::Event *event) { switch (event->type) { case Common::EVENT_LBUTTONDOWN: @@ -88,13 +88,13 @@ void CBPlatform::handleEvent(Common::Event *event) { break; /*#ifdef __IPHONEOS__ { - CBRenderOSystem *renderer = static_cast(_gameRef->_renderer); + BaseRenderOSystem *renderer = static_cast(_gameRef->_renderer); POINT p; GetCursorPos(&p); _gameRef->SetActiveObject(renderer->GetObjectAt(p.x, p.y)); - if (_gameRef->_activeObject != NULL && strcmp(_gameRef->_activeObject->getClassName(), "CUIButton") == 0) { - CUIButton *btn = static_cast(_gameRef->_activeObject); + if (_gameRef->_activeObject != NULL && strcmp(_gameRef->_activeObject->getClassName(), "UIButton") == 0) { + UIButton *btn = static_cast(_gameRef->_activeObject); if (btn->_visible && !btn->_disable) btn->_press = true; } } @@ -151,7 +151,7 @@ void CBPlatform::handleEvent(Common::Event *event) { } ////////////////////////////////////////////////////////////////////////// -int CBPlatform::SDLEventWatcher(void *userdata, Common::Event *event) { +int BasePlatform::SDLEventWatcher(void *userdata, Common::Event *event) { //TODO /* if (event->type == SDL_WINDOWEVENT && event->window.event == SDL_WINDOWEVENT_MINIMIZED) { if (_gameRef) _gameRef->AutoSaveOnExit(); @@ -166,7 +166,7 @@ int CBPlatform::SDLEventWatcher(void *userdata, Common::Event *event) { ////////////////////////////////////////////////////////////////////////// // Win32 API bindings ////////////////////////////////////////////////////////////////////////// -void CBPlatform::outputDebugString(const char *lpOutputString) { +void BasePlatform::outputDebugString(const char *lpOutputString) { /* #ifdef __WIN32__ ::OutputDebugString(lpOutputString); @@ -176,13 +176,13 @@ void CBPlatform::outputDebugString(const char *lpOutputString) { ////////////////////////////////////////////////////////////////////////// -uint32 CBPlatform::getTime() { +uint32 BasePlatform::getTime() { return g_system->getMillis(); } ////////////////////////////////////////////////////////////////////////// -bool CBPlatform::getCursorPos(Point32 *lpPoint) { - CBRenderOSystem *renderer = static_cast(_gameRef->_renderer); +bool BasePlatform::getCursorPos(Point32 *lpPoint) { + BaseRenderOSystem *renderer = static_cast(_gameRef->_renderer); Common::Point p = g_system->getEventManager()->getMousePos(); lpPoint->x = p.x; @@ -194,8 +194,8 @@ bool CBPlatform::getCursorPos(Point32 *lpPoint) { } ////////////////////////////////////////////////////////////////////////// -bool CBPlatform::setCursorPos(int X, int Y) { - CBRenderOSystem *renderer = static_cast(_gameRef->_renderer); +bool BasePlatform::setCursorPos(int X, int Y) { + BaseRenderOSystem *renderer = static_cast(_gameRef->_renderer); Point32 p; p.x = X; @@ -207,19 +207,19 @@ bool CBPlatform::setCursorPos(int X, int Y) { } ////////////////////////////////////////////////////////////////////////// -bool CBPlatform::showWindow(int nCmdShow) { +bool BasePlatform::showWindow(int nCmdShow) { return false; } ////////////////////////////////////////////////////////////////////////// -bool CBPlatform::deleteFile(const char *lpFileName) { +bool BasePlatform::deleteFile(const char *lpFileName) { return remove(lpFileName) ? true : false; } ////////////////////////////////////////////////////////////////////////// -bool CBPlatform::copyFile(const char *from, const char *to, bool failIfExists) { +bool BasePlatform::copyFile(const char *from, const char *to, bool failIfExists) { // try { - warning("CBPlatform::copyFile(%s, %s, %d) - not implemented", from, to, failIfExists); + warning("BasePlatform::copyFile(%s, %s, %d) - not implemented", from, to, failIfExists); return false; // if (failIfExists && boost::filesystem::exists(to)) return false; // boost::filesystem::copy_file(from, to); @@ -230,38 +230,38 @@ bool CBPlatform::copyFile(const char *from, const char *to, bool failIfExists) { } ////////////////////////////////////////////////////////////////////////// -void CBPlatform::setCapture() { +void BasePlatform::setCapture() { return; } ////////////////////////////////////////////////////////////////////////// -bool CBPlatform::releaseCapture() { +bool BasePlatform::releaseCapture() { return false; } ////////////////////////////////////////////////////////////////////////// -bool CBPlatform::setForegroundWindow() { +bool BasePlatform::setForegroundWindow() { return false; } ////////////////////////////////////////////////////////////////////////// -bool CBPlatform::setRectEmpty(Rect32 *lprc) { +bool BasePlatform::setRectEmpty(Rect32 *lprc) { lprc->left = lprc->right = lprc->top = lprc->bottom = 0; return true; } ////////////////////////////////////////////////////////////////////////// -bool CBPlatform::isRectEmpty(const Rect32 *lprc) { +bool BasePlatform::isRectEmpty(const Rect32 *lprc) { return (lprc->left >= lprc->right) || (lprc->top >= lprc->bottom); } ////////////////////////////////////////////////////////////////////////// -bool CBPlatform::ptInRect(Rect32 *lprc, Point32 p) { +bool BasePlatform::ptInRect(Rect32 *lprc, Point32 p) { return (p.x >= lprc->left) && (p.x < lprc->right) && (p.y >= lprc->top) && (p.y < lprc->bottom); } ////////////////////////////////////////////////////////////////////////// -bool CBPlatform::setRect(Rect32 *lprc, int left, int top, int right, int bottom) { +bool BasePlatform::setRect(Rect32 *lprc, int left, int top, int right, int bottom) { lprc->left = left; lprc->top = top; lprc->right = right; @@ -271,7 +271,7 @@ bool CBPlatform::setRect(Rect32 *lprc, int left, int top, int right, int bottom) } ////////////////////////////////////////////////////////////////////////// -bool CBPlatform::intersectRect(Rect32 *lprcDst, const Rect32 *lprcSrc1, const Rect32 *lprcSrc2) { +bool BasePlatform::intersectRect(Rect32 *lprcDst, const Rect32 *lprcSrc1, const Rect32 *lprcSrc2) { if (isRectEmpty(lprcSrc1) || isRectEmpty(lprcSrc2) || lprcSrc1->left >= lprcSrc2->right || lprcSrc2->left >= lprcSrc1->right || lprcSrc1->top >= lprcSrc2->bottom || lprcSrc2->top >= lprcSrc1->bottom) { @@ -287,7 +287,7 @@ bool CBPlatform::intersectRect(Rect32 *lprcDst, const Rect32 *lprcSrc1, const Re } ////////////////////////////////////////////////////////////////////////// -bool CBPlatform::unionRect(Rect32 *lprcDst, Rect32 *lprcSrc1, Rect32 *lprcSrc2) { +bool BasePlatform::unionRect(Rect32 *lprcDst, Rect32 *lprcSrc1, Rect32 *lprcSrc2) { if (isRectEmpty(lprcSrc1)) { if (isRectEmpty(lprcSrc2)) { setRectEmpty(lprcDst); @@ -310,7 +310,7 @@ bool CBPlatform::unionRect(Rect32 *lprcDst, Rect32 *lprcSrc1, Rect32 *lprcSrc2) } ////////////////////////////////////////////////////////////////////////// -bool CBPlatform::copyRect(Rect32 *lprcDst, Rect32 *lprcSrc) { +bool BasePlatform::copyRect(Rect32 *lprcDst, Rect32 *lprcSrc) { if (lprcDst == NULL || lprcSrc == NULL) return false; *lprcDst = *lprcSrc; @@ -318,7 +318,7 @@ bool CBPlatform::copyRect(Rect32 *lprcDst, Rect32 *lprcSrc) { } ////////////////////////////////////////////////////////////////////////// -bool CBPlatform::offsetRect(Rect32 *lprc, int dx, int dy) { +bool BasePlatform::offsetRect(Rect32 *lprc, int dx, int dy) { if (lprc == NULL) return false; lprc->left += dx; @@ -330,13 +330,13 @@ bool CBPlatform::offsetRect(Rect32 *lprc, int dx, int dy) { } ////////////////////////////////////////////////////////////////////////// -bool CBPlatform::equalRect(Rect32 *rect1, Rect32 *rect2) { +bool BasePlatform::equalRect(Rect32 *rect1, Rect32 *rect2) { return rect1->left == rect2->left && rect1->right == rect2->right && rect1->top == rect2->top && rect1->bottom == rect2->bottom; } ////////////////////////////////////////////////////////////////////////// -AnsiString CBPlatform::getSystemFontPath() { +AnsiString BasePlatform::getSystemFontPath() { /*#ifdef __WIN32__ // we're looking for something like "c:\windows\fonts\"; char winDir[MAX_PATH_LENGTH + 1]; @@ -351,14 +351,14 @@ AnsiString CBPlatform::getSystemFontPath() { } ////////////////////////////////////////////////////////////////////////// -AnsiString CBPlatform::getPlatformName() { +AnsiString BasePlatform::getPlatformName() { // TODO: Should conform to the WME-spec. //return AnsiString(SDL_GetPlatform()); return AnsiString("ScummVM"); } ////////////////////////////////////////////////////////////////////////// -char *CBPlatform::strupr(char *string) { +char *BasePlatform::strupr(char *string) { if (string) { for (size_t i = 0; i < strlen(string); ++i) { string[i] = toupper(string[i]); @@ -368,7 +368,7 @@ char *CBPlatform::strupr(char *string) { } ////////////////////////////////////////////////////////////////////////// -char *CBPlatform::strlwr(char *string) { +char *BasePlatform::strlwr(char *string) { if (string) { for (size_t i = 0; i < strlen(string); ++i) { string[i] = tolower(string[i]); diff --git a/engines/wintermute/platform_osystem.h b/engines/wintermute/platform_osystem.h index 50b07bccb8..601f47b29d 100644 --- a/engines/wintermute/platform_osystem.h +++ b/engines/wintermute/platform_osystem.h @@ -36,12 +36,12 @@ namespace WinterMute { -class CBGame; +class BaseGame; ////////////////////////////////////////////////////////////////////////// -class CBPlatform { +class BasePlatform { public: - static int initialize(CBGame *inGame, int argc, char *argv[]); + static int initialize(BaseGame *inGame, int argc, char *argv[]); static void handleEvent(Common::Event *event); static AnsiString getSystemFontPath(); @@ -80,7 +80,7 @@ public: static int SDLEventWatcher(void *userdata, Common::Event *event); private: - static CBGame *_gameRef; + static BaseGame *_gameRef; }; } // end of namespace WinterMute diff --git a/engines/wintermute/system/sys_class.cpp b/engines/wintermute/system/sys_class.cpp index be70f8b8bd..32704e0a0e 100644 --- a/engines/wintermute/system/sys_class.cpp +++ b/engines/wintermute/system/sys_class.cpp @@ -36,7 +36,7 @@ namespace WinterMute { ////////////////////////////////////////////////////////////////////////// -CSysClass::CSysClass(const AnsiString &name, PERSISTBUILD build, PERSISTLOAD load, bool persistent_class) { +SystemClass::SystemClass(const AnsiString &name, PERSISTBUILD build, PERSISTLOAD load, bool persistent_class) { _name = name; _build = build; @@ -46,18 +46,18 @@ CSysClass::CSysClass(const AnsiString &name, PERSISTBUILD build, PERSISTLOAD loa _persistent = persistent_class; _numInst = 0; - CSysClassRegistry::getInstance()->registerClass(this); + SystemClassRegistry::getInstance()->registerClass(this); } ////////////////////////////////////////////////////////////////////////// -CSysClass::~CSysClass() { - CSysClassRegistry::getInstance()->unregisterClass(this); +SystemClass::~SystemClass() { + SystemClassRegistry::getInstance()->unregisterClass(this); removeAllInstances(); } ////////////////////////////////////////////////////////////////////////// -bool CSysClass::removeAllInstances() { +bool SystemClass::removeAllInstances() { Instances::iterator it; for (it = _instances.begin(); it != _instances.end(); ++it) { delete(it->_value); @@ -69,21 +69,21 @@ bool CSysClass::removeAllInstances() { } ////////////////////////////////////////////////////////////////////////// -CSysInstance *CSysClass::addInstance(void *instance, int id, int savedId) { - CSysInstance *inst = new CSysInstance(instance, id, this); +SystemInstance *SystemClass::addInstance(void *instance, int id, int savedId) { + SystemInstance *inst = new SystemInstance(instance, id, this); inst->setSavedID(savedId); _instances[inst] = (inst); _instanceMap[instance] = inst; - CSysClassRegistry::getInstance()->addInstanceToTable(inst, instance); + SystemClassRegistry::getInstance()->addInstanceToTable(inst, instance); return inst; } ////////////////////////////////////////////////////////////////////////// -bool CSysClass::removeInstance(void *instance) { +bool SystemClass::removeInstance(void *instance) { InstanceMap::iterator mapIt = _instanceMap.find(instance); if (mapIt == _instanceMap.end()) return false; @@ -99,14 +99,14 @@ bool CSysClass::removeInstance(void *instance) { } ////////////////////////////////////////////////////////////////////////// -int CSysClass::getInstanceID(void *pointer) { +int SystemClass::getInstanceID(void *pointer) { InstanceMap::iterator mapIt = _instanceMap.find(pointer); if (mapIt == _instanceMap.end()) return -1; else return (mapIt->_value)->getID(); } ////////////////////////////////////////////////////////////////////////// -void *CSysClass::idToPointer(int savedID) { +void *SystemClass::idToPointer(int savedID) { //slow Instances::iterator it; for (it = _instances.begin(); it != _instances.end(); ++it) { @@ -116,19 +116,19 @@ void *CSysClass::idToPointer(int savedID) { } ////////////////////////////////////////////////////////////////////////// -int CSysClass::getNumInstances() { +int SystemClass::getNumInstances() { return _instances.size(); } ////////////////////////////////////////////////////////////////////////// -void CSysClass::dump(Common::WriteStream *stream) { +void SystemClass::dump(Common::WriteStream *stream) { Common::String str; str = Common::String::format("%03d %c %-20s instances: %d\n", _iD, _persistent ? 'p' : ' ', _name.c_str(), getNumInstances()); stream->write(str.c_str(), str.size()); } ////////////////////////////////////////////////////////////////////////// -void CSysClass::saveTable(CBGame *gameRef, CBPersistMgr *persistMgr) { +void SystemClass::saveTable(BaseGame *gameRef, BasePersistenceManager *persistMgr) { persistMgr->putString(_name.c_str()); persistMgr->putDWORD(_iD); persistMgr->putDWORD(_instances.size()); @@ -140,7 +140,7 @@ void CSysClass::saveTable(CBGame *gameRef, CBPersistMgr *persistMgr) { } ////////////////////////////////////////////////////////////////////////// -void CSysClass::loadTable(CBGame *gameRef, CBPersistMgr *persistMgr) { +void SystemClass::loadTable(BaseGame *gameRef, BasePersistenceManager *persistMgr) { _savedID = persistMgr->getDWORD(); int numInstances = persistMgr->getDWORD(); @@ -156,7 +156,7 @@ void CSysClass::loadTable(CBGame *gameRef, CBPersistMgr *persistMgr) { Instances::iterator it = _instances.begin(); if (it != _instances.end()) { (it->_value)->setSavedID(instID); - CSysClassRegistry::getInstance()->addInstanceToTable((it->_value), (it->_value)->getInstance()); + SystemClassRegistry::getInstance()->addInstanceToTable((it->_value), (it->_value)->getInstance()); } else gameRef->LOG(0, "Warning: instance %d of persistent class %s not found", i, _name.c_str()); } // normal instances, create empty objects @@ -166,14 +166,14 @@ void CSysClass::loadTable(CBGame *gameRef, CBPersistMgr *persistMgr) { warning("HALT"); } - addInstance(emptyObject, CSysClassRegistry::getInstance()->getNextID(), instID); + addInstance(emptyObject, SystemClassRegistry::getInstance()->getNextID(), instID); } } } ////////////////////////////////////////////////////////////////////////// -void CSysClass::saveInstances(CBGame *Game, CBPersistMgr *persistMgr) { +void SystemClass::saveInstances(BaseGame *Game, BasePersistenceManager *persistMgr) { Instances::iterator it; for (it = _instances.begin(); it != _instances.end(); ++it) { // write instace header @@ -187,13 +187,13 @@ void CSysClass::saveInstances(CBGame *Game, CBPersistMgr *persistMgr) { } ////////////////////////////////////////////////////////////////////////// -void CSysClass::loadInstance(void *instance, CBPersistMgr *persistMgr) { +void SystemClass::loadInstance(void *instance, BasePersistenceManager *persistMgr) { _load(instance, persistMgr); } ////////////////////////////////////////////////////////////////////////// -void CSysClass::resetSavedIDs() { +void SystemClass::resetSavedIDs() { Instances::iterator it; for (it = _instances.begin(); it != _instances.end(); ++it) { (it->_value)->setSavedID(-1); @@ -201,7 +201,7 @@ void CSysClass::resetSavedIDs() { } ////////////////////////////////////////////////////////////////////////// -void CSysClass::instanceCallback(SYS_INSTANCE_CALLBACK lpCallback, void *lpData) { +void SystemClass::instanceCallback(SYS_INSTANCE_CALLBACK lpCallback, void *lpData) { Instances::iterator it; for (it = _instances.begin(); it != _instances.end(); ++it) { lpCallback((it->_value)->getInstance(), lpData); diff --git a/engines/wintermute/system/sys_class.h b/engines/wintermute/system/sys_class.h index f807ea677c..bd534f8bb0 100644 --- a/engines/wintermute/system/sys_class.h +++ b/engines/wintermute/system/sys_class.h @@ -36,10 +36,10 @@ #include "common/stream.h" namespace WinterMute { -class CSysInstance; -class CBGame; -class CBPersistMgr; -class CSysClass; +class SystemInstance; +class BaseGame; +class BasePersistenceManager; +class SystemClass; } @@ -52,8 +52,8 @@ template<> struct Hash : public UnaryFunction { } }; -template<> struct Hash : public UnaryFunction { - uint operator()(WinterMute::CSysInstance *val) const { +template<> struct Hash : public UnaryFunction { + uint operator()(WinterMute::SystemInstance *val) const { return (uint)((size_t)val); } }; @@ -63,14 +63,14 @@ template<> struct Hash : public UnaryFunction Instances; - typedef Common::HashMap Instances; + //typedef std::set Instances; + typedef Common::HashMap Instances; Instances _instances; - typedef Common::HashMap InstanceMap; + typedef Common::HashMap InstanceMap; InstanceMap _instanceMap; }; diff --git a/engines/wintermute/system/sys_class_registry.cpp b/engines/wintermute/system/sys_class_registry.cpp index ce14b01385..7f7814f75c 100644 --- a/engines/wintermute/system/sys_class_registry.cpp +++ b/engines/wintermute/system/sys_class_registry.cpp @@ -37,31 +37,31 @@ namespace WinterMute { ////////////////////////////////////////////////////////////////////////// -CSysClassRegistry::CSysClassRegistry() { +SystemClassRegistry::SystemClassRegistry() { _count = 0; _disabled = false; } ////////////////////////////////////////////////////////////////////////// -CSysClassRegistry::~CSysClassRegistry() { +SystemClassRegistry::~SystemClassRegistry() { unregisterClasses(); } ////////////////////////////////////////////////////////////////////////// -CSysClassRegistry *CSysClassRegistry::getInstance() { +SystemClassRegistry *SystemClassRegistry::getInstance() { return g_wintermute->getClassRegistry(); } -void CSysClassRegistry::unregisterClasses() { - // CSysClass calls UnregisterClass upon destruction. +void SystemClassRegistry::unregisterClasses() { + // SystemClass calls UnregisterClass upon destruction. while (_classes.size() > 0) { delete _classes.begin()->_value; } } ////////////////////////////////////////////////////////////////////////// -bool CSysClassRegistry::registerClass(CSysClass *classObj) { +bool SystemClassRegistry::registerClass(SystemClass *classObj) { classObj->setID(_count++); //_classes.insert(classObj); _classes[classObj] = classObj; @@ -74,7 +74,7 @@ bool CSysClassRegistry::registerClass(CSysClass *classObj) { ////////////////////////////////////////////////////////////////////////// -bool CSysClassRegistry::unregisterClass(CSysClass *classObj) { +bool SystemClassRegistry::unregisterClass(SystemClass *classObj) { Classes::iterator it = _classes.find(classObj); if (it == _classes.end()) return false; @@ -82,7 +82,7 @@ bool CSysClassRegistry::unregisterClass(CSysClass *classObj) { if (classObj->getNumInstances() != 0) { char str[MAX_PATH_LENGTH]; sprintf(str, "Memory leak@class %-20s: %d instance(s) left\n", classObj->getName().c_str(), classObj->getNumInstances()); - CBPlatform::outputDebugString(str); + BasePlatform::outputDebugString(str); } _classes.erase(it); @@ -98,18 +98,18 @@ bool CSysClassRegistry::unregisterClass(CSysClass *classObj) { ////////////////////////////////////////////////////////////////////////// -bool CSysClassRegistry::registerInstance(const char *className, void *instance) { +bool SystemClassRegistry::registerInstance(const char *className, void *instance) { if (_disabled) return true; NameMap::iterator mapIt = _nameMap.find(className); if (mapIt == _nameMap.end()) return false; - CSysInstance *inst = (*mapIt)._value->addInstance(instance, _count++); + SystemInstance *inst = (*mapIt)._value->addInstance(instance, _count++); return (inst != NULL); } ////////////////////////////////////////////////////////////////////////// -void CSysClassRegistry::addInstanceToTable(CSysInstance *instance, void *pointer) { +void SystemClassRegistry::addInstanceToTable(SystemInstance *instance, void *pointer) { _instanceMap[pointer] = instance; if (instance->getSavedID() >= 0) @@ -117,12 +117,12 @@ void CSysClassRegistry::addInstanceToTable(CSysInstance *instance, void *pointer } ////////////////////////////////////////////////////////////////////////// -int CSysClassRegistry::getNextID() { +int SystemClassRegistry::getNextID() { return _count++; } ////////////////////////////////////////////////////////////////////////// -bool CSysClassRegistry::unregisterInstance(const char *className, void *instance) { +bool SystemClassRegistry::unregisterInstance(const char *className, void *instance) { NameMap::iterator mapIt = _nameMap.find(className); if (mapIt == _nameMap.end()) return false; (*mapIt)._value->removeInstance(instance); @@ -136,14 +136,14 @@ bool CSysClassRegistry::unregisterInstance(const char *className, void *instance ////////////////////////////////////////////////////////////////////////// -bool CSysClassRegistry::getPointerID(void *pointer, int *classID, int *instanceID) { +bool SystemClassRegistry::getPointerID(void *pointer, int *classID, int *instanceID) { if (pointer == NULL) return true; InstanceMap::iterator it = _instanceMap.find(pointer); if (it == _instanceMap.end()) return false; - CSysInstance *inst = (*it)._value; + SystemInstance *inst = (*it)._value; *instanceID = inst->getID(); *classID = inst->getClass()->getID(); @@ -151,13 +151,13 @@ bool CSysClassRegistry::getPointerID(void *pointer, int *classID, int *instanceI } ////////////////////////////////////////////////////////////////////////// -void *CSysClassRegistry::idToPointer(int classID, int instanceID) { +void *SystemClassRegistry::idToPointer(int classID, int instanceID) { SavedInstanceMap::iterator it = _savedInstanceMap.find(instanceID); if (it == _savedInstanceMap.end()) return NULL; else return (*it)._value->getInstance(); } -bool checkHeader(const char *tag, CBPersistMgr *pm) { +bool checkHeader(const char *tag, BasePersistenceManager *pm) { char *test = pm->getString(); Common::String verify = test; delete[] test; @@ -169,7 +169,7 @@ bool checkHeader(const char *tag, CBPersistMgr *pm) { } ////////////////////////////////////////////////////////////////////////// -bool CSysClassRegistry::saveTable(CBGame *gameRef, CBPersistMgr *persistMgr, bool quickSave) { +bool SystemClassRegistry::saveTable(BaseGame *gameRef, BasePersistenceManager *persistMgr, bool quickSave) { persistMgr->putString(""); persistMgr->putDWORD(_classes.size()); @@ -193,7 +193,7 @@ bool CSysClassRegistry::saveTable(CBGame *gameRef, CBPersistMgr *persistMgr, boo ////////////////////////////////////////////////////////////////////////// -bool CSysClassRegistry::loadTable(CBGame *gameRef, CBPersistMgr *persistMgr) { +bool SystemClassRegistry::loadTable(BaseGame *gameRef, BasePersistenceManager *persistMgr) { checkHeader("", persistMgr); // reset SavedID of current instances @@ -228,7 +228,7 @@ bool CSysClassRegistry::loadTable(CBGame *gameRef, CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -bool CSysClassRegistry::saveInstances(CBGame *gameRef, CBPersistMgr *persistMgr, bool quickSave) { +bool SystemClassRegistry::saveInstances(BaseGame *gameRef, BasePersistenceManager *persistMgr, bool quickSave) { Classes::iterator it; @@ -260,7 +260,7 @@ bool CSysClassRegistry::saveInstances(CBGame *gameRef, CBPersistMgr *persistMgr, } ////////////////////////////////////////////////////////////////////////// -bool CSysClassRegistry::loadInstances(CBGame *gameRef, CBPersistMgr *persistMgr) { +bool SystemClassRegistry::loadInstances(BaseGame *gameRef, BasePersistenceManager *persistMgr) { // get total instances int numInstances = persistMgr->getDWORD(); @@ -296,7 +296,7 @@ bool CSysClassRegistry::loadInstances(CBGame *gameRef, CBPersistMgr *persistMgr) ////////////////////////////////////////////////////////////////////////// -bool CSysClassRegistry::enumInstances(SYS_INSTANCE_CALLBACK lpCallback, const char *className, void *lpData) { +bool SystemClassRegistry::enumInstances(SYS_INSTANCE_CALLBACK lpCallback, const char *className, void *lpData) { NameMap::iterator mapIt = _nameMap.find(className); if (mapIt == _nameMap.end()) return STATUS_FAILED; @@ -306,7 +306,7 @@ bool CSysClassRegistry::enumInstances(SYS_INSTANCE_CALLBACK lpCallback, const ch ////////////////////////////////////////////////////////////////////////// -void CSysClassRegistry::dumpClasses(Common::WriteStream *stream) { +void SystemClassRegistry::dumpClasses(Common::WriteStream *stream) { Classes::iterator it; for (it = _classes.begin(); it != _classes.end(); ++it) (it->_value)->dump(stream); diff --git a/engines/wintermute/system/sys_class_registry.h b/engines/wintermute/system/sys_class_registry.h index e17ae9bf78..d668c57803 100644 --- a/engines/wintermute/system/sys_class_registry.h +++ b/engines/wintermute/system/sys_class_registry.h @@ -39,13 +39,13 @@ #include "common/stream.h" namespace WinterMute { -class CSysClass; +class SystemClass; } namespace Common { template struct Hash; -template<> struct Hash : public UnaryFunction { - uint operator()(WinterMute::CSysClass *val) const { +template<> struct Hash : public UnaryFunction { + uint operator()(WinterMute::SystemClass *val) const { return (uint)((size_t)val); } }; @@ -54,50 +54,50 @@ template<> struct Hash : public UnaryFunction Classes; + typedef Common::HashMap Classes; Classes _classes; - typedef Common::HashMap NameMap; + typedef Common::HashMap NameMap; NameMap _nameMap; - typedef Common::HashMap IdMap; + typedef Common::HashMap IdMap; IdMap _idMap; - typedef Common::HashMap InstanceMap; + typedef Common::HashMap InstanceMap; InstanceMap _instanceMap; - typedef Common::HashMap SavedInstanceMap; + typedef Common::HashMap SavedInstanceMap; SavedInstanceMap _savedInstanceMap; }; diff --git a/engines/wintermute/system/sys_instance.cpp b/engines/wintermute/system/sys_instance.cpp index c34c3cc64a..a5ef69647c 100644 --- a/engines/wintermute/system/sys_instance.cpp +++ b/engines/wintermute/system/sys_instance.cpp @@ -33,7 +33,7 @@ namespace WinterMute { ////////////////////////////////////////////////////////////////////////// -CSysInstance::CSysInstance(void *instance, int id, CSysClass *sysClass) { +SystemInstance::SystemInstance(void *instance, int id, SystemClass *sysClass) { _instance = instance; _id = id; _savedID = -1; @@ -43,7 +43,7 @@ CSysInstance::CSysInstance(void *instance, int id, CSysClass *sysClass) { } ////////////////////////////////////////////////////////////////////////// -CSysInstance::~CSysInstance() { +SystemInstance::~SystemInstance() { } } // end of namespace WinterMute diff --git a/engines/wintermute/system/sys_instance.h b/engines/wintermute/system/sys_instance.h index 6becd491af..493055a8fd 100644 --- a/engines/wintermute/system/sys_instance.h +++ b/engines/wintermute/system/sys_instance.h @@ -31,12 +31,12 @@ namespace WinterMute { -class CSysClass; +class SystemClass; -class CSysInstance { +class SystemInstance { public: - CSysInstance(void *Instance, int ID, CSysClass *sysClass); - virtual ~CSysInstance(); + SystemInstance(void *Instance, int ID, SystemClass *sysClass); + virtual ~SystemInstance(); int getID() const { return _id; @@ -47,7 +47,7 @@ public: void *getInstance() const { return _instance; } - CSysClass *getClass() const { + SystemClass *getClass() const { return _class; } @@ -60,7 +60,7 @@ private: int _id; int _savedID; void *_instance; - CSysClass *_class; + SystemClass *_class; }; } // end of namespace WinterMute diff --git a/engines/wintermute/ui/ui_button.cpp b/engines/wintermute/ui/ui_button.cpp index 5b1867b652..af7e3262db 100644 --- a/engines/wintermute/ui/ui_button.cpp +++ b/engines/wintermute/ui/ui_button.cpp @@ -45,10 +45,10 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CUIButton, false) +IMPLEMENT_PERSISTENT(UIButton, false) ////////////////////////////////////////////////////////////////////////// -CUIButton::CUIButton(CBGame *inGame): CUIObject(inGame) { +UIButton::UIButton(BaseGame *inGame): UIObject(inGame) { _backPress = _backHover = _backDisable = _backFocus = NULL; _fontHover = _fontPress = _fontDisable = _fontFocus = NULL; @@ -72,7 +72,7 @@ CUIButton::CUIButton(CBGame *inGame): CUIObject(inGame) { ////////////////////////////////////////////////////////////////////////// -CUIButton::~CUIButton() { +UIButton::~UIButton() { delete _backPress; delete _backHover; delete _backDisable; @@ -95,10 +95,10 @@ CUIButton::~CUIButton() { ////////////////////////////////////////////////////////////////////////// -bool CUIButton::loadFile(const char *filename) { +bool UIButton::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { - _gameRef->LOG(0, "CUIButton::LoadFile failed for file '%s'", filename); + _gameRef->LOG(0, "UIButton::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -154,7 +154,7 @@ TOKEN_DEF(PIXEL_PERFECT) TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -bool CUIButton::loadBuffer(byte *buffer, bool complete) { +bool UIButton::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(BUTTON) TOKEN_TABLE(TEMPLATE) @@ -196,7 +196,7 @@ bool CUIButton::loadBuffer(byte *buffer, bool complete) { byte *params; int cmd = 2; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); if (complete) { if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_BUTTON) { @@ -222,7 +222,7 @@ bool CUIButton::loadBuffer(byte *buffer, bool complete) { case TOKEN_BACK: delete _back; - _back = new CUITiledImage(_gameRef); + _back = new UITiledImage(_gameRef); if (!_back || DID_FAIL(_back->loadFile((char *)params))) { delete _back; _back = NULL; @@ -232,7 +232,7 @@ bool CUIButton::loadBuffer(byte *buffer, bool complete) { case TOKEN_BACK_HOVER: delete _backHover; - _backHover = new CUITiledImage(_gameRef); + _backHover = new UITiledImage(_gameRef); if (!_backHover || DID_FAIL(_backHover->loadFile((char *)params))) { delete _backHover; _backHover = NULL; @@ -242,7 +242,7 @@ bool CUIButton::loadBuffer(byte *buffer, bool complete) { case TOKEN_BACK_PRESS: delete _backPress; - _backPress = new CUITiledImage(_gameRef); + _backPress = new UITiledImage(_gameRef); if (!_backPress || DID_FAIL(_backPress->loadFile((char *)params))) { delete _backPress; _backPress = NULL; @@ -252,7 +252,7 @@ bool CUIButton::loadBuffer(byte *buffer, bool complete) { case TOKEN_BACK_DISABLE: delete _backDisable; - _backDisable = new CUITiledImage(_gameRef); + _backDisable = new UITiledImage(_gameRef); if (!_backDisable || DID_FAIL(_backDisable->loadFile((char *)params))) { delete _backDisable; _backDisable = NULL; @@ -262,7 +262,7 @@ bool CUIButton::loadBuffer(byte *buffer, bool complete) { case TOKEN_BACK_FOCUS: delete _backFocus; - _backFocus = new CUITiledImage(_gameRef); + _backFocus = new UITiledImage(_gameRef); if (!_backFocus || DID_FAIL(_backFocus->loadFile((char *)params))) { delete _backFocus; _backFocus = NULL; @@ -272,7 +272,7 @@ bool CUIButton::loadBuffer(byte *buffer, bool complete) { case TOKEN_IMAGE: delete _image; - _image = new CBSprite(_gameRef); + _image = new BaseSprite(_gameRef); if (!_image || DID_FAIL(_image->loadFile((char *)params))) { delete _image; _image = NULL; @@ -282,7 +282,7 @@ bool CUIButton::loadBuffer(byte *buffer, bool complete) { case TOKEN_IMAGE_HOVER: delete _imageHover; - _imageHover = new CBSprite(_gameRef); + _imageHover = new BaseSprite(_gameRef); if (!_imageHover || DID_FAIL(_imageHover->loadFile((char *)params))) { delete _imageHover; _imageHover = NULL; @@ -292,7 +292,7 @@ bool CUIButton::loadBuffer(byte *buffer, bool complete) { case TOKEN_IMAGE_PRESS: delete _imagePress; - _imagePress = new CBSprite(_gameRef); + _imagePress = new BaseSprite(_gameRef); if (!_imagePress || DID_FAIL(_imagePress->loadFile((char *)params))) { delete _imagePress; _imagePress = NULL; @@ -302,7 +302,7 @@ bool CUIButton::loadBuffer(byte *buffer, bool complete) { case TOKEN_IMAGE_DISABLE: delete _imageDisable; - _imageDisable = new CBSprite(_gameRef); + _imageDisable = new BaseSprite(_gameRef); if (!_imageDisable || DID_FAIL(_imageDisable->loadFile((char *)params))) { delete _imageDisable; _imageDisable = NULL; @@ -312,7 +312,7 @@ bool CUIButton::loadBuffer(byte *buffer, bool complete) { case TOKEN_IMAGE_FOCUS: delete _imageFocus; - _imageFocus = new CBSprite(_gameRef); + _imageFocus = new BaseSprite(_gameRef); if (!_imageFocus || DID_FAIL(_imageFocus->loadFile((char *)params))) { delete _imageFocus; _imageFocus = NULL; @@ -379,7 +379,7 @@ bool CUIButton::loadBuffer(byte *buffer, bool complete) { case TOKEN_CURSOR: delete _cursor; - _cursor = new CBSprite(_gameRef); + _cursor = new BaseSprite(_gameRef); if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) { delete _cursor; _cursor = NULL; @@ -439,7 +439,7 @@ bool CUIButton::loadBuffer(byte *buffer, bool complete) { } ////////////////////////////////////////////////////////////////////////// -bool CUIButton::saveAsText(CBDynBuffer *buffer, int indent) { +bool UIButton::saveAsText(BaseDynamicBuffer *buffer, int indent) { buffer->putTextIndent(indent, "BUTTON\n"); buffer->putTextIndent(indent, "{\n"); @@ -501,7 +501,7 @@ bool CUIButton::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent + 2, "TEXT_ALIGN=\"%s\"\n", "center"); break; default: - warning("CUIButton::SaveAsText - unhandled enum"); + warning("UIButton::SaveAsText - unhandled enum"); break; } @@ -531,17 +531,17 @@ bool CUIButton::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent + 2, "\n"); // editor properties - CBBase::saveAsText(buffer, indent + 2); + BaseClass::saveAsText(buffer, indent + 2); buffer->putTextIndent(indent, "}\n"); return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -void CUIButton::correctSize() { +void UIButton::correctSize() { Rect32 rect; - CBSprite *img = NULL; + BaseSprite *img = NULL; if (_image) img = _image; else if (_imageDisable) img = _imageDisable; else if (_imageHover) img = _imageHover; @@ -577,21 +577,21 @@ void CUIButton::correctSize() { ////////////////////////////////////////////////////////////////////////// -bool CUIButton::display(int offsetX, int offsetY) { +bool UIButton::display(int offsetX, int offsetY) { if (!_visible) return STATUS_OK; - CUITiledImage *back = NULL; - CBSprite *image = NULL; - CBFont *font = 0; + UITiledImage *back = NULL; + BaseSprite *image = NULL; + BaseFont *font = 0; //RECT rect; - //CBPlatform::setRect(&rect, OffsetX + _posX, OffsetY + _posY, OffsetX+_posX+_width, OffsetY+_posY+_height); - //_hover = (!_disable && CBPlatform::ptInRect(&rect, _gameRef->_mousePos)!=FALSE); + //BasePlatform::setRect(&rect, OffsetX + _posX, OffsetY + _posY, OffsetX+_posX+_width, OffsetY+_posY+_height); + //_hover = (!_disable && BasePlatform::ptInRect(&rect, _gameRef->_mousePos)!=FALSE); _hover = (!_disable && _gameRef->_activeObject == this && (_gameRef->_interactive || _gameRef->_state == GAME_SEMI_FROZEN)); if ((_press && _hover && !_gameRef->_mouseLeftDown) || - (_oneTimePress && CBPlatform::getTime() - _oneTimePressTime >= 100)) press(); + (_oneTimePress && BasePlatform::getTime() - _oneTimePressTime >= 100)) press(); if (_disable) { @@ -638,7 +638,7 @@ bool CUIButton::display(int offsetX, int offsetY) { font->drawText((byte *)_text, offsetX + _posX + ((_press || _oneTimePress) ? 1 : 0), offsetY + _posY + text_offset + ((_press || _oneTimePress) ? 1 : 0), _width, _align); } - if (!_pixelPerfect || !_image) _gameRef->_renderer->_rectList.add(new CBActiveRect(_gameRef, this, NULL, offsetX + _posX, offsetY + _posY, _width, _height, 100, 100, false)); + if (!_pixelPerfect || !_image) _gameRef->_renderer->_rectList.add(new BaseActiveRect(_gameRef, this, NULL, offsetX + _posX, offsetY + _posY, _width, _height, 100, 100, false)); // reset unused sprites if (_image && _image != image) _image->reset(); @@ -654,7 +654,7 @@ bool CUIButton::display(int offsetX, int offsetY) { ////////////////////////////////////////////////////////////////////////// -void CUIButton::press() { +void UIButton::press() { applyEvent("Press"); if (_listenerObject) _listenerObject->listen(_listenerParamObject, _listenerParamDWORD); if (_parentNotify && _parent) _parent->applyEvent(_name); @@ -666,13 +666,13 @@ void CUIButton::press() { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -bool CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // SetDisabledFont ////////////////////////////////////////////////////////////////////////// if (strcmp(name, "SetDisabledFont") == 0) { stack->correctParams(1); - CScValue *Val = stack->pop(); + ScValue *Val = stack->pop(); if (_fontDisable) _gameRef->_fontStorage->removeFont(_fontDisable); if (Val->isNULL()) { @@ -690,7 +690,7 @@ bool CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "SetHoverFont") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); if (_fontHover) _gameRef->_fontStorage->removeFont(_fontHover); if (val->isNULL()) { @@ -708,7 +708,7 @@ bool CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "SetPressedFont") == 0) { stack->correctParams(1); - CScValue *Val = stack->pop(); + ScValue *Val = stack->pop(); if (_fontPress) _gameRef->_fontStorage->removeFont(_fontPress); if (Val->isNULL()) { @@ -726,7 +726,7 @@ bool CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "SetFocusedFont") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); if (_fontFocus) _gameRef->_fontStorage->removeFont(_fontFocus); if (val->isNULL()) { @@ -746,7 +746,7 @@ bool CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS stack->correctParams(1); delete _imageDisable; - _imageDisable = new CBSprite(_gameRef); + _imageDisable = new BaseSprite(_gameRef); const char *filename = stack->pop()->getString(); if (!_imageDisable || DID_FAIL(_imageDisable->loadFile(filename))) { delete _imageDisable; @@ -787,7 +787,7 @@ bool CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS stack->correctParams(1); delete _imageHover; - _imageHover = new CBSprite(_gameRef); + _imageHover = new BaseSprite(_gameRef); const char *filename = stack->pop()->getString(); if (!_imageHover || DID_FAIL(_imageHover->loadFile(filename))) { delete _imageHover; @@ -827,7 +827,7 @@ bool CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS stack->correctParams(1); delete _imagePress; - _imagePress = new CBSprite(_gameRef); + _imagePress = new BaseSprite(_gameRef); const char *filename = stack->pop()->getString(); if (!_imagePress || DID_FAIL(_imagePress->loadFile(filename))) { delete _imagePress; @@ -867,7 +867,7 @@ bool CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS stack->correctParams(1); delete _imageFocus; - _imageFocus = new CBSprite(_gameRef); + _imageFocus = new BaseSprite(_gameRef); const char *filename = stack->pop()->getString(); if (!_imageFocus || DID_FAIL(_imageFocus->loadFile(filename))) { delete _imageFocus; @@ -908,7 +908,7 @@ bool CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS if (_visible && !_disable) { _oneTimePress = true; - _oneTimePressTime = CBPlatform::getTime(); + _oneTimePressTime = BasePlatform::getTime(); } stack->pushNULL(); @@ -916,12 +916,12 @@ bool CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS } - else return CUIObject::scCallMethod(script, stack, thisStack, name); + else return UIObject::scCallMethod(script, stack, thisStack, name); } ////////////////////////////////////////////////////////////////////////// -CScValue *CUIButton::scGetProperty(const char *name) { +ScValue *UIButton::scGetProperty(const char *name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// @@ -962,12 +962,12 @@ CScValue *CUIButton::scGetProperty(const char *name) { return _scValue; } - else return CUIObject::scGetProperty(name); + else return UIObject::scGetProperty(name); } ////////////////////////////////////////////////////////////////////////// -bool CUIButton::scSetProperty(const char *name, CScValue *value) { +bool UIButton::scSetProperty(const char *name, ScValue *value) { ////////////////////////////////////////////////////////////////////////// // TextAlign ////////////////////////////////////////////////////////////////////////// @@ -1000,20 +1000,20 @@ bool CUIButton::scSetProperty(const char *name, CScValue *value) { return STATUS_OK; } - else return CUIObject::scSetProperty(name, value); + else return UIObject::scSetProperty(name, value); } ////////////////////////////////////////////////////////////////////////// -const char *CUIButton::scToString() { +const char *UIButton::scToString() { return "[button]"; } ////////////////////////////////////////////////////////////////////////// -bool CUIButton::persist(CBPersistMgr *persistMgr) { +bool UIButton::persist(BasePersistenceManager *persistMgr) { - CUIObject::persist(persistMgr); + UIObject::persist(persistMgr); persistMgr->transfer(TMEMBER_INT(_align)); persistMgr->transfer(TMEMBER(_backDisable)); diff --git a/engines/wintermute/ui/ui_button.h b/engines/wintermute/ui/ui_button.h index c6538f4423..5c034d6113 100644 --- a/engines/wintermute/ui/ui_button.h +++ b/engines/wintermute/ui/ui_button.h @@ -35,42 +35,42 @@ namespace WinterMute { -class CUIButton : public CUIObject { +class UIButton : public UIObject { public: bool _pixelPerfect; bool _stayPressed; bool _centerImage; bool _oneTimePress; uint32 _oneTimePressTime; - DECLARE_PERSISTENT(CUIButton, CUIObject) + DECLARE_PERSISTENT(UIButton, UIObject) void press(); virtual bool display(int offsetX = 0, int offsetY = 0); bool _press; bool _hover; void correctSize(); TTextAlign _align; - CBSprite *_imageHover; - CBSprite *_imagePress; - CBSprite *_imageDisable; - CBSprite *_imageFocus; - CBFont *_fontDisable; - CBFont *_fontPress; - CBFont *_fontHover; - CBFont *_fontFocus; - CUITiledImage *_backPress; - CUITiledImage *_backHover; - CUITiledImage *_backDisable; - CUITiledImage *_backFocus; - CUIButton(CBGame *inGame = NULL); - virtual ~CUIButton(); + BaseSprite *_imageHover; + BaseSprite *_imagePress; + BaseSprite *_imageDisable; + BaseSprite *_imageFocus; + BaseFont *_fontDisable; + BaseFont *_fontPress; + BaseFont *_fontHover; + BaseFont *_fontFocus; + UITiledImage *_backPress; + UITiledImage *_backHover; + UITiledImage *_backDisable; + UITiledImage *_backFocus; + UIButton(BaseGame *inGame = NULL); + virtual ~UIButton(); bool loadFile(const char *filename); bool loadBuffer(byte *buffer, bool complete = true); - virtual bool saveAsText(CBDynBuffer *buffer, int indent); + virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent); // scripting interface - virtual CScValue *scGetProperty(const char *name); - virtual bool scSetProperty(const char *name, CScValue *value); - virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual ScValue *scGetProperty(const char *name); + virtual bool scSetProperty(const char *name, ScValue *value); + virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); virtual const char *scToString(); }; diff --git a/engines/wintermute/ui/ui_edit.cpp b/engines/wintermute/ui/ui_edit.cpp index 237b944332..d9c6c6586a 100644 --- a/engines/wintermute/ui/ui_edit.cpp +++ b/engines/wintermute/ui/ui_edit.cpp @@ -50,10 +50,10 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CUIEdit, false) +IMPLEMENT_PERSISTENT(UIEdit, false) ////////////////////////////////////////////////////////////////////////// -CUIEdit::CUIEdit(CBGame *inGame): CUIObject(inGame) { +UIEdit::UIEdit(BaseGame *inGame): UIObject(inGame) { _type = UI_EDIT; _fontSelected = NULL; @@ -80,7 +80,7 @@ CUIEdit::CUIEdit(CBGame *inGame): CUIObject(inGame) { ////////////////////////////////////////////////////////////////////////// -CUIEdit::~CUIEdit() { +UIEdit::~UIEdit() { if (!_sharedFonts) { if (_fontSelected) _gameRef->_fontStorage->removeFont(_fontSelected); } @@ -91,10 +91,10 @@ CUIEdit::~CUIEdit() { ////////////////////////////////////////////////////////////////////////// -bool CUIEdit::loadFile(const char *filename) { +bool UIEdit::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { - _gameRef->LOG(0, "CUIEdit::LoadFile failed for file '%s'", filename); + _gameRef->LOG(0, "UIEdit::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -136,7 +136,7 @@ TOKEN_DEF(EDIT) TOKEN_DEF(CAPTION) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -bool CUIEdit::loadBuffer(byte *buffer, bool complete) { +bool UIEdit::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(TEMPLATE) TOKEN_TABLE(DISABLED) @@ -164,7 +164,7 @@ bool CUIEdit::loadBuffer(byte *buffer, bool complete) { byte *params; int cmd = 2; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); if (complete) { if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_EDIT) { @@ -186,7 +186,7 @@ bool CUIEdit::loadBuffer(byte *buffer, bool complete) { case TOKEN_BACK: delete _back; - _back = new CUITiledImage(_gameRef); + _back = new UITiledImage(_gameRef); if (!_back || DID_FAIL(_back->loadFile((char *)params))) { delete _back; _back = NULL; @@ -196,7 +196,7 @@ bool CUIEdit::loadBuffer(byte *buffer, bool complete) { case TOKEN_IMAGE: delete _image; - _image = new CBSprite(_gameRef); + _image = new BaseSprite(_gameRef); if (!_image || DID_FAIL(_image->loadFile((char *)params))) { delete _image; _image = NULL; @@ -247,7 +247,7 @@ bool CUIEdit::loadBuffer(byte *buffer, bool complete) { case TOKEN_CURSOR: delete _cursor; - _cursor = new CBSprite(_gameRef); + _cursor = new BaseSprite(_gameRef); if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) { delete _cursor; _cursor = NULL; @@ -299,7 +299,7 @@ bool CUIEdit::loadBuffer(byte *buffer, bool complete) { } ////////////////////////////////////////////////////////////////////////// -bool CUIEdit::saveAsText(CBDynBuffer *buffer, int indent) { +bool UIEdit::saveAsText(BaseDynamicBuffer *buffer, int indent) { buffer->putTextIndent(indent, "EDIT\n"); buffer->putTextIndent(indent, "{\n"); @@ -349,7 +349,7 @@ bool CUIEdit::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent + 2, "\n"); // editor properties - CBBase::saveAsText(buffer, indent + 2); + BaseClass::saveAsText(buffer, indent + 2); buffer->putTextIndent(indent, "}\n"); return STATUS_OK; @@ -358,7 +358,7 @@ bool CUIEdit::saveAsText(CBDynBuffer *buffer, int indent) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -bool CUIEdit::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool UIEdit::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // SetSelectedFont ////////////////////////////////////////////////////////////////////////// @@ -372,12 +372,12 @@ bool CUIEdit::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSta return STATUS_OK; } - else return CUIObject::scCallMethod(script, stack, thisStack, name); + else return UIObject::scCallMethod(script, stack, thisStack, name); } ////////////////////////////////////////////////////////////////////////// -CScValue *CUIEdit::scGetProperty(const char *name) { +ScValue *UIEdit::scGetProperty(const char *name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// @@ -449,12 +449,12 @@ CScValue *CUIEdit::scGetProperty(const char *name) { return _scValue; } - else return CUIObject::scGetProperty(name); + else return UIObject::scGetProperty(name); } ////////////////////////////////////////////////////////////////////////// -bool CUIEdit::scSetProperty(const char *name, CScValue *value) { +bool UIEdit::scSetProperty(const char *name, ScValue *value) { ////////////////////////////////////////////////////////////////////////// // SelStart ////////////////////////////////////////////////////////////////////////// @@ -520,18 +520,18 @@ bool CUIEdit::scSetProperty(const char *name, CScValue *value) { return STATUS_OK; } - else return CUIObject::scSetProperty(name, value); + else return UIObject::scSetProperty(name, value); } ////////////////////////////////////////////////////////////////////////// -const char *CUIEdit::scToString() { +const char *UIEdit::scToString() { return "[edit]"; } ////////////////////////////////////////////////////////////////////////// -void CUIEdit::setCursorChar(const char *character) { +void UIEdit::setCursorChar(const char *character) { if (!character) return; delete[] _cursorChar; _cursorChar = new char [strlen(character) + 1]; @@ -540,7 +540,7 @@ void CUIEdit::setCursorChar(const char *character) { ////////////////////////////////////////////////////////////////////////// -bool CUIEdit::display(int offsetX, int offsetY) { +bool UIEdit::display(int offsetX, int offsetY) { if (!_visible) return STATUS_OK; @@ -552,8 +552,8 @@ bool CUIEdit::display(int offsetX, int offsetY) { if (_image) _image->draw(offsetX + _posX, offsetY + _posY, NULL); // prepare fonts - CBFont *font; - CBFont *sfont; + BaseFont *font; + BaseFont *sfont; if (_font) font = _font; else font = _gameRef->_systemFont; @@ -630,8 +630,8 @@ bool CUIEdit::display(int offsetX, int offsetY) { // cursor if (focused && curFirst) { if (Count) { - if (CBPlatform::getTime() - _lastBlinkTime >= _cursorBlinkRate) { - _lastBlinkTime = CBPlatform::getTime(); + if (BasePlatform::getTime() - _lastBlinkTime >= _cursorBlinkRate) { + _lastBlinkTime = BasePlatform::getTime(); _cursorVisible = !_cursorVisible; } if (_cursorVisible) @@ -653,8 +653,8 @@ bool CUIEdit::display(int offsetX, int offsetY) { // cursor if (focused && !curFirst) { if (Count) { - if (CBPlatform::getTime() - _lastBlinkTime >= _cursorBlinkRate) { - _lastBlinkTime = CBPlatform::getTime(); + if (BasePlatform::getTime() - _lastBlinkTime >= _cursorBlinkRate) { + _lastBlinkTime = BasePlatform::getTime(); _cursorVisible = !_cursorVisible; } if (_cursorVisible) @@ -673,7 +673,7 @@ bool CUIEdit::display(int offsetX, int offsetY) { } - _gameRef->_renderer->_rectList.add(new CBActiveRect(_gameRef, this, NULL, offsetX + _posX, offsetY + _posY, _width, _height, 100, 100, false)); + _gameRef->_renderer->_rectList.add(new BaseActiveRect(_gameRef, this, NULL, offsetX + _posX, offsetY + _posY, _width, _height, 100, 100, false)); _gameRef->_textEncoding = OrigEncoding; @@ -683,7 +683,7 @@ bool CUIEdit::display(int offsetX, int offsetY) { ////////////////////////////////////////////////////////////////////////// -bool CUIEdit::handleKeypress(Common::Event *event, bool printable) { +bool UIEdit::handleKeypress(Common::Event *event, bool printable) { bool handled = false; if (event->type == Common::EVENT_KEYDOWN && !printable) { @@ -695,7 +695,7 @@ bool CUIEdit::handleKeypress(Common::Event *event, bool printable) { // ctrl+A case Common::KEYCODE_a: - if (CBKeyboardState::isControlDown()) { + if (BaseKeyboardState::isControlDown()) { _selStart = 0; _selEnd = strlen(_text); handled = true; @@ -716,24 +716,24 @@ bool CUIEdit::handleKeypress(Common::Event *event, bool printable) { case Common::KEYCODE_LEFT: case Common::KEYCODE_UP: _selEnd--; - if (!CBKeyboardState::isShiftDown()) _selStart = _selEnd; + if (!BaseKeyboardState::isShiftDown()) _selStart = _selEnd; handled = true; break; case Common::KEYCODE_RIGHT: case Common::KEYCODE_DOWN: _selEnd++; - if (!CBKeyboardState::isShiftDown()) _selStart = _selEnd; + if (!BaseKeyboardState::isShiftDown()) _selStart = _selEnd; handled = true; break; case Common::KEYCODE_HOME: if (_gameRef->_textRTL) { _selEnd = strlen(_text); - if (!CBKeyboardState::isShiftDown()) _selStart = _selEnd; + if (!BaseKeyboardState::isShiftDown()) _selStart = _selEnd; } else { _selEnd = 0; - if (!CBKeyboardState::isShiftDown()) _selStart = _selEnd; + if (!BaseKeyboardState::isShiftDown()) _selStart = _selEnd; } handled = true; break; @@ -741,10 +741,10 @@ bool CUIEdit::handleKeypress(Common::Event *event, bool printable) { case Common::KEYCODE_END: if (_gameRef->_textRTL) { _selEnd = 0; - if (!CBKeyboardState::isShiftDown()) _selStart = _selEnd; + if (!BaseKeyboardState::isShiftDown()) _selStart = _selEnd; } else { _selEnd = strlen(_text); - if (!CBKeyboardState::isShiftDown()) _selStart = _selEnd; + if (!BaseKeyboardState::isShiftDown()) _selStart = _selEnd; } handled = true; break; @@ -786,8 +786,8 @@ bool CUIEdit::handleKeypress(Common::Event *event, bool printable) { ////////////////////////////////////////////////////////////////////////// -int CUIEdit::deleteChars(int start, int end) { - if (start > end) CBUtils::swap(&start, &end); +int UIEdit::deleteChars(int start, int end) { + if (start > end) BaseUtils::swap(&start, &end); start = MAX(start, (int)0); end = MIN((size_t)end, strlen(_text)); @@ -807,7 +807,7 @@ int CUIEdit::deleteChars(int start, int end) { ////////////////////////////////////////////////////////////////////////// -int CUIEdit::insertChars(int pos, byte *chars, int num) { +int UIEdit::insertChars(int pos, byte *chars, int num) { if ((int)strlen(_text) + num > _maxLength) { num -= (strlen(_text) + num - _maxLength); } @@ -833,9 +833,9 @@ int CUIEdit::insertChars(int pos, byte *chars, int num) { ////////////////////////////////////////////////////////////////////////// -bool CUIEdit::persist(CBPersistMgr *persistMgr) { +bool UIEdit::persist(BasePersistenceManager *persistMgr) { - CUIObject::persist(persistMgr); + UIObject::persist(persistMgr); persistMgr->transfer(TMEMBER(_cursorBlinkRate)); persistMgr->transfer(TMEMBER(_cursorChar)); diff --git a/engines/wintermute/ui/ui_edit.h b/engines/wintermute/ui/ui_edit.h index 400cd7b578..221b8aa151 100644 --- a/engines/wintermute/ui/ui_edit.h +++ b/engines/wintermute/ui/ui_edit.h @@ -34,10 +34,10 @@ #include "common/events.h" namespace WinterMute { -class CBFont; -class CUIEdit : public CUIObject { +class BaseFont; +class UIEdit : public UIObject { public: - DECLARE_PERSISTENT(CUIEdit, CUIObject) + DECLARE_PERSISTENT(UIEdit, UIObject) int _maxLength; int insertChars(int pos, byte *chars, int num); int deleteChars(int start, int end); @@ -52,18 +52,18 @@ public: char *_cursorChar; int _selEnd; int _selStart; - CBFont *_fontSelected; - CUIEdit(CBGame *inGame); - virtual ~CUIEdit(); + BaseFont *_fontSelected; + UIEdit(BaseGame *inGame); + virtual ~UIEdit(); bool loadFile(const char *filename); bool loadBuffer(byte *buffer, bool complete = true); - virtual bool saveAsText(CBDynBuffer *buffer, int indent); + virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent); // scripting interface - virtual CScValue *scGetProperty(const char *name); - virtual bool scSetProperty(const char *name, CScValue *value); - virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual ScValue *scGetProperty(const char *name); + virtual bool scSetProperty(const char *name, ScValue *value); + virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); virtual const char *scToString(); }; diff --git a/engines/wintermute/ui/ui_entity.cpp b/engines/wintermute/ui/ui_entity.cpp index 012ff0390f..acbcd2430f 100644 --- a/engines/wintermute/ui/ui_entity.cpp +++ b/engines/wintermute/ui/ui_entity.cpp @@ -38,27 +38,27 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CUIEntity, false) +IMPLEMENT_PERSISTENT(UIEntity, false) ////////////////////////////////////////////////////////////////////////// -CUIEntity::CUIEntity(CBGame *inGame): CUIObject(inGame) { +UIEntity::UIEntity(BaseGame *inGame): UIObject(inGame) { _type = UI_CUSTOM; _entity = NULL; } ////////////////////////////////////////////////////////////////////////// -CUIEntity::~CUIEntity() { +UIEntity::~UIEntity() { if (_entity) _gameRef->unregisterObject(_entity); _entity = NULL; } ////////////////////////////////////////////////////////////////////////// -bool CUIEntity::loadFile(const char *filename) { +bool UIEntity::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { - _gameRef->LOG(0, "CUIEntity::LoadFile failed for file '%s'", filename); + _gameRef->LOG(0, "UIEntity::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -89,7 +89,7 @@ TOKEN_DEF(SCRIPT) TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -bool CUIEntity::loadBuffer(byte *buffer, bool complete) { +bool UIEntity::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(ENTITY_CONTAINER) TOKEN_TABLE(TEMPLATE) @@ -105,7 +105,7 @@ bool CUIEntity::loadBuffer(byte *buffer, bool complete) { byte *params; int cmd = 2; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); if (complete) { if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_ENTITY_CONTAINER) { @@ -174,7 +174,7 @@ bool CUIEntity::loadBuffer(byte *buffer, bool complete) { } ////////////////////////////////////////////////////////////////////////// -bool CUIEntity::saveAsText(CBDynBuffer *buffer, int indent) { +bool UIEntity::saveAsText(BaseDynamicBuffer *buffer, int indent) { buffer->putTextIndent(indent, "ENTITY_CONTAINER\n"); buffer->putTextIndent(indent, "{\n"); @@ -201,16 +201,16 @@ bool CUIEntity::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent + 2, "\n"); // editor properties - CBBase::saveAsText(buffer, indent + 2); + BaseClass::saveAsText(buffer, indent + 2); buffer->putTextIndent(indent, "}\n"); return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CUIEntity::setEntity(const char *filename) { +bool UIEntity::setEntity(const char *filename) { if (_entity) _gameRef->unregisterObject(_entity); - _entity = new CAdEntity(_gameRef); + _entity = new AdEntity(_gameRef); if (!_entity || DID_FAIL(_entity->loadFile(filename))) { delete _entity; _entity = NULL; @@ -225,7 +225,7 @@ bool CUIEntity::setEntity(const char *filename) { } ////////////////////////////////////////////////////////////////////////// -bool CUIEntity::display(int offsetX, int offsetY) { +bool UIEntity::display(int offsetX, int offsetY) { if (!_visible) return STATUS_OK; if (_entity) { @@ -251,7 +251,7 @@ bool CUIEntity::display(int offsetX, int offsetY) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -bool CUIEntity::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool UIEntity::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // GetEntity ////////////////////////////////////////////////////////////////////////// @@ -280,12 +280,12 @@ bool CUIEntity::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS return STATUS_OK; } - else return CUIObject::scCallMethod(script, stack, thisStack, name); + else return UIObject::scCallMethod(script, stack, thisStack, name); } ////////////////////////////////////////////////////////////////////////// -CScValue *CUIEntity::scGetProperty(const char *name) { +ScValue *UIEntity::scGetProperty(const char *name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// @@ -305,32 +305,32 @@ CScValue *CUIEntity::scGetProperty(const char *name) { return _scValue; } - else return CUIObject::scGetProperty(name); + else return UIObject::scGetProperty(name); } ////////////////////////////////////////////////////////////////////////// -bool CUIEntity::scSetProperty(const char *name, CScValue *value) { +bool UIEntity::scSetProperty(const char *name, ScValue *value) { ////////////////////////////////////////////////////////////////////////// // Freezable ////////////////////////////////////////////////////////////////////////// if (strcmp(name, "Freezable") == 0) { if (_entity) _entity->makeFreezable(value->getBool()); return STATUS_OK; - } else return CUIObject::scSetProperty(name, value); + } else return UIObject::scSetProperty(name, value); } ////////////////////////////////////////////////////////////////////////// -const char *CUIEntity::scToString() { +const char *UIEntity::scToString() { return "[entity container]"; } ////////////////////////////////////////////////////////////////////////// -bool CUIEntity::persist(CBPersistMgr *persistMgr) { +bool UIEntity::persist(BasePersistenceManager *persistMgr) { - CUIObject::persist(persistMgr); + UIObject::persist(persistMgr); persistMgr->transfer(TMEMBER(_entity)); return STATUS_OK; diff --git a/engines/wintermute/ui/ui_entity.h b/engines/wintermute/ui/ui_entity.h index 6873000681..9c9bffdc4a 100644 --- a/engines/wintermute/ui/ui_entity.h +++ b/engines/wintermute/ui/ui_entity.h @@ -32,24 +32,24 @@ #include "engines/wintermute/ui/ui_object.h" namespace WinterMute { -class CAdEntity; -class CUIEntity : public CUIObject { +class AdEntity; +class UIEntity : public UIObject { public: - DECLARE_PERSISTENT(CUIEntity, CUIObject) - CUIEntity(CBGame *inGame); - virtual ~CUIEntity(); + DECLARE_PERSISTENT(UIEntity, UIObject) + UIEntity(BaseGame *inGame); + virtual ~UIEntity(); bool loadFile(const char *filename); bool loadBuffer(byte *buffer, bool complete); - virtual bool saveAsText(CBDynBuffer *buffer, int indent); + virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent); virtual bool display(int offsetX = 0, int offsetY = 0); - CAdEntity *_entity; + AdEntity *_entity; bool setEntity(const char *filename); // scripting interface - virtual CScValue *scGetProperty(const char *name); - virtual bool scSetProperty(const char *name, CScValue *value); - virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual ScValue *scGetProperty(const char *name); + virtual bool scSetProperty(const char *name, ScValue *value); + virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); virtual const char *scToString(); }; diff --git a/engines/wintermute/ui/ui_object.cpp b/engines/wintermute/ui/ui_object.cpp index 605b5b74b1..20fd6c363f 100644 --- a/engines/wintermute/ui/ui_object.cpp +++ b/engines/wintermute/ui/ui_object.cpp @@ -38,10 +38,10 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CUIObject, false) +IMPLEMENT_PERSISTENT(UIObject, false) ////////////////////////////////////////////////////////////////////////// -CUIObject::CUIObject(CBGame *inGame): CBObject(inGame) { +UIObject::UIObject(BaseGame *inGame): BaseObject(inGame) { _back = NULL; _image = NULL; _font = NULL; @@ -70,8 +70,8 @@ CUIObject::CUIObject(CBGame *inGame): CBObject(inGame) { ////////////////////////////////////////////////////////////////////////// -CUIObject::~CUIObject() { - if (!_gameRef->_loadInProgress) CSysClassRegistry::getInstance()->enumInstances(CBGame::invalidateValues, "CScValue", (void *)this); +UIObject::~UIObject() { + if (!_gameRef->_loadInProgress) SystemClassRegistry::getInstance()->enumInstances(BaseGame::invalidateValues, "ScValue", (void *)this); if (_back) delete _back; if (_font && !_sharedFonts) _gameRef->_fontStorage->removeFont(_font); @@ -85,7 +85,7 @@ CUIObject::~CUIObject() { ////////////////////////////////////////////////////////////////////////// -void CUIObject::setText(const char *text) { +void UIObject::setText(const char *text) { if (_text) delete [] _text; _text = new char [strlen(text) + 1]; if (_text) { @@ -98,13 +98,13 @@ void CUIObject::setText(const char *text) { ////////////////////////////////////////////////////////////////////////// -bool CUIObject::display(int offsetX, int offsetY) { +bool UIObject::display(int offsetX, int offsetY) { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -void CUIObject::setListener(CBScriptHolder *object, CBScriptHolder *listenerObject, uint32 listenerParam) { +void UIObject::setListener(BaseScriptHolder *object, BaseScriptHolder *listenerObject, uint32 listenerParam) { _listenerObject = object; _listenerParamObject = listenerObject; _listenerParamDWORD = listenerParam; @@ -112,7 +112,7 @@ void CUIObject::setListener(CBScriptHolder *object, CBScriptHolder *listenerObje ////////////////////////////////////////////////////////////////////////// -void CUIObject::correctSize() { +void UIObject::correctSize() { Rect32 rect; if (_width <= 0) { @@ -137,13 +137,13 @@ void CUIObject::correctSize() { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -bool CUIObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool UIObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // SetFont ////////////////////////////////////////////////////////////////////////// if (strcmp(name, "SetFont") == 0) { stack->correctParams(1); - CScValue *Val = stack->pop(); + ScValue *Val = stack->pop(); if (_font) _gameRef->_fontStorage->removeFont(_font); if (Val->isNULL()) { @@ -161,7 +161,7 @@ bool CUIObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "SetImage") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); /* const char *filename = */ val->getString(); @@ -172,7 +172,7 @@ bool CUIObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS return STATUS_OK; } - _image = new CBSprite(_gameRef); + _image = new BaseSprite(_gameRef); if (!_image || DID_FAIL(_image->loadFile(val->getString()))) { delete _image; _image = NULL; @@ -221,14 +221,14 @@ bool CUIObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS stack->correctParams(1); if (_parent && _parent->_type == UI_WINDOW) { - CUIWindow *win = (CUIWindow *)_parent; + UIWindow *win = (UIWindow *)_parent; int i; bool found = false; - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); // find directly if (val->isNative()) { - CUIObject *widget = (CUIObject *)val->getNative(); + UIObject *widget = (UIObject *)val->getNative(); for (i = 0; i < win->_widgets.getSize(); i++) { if (win->_widgets[i] == widget) { found = true; @@ -277,7 +277,7 @@ bool CUIObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS stack->correctParams(0); if (_parent && _parent->_type == UI_WINDOW) { - CUIWindow *win = (CUIWindow *)_parent; + UIWindow *win = (UIWindow *)_parent; for (int i = 0; i < win->_widgets.getSize(); i++) { if (win->_widgets[i] == this) { win->_widgets.removeAt(i); @@ -298,7 +298,7 @@ bool CUIObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS stack->correctParams(0); if (_parent && _parent->_type == UI_WINDOW) { - CUIWindow *win = (CUIWindow *)_parent; + UIWindow *win = (UIWindow *)_parent; for (int i = 0; i < win->_widgets.getSize(); i++) { if (win->_widgets[i] == this) { win->_widgets.removeAt(i); @@ -312,12 +312,12 @@ bool CUIObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS return STATUS_OK; } - else return CBObject::scCallMethod(script, stack, thisStack, name); + else return BaseObject::scCallMethod(script, stack, thisStack, name); } ////////////////////////////////////////////////////////////////////////// -CScValue *CUIObject::scGetProperty(const char *name) { +ScValue *UIObject::scGetProperty(const char *name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// @@ -398,7 +398,7 @@ CScValue *CUIObject::scGetProperty(const char *name) { else if (strcmp(name, "NextSibling") == 0 || strcmp(name, "PrevSibling") == 0) { _scValue->setNULL(); if (_parent && _parent->_type == UI_WINDOW) { - CUIWindow *win = (CUIWindow *)_parent; + UIWindow *win = (UIWindow *)_parent; for (int i = 0; i < win->_widgets.getSize(); i++) { if (win->_widgets[i] == this) { if (strcmp(name, "NextSibling") == 0) { @@ -413,12 +413,12 @@ CScValue *CUIObject::scGetProperty(const char *name) { return _scValue; } - else return CBObject::scGetProperty(name); + else return BaseObject::scGetProperty(name); } ////////////////////////////////////////////////////////////////////////// -bool CUIObject::scSetProperty(const char *name, CScValue *value) { +bool UIObject::scSetProperty(const char *name, ScValue *value) { ////////////////////////////////////////////////////////////////////////// // Name ////////////////////////////////////////////////////////////////////////// @@ -475,22 +475,22 @@ bool CUIObject::scSetProperty(const char *name, CScValue *value) { return STATUS_OK; } - else return CBObject::scSetProperty(name, value); + else return BaseObject::scSetProperty(name, value); } ////////////////////////////////////////////////////////////////////////// -const char *CUIObject::scToString() { +const char *UIObject::scToString() { return "[ui_object]"; } ////////////////////////////////////////////////////////////////////////// -bool CUIObject::isFocused() { +bool UIObject::isFocused() { if (!_gameRef->_focusedWindow) return false; if (_gameRef->_focusedWindow == this) return true; - CUIObject *obj = _gameRef->_focusedWindow; + UIObject *obj = _gameRef->_focusedWindow; while (obj) { if (obj == this) return true; else obj = obj->_focusedWidget; @@ -500,18 +500,18 @@ bool CUIObject::isFocused() { ////////////////////////////////////////////////////////////////////////// -bool CUIObject::handleMouse(TMouseEvent event, TMouseButton button) { +bool UIObject::handleMouse(TMouseEvent event, TMouseButton button) { // handle focus change if (event == MOUSE_CLICK && button == MOUSE_BUTTON_LEFT) { focus(); } - return CBObject::handleMouse(event, button); + return BaseObject::handleMouse(event, button); } ////////////////////////////////////////////////////////////////////////// -bool CUIObject::focus() { - CUIObject *obj = this; +bool UIObject::focus() { + UIObject *obj = this; bool disabled = false; while (obj) { if (obj->_disable && obj->_type == UI_WINDOW) { @@ -526,7 +526,7 @@ bool CUIObject::focus() { if (obj->_parent) { if (!obj->_disable && obj->_canFocus) obj->_parent->_focusedWidget = obj; } else { - if (obj->_type == UI_WINDOW) _gameRef->focusWindow((CUIWindow *)obj); + if (obj->_type == UI_WINDOW) _gameRef->focusWindow((UIWindow *)obj); } obj = obj->_parent; @@ -537,10 +537,10 @@ bool CUIObject::focus() { ////////////////////////////////////////////////////////////////////////// -bool CUIObject::getTotalOffset(int *offsetX, int *offsetY) { +bool UIObject::getTotalOffset(int *offsetX, int *offsetY) { int offX = 0, offY = 0; - CUIObject *obj = _parent; + UIObject *obj = _parent; while (obj) { offX += obj->_posX; offY += obj->_posY; @@ -555,9 +555,9 @@ bool CUIObject::getTotalOffset(int *offsetX, int *offsetY) { ////////////////////////////////////////////////////////////////////////// -bool CUIObject::persist(CBPersistMgr *persistMgr) { +bool UIObject::persist(BasePersistenceManager *persistMgr) { - CBObject::persist(persistMgr); + BaseObject::persist(persistMgr); persistMgr->transfer(TMEMBER(_back)); persistMgr->transfer(TMEMBER(_canFocus)); @@ -582,7 +582,7 @@ bool CUIObject::persist(CBPersistMgr *persistMgr) { } ////////////////////////////////////////////////////////////////////////// -bool CUIObject::saveAsText(CBDynBuffer *buffer, int indent) { +bool UIObject::saveAsText(BaseDynamicBuffer *buffer, int indent) { return STATUS_FAILED; } diff --git a/engines/wintermute/ui/ui_object.h b/engines/wintermute/ui/ui_object.h index 35bd092592..64cd711dcc 100644 --- a/engines/wintermute/ui/ui_object.h +++ b/engines/wintermute/ui/ui_object.h @@ -35,9 +35,9 @@ namespace WinterMute { -class CUITiledImage; -class CBFont; -class CUIObject : public CBObject { +class UITiledImage; +class BaseFont; +class UIObject : public BaseObject { public: bool getTotalOffset(int *offsetX, int *offsetY); @@ -46,35 +46,35 @@ public: virtual bool handleMouse(TMouseEvent event, TMouseButton button); bool isFocused(); bool _parentNotify; - DECLARE_PERSISTENT(CUIObject, CBObject) - CUIObject *_parent; + DECLARE_PERSISTENT(UIObject, BaseObject) + UIObject *_parent; virtual bool display(int offsetX = 0, int offsetY = 0); virtual void correctSize(); bool _sharedFonts; bool _sharedImages; void setText(const char *text); char *_text; - CBFont *_font; + BaseFont *_font; bool _visible; - CUITiledImage *_back; + UITiledImage *_back; bool _disable; - CUIObject(CBGame *inGame = NULL); - virtual ~CUIObject(); + UIObject(BaseGame *inGame = NULL); + virtual ~UIObject(); int _width; int _height; TUIObjectType _type; - CBSprite *_image; - void setListener(CBScriptHolder *object, CBScriptHolder *listenerObject, uint32 listenerParam); - CBScriptHolder *_listenerParamObject; + BaseSprite *_image; + void setListener(BaseScriptHolder *object, BaseScriptHolder *listenerObject, uint32 listenerParam); + BaseScriptHolder *_listenerParamObject; uint32 _listenerParamDWORD; - CBScriptHolder *_listenerObject; - CUIObject *_focusedWidget; - virtual bool saveAsText(CBDynBuffer *buffer, int indent); + BaseScriptHolder *_listenerObject; + UIObject *_focusedWidget; + virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent); // scripting interface - virtual CScValue *scGetProperty(const char *name); - virtual bool scSetProperty(const char *name, CScValue *value); - virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual ScValue *scGetProperty(const char *name); + virtual bool scSetProperty(const char *name, ScValue *value); + virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); virtual const char *scToString(); }; diff --git a/engines/wintermute/ui/ui_text.cpp b/engines/wintermute/ui/ui_text.cpp index 6309d05a1e..fdf7f6287f 100644 --- a/engines/wintermute/ui/ui_text.cpp +++ b/engines/wintermute/ui/ui_text.cpp @@ -44,10 +44,10 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CUIText, false) +IMPLEMENT_PERSISTENT(UIText, false) ////////////////////////////////////////////////////////////////////////// -CUIText::CUIText(CBGame *inGame): CUIObject(inGame) { +UIText::UIText(BaseGame *inGame): UIObject(inGame) { _textAlign = TAL_LEFT; _verticalAlign = VAL_CENTER; _type = UI_STATIC; @@ -56,17 +56,17 @@ CUIText::CUIText(CBGame *inGame): CUIObject(inGame) { ////////////////////////////////////////////////////////////////////////// -CUIText::~CUIText() { +UIText::~UIText() { } ////////////////////////////////////////////////////////////////////////// -bool CUIText::display(int offsetX, int offsetY) { +bool UIText::display(int offsetX, int offsetY) { if (!_visible) return STATUS_OK; - CBFont *font = _font; + BaseFont *font = _font; if (!font) font = _gameRef->_systemFont; if (_back) _back->display(offsetX + _posX, offsetY + _posY, _width, _height); @@ -87,7 +87,7 @@ bool CUIText::display(int offsetX, int offsetY) { font->drawText((byte *)_text, offsetX + _posX, offsetY + _posY + textOffset, _width, _textAlign, _height); } - //_gameRef->_renderer->_rectList.add(new CBActiveRect(_gameRef, this, NULL, OffsetX + _posX, OffsetY + _posY, _width, _height, 100, 100, false)); + //_gameRef->_renderer->_rectList.add(new BaseActiveRect(_gameRef, this, NULL, OffsetX + _posX, OffsetY + _posY, _width, _height, 100, 100, false)); return STATUS_OK; } @@ -95,10 +95,10 @@ bool CUIText::display(int offsetX, int offsetY) { ////////////////////////////////////////////////////////////////////////// -bool CUIText::loadFile(const char *filename) { +bool UIText::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { - _gameRef->LOG(0, "CUIText::LoadFile failed for file '%s'", filename); + _gameRef->LOG(0, "UIText::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -138,7 +138,7 @@ TOKEN_DEF(PARENT_NOTIFY) TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -bool CUIText::loadBuffer(byte *buffer, bool complete) { +bool UIText::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(STATIC) TOKEN_TABLE(TEMPLATE) @@ -164,7 +164,7 @@ bool CUIText::loadBuffer(byte *buffer, bool complete) { byte *params; int cmd = 2; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); if (complete) { if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_STATIC) { @@ -190,7 +190,7 @@ bool CUIText::loadBuffer(byte *buffer, bool complete) { case TOKEN_BACK: delete _back; - _back = new CUITiledImage(_gameRef); + _back = new UITiledImage(_gameRef); if (!_back || DID_FAIL(_back->loadFile((char *)params))) { delete _back; _back = NULL; @@ -200,7 +200,7 @@ bool CUIText::loadBuffer(byte *buffer, bool complete) { case TOKEN_IMAGE: delete _image; - _image = new CBSprite(_gameRef); + _image = new BaseSprite(_gameRef); if (!_image || DID_FAIL(_image->loadFile((char *)params))) { delete _image; _image = NULL; @@ -249,7 +249,7 @@ bool CUIText::loadBuffer(byte *buffer, bool complete) { case TOKEN_CURSOR: delete _cursor; - _cursor = new CBSprite(_gameRef); + _cursor = new BaseSprite(_gameRef); if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) { delete _cursor; _cursor = NULL; @@ -293,7 +293,7 @@ bool CUIText::loadBuffer(byte *buffer, bool complete) { } ////////////////////////////////////////////////////////////////////////// -bool CUIText::saveAsText(CBDynBuffer *buffer, int indent) { +bool UIText::saveAsText(BaseDynamicBuffer *buffer, int indent) { buffer->putTextIndent(indent, "STATIC\n"); buffer->putTextIndent(indent, "{\n"); @@ -328,7 +328,7 @@ bool CUIText::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent + 2, "TEXT_ALIGN=\"%s\"\n", "center"); break; default: - error("CUIText::SaveAsText - Unhandled enum"); + error("UIText::SaveAsText - Unhandled enum"); break; } @@ -367,7 +367,7 @@ bool CUIText::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent + 2, "\n"); // editor properties - CBBase::saveAsText(buffer, indent + 2); + BaseClass::saveAsText(buffer, indent + 2); buffer->putTextIndent(indent, "}\n"); return STATUS_OK; @@ -376,7 +376,7 @@ bool CUIText::saveAsText(CBDynBuffer *buffer, int indent) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -bool CUIText::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool UIText::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // SizeToFit ////////////////////////////////////////////////////////////////////////// @@ -397,12 +397,12 @@ bool CUIText::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSta return STATUS_OK; } - else return CUIObject::scCallMethod(script, stack, thisStack, name); + else return UIObject::scCallMethod(script, stack, thisStack, name); } ////////////////////////////////////////////////////////////////////////// -CScValue *CUIText::scGetProperty(const char *name) { +ScValue *UIText::scGetProperty(const char *name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// @@ -429,12 +429,12 @@ CScValue *CUIText::scGetProperty(const char *name) { return _scValue; } - else return CUIObject::scGetProperty(name); + else return UIObject::scGetProperty(name); } ////////////////////////////////////////////////////////////////////////// -bool CUIText::scSetProperty(const char *name, CScValue *value) { +bool UIText::scSetProperty(const char *name, ScValue *value) { ////////////////////////////////////////////////////////////////////////// // TextAlign ////////////////////////////////////////////////////////////////////////// @@ -455,21 +455,21 @@ bool CUIText::scSetProperty(const char *name, CScValue *value) { return STATUS_OK; } - else return CUIObject::scSetProperty(name, value); + else return UIObject::scSetProperty(name, value); } ////////////////////////////////////////////////////////////////////////// -const char *CUIText::scToString() { +const char *UIText::scToString() { return "[static]"; } ////////////////////////////////////////////////////////////////////////// -bool CUIText::persist(CBPersistMgr *persistMgr) { +bool UIText::persist(BasePersistenceManager *persistMgr) { - CUIObject::persist(persistMgr); + UIObject::persist(persistMgr); persistMgr->transfer(TMEMBER_INT(_textAlign)); persistMgr->transfer(TMEMBER_INT(_verticalAlign)); @@ -478,7 +478,7 @@ bool CUIText::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -bool CUIText::sizeToFit() { +bool UIText::sizeToFit() { if (_font && _text) { _width = _font->getTextWidth((byte *)_text); _height = _font->getTextHeight((byte *)_text, _width); diff --git a/engines/wintermute/ui/ui_text.h b/engines/wintermute/ui/ui_text.h index dc633dc042..ee2e63c448 100644 --- a/engines/wintermute/ui/ui_text.h +++ b/engines/wintermute/ui/ui_text.h @@ -34,24 +34,24 @@ namespace WinterMute { -class CUIText : public CUIObject { +class UIText : public UIObject { private: bool sizeToFit(); public: virtual bool display(int offsetX, int offsetY); - DECLARE_PERSISTENT(CUIText, CUIObject) - CUIText(CBGame *inGame = NULL); - virtual ~CUIText(); + DECLARE_PERSISTENT(UIText, UIObject) + UIText(BaseGame *inGame = NULL); + virtual ~UIText(); TTextAlign _textAlign; TVerticalAlign _verticalAlign; bool loadFile(const char *filename); bool loadBuffer(byte *buffer, bool complete = true); - virtual bool saveAsText(CBDynBuffer *buffer, int indent); + virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent); // scripting interface - virtual CScValue *scGetProperty(const char *name); - virtual bool scSetProperty(const char *name, CScValue *value); - virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual ScValue *scGetProperty(const char *name); + virtual bool scSetProperty(const char *name, ScValue *value); + virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); virtual const char *scToString(); }; diff --git a/engines/wintermute/ui/ui_tiled_image.cpp b/engines/wintermute/ui/ui_tiled_image.cpp index 39b39b556d..fec30f46e9 100644 --- a/engines/wintermute/ui/ui_tiled_image.cpp +++ b/engines/wintermute/ui/ui_tiled_image.cpp @@ -38,33 +38,33 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CUITiledImage, false) +IMPLEMENT_PERSISTENT(UITiledImage, false) ////////////////////////////////////////////////////////////////////////// -CUITiledImage::CUITiledImage(CBGame *inGame): CBObject(inGame) { +UITiledImage::UITiledImage(BaseGame *inGame): BaseObject(inGame) { _image = NULL; - CBPlatform::setRectEmpty(&_upLeft); - CBPlatform::setRectEmpty(&_upMiddle); - CBPlatform::setRectEmpty(&_upRight); - CBPlatform::setRectEmpty(&_middleLeft); - CBPlatform::setRectEmpty(&_middleMiddle); - CBPlatform::setRectEmpty(&_middleRight); - CBPlatform::setRectEmpty(&_downLeft); - CBPlatform::setRectEmpty(&_downMiddle); - CBPlatform::setRectEmpty(&_downRight); + BasePlatform::setRectEmpty(&_upLeft); + BasePlatform::setRectEmpty(&_upMiddle); + BasePlatform::setRectEmpty(&_upRight); + BasePlatform::setRectEmpty(&_middleLeft); + BasePlatform::setRectEmpty(&_middleMiddle); + BasePlatform::setRectEmpty(&_middleRight); + BasePlatform::setRectEmpty(&_downLeft); + BasePlatform::setRectEmpty(&_downMiddle); + BasePlatform::setRectEmpty(&_downRight); } ////////////////////////////////////////////////////////////////////////// -CUITiledImage::~CUITiledImage() { +UITiledImage::~UITiledImage() { delete _image; _image = NULL; } ////////////////////////////////////////////////////////////////////////// -bool CUITiledImage::display(int x, int y, int width, int height) { +bool UITiledImage::display(int x, int y, int width, int height) { if (!_image) return STATUS_FAILED; int tileWidth = _middleMiddle.right - _middleMiddle.left; @@ -119,10 +119,10 @@ bool CUITiledImage::display(int x, int y, int width, int height) { ////////////////////////////////////////////////////////////////////////// -bool CUITiledImage::loadFile(const char *filename) { +bool UITiledImage::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { - _gameRef->LOG(0, "CUITiledImage::LoadFile failed for file '%s'", filename); + _gameRef->LOG(0, "UITiledImage::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -158,7 +158,7 @@ TOKEN_DEF(HORIZONTAL_TILES) TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -bool CUITiledImage::loadBuffer(byte *buffer, bool complete) { +bool UITiledImage::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(TILED_IMAGE) TOKEN_TABLE(TEMPLATE) @@ -179,7 +179,7 @@ bool CUITiledImage::loadBuffer(byte *buffer, bool complete) { byte *params; int cmd; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); bool hTiles = false, vTiles = false; int h1 = 0, h2 = 0, h3 = 0; int v1 = 0, v2 = 0, v3 = 0; @@ -200,7 +200,7 @@ bool CUITiledImage::loadBuffer(byte *buffer, bool complete) { case TOKEN_IMAGE: delete _image; - _image = new CBSubFrame(_gameRef); + _image = new BaseSubFrame(_gameRef); if (!_image || DID_FAIL(_image->setSurface((char *)params))) { delete _image; _image = NULL; @@ -270,19 +270,19 @@ bool CUITiledImage::loadBuffer(byte *buffer, bool complete) { if (vTiles && hTiles) { // up row - CBPlatform::setRect(&_upLeft, 0, 0, h1, v1); - CBPlatform::setRect(&_upMiddle, h1, 0, h1 + h2, v1); - CBPlatform::setRect(&_upRight, h1 + h2, 0, h1 + h2 + h3, v1); + BasePlatform::setRect(&_upLeft, 0, 0, h1, v1); + BasePlatform::setRect(&_upMiddle, h1, 0, h1 + h2, v1); + BasePlatform::setRect(&_upRight, h1 + h2, 0, h1 + h2 + h3, v1); // middle row - CBPlatform::setRect(&_middleLeft, 0, v1, h1, v1 + v2); - CBPlatform::setRect(&_middleMiddle, h1, v1, h1 + h2, v1 + v2); - CBPlatform::setRect(&_middleRight, h1 + h2, v1, h1 + h2 + h3, v1 + v2); + BasePlatform::setRect(&_middleLeft, 0, v1, h1, v1 + v2); + BasePlatform::setRect(&_middleMiddle, h1, v1, h1 + h2, v1 + v2); + BasePlatform::setRect(&_middleRight, h1 + h2, v1, h1 + h2 + h3, v1 + v2); // down row - CBPlatform::setRect(&_downLeft, 0, v1 + v2, h1, v1 + v2 + v3); - CBPlatform::setRect(&_downMiddle, h1, v1 + v2, h1 + h2, v1 + v2 + v3); - CBPlatform::setRect(&_downRight, h1 + h2, v1 + v2, h1 + h2 + h3, v1 + v2 + v3); + BasePlatform::setRect(&_downLeft, 0, v1 + v2, h1, v1 + v2 + v3); + BasePlatform::setRect(&_downMiddle, h1, v1 + v2, h1 + h2, v1 + v2 + v3); + BasePlatform::setRect(&_downRight, h1 + h2, v1 + v2, h1 + h2 + h3, v1 + v2 + v3); } // default @@ -290,24 +290,24 @@ bool CUITiledImage::loadBuffer(byte *buffer, bool complete) { int width = _image->_surface->getWidth() / 3; int height = _image->_surface->getHeight() / 3; - if (CBPlatform::isRectEmpty(&_upLeft)) CBPlatform::setRect(&_upLeft, 0, 0, width, height); - if (CBPlatform::isRectEmpty(&_upMiddle)) CBPlatform::setRect(&_upMiddle, width, 0, 2 * width, height); - if (CBPlatform::isRectEmpty(&_upRight)) CBPlatform::setRect(&_upRight, 2 * width, 0, 3 * width, height); + if (BasePlatform::isRectEmpty(&_upLeft)) BasePlatform::setRect(&_upLeft, 0, 0, width, height); + if (BasePlatform::isRectEmpty(&_upMiddle)) BasePlatform::setRect(&_upMiddle, width, 0, 2 * width, height); + if (BasePlatform::isRectEmpty(&_upRight)) BasePlatform::setRect(&_upRight, 2 * width, 0, 3 * width, height); - if (CBPlatform::isRectEmpty(&_middleLeft)) CBPlatform::setRect(&_middleLeft, 0, height, width, 2 * height); - if (CBPlatform::isRectEmpty(&_middleMiddle)) CBPlatform::setRect(&_middleMiddle, width, height, 2 * width, 2 * height); - if (CBPlatform::isRectEmpty(&_middleRight)) CBPlatform::setRect(&_middleRight, 2 * width, height, 3 * width, 2 * height); + if (BasePlatform::isRectEmpty(&_middleLeft)) BasePlatform::setRect(&_middleLeft, 0, height, width, 2 * height); + if (BasePlatform::isRectEmpty(&_middleMiddle)) BasePlatform::setRect(&_middleMiddle, width, height, 2 * width, 2 * height); + if (BasePlatform::isRectEmpty(&_middleRight)) BasePlatform::setRect(&_middleRight, 2 * width, height, 3 * width, 2 * height); - if (CBPlatform::isRectEmpty(&_downLeft)) CBPlatform::setRect(&_downLeft, 0, 2 * height, width, 3 * height); - if (CBPlatform::isRectEmpty(&_downMiddle)) CBPlatform::setRect(&_downMiddle, width, 2 * height, 2 * width, 3 * height); - if (CBPlatform::isRectEmpty(&_downRight)) CBPlatform::setRect(&_downRight, 2 * width, 2 * height, 3 * width, 3 * height); + if (BasePlatform::isRectEmpty(&_downLeft)) BasePlatform::setRect(&_downLeft, 0, 2 * height, width, 3 * height); + if (BasePlatform::isRectEmpty(&_downMiddle)) BasePlatform::setRect(&_downMiddle, width, 2 * height, 2 * width, 3 * height); + if (BasePlatform::isRectEmpty(&_downRight)) BasePlatform::setRect(&_downRight, 2 * width, 2 * height, 3 * width, 3 * height); } return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -bool CUITiledImage::saveAsText(CBDynBuffer *buffer, int indent) { +bool UITiledImage::saveAsText(BaseDynamicBuffer *buffer, int indent) { buffer->putTextIndent(indent, "TILED_IMAGE\n"); buffer->putTextIndent(indent, "{\n"); @@ -330,14 +330,14 @@ bool CUITiledImage::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent + 2, "HORIZONTAL_TILES { %d, %d, %d }\n", h1, h2, h3); // editor properties - CBBase::saveAsText(buffer, indent + 2); + BaseClass::saveAsText(buffer, indent + 2); buffer->putTextIndent(indent, "}\n"); return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -void CUITiledImage::correctSize(int *width, int *height) { +void UITiledImage::correctSize(int *width, int *height) { int tileWidth = _middleMiddle.right - _middleMiddle.left; int tileHeight = _middleMiddle.bottom - _middleMiddle.top; @@ -350,8 +350,8 @@ void CUITiledImage::correctSize(int *width, int *height) { ////////////////////////////////////////////////////////////////////////// -bool CUITiledImage::persist(CBPersistMgr *persistMgr) { - CBObject::persist(persistMgr); +bool UITiledImage::persist(BasePersistenceManager *persistMgr) { + BaseObject::persist(persistMgr); persistMgr->transfer(TMEMBER(_downLeft)); persistMgr->transfer(TMEMBER(_downMiddle)); diff --git a/engines/wintermute/ui/ui_tiled_image.h b/engines/wintermute/ui/ui_tiled_image.h index 79adf7caac..2d7068e7cd 100644 --- a/engines/wintermute/ui/ui_tiled_image.h +++ b/engines/wintermute/ui/ui_tiled_image.h @@ -34,19 +34,19 @@ #include "common/rect.h" namespace WinterMute { -class CBSubFrame; -class CUITiledImage : public CBObject { +class BaseSubFrame; +class UITiledImage : public BaseObject { public: - DECLARE_PERSISTENT(CUITiledImage, CBObject) + DECLARE_PERSISTENT(UITiledImage, BaseObject) void correctSize(int *width, int *height); bool loadFile(const char *filename); bool loadBuffer(byte *buffer, bool complete = true); - virtual bool saveAsText(CBDynBuffer *buffer, int indent); + virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent); bool display(int x, int y, int width, int height); - CUITiledImage(CBGame *inGame = NULL); - virtual ~CUITiledImage(); - CBSubFrame *_image; + UITiledImage(BaseGame *inGame = NULL); + virtual ~UITiledImage(); + BaseSubFrame *_image; Rect32 _upLeft; Rect32 _upMiddle; Rect32 _upRight; diff --git a/engines/wintermute/ui/ui_window.cpp b/engines/wintermute/ui/ui_window.cpp index 269744a3c2..0fedfdc87a 100644 --- a/engines/wintermute/ui/ui_window.cpp +++ b/engines/wintermute/ui/ui_window.cpp @@ -50,12 +50,12 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CUIWindow, false) +IMPLEMENT_PERSISTENT(UIWindow, false) ////////////////////////////////////////////////////////////////////////// -CUIWindow::CUIWindow(CBGame *inGame): CUIObject(inGame) { - CBPlatform::setRectEmpty(&_titleRect); - CBPlatform::setRectEmpty(&_dragRect); +UIWindow::UIWindow(BaseGame *inGame): UIObject(inGame) { + BasePlatform::setRectEmpty(&_titleRect); + BasePlatform::setRectEmpty(&_dragRect); _titleAlign = TAL_LEFT; _transparent = false; @@ -88,14 +88,14 @@ CUIWindow::CUIWindow(CBGame *inGame): CUIObject(inGame) { ////////////////////////////////////////////////////////////////////////// -CUIWindow::~CUIWindow() { +UIWindow::~UIWindow() { close(); cleanup(); } ////////////////////////////////////////////////////////////////////////// -void CUIWindow::cleanup() { +void UIWindow::cleanup() { delete _shieldWindow; delete _shieldButton; delete _viewport; @@ -113,10 +113,10 @@ void CUIWindow::cleanup() { ////////////////////////////////////////////////////////////////////////// -bool CUIWindow::display(int offsetX, int offsetY) { +bool UIWindow::display(int offsetX, int offsetY) { // go exclusive if (_mode == WINDOW_EXCLUSIVE || _mode == WINDOW_SYSTEM_EXCLUSIVE) { - if (!_shieldWindow) _shieldWindow = new CUIWindow(_gameRef); + if (!_shieldWindow) _shieldWindow = new UIWindow(_gameRef); if (_shieldWindow) { _shieldWindow->_posX = _shieldWindow->_posY = 0; _shieldWindow->_width = _gameRef->_renderer->_width; @@ -126,7 +126,7 @@ bool CUIWindow::display(int offsetX, int offsetY) { } } else if (_isMenu) { if (!_shieldButton) { - _shieldButton = new CUIButton(_gameRef); + _shieldButton = new UIButton(_gameRef); _shieldButton->setName("close"); _shieldButton->setListener(this, _shieldButton, 0); _shieldButton->_parent = this; @@ -159,7 +159,7 @@ bool CUIWindow::display(int offsetX, int offsetY) { bool popViewport = false; if (_clipContents) { - if (!_viewport) _viewport = new CBViewport(_gameRef); + if (!_viewport) _viewport = new BaseViewport(_gameRef); if (_viewport) { _viewport->setRect(_posX + offsetX, _posY + offsetY, _posX + _width + offsetX, _posY + _height + offsetY); _gameRef->pushViewport(_viewport); @@ -168,9 +168,9 @@ bool CUIWindow::display(int offsetX, int offsetY) { } - CUITiledImage *back = _back; - CBSprite *image = _image; - CBFont *font = _font; + UITiledImage *back = _back; + BaseSprite *image = _image; + BaseFont *font = _font; if (!isFocused()) { if (_backInactive) back = _backInactive; @@ -185,12 +185,12 @@ bool CUIWindow::display(int offsetX, int offsetY) { if (image) image->draw(_posX + offsetX, _posY + offsetY, _transparent ? NULL : this); - if (!CBPlatform::isRectEmpty(&_titleRect) && font && _text) { + if (!BasePlatform::isRectEmpty(&_titleRect) && font && _text) { font->drawText((byte *)_text, _posX + offsetX + _titleRect.left, _posY + offsetY + _titleRect.top, _titleRect.right - _titleRect.left, _titleAlign, _titleRect.bottom - _titleRect.top); } if (!_transparent && !image) - _gameRef->_renderer->_rectList.add(new CBActiveRect(_gameRef, this, NULL, _posX + offsetX, _posY + offsetY, _width, _height, 100, 100, false)); + _gameRef->_renderer->_rectList.add(new BaseActiveRect(_gameRef, this, NULL, _posX + offsetX, _posY + offsetY, _width, _height, 100, 100, false)); for (int i = 0; i < _widgets.getSize(); i++) { _widgets[i]->display(_posX + offsetX, _posY + offsetY); @@ -207,10 +207,10 @@ bool CUIWindow::display(int offsetX, int offsetY) { ////////////////////////////////////////////////////////////////////////// -bool CUIWindow::loadFile(const char *filename) { +bool UIWindow::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { - _gameRef->LOG(0, "CUIWindow::LoadFile failed for file '%s'", filename); + _gameRef->LOG(0, "UIWindow::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } @@ -266,7 +266,7 @@ TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF(EDIT) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -bool CUIWindow::loadBuffer(byte *buffer, bool complete) { +bool UIWindow::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(WINDOW) TOKEN_TABLE(ALPHA_COLOR) @@ -308,7 +308,7 @@ bool CUIWindow::loadBuffer(byte *buffer, bool complete) { byte *params; int cmd = 2; - CBParser parser(_gameRef); + BaseParser parser(_gameRef); int fadeR = 0, fadeG = 0, fadeB = 0, fadeA = 0; int ar = 0, ag = 0, ab = 0, alpha = 0; @@ -337,7 +337,7 @@ bool CUIWindow::loadBuffer(byte *buffer, bool complete) { case TOKEN_BACK: delete _back; - _back = new CUITiledImage(_gameRef); + _back = new UITiledImage(_gameRef); if (!_back || DID_FAIL(_back->loadFile((char *)params))) { delete _back; _back = NULL; @@ -347,7 +347,7 @@ bool CUIWindow::loadBuffer(byte *buffer, bool complete) { case TOKEN_BACK_INACTIVE: delete _backInactive; - _backInactive = new CUITiledImage(_gameRef); + _backInactive = new UITiledImage(_gameRef); if (!_backInactive || DID_FAIL(_backInactive->loadFile((char *)params))) { delete _backInactive; _backInactive = NULL; @@ -357,7 +357,7 @@ bool CUIWindow::loadBuffer(byte *buffer, bool complete) { case TOKEN_IMAGE: delete _image; - _image = new CBSprite(_gameRef); + _image = new BaseSprite(_gameRef); if (!_image || DID_FAIL(_image->loadFile((char *)params))) { delete _image; _image = NULL; @@ -367,7 +367,7 @@ bool CUIWindow::loadBuffer(byte *buffer, bool complete) { case TOKEN_IMAGE_INACTIVE: delete _imageInactive, - _imageInactive = new CBSprite(_gameRef); + _imageInactive = new BaseSprite(_gameRef); if (!_imageInactive || DID_FAIL(_imageInactive->loadFile((char *)params))) { delete _imageInactive; _imageInactive = NULL; @@ -424,7 +424,7 @@ bool CUIWindow::loadBuffer(byte *buffer, bool complete) { case TOKEN_CURSOR: delete _cursor; - _cursor = new CBSprite(_gameRef); + _cursor = new BaseSprite(_gameRef); if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) { delete _cursor; _cursor = NULL; @@ -433,7 +433,7 @@ bool CUIWindow::loadBuffer(byte *buffer, bool complete) { break; case TOKEN_BUTTON: { - CUIButton *btn = new CUIButton(_gameRef); + UIButton *btn = new UIButton(_gameRef); if (!btn || DID_FAIL(btn->loadBuffer(params, false))) { delete btn; btn = NULL; @@ -446,7 +446,7 @@ bool CUIWindow::loadBuffer(byte *buffer, bool complete) { break; case TOKEN_STATIC: { - CUIText *text = new CUIText(_gameRef); + UIText *text = new UIText(_gameRef); if (!text || DID_FAIL(text->loadBuffer(params, false))) { delete text; text = NULL; @@ -459,7 +459,7 @@ bool CUIWindow::loadBuffer(byte *buffer, bool complete) { break; case TOKEN_EDIT: { - CUIEdit *edit = new CUIEdit(_gameRef); + UIEdit *edit = new UIEdit(_gameRef); if (!edit || DID_FAIL(edit->loadBuffer(params, false))) { delete edit; edit = NULL; @@ -472,7 +472,7 @@ bool CUIWindow::loadBuffer(byte *buffer, bool complete) { break; case TOKEN_WINDOW: { - CUIWindow *win = new CUIWindow(_gameRef); + UIWindow *win = new UIWindow(_gameRef); if (!win || DID_FAIL(win->loadBuffer(params, false))) { delete win; win = NULL; @@ -575,7 +575,7 @@ bool CUIWindow::loadBuffer(byte *buffer, bool complete) { } ////////////////////////////////////////////////////////////////////////// -bool CUIWindow::saveAsText(CBDynBuffer *buffer, int indent) { +bool UIWindow::saveAsText(BaseDynamicBuffer *buffer, int indent) { buffer->putTextIndent(indent, "WINDOW\n"); buffer->putTextIndent(indent, "{\n"); @@ -621,11 +621,11 @@ bool CUIWindow::saveAsText(CBDynBuffer *buffer, int indent) { error("UIWindow::SaveAsText - Unhandled enum-value NUM_TEXT_ALIGN"); } - if (!CBPlatform::isRectEmpty(&_titleRect)) { + if (!BasePlatform::isRectEmpty(&_titleRect)) { buffer->putTextIndent(indent + 2, "TITLE_RECT { %d, %d, %d, %d }\n", _titleRect.left, _titleRect.top, _titleRect.right, _titleRect.bottom); } - if (!CBPlatform::isRectEmpty(&_dragRect)) { + if (!BasePlatform::isRectEmpty(&_dragRect)) { buffer->putTextIndent(indent + 2, "DRAG_RECT { %d, %d, %d, %d }\n", _dragRect.left, _dragRect.top, _dragRect.right, _dragRect.bottom); } @@ -666,7 +666,7 @@ bool CUIWindow::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent + 2, "\n"); // editor properties - CBBase::saveAsText(buffer, indent + 2); + BaseClass::saveAsText(buffer, indent + 2); // controls for (int i = 0; i < _widgets.getSize(); i++) @@ -678,7 +678,7 @@ bool CUIWindow::saveAsText(CBDynBuffer *buffer, int indent) { } ////////////////////////////////////////////////////////////////////////// -bool CUIWindow::enableWidget(const char *name, bool Enable) { +bool UIWindow::enableWidget(const char *name, bool Enable) { for (int i = 0; i < _widgets.getSize(); i++) { if (scumm_stricmp(_widgets[i]->_name, name) == 0) _widgets[i]->_disable = !Enable; } @@ -687,7 +687,7 @@ bool CUIWindow::enableWidget(const char *name, bool Enable) { ////////////////////////////////////////////////////////////////////////// -bool CUIWindow::showWidget(const char *name, bool Visible) { +bool UIWindow::showWidget(const char *name, bool Visible) { for (int i = 0; i < _widgets.getSize(); i++) { if (scumm_stricmp(_widgets[i]->_name, name) == 0) _widgets[i]->_visible = Visible; } @@ -698,13 +698,13 @@ bool CUIWindow::showWidget(const char *name, bool Visible) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -bool CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool UIWindow::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // GetWidget / GetControl ////////////////////////////////////////////////////////////////////////// if (strcmp(name, "GetWidget") == 0 || strcmp(name, "GetControl") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); if (val->getType() == VAL_INT) { int widget = val->getInt(); if (widget < 0 || widget >= _widgets.getSize()) stack->pushNULL(); @@ -742,7 +742,7 @@ bool CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS stack->correctParams(1); delete _imageInactive; - _imageInactive = new CBSprite(_gameRef); + _imageInactive = new BaseSprite(_gameRef); const char *filename = stack->pop()->getString(); if (!_imageInactive || DID_FAIL(_imageInactive->loadFile(filename))) { delete _imageInactive; @@ -824,7 +824,7 @@ bool CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS else if (strcmp(name, "LoadFromFile") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); cleanup(); if (!val->isNULL()) { stack->pushBool(DID_SUCCEED(loadFile(val->getString()))); @@ -838,9 +838,9 @@ bool CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "CreateButton") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); - CUIButton *btn = new CUIButton(_gameRef); + UIButton *btn = new UIButton(_gameRef); if (!val->isNULL()) btn->setName(val->getString()); stack->pushNative(btn, true); @@ -855,9 +855,9 @@ bool CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "CreateStatic") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); - CUIText *sta = new CUIText(_gameRef); + UIText *sta = new UIText(_gameRef); if (!val->isNULL()) sta->setName(val->getString()); stack->pushNative(sta, true); @@ -872,9 +872,9 @@ bool CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "CreateEditor") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); - CUIEdit *edi = new CUIEdit(_gameRef); + UIEdit *edi = new UIEdit(_gameRef); if (!val->isNULL()) edi->setName(val->getString()); stack->pushNative(edi, true); @@ -889,9 +889,9 @@ bool CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "CreateWindow") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); + ScValue *val = stack->pop(); - CUIWindow *win = new CUIWindow(_gameRef); + UIWindow *win = new UIWindow(_gameRef); if (!val->isNULL()) win->setName(val->getString()); stack->pushNative(win, true); @@ -906,8 +906,8 @@ bool CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "DeleteControl") == 0 || strcmp(name, "DeleteButton") == 0 || strcmp(name, "DeleteStatic") == 0 || strcmp(name, "DeleteEditor") == 0 || strcmp(name, "DeleteWindow") == 0) { stack->correctParams(1); - CScValue *val = stack->pop(); - CUIObject *obj = (CUIObject *)val->getNative(); + ScValue *val = stack->pop(); + UIObject *obj = (UIObject *)val->getNative(); for (int i = 0; i < _widgets.getSize(); i++) { if (_widgets[i] == obj) { @@ -920,12 +920,12 @@ bool CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS return STATUS_OK; } else if DID_SUCCEED(_gameRef->windowScriptMethodHook(this, script, stack, name)) return STATUS_OK; - else return CUIObject::scCallMethod(script, stack, thisStack, name); + else return UIObject::scCallMethod(script, stack, thisStack, name); } ////////////////////////////////////////////////////////////////////////// -CScValue *CUIWindow::scGetProperty(const char *name) { +ScValue *UIWindow::scGetProperty(const char *name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// @@ -1008,12 +1008,12 @@ CScValue *CUIWindow::scGetProperty(const char *name) { return _scValue; } - else return CUIObject::scGetProperty(name); + else return UIObject::scGetProperty(name); } ////////////////////////////////////////////////////////////////////////// -bool CUIWindow::scSetProperty(const char *name, CScValue *value) { +bool UIWindow::scSetProperty(const char *name, ScValue *value) { ////////////////////////////////////////////////////////////////////////// // Name ////////////////////////////////////////////////////////////////////////// @@ -1097,21 +1097,21 @@ bool CUIWindow::scSetProperty(const char *name, CScValue *value) { return STATUS_OK; } - else return CUIObject::scSetProperty(name, value); + else return UIObject::scSetProperty(name, value); } ////////////////////////////////////////////////////////////////////////// -const char *CUIWindow::scToString() { +const char *UIWindow::scToString() { return "[window]"; } ////////////////////////////////////////////////////////////////////////// -bool CUIWindow::handleKeypress(Common::Event *event, bool printable) { +bool UIWindow::handleKeypress(Common::Event *event, bool printable) { //TODO if (event->type == Common::EVENT_KEYDOWN && event->kbd.keycode == Common::KEYCODE_TAB) { - return DID_SUCCEED(moveFocus(!CBKeyboardState::isShiftDown())); + return DID_SUCCEED(moveFocus(!BaseKeyboardState::isShiftDown())); } else { if (_focusedWidget) return _focusedWidget->handleKeypress(event, printable); else return false; @@ -1121,26 +1121,26 @@ bool CUIWindow::handleKeypress(Common::Event *event, bool printable) { ////////////////////////////////////////////////////////////////////////// -bool CUIWindow::handleMouseWheel(int Delta) { +bool UIWindow::handleMouseWheel(int Delta) { if (_focusedWidget) return _focusedWidget->handleMouseWheel(Delta); else return false; } ////////////////////////////////////////////////////////////////////////// -bool CUIWindow::handleMouse(TMouseEvent event, TMouseButton button) { - bool res = CUIObject::handleMouse(event, button); +bool UIWindow::handleMouse(TMouseEvent event, TMouseButton button) { + bool res = UIObject::handleMouse(event, button); // handle window dragging - if (!CBPlatform::isRectEmpty(&_dragRect)) { + if (!BasePlatform::isRectEmpty(&_dragRect)) { // start drag if (event == MOUSE_CLICK && button == MOUSE_BUTTON_LEFT) { Rect32 dragRect = _dragRect; int offsetX, offsetY; getTotalOffset(&offsetX, &offsetY); - CBPlatform::offsetRect(&dragRect, _posX + offsetX, _posY + offsetY); + BasePlatform::offsetRect(&dragRect, _posX + offsetX, _posY + offsetY); - if (CBPlatform::ptInRect(&dragRect, _gameRef->_mousePos)) { + if (BasePlatform::ptInRect(&dragRect, _gameRef->_mousePos)) { _dragFrom.x = _gameRef->_mousePos.x; _dragFrom.y = _gameRef->_mousePos.y; _dragging = true; @@ -1158,9 +1158,9 @@ bool CUIWindow::handleMouse(TMouseEvent event, TMouseButton button) { ////////////////////////////////////////////////////////////////////////// -bool CUIWindow::persist(CBPersistMgr *persistMgr) { +bool UIWindow::persist(BasePersistenceManager *persistMgr) { - CUIObject::persist(persistMgr); + UIObject::persist(persistMgr); persistMgr->transfer(TMEMBER(_backInactive)); persistMgr->transfer(TMEMBER(_clipContents)); @@ -1189,7 +1189,7 @@ bool CUIWindow::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -bool CUIWindow::moveFocus(bool forward) { +bool UIWindow::moveFocus(bool forward) { int i; bool found = false; for (i = 0; i < _widgets.getSize(); i++) { @@ -1230,7 +1230,7 @@ bool CUIWindow::moveFocus(bool forward) { ////////////////////////////////////////////////////////////////////////// -bool CUIWindow::goExclusive() { +bool UIWindow::goExclusive() { if (_mode == WINDOW_EXCLUSIVE) return STATUS_OK; if (_mode == WINDOW_NORMAL) { @@ -1245,7 +1245,7 @@ bool CUIWindow::goExclusive() { ////////////////////////////////////////////////////////////////////////// -bool CUIWindow::goSystemExclusive() { +bool UIWindow::goSystemExclusive() { if (_mode == WINDOW_SYSTEM_EXCLUSIVE) return STATUS_OK; makeFreezable(false); @@ -1262,7 +1262,7 @@ bool CUIWindow::goSystemExclusive() { ////////////////////////////////////////////////////////////////////////// -bool CUIWindow::close() { +bool UIWindow::close() { if (_mode == WINDOW_SYSTEM_EXCLUSIVE) { _gameRef->unfreeze(); } @@ -1276,16 +1276,16 @@ bool CUIWindow::close() { ////////////////////////////////////////////////////////////////////////// -bool CUIWindow::listen(CBScriptHolder *param1, uint32 param2) { - CUIObject *obj = (CUIObject *)param1; +bool UIWindow::listen(BaseScriptHolder *param1, uint32 param2) { + UIObject *obj = (UIObject *)param1; switch (obj->_type) { case UI_BUTTON: if (scumm_stricmp(obj->_name, "close") == 0) close(); - else return CBObject::listen(param1, param2); + else return BaseObject::listen(param1, param2); break; default: - return CBObject::listen(param1, param2); + return BaseObject::listen(param1, param2); } return STATUS_OK; @@ -1293,23 +1293,23 @@ bool CUIWindow::listen(CBScriptHolder *param1, uint32 param2) { ////////////////////////////////////////////////////////////////////////// -void CUIWindow::makeFreezable(bool freezable) { +void UIWindow::makeFreezable(bool freezable) { for (int i = 0; i < _widgets.getSize(); i++) _widgets[i]->makeFreezable(freezable); - CBObject::makeFreezable(freezable); + BaseObject::makeFreezable(freezable); } ////////////////////////////////////////////////////////////////////////// -bool CUIWindow::getWindowObjects(CBArray &objects, bool interactiveOnly) { +bool UIWindow::getWindowObjects(BaseArray &objects, bool interactiveOnly) { for (int i = 0; i < _widgets.getSize(); i++) { - CUIObject *control = _widgets[i]; + UIObject *control = _widgets[i]; if (control->_disable && interactiveOnly) continue; switch (control->_type) { case UI_WINDOW: - ((CUIWindow *)control)->getWindowObjects(objects, interactiveOnly); + ((UIWindow *)control)->getWindowObjects(objects, interactiveOnly); break; case UI_BUTTON: diff --git a/engines/wintermute/ui/ui_window.h b/engines/wintermute/ui/ui_window.h index 6fe24c6a2c..9e8862471c 100644 --- a/engines/wintermute/ui/ui_window.h +++ b/engines/wintermute/ui/ui_window.h @@ -35,24 +35,24 @@ namespace WinterMute { -class CUIButton; -class CBViewport; -class CUIWindow : public CUIObject { +class UIButton; +class BaseViewport; +class UIWindow : public UIObject { public: - bool getWindowObjects(CBArray &Objects, bool InteractiveOnly); + bool getWindowObjects(BaseArray &Objects, bool InteractiveOnly); bool _pauseMusic; void cleanup(); virtual void makeFreezable(bool freezable); - CBViewport *_viewport; + BaseViewport *_viewport; bool _clipContents; bool _inGame; bool _isMenu; bool _fadeBackground; uint32 _fadeColor; virtual bool handleMouseWheel(int delta); - CUIWindow *_shieldWindow; - CUIButton *_shieldButton; + UIWindow *_shieldWindow; + UIButton *_shieldButton; bool close(); bool goSystemExclusive(); bool goExclusive(); @@ -61,30 +61,30 @@ public: virtual bool handleMouse(TMouseEvent Event, TMouseButton Button); Point32 _dragFrom; bool _dragging; - DECLARE_PERSISTENT(CUIWindow, CUIObject) + DECLARE_PERSISTENT(UIWindow, UIObject) bool _transparent; bool showWidget(const char *name, bool visible = true); bool enableWidget(const char *name, bool enable = true); Rect32 _titleRect; Rect32 _dragRect; virtual bool display(int offsetX = 0, int offsetY = 0); - CUIWindow(CBGame *inGame); - virtual ~CUIWindow(); + UIWindow(BaseGame *inGame); + virtual ~UIWindow(); virtual bool handleKeypress(Common::Event *event, bool printable = false); - CBArray _widgets; + BaseArray _widgets; TTextAlign _titleAlign; bool loadFile(const char *filename); bool loadBuffer(byte *buffer, bool complete = true); - CUITiledImage *_backInactive; - CBFont *_fontInactive; - CBSprite *_imageInactive; - virtual bool listen(CBScriptHolder *param1, uint32 param2); - virtual bool saveAsText(CBDynBuffer *buffer, int indent); + UITiledImage *_backInactive; + BaseFont *_fontInactive; + BaseSprite *_imageInactive; + virtual bool listen(BaseScriptHolder *param1, uint32 param2); + virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent); // scripting interface - virtual CScValue *scGetProperty(const char *name); - virtual bool scSetProperty(const char *name, CScValue *value); - virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual ScValue *scGetProperty(const char *name); + virtual bool scSetProperty(const char *name, ScValue *value); + virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); virtual const char *scToString(); }; diff --git a/engines/wintermute/utils/utils.cpp b/engines/wintermute/utils/utils.cpp index e77f35a0e8..038095c8ae 100644 --- a/engines/wintermute/utils/utils.cpp +++ b/engines/wintermute/utils/utils.cpp @@ -45,7 +45,7 @@ static inline unsigned Sqr(int x) { ////////////////////////////////////////////////////////////////////////////////// -void CBUtils::clip(int *destX, int *destY, Rect32 *srcRect, Rect32 *destRect) { +void BaseUtils::clip(int *destX, int *destY, Rect32 *srcRect, Rect32 *destRect) { // If it's partly off the right side of the screen if (*destX + (srcRect->right - srcRect->left) > destRect->right) srcRect->right -= *destX + (srcRect->right - srcRect->left) - destRect->right; @@ -76,20 +76,20 @@ void CBUtils::clip(int *destX, int *destY, Rect32 *srcRect, Rect32 *destRect) { ////////////////////////////////////////////////////////////////////////////////// // Swap - swaps two integers ////////////////////////////////////////////////////////////////////////////////// -void CBUtils::swap(int *a, int *b) { +void BaseUtils::swap(int *a, int *b) { int Temp = *a; *a = *b; *b = Temp; } ////////////////////////////////////////////////////////////////////////// -bool CBUtils::strBeginsI(const char *string, const char *fragment) { +bool BaseUtils::strBeginsI(const char *string, const char *fragment) { return (scumm_strnicmp(string, fragment, strlen(fragment)) == 0); } ////////////////////////////////////////////////////////////////////////// -float CBUtils::normalizeAngle(float angle) { +float BaseUtils::normalizeAngle(float angle) { while (angle > 360) angle -= 360; while (angle < 0) angle += 360; @@ -98,14 +98,14 @@ float CBUtils::normalizeAngle(float angle) { //////////////////////////////////////////////////////////////////////////////// -void CBUtils::createPath(const char *path, bool pathOnly) { +void BaseUtils::createPath(const char *path, bool pathOnly) { AnsiString pathStr; if (!pathOnly) pathStr = PathUtil::getDirectoryName(path); else pathStr = path; // try { - warning("CBUtils::CreatePath - not implemented: %s", path); + warning("BaseUtils::CreatePath - not implemented: %s", path); // boost::filesystem::create_directories(path); // } catch (...) { return; @@ -114,13 +114,13 @@ void CBUtils::createPath(const char *path, bool pathOnly) { ////////////////////////////////////////////////////////////////////////// -void CBUtils::debugMessage(const char *text) { +void BaseUtils::debugMessage(const char *text) { //MessageBox(hWnd, Text, "WME", MB_OK|MB_ICONINFORMATION); } ////////////////////////////////////////////////////////////////////////// -char *CBUtils::setString(char **string, const char *value) { +char *BaseUtils::setString(char **string, const char *value) { delete[] *string; *string = new char[strlen(value) + 1]; if (*string) strcpy(*string, value); @@ -128,7 +128,7 @@ char *CBUtils::setString(char **string, const char *value) { } ////////////////////////////////////////////////////////////////////////// -int CBUtils::strNumEntries(const char *str, const char delim) { +int BaseUtils::strNumEntries(const char *str, const char delim) { int numEntries = 1; for (uint32 i = 0; i < strlen(str); i++) { if (str[i] == delim) numEntries++; @@ -138,7 +138,7 @@ int CBUtils::strNumEntries(const char *str, const char delim) { ////////////////////////////////////////////////////////////////////////// -char *CBUtils::strEntry(int entry, const char *str, const char delim) { +char *BaseUtils::strEntry(int entry, const char *str, const char delim) { int numEntries = 0; const char *start = NULL; @@ -163,7 +163,7 @@ char *CBUtils::strEntry(int entry, const char *str, const char delim) { } ////////////////////////////////////////////////////////////////////////// -int CBUtils::randomInt(int from, int to) { +int BaseUtils::randomInt(int from, int to) { if (to < from) { int i = to; to = from; @@ -174,14 +174,14 @@ int CBUtils::randomInt(int from, int to) { } ////////////////////////////////////////////////////////////////////////// -float CBUtils::randomFloat(float from, float to) { +float BaseUtils::randomFloat(float from, float to) { const uint32 randMax = RAND_MAX; float randNum = (float)g_wintermute->randInt(0, randMax) / (float)randMax; return from + (to - from) * randNum; } ////////////////////////////////////////////////////////////////////////// -float CBUtils::randomAngle(float From, float To) { +float BaseUtils::randomAngle(float From, float To) { while (To < From) { To += 360; } @@ -189,7 +189,7 @@ float CBUtils::randomAngle(float From, float To) { } ////////////////////////////////////////////////////////////////////////// -bool CBUtils::matchesPattern(const char *pattern, const char *string) { +bool BaseUtils::matchesPattern(const char *pattern, const char *string) { char stringc, patternc; for (;; ++string) { @@ -220,14 +220,14 @@ bool CBUtils::matchesPattern(const char *pattern, const char *string) { } while (*string) - if (CBUtils::matchesPattern(pattern, string++)) + if (BaseUtils::matchesPattern(pattern, string++)) return true; return false; default: if (patternc != stringc) if (patternc == '.' && stringc == 0) - return(CBUtils::matchesPattern(pattern, string)); + return(BaseUtils::matchesPattern(pattern, string)); else return false; break; @@ -236,10 +236,10 @@ bool CBUtils::matchesPattern(const char *pattern, const char *string) { } ////////////////////////////////////////////////////////////////////////// -char *CBUtils::getPath(const char *filename) { +char *BaseUtils::getPath(const char *filename) { AnsiString path = PathUtil::getDirectoryName(filename); //path = boost::filesystem::syste_complete(path).string(); - warning("CBUtils::GetPath: (%s), not implemented", filename); + warning("BaseUtils::GetPath: (%s), not implemented", filename); char *ret = new char[path.size() + 1]; strcpy(ret, path.c_str()); @@ -247,7 +247,7 @@ char *CBUtils::getPath(const char *filename) { } ////////////////////////////////////////////////////////////////////////// -char *CBUtils::getFilename(const char *filename) { +char *BaseUtils::getFilename(const char *filename) { AnsiString path = PathUtil::getFileName(filename); char *ret = new char[path.size() + 1]; strcpy(ret, path.c_str()); @@ -255,7 +255,7 @@ char *CBUtils::getFilename(const char *filename) { } ////////////////////////////////////////////////////////////////////////// -void CBUtils::RGBtoHSL(uint32 RGBColor, byte *outH, byte *outS, byte *outL) { +void BaseUtils::RGBtoHSL(uint32 RGBColor, byte *outH, byte *outS, byte *outL) { float varR = (RGBCOLGetR(RGBColor) / 255.0f); float varG = (RGBCOLGetG(RGBColor) / 255.0f); float varB = (RGBCOLGetB(RGBColor) / 255.0f); @@ -304,7 +304,7 @@ void CBUtils::RGBtoHSL(uint32 RGBColor, byte *outH, byte *outS, byte *outL) { ////////////////////////////////////////////////////////////////////////// -uint32 CBUtils::HSLtoRGB(byte InH, byte InS, byte InL) { +uint32 BaseUtils::HSLtoRGB(byte InH, byte InS, byte InL) { float H = InH / 255.0f; float S = InS / 255.0f; float L = InL / 255.0f; @@ -333,7 +333,7 @@ uint32 CBUtils::HSLtoRGB(byte InH, byte InS, byte InL) { ////////////////////////////////////////////////////////////////////////// -float CBUtils::Hue2RGB(float v1, float v2, float vH) { +float BaseUtils::Hue2RGB(float v1, float v2, float vH) { if (vH < 0.0f) vH += 1.0f; if (vH > 1.0f) vH -= 1.0f; if ((6.0f * vH) < 1.0f) return (v1 + (v2 - v1) * 6.0f * vH); diff --git a/engines/wintermute/utils/utils.h b/engines/wintermute/utils/utils.h index c8ca2e121c..3baafaa606 100644 --- a/engines/wintermute/utils/utils.h +++ b/engines/wintermute/utils/utils.h @@ -34,9 +34,9 @@ namespace WinterMute { -class CBGame; +class BaseGame; -class CBUtils { +class BaseUtils { public: static void clip(int *destX, int *destY, Rect32 *srcRect, Rect32 *destRect); static void swap(int *a, int *b); diff --git a/engines/wintermute/video/video_player.cpp b/engines/wintermute/video/video_player.cpp index 49d1c6c50f..2806dbe516 100644 --- a/engines/wintermute/video/video_player.cpp +++ b/engines/wintermute/video/video_player.cpp @@ -39,13 +39,13 @@ namespace WinterMute { ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// -CVidPlayer::CVidPlayer(CBGame *inGame): CBBase(inGame) { +VideoPlayer::VideoPlayer(BaseGame *inGame): BaseClass(inGame) { SetDefaults(); } ////////////////////////////////////////////////////////////////////////// -bool CVidPlayer::SetDefaults() { +bool VideoPlayer::SetDefaults() { _playing = false; /* _aviFile = NULL; @@ -85,13 +85,13 @@ bool CVidPlayer::SetDefaults() { ////////////////////////////////////////////////////////////////////////// -CVidPlayer::~CVidPlayer() { +VideoPlayer::~VideoPlayer() { cleanup(); } ////////////////////////////////////////////////////////////////////////// -bool CVidPlayer::cleanup() { +bool VideoPlayer::cleanup() { #if 0 if (_sound) _sound->Stop(); if (_videoPGF) AVIStreamGetFrameClose(_videoPGF); @@ -124,7 +124,7 @@ bool CVidPlayer::cleanup() { ////////////////////////////////////////////////////////////////////////// -bool CVidPlayer::initialize(const char *inFilename, const char *SubtitleFile) { +bool VideoPlayer::initialize(const char *inFilename, const char *SubtitleFile) { #if 0 cleanup(); @@ -186,7 +186,7 @@ bool CVidPlayer::initialize(const char *inFilename, const char *SubtitleFile) { bool res; if (_soundAvailable) { - _sound = new CBSoundAVI(_gameRef); + _sound = new BaseSoundAVI(_gameRef); if (DID_FAIL(res = _sound->InitializeBuffer(_audioStream))) { SAFE_DELETE(_sound); _soundAvailable = false; @@ -204,7 +204,7 @@ bool CVidPlayer::initialize(const char *inFilename, const char *SubtitleFile) { ////////////////////////////////////////////////////////////////////////// -bool CVidPlayer::update() { +bool VideoPlayer::update() { #if 0 if (!m_Playing) return STATUS_OK; @@ -274,7 +274,7 @@ bool CVidPlayer::update() { ////////////////////////////////////////////////////////////////////////// -bool CVidPlayer::display() { +bool VideoPlayer::display() { #if 0 if (!m_Playing) return STATUS_OK; @@ -284,7 +284,7 @@ bool CVidPlayer::display() { // display subtitle if (m_ShowSubtitle) { - CBFont *font = _gameRef->_videoFont ? _gameRef->_videoFont : _gameRef->_systemFont; + BaseFont *font = _gameRef->_videoFont ? _gameRef->_videoFont : _gameRef->_systemFont; int Height = font->GetTextHeight((BYTE *)m_Subtitles[_currentSubtitle]->_text, _gameRef->_renderer->_width); font->drawText((byte *)_subtitles[m_CurrentSubtitle]->_text, 0, _gameRef->_renderer->_height - Height - 5, _gameRef->_renderer->_width, TAL_CENTER); } @@ -298,7 +298,7 @@ bool CVidPlayer::display() { ////////////////////////////////////////////////////////////////////////// -bool CVidPlayer::play(TVideoPlayback Type, int X, int Y, bool FreezeMusic) { +bool VideoPlayer::play(TVideoPlayback Type, int X, int Y, bool FreezeMusic) { #if 0 if (!_videoStream || !_vidRenderer) return STATUS_FAILED; @@ -359,7 +359,7 @@ bool CVidPlayer::play(TVideoPlayback Type, int X, int Y, bool FreezeMusic) { ////////////////////////////////////////////////////////////////////////// -bool CVidPlayer::stop() { +bool VideoPlayer::stop() { #if 0 if (!_playing) return STATUS_OK; @@ -372,13 +372,13 @@ bool CVidPlayer::stop() { ////////////////////////////////////////////////////////////////////////// -bool CVidPlayer::isPlaying() { +bool VideoPlayer::isPlaying() { return _playing; } ////////////////////////////////////////////////////////////////////////// -bool CVidPlayer::loadSubtitles(const char *filename, const char *SubtitleFile) { +bool VideoPlayer::loadSubtitles(const char *filename, const char *SubtitleFile) { #if 0 if (!Filename) return STATUS_OK; diff --git a/engines/wintermute/video/video_player.h b/engines/wintermute/video/video_player.h index 8dda93b43e..8e82a44076 100644 --- a/engines/wintermute/video/video_player.h +++ b/engines/wintermute/video/video_player.h @@ -38,7 +38,7 @@ namespace WinterMute { -class CVidPlayer : public CBBase { +class VideoPlayer : public BaseClass { public: bool _showSubtitle; int _currentSubtitle; @@ -51,7 +51,7 @@ public: uint32 _totalVideoTime; uint32 _startTime; //CVidRenderer *_vidRenderer; - //CBSoundAVI *_sound; + //BaseSoundAVI *_sound; bool _soundAvailable; bool SetDefaults(); bool _playing; @@ -59,8 +59,8 @@ public: bool update(); bool initialize(const char *inFilename, const char *SubtitleFile = NULL); bool cleanup(); - CVidPlayer(CBGame *inGame); - virtual ~CVidPlayer(); + VideoPlayer(BaseGame *inGame); + virtual ~VideoPlayer(); /*PAVIFILE _aviFile; @@ -81,7 +81,7 @@ public: /* LPBITMAPV4HEADER _targetFormat; - CBArray _subtitles;*/ + BaseArray _subtitles;*/ }; } // end of namespace WinterMute diff --git a/engines/wintermute/video/video_theora_player.cpp b/engines/wintermute/video/video_theora_player.cpp index e3c120ff86..91161cbd3b 100644 --- a/engines/wintermute/video/video_theora_player.cpp +++ b/engines/wintermute/video/video_theora_player.cpp @@ -43,15 +43,15 @@ namespace WinterMute { -IMPLEMENT_PERSISTENT(CVidTheoraPlayer, false) +IMPLEMENT_PERSISTENT(VideoTheoraPlayer, false) ////////////////////////////////////////////////////////////////////////// -CVidTheoraPlayer::CVidTheoraPlayer(CBGame *inGame): CBBase(inGame) { +VideoTheoraPlayer::VideoTheoraPlayer(BaseGame *inGame): BaseClass(inGame) { SetDefaults(); } ////////////////////////////////////////////////////////////////////////// -void CVidTheoraPlayer::SetDefaults() { +void VideoTheoraPlayer::SetDefaults() { _file = NULL; _filename = ""; @@ -97,7 +97,7 @@ void CVidTheoraPlayer::SetDefaults() { } ////////////////////////////////////////////////////////////////////////// -CVidTheoraPlayer::~CVidTheoraPlayer(void) { +VideoTheoraPlayer::~VideoTheoraPlayer(void) { cleanup(); /* SAFE_DELETE_ARRAY(_filename); @@ -108,7 +108,7 @@ CVidTheoraPlayer::~CVidTheoraPlayer(void) { } ////////////////////////////////////////////////////////////////////////// -void CVidTheoraPlayer::cleanup() { +void VideoTheoraPlayer::cleanup() { if (_file) { _gameRef->_fileManager->closeFile(_file); _file = NULL; @@ -134,14 +134,14 @@ void CVidTheoraPlayer::cleanup() { } ////////////////////////////////////////////////////////////////////////// -bool CVidTheoraPlayer::initialize(const Common::String &filename, const Common::String &subtitleFile) { +bool VideoTheoraPlayer::initialize(const Common::String &filename, const Common::String &subtitleFile) { cleanup(); _filename = filename; _file = _gameRef->_fileManager->openFile(filename, true, false); if (!_file) return STATUS_FAILED; - //if (Filename != _filename) CBUtils::setString(&_filename, filename); + //if (Filename != _filename) BaseUtils::setString(&_filename, filename); #if defined (USE_THEORADEC) _theoraDecoder = new TheoraDecoder(); #else @@ -156,7 +156,7 @@ bool CVidTheoraPlayer::initialize(const Common::String &filename, const Common:: // Additional setup. _surface.create(_theoraDecoder->getWidth(), _theoraDecoder->getHeight(), _theoraDecoder->getPixelFormat()); - _texture = new CBSurfaceOSystem(_gameRef); + _texture = new BaseSurfaceOSystem(_gameRef); _texture->create(_theoraDecoder->getWidth(), _theoraDecoder->getHeight()); _state = THEORA_STATE_PLAYING; _playZoom = 100; @@ -168,7 +168,7 @@ bool CVidTheoraPlayer::initialize(const Common::String &filename, const Common:: _file = _gameRef->_fileManager->openFile(filename); if (!_file) return STATUS_FAILED; - if (Filename != _filename) CBUtils::setString(&_filename, filename); + if (Filename != _filename) BaseUtils::setString(&_filename, filename); // start up Ogg stream synchronization layer ogg_sync_init(&m_OggSyncState); @@ -299,7 +299,7 @@ bool CVidTheoraPlayer::initialize(const Common::String &filename, const Common:: // create sound buffer if (m_VorbisStreams && _gameRef->m_SoundMgr->m_SoundAvailable) { - m_Sound = new CBSoundTheora(_gameRef); + m_Sound = new BaseSoundTheora(_gameRef); _gameRef->m_SoundMgr->AddSound(m_Sound); if (DID_FAIL(Res = m_Sound->InitializeBuffer(this))) { _gameRef->m_SoundMgr->RemoveSound(m_Sound); @@ -315,9 +315,9 @@ bool CVidTheoraPlayer::initialize(const Common::String &filename, const Common:: // create texture if (m_TheoraStreams && !m_Texture) { if (_gameRef->m_UseD3D) - m_Texture = new CBSurfaceD3D(_gameRef); + m_Texture = new BaseSurfaceD3D(_gameRef); else - m_Texture = new CBSurfaceDD(_gameRef); + m_Texture = new BaseSurfaceDD(_gameRef); if (!m_Texture || DID_FAIL(Res = m_Texture->Create(m_TheoraInfo.width, m_TheoraInfo.height))) { SAFE_DELETE(m_Texture); @@ -335,7 +335,7 @@ bool CVidTheoraPlayer::initialize(const Common::String &filename, const Common:: ////////////////////////////////////////////////////////////////////////// -bool CVidTheoraPlayer::resetStream() { +bool VideoTheoraPlayer::resetStream() { warning("VidTheoraPlayer::resetStream - stubbed"); #if 0 if (_sound) _sound->Stop(); @@ -348,7 +348,7 @@ bool CVidTheoraPlayer::resetStream() { } ////////////////////////////////////////////////////////////////////////// -bool CVidTheoraPlayer::play(TVideoPlayback type, int x, int y, bool freezeGame, bool freezeMusic, bool looping, uint32 startTime, float forceZoom, int volume) { +bool VideoTheoraPlayer::play(TVideoPlayback type, int x, int y, bool freezeGame, bool freezeMusic, bool looping, uint32 startTime, float forceZoom, int volume) { if (forceZoom < 0.0f) forceZoom = 100.0f; if (volume < 0) @@ -452,7 +452,7 @@ bool CVidTheoraPlayer::play(TVideoPlayback type, int x, int y, bool freezeGame, } ////////////////////////////////////////////////////////////////////////// -bool CVidTheoraPlayer::stop() { +bool VideoTheoraPlayer::stop() { _theoraDecoder->close(); _state = THEORA_STATE_FINISHED; if (_freezeGame) { @@ -467,7 +467,7 @@ bool CVidTheoraPlayer::stop() { } ////////////////////////////////////////////////////////////////////////// -bool CVidTheoraPlayer::update() { +bool VideoTheoraPlayer::update() { _currentTime = _freezeGame ? _gameRef->_liveTimer : _gameRef->_timer; if (!isPlaying()) return STATUS_OK; @@ -590,7 +590,7 @@ bool CVidTheoraPlayer::update() { } ////////////////////////////////////////////////////////////////////////// -uint32 CVidTheoraPlayer::getMovieTime() { +uint32 VideoTheoraPlayer::getMovieTime() { if (!_playbackStarted) { return 0; } else { @@ -600,7 +600,7 @@ uint32 CVidTheoraPlayer::getMovieTime() { ////////////////////////////////////////////////////////////////////////// -uint32 CVidTheoraPlayer::getMovieFrame() { +uint32 VideoTheoraPlayer::getMovieFrame() { #if 0 if (!m_TheoraStreams) return 0; float Time = GetMovieTime(); @@ -615,7 +615,7 @@ uint32 CVidTheoraPlayer::getMovieFrame() { } ////////////////////////////////////////////////////////////////////////// -bool CVidTheoraPlayer::WriteVideo() { +bool VideoTheoraPlayer::WriteVideo() { if (!_texture) return STATUS_FAILED; _texture->startPixelOp(); @@ -634,7 +634,7 @@ bool CVidTheoraPlayer::WriteVideo() { return STATUS_OK; } -void CVidTheoraPlayer::writeAlpha() { +void VideoTheoraPlayer::writeAlpha() { if (_alphaImage && _surface.w == _alphaImage->getSurface()->w && _surface.h == _alphaImage->getSurface()->h) { assert(_alphaImage->getSurface()->format.bytesPerPixel == 4); assert(_surface.format.bytesPerPixel == 4); @@ -652,12 +652,12 @@ void CVidTheoraPlayer::writeAlpha() { } ////////////////////////////////////////////////////////////////////////// -bool CVidTheoraPlayer::display(uint32 alpha) { +bool VideoTheoraPlayer::display(uint32 alpha) { Rect32 rc; bool res; if (_texture && _videoFrameReady) { - CBPlatform::setRect(&rc, 0, 0, _texture->getWidth(), _texture->getHeight()); + BasePlatform::setRect(&rc, 0, 0, _texture->getWidth(), _texture->getHeight()); if (_playZoom == 100.0f) res = _texture->displayTrans(_posX, _posY, rc, alpha); else res = _texture->displayTransZoom(_posX, _posY, rc, _playZoom, _playZoom, alpha); } else res = STATUS_FAILED; @@ -668,11 +668,11 @@ bool CVidTheoraPlayer::display(uint32 alpha) { } ////////////////////////////////////////////////////////////////////////// -bool CVidTheoraPlayer::setAlphaImage(const Common::String &filename) { - warning("CVidTheoraPlayer::SetAlphaImage(%s) - Not implemented", filename.c_str()); +bool VideoTheoraPlayer::setAlphaImage(const Common::String &filename) { + warning("VideoTheoraPlayer::SetAlphaImage(%s) - Not implemented", filename.c_str()); delete _alphaImage; - _alphaImage = new CBImage(_gameRef); + _alphaImage = new BaseImage(_gameRef); if (!_alphaImage || DID_FAIL(_alphaImage->loadFile(filename))) { delete _alphaImage; _alphaImage = NULL; @@ -686,20 +686,20 @@ bool CVidTheoraPlayer::setAlphaImage(const Common::String &filename) { //TODO: Conversion. #if 0 SAFE_DELETE(m_AlphaImage); - m_AlphaImage = new CBImage(_gameRef); + m_AlphaImage = new BaseImage(_gameRef); if (!m_AlphaImage || DID_FAIL(m_AlphaImage->loadFile(filename))) { SAFE_DELETE(m_AlphaImage); SAFE_DELETE_ARRAY(m_AlphaFilename); return STATUS_FAILED; } - if (m_AlphaFilename != Filename) CBUtils::setString(&m_AlphaFilename, filename); + if (m_AlphaFilename != Filename) BaseUtils::setString(&m_AlphaFilename, filename); m_AlphaImage->Convert(IMG_TRUECOLOR); #endif return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -byte CVidTheoraPlayer::getAlphaAt(int x, int y) { +byte VideoTheoraPlayer::getAlphaAt(int x, int y) { if (_alphaImage) return _alphaImage->getAlphaAt(x, y); else return 0xFF; } @@ -717,8 +717,8 @@ inline int intlog(int num) { } ////////////////////////////////////////////////////////////////////////// -bool CVidTheoraPlayer::SeekToTime(uint32 time) { - warning("CVidTheoraPlayer::SeekToTime(%d) - not supported", time); +bool VideoTheoraPlayer::SeekToTime(uint32 time) { + warning("VideoTheoraPlayer::SeekToTime(%d) - not supported", time); #if 0 if (!m_TheoraStreams) return STATUS_FAILED; @@ -781,7 +781,7 @@ finish: } ////////////////////////////////////////////////////////////////////////// -bool CVidTheoraPlayer::pause() { +bool VideoTheoraPlayer::pause() { if (_state == THEORA_STATE_PLAYING) { _state = THEORA_STATE_PAUSED; _theoraDecoder->pauseVideo(true); @@ -792,7 +792,7 @@ bool CVidTheoraPlayer::pause() { } ////////////////////////////////////////////////////////////////////////// -bool CVidTheoraPlayer::resume() { +bool VideoTheoraPlayer::resume() { if (_state == THEORA_STATE_PAUSED) { _state = THEORA_STATE_PLAYING; _theoraDecoder->pauseVideo(false); @@ -803,8 +803,8 @@ bool CVidTheoraPlayer::resume() { } ////////////////////////////////////////////////////////////////////////// -bool CVidTheoraPlayer::persist(CBPersistMgr *persistMgr) { - //CBBase::persist(persistMgr); +bool VideoTheoraPlayer::persist(BasePersistenceManager *persistMgr) { + //BaseClass::persist(persistMgr); if (persistMgr->_saving) { _savedPos = getMovieTime() * 1000; @@ -833,7 +833,7 @@ bool CVidTheoraPlayer::persist(CBPersistMgr *persistMgr) { } ////////////////////////////////////////////////////////////////////////// -bool CVidTheoraPlayer::initializeSimple() { +bool VideoTheoraPlayer::initializeSimple() { if (DID_SUCCEED(initialize(_filename))) { if (_alphaFilename != "") setAlphaImage(_alphaFilename); play(_playbackType, _posX, _posY, false, false, _looping, _savedPos, _playZoom); @@ -843,7 +843,7 @@ bool CVidTheoraPlayer::initializeSimple() { } ////////////////////////////////////////////////////////////////////////// -CBSurface *CVidTheoraPlayer::getTexture() { +BaseSurface *VideoTheoraPlayer::getTexture() { return _texture; } diff --git a/engines/wintermute/video/video_theora_player.h b/engines/wintermute/video/video_theora_player.h index 5bf8e165c7..6e0e4b3152 100644 --- a/engines/wintermute/video/video_theora_player.h +++ b/engines/wintermute/video/video_theora_player.h @@ -37,9 +37,9 @@ #include "graphics/surface.h" namespace WinterMute { -class CBSurface; -class CBImage; -class CVidTheoraPlayer : public CBBase { +class BaseSurface; +class BaseImage; +class VideoTheoraPlayer : public BaseClass { private: enum { THEORA_STATE_NONE = 0, @@ -50,16 +50,16 @@ private: Video::RewindableVideoDecoder *_theoraDecoder; Graphics::Surface _surface; public: - DECLARE_PERSISTENT(CVidTheoraPlayer, CBBase) + DECLARE_PERSISTENT(VideoTheoraPlayer, BaseClass) - CVidTheoraPlayer(CBGame *inGame); - virtual ~CVidTheoraPlayer(void); + VideoTheoraPlayer(BaseGame *inGame); + virtual ~VideoTheoraPlayer(void); // external objects Common::SeekableReadStream *_file; Common::String _filename; - CBSurface *_texture; + BaseSurface *_texture; //CVidSubtitler *_subtitler; // control methods @@ -69,7 +69,7 @@ public: bool play(TVideoPlayback type = VID_PLAY_CENTER, int x = 0, int y = 0, bool freezeGame = false, bool freezeMusic = true, bool Looping = false, uint32 startTime = 0, float forceZoom = -1.0f, int volume = -1); bool stop(); bool display(uint32 alpha = 0xFFFFFFFF); - //bool RenderFrame(CBSurface *Texture, yuv_buffer *yuv); + //bool RenderFrame(BaseSurface *Texture, yuv_buffer *yuv); bool pause(); bool resume(); @@ -87,7 +87,7 @@ public: uint32 getMovieTime(); uint32 getMovieFrame(); - CBSurface *getTexture(); + BaseSurface *getTexture(); int _state; uint32 _startTime; @@ -97,7 +97,7 @@ public: // alpha related - CBImage *_alphaImage; + BaseImage *_alphaImage; Common::String _alphaFilename; bool setAlphaImage(const Common::String &filename); __inline byte getAlphaAt(int x, int y); diff --git a/engines/wintermute/wintermute.cpp b/engines/wintermute/wintermute.cpp index 2a651baabf..69c5df5bc5 100644 --- a/engines/wintermute/wintermute.cpp +++ b/engines/wintermute/wintermute.cpp @@ -138,12 +138,12 @@ Common::Error WinterMuteEngine::run() { } int WinterMuteEngine::init() { - _classReg = new CSysClassRegistry(); + _classReg = new SystemClassRegistry(); _classReg->registerClasses(); - _game = new CAdGame; + _game = new AdGame; if (!_game) return 1; - CBPlatform::initialize(_game, 0, NULL); + BasePlatform::initialize(_game, 0, NULL); bool windowedMode = !ConfMan.getBool("fullscreen"); @@ -157,8 +157,8 @@ int WinterMuteEngine::init() { else param[0] = '\0'; if (strcmp(param, "") != 0) { - char *IniDir = CBUtils::GetPath(param); - char *IniName = CBUtils::GetFilename(param); + char *IniDir = BaseUtils::GetPath(param); + char *IniName = BaseUtils::GetFilename(param); // switch to ini's dir warning("TODO: Place ini-files somewhere"); @@ -230,7 +230,7 @@ int WinterMuteEngine::init() { // load game - uint32 DataInitStart = CBPlatform::getTime(); + uint32 DataInitStart = BasePlatform::getTime(); if (DID_FAIL(_game->loadFile(_game->_settingsGameFile ? _game->_settingsGameFile : "default.game"))) { _game->LOG(ret, "Error loading game file. Exiting."); @@ -242,7 +242,7 @@ int WinterMuteEngine::init() { _game->_renderer->_ready = true; _game->_miniUpdateEnabled = true; - _game->LOG(0, "Engine initialized in %d ms", CBPlatform::getTime() - DataInitStart); + _game->LOG(0, "Engine initialized in %d ms", BasePlatform::getTime() - DataInitStart); _game->LOG(0, ""); if (ConfMan.hasKey("save_slot")) { @@ -272,7 +272,7 @@ int WinterMuteEngine::messageLoop() { while (!done) { Common::Event event; while (_system->getEventManager()->pollEvent(event)) { - CBPlatform::handleEvent(&event); + BasePlatform::handleEvent(&event); } if (_game && _game->_renderer->_active && _game->_renderer->_ready) { diff --git a/engines/wintermute/wintermute.h b/engines/wintermute/wintermute.h index bf716a5a1f..b37f495b5e 100644 --- a/engines/wintermute/wintermute.h +++ b/engines/wintermute/wintermute.h @@ -31,8 +31,8 @@ namespace WinterMute { class Console; -class CBGame; -class CSysClassRegistry; +class BaseGame; +class SystemClassRegistry; // our engine debug channels enum { kWinterMuteDebugLog = 1 << 0, // The debug-logs from the original engine @@ -49,15 +49,15 @@ public: virtual Common::Error run(); virtual bool hasFeature(EngineFeature f) const; Common::SaveFileManager *getSaveFileMan() { return _saveFileMan; } - CSysClassRegistry *getClassRegistry(){ return _classReg; } + SystemClassRegistry *getClassRegistry(){ return _classReg; } uint32 randInt(int from, int to); private: int init(); void deinit(); int messageLoop(); Console *_console; - CBGame *_game; - CSysClassRegistry *_classReg; + BaseGame *_game; + SystemClassRegistry *_classReg; // We need random numbers Common::RandomSource *_rnd; const ADGameDescription *_gameDescription; -- cgit v1.2.3