Merge branch 'public_next' into private

This commit is contained in:
Alam Ed Arias 2016-07-21 19:22:30 -04:00
commit 7b88db478c
22 changed files with 372 additions and 228 deletions

View File

@ -2815,6 +2815,39 @@ HW3SOUND for 3D hardware sound support
<Option target="Debug Mingw64/DirectX" />
<Option target="Release Mingw64/DirectX" />
</Unit>
<Unit filename="src/m_aatree.c">
<Option compilerVar="CC" />
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
<Option target="Debug Mingw/DirectX" />
<Option target="Release Mingw/DirectX" />
<Option target="Debug Any/Dummy" />
<Option target="Release Any/Dummy" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw64/SDL" />
<Option target="Release Mingw64/SDL" />
<Option target="Debug Mingw64/DirectX" />
<Option target="Release Mingw64/DirectX" />
</Unit>
<Unit filename="src/m_aatree.h">
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
<Option target="Debug Mingw/DirectX" />
<Option target="Release Mingw/DirectX" />
<Option target="Debug Any/Dummy" />
<Option target="Release Any/Dummy" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw64/SDL" />
<Option target="Release Mingw64/SDL" />
<Option target="Debug Mingw64/DirectX" />
<Option target="Release Mingw64/DirectX" />
</Unit>
<Unit filename="src/m_anigif.c">
<Option compilerVar="CC" />
<Option target="Debug Native/SDL" />

View File

@ -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

View File

@ -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 $@

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

167
src/m_aatree.c Normal file
View File

@ -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);
}

31
src/m_aatree.h Normal file
View File

@ -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

View File

@ -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);
}

View File

@ -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];

View File

@ -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

View File

@ -2563,9 +2563,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
@ -2719,7 +2719,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

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

@ -167,6 +167,7 @@
<ClInclude Include="..\lzf.h" />
<ClInclude Include="..\md5.h" />
<ClInclude Include="..\mserv.h" />
<ClInclude Include="..\m_aatree.h" />
<ClInclude Include="..\m_anigif.h" />
<ClInclude Include="..\m_argv.h" />
<ClInclude Include="..\m_bbox.h" />
@ -308,6 +309,7 @@
<ClCompile Include="..\lzf.c" />
<ClCompile Include="..\md5.c" />
<ClCompile Include="..\mserv.c" />
<ClCompile Include="..\m_aatree.c" />
<ClCompile Include="..\m_anigif.c" />
<ClCompile Include="..\m_argv.c" />
<ClCompile Include="..\m_bbox.c" />

View File

@ -294,6 +294,9 @@
<ClInclude Include="..\md5.h">
<Filter>M_Misc</Filter>
</ClInclude>
<ClInclude Include="..\m_aatree.h">
<Filter>M_Misc</Filter>
</ClInclude>
<ClInclude Include="..\m_anigif.h">
<Filter>M_Misc</Filter>
</ClInclude>
@ -666,6 +669,9 @@
<ClCompile Include="..\md5.c">
<Filter>M_Misc</Filter>
</ClCompile>
<ClCompile Include="..\m_aatree.c">
<Filter>M_Misc</Filter>
</ClCompile>
<ClCompile Include="..\m_anigif.c">
<Filter>M_Misc</Filter>
</ClCompile>

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);
}
}
}

View File

@ -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

View File

@ -145,6 +145,7 @@
<ClCompile Include="..\lzf.c" />
<ClCompile Include="..\md5.c" />
<ClCompile Include="..\mserv.c" />
<ClCompile Include="..\m_aatree.c" />
<ClCompile Include="..\m_anigif.c" />
<ClCompile Include="..\m_argv.c" />
<ClCompile Include="..\m_bbox.c" />
@ -300,6 +301,7 @@
<ClInclude Include="..\lzf.h" />
<ClInclude Include="..\md5.h" />
<ClInclude Include="..\mserv.h" />
<ClInclude Include="..\m_aatree.h" />
<ClInclude Include="..\m_anigif.h" />
<ClInclude Include="..\m_argv.h" />
<ClInclude Include="..\m_bbox.h" />

View File

@ -255,6 +255,9 @@
<ClCompile Include="..\lua_skinlib.c">
<Filter>LUA</Filter>
</ClCompile>
<ClCompile Include="..\m_aatree.c">
<Filter>M_Misc</Filter>
</ClCompile>
<ClCompile Include="..\m_anigif.c">
<Filter>M_Misc</Filter>
</ClCompile>
@ -662,6 +665,9 @@
<ClInclude Include="..\md5.h">
<Filter>M_Misc</Filter>
</ClInclude>
<ClInclude Include="..\m_aatree.h">
<Filter>M_Misc</Filter>
</ClInclude>
<ClInclude Include="..\m_anigif.h">
<Filter>M_Misc</Filter>
</ClInclude>