Ticket #8574: scummvmds_090_branch.patch

File scummvmds_090_branch.patch, 12.5 KB (added by agent-q, 18 years ago)

DS port codebase changes

  • C:/ndsdev/branch090/common/scummsys.h

     
    355355        typedef unsigned long uint32_t;
    356356        #endif
    357357
     358#elif defined (__DS__) //NeilM
     359
     360        #define scumm_stricmp stricmp
     361        #define scumm_strnicmp strnicmp
     362
     363        #define SCUMM_NEED_ALIGNMENT
     364        #define SCUMM_LITTLE_ENDIAN
     365
     366        #include "nds/jtypes.h"
     367        #include <stdarg.h>
     368        #include <ctype.h>
     369        #include <string.h>
     370        #include <math.h>
     371    #include <time.h>
     372
     373        #define STRINGBUFLEN 256
     374
    358375#else
    359376
    360377        #error No system type defined
  • C:/ndsdev/branch090/common/system.h

     
    440440         */
    441441        virtual void setShakePos(int shakeOffset) = 0;
    442442
     443        /**
     444         * Sets the area of the screen that has the focus.  For example, when a character
     445         * is speaking, they will have the focus.  Allows for pan-and-scan style views
     446         * where the backend could follow the speaking character or area of interest on
     447         * the screen.
     448         *
     449         * The backend is responsible for clipping the rectangle and deciding how best to
     450         * zoom the screen to show any shape and size rectangle the engine provides.
     451         *
     452         * @param rect A rectangle on the screen to be focused on
     453         * @see clearFocusRectangle
     454         */     
     455        virtual void setFocusRectangle(const Common::Rect& rect) {}
     456       
     457        /**
     458         * Clears the focus set by a call to setFocusRectangle().  This allows the engine
     459         * to clear the focus during times when no particular area of the screen has the
     460         * focus.
     461         * @see setFocusRectangle
     462         */
     463        virtual void clearFocusRectangle() {}
     464
     465
    443466        //@}
    444467
    445468
  • C:/ndsdev/branch090/engines/queen/display.cpp

     
    851851        }
    852852}
    853853
     854void Display::setFocusRect(const Common::Rect& rect) {
     855        _system->setFocusRectangle(rect);
     856}
     857
    854858int Display::textCenterX(const char *text) const {
    855859        return (GAME_SCREEN_WIDTH - textWidth(text)) / 2;
    856860}
  • C:/ndsdev/branch090/engines/queen/display.h

     
    149149        //! change the text color for the specified texts list entry
    150150        void textColor(uint16 y, uint8 color) { _texts[y].color = color; }
    151151
     152        //! Set the focus rectangle to the speaking character
     153        void setFocusRect(const Common::Rect& rect);
     154
    152155        int textCenterX(const char *text) const;
    153156        uint16 textWidth(const char *text) const;
    154157        uint16 textWidth(const char *text, uint16 len) const;
  • C:/ndsdev/branch090/engines/queen/talk.cpp

     
    865865                textY = bob->y;
    866866        }
    867867
     868        // Set the focus rectangle
     869        // FIXME: This may not be correct!
     870        BobFrame *pbf = _vm->bankMan()->fetchFrame(bob->frameNum);
     871
     872        int height = (pbf->height * bob->scale) / 100;
     873       
     874        Common::Rect focus(textX - 96, textY - height - 64, textX + 96, textY + height + 64);
     875        _vm->display()->setFocusRect(focus);
     876       
    868877        //int SF = _vm->grid()->findScale(textX, textY);
    869878
    870879        const SpeechParameters *parameters = NULL;
  • C:/ndsdev/branch090/engines/scumm/actor.cpp

     
    2222 */
    2323
    2424#include "common/stdafx.h"
     25#include "common/system.h"      // for setFocusRectangle/clearFocusRectangle
    2526#include "scumm/scumm.h"
    2627#include "scumm/actor.h"
    2728#include "scumm/akos.h"
     
    845846}
    846847
    847848void ScummEngine::setTalkingActor(int value) {
     849
     850        if (value == 255) {
     851                _system->clearFocusRectangle();
     852        } else {
     853                // Work out the screen co-ordinates of the actor
     854                int x = _actors[value]._pos.x - (camera._cur.x - (_screenWidth >> 1));
     855                int y = _actors[value]._top - (camera._cur.y - (_screenHeight >> 1));
     856               
     857                // Set the focus area to the calculated position
     858                // TODO: Make the size adjust depending on what it's focusing on.
     859                Common::Rect rect(x - 96, y - 64, x + 96, y + 64);
     860                _system->setFocusRectangle(rect);
     861        }
     862
    848863        if (_game.id == GID_MANIAC && _game.version <= 1 && !(_game.platform == Common::kPlatformNES))
    849864                _V1TalkingActor = value;
    850865        else
  • C:/ndsdev/branch090/engines/scumm/dialogs.cpp

     
    4343#include "sound/mididrv.h"
    4444#include "sound/mixer.h"
    4545
     46#ifdef __DS__
     47#include "scummhelp.h"
     48#endif
     49
    4650#ifndef DISABLE_HELP
    4751#include "scumm/help.h"
    4852#endif
     
    710714
    711715        String titleStr, *keyStr, *dscStr;
    712716
     717#ifndef __DS__
    713718        ScummHelp::updateStrings(_game.id, _game.version, _game.platform, _page, titleStr, keyStr, dscStr);
     719#else
     720        // DS version has a different help screen
     721        DS::updateStrings(_game.id, _game.version, _game.platform, _page, titleStr, keyStr, dscStr);
     722#endif
    714723
    715724        _title->setLabel(titleStr);
    716725        for (int i = 0; i < HELP_NUM_LINES; i++) {
  • C:/ndsdev/branch090/engines/scumm/gfx.cpp

     
    3232#include "scumm/resource.h"
    3333#include "scumm/usage_bits.h"
    3434#include "scumm/he/wiz_he.h"
     35#ifdef __DS__
     36#include "blitters.h"
     37#endif
    3538
    3639namespace Scumm {
    3740
     
    543546        if (_game.version < 7) {
    544547                // Handle the text mask in older games; newer (V7/V8) games do not use it anymore.
    545548                const byte *text = (byte *)_charset->_textSurface.pixels + x + y * _charset->_textSurface.pitch;
    546        
     549
     550#ifdef __DS__
     551                DS::asmDrawStripToScreen(height, width, text, src, dst, vs->pitch, _screenWidth, _charset->_textSurface.pitch);
     552#else   
     553
    547554                // Compose the text over the game graphics
    548555                for (int h = 0; h < height; ++h) {
    549556                        for (int w = 0; w < width; ++w) {
     
    556563                        dst += _screenWidth;
    557564                        text += _charset->_textSurface.pitch;
    558565                }
     566#endif
     567
    559568        } else {
    560569                // Just do a simple blit in V7/V8 games.
    561570                blit(dst, _screenWidth, src, vs->pitch, width, height);
     
    973982}
    974983
    975984static void copy8Col(byte *dst, int dstPitch, const byte *src, int height) {
    976         do {
     985#ifndef __DS__
     986do {
    977987#if defined(SCUMM_NEED_ALIGNMENT)
    978988                memcpy(dst, src, 8);
    979989#else
     
    983993                dst += dstPitch;
    984994                src += dstPitch;
    985995        } while (--height);
     996#else   
     997        DS::asmCopy8Col(dst, dstPitch, src, height);
     998#endif
    986999}
    9871000
    9881001static void clear8Col(byte *dst, int dstPitch, int height) {
  • C:/ndsdev/branch090/engines/scumm/thumbnail.cpp

     
    104104void ScummEngine::saveThumbnail(Common::OutSaveFile *file) {
    105105        Graphics::Surface thumb;
    106106
    107 #ifndef PALMOS_68K
     107#if !defined(PALMOS_68K) && !defined(__DS__)
    108108        if (!createThumbnailFromScreen(&thumb))
    109109#endif
    110110                thumb.create(kThumbnailWidth, kThumbnailHeight2, sizeof(uint16));
  • C:/ndsdev/branch090/engines/simon/simon.cpp

     
    491491                _textIndexBase = 1500 / 4;
    492492                _numTextBoxes = 20;
    493493                _numVideoOpcodes = 75;
    494 #ifndef PALMOS_68K
     494#if     defined(PALMOS_68K)
     495                _vgaMemSize = gVars->memory[kMemSimon2Games];
     496#elif defined(__DS__)
     497                _vgaMemSize = 1450000;
     498#else
    495499                _vgaMemSize = 2000000;
    496 #else
    497                 _vgaMemSize = gVars->memory[kMemSimon2Games];
    498500#endif
    499501                _tableMemSize = 100000;
    500502                // Check whether to use MT-32 MIDI tracks in Simon the Sorcerer 2
  • C:/ndsdev/branch090/engines/sky/logic.cpp

     
    25112511        bool speechFileFound = false;
    25122512        if (SkyEngine::isCDVersion())
    25132513                speechFileFound = _skySound->startSpeech((uint16)textNum);
     2514       
     2515        // Calculate the point where the character is
     2516        int x = (((uint32) (target->xcood)) * GAME_SCREEN_WIDTH) >> 9;
     2517        int y = ((((uint32) (target->ycood)) * GAME_SCREEN_HEIGHT) >> 9);
    25142518
     2519        // Set the focus region to that area
     2520        // TODO: Make the box size change based on the object that has the focus
     2521        Common::Rect rect(x - 96, y - 64, x + 96, y + 64);
     2522        _skyScreen->setFocusRectangle(rect);
     2523
    25152524        if ((SkyEngine::_systemVars.systemFlags & SF_ALLOW_TEXT) || !speechFileFound) {
    25162525                // form the text sprite, if player wants subtitles or
    25172526                // if we couldn't find the speech file
  • C:/ndsdev/branch090/engines/sky/screen.cpp

     
    105105        _system->updateScreen();
    106106}
    107107
     108void Screen::setFocusRectangle(const Common::Rect& rect) {
     109        _system->setFocusRectangle(rect);
     110}
     111
    108112//set a new palette, pal is a pointer to dos vga rgb components 0..63
    109113void Screen::setPalette(uint8 *pal) {
    110114
  • C:/ndsdev/branch090/engines/sky/screen.h

     
    8888
    8989        void paintBox(uint16 x, uint16 y);
    9090        void showGrid(uint8 *gridBuf);
     91        void setFocusRectangle(const Common::Rect& rect);
    9192
    9293private:
    9394        OSystem *_system;
  • C:/ndsdev/branch090/gui/options.cpp

     
    3535#include "sound/mididrv.h"
    3636#include "sound/mixer.h"
    3737
    38 #if (!( defined(PALMOS_MODE) || defined(__DC__) || defined(__GP32__) || defined(__amigaos4__) ) && !defined(_MSC_VER))
     38#if (!( defined(PALMOS_MODE) || defined(__DC__) || defined(__GP32__) || defined(__amigaos4__) || defined(__DS__) ) && !defined(_MSC_VER))
    3939#include <sys/param.h>
    4040#include <unistd.h>
    4141#endif
  • C:/ndsdev/branch090/sound/fmopl.cpp

     
    3535
    3636#include "common/util.h"
    3737
    38 #if defined (_WIN32_WCE) || defined (__SYMBIAN32__) || defined(PALMOS_MODE) || defined(__GP32__) || defined (__MAEMO__)
     38#if defined (_WIN32_WCE) || defined (__SYMBIAN32__) || defined(PALMOS_MODE) || defined(__GP32__) || defined (__MAEMO__) || defined(__DS__)
    3939#include "common/config-manager.h"
    4040#endif
    4141
     
    637637        /* allocate dynamic tables */
    638638        if((TL_TABLE = (int *)malloc(TL_MAX * 2 * sizeof(int))) == NULL)
    639639                return 0;
     640#ifdef __DS__
     641        // On the DS, use fast RAM for the sine table, since it thrashes the cache otherwise
     642        // Unfotunately, this doesn't stop OPL emulation from taking up far too much CPU time, but it helps a fair bit.
     643        SIN_TABLE = ((int **) (0x37F8000));
     644#else
    640645        if((SIN_TABLE = (int **)malloc(SIN_ENT * 4 * sizeof(int *))) == NULL) {
    641646                free(TL_TABLE);
    642647                return 0;
    643648        }
     649#endif
    644650        if((AMS_TABLE = (int *)malloc(AMS_ENT * 2 * sizeof(int))) == NULL) {
    645651                free(TL_TABLE);
    646652                free(SIN_TABLE);
     
    11721178        // We need to emulate one YM3812 chip
    11731179        int env_bits = FMOPL_ENV_BITS_HQ;
    11741180        int eg_ent = FMOPL_EG_ENT_HQ;
    1175 #if defined (_WIN32_WCE) || defined(__SYMBIAN32__) || defined(PALMOS_MODE) || defined(__GP32__) || defined(__MAEMO__)
     1181#if defined (_WIN32_WCE) || defined(__SYMBIAN32__) || defined(PALMOS_MODE) || defined(__GP32__) || defined(__MAEMO__) || defined(__DS__)
    11761182        if (ConfMan.hasKey("FM_high_quality") && ConfMan.getBool("FM_high_quality")) {
    11771183                env_bits = FMOPL_ENV_BITS_HQ;
    11781184                eg_ent = FMOPL_EG_ENT_HQ;