- Timestamp:
- Aug 12, 2013, 12:42:40 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Daodan/src/patches/Patches.c
r895 r896 30 30 UUtUns16 y; 31 31 32 UUtUns16 index; 33 UUtUns16 remaining_width; 34 UUtUns16 remaining_height; 35 36 M3tPointScreen dest_point; 37 dest_point.z = inDestPoint->z; 38 dest_point.invW = inDestPoint->invW; 39 40 index = 0; 41 remaining_height = inHeight; 42 dest_point.y = (UUtInt16)((UUtUns16)inDestPoint->y); 32 43 for (y = 0; y < inBigBitmap->num_y; y++) 33 44 { 45 remaining_width = inWidth; 46 dest_point.x = (UUtInt16)((UUtUns16)inDestPoint->x); 34 47 for (x = 0; x < inBigBitmap->num_x; x++) 35 48 { 36 UUtUns16 index;37 void* texture; // M3tTextureMap38 M3tPointScreen dest_point;39 49 UUtUns16 width; 40 50 UUtUns16 height; 41 UUtInt16 temp;42 UUtInt32 x_times_maxwidth;43 UUtInt32 y_times_maxheight;44 51 45 index = x + (y * inBigBitmap->num_x); 46 texture = inBigBitmap->textures[index]; 47 48 x_times_maxwidth = x * 256; 49 y_times_maxheight = y * 256; 50 51 // 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) 52 dest_point.x = (UUtInt16)((UUtUns16)inDestPoint->x) + x_times_maxwidth; 53 dest_point.y = (UUtInt16)((UUtUns16)inDestPoint->y) + y_times_maxheight; 54 dest_point.z = inDestPoint->z; 55 dest_point.invW = inDestPoint->invW; 56 57 temp = (UUtInt16) ( ((UUtInt32)inWidth - x_times_maxwidth) > 0 ? ((UUtInt32)inWidth - x_times_maxwidth) : 0); 58 width = 256 < (UUtUns16)temp ? 256 : temp; 59 temp = (UUtInt16) ( ((UUtInt32)inHeight - y_times_maxheight) > 0 ? ((UUtInt32)inHeight - y_times_maxheight) : 0); 60 height = 256 < (UUtUns16)temp ? 256 : temp; 52 width = 256 < remaining_width ? 256 : remaining_width; 53 height = 256 < remaining_height ? 256 : remaining_height; 61 54 62 M3rDraw_Bitmap(texture, &dest_point, width, height, inShade, inAlpha); 55 M3rDraw_Bitmap(inBigBitmap->textures[index], &dest_point, width, height, inShade, inAlpha); 56 57 dest_point.x += 256; 58 remaining_width -= 256; 59 index++; 63 60 } 61 dest_point.y += 256; 62 remaining_height -= 256; 64 63 } 65 64 }
Note:
See TracChangeset
for help on using the changeset viewer.