Ticket #4811: labels.patch
File labels.patch, 11.0 KB (added by , 14 years ago) |
---|
-
graphics.h
444 444 void unpackBlt(const Common::Rect& r, byte *data, uint size, Graphics::Surface *surf, uint16 z, uint scale, byte transparentColor); 445 445 446 446 // labels 447 void showFloatingLabel( uintlabel);447 void showFloatingLabel(GfxObj *label); 448 448 void hideFloatingLabel(); 449 449 450 uintrenderFloatingLabel(Font *font, char *text);451 uintcreateLabel(Font *font, const char *text, byte color);452 void showLabel( uint id, int16 x, int16 y);453 void hideLabel( uint id);450 GfxObj *renderFloatingLabel(Font *font, char *text); 451 GfxObj *createLabel(Font *font, const char *text, byte color); 452 void showLabel(GfxObj *label, int16 x, int16 y); 453 void hideLabel(GfxObj *label); 454 454 void freeLabels(); 455 void unregisterLabel(GfxObj *label); 455 456 456 457 // dialogue handling 457 458 GfxObj* registerBalloon(Frames *frames, const char *text); … … 528 529 void scroll(); 529 530 #define NO_FLOATING_LABEL 1000 530 531 532 struct Label { 533 Common::String _text; 534 int _x, _y; 535 int color; 536 bool _floating; 537 }; 538 531 539 GfxObjArray _labels; 532 540 GfxObjArray _balloons; 533 541 GfxObjArray _items; 534 542 535 uint_floatingLabel;543 GfxObj *_floatingLabel; 536 544 537 545 // overlay mode enables drawing of graphics with automatic screen-to-game coordinate translation 538 546 bool _overlayMode; -
parallaction.h
547 547 uint _subtitleLipSync; 548 548 #endif 549 549 int _subtitleY; 550 int_subtitle[2];550 GfxObj *_subtitle[2]; 551 551 ZonePtr _activeZone2; 552 552 uint32 _zoneFlags[NUM_LOCATIONS][NUM_ZONES]; 553 553 -
parallaction_br.cpp
87 87 88 88 _part = -1; 89 89 90 _subtitle[0] = -1;91 _subtitle[1] = -1;90 _subtitle[0] = 0; 91 _subtitle[1] = 0; 92 92 93 93 memset(_zoneFlags, 0, sizeof(_zoneFlags)); 94 94 … … 226 226 void Parallaction_br::freeLocation(bool removeAll) { 227 227 // free open location stuff 228 228 clearSubtitles(); 229 _subtitle[0] = _subtitle[1] = -1;229 _subtitle[0] = _subtitle[1] = 0; 230 230 231 231 _localFlagNames->clear(); 232 232 -
objects.h
272 272 273 273 uint32 _type; 274 274 uint32 _flags; 275 uint_label;275 GfxObj *_label; 276 276 277 277 TypeData u; 278 278 CommandList _commands; -
graphics.cpp
524 524 surf.fillRect(Common::Rect(w,h), LABEL_TRANSPARENT_COLOR); 525 525 } 526 526 527 uintGfx::renderFloatingLabel(Font *font, char *text) {527 GfxObj *Gfx::renderFloatingLabel(Font *font, char *text) { 528 528 529 529 Graphics::Surface *cnv = new Graphics::Surface; 530 530 … … 555 555 obj->transparentKey = LABEL_TRANSPARENT_COLOR; 556 556 obj->layer = LAYER_FOREGROUND; 557 557 558 uint id = _labels.size(); 559 _labels.insert_at(id, obj); 560 561 return id; 558 return obj; 562 559 } 563 560 564 void Gfx::showFloatingLabel(uint label) { 565 assert(label < _labels.size()); 566 561 void Gfx::showFloatingLabel(GfxObj *label) { 567 562 hideFloatingLabel(); 568 563 569 _labels[label]->x = -1000; 570 _labels[label]->y = -1000; 571 _labels[label]->setFlags(kGfxObjVisible); 572 573 _floatingLabel = label; 564 if (label) { 565 label->x = -1000; 566 label->y = -1000; 567 label->setFlags(kGfxObjVisible); 568 569 _floatingLabel = label; 570 _labels.push_back(label); 571 } 574 572 } 575 573 576 574 void Gfx::hideFloatingLabel() { 577 if (_floatingLabel != NO_FLOATING_LABEL) {578 _ labels[_floatingLabel]->clearFlags(kGfxObjVisible);575 if (_floatingLabel != 0) { 576 _floatingLabel->clearFlags(kGfxObjVisible); 579 577 } 580 _floatingLabel = NO_FLOATING_LABEL;578 _floatingLabel = 0; 581 579 } 582 580 583 581 584 582 void Gfx::updateFloatingLabel() { 585 if (_floatingLabel == NO_FLOATING_LABEL) {583 if (_floatingLabel == 0) { 586 584 return; 587 585 } 588 586 … … 596 594 } *traits; 597 595 598 596 Common::Rect r; 599 _ labels[_floatingLabel]->getRect(0, r);597 _floatingLabel->getRect(0, r); 600 598 601 599 if (_gameType == GType_Nippon) { 602 600 FloatingLabelTraits traits_NS = { … … 619 617 _vm->_input->getCursorPos(cursor); 620 618 Common::Point offset = (_vm->_input->_activeItem._id) ? traits->_offsetWithItem : traits->_offsetWithoutItem; 621 619 622 _ labels[_floatingLabel]->x = CLIP(cursor.x + offset.x, traits->_minX, traits->_maxX);623 _ labels[_floatingLabel]->y = CLIP(cursor.y + offset.y, traits->_minY, traits->_maxY);620 _floatingLabel->x = CLIP(cursor.x + offset.x, traits->_minX, traits->_maxX); 621 _floatingLabel->y = CLIP(cursor.y + offset.y, traits->_minY, traits->_maxY); 624 622 } 625 623 626 624 627 625 628 626 629 uintGfx::createLabel(Font *font, const char *text, byte color) {627 GfxObj *Gfx::createLabel(Font *font, const char *text, byte color) { 630 628 Graphics::Surface *cnv = new Graphics::Surface; 631 629 632 630 uint w, h; … … 652 650 obj->transparentKey = LABEL_TRANSPARENT_COLOR; 653 651 obj->layer = LAYER_FOREGROUND; 654 652 655 int id = _labels.size(); 653 return obj; 654 } 656 655 657 _labels.insert_at(id, obj); 656 void Gfx::showLabel(GfxObj *label, int16 x, int16 y) { 657 if (!label) { 658 return; 659 } 658 660 659 return id; 660 } 661 label->setFlags(kGfxObjVisible); 661 662 662 void Gfx::showLabel(uint id, int16 x, int16 y) {663 assert(id < _labels.size());664 _labels[id]->setFlags(kGfxObjVisible);665 666 663 Common::Rect r; 667 _labels[id]->getRect(0, r);664 label->getRect(0, r); 668 665 669 666 if (x == CENTER_LABEL_HORIZONTAL) { 670 667 x = CLIP<int16>((_backgroundInfo->width - r.width()) / 2, 0, _backgroundInfo->width/2); … … 674 671 y = CLIP<int16>((_vm->_screenHeight - r.height()) / 2, 0, _vm->_screenHeight/2); 675 672 } 676 673 677 _labels[id]->x = x; 678 _labels[id]->y = y; 674 label->x = x; 675 label->y = y; 676 677 _labels.push_back(label); 679 678 } 680 679 681 void Gfx::hideLabel(uint id) { 682 assert(id < _labels.size()); 683 _labels[id]->clearFlags(kGfxObjVisible); 680 void Gfx::hideLabel(GfxObj *label) { 681 label->clearFlags(kGfxObjVisible); 684 682 } 685 683 686 684 void Gfx::freeLabels() { 685 // for (uint i = 0; i < _labels.size(); i++) { 686 // delete _labels[i]; 687 // } 688 _labels.clear(); 689 _floatingLabel = 0; 690 } 691 692 void Gfx::unregisterLabel(GfxObj *label) { 693 int toBeRemoved = -1; 687 694 for (uint i = 0; i < _labels.size(); i++) { 688 delete _labels[i]; 695 if (_labels[i] == label) { 696 toBeRemoved = i; 697 } 689 698 } 690 _labels.clear(); 691 _floatingLabel = NO_FLOATING_LABEL; 699 700 if (toBeRemoved != -1) { 701 _labels.remove_at(toBeRemoved); 702 } 692 703 } 693 704 694 705 … … 724 735 725 736 setPalette(_palette); 726 737 727 _floatingLabel = NO_FLOATING_LABEL;738 _floatingLabel = 0; 728 739 729 740 _backgroundInfo = 0; 730 741 -
exec_br.cpp
96 96 _subtitle[1] = _gfx->createLabel(_labelFont, s2, color); 97 97 _gfx->showLabel(_subtitle[1], CENTER_LABEL_HORIZONTAL, _subtitleY + 5 + _labelFont->height()); 98 98 } else { 99 _subtitle[1] = -1;99 _subtitle[1] = 0; 100 100 } 101 101 #if 0 // disabled because no references to lip sync has been found in the scripts 102 102 _subtitleLipSync = 0; … … 104 104 } 105 105 106 106 void Parallaction_br::clearSubtitles() { 107 if (_subtitle[0] != -1) {107 if (_subtitle[0]) { 108 108 _gfx->hideLabel(_subtitle[0]); 109 109 } 110 110 111 if (_subtitle[1] != -1) {111 if (_subtitle[1]) { 112 112 _gfx->hideLabel(_subtitle[1]); 113 113 } 114 114 } -
parallaction_ns.cpp
355 355 356 356 if (locname.hasSlide()) { 357 357 showSlide(locname.slide()); 358 uint id = _gfx->createLabel(_menuFont, _location._slideText[0].c_str(), 1); 359 _gfx->showLabel(id, CENTER_LABEL_HORIZONTAL, 14); 358 _gfx->showLabel(_gfx->createLabel(_menuFont, _location._slideText[0].c_str(), 1), CENTER_LABEL_HORIZONTAL, 14); 360 359 _gfx->updateScreen(); 361 360 362 361 _input->waitForButtonEvent(kMouseLeftUp); -
callables_ns.cpp
409 409 410 410 parseLocation("common"); 411 411 412 uint id[2];413 id[0] = _gfx->createLabel(_menuFont, _location._slideText[0].c_str(), 1);414 id[1] = _gfx->createLabel(_menuFont, _location._slideText[1].c_str(), 1);412 GfxObj *labels[2]; 413 labels[0] = _gfx->createLabel(_menuFont, _location._slideText[0].c_str(), 1); 414 labels[1] = _gfx->createLabel(_menuFont, _location._slideText[1].c_str(), 1); 415 415 416 _gfx->showLabel( id[0], CENTER_LABEL_HORIZONTAL, 38);417 _gfx->showLabel( id[1], CENTER_LABEL_HORIZONTAL, 58);416 _gfx->showLabel(labels[0], CENTER_LABEL_HORIZONTAL, 38); 417 _gfx->showLabel(labels[1], CENTER_LABEL_HORIZONTAL, 58); 418 418 419 419 return; 420 420 } -
gui_ns.cpp
175 175 // user can choose language in this version 176 176 _vm->showSlide("lingua"); 177 177 178 uint id = _vm->_gfx->createLabel(_vm->_introFont, "SELECT LANGUAGE", 1); 179 _vm->_gfx->showLabel(id, 60, 30); 178 _vm->_gfx->showLabel(_vm->_gfx->createLabel(_vm->_introFont, "SELECT LANGUAGE", 1), 60, 30); 180 179 181 180 _vm->_input->setArrowCursor(); 182 181 } … … 201 200 int _choice, _oldChoice; 202 201 Common::String _nextState[2]; 203 202 204 uint_labels[2];203 GfxObj *_labels[2]; 205 204 206 205 Parallaction *_vm; 207 206 … … 321 320 _vm->changeBackground("test"); 322 321 _vm->_input->setMouseState(MOUSE_ENABLED_HIDE); 323 322 324 uintid[4];323 GfxObj *id[4]; 325 324 id[0] = _vm->_gfx->createLabel(_vm->_menuFont, introMsg3[0], 1); 326 325 id[1] = _vm->_gfx->createLabel(_vm->_menuFont, introMsg3[1], 1); 327 326 id[2] = _vm->_gfx->createLabel(_vm->_menuFont, introMsg3[2], 1); … … 402 401 Graphics::Surface _block; 403 402 Graphics::Surface _emptySlots; 404 403 405 uint_labels[2];404 GfxObj *_labels[2]; 406 405 uint _len; 407 406 uint32 _startTime; 408 407 … … 634 633 } 635 634 636 635 void drawCurrentLabel() { 637 uintid[2];636 GfxObj *id[2]; 638 637 id[0] = _vm->_gfx->createLabel(_vm->_menuFont, _credits[_current]._role, 1); 639 638 id[1] = _vm->_gfx->createLabel(_vm->_menuFont, _credits[_current]._name, 1); 640 639 _vm->_gfx->showLabel(id[0], CENTER_LABEL_HORIZONTAL, 80); … … 713 712 714 713 if (!_isDemo) { 715 714 _vm->_soundManI->stopMusic(); 716 int label = _vm->_gfx->createLabel(_vm->_menuFont, "CLICK MOUSE BUTTON TO START", 1); 717 _vm->_gfx->showLabel(label, CENTER_LABEL_HORIZONTAL, 80); 715 _vm->_gfx->showLabel(_vm->_gfx->createLabel(_vm->_menuFont, "CLICK MOUSE BUTTON TO START", 1), CENTER_LABEL_HORIZONTAL, 80); 718 716 } 719 717 } 720 718 }; … … 763 761 _vm->_input->setMouseState(MOUSE_DISABLED); 764 762 765 763 uint16 language = _vm->getInternLanguage(); 766 uintid[4];764 GfxObj *id[4]; 767 765 if (_allPartsComplete) { 768 766 id[0] = _vm->_gfx->createLabel(_vm->_menuFont, endMsg4[language], 1); 769 767 id[1] = _vm->_gfx->createLabel(_vm->_menuFont, endMsg5[language], 1); -
objects.cpp
204 204 } 205 205 206 206 Zone::~Zone() { 207 _vm->_gfx->unregisterLabel(_label); 208 delete _label; 207 209 } 208 210 209 211 void Zone::translate(int16 x, int16 y) {