Changeset 894 for Daodan/src/patches


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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.