Changeset 894


Ignore:
Timestamp:
Aug 12, 2013, 12:31:16 AM (11 years ago)
Author:
alloc
Message:

Daodan 3.5: Fix displaying screens larger than screen res

Location:
Daodan/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • Daodan/src/BFW_Motoko_Draw.h

    r705 r894  
    8282} M3tWin32GammaRamp;
    8383
     84typedef struct
     85{
     86        float   x;
     87        float   y;
     88        float   z;
     89        float   invW;
     90} M3tPointScreen;
     91
     92typedef struct
     93{
     94        char pad[8];
     95               
     96        UUtUns16 width;
     97        UUtUns16 height;
     98        int texelType; // enum IMtPixelType
     99               
     100        UUtUns16 num_x;
     101        UUtUns16 num_y;
     102
     103        UUtUns32 num_textures;
     104        void* textures[1]; // struct M3tTextureMap
     105} M3tTextureMap_Big;
     106
    84107extern char M3gResolutionSwitch;
    85108
  • Daodan/src/Daodan.h

    r838 r894  
    1818#define UUcError_None ((UUtError) 0)
    1919
     20typedef unsigned char UUtUns8;
     21typedef unsigned short UUtUns16;
     22typedef unsigned int UUtUns32;
     23typedef char UUtInt8;
     24typedef short UUtInt16;
     25typedef int UUtInt32;
     26
    2027extern HMODULE DDrDLLModule;
    2128extern HMODULE DDrONiModule;
  • Daodan/src/Daodan_Config.c

    r893 r894  
    2626bool patch_fonttexturecache = true;
    2727bool patch_getcmdline = true;
     28bool patch_hdscreens_lowres = true;
    2829bool patch_kickguns = false;
    2930bool patch_killvtune = true;
     
    131132                        else if (!_stricmp(name, "getcmdline"))
    132133                                patch_getcmdline = !_stricmp(inifile_cleanstr(value), "true");
     134                        else if (!_stricmp(name, "hdscreens_lowres"))
     135                                patch_hdscreens_lowres = !_stricmp(inifile_cleanstr(value), "true");
    133136                        else if (!_stricmp(name, "kickguns"))
    134137                                patch_kickguns = !_stricmp(inifile_cleanstr(value), "true");
  • Daodan/src/Daodan_Config.h

    r893 r894  
    2121extern bool patch_fonttexturecache;
    2222extern bool patch_getcmdline;
     23extern bool patch_hdscreens_lowres;
    2324extern bool patch_kickguns;
    2425extern bool patch_killvtune;
  • Daodan/src/Oni_Symbols.h

    r893 r894  
    220220DefFunc(void, AI2rDisplayDebuggingInfo, ONICALL, (Character* Char), 0x0048C5F0);
    221221DefFunc(uint32_t, M3rTextureMap_New, ONICALL, (short width, short height, int type, int allocated, int flags, char* name, void** output), 0x0041EB00);
     222DefFunc(void, M3rDraw_BigBitmap, ONICALL, (M3tTextureMap_Big* inBigBitmap, const M3tPointScreen *inDestPoint, UUtUns16 inWidth, UUtUns16 inHeight, UUtUns32 inShade, UUtUns16 inAlpha), 0x0041f6e0);
     223DefFunc(void, M3rDraw_Bitmap, ONICALL, (void* inBitmap, const M3tPointScreen* inDestPoint, UUtUns16 inWidth, UUtUns16 inHeight, UUtUns32 inShade, UUtUns16 inAlpha), 0x0041f4a0);
    222224/*
    223225DefFunc(void, M3rGeom_Line_Light, ONICALL, (), 0x0041f440);
  • Daodan/src/_Version.h

    r893 r894  
    66
    77#define DAODAN_VERSION_MAJOR 3
    8 #define DAODAN_VERSION_MINOR 4
     8#define DAODAN_VERSION_MINOR 5
    99#define DAODAN_VERSION_STRING STRINGIZE(DAODAN_VERSION_MAJOR) "." STRINGIZE(DAODAN_VERSION_MINOR)
    1010
  • Daodan/src/patches/Patches.c

    r893 r894  
    2424        WMrSlider_SetRange(window, min_value, max_value);
    2525}
    26  
     26
     27void ONICALL DD_M3rDraw_BigBitmap(M3tTextureMap_Big* inBigBitmap, const M3tPointScreen* inDestPoint, UUtUns16 inWidth, UUtUns16 inHeight, UUtUns32 inShade, UUtUns16 inAlpha) /* 0 - M3cMaxAlpha */
     28{
     29        UUtUns16 x;
     30        UUtUns16 y;
     31
     32        for (y = 0; y < inBigBitmap->num_y; y++)
     33        {
     34                for (x = 0; x < inBigBitmap->num_x; x++)
     35                {
     36                        UUtUns16 index;
     37                        void* texture; // M3tTextureMap
     38                        UUtUns16 width;
     39                        UUtUns16 height;
     40                        UUtInt16 temp;                 
     41                        UUtInt32 x_times_maxwidth;
     42                        UUtInt32 y_times_maxheight;
     43                       
     44                        index = x + (y * inBigBitmap->num_x);
     45                        texture = inBigBitmap->textures[index];
     46                       
     47                        x_times_maxwidth = x * 256;
     48                        y_times_maxheight = y * 256;
     49                       
     50                        // Cast to Unsigned to get the 16 bit int representation and then to signed to get the actual value. Doing it in one step gives wrong results (at least with gcc)
     51                        dest_point.x = (UUtInt16)((UUtUns16)inDestPoint->x) + x_times_maxwidth;
     52                        dest_point.y = (UUtInt16)((UUtUns16)inDestPoint->y) + y_times_maxheight;
     53                        dest_point.z = inDestPoint->z;
     54                        dest_point.invW = inDestPoint->invW;
     55
     56                        temp = (UUtInt16) ( ((UUtInt32)inWidth - x_times_maxwidth) > 0 ? ((UUtInt32)inWidth - x_times_maxwidth) : 0);
     57                        width = 256 < (UUtUns16)temp ? 256 : temp;
     58                        temp = (UUtInt16) ( ((UUtInt32)inHeight - y_times_maxheight) > 0 ? ((UUtInt32)inHeight - y_times_maxheight) : 0);
     59                        height = 256 < (UUtUns16)temp ? 256 : temp;
     60                               
     61                        M3rDraw_Bitmap(texture, &dest_point, width, height, inShade, inAlpha);
     62                }
     63        }
     64}
     65
     66
    2767void ONICALL DDrShowResumeButton(WMtWindow* window, int visibility)
    2868{
     
    274314}
    275315
     316// Allow HD screens with resolution < 1024*768
     317void DD_Patch_HDScreens_LowRes()
     318{
     319        DDrPatch_MakeJump((void*)M3rDraw_BigBitmap, (void*)DD_M3rDraw_BigBitmap);
     320}
     321
    276322// Hackish fix for Konoko not kicking guns
    277323// Don't use this, it breaks stairs.
     
    545591        if (patch_getcmdline)
    546592                DD_Patch_GetCmdLine();
     593
     594        if (patch_hdscreens_lowres)
     595                DD_Patch_HDScreens_LowRes();
    547596       
    548597        if (patch_kickguns)
Note: See TracChangeset for help on using the changeset viewer.