Merge branch 'master' into next

This commit is contained in:
Alam Ed Arias 2016-07-21 18:49:33 -04:00
commit 5c234a817a
9 changed files with 107 additions and 51 deletions

View file

@ -189,6 +189,10 @@ ifdef FREEBSD
UNIXCOMMON=1
endif
ifdef MACOSX
UNIXCOMMON=1
endif
ifdef NDS
NOPNG=1
NONET=1
@ -594,11 +598,15 @@ ifndef WINDOWSHELL
-$(GZIP) $(GZIP_OPT2) $(BIN)/$(DBGNAME).txt
endif
endif
# mac os x lsdlsrb2 does not like objcopy
ifndef MACOSX
ifndef PSP
$(OBJCOPY) $(BIN)/$(EXENAME) $(BIN)/$(DBGNAME)
$(OBJCOPY) --strip-debug $(BIN)/$(EXENAME)
-$(OBJCOPY) --add-gnu-debuglink=$(BIN)/$(DBGNAME) $(BIN)/$(EXENAME)
endif
endif
ifndef NOUPX
-$(UPX) $(UPX_OPTS) $(BIN)/$(EXENAME)
endif
@ -746,6 +754,11 @@ $(OBJDIR)/%.o: %.c
$(OBJDIR)/%.o: $(INTERFACE)/%.c
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
ifdef MACOSX
$(OBJDIR)/%.o: sdl/macosx/%.c
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
endif
$(OBJDIR)/%.o: hardware/%.c
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@

View file

@ -406,6 +406,15 @@ else
WINDRES=windres
endif
# because Apple screws with us on this
# need to get bintools from homebrew
ifdef MACOSX
CC=clang
CXX=clang
OBJCOPY=gobjcopy
OBJDUMP=gobjdump
endif
OBJDUMP_OPTS?=--wide --source --line-numbers
LD=$(CC)

View file

@ -92,7 +92,7 @@ typedef long ssize_t;
#endif
#ifdef __APPLE_CC__
#define DIRECTFULLSCREEN
#define DIRECTFULLSCREEN 1
#define DEBUG_LOG
#define NOIPX
#endif

View file

@ -874,9 +874,9 @@ void R_DrawTiltedSplat_8(void)
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
val = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]];
val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)];
if (val != TRANSPARENTPIXEL)
*dest = val;
*dest = colormap[val];
dest++;
iz += ds_sz.x;
uz += ds_su.x;
@ -913,9 +913,9 @@ void R_DrawTiltedSplat_8(void)
for (i = SPANSIZE-1; i >= 0; i--)
{
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
val = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]];
val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)];
if (val != TRANSPARENTPIXEL)
*dest = val;
*dest = colormap[val];
dest++;
u += stepu;
v += stepv;
@ -931,9 +931,9 @@ void R_DrawTiltedSplat_8(void)
u = (INT64)(startu);
v = (INT64)(startv);
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
val = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]];
val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)];
if (val != TRANSPARENTPIXEL)
*dest = val;
*dest = colormap[val];
}
else
{
@ -954,9 +954,9 @@ void R_DrawTiltedSplat_8(void)
for (; width != 0; width--)
{
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
val = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]];
val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)];
if (val != TRANSPARENTPIXEL)
*dest = val;
*dest = colormap[val];
dest++;
u += stepu;
v += stepv;
@ -1124,49 +1124,49 @@ void R_DrawTranslucentSplat_8 (void)
// need!
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
if (val != TRANSPARENTPIXEL)
dest[0] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + dest[0])];
dest[0] = colormap[*(ds_transmap + (val << 8) + dest[0])];
xposition += xstep;
yposition += ystep;
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
if (val != TRANSPARENTPIXEL)
dest[1] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + dest[1])];
dest[1] = colormap[*(ds_transmap + (val << 8) + dest[1])];
xposition += xstep;
yposition += ystep;
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
if (val != TRANSPARENTPIXEL)
dest[2] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + dest[2])];
dest[2] = colormap[*(ds_transmap + (val << 8) + dest[2])];
xposition += xstep;
yposition += ystep;
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
if (val != TRANSPARENTPIXEL)
dest[3] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + dest[3])];
dest[3] = colormap[*(ds_transmap + (val << 8) + dest[3])];
xposition += xstep;
yposition += ystep;
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
if (val != TRANSPARENTPIXEL)
dest[4] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + dest[4])];
dest[4] = colormap[*(ds_transmap + (val << 8) + dest[4])];
xposition += xstep;
yposition += ystep;
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
if (val != TRANSPARENTPIXEL)
dest[5] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + dest[5])];
dest[5] = colormap[*(ds_transmap + (val << 8) + dest[5])];
xposition += xstep;
yposition += ystep;
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
if (val != TRANSPARENTPIXEL)
dest[6] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + dest[6])];
dest[6] = colormap[*(ds_transmap + (val << 8) + dest[6])];
xposition += xstep;
yposition += ystep;
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
if (val != TRANSPARENTPIXEL)
dest[7] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + dest[7])];
dest[7] = colormap[*(ds_transmap + (val << 8) + dest[7])];
xposition += xstep;
yposition += ystep;
@ -1175,9 +1175,9 @@ void R_DrawTranslucentSplat_8 (void)
}
while (count--)
{
val =colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]];
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
if (val != TRANSPARENTPIXEL)
*dest = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dest)];
*dest = colormap[*(ds_transmap + (val << 8) + *dest)];
dest++;
xposition += xstep;

