Fix sdl and linux build

This commit is contained in:
Filip Gawin 2020-04-24 17:41:48 +02:00
parent 374f951d7c
commit e3227f5558
10 changed files with 18 additions and 13 deletions

View File

@ -82,6 +82,9 @@ readBMP(const char *afilename)
StreamMemory file; StreamMemory file;
int i, x, y; int i, x, y;
bool32 noalpha;
int pad;
filename = Image::getFilename(afilename); filename = Image::getFilename(afilename);
if(filename == nil) if(filename == nil)
return nil; return nil;
@ -103,7 +106,7 @@ readBMP(const char *afilename)
dib.paletteLen = 0; dib.paletteLen = 0;
} }
bool32 noalpha = true; noalpha = true;
// Recognize 32 bit formats // Recognize 32 bit formats
if(dib.compression == 3){ if(dib.compression == 3){
@ -138,7 +141,7 @@ readBMP(const char *afilename)
file.seek(bmp.offset, 0); file.seek(bmp.offset, 0);
int pad = image->width*image->bpp % 4; pad = image->width*image->bpp % 4;
uint8 *px, *line; uint8 *px, *line;
line = image->pixels + (image->height-1)*image->stride; line = image->pixels + (image->height-1)*image->stride;

View File

@ -144,7 +144,7 @@ Charset::printChar(uint32 c, int32 x, int32 y)
RWDEVICE::Im2DVertex *vert; RWDEVICE::Im2DVertex *vert;
uint16 *ix; uint16 *ix;
if(c >= this->desc.count) if((int32)c >= this->desc.count)
return; return;
if(this->raster != lastRaster || numChars >= NUMCHARS) if(this->raster != lastRaster || numChars >= NUMCHARS)

View File

@ -96,7 +96,7 @@ Texture *readNativeTexture(Stream *stream);
void writeNativeTexture(Texture *tex, Stream *stream); void writeNativeTexture(Texture *tex, Stream *stream);
uint32 getSizeNativeTexture(Texture *tex); uint32 getSizeNativeTexture(Texture *tex);
enum { enum : uint32 {
D3DFMT_UNKNOWN = 0xFFFFFFFF, D3DFMT_UNKNOWN = 0xFFFFFFFF,
/* Swizzled formats */ /* Swizzled formats */

View File

@ -497,7 +497,7 @@ Geometry::generateTriangles(int8 *adc)
static void static void
dumpMesh(Mesh *m) dumpMesh(Mesh *m)
{ {
for(int32 i = 0; i < m->numIndices-2; i++) for(uint32 i = 0; i < m->numIndices-2; i++)
// if(i % 2) // if(i % 2)
// printf("%3d %3d %3d\n", // printf("%3d %3d %3d\n",
// m->indices[i+1], // m->indices[i+1],

View File

@ -25,13 +25,14 @@
namespace rw { namespace rw {
namespace gl3 { namespace gl3 {
#ifndef LIBRW_SDL2
struct DisplayMode struct DisplayMode
{ {
GLFWvidmode mode; GLFWvidmode mode;
int32 depth; int32 depth;
uint32 flags; uint32 flags;
}; };
#endif
struct GlGlobals struct GlGlobals
{ {
@ -48,13 +49,13 @@ struct GlGlobals
DisplayMode *modes; DisplayMode *modes;
int numModes; int numModes;
int currentMode; int currentMode;
GLFWwindow **pWindow;
#endif #endif
int presentWidth, presentHeight; int presentWidth, presentHeight;
// for opening the window // for opening the window
int winWidth, winHeight; int winWidth, winHeight;
const char *winTitle; const char *winTitle;
GLFWwindow **pWindow;
} glGlobals; } glGlobals;
struct UniformState struct UniformState

View File

@ -14,6 +14,7 @@ struct EngineOpenParams
{ {
#ifdef LIBRW_SDL2 #ifdef LIBRW_SDL2
SDL_Window **window; SDL_Window **window;
bool32 fullscreen;
#else #else
GLFWwindow **window; GLFWwindow **window;
#endif #endif

View File

@ -475,7 +475,7 @@ static char*
rwstrdup(const char *s) rwstrdup(const char *s)
{ {
char *t; char *t;
int32 len = strlen(s)+1; size_t len = strlen(s)+1;
t = (char*)rwMalloc(len, MEMDUR_EVENT); t = (char*)rwMalloc(len, MEMDUR_EVENT);
if(t) if(t)
memcpy(t, s, len); memcpy(t, s, len);

View File

@ -198,7 +198,7 @@ struct Raster
void destroy(void); void destroy(void);
static bool32 imageFindRasterFormat(Image *image, int32 type, static bool32 imageFindRasterFormat(Image *image, int32 type,
int32 *pWidth, int32 *pHeight, int32 *pDepth, int32 *pFormat, int32 platform = 0); int32 *pWidth, int32 *pHeight, int32 *pDepth, int32 *pFormat, int32 platform = 0);
Raster *Raster::setFromImage(Image *image, int32 platform = 0); Raster *setFromImage(Image *image, int32 platform = 0);
static Raster *createFromImage(Image *image, int32 platform = 0); static Raster *createFromImage(Image *image, int32 platform = 0);
Image *toImage(void); Image *toImage(void);
uint8 *lock(int32 level, int32 lockMode); uint8 *lock(int32 level, int32 lockMode);

View File

@ -240,8 +240,8 @@ uvAnimParamInterpCB(void *out, void *in1, void *in2, float32 t, void *custom)
float32 f = (t - kf1->time) / (kf2->time - kf1->time); float32 f = (t - kf1->time) / (kf2->time - kf1->time);
float32 a = kf2->uv[0] - kf1->uv[0]; float32 a = kf2->uv[0] - kf1->uv[0];
while(a < M_PI) a += 2*M_PI; while(a < (float)M_PI) a += 2 * (float)M_PI;
while(a > M_PI) a -= 2*M_PI; while(a > (float)M_PI) a -= 2 * (float)M_PI;
intf->uv[0] = a*f + kf1->uv[0]; intf->uv[0] = a*f + kf1->uv[0];
intf->uv[1] = (kf2->uv[1] - kf1->uv[1])*f + kf1->uv[1]; intf->uv[1] = (kf2->uv[1] - kf1->uv[1])*f + kf1->uv[1];
intf->uv[2] = (kf2->uv[2] - kf1->uv[2])*f + kf1->uv[2]; intf->uv[2] = (kf2->uv[2] - kf1->uv[2])*f + kf1->uv[2];

View File

@ -287,11 +287,11 @@ putpixel(Canvas *canvas, Point3 p, Color c)
case DEPTHTEST_ALWAYS: case DEPTHTEST_ALWAYS:
break; break;
case DEPTHTEST_GEQUAL: case DEPTHTEST_GEQUAL:
if(p.z < *z) if(p.z < (int)*z)
return; return;
break; break;
case DEPTHTEST_GREATER: case DEPTHTEST_GREATER:
if(p.z <= *z) if(p.z <= (int)*z)
return; return;
break; break;
} }