ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/Daodan/src/patches/Patches.c
(Generate patch)

Comparing Daodan/src/patches/Patches.c (file contents):
Revision 893 by alloc, Fri Jul 26 10:42:31 2013 UTC vs.
Revision 894 by alloc, Sun Aug 11 22:31:16 2013 UTC

# Line 23 | Line 23 | static void ONICALL DD_ONiOGU_GammaSlide
23          WMrWindow_SetEnabled(window, M3gResolutionSwitch && opt_gamma);
24          WMrSlider_SetRange(window, min_value, max_value);
25   }
26 <
26 >
27 > void 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 >
67   void ONICALL DDrShowResumeButton(WMtWindow* window, int visibility)
68   {
69          if (visibility)
# Line 273 | Line 313 | void DD_Patch_GetCmdLine()
313          DDrPatch_NOOP  ((char*)(OniExe + 0x000d3280), 51);
314   }
315  
316 + // Allow HD screens with resolution < 1024*768
317 + void DD_Patch_HDScreens_LowRes()
318 + {
319 +        DDrPatch_MakeJump((void*)M3rDraw_BigBitmap, (void*)DD_M3rDraw_BigBitmap);
320 + }
321 +
322   // Hackish fix for Konoko not kicking guns
323   // Don't use this, it breaks stairs.
324   void DD_Patch_KickGuns()
# Line 544 | Line 590 | bool DD_Patch_Init()
590  
591          if (patch_getcmdline)
592                  DD_Patch_GetCmdLine();
593 +
594 +        if (patch_hdscreens_lowres)
595 +                DD_Patch_HDScreens_LowRes();
596          
597          if (patch_kickguns)
598                  DD_Patch_KickGuns();

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)