View file

@ -919,9 +919,9 @@ void R_SkyboxFrame(player_t *player)
}
}
if (mh->skybox_scalez > 0)
viewz += player->awayviewmobj->z / mh->skybox_scalez;
viewz += (player->awayviewmobj->z + 20*FRACUNIT) / mh->skybox_scalez;
else if (mh->skybox_scalez < 0)
viewz += player->awayviewmobj->z * -mh->skybox_scalez;
viewz += (player->awayviewmobj->z + 20*FRACUNIT) * -mh->skybox_scalez;
}
else if (thiscam->chase)
{
@ -966,9 +966,9 @@ void R_SkyboxFrame(player_t *player)
}
}
if (mh->skybox_scalez > 0)
viewz += thiscam->z / mh->skybox_scalez;
viewz += (thiscam->z + (thiscam->height>>1)) / mh->skybox_scalez;
else if (mh->skybox_scalez < 0)
viewz += thiscam->z * -mh->skybox_scalez;
viewz += (thiscam->z + (thiscam->height>>1)) * -mh->skybox_scalez;
}
else
{

View file

@ -1488,7 +1488,7 @@ static void R_RenderSegLoop (void)
{
// note: don't use min/max macros, since casting from INT32 to INT16 is involved here
if (markceiling)
ceilingclip[rw_x] = (yh >= 0) ? ((yl > viewheight) ? (INT16)viewheight : (INT16)((INT16)yl - 1)) : -1;
ceilingclip[rw_x] = (yl >= 0) ? ((yl > viewheight) ? (INT16)viewheight : (INT16)((INT16)yl - 1)) : -1;
if (markfloor)
floorclip[rw_x] = (yh < viewheight) ? ((yh < -1) ? -1 : (INT16)((INT16)yh + 1)) : (INT16)viewheight;
}
@ -1523,10 +1523,10 @@ static void R_RenderSegLoop (void)
ceilingclip[rw_x] = -1;
}
else
ceilingclip[rw_x] = (yh >= 0) ? ((yl > viewheight) ? (INT16)viewheight : (INT16)((INT16)yl - 1)) : -1;
ceilingclip[rw_x] = (yl >= 0) ? ((yl > viewheight) ? (INT16)viewheight : (INT16)((INT16)yl - 1)) : -1;
}
else if (markceiling) // no top wall
ceilingclip[rw_x] = (yh >= 0) ? ((yl > viewheight) ? (INT16)viewheight : (INT16)((INT16)yl - 1)) : -1;
ceilingclip[rw_x] = (yl >= 0) ? ((yl > viewheight) ? (INT16)viewheight : (INT16)((INT16)yl - 1)) : -1;
if (bottomtexture)
{

View file

@ -56,6 +56,15 @@ ifdef FREEBSD
LIBS+=-lipx -lkvm
endif
#
#here is Mac OS X
#
ifdef MACOSX
OBJS+=$(OBJDIR)/mac_resources.o
OBJS+=$(OBJDIR)/mac_alert.o
LIBS+=-framework CoreFoundation
endif
#
#here is GP2x (arm-gp2x-linux)
#

View file

@ -25,19 +25,38 @@
#include "mac_alert.h"
#include <CoreFoundation/CoreFoundation.h>
#define CFSTRINGIFY(x) CFStringCreateWithCString(NULL, x, kCFStringEncodingASCII)
int MacShowAlert(const char *title, const char *message, const char *button1, const char *button2, const char *button3)
{
CFOptionFlags results;
CFUserNotificationDisplayAlert(0,
kCFUserNotificationStopAlertLevel | kCFUserNotificationNoDefaultButtonFlag,
NULL, NULL, NULL,
CFStringCreateWithCString(NULL, title, kCFStringEncodingASCII),
CFStringCreateWithCString(NULL, message, kCFStringEncodingASCII),
button1 != NULL ? CFStringCreateWithCString(NULL, button1, kCFStringEncodingASCII) : NULL,
button2 != NULL ? CFStringCreateWithCString(NULL, button2, kCFStringEncodingASCII) : NULL,
button3 != NULL ? CFStringCreateWithCString(NULL, button3, kCFStringEncodingASCII) : NULL,
&results);
CFStringRef cf_title = CFSTRINGIFY(title);
CFStringRef cf_message = CFSTRINGIFY(message);
CFStringRef cf_button1 = NULL;
CFStringRef cf_button2 = NULL;
CFStringRef cf_button3 = NULL;
if (button1 != NULL)
cf_button1 = CFSTRINGIFY(button1);
if (button2 != NULL)
cf_button2 = CFSTRINGIFY(button2);
if (button3 != NULL)
cf_button3 = CFSTRINGIFY(button3);
CFOptionFlags alert_flags = kCFUserNotificationStopAlertLevel | kCFUserNotificationNoDefaultButtonFlag;
CFUserNotificationDisplayAlert(0, alert_flags, NULL, NULL, NULL, cf_title, cf_message,
cf_button1, cf_button2, cf_button3, &results);
if (cf_button1 != NULL)
CFRelease(cf_button1);
if (cf_button2 != NULL)
CFRelease(cf_button2);
if (cf_button3 != NULL)
CFRelease(cf_button3);
CFRelease(cf_message);
CFRelease(cf_title);
return (int)results;
}

View file

@ -9,23 +9,29 @@ void OSX_GetResourcesPath(char * buffer)
mainBundle = CFBundleGetMainBundle();
if (mainBundle)
{
const int BUF_SIZE = 256; // because we somehow always know that
CFURLRef appUrlRef = CFBundleCopyBundleURL(mainBundle);
CFStringRef macPath = CFURLCopyFileSystemPath(appUrlRef, kCFURLPOSIXPathStyle);
CFStringRef resources = CFStringCreateWithCString(kCFAllocatorMalloc, "/Contents/Resources", kCFStringEncodingASCII);
const void* rawarray[2] = {macPath, resources};
CFArrayRef array = CFArrayCreate(kCFAllocatorMalloc, rawarray, 2, NULL);
CFStringRef separator = CFStringCreateWithCString(kCFAllocatorMalloc, "", kCFStringEncodingASCII);
CFStringRef fullPath = CFStringCreateByCombiningStrings(kCFAllocatorMalloc, array, separator);
const char * path = CFStringGetCStringPtr(fullPath, kCFStringEncodingASCII);
strcpy(buffer, path);
CFRelease(fullPath);
path = NULL;
CFRelease(array);
CFRelease(resources);
CFStringRef macPath;
if (appUrlRef != NULL)
macPath = CFURLCopyFileSystemPath(appUrlRef, kCFURLPOSIXPathStyle);
else
macPath = NULL;
const char* rawPath;
if (macPath != NULL)
rawPath = CFStringGetCStringPtr(macPath, kCFStringEncodingASCII);
else
rawPath = NULL;
if (rawPath != NULL && (CFStringGetLength(macPath) + strlen("/Contents/Resources") < BUF_SIZE))
{
strcpy(buffer, rawPath);
strcat(buffer, "/Contents/Resources");
}
CFRelease(macPath);
CFRelease(appUrlRef);
//CFRelease(mainBundle);
CFRelease(separator);
}
}
}