diff --git a/SRB2.cbp b/SRB2.cbp
index 43696ee2e..99a712264 100644
--- a/SRB2.cbp
+++ b/SRB2.cbp
@@ -2815,6 +2815,39 @@ HW3SOUND for 3D hardware sound support
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 035b46556..ba354c289 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -22,6 +22,7 @@ set(SRB2_CORE_SOURCES
i_tcp.c
info.c
lzf.c
+ m_aatree.c
m_anigif.c
m_argv.c
m_bbox.c
@@ -83,6 +84,7 @@ set(SRB2_CORE_HEADERS
info.h
keys.h
lzf.h
+ m_aatree.h
m_anigif.h
m_argv.h
m_bbox.h
diff --git a/src/Makefile b/src/Makefile
index f7a8c1b85..ce4b569ee 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -189,6 +189,10 @@ ifdef FREEBSD
UNIXCOMMON=1
endif
+ifdef MACOSX
+UNIXCOMMON=1
+endif
+
ifdef NDS
NOPNG=1
NONET=1
@@ -429,6 +433,7 @@ OBJS:=$(i_main_o) \
$(OBJDIR)/hu_stuff.o \
$(OBJDIR)/y_inter.o \
$(OBJDIR)/st_stuff.o \
+ $(OBJDIR)/m_aatree.o \
$(OBJDIR)/m_anigif.o \
$(OBJDIR)/m_argv.o \
$(OBJDIR)/m_bbox.o \
@@ -593,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
@@ -745,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 $@
diff --git a/src/Makefile.cfg b/src/Makefile.cfg
index 347efa5e4..72404becc 100644
--- a/src/Makefile.cfg
+++ b/src/Makefile.cfg
@@ -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)
diff --git a/src/doomtype.h b/src/doomtype.h
index 2d9d36328..a711b466d 100644
--- a/src/doomtype.h
+++ b/src/doomtype.h
@@ -92,7 +92,7 @@ typedef long ssize_t;
#endif
#ifdef __APPLE_CC__
-#define DIRECTFULLSCREEN
+#define DIRECTFULLSCREEN 1
#define DEBUG_LOG
#define NOIPX
#endif
diff --git a/src/m_aatree.c b/src/m_aatree.c
new file mode 100644
index 000000000..6cb3a32cb
--- /dev/null
+++ b/src/m_aatree.c
@@ -0,0 +1,167 @@
+// SONIC ROBO BLAST 2
+//-----------------------------------------------------------------------------
+// Copyright (C) 1993-1996 by id Software, Inc.
+// Copyright (C) 1998-2000 by DooM Legacy Team.
+// Copyright (C) 1999-2016 by Sonic Team Junior.
+//
+// This program is free software distributed under the
+// terms of the GNU General Public License, version 2.
+// See the 'LICENSE' file for more details.
+//-----------------------------------------------------------------------------
+/// \file m_aatree.h
+/// \brief AA trees code
+
+#include "m_aatree.h"
+#include "z_zone.h"
+
+// A partial implementation of AA trees,
+// according to the algorithms given on Wikipedia.
+// http://en.wikipedia.org/wiki/AA_tree
+
+typedef struct aatree_node_s
+{
+ INT32 level;
+ INT32 key;
+ void* value;
+
+ struct aatree_node_s *left, *right;
+} aatree_node_t;
+
+struct aatree_s
+{
+ aatree_node_t *root;
+ UINT32 flags;
+};
+
+aatree_t *M_AATreeAlloc(UINT32 flags)
+{
+ aatree_t *aatree = Z_Malloc(sizeof (aatree_t), PU_STATIC, NULL);
+ aatree->root = NULL;
+ aatree->flags = flags;
+ return aatree;
+}
+
+static void M_AATreeFree_Node(aatree_node_t *node)
+{
+ if (node->left) M_AATreeFree_Node(node->left);
+ if (node->right) M_AATreeFree_Node(node->right);
+ Z_Free(node);
+}
+
+void M_AATreeFree(aatree_t *aatree)
+{
+ if (aatree->root)
+ M_AATreeFree_Node(aatree->root);
+
+ Z_Free(aatree);
+}
+
+static aatree_node_t *M_AATreeSkew(aatree_node_t *node)
+{
+ if (node && node->left && node->left->level == node->level)
+ {
+ // Not allowed: horizontal left-link. Reverse the
+ // horizontal link and hook the orphan back in.
+ aatree_node_t *oldleft = node->left;
+ node->left = oldleft->right;
+ oldleft->right = node;
+
+ return oldleft;
+ }
+
+ // No change needed.
+ return node;
+}
+
+static aatree_node_t *M_AATreeSplit(aatree_node_t *node)
+{
+ if (node && node->right && node->right->right && node->level == node->right->right->level)
+ {
+ // Not allowed: two consecutive horizontal right-links.
+ // The middle one becomes the new root at this point,
+ // with suitable adjustments below.
+
+ aatree_node_t *oldright = node->right;
+ node->right = oldright->left;
+ oldright->left = node;
+ oldright->level++;
+
+ return oldright;
+ }
+
+ // No change needed.
+ return node;
+}
+
+static aatree_node_t *M_AATreeSet_Node(aatree_node_t *node, UINT32 flags, INT32 key, void* value)
+{
+ if (!node)
+ {
+ // Nothing here, so just add where we are
+
+ node = Z_Malloc(sizeof (aatree_node_t), PU_STATIC, NULL);
+ node->level = 1;
+ node->key = key;
+ if (value && (flags & AATREE_ZUSER)) Z_SetUser(value, &node->value);
+ else node->value = value;
+ node->left = node->right = NULL;
+ }
+ else
+ {
+ if (key < node->key)
+ node->left = M_AATreeSet_Node(node->left, flags, key, value);
+ else if (key > node->key)
+ node->right = M_AATreeSet_Node(node->right, flags, key, value);
+ else
+ {
+ if (value && (flags & AATREE_ZUSER)) Z_SetUser(value, &node->value);
+ else node->value = value;
+ }
+
+ node = M_AATreeSkew(node);
+ node = M_AATreeSplit(node);
+ }
+
+ return node;
+}
+
+void M_AATreeSet(aatree_t *aatree, INT32 key, void* value)
+{
+ aatree->root = M_AATreeSet_Node(aatree->root, aatree->flags, key, value);
+}
+
+// Caveat: we don't distinguish between nodes that don't exists
+// and nodes with value == NULL.
+static void *M_AATreeGet_Node(aatree_node_t *node, INT32 key)
+{
+ if (node)
+ {
+ if (node->key == key)
+ return node->value;
+ else if(node->key < key)
+ return M_AATreeGet_Node(node->right, key);
+ else
+ return M_AATreeGet_Node(node->left, key);
+ }
+
+ return NULL;
+}
+
+void *M_AATreeGet(aatree_t *aatree, INT32 key)
+{
+ return M_AATreeGet_Node(aatree->root, key);
+}
+
+
+static void M_AATreeIterate_Node(aatree_node_t *node, aatree_iter_t callback)
+{
+ if (node->left) M_AATreeIterate_Node(node->left, callback);
+ callback(node->key, node->value);
+ if (node->right) M_AATreeIterate_Node(node->right, callback);
+}
+
+void M_AATreeIterate(aatree_t *aatree, aatree_iter_t callback)
+{
+ if (aatree->root)
+ M_AATreeIterate_Node(aatree->root, callback);
+}
diff --git a/src/m_aatree.h b/src/m_aatree.h
new file mode 100644
index 000000000..c9077b974
--- /dev/null
+++ b/src/m_aatree.h
@@ -0,0 +1,31 @@
+// SONIC ROBO BLAST 2
+//-----------------------------------------------------------------------------
+// Copyright (C) 1993-1996 by id Software, Inc.
+// Copyright (C) 1998-2000 by DooM Legacy Team.
+// Copyright (C) 1999-2016 by Sonic Team Junior.
+//
+// This program is free software distributed under the
+// terms of the GNU General Public License, version 2.
+// See the 'LICENSE' file for more details.
+//-----------------------------------------------------------------------------
+/// \file m_aatree.h
+/// \brief AA trees code
+
+#ifndef __M_AATREE__
+#define __M_AATREE__
+
+#include "doomtype.h"
+
+// Flags for AA trees.
+#define AATREE_ZUSER 1 // Treat values as z_zone-allocated blocks and set their user fields
+
+typedef struct aatree_s aatree_t;
+typedef void (*aatree_iter_t)(INT32 key, void *value);
+
+aatree_t *M_AATreeAlloc(UINT32 flags);
+void M_AATreeFree(aatree_t *aatree);
+void M_AATreeSet(aatree_t *aatree, INT32 key, void* value);
+void *M_AATreeGet(aatree_t *aatree, INT32 key);
+void M_AATreeIterate(aatree_t *aatree, aatree_iter_t callback);
+
+#endif
\ No newline at end of file
diff --git a/src/m_misc.c b/src/m_misc.c
index 64054d4f9..457214e33 100644
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -2323,158 +2323,3 @@ void M_SetupMemcpy(void)
M_Memcpy = cpu_cpy;
#endif
}
-
-
-// A partial implementation of AA trees,
-// according to the algorithms given on Wikipedia.
-// http://en.wikipedia.org/wiki/AA_tree
-
-
-
-typedef struct aatree_node_s
-{
- INT32 level;
- INT32 key;
- void* value;
-
- struct aatree_node_s *left, *right;
-} aatree_node_t;
-
-struct aatree_s
-{
- aatree_node_t *root;
- UINT32 flags;
-};
-
-aatree_t *M_AATreeAlloc(UINT32 flags)
-{
- aatree_t *aatree = Z_Malloc(sizeof (aatree_t), PU_STATIC, NULL);
- aatree->root = NULL;
- aatree->flags = flags;
- return aatree;
-}
-
-static void M_AATreeFree_Node(aatree_node_t *node)
-{
- if (node->left) M_AATreeFree_Node(node->left);
- if (node->right) M_AATreeFree_Node(node->right);
- Z_Free(node);
-}
-
-void M_AATreeFree(aatree_t *aatree)
-{
- if (aatree->root)
- M_AATreeFree_Node(aatree->root);
-
- Z_Free(aatree);
-}
-
-static aatree_node_t *M_AATreeSkew(aatree_node_t *node)
-{
- if (node && node->left && node->left->level == node->level)
- {
- // Not allowed: horizontal left-link. Reverse the
- // horizontal link and hook the orphan back in.
- aatree_node_t *oldleft = node->left;
- node->left = oldleft->right;
- oldleft->right = node;
-
- return oldleft;
- }
-
- // No change needed.
- return node;
-}
-
-static aatree_node_t *M_AATreeSplit(aatree_node_t *node)
-{
- if (node && node->right && node->right->right && node->level == node->right->right->level)
- {
- // Not allowed: two consecutive horizontal right-links.
- // The middle one becomes the new root at this point,
- // with suitable adjustments below.
-
- aatree_node_t *oldright = node->right;
- node->right = oldright->left;
- oldright->left = node;
- oldright->level++;
-
- return oldright;
- }
-
- // No change needed.
- return node;
-}
-
-static aatree_node_t *M_AATreeSet_Node(aatree_node_t *node, UINT32 flags, INT32 key, void* value)
-{
- if (!node)
- {
- // Nothing here, so just add where we are
-
- node = Z_Malloc(sizeof (aatree_node_t), PU_STATIC, NULL);
- node->level = 1;
- node->key = key;
- if (value && (flags & AATREE_ZUSER)) Z_SetUser(value, &node->value);
- else node->value = value;
- node->left = node->right = NULL;
- }
- else
- {
- if (key < node->key)
- node->left = M_AATreeSet_Node(node->left, flags, key, value);
- else if (key > node->key)
- node->right = M_AATreeSet_Node(node->right, flags, key, value);
- else
- {
- if (value && (flags & AATREE_ZUSER)) Z_SetUser(value, &node->value);
- else node->value = value;
- }
-
- node = M_AATreeSkew(node);
- node = M_AATreeSplit(node);
- }
-
- return node;
-}
-
-void M_AATreeSet(aatree_t *aatree, INT32 key, void* value)
-{
- aatree->root = M_AATreeSet_Node(aatree->root, aatree->flags, key, value);
-}
-
-// Caveat: we don't distinguish between nodes that don't exists
-// and nodes with value == NULL.
-static void *M_AATreeGet_Node(aatree_node_t *node, INT32 key)
-{
- if (node)
- {
- if (node->key == key)
- return node->value;
- else if(node->key < key)
- return M_AATreeGet_Node(node->right, key);
- else
- return M_AATreeGet_Node(node->left, key);
- }
-
- return NULL;
-}
-
-void *M_AATreeGet(aatree_t *aatree, INT32 key)
-{
- return M_AATreeGet_Node(aatree->root, key);
-}
-
-
-static void M_AATreeIterate_Node(aatree_node_t *node, aatree_iter_t callback)
-{
- if (node->left) M_AATreeIterate_Node(node->left, callback);
- callback(node->key, node->value);
- if (node->right) M_AATreeIterate_Node(node->right, callback);
-}
-
-void M_AATreeIterate(aatree_t *aatree, aatree_iter_t callback)
-{
- if (aatree->root)
- M_AATreeIterate_Node(aatree->root, callback);
-}
diff --git a/src/m_misc.h b/src/m_misc.h
index fa1f3b33c..dc540dc16 100644
--- a/src/m_misc.h
+++ b/src/m_misc.h
@@ -96,19 +96,6 @@ void M_SetupMemcpy(void);
// counting bits, for weapon ammo code, usually
FUNCMATH UINT8 M_CountBits(UINT32 num, UINT8 size);
-// Flags for AA trees.
-#define AATREE_ZUSER 1 // Treat values as z_zone-allocated blocks and set their user fields
-
-typedef struct aatree_s aatree_t;
-typedef void (*aatree_iter_t)(INT32 key, void *value);
-
-aatree_t *M_AATreeAlloc(UINT32 flags);
-void M_AATreeFree(aatree_t *aatree);
-void M_AATreeSet(aatree_t *aatree, INT32 key, void* value);
-void *M_AATreeGet(aatree_t *aatree, INT32 key);
-void M_AATreeIterate(aatree_t *aatree, aatree_iter_t callback);
-
-// Nasty cyclic dependency workaround. This must come after aatree stuff.
#include "w_wad.h"
extern char configfile[MAX_WADPATH];
diff --git a/src/p_map.c b/src/p_map.c
index 8621ba202..1f2d903e8 100644
--- a/src/p_map.c
+++ b/src/p_map.c
@@ -129,6 +129,10 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
return false;
}
+#ifdef ESLOPE
+ object->standingslope = NULL; // Okay, now we can't return - no launching off at silly angles for you.
+#endif
+
object->eflags |= MFE_SPRUNG; // apply this flag asap!
spring->flags &= ~(MF_SOLID|MF_SPECIAL); // De-solidify
@@ -232,20 +236,24 @@ static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object)
if (p && object->state == &states[object->info->painstate]) // can't use fans and gas jets when player is in pain!
return;
- // is object below thruster's position? if not, calculate distance between their bottoms
+ // is object's top below thruster's position? if not, calculate distance between their bottoms
if (spring->eflags & MFE_VERTICALFLIP)
{
- if (object->z + object->height > spring->z + spring->height)
+ if (object->z > spring->z + spring->height)
return;
zdist = (spring->z + spring->height) - (object->z + object->height);
}
else
{
- if (object->z < spring->z)
+ if (object->z + object->height < spring->z)
return;
zdist = object->z - spring->z;
}
+#ifdef ESLOPE
+ object->standingslope = NULL; // No launching off at silly angles for you.
+#endif
+
switch (spring->type)
{
case MT_FAN: // fan
diff --git a/src/p_mobj.c b/src/p_mobj.c
index c6fed9934..62dee0a67 100644
--- a/src/p_mobj.c
+++ b/src/p_mobj.c
@@ -2376,9 +2376,9 @@ static boolean P_ZMovement(mobj_t *mo)
#ifdef ESLOPE
P_CheckPosition(mo, mo->x, mo->y); // Sets mo->standingslope correctly
- if ((mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope) {
+ if (((mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope) && (mo->type != MT_STEAM))
+ {
mo->standingslope = (mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope;
-
P_ReverseQuantizeMomentumToSlope(&mom, mo->standingslope);
}
#endif
@@ -2532,7 +2532,7 @@ static boolean P_ZMovement(mobj_t *mo)
mom.z = tmfloorthing->momz;
#ifdef ESLOPE
- if (mo->standingslope) {
+ if (mo->standingslope) { // MT_STEAM will never have a standingslope, see above.
P_QuantizeMomentumToSlope(&mom, mo->standingslope);
}
#endif
diff --git a/src/r_draw8.c b/src/r_draw8.c
index c22cd2362..9f5ab62cd 100644
--- a/src/r_draw8.c
+++ b/src/r_draw8.c
@@ -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;
diff --git a/src/r_main.c b/src/r_main.c
index 97d6876e1..1ad125cd0 100644
--- a/src/r_main.c
+++ b/src/r_main.c
@@ -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
{
diff --git a/src/r_segs.c b/src/r_segs.c
index 59b4f5db9..cb78743b6 100644
--- a/src/r_segs.c
+++ b/src/r_segs.c
@@ -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)
{
diff --git a/src/sdl/MakeNIX.cfg b/src/sdl/MakeNIX.cfg
index f5c9b2075..1a0b54210 100644
--- a/src/sdl/MakeNIX.cfg
+++ b/src/sdl/MakeNIX.cfg
@@ -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)
#
diff --git a/src/sdl/Srb2SDL-vc10.vcxproj b/src/sdl/Srb2SDL-vc10.vcxproj
index d12a7efbf..820192649 100644
--- a/src/sdl/Srb2SDL-vc10.vcxproj
+++ b/src/sdl/Srb2SDL-vc10.vcxproj
@@ -167,6 +167,7 @@
+
@@ -308,6 +309,7 @@
+
diff --git a/src/sdl/Srb2SDL-vc10.vcxproj.filters b/src/sdl/Srb2SDL-vc10.vcxproj.filters
index 9396b4823..d04007dd7 100644
--- a/src/sdl/Srb2SDL-vc10.vcxproj.filters
+++ b/src/sdl/Srb2SDL-vc10.vcxproj.filters
@@ -294,6 +294,9 @@
M_Misc
+
+ M_Misc
+
M_Misc
@@ -666,6 +669,9 @@
M_Misc
+
+ M_Misc
+
M_Misc
diff --git a/src/sdl/macosx/mac_alert.c b/src/sdl/macosx/mac_alert.c
index 455e36509..2a139041a 100644
--- a/src/sdl/macosx/mac_alert.c
+++ b/src/sdl/macosx/mac_alert.c
@@ -25,19 +25,38 @@
#include "mac_alert.h"
#include
+#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;
}
diff --git a/src/sdl/macosx/mac_resources.c b/src/sdl/macosx/mac_resources.c
index dacc8014b..d67b92580 100644
--- a/src/sdl/macosx/mac_resources.c
+++ b/src/sdl/macosx/mac_resources.c
@@ -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);
}
-
-}
\ No newline at end of file
+}
diff --git a/src/w_wad.h b/src/w_wad.h
index c13f69338..b03e376bf 100644
--- a/src/w_wad.h
+++ b/src/w_wad.h
@@ -54,10 +54,8 @@ typedef struct
#define lumpcache_t void *
-// Annoying cyclic dependency workaround: this inlcusion must come after
-// the definition of MAX_WADPATH.
#ifdef HWRENDER
-#include "m_misc.h"
+#include "m_aatree.h"
#endif
typedef struct wadfile_s
diff --git a/src/win32/Srb2win-vc10.vcxproj b/src/win32/Srb2win-vc10.vcxproj
index 1e9d8241e..064f75d7d 100644
--- a/src/win32/Srb2win-vc10.vcxproj
+++ b/src/win32/Srb2win-vc10.vcxproj
@@ -145,6 +145,7 @@
+
@@ -300,6 +301,7 @@
+
diff --git a/src/win32/Srb2win-vc10.vcxproj.filters b/src/win32/Srb2win-vc10.vcxproj.filters
index 3f5b84bfb..b2647ea1c 100644
--- a/src/win32/Srb2win-vc10.vcxproj.filters
+++ b/src/win32/Srb2win-vc10.vcxproj.filters
@@ -255,6 +255,9 @@
LUA
+
+ M_Misc
+
M_Misc
@@ -662,6 +665,9 @@
M_Misc
+
+ M_Misc
+
M_Misc