Welcome, Guest! Log In | Create Account

Changeset 45719

Show
Ignore:
Timestamp:
11/07/09 09:40:11 (5 weeks ago)
Author:
megath
Message:

added default delays for the messages

Location:
scummvm/trunk/engines/teenagent
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • scummvm/trunk/engines/teenagent/scene.cpp

    r45718 r45719  
    300300                if (!message.empty()) { 
    301301                        message.clear(); 
     302                        message_timer = 0; 
    302303                        nextEvent(); 
    303304                        return true; 
     
    310311                                intro = false; 
    311312                                message.clear(); 
     313                                message_timer = 0; 
    312314                                events.clear(); 
    313315                                sounds.clear(); 
     
    324326                        if (!message.empty()) { 
    325327                                message.clear(); 
     328                                message_timer = 0; 
    326329                                nextEvent(); 
    327330                                return true; 
     
    343346                restart = false; 
    344347                busy = processEventQueue(); 
     348                if (!message.empty() && message_timer != 0) { 
     349                        if (--message_timer == 0) { 
     350                                message.clear(); 
     351                                nextEvent(); 
     352                                continue; 
     353                        } 
     354                } 
    345355 
    346356                if (current_event.type == SceneEvent::kCreditsMessage) { 
     
    550560                case SceneEvent::kMessage: { 
    551561                                message = current_event.message; 
     562                                message_timer = messageDuration(message); 
    552563                                Common::Point p( 
    553564                                        (actor_animation_position.left + actor_animation_position.right) / 2,  
     
    678689} 
    679690 
     691uint Scene::messageDuration(const Common::String &str) { 
     692        uint words = 1; 
     693        for(uint i = 0; i < str.size(); ++i) { 
     694                if (str[i] == ' ' || str[i] == '\n') 
     695                        ++words; 
     696        } 
     697        words *= 7; //add text speed here 
     698        if (words < 15) 
     699                words = 15; 
     700 
     701        return words; 
     702} 
     703 
     704 
    680705void Scene::displayMessage(const Common::String &str, byte color) { 
    681706        //assert(!str.empty()); 
     
    684709        message_pos = messagePosition(str, position); 
    685710        message_color = color; 
     711        message_timer = messageDuration(message); 
    686712} 
    687713 
    688714void Scene::clear() { 
    689715        message.clear(); 
     716        message_timer = 0; 
    690717        events.clear(); 
    691718        current_event.clear(); 
  • scummvm/trunk/engines/teenagent/scene.h

    r45718 r45719  
    143143        void setPalette(OSystem *system, const byte *palette, unsigned mul = 1); 
    144144        static Common::Point messagePosition(const Common::String &str, Common::Point position); 
     145        static uint messageDuration(const Common::String &str); 
    145146 
    146147        bool processEventQueue(); 
     
    171172        Common::Point message_pos; 
    172173        byte message_color; 
     174        uint message_timer; 
    173175 
    174176        typedef Common::List<SceneEvent> EventList;