mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-02 09:03:37 +00:00
Use std min and max
This commit is contained in:
parent
ab33c41f08
commit
4d93ddac4f
5
RSP.cpp
5
RSP.cpp
|
@ -1,3 +1,4 @@
|
|||
#include <algorithm>
|
||||
#include "Debug.h"
|
||||
#include "RSP.h"
|
||||
#include "RDP.h"
|
||||
|
@ -10,6 +11,8 @@
|
|||
#include "GBI.h"
|
||||
#include "Config.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
RSPInfo RSP;
|
||||
|
||||
void RSP_LoadMatrix( f32 mtx[4][4], u32 address )
|
||||
|
@ -130,7 +133,7 @@ void RSP_ProcessDList()
|
|||
RSP.halt = FALSE;
|
||||
RSP.busy = TRUE;
|
||||
|
||||
gSP.matrix.stackSize = min( 32, *(u32*)&DMEM[0x0FE4] >> 6 );
|
||||
gSP.matrix.stackSize = min( 32U, *(u32*)&DMEM[0x0FE4] >> 6 );
|
||||
gSP.matrix.modelViewi = 0;
|
||||
gSP.changed &= ~CHANGED_CPU_FB_WRITE;
|
||||
gSP.changed |= CHANGED_MATRIX;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <memory.h>
|
||||
#include <algorithm>
|
||||
#include "OpenGL.h"
|
||||
#include "Textures.h"
|
||||
#include "GBI.h"
|
||||
|
@ -13,6 +14,8 @@
|
|||
#include "Config.h"
|
||||
#include <assert.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
TextureCache cache;
|
||||
|
||||
typedef u32 (*GetTexelFunc)( u64 *src, u16 x, u16 i, u8 palette );
|
||||
|
@ -497,13 +500,13 @@ void TextureCache_LoadBackground( CachedTexture *texInfo )
|
|||
j = 0;
|
||||
for (y = 0; y < texInfo->realHeight; y++)
|
||||
{
|
||||
ty = min(y, clampTClamp);
|
||||
ty = min(y, (u32)clampTClamp);
|
||||
|
||||
src = &swapped[bpl * ty];
|
||||
|
||||
for (x = 0; x < texInfo->realWidth; x++)
|
||||
{
|
||||
tx = min(x, clampSClamp);
|
||||
tx = min(x, (u32)clampSClamp);
|
||||
|
||||
if (glInternalFormat == GL_RGBA)
|
||||
((u32*)dest)[j++] = GetTexel( (u64*)src, tx, 0, texInfo->palette );
|
||||
|
|
17
gDP.cpp
17
gDP.cpp
|
@ -1,4 +1,5 @@
|
|||
#include <assert.h>
|
||||
#include <algorithm>
|
||||
#include "GLideN64.h"
|
||||
#include "N64.h"
|
||||
#include "GBI.h"
|
||||
|
@ -17,6 +18,8 @@
|
|||
|
||||
#define DEPTH_CLEAR_COLOR 0xfffcfffc // The value usually used to clear depth buffer
|
||||
|
||||
using namespace std;
|
||||
|
||||
gDPInfo gDP;
|
||||
|
||||
void gDPSetOtherMode( u32 mode0, u32 mode1 )
|
||||
|
@ -261,9 +264,9 @@ void gDPSetColorImage( u32 format, u32 size, u32 width, u32 address )
|
|||
u32 height = 1;
|
||||
if (width == VI.width) {
|
||||
if (width == gSP.viewport.width)
|
||||
height = max(VI.height, gSP.viewport.height);
|
||||
height = max((float)VI.height, gSP.viewport.height);
|
||||
else
|
||||
height = max(VI.height, gDP.scissor.lry);
|
||||
height = max((float)VI.height, gDP.scissor.lry);
|
||||
} else if (width == gDP.scissor.lrx && width == gSP.viewport.width)
|
||||
height = max(gDP.scissor.lry, gSP.viewport.height);
|
||||
else if (width == gDP.scissor.lrx)
|
||||
|
@ -753,10 +756,10 @@ void gDPFillRDRAM(u32 address, s32 ulx, s32 uly, s32 lrx, s32 lry, u32 width, u3
|
|||
frameBuffer.top->cleared = true;
|
||||
frameBuffer.top->fillcolor = color;
|
||||
}
|
||||
ulx = min(max(ulx, gDP.scissor.ulx), gDP.scissor.lrx);
|
||||
lrx = min(max(lrx, gDP.scissor.ulx), gDP.scissor.lrx);
|
||||
uly = min(max(uly, gDP.scissor.uly), gDP.scissor.lry);
|
||||
lry = min(max(lry, gDP.scissor.uly), gDP.scissor.lry);
|
||||
ulx = min(max((float)ulx, gDP.scissor.ulx), gDP.scissor.lrx);
|
||||
lrx = min(max((float)lrx, gDP.scissor.ulx), gDP.scissor.lrx);
|
||||
uly = min(max((float)uly, gDP.scissor.uly), gDP.scissor.lry);
|
||||
lry = min(max((float)lry, gDP.scissor.uly), gDP.scissor.lry);
|
||||
u32 ci_width_in_dwords = width >> (3 - size);
|
||||
ulx >>= (3 - size);
|
||||
lrx >>= (3 - size);
|
||||
|
@ -903,7 +906,7 @@ void gDPTextureRectangle( f32 ulx, f32 uly, f32 lrx, f32 lry, s32 tile, f32 s, f
|
|||
|
||||
gDP.colorImage.changed = TRUE;
|
||||
if (gDP.colorImage.width < 64)
|
||||
gDP.colorImage.height = (u32)max( (s32)gDP.colorImage.height, lry );
|
||||
gDP.colorImage.height = (u32)max( (f32)gDP.colorImage.height, lry );
|
||||
else
|
||||
gDP.colorImage.height = max( gDP.colorImage.height, (u32)gDP.scissor.lry );
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user