Merge branch 'next' into public_next
This commit is contained in:
commit
5513e110d1
33
SRB2.cbp
33
SRB2.cbp
|
@ -2815,6 +2815,39 @@ HW3SOUND for 3D hardware sound support
|
||||||
<Option target="Debug Mingw64/DirectX" />
|
<Option target="Debug Mingw64/DirectX" />
|
||||||
<Option target="Release Mingw64/DirectX" />
|
<Option target="Release Mingw64/DirectX" />
|
||||||
</Unit>
|
</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">
|
<Unit filename="src/m_anigif.c">
|
||||||
<Option compilerVar="CC" />
|
<Option compilerVar="CC" />
|
||||||
<Option target="Debug Native/SDL" />
|
<Option target="Debug Native/SDL" />
|
||||||
|
|
|
@ -22,6 +22,7 @@ set(SRB2_CORE_SOURCES
|
||||||
i_tcp.c
|
i_tcp.c
|
||||||
info.c
|
info.c
|
||||||
lzf.c
|
lzf.c
|
||||||
|
m_aatree.c
|
||||||
m_anigif.c
|
m_anigif.c
|
||||||
m_argv.c
|
m_argv.c
|
||||||
m_bbox.c
|
m_bbox.c
|
||||||
|
@ -83,6 +84,7 @@ set(SRB2_CORE_HEADERS
|
||||||
info.h
|
info.h
|
||||||
keys.h
|
keys.h
|
||||||
lzf.h
|
lzf.h
|
||||||
|
m_aatree.h
|
||||||
m_anigif.h
|
m_anigif.h
|
||||||
m_argv.h
|
m_argv.h
|
||||||
m_bbox.h
|
m_bbox.h
|
||||||
|
|
14
src/Makefile
14
src/Makefile
|
@ -189,6 +189,10 @@ ifdef FREEBSD
|
||||||
UNIXCOMMON=1
|
UNIXCOMMON=1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifdef MACOSX
|
||||||
|
UNIXCOMMON=1
|
||||||
|
endif
|
||||||
|
|
||||||
ifdef NDS
|
ifdef NDS
|
||||||
NOPNG=1
|
NOPNG=1
|
||||||
NONET=1
|
NONET=1
|
||||||
|
@ -429,6 +433,7 @@ OBJS:=$(i_main_o) \
|
||||||
$(OBJDIR)/hu_stuff.o \
|
$(OBJDIR)/hu_stuff.o \
|
||||||
$(OBJDIR)/y_inter.o \
|
$(OBJDIR)/y_inter.o \
|
||||||
$(OBJDIR)/st_stuff.o \
|
$(OBJDIR)/st_stuff.o \
|
||||||
|
$(OBJDIR)/m_aatree.o \
|
||||||
$(OBJDIR)/m_anigif.o \
|
$(OBJDIR)/m_anigif.o \
|
||||||
$(OBJDIR)/m_argv.o \
|
$(OBJDIR)/m_argv.o \
|
||||||
$(OBJDIR)/m_bbox.o \
|
$(OBJDIR)/m_bbox.o \
|
||||||
|
@ -593,11 +598,15 @@ ifndef WINDOWSHELL
|
||||||
-$(GZIP) $(GZIP_OPT2) $(BIN)/$(DBGNAME).txt
|
-$(GZIP) $(GZIP_OPT2) $(BIN)/$(DBGNAME).txt
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# mac os x lsdlsrb2 does not like objcopy
|
||||||
|
ifndef MACOSX
|
||||||
ifndef PSP
|
ifndef PSP
|
||||||
$(OBJCOPY) $(BIN)/$(EXENAME) $(BIN)/$(DBGNAME)
|
$(OBJCOPY) $(BIN)/$(EXENAME) $(BIN)/$(DBGNAME)
|
||||||
$(OBJCOPY) --strip-debug $(BIN)/$(EXENAME)
|
$(OBJCOPY) --strip-debug $(BIN)/$(EXENAME)
|
||||||
-$(OBJCOPY) --add-gnu-debuglink=$(BIN)/$(DBGNAME) $(BIN)/$(EXENAME)
|
-$(OBJCOPY) --add-gnu-debuglink=$(BIN)/$(DBGNAME) $(BIN)/$(EXENAME)
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
ifndef NOUPX
|
ifndef NOUPX
|
||||||
-$(UPX) $(UPX_OPTS) $(BIN)/$(EXENAME)
|
-$(UPX) $(UPX_OPTS) $(BIN)/$(EXENAME)
|
||||||
endif
|
endif
|
||||||
|
@ -745,6 +754,11 @@ $(OBJDIR)/%.o: %.c
|
||||||
$(OBJDIR)/%.o: $(INTERFACE)/%.c
|
$(OBJDIR)/%.o: $(INTERFACE)/%.c
|
||||||
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
ifdef MACOSX
|
||||||
|
$(OBJDIR)/%.o: sdl/macosx/%.c
|
||||||
|
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
|
||||||
|
endif
|
||||||
|
|
||||||
$(OBJDIR)/%.o: hardware/%.c
|
$(OBJDIR)/%.o: hardware/%.c
|
||||||
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
|
|
@ -406,6 +406,15 @@ else
|
||||||
WINDRES=windres
|
WINDRES=windres
|
||||||
endif
|
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
|
OBJDUMP_OPTS?=--wide --source --line-numbers
|
||||||
LD=$(CC)
|
LD=$(CC)
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ typedef long ssize_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __APPLE_CC__
|
#ifdef __APPLE_CC__
|
||||||
#define DIRECTFULLSCREEN
|
#define DIRECTFULLSCREEN 1
|
||||||
#define DEBUG_LOG
|
#define DEBUG_LOG
|
||||||
#define NOIPX
|
#define NOIPX
|
||||||
#endif
|
#endif
|
||||||
|
|
167
src/m_aatree.c
Normal file
167
src/m_aatree.c
Normal 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
31
src/m_aatree.h
Normal 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
|
155
src/m_misc.c
155
src/m_misc.c
|
@ -2323,158 +2323,3 @@ void M_SetupMemcpy(void)
|
||||||
M_Memcpy = cpu_cpy;
|
M_Memcpy = cpu_cpy;
|
||||||
#endif
|
#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);
|
|
||||||
}
|
|
||||||
|
|
13
src/m_misc.h
13
src/m_misc.h
|
@ -96,19 +96,6 @@ void M_SetupMemcpy(void);
|
||||||
// counting bits, for weapon ammo code, usually
|
// counting bits, for weapon ammo code, usually
|
||||||
FUNCMATH UINT8 M_CountBits(UINT32 num, UINT8 size);
|
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"
|
#include "w_wad.h"
|
||||||
extern char configfile[MAX_WADPATH];
|
extern char configfile[MAX_WADPATH];
|
||||||
|
|
||||||
|
|
14
src/p_map.c
14
src/p_map.c
|
@ -129,6 +129,10 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
|
||||||
return false;
|
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!
|
object->eflags |= MFE_SPRUNG; // apply this flag asap!
|
||||||
spring->flags &= ~(MF_SOLID|MF_SPECIAL); // De-solidify
|
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!
|
if (p && object->state == &states[object->info->painstate]) // can't use fans and gas jets when player is in pain!
|
||||||
return;
|
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 (spring->eflags & MFE_VERTICALFLIP)
|
||||||
{
|
{
|
||||||
if (object->z + object->height > spring->z + spring->height)
|
if (object->z > spring->z + spring->height)
|
||||||
return;
|
return;
|
||||||
zdist = (spring->z + spring->height) - (object->z + object->height);
|
zdist = (spring->z + spring->height) - (object->z + object->height);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (object->z < spring->z)
|
if (object->z + object->height < spring->z)
|
||||||
return;
|
return;
|
||||||
zdist = object->z - spring->z;
|
zdist = object->z - spring->z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ESLOPE
|
||||||
|
object->standingslope = NULL; // No launching off at silly angles for you.
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (spring->type)
|
switch (spring->type)
|
||||||
{
|
{
|
||||||
case MT_FAN: // fan
|
case MT_FAN: // fan
|
||||||
|
|
|
@ -2376,9 +2376,9 @@ static boolean P_ZMovement(mobj_t *mo)
|
||||||
|
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
P_CheckPosition(mo, mo->x, mo->y); // Sets mo->standingslope correctly
|
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;
|
mo->standingslope = (mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope;
|
||||||
|
|
||||||
P_ReverseQuantizeMomentumToSlope(&mom, mo->standingslope);
|
P_ReverseQuantizeMomentumToSlope(&mom, mo->standingslope);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -2532,7 +2532,7 @@ static boolean P_ZMovement(mobj_t *mo)
|
||||||
mom.z = tmfloorthing->momz;
|
mom.z = tmfloorthing->momz;
|
||||||
|
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
if (mo->standingslope) {
|
if (mo->standingslope) { // MT_STEAM will never have a standingslope, see above.
|
||||||
P_QuantizeMomentumToSlope(&mom, mo->standingslope);
|
P_QuantizeMomentumToSlope(&mom, mo->standingslope);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -874,9 +874,9 @@ void R_DrawTiltedSplat_8(void)
|
||||||
|
|
||||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
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)
|
if (val != TRANSPARENTPIXEL)
|
||||||
*dest = val;
|
*dest = colormap[val];
|
||||||
dest++;
|
dest++;
|
||||||
iz += ds_sz.x;
|
iz += ds_sz.x;
|
||||||
uz += ds_su.x;
|
uz += ds_su.x;
|
||||||
|
@ -913,9 +913,9 @@ void R_DrawTiltedSplat_8(void)
|
||||||
for (i = SPANSIZE-1; i >= 0; i--)
|
for (i = SPANSIZE-1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
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)
|
if (val != TRANSPARENTPIXEL)
|
||||||
*dest = val;
|
*dest = colormap[val];
|
||||||
dest++;
|
dest++;
|
||||||
u += stepu;
|
u += stepu;
|
||||||
v += stepv;
|
v += stepv;
|
||||||
|
@ -931,9 +931,9 @@ void R_DrawTiltedSplat_8(void)
|
||||||
u = (INT64)(startu);
|
u = (INT64)(startu);
|
||||||
v = (INT64)(startv);
|
v = (INT64)(startv);
|
||||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
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)
|
if (val != TRANSPARENTPIXEL)
|
||||||
*dest = val;
|
*dest = colormap[val];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -954,9 +954,9 @@ void R_DrawTiltedSplat_8(void)
|
||||||
for (; width != 0; width--)
|
for (; width != 0; width--)
|
||||||
{
|
{
|
||||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
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)
|
if (val != TRANSPARENTPIXEL)
|
||||||
*dest = val;
|
*dest = colormap[val];
|
||||||
dest++;
|
dest++;
|
||||||
u += stepu;
|
u += stepu;
|
||||||
v += stepv;
|
v += stepv;
|
||||||
|
@ -1124,49 +1124,49 @@ void R_DrawTranslucentSplat_8 (void)
|
||||||
// need!
|
// need!
|
||||||
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
|
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
|
||||||
if (val != TRANSPARENTPIXEL)
|
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;
|
xposition += xstep;
|
||||||
yposition += ystep;
|
yposition += ystep;
|
||||||
|
|
||||||
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
|
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
|
||||||
if (val != TRANSPARENTPIXEL)
|
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;
|
xposition += xstep;
|
||||||
yposition += ystep;
|
yposition += ystep;
|
||||||
|
|
||||||
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
|
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
|
||||||
if (val != TRANSPARENTPIXEL)
|
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;
|
xposition += xstep;
|
||||||
yposition += ystep;
|
yposition += ystep;
|
||||||
|
|
||||||
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
|
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
|
||||||
if (val != TRANSPARENTPIXEL)
|
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;
|
xposition += xstep;
|
||||||
yposition += ystep;
|
yposition += ystep;
|
||||||
|
|
||||||
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
|
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
|
||||||
if (val != TRANSPARENTPIXEL)
|
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;
|
xposition += xstep;
|
||||||
yposition += ystep;
|
yposition += ystep;
|
||||||
|
|
||||||
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
|
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
|
||||||
if (val != TRANSPARENTPIXEL)
|
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;
|
xposition += xstep;
|
||||||
yposition += ystep;
|
yposition += ystep;
|
||||||
|
|
||||||
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
|
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
|
||||||
if (val != TRANSPARENTPIXEL)
|
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;
|
xposition += xstep;
|
||||||
yposition += ystep;
|
yposition += ystep;
|
||||||
|
|
||||||
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
|
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
|
||||||
if (val != TRANSPARENTPIXEL)
|
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;
|
xposition += xstep;
|
||||||
yposition += ystep;
|
yposition += ystep;
|
||||||
|
|
||||||
|
@ -1175,9 +1175,9 @@ void R_DrawTranslucentSplat_8 (void)
|
||||||
}
|
}
|
||||||
while (count--)
|
while (count--)
|
||||||
{
|
{
|
||||||
val =colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]];
|
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
|
||||||
if (val != TRANSPARENTPIXEL)
|
if (val != TRANSPARENTPIXEL)
|
||||||
*dest = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dest)];
|
*dest = colormap[*(ds_transmap + (val << 8) + *dest)];
|
||||||
|
|
||||||
dest++;
|
dest++;
|
||||||
xposition += xstep;
|
xposition += xstep;
|
||||||
|
|
|
@ -919,9 +919,9 @@ void R_SkyboxFrame(player_t *player)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mh->skybox_scalez > 0)
|
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)
|
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)
|
else if (thiscam->chase)
|
||||||
{
|
{
|
||||||
|
@ -966,9 +966,9 @@ void R_SkyboxFrame(player_t *player)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mh->skybox_scalez > 0)
|
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)
|
else if (mh->skybox_scalez < 0)
|
||||||
viewz += thiscam->z * -mh->skybox_scalez;
|
viewz += (thiscam->z + (thiscam->height>>1)) * -mh->skybox_scalez;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -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
|
// note: don't use min/max macros, since casting from INT32 to INT16 is involved here
|
||||||
if (markceiling)
|
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)
|
if (markfloor)
|
||||||
floorclip[rw_x] = (yh < viewheight) ? ((yh < -1) ? -1 : (INT16)((INT16)yh + 1)) : (INT16)viewheight;
|
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;
|
ceilingclip[rw_x] = -1;
|
||||||
}
|
}
|
||||||
else
|
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
|
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)
|
if (bottomtexture)
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,6 +56,15 @@ ifdef FREEBSD
|
||||||
LIBS+=-lipx -lkvm
|
LIBS+=-lipx -lkvm
|
||||||
endif
|
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)
|
#here is GP2x (arm-gp2x-linux)
|
||||||
#
|
#
|
||||||
|
|
|
@ -167,6 +167,7 @@
|
||||||
<ClInclude Include="..\lzf.h" />
|
<ClInclude Include="..\lzf.h" />
|
||||||
<ClInclude Include="..\md5.h" />
|
<ClInclude Include="..\md5.h" />
|
||||||
<ClInclude Include="..\mserv.h" />
|
<ClInclude Include="..\mserv.h" />
|
||||||
|
<ClInclude Include="..\m_aatree.h" />
|
||||||
<ClInclude Include="..\m_anigif.h" />
|
<ClInclude Include="..\m_anigif.h" />
|
||||||
<ClInclude Include="..\m_argv.h" />
|
<ClInclude Include="..\m_argv.h" />
|
||||||
<ClInclude Include="..\m_bbox.h" />
|
<ClInclude Include="..\m_bbox.h" />
|
||||||
|
@ -308,6 +309,7 @@
|
||||||
<ClCompile Include="..\lzf.c" />
|
<ClCompile Include="..\lzf.c" />
|
||||||
<ClCompile Include="..\md5.c" />
|
<ClCompile Include="..\md5.c" />
|
||||||
<ClCompile Include="..\mserv.c" />
|
<ClCompile Include="..\mserv.c" />
|
||||||
|
<ClCompile Include="..\m_aatree.c" />
|
||||||
<ClCompile Include="..\m_anigif.c" />
|
<ClCompile Include="..\m_anigif.c" />
|
||||||
<ClCompile Include="..\m_argv.c" />
|
<ClCompile Include="..\m_argv.c" />
|
||||||
<ClCompile Include="..\m_bbox.c" />
|
<ClCompile Include="..\m_bbox.c" />
|
||||||
|
|
|
@ -294,6 +294,9 @@
|
||||||
<ClInclude Include="..\md5.h">
|
<ClInclude Include="..\md5.h">
|
||||||
<Filter>M_Misc</Filter>
|
<Filter>M_Misc</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\m_aatree.h">
|
||||||
|
<Filter>M_Misc</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="..\m_anigif.h">
|
<ClInclude Include="..\m_anigif.h">
|
||||||
<Filter>M_Misc</Filter>
|
<Filter>M_Misc</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -666,6 +669,9 @@
|
||||||
<ClCompile Include="..\md5.c">
|
<ClCompile Include="..\md5.c">
|
||||||
<Filter>M_Misc</Filter>
|
<Filter>M_Misc</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\m_aatree.c">
|
||||||
|
<Filter>M_Misc</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\m_anigif.c">
|
<ClCompile Include="..\m_anigif.c">
|
||||||
<Filter>M_Misc</Filter>
|
<Filter>M_Misc</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
|
@ -25,19 +25,38 @@
|
||||||
#include "mac_alert.h"
|
#include "mac_alert.h"
|
||||||
#include <CoreFoundation/CoreFoundation.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)
|
int MacShowAlert(const char *title, const char *message, const char *button1, const char *button2, const char *button3)
|
||||||
{
|
{
|
||||||
CFOptionFlags results;
|
CFOptionFlags results;
|
||||||
|
|
||||||
CFUserNotificationDisplayAlert(0,
|
CFStringRef cf_title = CFSTRINGIFY(title);
|
||||||
kCFUserNotificationStopAlertLevel | kCFUserNotificationNoDefaultButtonFlag,
|
CFStringRef cf_message = CFSTRINGIFY(message);
|
||||||
NULL, NULL, NULL,
|
CFStringRef cf_button1 = NULL;
|
||||||
CFStringCreateWithCString(NULL, title, kCFStringEncodingASCII),
|
CFStringRef cf_button2 = NULL;
|
||||||
CFStringCreateWithCString(NULL, message, kCFStringEncodingASCII),
|
CFStringRef cf_button3 = NULL;
|
||||||
button1 != NULL ? CFStringCreateWithCString(NULL, button1, kCFStringEncodingASCII) : NULL,
|
|
||||||
button2 != NULL ? CFStringCreateWithCString(NULL, button2, kCFStringEncodingASCII) : NULL,
|
if (button1 != NULL)
|
||||||
button3 != NULL ? CFStringCreateWithCString(NULL, button3, kCFStringEncodingASCII) : NULL,
|
cf_button1 = CFSTRINGIFY(button1);
|
||||||
&results);
|
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;
|
return (int)results;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,23 +9,29 @@ void OSX_GetResourcesPath(char * buffer)
|
||||||
mainBundle = CFBundleGetMainBundle();
|
mainBundle = CFBundleGetMainBundle();
|
||||||
if (mainBundle)
|
if (mainBundle)
|
||||||
{
|
{
|
||||||
|
const int BUF_SIZE = 256; // because we somehow always know that
|
||||||
|
|
||||||
CFURLRef appUrlRef = CFBundleCopyBundleURL(mainBundle);
|
CFURLRef appUrlRef = CFBundleCopyBundleURL(mainBundle);
|
||||||
CFStringRef macPath = CFURLCopyFileSystemPath(appUrlRef, kCFURLPOSIXPathStyle);
|
CFStringRef macPath;
|
||||||
CFStringRef resources = CFStringCreateWithCString(kCFAllocatorMalloc, "/Contents/Resources", kCFStringEncodingASCII);
|
if (appUrlRef != NULL)
|
||||||
const void* rawarray[2] = {macPath, resources};
|
macPath = CFURLCopyFileSystemPath(appUrlRef, kCFURLPOSIXPathStyle);
|
||||||
CFArrayRef array = CFArrayCreate(kCFAllocatorMalloc, rawarray, 2, NULL);
|
else
|
||||||
CFStringRef separator = CFStringCreateWithCString(kCFAllocatorMalloc, "", kCFStringEncodingASCII);
|
macPath = NULL;
|
||||||
CFStringRef fullPath = CFStringCreateByCombiningStrings(kCFAllocatorMalloc, array, separator);
|
|
||||||
const char * path = CFStringGetCStringPtr(fullPath, kCFStringEncodingASCII);
|
const char* rawPath;
|
||||||
strcpy(buffer, path);
|
|
||||||
CFRelease(fullPath);
|
if (macPath != NULL)
|
||||||
path = NULL;
|
rawPath = CFStringGetCStringPtr(macPath, kCFStringEncodingASCII);
|
||||||
CFRelease(array);
|
else
|
||||||
CFRelease(resources);
|
rawPath = NULL;
|
||||||
CFRelease(macPath);
|
|
||||||
CFRelease(appUrlRef);
|
if (rawPath != NULL && (CFStringGetLength(macPath) + strlen("/Contents/Resources") < BUF_SIZE))
|
||||||
//CFRelease(mainBundle);
|
{
|
||||||
CFRelease(separator);
|
strcpy(buffer, rawPath);
|
||||||
|
strcat(buffer, "/Contents/Resources");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CFRelease(macPath);
|
||||||
|
CFRelease(appUrlRef);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -54,10 +54,8 @@ typedef struct
|
||||||
|
|
||||||
#define lumpcache_t void *
|
#define lumpcache_t void *
|
||||||
|
|
||||||
// Annoying cyclic dependency workaround: this inlcusion must come after
|
|
||||||
// the definition of MAX_WADPATH.
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
#include "m_misc.h"
|
#include "m_aatree.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct wadfile_s
|
typedef struct wadfile_s
|
||||||
|
|
|
@ -145,6 +145,7 @@
|
||||||
<ClCompile Include="..\lzf.c" />
|
<ClCompile Include="..\lzf.c" />
|
||||||
<ClCompile Include="..\md5.c" />
|
<ClCompile Include="..\md5.c" />
|
||||||
<ClCompile Include="..\mserv.c" />
|
<ClCompile Include="..\mserv.c" />
|
||||||
|
<ClCompile Include="..\m_aatree.c" />
|
||||||
<ClCompile Include="..\m_anigif.c" />
|
<ClCompile Include="..\m_anigif.c" />
|
||||||
<ClCompile Include="..\m_argv.c" />
|
<ClCompile Include="..\m_argv.c" />
|
||||||
<ClCompile Include="..\m_bbox.c" />
|
<ClCompile Include="..\m_bbox.c" />
|
||||||
|
@ -300,6 +301,7 @@
|
||||||
<ClInclude Include="..\lzf.h" />
|
<ClInclude Include="..\lzf.h" />
|
||||||
<ClInclude Include="..\md5.h" />
|
<ClInclude Include="..\md5.h" />
|
||||||
<ClInclude Include="..\mserv.h" />
|
<ClInclude Include="..\mserv.h" />
|
||||||
|
<ClInclude Include="..\m_aatree.h" />
|
||||||
<ClInclude Include="..\m_anigif.h" />
|
<ClInclude Include="..\m_anigif.h" />
|
||||||
<ClInclude Include="..\m_argv.h" />
|
<ClInclude Include="..\m_argv.h" />
|
||||||
<ClInclude Include="..\m_bbox.h" />
|
<ClInclude Include="..\m_bbox.h" />
|
||||||
|
|
|
@ -255,6 +255,9 @@
|
||||||
<ClCompile Include="..\lua_skinlib.c">
|
<ClCompile Include="..\lua_skinlib.c">
|
||||||
<Filter>LUA</Filter>
|
<Filter>LUA</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\m_aatree.c">
|
||||||
|
<Filter>M_Misc</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\m_anigif.c">
|
<ClCompile Include="..\m_anigif.c">
|
||||||
<Filter>M_Misc</Filter>
|
<Filter>M_Misc</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -662,6 +665,9 @@
|
||||||
<ClInclude Include="..\md5.h">
|
<ClInclude Include="..\md5.h">
|
||||||
<Filter>M_Misc</Filter>
|
<Filter>M_Misc</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\m_aatree.h">
|
||||||
|
<Filter>M_Misc</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="..\m_anigif.h">
|
<ClInclude Include="..\m_anigif.h">
|
||||||
<Filter>M_Misc</Filter>
|
<Filter>M_Misc</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|
Loading…
Reference in a new issue