Fix some compile errors from me being too lazy to test anything but linux.

This commit is contained in:
Shpoike 2023-07-10 03:02:16 +01:00
parent 49822069a3
commit 09b9a76bb4
4 changed files with 14 additions and 7 deletions

View file

@ -4,6 +4,11 @@ PROJECT(QSS)
SET(QS_LIBS ${QS_LIBS} m ${CMAKE_DL_LIBS})
#other people seem to still care about msvc.
IF(CMAKE_C_COMPILER_ID MATCHES "GNU")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=pointer-arith") #block this gnuc extension
ENDIF()
FIND_PACKAGE(PkgConfig REQUIRED)
#sdl2 stuff

View file

@ -416,21 +416,21 @@ loc0:
line3 = ((surf->extents[0]>>surf->lmshift)+1);
for (maps = 0;maps < MAXLIGHTMAPS && surf->styles[maps] != INVALID_LIGHTSTYLE;maps++)
{
scale = (1<<7) * (float) d_lightstylevalue[surf->styles[maps]] * 1.0 / 256.0;
e = rgb9e5tab[lightmap[ 0]>>27] * scale;r00 += ((lightmap[ 0]>> 0)&0x1ff) * e;g00 += (float) ((lightmap[ 0]>> 9)&0x1ff) * e;b00 += (float) ((lightmap[ 0]>> 9)&0x1ff) * e;
e = rgb9e5tab[lightmap[ 1]>>27] * scale;r01 += ((lightmap[ 1]>> 0)&0x1ff) * e;g01 += (float) ((lightmap[ 1]>> 9)&0x1ff) * e;b01 += (float) ((lightmap[ 1]>> 9)&0x1ff) * e;
e = rgb9e5tab[lightmap[line3+0]>>27] * scale;r10 += ((lightmap[line3+0]>> 0)&0x1ff) * e;g10 += (float) ((lightmap[line3+0]>> 9)&0x1ff) * e;b10 += (float) ((lightmap[line3+0]>> 9)&0x1ff) * e;
e = rgb9e5tab[lightmap[line3+1]>>27] * scale;r11 += ((lightmap[line3+1]>> 0)&0x1ff) * e;g11 += (float) ((lightmap[line3+1]>> 9)&0x1ff) * e;b11 += (float) ((lightmap[line3+1]>> 9)&0x1ff) * e;
scale = (1<<7) * (float) d_lightstylevalue[surf->styles[maps]] * 1.0f / 256.0f;
e = rgb9e5tab[lightmap[ 0]>>27] * scale;r00 += ((lightmap[ 0]>> 0)&0x1ff) * e;g00 += ((lightmap[ 0]>> 9)&0x1ff) * e;b00 += ((lightmap[ 0]>> 9)&0x1ff) * e;
e = rgb9e5tab[lightmap[ 1]>>27] * scale;r01 += ((lightmap[ 1]>> 0)&0x1ff) * e;g01 += ((lightmap[ 1]>> 9)&0x1ff) * e;b01 += ((lightmap[ 1]>> 9)&0x1ff) * e;
e = rgb9e5tab[lightmap[line3+0]>>27] * scale;r10 += ((lightmap[line3+0]>> 0)&0x1ff) * e;g10 += ((lightmap[line3+0]>> 9)&0x1ff) * e;b10 += ((lightmap[line3+0]>> 9)&0x1ff) * e;
e = rgb9e5tab[lightmap[line3+1]>>27] * scale;r11 += ((lightmap[line3+1]>> 0)&0x1ff) * e;g11 += ((lightmap[line3+1]>> 9)&0x1ff) * e;b11 += ((lightmap[line3+1]>> 9)&0x1ff) * e;
lightmap += ((surf->extents[0]>>surf->lmshift)+1) * ((surf->extents[1]>>surf->lmshift)+1);
}
}
else
{
byte *lightmap = surf->samples + ((dt>>surf->lmshift) * ((surf->extents[0]>>surf->lmshift)+1) + (ds>>surf->lmshift))*3; // LordHavoc: *3 for color
byte *lightmap = (byte*)surf->samples + ((dt>>surf->lmshift) * ((surf->extents[0]>>surf->lmshift)+1) + (ds>>surf->lmshift))*3; // LordHavoc: *3 for color
line3 = ((surf->extents[0]>>surf->lmshift)+1)*3;
for (maps = 0;maps < MAXLIGHTMAPS && surf->styles[maps] != INVALID_LIGHTSTYLE;maps++)
{
scale = (float) d_lightstylevalue[surf->styles[maps]] * 1.0 / 256.0;
scale = (float) d_lightstylevalue[surf->styles[maps]] * 1.0f / 256.0f;
r00 += (float) lightmap[ 0] * scale;g00 += (float) lightmap[ 1] * scale;b00 += (float) lightmap[2] * scale;
r01 += (float) lightmap[ 3] * scale;g01 += (float) lightmap[ 4] * scale;b01 += (float) lightmap[5] * scale;
r10 += (float) lightmap[line3+0] * scale;g10 += (float) lightmap[line3+1] * scale;b10 += (float) lightmap[line3+2] * scale;

View file

@ -109,6 +109,7 @@ sys_socket_t UDP4_Init (void)
}
else
myAddr4 = *(in_addr_t *)local->h_addr_list[0];
}
#endif
}

View file

@ -37,6 +37,7 @@ typedef int string_t;
#define Q_ALIGN(a)
#endif
//64bit types need alignment hints to ensure we don't get misalignment exceptions on other platforms.
#include <inttypes.h> //just in case...
typedef Q_ALIGN(4) int64_t qcsint64_t;
typedef Q_ALIGN(4) uint64_t qcuint64_t;
typedef Q_ALIGN(4) double qcdouble_t;