Merge remote branch 'origin/master' into qt
Conflicts: configure.ac lib/exceptionhandler/exceptionhandler.h lib/framework/SDL_framerate.h lib/framework/cursors.h lib/framework/input.cpp lib/framework/input.h lib/ivis_opengl/pieclip.h lib/ivis_opengl/screen.cpp macosx/Warzone.xcodeproj/project.pbxproj (used qt version) src/console.cpp src/console.h src/frontend.cpp win32/libs/Makefile and src/Makefile.am (resolved by Safety0ff)master
commit
e689ad51d5
|
@ -1,5 +1,4 @@
|
|||
SUBDIRS = \
|
||||
build_tools/autorevision \
|
||||
win32 \
|
||||
lib/framework \
|
||||
lib/exceptionhandler \
|
||||
|
@ -33,6 +32,7 @@ macosx/prebuilt:
|
|||
$(MKDIR_P) macosx/prebuilt
|
||||
|
||||
EXTRA_DIST= \
|
||||
build_tools/autorevision.sh \
|
||||
autogen.sh \
|
||||
autorevision.conf \
|
||||
config.rpath \
|
||||
|
|
|
@ -0,0 +1,103 @@
|
|||
#!/bin/bash
|
||||
|
||||
# autorevision.sh - a shell script to get git / hg revisions etc. into binary builds.
|
||||
# To use pass a path to the desired output file: some/path/to/autorevision.h.
|
||||
# Note: the script will run at the root level of the repository that it is in.
|
||||
|
||||
# Config
|
||||
TARGETFILE="${1}"
|
||||
|
||||
# For git repos
|
||||
function gitRepo {
|
||||
cd "$(git rev-parse --show-toplevel)"
|
||||
|
||||
# Is the working copy clean?
|
||||
git diff --quiet HEAD &> /dev/null
|
||||
WC_MODIFIED="${?}"
|
||||
|
||||
# Enumeration of changesets
|
||||
VCS_NUM="$(git rev-list --count HEAD)"
|
||||
|
||||
# The full revision hash
|
||||
VCS_FULL_HASH="$(git rev-parse HEAD)"
|
||||
|
||||
# The short hash
|
||||
VCS_SHORT_HASH="$(echo ${VCS_FULL_HASH} | cut -b 1-7)"
|
||||
|
||||
# Current branch
|
||||
VCS_URI="$(git symbolic-ref HEAD)"
|
||||
|
||||
# Current tag (or uri if there is no tag)
|
||||
VCS_TAG="$(git describe --exact-match --tags 2>/dev/null)"
|
||||
if [ -z "${VCS_TAG}" ]; then
|
||||
VCS_TAG="${VCS_URI}"
|
||||
fi
|
||||
|
||||
# Date of the curent commit
|
||||
VCS_DATE="$(git log -1 --pretty=format:%ci)"
|
||||
}
|
||||
|
||||
# For hg repos
|
||||
function hgRepo {
|
||||
cd "$(hg root)"
|
||||
|
||||
# Is the working copy clean?
|
||||
hg sum | grep -q 'commit: (clean)'
|
||||
WC_MODIFIED="${?}"
|
||||
|
||||
# Enumeration of changesets
|
||||
VCS_NUM="$(hg id -n)"
|
||||
|
||||
# The full revision hash
|
||||
VCS_FULL_HASH="$(hg log -r ${VCS_NUM} -l 1 --template '{node}\n')"
|
||||
|
||||
# The short hash
|
||||
VCS_SHORT_HASH="$(hg id -i)"
|
||||
|
||||
# Current bookmark (bookmarks are roughly equivalent to git's branches) or branch if no bookmark
|
||||
VCS_URI="$(hg id -B | cut -d ' ' -f 1)"
|
||||
# Fall back to the branch if there are no bookmarks
|
||||
if [ -z "${VCS_URI}" ]; then
|
||||
VCS_URI="$(hg id -b)"
|
||||
fi
|
||||
|
||||
# Current tag (or uri if there is no tag)
|
||||
if [ "$(hg log -r ${VCS_NUM} -l 1 --template '{latesttagdistance}\n')" = "0" ]; then
|
||||
VCS_TAG="`hg id -t | sed -e 's:qtip::' -e 's:tip::' -e 's:qbase::' -e 's:qparent::' -e "s:$(hg --color never qtop 2>/dev/null)::" | cut -d ' ' -f 1`"
|
||||
else
|
||||
VCS_TAG="${VCS_URI}"
|
||||
fi
|
||||
|
||||
# Date of the curent commit
|
||||
VCS_DATE="$(hg log -r ${VCS_NUM} -l 1 --template '{date|isodatesec}\n')"
|
||||
}
|
||||
|
||||
|
||||
if [[ ! -z "$(hg id 2>/dev/null)" ]]; then
|
||||
hgRepo
|
||||
elif [[ ! -z "$(git rev-parse HEAD 2>/dev/null)" ]]; then
|
||||
gitRepo
|
||||
else
|
||||
echo "error: No repo detected."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
cat > "${TARGETFILE}" << EOF
|
||||
/* ${VCS_FULL_HASH} */
|
||||
#ifndef AUTOREVISION_H
|
||||
#define AUTOREVISION_H
|
||||
|
||||
#define VCS_NUM ${VCS_NUM}
|
||||
#define VCS_DATE ${VCS_DATE}
|
||||
#define VCS_URI ${VCS_URI}
|
||||
#define VCS_TAG ${VCS_TAG}
|
||||
|
||||
#define VCS_FULL_HASH ${VCS_FULL_HASH}
|
||||
#define VCS_SHORT_HASH ${VCS_SHORT_HASH}
|
||||
|
||||
#define VCS_WC_MODIFIED ${WC_MODIFIED}
|
||||
|
||||
#endif
|
||||
|
||||
EOF
|
|
@ -100,8 +100,7 @@ struct RevisionInformation
|
|||
revision("unknown"),
|
||||
low_revisionCount("-1"),
|
||||
revisionCount("-1"),
|
||||
wc_modified(false),
|
||||
wc_switched(false)
|
||||
wc_modified(false)
|
||||
{}
|
||||
|
||||
assign_once<std::string> low_revision;
|
||||
|
@ -116,7 +115,6 @@ struct RevisionInformation
|
|||
assign_once<std::string> wc_uri;
|
||||
|
||||
bool wc_modified;
|
||||
bool wc_switched;
|
||||
};
|
||||
|
||||
/** Abstract base class for classes that extract revision information.
|
||||
|
@ -401,13 +399,6 @@ bool RevSVNVersionQuery::extractRevision(RevisionInformation& rev_info)
|
|||
line.erase(char_pos, 1);
|
||||
}
|
||||
|
||||
char_pos = line.find('S');
|
||||
if (char_pos != string::npos)
|
||||
{
|
||||
rev_info.wc_switched = true;
|
||||
line.erase(char_pos, 1);
|
||||
}
|
||||
|
||||
rev_info.revision = line;
|
||||
}
|
||||
|
||||
|
@ -756,18 +747,6 @@ bool RevConfigFile::extractRevision(RevisionInformation& rev_info)
|
|||
|
||||
done_stuff = true;
|
||||
}
|
||||
else if (line.compare(0, strlen("wc_switched="), "wc_switched=") == 0)
|
||||
{
|
||||
std::string bool_val = line.substr(strlen("wc_switched="));
|
||||
|
||||
if (bool_val.find("true") != std::string::npos
|
||||
|| bool_val.find('1') != std::string::npos)
|
||||
rev_info.wc_switched = true;
|
||||
else
|
||||
rev_info.wc_switched = false;
|
||||
|
||||
done_stuff = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (done_stuff)
|
||||
|
@ -798,9 +777,6 @@ bool WriteOutput(const string& outputFile, const RevisionInformation& rev_info)
|
|||
if (rev_info.wc_modified)
|
||||
comment_str << "M";
|
||||
|
||||
if (rev_info.wc_switched)
|
||||
comment_str << "S";
|
||||
|
||||
comment_str << "*/";
|
||||
|
||||
string comment(comment_str.str());
|
||||
|
@ -837,84 +813,15 @@ bool WriteOutput(const string& outputFile, const RevisionInformation& rev_info)
|
|||
"#ifndef AUTOREVISION_H\n"
|
||||
"#define AUTOREVISION_H\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"#ifndef SVN_AUTOREVISION_STATIC\n"
|
||||
"#define SVN_AUTOREVISION_STATIC\n"
|
||||
"#endif\n"
|
||||
"\n"
|
||||
"\n";
|
||||
|
||||
if(do_std)
|
||||
header << "#include <string>\n";
|
||||
if(do_wx)
|
||||
header << "#include <wx/string.h>\n";
|
||||
|
||||
header << "\n#define SVN_LOW_REV " << (rev_info.low_revisionCount.empty() ? rev_info.revisionCount : rev_info.low_revisionCount)
|
||||
<< "\n#define SVN_LOW_REV_STR \"" << (rev_info.low_revision.empty() ? rev_info.revision : rev_info.low_revision) << "\""
|
||||
<< "\n#define SVN_REV " << rev_info.revisionCount
|
||||
<< "\n#define SVN_REV_STR \"" << rev_info.revision << "\""
|
||||
<< "\n#define SVN_DATE \"" << rev_info.date << "\""
|
||||
<< "\n#define SVN_URI \"" << rev_info.wc_uri << "\""
|
||||
<< "\n#define SVN_TAG \"" << rev_info.tag << "\"\n"
|
||||
<< "\n#define SVN_SHORT_HASH \"" << rev_info.revision.substr(0, 7) << "\""
|
||||
<< "\n#define SVN_SHORT_HASH_WITHOUT_QUOTES " << rev_info.revision.substr(0, 7)
|
||||
header << "\n#define VCS_NUM " << rev_info.revisionCount
|
||||
<< "\n#define VCS_DATE " << rev_info.date
|
||||
<< "\n#define VCS_URI " << rev_info.wc_uri
|
||||
<< "\n#define VCS_SHORT_HASH " << rev_info.revision.substr(0, 7)
|
||||
<< "\n";
|
||||
|
||||
header << "\n#define SVN_WC_MODIFIED " << rev_info.wc_modified
|
||||
<< "\n#define SVN_WC_SWITCHED " << rev_info.wc_switched << "\n\n";
|
||||
|
||||
// Open namespace
|
||||
if(do_int || do_std || do_wx)
|
||||
header << "namespace autorevision\n{\n";
|
||||
|
||||
if(do_int)
|
||||
header << "\tSVN_AUTOREVISION_STATIC const unsigned int svn_low_revision = " << rev_info.low_revision << ";\n"
|
||||
<< "\tSVN_AUTOREVISION_STATIC const unsigned int svn_revision = " << rev_info.revision << ";\n";
|
||||
|
||||
if(do_std)
|
||||
header << "\tSVN_AUTOREVISION_STATIC const std::string svn_low_revision_s(\"" << rev_info.low_revision << "\");\n"
|
||||
<< "\tSVN_AUTOREVISION_STATIC const std::string svn_revision_s(\"" << rev_info.revision << "\");\n"
|
||||
<< "\tSVN_AUTOREVISION_STATIC const std::string svn_date_s(\"" << rev_info.date << "\");\n"
|
||||
<< "\tSVN_AUTOREVISION_STATIC const std::string svn_uri_s(\"" << rev_info.wc_uri << "\");\n";
|
||||
if(do_cstr)
|
||||
header << "\tSVN_AUTOREVISION_STATIC const char svn_low_revision_cstr[] = \"" << rev_info.low_revision << "\";\n"
|
||||
<< "\tSVN_AUTOREVISION_STATIC const char svn_revision_cstr[] = \"" << rev_info.revision << "\";\n"
|
||||
<< "\tSVN_AUTOREVISION_STATIC const char svn_date_cstr[] = \"" << rev_info.date << "\";\n"
|
||||
<< "\tSVN_AUTOREVISION_STATIC const char svn_uri_cstr[] = \"" << rev_info.wc_uri << "\";\n";
|
||||
if(do_wx)
|
||||
{
|
||||
header << "\tSVN_AUTOREVISION_STATIC const wxString svnLowRevision(";
|
||||
|
||||
if(do_translate)
|
||||
header << "wxT";
|
||||
|
||||
header << "(\"" << rev_info.low_revision << "\"));\n"
|
||||
|
||||
<< "\tSVN_AUTOREVISION_STATIC const wxString svnRevision(";
|
||||
|
||||
if(do_translate)
|
||||
header << "wxT";
|
||||
|
||||
header << "(\"" << rev_info.revision << "\"));\n"
|
||||
|
||||
<< "\tSVN_AUTOREVISION_STATIC const wxString svnDate(";
|
||||
|
||||
if(do_translate)
|
||||
header << "wxT";
|
||||
|
||||
header << "(\"" << rev_info.date << "\"));\n"
|
||||
|
||||
<< "\tSVN_AUTOREVISION_STATIC const wxString svnUri(";
|
||||
|
||||
if(do_translate)
|
||||
header << "wxT";
|
||||
|
||||
header << "(\"" << rev_info.wc_uri << "\"));\n";
|
||||
}
|
||||
|
||||
// Terminate/close namespace
|
||||
if(do_int || do_std || do_wx)
|
||||
header << "}\n\n";
|
||||
header << "\n#define VCS_WC_MODIFIED " << rev_info.wc_modified << "\n\n";
|
||||
|
||||
header << "\n\n#endif\n";
|
||||
|
||||
|
|
|
@ -246,7 +246,7 @@ else
|
|||
fi
|
||||
|
||||
WZ_WARNINGS_GCC="-Wall -Wextra ${WZ_Wno_}unused-parameter ${WZ_Wno_}sign-compare -Wcast-align -Wwrite-strings -Wpointer-arith ${WZ_Wno_}format-security"
|
||||
WZ_WARNINGS_GCC_C="${WZ_WARNINGS_GCC} -Wstrict-prototypes -Wdeclaration-after-statement -Wc++-compat ${WZ_Wno_}c++-compat ${CFLAGS_IGNORE_WARNINGS}"
|
||||
WZ_WARNINGS_GCC_C="${WZ_WARNINGS_GCC} -Wstrict-prototypes -Wdeclaration-after-statement ${CFLAGS_IGNORE_WARNINGS}"
|
||||
WZ_WARNINGS_GCC_CXX="${WZ_Wno_}enum-compare ${WZ_WARNINGS_GCC}"
|
||||
if test "x$enable_debug" = "xyes" ; then
|
||||
if test "x$cc_icc" = "xyes" ; then
|
||||
|
@ -410,9 +410,9 @@ AC_SUBST([OPENGL_LIBS], [${OPENGL_LIBS}])
|
|||
# MinGW derived exception handler.
|
||||
if test "x$host_os_mingw32" = "xyes" ; then
|
||||
AC_CHECK_HEADER(bfd.h, , AC_MSG_ERROR([BFD header not found.]))
|
||||
AC_CHECK_LIB(bfd, bfd_openr, AC_SUBST([BFD_LIBS], [-lbfd]), AC_MSG_ERROR([BFD not found.]), [${IBERTY_LIBS}])
|
||||
AC_CHECK_LIB(bfd, bfd_openr, AC_SUBST([BFD_LIBS], [-lbfd]), AC_MSG_ERROR([BFD not found.]), [${WIN32_LIBS}])
|
||||
|
||||
WIN32_LIBS="${WIN32_LIBS} ${BFD_LIBS} ${IBERTY_LIBS} -lstdc++"
|
||||
WIN32_LIBS="${BFD_LIBS} ${WIN32_LIBS} -lstdc++"
|
||||
fi
|
||||
|
||||
WZ_CPPFLAGS="${WZ_CPPFLAGS} -DWZ_DATADIR=\"\\\"\${datadir}/\${PACKAGE}\\\"\""
|
||||
|
@ -430,7 +430,6 @@ AC_CONFIG_HEADER([config.h])
|
|||
AC_CONFIG_FILES([Makefile
|
||||
po/Makefile.in
|
||||
doc/Makefile
|
||||
build_tools/autorevision/Makefile
|
||||
icons/Makefile
|
||||
data/Makefile
|
||||
data/mods/multiplay/Makefile
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
PIE 2
|
||||
TYPE 200
|
||||
TYPE 10200
|
||||
TEXTURE 0 page-12-player-buildings.png 256 256
|
||||
LEVELS 1
|
||||
LEVEL 1
|
||||
|
|
|
@ -277,7 +277,7 @@ std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>&
|
|||
<< "." << static_cast<unsigned int>(ver.patch);
|
||||
}
|
||||
|
||||
static void createHeader(int const argc, char* argv[])
|
||||
static void createHeader(int const argc, const char** argv)
|
||||
{
|
||||
std::ostringstream os;
|
||||
|
||||
|
@ -353,7 +353,7 @@ void addDumpInfo(const char *inbuffer)
|
|||
miscData.insert(miscData.end(), msg.begin(), msg.end());
|
||||
}
|
||||
|
||||
void dbgDumpInit(int argc, char* argv[])
|
||||
void dbgDumpInit(int argc, const char** argv)
|
||||
{
|
||||
debug_register_callback(&debug_exceptionhandler_data, NULL, NULL, NULL );
|
||||
createHeader(argc, argv);
|
||||
|
|
|
@ -38,7 +38,7 @@ extern void dbgDumpHeader(DumpFileHandle file);
|
|||
*/
|
||||
extern void dbgDumpLog(DumpFileHandle file);
|
||||
|
||||
extern void dbgDumpInit(int argc, char* argv[]);
|
||||
extern void dbgDumpInit(int argc, const char** argv);
|
||||
|
||||
extern void addDumpInfo(const char *inbuffer);
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ static struct sigaction oldAction[NSIG];
|
|||
|
||||
|
||||
static struct utsname sysInfo;
|
||||
static BOOL gdbIsAvailable = false, programIsAvailable = false, sysInfoValid = false;
|
||||
static bool gdbIsAvailable = false, programIsAvailable = false, sysInfoValid = false;
|
||||
static char
|
||||
executionDate[MAX_DATE_STRING] = {'\0'},
|
||||
programPID[MAX_PID_STRING] = {'\0'},
|
||||
|
@ -736,7 +736,7 @@ static bool fetchProgramPath(char * const programPath, size_t const bufSize, con
|
|||
*
|
||||
* \param programCommand Command used to launch this program. Only used for POSIX handler.
|
||||
*/
|
||||
void setupExceptionHandler(int argc, char * argv[])
|
||||
void setupExceptionHandler(int argc, const char ** argv)
|
||||
{
|
||||
#if defined(WZ_OS_UNIX) && !defined(WZ_OS_MAC)
|
||||
const char *programCommand;
|
||||
|
@ -782,7 +782,6 @@ bool OverrideRPTDirectory(char *newPath)
|
|||
//conversion failed-- we won't use the user's directory.
|
||||
|
||||
LPVOID lpMsgBuf;
|
||||
LPVOID lpDisplayBuf;
|
||||
DWORD dw = GetLastError();
|
||||
TCHAR szBuffer[4196];
|
||||
|
||||
|
@ -800,7 +799,6 @@ bool OverrideRPTDirectory(char *newPath)
|
|||
MessageBox((HWND)MB_ICONEXCLAMATION, szBuffer, _T("Error"), MB_OK);
|
||||
|
||||
LocalFree(lpMsgBuf);
|
||||
LocalFree(lpDisplayBuf);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#ifndef __INCLUDED_LIB_EXCEPTIONHANDLER_EXCEPTIONHANDLER_H__
|
||||
#define __INCLUDED_LIB_EXCEPTIONHANDLER_EXCEPTIONHANDLER_H__
|
||||
|
||||
extern void setupExceptionHandler(int argc, char * argv[]);
|
||||
extern void setupExceptionHandler(int argc, const char ** argv);
|
||||
|
||||
extern bool OverrideRPTDirectory(char *newPath);
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ static void find_address_in_section (bfd *abfd, asection *section, PTR data)
|
|||
}
|
||||
|
||||
static
|
||||
BOOL BfdDemangleSymName(LPCTSTR lpName, LPTSTR lpDemangledName, DWORD nSize)
|
||||
bool BfdDemangleSymName(LPCTSTR lpName, LPTSTR lpDemangledName, DWORD nSize)
|
||||
{
|
||||
char *res;
|
||||
|
||||
|
@ -165,7 +165,7 @@ BOOL BfdDemangleSymName(LPCTSTR lpName, LPTSTR lpDemangledName, DWORD nSize)
|
|||
}
|
||||
|
||||
static
|
||||
BOOL BfdGetSymFromAddr(bfd *abfd, asymbol **syms, long symcount, DWORD dwAddress, LPTSTR lpSymName, DWORD nSize)
|
||||
bool BfdGetSymFromAddr(bfd *abfd, asymbol **syms, long symcount, DWORD dwAddress, LPTSTR lpSymName, DWORD nSize)
|
||||
{
|
||||
HMODULE hModule;
|
||||
struct find_handle info;
|
||||
|
@ -195,7 +195,7 @@ BOOL BfdGetSymFromAddr(bfd *abfd, asymbol **syms, long symcount, DWORD dwAddress
|
|||
}
|
||||
|
||||
static
|
||||
BOOL BfdGetLineFromAddr(bfd *abfd, asymbol **syms, long symcount, DWORD dwAddress, LPTSTR lpFileName, DWORD nSize, LPDWORD lpLineNumber)
|
||||
bool BfdGetLineFromAddr(bfd *abfd, asymbol **syms, long symcount, DWORD dwAddress, LPTSTR lpFileName, DWORD nSize, LPDWORD lpLineNumber)
|
||||
{
|
||||
HMODULE hModule;
|
||||
struct find_handle info;
|
||||
|
@ -227,15 +227,15 @@ BOOL BfdGetLineFromAddr(bfd *abfd, asymbol **syms, long symcount, DWORD dwAddres
|
|||
|
||||
#include <imagehlp.h>
|
||||
|
||||
static BOOL bSymInitialized = FALSE;
|
||||
static bool bSymInitialized = FALSE;
|
||||
|
||||
static HMODULE hModule_Imagehlp = NULL;
|
||||
|
||||
typedef BOOL (WINAPI *PFNSYMINITIALIZE)(HANDLE, LPSTR, BOOL);
|
||||
typedef bool (WINAPI *PFNSYMINITIALIZE)(HANDLE, LPSTR, bool);
|
||||
static PFNSYMINITIALIZE pfnSymInitialize = NULL;
|
||||
|
||||
static
|
||||
BOOL WINAPI j_SymInitialize(HANDLE hProcess, PSTR UserSearchPath, BOOL fInvadeProcess)
|
||||
bool WINAPI j_SymInitialize(HANDLE hProcess, PSTR UserSearchPath, bool fInvadeProcess)
|
||||
{
|
||||
if(
|
||||
(hModule_Imagehlp || (hModule_Imagehlp = LoadLibrary(_T("IMAGEHLP.DLL")))) &&
|
||||
|
@ -246,11 +246,11 @@ BOOL WINAPI j_SymInitialize(HANDLE hProcess, PSTR UserSearchPath, BOOL fInvadePr
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
typedef BOOL (WINAPI *PFNSYMCLEANUP)(HANDLE);
|
||||
typedef bool (WINAPI *PFNSYMCLEANUP)(HANDLE);
|
||||
static PFNSYMCLEANUP pfnSymCleanup = NULL;
|
||||
|
||||
static
|
||||
BOOL WINAPI j_SymCleanup(HANDLE hProcess)
|
||||
bool WINAPI j_SymCleanup(HANDLE hProcess)
|
||||
{
|
||||
if(
|
||||
(hModule_Imagehlp || (hModule_Imagehlp = LoadLibrary(_T("IMAGEHLP.DLL")))) &&
|
||||
|
@ -276,11 +276,11 @@ DWORD WINAPI j_SymSetOptions(DWORD SymOptions)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
typedef BOOL (WINAPI *PFNSYMUNDNAME)(PIMAGEHLP_SYMBOL, PSTR, DWORD);
|
||||
typedef bool (WINAPI *PFNSYMUNDNAME)(PIMAGEHLP_SYMBOL, PSTR, DWORD);
|
||||
static PFNSYMUNDNAME pfnSymUnDName = NULL;
|
||||
|
||||
static
|
||||
BOOL WINAPI j_SymUnDName(PIMAGEHLP_SYMBOL Symbol, PSTR UnDecName, DWORD UnDecNameLength)
|
||||
bool WINAPI j_SymUnDName(PIMAGEHLP_SYMBOL Symbol, PSTR UnDecName, DWORD UnDecNameLength)
|
||||
{
|
||||
if(
|
||||
(hModule_Imagehlp || (hModule_Imagehlp = LoadLibrary(_T("IMAGEHLP.DLL")))) &&
|
||||
|
@ -321,11 +321,11 @@ DWORD WINAPI j_SymGetModuleBase(HANDLE hProcess, DWORD dwAddr)
|
|||
return 0;
|
||||
}
|
||||
|
||||
typedef BOOL (WINAPI *PFNSTACKWALK)(DWORD, HANDLE, HANDLE, LPSTACKFRAME, LPVOID, PREAD_PROCESS_MEMORY_ROUTINE, PFUNCTION_TABLE_ACCESS_ROUTINE, PGET_MODULE_BASE_ROUTINE, PTRANSLATE_ADDRESS_ROUTINE);
|
||||
typedef bool (WINAPI *PFNSTACKWALK)(DWORD, HANDLE, HANDLE, LPSTACKFRAME, LPVOID, PREAD_PROCESS_MEMORY_ROUTINE, PFUNCTION_TABLE_ACCESS_ROUTINE, PGET_MODULE_BASE_ROUTINE, PTRANSLATE_ADDRESS_ROUTINE);
|
||||
static PFNSTACKWALK pfnStackWalk = NULL;
|
||||
|
||||
static
|
||||
BOOL WINAPI j_StackWalk(
|
||||
bool WINAPI j_StackWalk(
|
||||
DWORD MachineType,
|
||||
HANDLE hProcess,
|
||||
HANDLE hThread,
|
||||
|
@ -356,11 +356,11 @@ BOOL WINAPI j_StackWalk(
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
typedef BOOL (WINAPI *PFNSYMGETSYMFROMADDR)(HANDLE, DWORD, LPDWORD, PIMAGEHLP_SYMBOL);
|
||||
typedef bool (WINAPI *PFNSYMGETSYMFROMADDR)(HANDLE, DWORD, LPDWORD, PIMAGEHLP_SYMBOL);
|
||||
static PFNSYMGETSYMFROMADDR pfnSymGetSymFromAddr = NULL;
|
||||
|
||||
static
|
||||
BOOL WINAPI j_SymGetSymFromAddr(HANDLE hProcess, DWORD Address, PDWORD Displacement, PIMAGEHLP_SYMBOL Symbol)
|
||||
bool WINAPI j_SymGetSymFromAddr(HANDLE hProcess, DWORD Address, PDWORD Displacement, PIMAGEHLP_SYMBOL Symbol)
|
||||
{
|
||||
if(
|
||||
(hModule_Imagehlp || (hModule_Imagehlp = LoadLibrary(_T("IMAGEHLP.DLL")))) &&
|
||||
|
@ -371,11 +371,11 @@ BOOL WINAPI j_SymGetSymFromAddr(HANDLE hProcess, DWORD Address, PDWORD Displacem
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
typedef BOOL (WINAPI *PFNSYMGETLINEFROMADDR)(HANDLE, DWORD, LPDWORD, PIMAGEHLP_LINE);
|
||||
typedef bool (WINAPI *PFNSYMGETLINEFROMADDR)(HANDLE, DWORD, LPDWORD, PIMAGEHLP_LINE);
|
||||
static PFNSYMGETLINEFROMADDR pfnSymGetLineFromAddr = NULL;
|
||||
|
||||
static
|
||||
BOOL WINAPI j_SymGetLineFromAddr(HANDLE hProcess, DWORD dwAddr, PDWORD pdwDisplacement, PIMAGEHLP_LINE Line)
|
||||
bool WINAPI j_SymGetLineFromAddr(HANDLE hProcess, DWORD dwAddr, PDWORD pdwDisplacement, PIMAGEHLP_LINE Line)
|
||||
{
|
||||
if(
|
||||
(hModule_Imagehlp || (hModule_Imagehlp = LoadLibrary(_T("IMAGEHLP.DLL")))) &&
|
||||
|
@ -387,7 +387,7 @@ BOOL WINAPI j_SymGetLineFromAddr(HANDLE hProcess, DWORD dwAddr, PDWORD pdwDispla
|
|||
}
|
||||
|
||||
static
|
||||
BOOL ImagehlpDemangleSymName(LPCTSTR lpName, LPTSTR lpDemangledName, DWORD nSize)
|
||||
bool ImagehlpDemangleSymName(LPCTSTR lpName, LPTSTR lpDemangledName, DWORD nSize)
|
||||
{
|
||||
BYTE symbolBuffer[sizeof(IMAGEHLP_SYMBOL) + 512];
|
||||
PIMAGEHLP_SYMBOL pSymbol = (PIMAGEHLP_SYMBOL) symbolBuffer;
|
||||
|
@ -406,7 +406,7 @@ BOOL ImagehlpDemangleSymName(LPCTSTR lpName, LPTSTR lpDemangledName, DWORD nSize
|
|||
}
|
||||
|
||||
static
|
||||
BOOL ImagehlpGetSymFromAddr(HANDLE hProcess, DWORD dwAddress, LPTSTR lpSymName, DWORD nSize)
|
||||
bool ImagehlpGetSymFromAddr(HANDLE hProcess, DWORD dwAddress, LPTSTR lpSymName, DWORD nSize)
|
||||
{
|
||||
// IMAGEHLP is wacky, and requires you to pass in a pointer to a
|
||||
// IMAGEHLP_SYMBOL structure. The problem is that this structure is
|
||||
|
@ -434,7 +434,7 @@ BOOL ImagehlpGetSymFromAddr(HANDLE hProcess, DWORD dwAddress, LPTSTR lpSymName,
|
|||
}
|
||||
|
||||
static
|
||||
BOOL ImagehlpGetLineFromAddr(HANDLE hProcess, DWORD dwAddress, LPTSTR lpFileName, DWORD nSize, LPDWORD lpLineNumber)
|
||||
bool ImagehlpGetLineFromAddr(HANDLE hProcess, DWORD dwAddress, LPTSTR lpFileName, DWORD nSize, LPDWORD lpLineNumber)
|
||||
{
|
||||
IMAGEHLP_LINE Line;
|
||||
DWORD dwDisplacement = 0; // Displacement of the input address, relative to the start of the symbol
|
||||
|
@ -477,7 +477,7 @@ BOOL ImagehlpGetLineFromAddr(HANDLE hProcess, DWORD dwAddress, LPTSTR lpFileNam
|
|||
}
|
||||
|
||||
static
|
||||
BOOL PEGetSymFromAddr(HANDLE hProcess, DWORD dwAddress, LPTSTR lpSymName, DWORD nSize)
|
||||
bool PEGetSymFromAddr(HANDLE hProcess, DWORD dwAddress, LPTSTR lpSymName, DWORD nSize)
|
||||
{
|
||||
HMODULE hModule;
|
||||
PIMAGE_NT_HEADERS pNtHdr;
|
||||
|
@ -578,7 +578,7 @@ struct ItDoesntMatterIfItsADWORDOrAVoidPointer_JustCompileTheDamnThing
|
|||
};
|
||||
|
||||
static
|
||||
BOOL WINAPI IntelStackWalk(
|
||||
bool WINAPI IntelStackWalk(
|
||||
DWORD MachineType,
|
||||
HANDLE hProcess,
|
||||
WZ_DECL_UNUSED HANDLE hThread,
|
||||
|
@ -607,10 +607,10 @@ BOOL WINAPI IntelStackWalk(
|
|||
StackFrame->AddrFrame.Offset = ContextRecord->Ebp;
|
||||
|
||||
StackFrame->AddrReturn.Mode = AddrModeFlat;
|
||||
// Error 26 error C2664: 'BOOL (HANDLE,DWORD,PVOID,DWORD,PDWORD)' :
|
||||
// Error 26 error C2664: 'bool (HANDLE,DWORD,PVOID,DWORD,PDWORD)' :
|
||||
// cannot convert parameter 2 from 'void *' to 'DWORD'
|
||||
// c:\warzone\lib\exceptionhandler\exchndl.cpp 599
|
||||
// ../../../../lib/exceptionhandler/exchndl.cpp: In function ‘BOOL IntelStackWalk(DWORD, void*, void*, _tagSTACKFRAME*, CONTEXT*, BOOL (*)(void*, const void*, void*, DWORD, DWORD*), void* (*)(void*, DWORD), DWORD (*)(void*, DWORD), DWORD (*)(void*, void*, _tagADDRESS*))’:
|
||||
// ../../../../lib/exceptionhandler/exchndl.cpp: In function ‘bool IntelStackWalk(DWORD, void*, void*, _tagSTACKFRAME*, CONTEXT*, bool (*)(void*, const void*, void*, DWORD, DWORD*), void* (*)(void*, DWORD), DWORD (*)(void*, DWORD), DWORD (*)(void*, void*, _tagADDRESS*))’:
|
||||
// ../../../../lib/exceptionhandler/exchndl.cpp:599: error: invalid conversion from ‘long unsigned int’ to ‘const void*’
|
||||
if(!ReadMemoryRoutine((HANDLE)hProcess, ItDoesntMatterIfItsADWORDOrAVoidPointer_JustCompileTheDamnThing((void *) (StackFrame->AddrFrame.Offset + sizeof(DWORD))), (void *)&StackFrame->AddrReturn.Offset, sizeof(DWORD), NULL))
|
||||
return FALSE;
|
||||
|
@ -631,7 +631,7 @@ BOOL WINAPI IntelStackWalk(
|
|||
}
|
||||
|
||||
static
|
||||
BOOL StackBackTrace(HANDLE hProcess, HANDLE hThread, PCONTEXT pContext)
|
||||
bool StackBackTrace(HANDLE hProcess, HANDLE hThread, PCONTEXT pContext)
|
||||
{
|
||||
STACKFRAME StackFrame;
|
||||
|
||||
|
@ -668,7 +668,7 @@ BOOL StackBackTrace(HANDLE hProcess, HANDLE hThread, PCONTEXT pContext)
|
|||
|
||||
while ( 1 )
|
||||
{
|
||||
BOOL bSuccess = FALSE;
|
||||
bool bSuccess = FALSE;
|
||||
#ifdef HAVE_BFD
|
||||
const HMODULE hPrevModule = hModule;
|
||||
#endif /* HAVE_BFD */
|
||||
|
@ -1110,7 +1110,7 @@ void GenerateExceptionReport(PEXCEPTION_POINTERS pExceptionInfo)
|
|||
static
|
||||
LONG WINAPI TopLevelExceptionFilter(PEXCEPTION_POINTERS pExceptionInfo)
|
||||
{
|
||||
static BOOL bBeenHere = FALSE;
|
||||
static bool bBeenHere = FALSE;
|
||||
|
||||
if(!bBeenHere)
|
||||
{
|
||||
|
@ -1134,7 +1134,6 @@ LONG WINAPI TopLevelExceptionFilter(PEXCEPTION_POINTERS pExceptionInfo)
|
|||
// Retrieve the system error message for the last-error code
|
||||
|
||||
LPVOID lpMsgBuf;
|
||||
LPVOID lpDisplayBuf;
|
||||
DWORD dw = GetLastError();
|
||||
TCHAR szBuffer[4196];
|
||||
|
||||
|
@ -1152,7 +1151,6 @@ LONG WINAPI TopLevelExceptionFilter(PEXCEPTION_POINTERS pExceptionInfo)
|
|||
MessageBox((HWND)MB_ICONEXCLAMATION, szBuffer, _T("Error"), MB_OK);
|
||||
|
||||
LocalFree(lpMsgBuf);
|
||||
LocalFree(lpDisplayBuf);
|
||||
debug(LOG_ERROR, "Exception handler failed to create file!");
|
||||
}
|
||||
|
||||
|
@ -1176,7 +1174,6 @@ LONG WINAPI TopLevelExceptionFilter(PEXCEPTION_POINTERS pExceptionInfo)
|
|||
if (err == 0)
|
||||
{
|
||||
LPVOID lpMsgBuf;
|
||||
LPVOID lpDisplayBuf;
|
||||
DWORD dw = GetLastError();
|
||||
TCHAR szBuffer[4196];
|
||||
|
||||
|
@ -1194,7 +1191,6 @@ LONG WINAPI TopLevelExceptionFilter(PEXCEPTION_POINTERS pExceptionInfo)
|
|||
MessageBox((HWND)MB_ICONEXCLAMATION, szBuffer, _T("Error"), MB_OK);
|
||||
|
||||
LocalFree(lpMsgBuf);
|
||||
LocalFree(lpDisplayBuf);
|
||||
debug(LOG_ERROR, "Exception handler failed to create file!");
|
||||
}
|
||||
hReportFile = 0;
|
||||
|
|
|
@ -20,12 +20,13 @@
|
|||
|
||||
/* --------- Structure variables */
|
||||
|
||||
typedef struct {
|
||||
struct FPSmanager
|
||||
{
|
||||
uint32_t framecount;
|
||||
float rateticks;
|
||||
uint32_t lastticks;
|
||||
uint32_t rate;
|
||||
} FPSmanager;
|
||||
};
|
||||
|
||||
/* Functions return 0 or value for sucess and -1 for error */
|
||||
|
||||
|
|
|
@ -29,12 +29,12 @@
|
|||
|
||||
#define REGISTRY_HASH_SIZE 32
|
||||
|
||||
typedef struct regkey_t
|
||||
struct regkey_t
|
||||
{
|
||||
char *key;
|
||||
char *value;
|
||||
struct regkey_t *next;
|
||||
} regkey_t;
|
||||
regkey_t * next;
|
||||
};
|
||||
static regkey_t* registry[REGISTRY_HASH_SIZE] = { NULL };
|
||||
static char RegFilePath[PATH_MAX];
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#ifndef __INCLUDED_LIB_FRAMEWORK_CURSORS_H__
|
||||
#define __INCLUDED_LIB_FRAMEWORK_CURSORS_H__
|
||||
|
||||
typedef enum
|
||||
enum CURSOR
|
||||
{
|
||||
CURSOR_ARROW,
|
||||
CURSOR_DEST,
|
||||
|
@ -56,7 +56,7 @@ typedef enum
|
|||
CURSOR_SELECT,
|
||||
|
||||
CURSOR_MAX,
|
||||
} CURSOR;
|
||||
};
|
||||
|
||||
enum CURSOR_TYPE
|
||||
{
|
||||
|
@ -64,7 +64,7 @@ enum CURSOR_TYPE
|
|||
CURSOR_32,
|
||||
};
|
||||
|
||||
void init_system_cursor(CURSOR cur, enum CURSOR_TYPE type);
|
||||
void init_system_cursor(CURSOR cur, CURSOR_TYPE type);
|
||||
void init_system_cursor32(CURSOR cur);
|
||||
void init_system_cursor16(CURSOR cur);
|
||||
|
||||
|
|
|
@ -147,7 +147,8 @@ template<> class StaticAssert<true>{};
|
|||
***/
|
||||
|
||||
/** Debug enums. Must match code_part_names in debug.c */
|
||||
typedef enum {
|
||||
enum code_part
|
||||
{
|
||||
LOG_ALL, /* special: sets all to on */
|
||||
LOG_MAIN,
|
||||
LOG_SOUND,
|
||||
|
@ -181,7 +182,7 @@ typedef enum {
|
|||
LOG_POPUP, // special, on by default, for both debug & release builds (used for OS dependent popup code)
|
||||
LOG_CONSOLE, // send console messages to file
|
||||
LOG_LAST /**< _must_ be last! */
|
||||
} code_part;
|
||||
};
|
||||
|
||||
extern bool enabled_debug[LOG_LAST];
|
||||
|
||||
|
@ -189,13 +190,14 @@ typedef void (*debug_callback_fn)(void**, const char*);
|
|||
typedef bool (*debug_callback_init)(void**);
|
||||
typedef void (*debug_callback_exit)(void**);
|
||||
|
||||
typedef struct _debug_callback {
|
||||
struct _debug_callback * next;
|
||||
struct debug_callback
|
||||
{
|
||||
debug_callback * next;
|
||||
debug_callback_fn callback; /// Function which does the output
|
||||
debug_callback_init init; /// Setup function
|
||||
debug_callback_exit exit; /// Cleaning function
|
||||
void * data; /// Used to pass data to the above functions. Eg a filename or handle.
|
||||
} debug_callback;
|
||||
};
|
||||
|
||||
/**
|
||||
* Call once to initialize the debug logging system.
|
||||
|
|
|
@ -61,11 +61,11 @@ typedef uint16_t PlayerMask;
|
|||
#error Warzone 2100 is not a MMO.
|
||||
#endif
|
||||
|
||||
typedef enum
|
||||
enum QUEUE_MODE
|
||||
{
|
||||
ModeQueue, ///< Sends a message on the game queue, which will get synchronised, by sending a GAME_ message.
|
||||
ModeImmediate ///< Performs the action immediately. Must already have been synchronised, for example by sending a GAME_ message.
|
||||
} QUEUE_MODE;
|
||||
};
|
||||
|
||||
|
||||
/** Initialise the framework library
|
||||
|
|
|
@ -251,12 +251,12 @@ void SetLastResourceFilename(const char *pName)
|
|||
|
||||
|
||||
// Structure for each file currently in use in the resource ... probably only going to be one ... but we will handle upto MAXLOADEDRESOURCE
|
||||
typedef struct
|
||||
struct RESOURCEFILE
|
||||
{
|
||||
char *pBuffer; // a pointer to the data
|
||||
UDWORD size; // number of bytes
|
||||
UBYTE type; // what type of resource is it
|
||||
} RESOURCEFILE;
|
||||
};
|
||||
|
||||
#define RESFILETYPE_EMPTY (0) // empty entry
|
||||
#define RESFILETYPE_PC_SBL (1) // Johns SBL stuff
|
||||
|
|
|
@ -44,23 +44,23 @@ typedef void (*RES_FREE)(void *pData);
|
|||
/** callback type for resload display callback. */
|
||||
typedef void (*RESLOAD_CALLBACK)(void);
|
||||
|
||||
typedef struct res_data
|
||||
struct RES_DATA
|
||||
{
|
||||
void *pData; // pointer to the acutal data
|
||||
SDWORD blockID; // which of the blocks is it in (so we can clear some of them...)
|
||||
|
||||
UDWORD HashedID; // hashed version of the name of the id
|
||||
struct res_data *psNext; // next entry - most likely to be following on!
|
||||
RES_DATA * psNext; // next entry - most likely to be following on!
|
||||
UDWORD usage; // Reference count
|
||||
|
||||
// ID of the resource - filename from the .wrf - e.g. "TRON.PIE"
|
||||
const char* aID;
|
||||
} RES_DATA;
|
||||
};
|
||||
|
||||
|
||||
// New reduced resource type ... specially for PSX
|
||||
// These types are statically defined in data.c
|
||||
typedef struct _res_type
|
||||
struct RES_TYPE
|
||||
{
|
||||
// type is still needed on psx ... strings are defined in source - data.c (yak!)
|
||||
char aType[RESTYPE_MAXCHAR]; // type string (e.g. "PIE" - just for debug use only, only aplicable when loading from wrf (not wdg)
|
||||
|
@ -73,8 +73,8 @@ typedef struct _res_type
|
|||
UDWORD HashedType; // hashed version of the name of the id - // a null hashedtype indicates end of list
|
||||
|
||||
RES_FILELOAD fileLoad; // This isn't really used any more ?
|
||||
struct _res_type *psNext;
|
||||
} RES_TYPE;
|
||||
RES_TYPE * psNext;
|
||||
};
|
||||
|
||||
|
||||
/** Set the function to call when loading files with resloadfile. */
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include "vector.h"
|
||||
|
||||
/** Defines for all the key codes used. */
|
||||
typedef enum _key_code
|
||||
enum KEY_CODE
|
||||
{
|
||||
KEY_ESC = 27,
|
||||
KEY_1 = '1',
|
||||
|
@ -144,7 +144,7 @@ typedef enum _key_code
|
|||
KEY_MAXSCAN = 323, ///< The largest possible scan code.
|
||||
|
||||
KEY_IGNORE = 5190
|
||||
} KEY_CODE;
|
||||
};
|
||||
|
||||
/** Tell the input system that we have lost the focus. */
|
||||
extern void inputLoseFocus(void);
|
||||
|
@ -165,7 +165,7 @@ extern bool keyPressed(KEY_CODE code);
|
|||
/** This returns true if the key went from being down to being up this frame. */
|
||||
extern bool keyReleased(KEY_CODE code);
|
||||
|
||||
typedef enum _mouse_key_code
|
||||
enum MOUSE_KEY_CODE
|
||||
{
|
||||
MOUSE_LMB = 1,
|
||||
MOUSE_MMB,
|
||||
|
@ -173,7 +173,7 @@ typedef enum _mouse_key_code
|
|||
MOUSE_WUP,
|
||||
MOUSE_WDN,
|
||||
MOUSE_BAD
|
||||
} MOUSE_KEY_CODE;
|
||||
};
|
||||
|
||||
/** Return the current X position of the mouse. */
|
||||
extern uint16_t mouseX(void) WZ_DECL_PURE;
|
||||
|
|
|
@ -30,7 +30,7 @@ enum lexinput_type
|
|||
LEXINPUT_BUFFER,
|
||||
};
|
||||
|
||||
typedef struct
|
||||
struct lexerinput_t
|
||||
{
|
||||
union
|
||||
{
|
||||
|
@ -42,8 +42,8 @@ typedef struct
|
|||
const char* end;
|
||||
} buffer;
|
||||
} input;
|
||||
enum lexinput_type type;
|
||||
} lexerinput_t;
|
||||
lexinput_type type;
|
||||
};
|
||||
|
||||
#ifdef YY_EXTRA_TYPE
|
||||
# undef YY_EXTRA_TYPE
|
||||
|
|
|
@ -37,10 +37,10 @@
|
|||
#include "strresly.h"
|
||||
|
||||
/* A String Resource */
|
||||
typedef struct STR_RES
|
||||
struct STR_RES
|
||||
{
|
||||
struct TREAP_NODE** psIDTreap; ///< The treap to store string identifiers
|
||||
} STR_RES;
|
||||
};
|
||||
|
||||
/* Initialise the string system */
|
||||
STR_RES* strresCreate()
|
||||
|
|
|
@ -26,15 +26,15 @@ enum internal_types
|
|||
};
|
||||
|
||||
// A definition group
|
||||
typedef struct _define
|
||||
struct define_t
|
||||
{
|
||||
unsigned int vm; //! value multiple
|
||||
element_t element; //! tag number
|
||||
char vr[2]; //! value representation (type)
|
||||
struct _define *parent; //! parent group
|
||||
struct _define *group; //! child group
|
||||
struct _define *next; //! sibling group
|
||||
struct _define *current; //! where in the sibling list we currently are
|
||||
define_t *parent; //! parent group
|
||||
define_t *group; //! child group
|
||||
define_t *next; //! sibling group
|
||||
define_t *current; //! where in the sibling list we currently are
|
||||
bool defaultval; //! default value
|
||||
union {
|
||||
uint32_t uint32_tval;
|
||||
|
@ -44,7 +44,7 @@ typedef struct _define
|
|||
// debugging temp variables below
|
||||
int countItems; // check group items against number of separators given
|
||||
int expectedItems; // group items expected in current group
|
||||
} define_t;
|
||||
};
|
||||
|
||||
|
||||
static bool tag_error = false; // are we in an error condition?
|
||||
|
|
|
@ -34,13 +34,13 @@
|
|||
#include "debug.h"
|
||||
#include "treap.h"
|
||||
|
||||
typedef struct TREAP_NODE
|
||||
struct TREAP_NODE
|
||||
{
|
||||
const char* key; //< The key to sort the node on
|
||||
unsigned int priority; //< Treap priority
|
||||
const char* string; //< The string stored in the treap
|
||||
struct TREAP_NODE *psLeft, *psRight; //< The sub trees
|
||||
} TREAP_NODE;
|
||||
TREAP_NODE *psLeft, *psRight; //< The sub trees
|
||||
};
|
||||
|
||||
/* A useful comparison function - keys are char pointers */
|
||||
static int treapStringCmp(const char *key1, const char *key2)
|
||||
|
|
|
@ -87,8 +87,4 @@ typedef int32_t SDWORD;
|
|||
#define SDWORD_MIN INT32_MIN
|
||||
#define SDWORD_MAX INT32_MAX
|
||||
|
||||
#if !defined(WZ_OS_WIN)
|
||||
typedef int BOOL;
|
||||
#endif // WZ_OS_WIN
|
||||
|
||||
#endif // __INCLUDED_LIB_FRAMEWORK_TYPES_H__
|
||||
|
|
|
@ -552,7 +552,7 @@
|
|||
# pragma warning (disable : 4244) // Shut up: conversion from 'float' to 'int', possible loss of data
|
||||
# pragma warning (disable : 4267) // Shut up: conversion from 'size_t' to 'type', possible loss of data
|
||||
# pragma warning (disable : 4389) // Shut up: '==' : signed/unsigned mismatch
|
||||
# pragma warning (disable : 4800) // Shut up: 'BOOL' : forcing value to bool 'true' or 'false' (performance warning)
|
||||
# pragma warning (disable : 4800) // Shut up: 'bool' : forcing value to bool 'true' or 'false' (performance warning)
|
||||
# pragma warning (disable : 4512) // Shut up: 'class' : assignment operator could not be generated
|
||||
|
||||
# define strcasecmp _stricmp
|
||||
|
|
|
@ -66,7 +66,7 @@ g_animGlobals;
|
|||
/**
|
||||
* Initialise animation subsystem.
|
||||
*/
|
||||
BOOL anim_Init()
|
||||
bool anim_Init()
|
||||
{
|
||||
/* init globals */
|
||||
g_animGlobals.psAnimList = NULL;
|
||||
|
@ -105,7 +105,7 @@ void anim_ReleaseAnim(BASEANIM *psAnim)
|
|||
/**
|
||||
* Shut down animation subsystem.
|
||||
*/
|
||||
BOOL anim_Shutdown()
|
||||
bool anim_Shutdown()
|
||||
{
|
||||
BASEANIM *psAnim, *psAnimTmp;
|
||||
|
||||
|
@ -143,7 +143,7 @@ static void anim_InitBaseMembers(BASEANIM * psAnim, UWORD uwStates, UWORD uwFram
|
|||
/**
|
||||
* Create animation for a model. Called from animation script.
|
||||
*/
|
||||
BOOL anim_Create3D(char szPieFileName[], UWORD uwStates, UWORD uwFrameRate, UWORD uwObj,
|
||||
bool anim_Create3D(char szPieFileName[], UWORD uwStates, UWORD uwFrameRate, UWORD uwObj,
|
||||
ANIM_MODE ubType, UWORD uwID)
|
||||
{
|
||||
ANIM3D *psAnim3D;
|
||||
|
@ -210,7 +210,7 @@ void anim_BeginScript()
|
|||
|
||||
/***************************************************************************/
|
||||
|
||||
BOOL anim_EndScript()
|
||||
bool anim_EndScript()
|
||||
{
|
||||
BASEANIM *psAnim;
|
||||
|
||||
|
@ -231,7 +231,7 @@ BOOL anim_EndScript()
|
|||
|
||||
/***************************************************************************/
|
||||
|
||||
BOOL anim_AddFrameToAnim(int iFrame, Vector3i vecPos, Vector3i vecRot, Vector3i vecScale)
|
||||
bool anim_AddFrameToAnim(int iFrame, Vector3i vecPos, Vector3i vecRot, Vector3i vecScale)
|
||||
{
|
||||
ANIM_STATE *psState;
|
||||
BASEANIM *psAnim;
|
||||
|
|
|
@ -17,18 +17,15 @@
|
|||
along with Warzone 2100; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
/***************************************************************************/
|
||||
/*! \file anim.h
|
||||
* \brief Animation types and function headers
|
||||
*
|
||||
* Gareth Jones 11/7/97
|
||||
*/
|
||||
/***************************************************************************/
|
||||
|
||||
#ifndef _ANIM_H_
|
||||
#define _ANIM_H_
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
#include <physfs.h>
|
||||
|
||||
|
@ -40,16 +37,13 @@
|
|||
#define NO_ANIM 0xFFFD
|
||||
#define NO_IMD 0xFFFC
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
typedef enum
|
||||
enum ANIM_MODE
|
||||
{
|
||||
ANIM_2D,
|
||||
ANIM_3D_FRAMES,
|
||||
ANIM_3D_FRAMES = 1,
|
||||
ANIM_3D_TRANS
|
||||
} ANIM_MODE;
|
||||
};
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
struct ANIM_STATE;
|
||||
struct BASEANIM;
|
||||
|
@ -66,47 +60,46 @@ struct BASEANIM;
|
|||
struct ANIM_STATE *psStates; \
|
||||
struct BASEANIM *psNext;
|
||||
|
||||
/* ensure ANIM2D/3D structs same size */
|
||||
#define ANIM_3D_ELEMENTS \
|
||||
ANIM_BASE_ELEMENTS \
|
||||
iIMDShape *psFrames; \
|
||||
iIMDShape **apFrame;
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
typedef struct ANIM_STATE
|
||||
struct ANIM_STATE
|
||||
{
|
||||
UWORD uwFrame; /* frame to play */
|
||||
Vector3i vecPos;
|
||||
Vector3i vecAngle;
|
||||
Vector3i vecScale;
|
||||
}
|
||||
ANIM_STATE;
|
||||
};
|
||||
|
||||
typedef struct BASEANIM
|
||||
struct BASEANIM
|
||||
{
|
||||
ANIM_BASE_ELEMENTS
|
||||
}
|
||||
BASEANIM;
|
||||
char szFileName[ANIM_MAX_STR];
|
||||
char animType;
|
||||
UWORD uwID;
|
||||
UWORD uwFrameRate;
|
||||
UWORD uwStates;
|
||||
UWORD uwObj;
|
||||
UWORD uwAnimTime;
|
||||
ANIM_MODE ubType;
|
||||
ANIM_STATE * psStates;
|
||||
BASEANIM * psNext;
|
||||
};
|
||||
|
||||
typedef struct ANIM3D
|
||||
struct ANIM3D : public BASEANIM
|
||||
{
|
||||
ANIM_3D_ELEMENTS
|
||||
}
|
||||
ANIM3D;
|
||||
iIMDShape * psFrames;
|
||||
iIMDShape ** apFrame;
|
||||
};
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
BOOL anim_Init(void);
|
||||
BOOL anim_Shutdown(void);
|
||||
bool anim_Init(void);
|
||||
bool anim_Shutdown(void);
|
||||
BASEANIM * anim_LoadFromBuffer(char *pBuffer, UDWORD size);
|
||||
BASEANIM * anim_LoadFromFile(PHYSFS_file* fileHandle);
|
||||
void anim_ReleaseAnim(BASEANIM *psAnim);
|
||||
BOOL anim_Create3D(char szPieFileName[], UWORD uwFrames, UWORD uwFrameRate, UWORD uwObj,
|
||||
bool anim_Create3D(char szPieFileName[], UWORD uwFrames, UWORD uwFrameRate, UWORD uwObj,
|
||||
ANIM_MODE ubType, UWORD uwID);
|
||||
void anim_BeginScript(void);
|
||||
BOOL anim_EndScript(void);
|
||||
BOOL anim_AddFrameToAnim(int iFrame, Vector3i vecPos, Vector3i vecRot, Vector3i vecScale);
|
||||
bool anim_EndScript(void);
|
||||
bool anim_AddFrameToAnim(int iFrame, Vector3i vecPos, Vector3i vecRot, Vector3i vecScale);
|
||||
BASEANIM * anim_GetAnim(UWORD uwAnimID);
|
||||
UWORD anim_GetAnimID(char *szName);
|
||||
iIMDShape * anim_GetShapeFromID(UWORD uwID);
|
||||
|
|
|
@ -70,7 +70,7 @@ static void animObj_HashFreeElementFunc( void * psElement );
|
|||
*/
|
||||
/***************************************************************************/
|
||||
|
||||
BOOL
|
||||
bool
|
||||
animObj_Init( ANIMOBJDIEDTESTFUNC pDiedFunc )
|
||||
{
|
||||
SDWORD iSize = sizeof(ANIM_OBJECT);
|
||||
|
@ -91,7 +91,7 @@ animObj_Init( ANIMOBJDIEDTESTFUNC pDiedFunc )
|
|||
|
||||
/***************************************************************************/
|
||||
|
||||
BOOL
|
||||
bool
|
||||
animObj_Shutdown( void )
|
||||
{
|
||||
/* destroy hash table */
|
||||
|
@ -144,7 +144,7 @@ animObj_Update( void )
|
|||
{
|
||||
ANIM_OBJECT *psObj;
|
||||
SDWORD dwTime;
|
||||
BOOL bRemove;
|
||||
bool bRemove;
|
||||
|
||||
psObj = (ANIM_OBJECT*)hashTable_GetFirst( g_pAnimObjTable );
|
||||
|
||||
|
|
|
@ -28,69 +28,43 @@
|
|||
#ifndef _ANIMOBJ_H_
|
||||
#define _ANIMOBJ_H_
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
#include "anim.h"
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
#define ANIM_MAX_COMPONENTS 10
|
||||
|
||||
/***************************************************************************/
|
||||
/* forward struct declarations */
|
||||
|
||||
struct ANIM_OBJECT;
|
||||
struct COMPONENT_OBJECT;
|
||||
|
||||
/***************************************************************************/
|
||||
/* typedefs */
|
||||
|
||||
typedef void (* ANIMOBJDONEFUNC) ( struct ANIM_OBJECT *psObj );
|
||||
typedef BOOL (* ANIMOBJDIEDTESTFUNC) ( void *psParent );
|
||||
typedef bool (* ANIMOBJDIEDTESTFUNC) ( void *psParent );
|
||||
|
||||
/***************************************************************************/
|
||||
/* struct member macros */
|
||||
|
||||
#define COMPONENT_ELEMENTS(pointerType) \
|
||||
Vector3i position; \
|
||||
Vector3i orientation; \
|
||||
void *psParent; \
|
||||
iIMDShape *psShape;
|
||||
|
||||
#define ANIM_OBJECT_ELEMENTS(pointerType) \
|
||||
UWORD uwID; \
|
||||
ANIM3D *psAnim; \
|
||||
void *psParent; \
|
||||
UDWORD udwStartTime; \
|
||||
UDWORD udwStartDelay; \
|
||||
UWORD uwCycles; \
|
||||
BOOL bVisible; \
|
||||
ANIMOBJDONEFUNC pDoneFunc; \
|
||||
/* this must be the last entry in this structure */ \
|
||||
COMPONENT_OBJECT apComponents[ANIM_MAX_COMPONENTS];
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
typedef struct COMPONENT_OBJECT
|
||||
struct COMPONENT_OBJECT
|
||||
{
|
||||
COMPONENT_ELEMENTS( struct COMPONENT_OBJECT )
|
||||
}
|
||||
COMPONENT_OBJECT;
|
||||
Vector3i position;
|
||||
Vector3i orientation;
|
||||
void * psParent;
|
||||
iIMDShape * psShape;
|
||||
};
|
||||
|
||||
typedef struct ANIM_OBJECT
|
||||
struct ANIM_OBJECT
|
||||
{
|
||||
struct ANIM_OBJECT *psNext;
|
||||
ANIM_OBJECT * psNext;
|
||||
|
||||
UWORD uwID;
|
||||
ANIM3D * psAnim;
|
||||
void * psParent;
|
||||
UDWORD udwStartTime;
|
||||
UDWORD udwStartDelay;
|
||||
UWORD uwCycles;
|
||||
bool bVisible;
|
||||
ANIMOBJDONEFUNC pDoneFunc;
|
||||
/* this must be the last entry in this structure */
|
||||
ANIM_OBJECT_ELEMENTS( struct ANIM_OBJECT )
|
||||
}
|
||||
ANIM_OBJECT;
|
||||
COMPONENT_OBJECT apComponents[ANIM_MAX_COMPONENTS];
|
||||
};
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
BOOL animObj_Init( ANIMOBJDIEDTESTFUNC pDiedFunc );
|
||||
bool animObj_Init( ANIMOBJDIEDTESTFUNC pDiedFunc );
|
||||
void animObj_Update( void );
|
||||
BOOL animObj_Shutdown( void );
|
||||
bool animObj_Shutdown( void );
|
||||
void animObj_SetDoneFunc( ANIM_OBJECT *psObj,
|
||||
ANIMOBJDONEFUNC pDoneFunc );
|
||||
|
||||
|
@ -103,8 +77,4 @@ ANIM_OBJECT * animObj_GetFirst( void );
|
|||
ANIM_OBJECT * animObj_GetNext( void );
|
||||
ANIM_OBJECT * animObj_Find( void *pParentObj, int iAnimID );
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
#endif /* _ANIMOBJ_H_ */
|
||||
|
||||
/***************************************************************************/
|
||||
|
|
|
@ -99,7 +99,7 @@ audio_list: audio_list audio_track |
|
|||
audio_track
|
||||
;
|
||||
/*
|
||||
* unsigned int audio_SetTrackVals(const char* fileName, BOOL loop, unsigned int volume, unsigned int audibleRadius)
|
||||
* unsigned int audio_SetTrackVals(const char* fileName, bool loop, unsigned int volume, unsigned int audibleRadius)
|
||||
*/
|
||||
|
||||
audio_track: AUDIO QTEXT looping INTEGER INTEGER
|
||||
|
|
|
@ -295,7 +295,7 @@ void gameTimeGetMod(float *pMod)
|
|||
*pMod = modifier;
|
||||
}
|
||||
|
||||
BOOL gameTimeIsStopped(void)
|
||||
bool gameTimeIsStopped(void)
|
||||
{
|
||||
return (stopCount != 0);
|
||||
}
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
#ifndef _gtime_h
|
||||
#define _gtime_h
|
||||
|
||||
//#include "lib/netplay/nettypes.h"
|
||||
typedef struct _netqueue NETQUEUE_;
|
||||
struct NETQUEUE;
|
||||
|
||||
/// The number of time units per second of the game clock.
|
||||
#define GAME_TICKS_PER_SEC 1000
|
||||
|
@ -79,7 +78,7 @@ void gameTimeUpdateEnd(void);
|
|||
void realTimeUpdate(void);
|
||||
|
||||
/* Returns true if gameTime is stopped. */
|
||||
extern BOOL gameTimeIsStopped(void);
|
||||
extern bool gameTimeIsStopped(void);
|
||||
|
||||
/** Call this to stop the game timer. */
|
||||
extern void gameTimeStop(void);
|
||||
|
@ -157,7 +156,7 @@ static inline float realTimeAdjustedIncrement(float value)
|
|||
}
|
||||
|
||||
void sendPlayerGameTime(void); ///< Sends a GAME_GAME_TIME message with gameTime plus latency to our game queues.
|
||||
void recvPlayerGameTime(NETQUEUE_ queue); ///< Processes a GAME_GAME_TIME message.
|
||||
void recvPlayerGameTime(NETQUEUE queue); ///< Processes a GAME_GAME_TIME message.
|
||||
bool checkPlayerGameTime(unsigned player); ///< Checks that we are not waiting for a GAME_GAME_TIME message from this player. (player can be NET_ALL_PLAYERS.)
|
||||
void setPlayerGameTime(unsigned player, uint32_t time); ///< Sets the player's time.
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ static UDWORD HashTest(intptr_t iKey1, intptr_t iKey2)
|
|||
|
||||
/***************************************************************************/
|
||||
|
||||
BOOL
|
||||
bool
|
||||
hashTable_Create( HASHTABLE **ppsTable, UDWORD udwTableSize,
|
||||
UDWORD udwInitElements, UDWORD udwExtElements, UDWORD udwElementSize )
|
||||
{
|
||||
|
@ -259,7 +259,7 @@ void *hashTable_FindElement(HASHTABLE *psTable, intptr_t iKey1, intptr_t iKey2)
|
|||
/***************************************************************************/
|
||||
|
||||
static void
|
||||
hashTable_SetNextNode( HASHTABLE *psTable, BOOL bMoveToNextNode )
|
||||
hashTable_SetNextNode( HASHTABLE *psTable, bool bMoveToNextNode )
|
||||
{
|
||||
if ( (bMoveToNextNode == true) && (psTable->psNextNode != NULL) )
|
||||
{
|
||||
|
@ -293,7 +293,7 @@ hashTable_SetNextNode( HASHTABLE *psTable, BOOL bMoveToNextNode )
|
|||
|
||||
/***************************************************************************/
|
||||
|
||||
BOOL
|
||||
bool
|
||||
hashTable_RemoveElement(HASHTABLE *psTable, void *psElement, intptr_t iKey1, intptr_t iKey2)
|
||||
{
|
||||
UDWORD udwHashIndex;
|
||||
|
|
|
@ -60,16 +60,15 @@ typedef void (* HASHFREEFUNC) ( void *psElement );
|
|||
/* structs
|
||||
*/
|
||||
|
||||
typedef struct HASHNODE
|
||||
struct HASHNODE
|
||||
{
|
||||
intptr_t iKey1;
|
||||
intptr_t iKey2;
|
||||
void *psElement;
|
||||
struct HASHNODE *psNext;
|
||||
}
|
||||
HASHNODE;
|
||||
HASHNODE * psNext;
|
||||
};
|
||||
|
||||
typedef struct HASHTABLE
|
||||
struct HASHTABLE
|
||||
{
|
||||
HASHNODE **ppsNode;
|
||||
HASHNODE *psNextNode;
|
||||
|
@ -80,8 +79,7 @@ typedef struct HASHTABLE
|
|||
UDWORD udwExtElements;
|
||||
UDWORD udwElementSize;
|
||||
UDWORD sdwCurIndex;
|
||||
}
|
||||
HASHTABLE;
|
||||
};
|
||||
|
||||
/***************************************************************************/
|
||||
/* functions
|
||||
|
@ -96,7 +94,7 @@ HASHTABLE;
|
|||
* \param udwExtElements number of elements when extending the heap
|
||||
* \param udwElementSize size of elements to be stored in the hashtable
|
||||
*/
|
||||
BOOL hashTable_Create( HASHTABLE **ppsTable, UDWORD udwTableSize,
|
||||
bool hashTable_Create( HASHTABLE **ppsTable, UDWORD udwTableSize,
|
||||
UDWORD udwInitElements, UDWORD udwExtElements,
|
||||
UDWORD udwElementSize );
|
||||
|
||||
|
@ -141,7 +139,7 @@ void hashTable_InsertElement(HASHTABLE *psTable, void *psElement, intptr_t iKey1
|
|||
* \param iKey2 second key
|
||||
* \return true, if the element was contained in the hashtable
|
||||
*/
|
||||
BOOL hashTable_RemoveElement(HASHTABLE *psTable, void *psElement, intptr_t iKey1, intptr_t iKey2);
|
||||
bool hashTable_RemoveElement(HASHTABLE *psTable, void *psElement, intptr_t iKey1, intptr_t iKey2);
|
||||
|
||||
/**
|
||||
* Calculates hash index from keys and returns element in hash table
|
||||
|
|
|
@ -234,7 +234,7 @@ void inifile_set_current_section(inifile *inif, const char *sec)
|
|||
ASSERT(inif->currsec, "Failed to allocate inifile memory.");
|
||||
}
|
||||
|
||||
BOOL inifile_key_exists(inifile *inif, const char *key)
|
||||
bool inifile_key_exists(inifile *inif, const char *key)
|
||||
{
|
||||
for (unsigned i = 0; i < inif->entry.size(); ++i)
|
||||
{
|
||||
|
|
|
@ -89,7 +89,7 @@ void inifile_set_current_section(inifile *inif, const char *sec);
|
|||
* @param key The key to check the existence of.
|
||||
* @return True if the key exists, false otherwise.
|
||||
*/
|
||||
BOOL inifile_key_exists(inifile *inif, const char *key);
|
||||
bool inifile_key_exists(inifile *inif, const char *key);
|
||||
|
||||
/**
|
||||
* Fetches the value of the key specified by key in the inifile inif. If the key
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
|
||||
extern iIMDShape *iV_ProcessIMD(const char **ppFileData, const char *FileDataEnd );
|
||||
|
||||
extern BOOL iV_IMDSave(char *filename, iIMDShape *s, BOOL PieIMD);
|
||||
extern bool iV_IMDSave(char *filename, iIMDShape *s, bool PieIMD);
|
||||
extern void iV_IMDRelease(iIMDShape *s);
|
||||
|
||||
// How high up do we want to stop looking
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include "imd.h" // for imd structures
|
||||
#include "tex.h" // texture page loading
|
||||
|
||||
static BOOL AtEndOfFile(const char *CurPos, const char *EndOfFile)
|
||||
static bool AtEndOfFile(const char *CurPos, const char *EndOfFile)
|
||||
{
|
||||
while ( *CurPos == 0x00 || *CurPos == 0x09 || *CurPos == 0x0a || *CurPos == 0x0d || *CurPos == 0x20 )
|
||||
{
|
||||
|
@ -199,7 +199,7 @@ static bool _imd_load_polys( const char **ppFileData, iIMDShape *s, int pieVersi
|
|||
}
|
||||
|
||||
|
||||
static BOOL ReadPoints( const char **ppFileData, iIMDShape *s )
|
||||
static bool ReadPoints( const char **ppFileData, iIMDShape *s )
|
||||
{
|
||||
const char *pFileData = *ppFileData;
|
||||
unsigned int i;
|
||||
|
@ -221,7 +221,7 @@ static BOOL ReadPoints( const char **ppFileData, iIMDShape *s )
|
|||
}
|
||||
|
||||
|
||||
static BOOL _imd_load_points( const char **ppFileData, iIMDShape *s )
|
||||
static bool _imd_load_points( const char **ppFileData, iIMDShape *s )
|
||||
{
|
||||
Vector3f *p = NULL;
|
||||
int32_t tempXMax, tempXMin, tempZMax, tempZMin;
|
||||
|
@ -455,7 +455,7 @@ static BOOL _imd_load_points( const char **ppFileData, iIMDShape *s )
|
|||
* \pre s->nconnectors set
|
||||
* \post s->connectors allocated
|
||||
*/
|
||||
static BOOL _imd_load_connectors(const char **ppFileData, iIMDShape *s)
|
||||
static bool _imd_load_connectors(const char **ppFileData, iIMDShape *s)
|
||||
{
|
||||
const char *pFileData = *ppFileData;
|
||||
int cnt;
|
||||
|
@ -639,7 +639,7 @@ iIMDShape *iV_ProcessIMD( const char **ppFileData, const char *FileDataEnd )
|
|||
UDWORD level;
|
||||
int32_t imd_version;
|
||||
uint32_t imd_flags;
|
||||
BOOL bTextured = false;
|
||||
bool bTextured = false;
|
||||
|
||||
if (sscanf(pFileData, "%255s %d%n", buffer, &imd_version, &cnt) != 2)
|
||||
{
|
||||
|
|
|
@ -37,16 +37,20 @@
|
|||
// screen surface structure
|
||||
//
|
||||
//*************************************************************************
|
||||
typedef struct { int32_t left, top, right, bottom; } iClip;
|
||||
struct iClip
|
||||
{
|
||||
int32_t left, top, right, bottom;
|
||||
};
|
||||
|
||||
typedef struct _iSurface {
|
||||
struct iSurface
|
||||
{
|
||||
int xcentre;
|
||||
int ycentre;
|
||||
iClip clip;
|
||||
|
||||
int width;
|
||||
int height;
|
||||
} iSurface;
|
||||
};
|
||||
|
||||
//*************************************************************************
|
||||
//
|
||||
|
@ -55,12 +59,13 @@ typedef struct _iSurface {
|
|||
//*************************************************************************
|
||||
|
||||
/// Stores the from and to verticles from an edge
|
||||
typedef struct edge_
|
||||
struct EDGE
|
||||
{
|
||||
int from, to;
|
||||
} EDGE;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct iIMDPoly
|
||||
{
|
||||
uint32_t flags;
|
||||
int32_t zcentre;
|
||||
unsigned int npnts;
|
||||
|
@ -68,9 +73,10 @@ typedef struct {
|
|||
int pindex[3];
|
||||
Vector2f *texCoord;
|
||||
Vector2f texAnim;
|
||||
} iIMDPoly;
|
||||
};
|
||||
|
||||
typedef struct _iIMDShape {
|
||||
struct iIMDShape
|
||||
{
|
||||
unsigned int flags;
|
||||
int texpage;
|
||||
int tcmaskpage;
|
||||
|
@ -95,8 +101,8 @@ typedef struct _iIMDShape {
|
|||
float material[LIGHT_MAX][4];
|
||||
float shininess;
|
||||
|
||||
struct _iIMDShape *next; // next pie in multilevel pies (NULL for non multilevel !)
|
||||
} iIMDShape;
|
||||
iIMDShape *next; // next pie in multilevel pies (NULL for non multilevel !)
|
||||
};
|
||||
|
||||
|
||||
//*************************************************************************
|
||||
|
@ -105,7 +111,8 @@ typedef struct _iIMDShape {
|
|||
//
|
||||
//*************************************************************************
|
||||
|
||||
typedef struct {
|
||||
struct IMAGEDEF
|
||||
{
|
||||
unsigned int TPageID; /**< Which associated file to read our info from */
|
||||
unsigned int Tu; /**< First vertex coordinate */
|
||||
unsigned int Tv; /**< Second vertex coordinate */
|
||||
|
@ -113,13 +120,14 @@ typedef struct {
|
|||
unsigned int Height; /**< Height of image */
|
||||
int XOffset; /**< X offset into source position */
|
||||
int YOffset; /**< Y offset into source position */
|
||||
} IMAGEDEF;
|
||||
};
|
||||
|
||||
#define MAX_NUM_TPAGEIDS 16
|
||||
typedef struct {
|
||||
struct IMAGEFILE
|
||||
{
|
||||
int NumImages; /**< Number of images contained here */
|
||||
int TPageIDs[MAX_NUM_TPAGEIDS]; /**< OpenGL Texture IDs */
|
||||
IMAGEDEF *ImageDefs; /**< Stored images */
|
||||
} IMAGEFILE;
|
||||
};
|
||||
|
||||
#endif // _ivisdef_h
|
||||
|
|
|
@ -266,7 +266,7 @@ void pie_UploadDisplayBuffer()
|
|||
screen_Upload(NULL, false);
|
||||
}
|
||||
|
||||
BOOL pie_InitRadar(void)
|
||||
bool pie_InitRadar(void)
|
||||
{
|
||||
radarTexture = _TEX_INDEX;
|
||||
glGenTextures(1, &_TEX_PAGE[_TEX_INDEX].id);
|
||||
|
@ -274,7 +274,7 @@ BOOL pie_InitRadar(void)
|
|||
return true;
|
||||
}
|
||||
|
||||
BOOL pie_ShutdownRadar(void)
|
||||
bool pie_ShutdownRadar(void)
|
||||
{
|
||||
glDeleteTextures(1, &_TEX_PAGE[radarTexture].id);
|
||||
return true;
|
||||
|
|
|
@ -70,19 +70,19 @@ extern void iV_DrawImageRect(IMAGEFILE *ImageFile, UWORD ID, int x, int y, int W
|
|||
extern void iV_TransBoxFill(float x0, float y0, float x1, float y1);
|
||||
extern void pie_UniTransBoxFill(float x0, float y0, float x1, float y1, PIELIGHT colour);
|
||||
|
||||
extern BOOL pie_InitRadar(void);
|
||||
extern BOOL pie_ShutdownRadar(void);
|
||||
extern bool pie_InitRadar(void);
|
||||
extern bool pie_ShutdownRadar(void);
|
||||
extern void pie_DownLoadRadar(UDWORD *buffer, int width, int height, bool filter);
|
||||
extern void pie_RenderRadar(int x, int y, int width, int height);
|
||||
|
||||
extern void pie_UploadDisplayBuffer(void);
|
||||
|
||||
typedef enum _screenType
|
||||
enum SCREENTYPE
|
||||
{
|
||||
SCREEN_RANDOMBDROP,
|
||||
SCREEN_CREDITS,
|
||||
SCREEN_MISSIONEND,
|
||||
} SCREENTYPE;
|
||||
};
|
||||
|
||||
extern void pie_LoadBackDrop(SCREENTYPE screenType);
|
||||
|
||||
|
|
|
@ -22,19 +22,19 @@
|
|||
|
||||
static UDWORD videoBufferDepth = 32, videoBufferWidth = 0, videoBufferHeight = 0;
|
||||
|
||||
BOOL pie_SetVideoBufferDepth(UDWORD depth)
|
||||
bool pie_SetVideoBufferDepth(UDWORD depth)
|
||||
{
|
||||
videoBufferDepth = depth;
|
||||
return(true);
|
||||
}
|
||||
|
||||
BOOL pie_SetVideoBufferWidth(UDWORD width)
|
||||
bool pie_SetVideoBufferWidth(UDWORD width)
|
||||
{
|
||||
videoBufferWidth = width;
|
||||
return(true);
|
||||
}
|
||||
|
||||
BOOL pie_SetVideoBufferHeight(UDWORD height)
|
||||
bool pie_SetVideoBufferHeight(UDWORD height)
|
||||
{
|
||||
videoBufferHeight = height;
|
||||
return(true);
|
||||
|
|
|
@ -34,12 +34,12 @@
|
|||
#include "lib/framework/frame.h"
|
||||
#include "piedef.h"
|
||||
|
||||
typedef struct
|
||||
struct CLIP_VERTEX
|
||||
{
|
||||
Vector3i pos;
|
||||
unsigned int u, v;
|
||||
PIELIGHT light;
|
||||
} CLIP_VERTEX;
|
||||
};
|
||||
|
||||
/***************************************************************************/
|
||||
/*
|
||||
|
@ -47,9 +47,9 @@ typedef struct
|
|||
*/
|
||||
/***************************************************************************/
|
||||
|
||||
extern BOOL pie_SetVideoBufferDepth(UDWORD depth);
|
||||
extern BOOL pie_SetVideoBufferWidth(UDWORD width);
|
||||
extern BOOL pie_SetVideoBufferHeight(UDWORD height);
|
||||
extern bool pie_SetVideoBufferDepth(UDWORD depth);
|
||||
extern bool pie_SetVideoBufferWidth(UDWORD width);
|
||||
extern bool pie_SetVideoBufferHeight(UDWORD height);
|
||||
extern int pie_GetVideoBufferDepth( void ) WZ_DECL_PURE;
|
||||
extern int pie_GetVideoBufferWidth( void ) WZ_DECL_PURE;
|
||||
extern int pie_GetVideoBufferHeight( void ) WZ_DECL_PURE;
|
||||
|
|
|
@ -42,20 +42,35 @@
|
|||
*/
|
||||
/***************************************************************************/
|
||||
|
||||
typedef struct { UBYTE r, g, b, a; } PIELIGHTBYTES;
|
||||
struct PIELIGHTBYTES
|
||||
{
|
||||
uint8_t r, g, b, a;
|
||||
};
|
||||
|
||||
/** Our basic colour type. Use whenever you want to define a colour.
|
||||
* Set bytes separetely, and do not assume a byte order between the components. */
|
||||
typedef union { PIELIGHTBYTES byte; UDWORD rgba; UBYTE vector[4]; } PIELIGHT;
|
||||
typedef struct {SWORD x, y, w, h;} PIERECT; /**< Screen rectangle. */
|
||||
typedef struct {SDWORD texPage; SWORD tu, tv, tw, th;} PIEIMAGE; /**< An area of texture. */
|
||||
union PIELIGHT
|
||||
{
|
||||
PIELIGHTBYTES byte;
|
||||
UDWORD rgba;
|
||||
UBYTE vector[4];
|
||||
};
|
||||
struct PIERECT ///< Screen rectangle.
|
||||
{
|
||||
SWORD x, y, w, h;
|
||||
};
|
||||
struct PIEIMAGE ///< An area of texture.
|
||||
{
|
||||
SDWORD texPage;
|
||||
SWORD tu, tv, tw, th;
|
||||
};
|
||||
|
||||
/***************************************************************************/
|
||||
/*
|
||||
* Global ProtoTypes
|
||||
*/
|
||||
/***************************************************************************/
|
||||
extern void pie_Draw3DShape(iIMDShape *shape, int frame, int team, PIELIGHT colour, int pieFlag, int pieFlagData, int shaderlessTeamColourHackAmount = 0);
|
||||
extern void pie_Draw3DShape(iIMDShape *shape, int frame, int team, PIELIGHT colour, int pieFlag, int pieFlagData);
|
||||
extern void pie_DrawImage(const PIEIMAGE *image, const PIERECT *dest);
|
||||
|
||||
extern void pie_GetResetCounts(unsigned int* pPieCount, unsigned int* pTileCount, unsigned int* pPolyCount, unsigned int* pStateCount);
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#define TRIANGLES_PER_TILE 2
|
||||
#define VERTICES_PER_TILE (TRIANGLES_PER_TILE * VERTICES_PER_TRIANGLE)
|
||||
|
||||
extern BOOL drawing_interface;
|
||||
extern bool drawing_interface;
|
||||
|
||||
/*
|
||||
* Local Variables
|
||||
|
@ -105,22 +105,24 @@ void pie_EndLighting(void)
|
|||
* Avoids recalculating vertex projections for every poly
|
||||
***************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
struct shadowcasting_shape_t
|
||||
{
|
||||
float matrix[16];
|
||||
iIMDShape* shape;
|
||||
int flag;
|
||||
int flag_data;
|
||||
Vector3f light;
|
||||
} shadowcasting_shape_t;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct transluscent_shape_t
|
||||
{
|
||||
float matrix[16];
|
||||
iIMDShape* shape;
|
||||
int frame;
|
||||
PIELIGHT colour;
|
||||
int flag;
|
||||
int flag_data;
|
||||
} transluscent_shape_t;
|
||||
};
|
||||
|
||||
static shadowcasting_shape_t* scshapes = NULL;
|
||||
static unsigned int scshapes_size = 0;
|
||||
|
@ -129,19 +131,13 @@ static transluscent_shape_t* tshapes = NULL;
|
|||
static unsigned int tshapes_size = 0;
|
||||
static unsigned int nb_tshapes = 0;
|
||||
|
||||
static void pie_Draw3DShape2(iIMDShape *shape, int frame, PIELIGHT colour, PIELIGHT teamcolour, int pieFlag, int pieFlagData, int shaderlessTeamColourHackAmount = 0)
|
||||
static void pie_Draw3DShape2(iIMDShape *shape, int frame, PIELIGHT colour, PIELIGHT teamcolour, int pieFlag, int pieFlagData)
|
||||
{
|
||||
if (bShaderlessTeamcolourHack)
|
||||
{
|
||||
colour.byte.r = (colour.byte.r*(256 - shaderlessTeamColourHackAmount) + teamcolour.byte.r*shaderlessTeamColourHackAmount) / 256; // Ugly, but better than being colourblind.
|
||||
colour.byte.g = (colour.byte.g*(256 - shaderlessTeamColourHackAmount) + teamcolour.byte.g*shaderlessTeamColourHackAmount) / 256;
|
||||
colour.byte.b = (colour.byte.b*(256 - shaderlessTeamColourHackAmount) + teamcolour.byte.b*shaderlessTeamColourHackAmount) / 256;
|
||||
}
|
||||
|
||||
iIMDPoly *pPolys;
|
||||
bool light = true;
|
||||
|
||||
pie_SetAlphaTest(true);
|
||||
|
||||
/* Set fog status */
|
||||
if (!(pieFlag & pie_FORCE_FOG) &&
|
||||
(pieFlag & pie_ADDITIVE || pieFlag & pie_TRANSLUCENT || pieFlag & pie_BUTTON))
|
||||
|
@ -274,7 +270,7 @@ static void addToEdgeList(int a, int b, EDGE *edgelist, unsigned int* edge_count
|
|||
{
|
||||
EDGE newEdge = {a, b};
|
||||
unsigned int i;
|
||||
BOOL foundMatching = false;
|
||||
bool foundMatching = false;
|
||||
|
||||
for(i = 0; i < *edge_count; i++)
|
||||
{
|
||||
|
@ -468,7 +464,7 @@ void pie_CleanUp( void )
|
|||
scshapes = NULL;
|
||||
}
|
||||
|
||||
void pie_Draw3DShape(iIMDShape *shape, int frame, int team, PIELIGHT colour, int pieFlag, int pieFlagData, int shaderlessTeamColourHackAmount)
|
||||
void pie_Draw3DShape(iIMDShape *shape, int frame, int team, PIELIGHT colour, int pieFlag, int pieFlagData)
|
||||
{
|
||||
PIELIGHT teamcolour;
|
||||
|
||||
|
@ -485,7 +481,7 @@ void pie_Draw3DShape(iIMDShape *shape, int frame, int team, PIELIGHT colour, int
|
|||
|
||||
if (drawing_interface || !shadows)
|
||||
{
|
||||
pie_Draw3DShape2(shape, frame, colour, teamcolour, pieFlag, pieFlagData, shaderlessTeamColourHackAmount);
|
||||
pie_Draw3DShape2(shape, frame, colour, teamcolour, pieFlag, pieFlagData);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -565,7 +561,7 @@ void pie_Draw3DShape(iIMDShape *shape, int frame, int team, PIELIGHT colour, int
|
|||
}
|
||||
}
|
||||
|
||||
pie_Draw3DShape2(shape, frame, colour, teamcolour, pieFlag, pieFlagData, shaderlessTeamColourHackAmount);
|
||||
pie_Draw3DShape2(shape, frame, colour, teamcolour, pieFlag, pieFlagData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,11 +44,17 @@
|
|||
* [ c f i l ]
|
||||
* [ 0 0 0 1 ]
|
||||
*/
|
||||
typedef struct { SDWORD a, b, c, d, e, f, g, h, i, j, k, l; } SDMATRIX;
|
||||
struct SDMATRIX
|
||||
{
|
||||
SDWORD a, b, c,
|
||||
d, e, f,
|
||||
g, h, i,
|
||||
j, k, l;
|
||||
};
|
||||
static SDMATRIX aMatrixStack[MATRIX_MAX];
|
||||
static SDMATRIX *psMatrix = &aMatrixStack[0];
|
||||
|
||||
BOOL drawing_interface = true;
|
||||
bool drawing_interface = true;
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
|
||||
iSurface rendSurface;
|
||||
|
||||
BOOL pie_Initialise(void)
|
||||
bool pie_Initialise(void)
|
||||
{
|
||||
pie_TexInit();
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ extern iSurface rendSurface;
|
|||
* Global ProtoTypes
|
||||
*/
|
||||
/***************************************************************************/
|
||||
extern BOOL pie_Initialise(void);
|
||||
extern bool pie_Initialise(void);
|
||||
extern void pie_ShutDown(void);
|
||||
extern void pie_ScreenFlip(int ClearMode);
|
||||
extern UDWORD pie_GetResScalingFactor( void );
|
||||
|
|
|
@ -94,12 +94,12 @@ void pie_SetDefaultStates(void)//Sets all states
|
|||
|
||||
//***************************************************************************
|
||||
//
|
||||
// pie_EnableFog(BOOL val)
|
||||
// pie_EnableFog(bool val)
|
||||
//
|
||||
// Global enable/disable fog to allow fog to be turned of ingame
|
||||
//
|
||||
//***************************************************************************
|
||||
void pie_EnableFog(BOOL val)
|
||||
void pie_EnableFog(bool val)
|
||||
{
|
||||
if (rendStates.fogEnabled != val)
|
||||
{
|
||||
|
@ -120,19 +120,19 @@ void pie_EnableFog(BOOL val)
|
|||
}
|
||||
}
|
||||
|
||||
BOOL pie_GetFogEnabled(void)
|
||||
bool pie_GetFogEnabled(void)
|
||||
{
|
||||
return rendStates.fogEnabled;
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
//
|
||||
// pie_SetFogStatus(BOOL val)
|
||||
// pie_SetFogStatus(bool val)
|
||||
//
|
||||
// Toggle fog on and off for rendering objects inside or outside the 3D world
|
||||
//
|
||||
//***************************************************************************
|
||||
BOOL pie_GetFogStatus(void)
|
||||
bool pie_GetFogStatus(void)
|
||||
{
|
||||
return rendStates.fog;
|
||||
}
|
||||
|
@ -425,11 +425,11 @@ void pie_UpdateFogDistance(float begin, float end)
|
|||
}
|
||||
|
||||
//
|
||||
// pie_SetFogStatus(BOOL val)
|
||||
// pie_SetFogStatus(bool val)
|
||||
//
|
||||
// Toggle fog on and off for rendering objects inside or outside the 3D world
|
||||
//
|
||||
void pie_SetFogStatus(BOOL val)
|
||||
void pie_SetFogStatus(bool val)
|
||||
{
|
||||
float fog_colour[4];
|
||||
|
||||
|
@ -499,7 +499,7 @@ void pie_SetTexturePage(SDWORD num)
|
|||
}
|
||||
}
|
||||
|
||||
void pie_SetAlphaTest(BOOL keyingOn)
|
||||
void pie_SetAlphaTest(bool keyingOn)
|
||||
{
|
||||
if (keyingOn != rendStates.keyingOn)
|
||||
{
|
||||
|
|
|
@ -40,16 +40,15 @@
|
|||
*/
|
||||
/***************************************************************************/
|
||||
|
||||
typedef struct RENDER_STATE
|
||||
{
|
||||
BOOL fogEnabled;
|
||||
BOOL fog;
|
||||
struct RENDER_STATE
|
||||
{
|
||||
bool fogEnabled;
|
||||
bool fog;
|
||||
PIELIGHT fogColour;
|
||||
SDWORD texPage;
|
||||
REND_MODE rendMode;
|
||||
BOOL keyingOn;
|
||||
}
|
||||
RENDER_STATE;
|
||||
bool keyingOn;
|
||||
};
|
||||
|
||||
void rendStatesRendModeHack(); // Sets rendStates.rendMode = REND_ALPHA; (Added during merge, since the renderStates is now static.)
|
||||
|
||||
|
@ -70,17 +69,17 @@ extern void pie_SetDefaultStates(void);//Sets all states
|
|||
extern void pie_SetDepthBufferStatus(DEPTH_MODE depthMode);
|
||||
extern void pie_SetDepthOffset(float offset);
|
||||
//fog available
|
||||
extern void pie_EnableFog(BOOL val);
|
||||
extern BOOL pie_GetFogEnabled(void);
|
||||
extern void pie_EnableFog(bool val);
|
||||
extern bool pie_GetFogEnabled(void);
|
||||
//fog currently on
|
||||
extern void pie_SetFogStatus(BOOL val);
|
||||
extern BOOL pie_GetFogStatus(void);
|
||||
extern void pie_SetFogStatus(bool val);
|
||||
extern bool pie_GetFogStatus(void);
|
||||
extern void pie_SetFogColour(PIELIGHT colour);
|
||||
extern PIELIGHT pie_GetFogColour(void) WZ_DECL_PURE;
|
||||
extern void pie_UpdateFogDistance(float begin, float end);
|
||||
//render states
|
||||
extern void pie_SetTexturePage(SDWORD num);
|
||||
extern void pie_SetAlphaTest(BOOL keyingOn);
|
||||
extern void pie_SetAlphaTest(bool keyingOn);
|
||||
extern void pie_SetRendMode(REND_MODE rendMode);
|
||||
|
||||
extern void pie_InitColourMouse(IMAGEFILE* img, const uint16_t cursorIDs[CURSOR_MAX]);
|
||||
|
|
|
@ -58,52 +58,59 @@
|
|||
|
||||
#define pie_RAISE_SCALE 256
|
||||
|
||||
typedef enum
|
||||
enum LIGHTING_TYPE
|
||||
{
|
||||
LIGHT_EMISSIVE,
|
||||
LIGHT_AMBIENT,
|
||||
LIGHT_DIFFUSE,
|
||||
LIGHT_SPECULAR,
|
||||
LIGHT_MAX
|
||||
} LIGHTING_TYPE;
|
||||
};
|
||||
|
||||
typedef enum
|
||||
enum REND_MODE
|
||||
{
|
||||
REND_ALPHA,
|
||||
REND_ADDITIVE,
|
||||
REND_OPAQUE,
|
||||
REND_MULTIPLICATIVE
|
||||
} REND_MODE;
|
||||
};
|
||||
|
||||
typedef enum
|
||||
enum DEPTH_MODE
|
||||
{
|
||||
DEPTH_CMP_LEQ_WRT_ON,
|
||||
DEPTH_CMP_ALWAYS_WRT_ON,
|
||||
DEPTH_CMP_LEQ_WRT_OFF,
|
||||
DEPTH_CMP_ALWAYS_WRT_OFF
|
||||
} DEPTH_MODE;
|
||||
};
|
||||
|
||||
typedef enum
|
||||
enum TEXPAGE_TYPE
|
||||
{
|
||||
TEXPAGE_NONE = -1,
|
||||
TEXPAGE_EXTERN = -2
|
||||
} TEXPAGE_TYPE;
|
||||
};
|
||||
|
||||
typedef enum SHADER_MODE
|
||||
enum SHADER_MODE
|
||||
{
|
||||
SHADER_NONE,
|
||||
SHADER_COMPONENT,
|
||||
SHADER_BUTTON,
|
||||
SHADER_MAX
|
||||
} SHADER_MODE;
|
||||
};
|
||||
|
||||
//*************************************************************************
|
||||
//
|
||||
// Simple derived types
|
||||
//
|
||||
//*************************************************************************
|
||||
typedef struct { Vector3i p, r; } iView;
|
||||
struct iView
|
||||
{
|
||||
Vector3i p, r;
|
||||
};
|
||||
|
||||
typedef struct { unsigned int width, height, depth; unsigned char *bmp; } iV_Image;
|
||||
struct iV_Image
|
||||
{
|
||||
unsigned int width, height, depth;
|
||||
unsigned char *bmp;
|
||||
};
|
||||
|
||||
#endif // _pieTypes_h
|
||||
|
|
|
@ -70,7 +70,7 @@ static inline void PNGWriteCleanup(png_infop *info_ptr, png_structp *png_ptr, PH
|
|||
PHYSFS_close(fileHandle);
|
||||
}
|
||||
|
||||
BOOL iV_loadImage_PNG(const char *fileName, iV_Image *image)
|
||||
bool iV_loadImage_PNG(const char *fileName, iV_Image *image)
|
||||
{
|
||||
unsigned char PNGheader[PNG_BYTES_TO_CHECK];
|
||||
PHYSFS_sint64 readSize;
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
* \param image Sprite to read into
|
||||
* \return true on success, false otherwise
|
||||
*/
|
||||
BOOL iV_loadImage_PNG(const char *fileName, iV_Image *image);
|
||||
bool iV_loadImage_PNG(const char *fileName, iV_Image *image);
|
||||
|
||||
/*!
|
||||
* Save a PNG from image into file
|
||||
|
|
|
@ -42,19 +42,17 @@
|
|||
#include "src/console.h"
|
||||
#include "src/levels.h"
|
||||
|
||||
bool bShaderlessTeamcolourHack = false;
|
||||
|
||||
/* global used to indicate preferred internal OpenGL format */
|
||||
int wz_texture_compression;
|
||||
|
||||
static BOOL bBackDrop = false;
|
||||
static bool bBackDrop = false;
|
||||
static char screendump_filename[PATH_MAX];
|
||||
static BOOL screendump_required = false;
|
||||
static bool screendump_required = false;
|
||||
static GLuint backDropTexture = ~0;
|
||||
|
||||
static int preview_width = 0, preview_height = 0;
|
||||
static Vector2i player_pos[MAX_PLAYERS];
|
||||
static BOOL mappreview = false;
|
||||
static bool mappreview = false;
|
||||
static char mapname[256];
|
||||
|
||||
/* Initialise the double buffered display */
|
||||
|
@ -166,9 +164,8 @@ bool screenInitialise()
|
|||
}
|
||||
else
|
||||
{
|
||||
debug(LOG_POPUP, "OpenGL 2.0 is not supported by your system, current shaders require this.");
|
||||
debug(LOG_POPUP, "Team colors will not function correctly on your system.");
|
||||
bShaderlessTeamcolourHack = true;
|
||||
debug(LOG_POPUP, "OpenGL 2.0 is not supported by your system, current shaders require this. Please upgrade your graphics drivers if possible.");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
@ -239,7 +236,7 @@ void screen_RestartBackDrop(void)
|
|||
bBackDrop = true;
|
||||
}
|
||||
|
||||
BOOL screen_GetBackDrop(void)
|
||||
bool screen_GetBackDrop(void)
|
||||
{
|
||||
return bBackDrop;
|
||||
}
|
||||
|
@ -247,7 +244,7 @@ BOOL screen_GetBackDrop(void)
|
|||
//******************************************************************
|
||||
//slight hack to display maps (or whatever) in background.
|
||||
//bitmap MUST be (BACKDROP_HACK_WIDTH * BACKDROP_HACK_HEIGHT) for now.
|
||||
void screen_Upload(const char *newBackDropBmp, BOOL preview)
|
||||
void screen_Upload(const char *newBackDropBmp, bool preview)
|
||||
{
|
||||
static bool processed = false;
|
||||
int x1 = 0, x2 = screenWidth, y1 = 0, y2 = screenHeight, i, scale = 0, w = 0, h = 0;
|
||||
|
@ -380,7 +377,7 @@ void screen_disableMapPreview(void)
|
|||
sstrcpy(mapname, "none");
|
||||
}
|
||||
|
||||
BOOL screen_getMapPreview(void)
|
||||
bool screen_getMapPreview(void)
|
||||
{
|
||||
return mappreview;
|
||||
}
|
||||
|
|
|
@ -35,8 +35,6 @@
|
|||
|
||||
#include "lib/framework/types.h"
|
||||
|
||||
extern bool bShaderlessTeamcolourHack;
|
||||
|
||||
/* ------------------------------------------------------------------------------------------- */
|
||||
|
||||
/* Legacy stuff
|
||||
|
@ -49,8 +47,8 @@ extern void screenSetTextColour(UBYTE red, UBYTE green, UBYTE blue);
|
|||
extern void screen_SetBackDropFromFile(const char* filename);
|
||||
extern void screen_StopBackDrop(void);
|
||||
extern void screen_RestartBackDrop(void);
|
||||
extern BOOL screen_GetBackDrop(void);
|
||||
extern void screen_Upload(const char *newBackDropBmp, BOOL preview);
|
||||
extern bool screen_GetBackDrop(void);
|
||||
extern void screen_Upload(const char *newBackDropBmp, bool preview);
|
||||
|
||||
/* screendump */
|
||||
extern void screenDumpToDisk(const char* path);
|
||||
|
@ -64,6 +62,6 @@ extern void screenDoDumpToDiskIfRequired(void);
|
|||
|
||||
void screen_enableMapPreview(char *name, int width, int height, Vector2i *playerpositions);
|
||||
void screen_disableMapPreview(void);
|
||||
BOOL screen_getMapPreview(void);
|
||||
bool screen_getMapPreview(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -32,11 +32,11 @@
|
|||
|
||||
//*************************************************************************
|
||||
|
||||
typedef struct
|
||||
struct iTexPage
|
||||
{
|
||||
char name[iV_TEXNAME_MAX];
|
||||
GLuint id;
|
||||
} iTexPage;
|
||||
};
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ static PHYSFS_file *pFileHandle = NULL;
|
|||
static uint32_t packetcount[2][NUM_GAME_PACKETS];
|
||||
static uint32_t packetsize[2][NUM_GAME_PACKETS];
|
||||
|
||||
BOOL NETstartLogging(void)
|
||||
bool NETstartLogging(void)
|
||||
{
|
||||
time_t aclock;
|
||||
struct tm *newtime;
|
||||
|
@ -69,7 +69,7 @@ BOOL NETstartLogging(void)
|
|||
return true;
|
||||
}
|
||||
|
||||
BOOL NETstopLogging(void)
|
||||
bool NETstopLogging(void)
|
||||
{
|
||||
static const char dash_line[] = "-----------------------------------------------------------\n";
|
||||
char buf[256];
|
||||
|
@ -143,16 +143,16 @@ BOOL NETstopLogging(void)
|
|||
/** log packet
|
||||
* \param type, uint8_t, the packet's type.
|
||||
* \param size, uint32_t, the packet's size
|
||||
* \param received, BOOL, true if we are receiving a packet, false if we are sending a packet.
|
||||
* \param received, bool, true if we are receiving a packet, false if we are sending a packet.
|
||||
*/
|
||||
void NETlogPacket(uint8_t type, uint32_t size, BOOL received)
|
||||
void NETlogPacket(uint8_t type, uint32_t size, bool received)
|
||||
{
|
||||
STATIC_ASSERT((1<<(8*sizeof(type))) == NUM_GAME_PACKETS); // NUM_GAME_PACKETS must be larger than maximum possible type.
|
||||
packetcount[received][type]++;
|
||||
packetsize[received][type] += size;
|
||||
}
|
||||
|
||||
BOOL NETlogEntry(const char *str,UDWORD a,UDWORD b)
|
||||
bool NETlogEntry(const char *str,UDWORD a,UDWORD b)
|
||||
{
|
||||
static const char star_line[] = "************************************************************\n";
|
||||
static UDWORD lastframe = 0;
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
|
||||
#include "netplay.h"
|
||||
|
||||
BOOL NETstartLogging(void);
|
||||
BOOL NETstopLogging(void);
|
||||
BOOL NETlogEntry( const char *str, UDWORD a, UDWORD b );
|
||||
void NETlogPacket(uint8_t type, uint32_t size, BOOL received);
|
||||
bool NETstartLogging(void);
|
||||
bool NETstopLogging(void);
|
||||
bool NETlogEntry( const char *str, UDWORD a, UDWORD b );
|
||||
void NETlogPacket(uint8_t type, uint32_t size, bool received);
|
||||
|
||||
#endif // _netlog_h
|
||||
|
|
|
@ -102,27 +102,27 @@ SYNC_COUNTER sync_counter; // keeps track on how well we are in sync
|
|||
// ////////////////////////////////////////////////////////////////////////
|
||||
// Types
|
||||
|
||||
typedef struct // data regarding the last one second or so.
|
||||
struct NETSTATS // data regarding the last one second or so.
|
||||
{
|
||||
UDWORD bytesRecvd;
|
||||
UDWORD bytesSent; // number of bytes sent in about 1 sec.
|
||||
UDWORD packetsSent;
|
||||
UDWORD packetsRecvd;
|
||||
} NETSTATS;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
struct NET_PLAYER_DATA
|
||||
{
|
||||
uint16_t size;
|
||||
void* data;
|
||||
size_t buffer_size;
|
||||
} NET_PLAYER_DATA;
|
||||
};
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////
|
||||
// Variables
|
||||
|
||||
NETPLAY NetPlay;
|
||||
PLAYER_IP *IPlist = NULL;
|
||||
static BOOL allow_joining = false;
|
||||
static bool allow_joining = false;
|
||||
static bool server_not_there = false;
|
||||
static GAMESTRUCT gamestruct;
|
||||
|
||||
|
@ -173,9 +173,9 @@ unsigned NET_PlayerConnectionStatus[CONNECTIONSTATUS_NORMAL][MAX_PLAYERS];
|
|||
** ie ("trunk", "2.1.3", "3.0", ...)
|
||||
************************************************************************************
|
||||
**/
|
||||
char VersionString[VersionStringSize] = "master, netcode 4.1009";
|
||||
char VersionString[VersionStringSize] = "master, netcode 4.1010";
|
||||
static int NETCODE_VERSION_MAJOR = 4;
|
||||
static int NETCODE_VERSION_MINOR = 1009;
|
||||
static int NETCODE_VERSION_MINOR = 1010;
|
||||
|
||||
bool NETisCorrectVersion(uint32_t game_version_major, uint32_t game_version_minor)
|
||||
{
|
||||
|
@ -512,7 +512,7 @@ void NETplayerKicked(UDWORD index)
|
|||
|
||||
// ////////////////////////////////////////////////////////////////////////
|
||||
// rename the local player
|
||||
BOOL NETchangePlayerName(UDWORD index, char *newName)
|
||||
bool NETchangePlayerName(UDWORD index, char *newName)
|
||||
{
|
||||
if(!NetPlay.bComms)
|
||||
{
|
||||
|
@ -600,7 +600,7 @@ static void NETsendGameFlags(void)
|
|||
|
||||
// ////////////////////////////////////////////////////////////////////////
|
||||
// Set a game flag
|
||||
BOOL NETsetGameFlags(UDWORD flag, SDWORD value)
|
||||
bool NETsetGameFlags(UDWORD flag, SDWORD value)
|
||||
{
|
||||
if(!NetPlay.bComms)
|
||||
{
|
||||
|
@ -1019,10 +1019,8 @@ void NETdiscoverUPnPDevices(void)
|
|||
|
||||
// ////////////////////////////////////////////////////////////////////////
|
||||
// setup stuff
|
||||
int NETinit(BOOL bFirstCall)
|
||||
int NETinit(bool bFirstCall)
|
||||
{
|
||||
UDWORD i;
|
||||
|
||||
debug(LOG_NET, "NETinit");
|
||||
NETlogEntry("NETinit!", SYNC_FLAG, selectedPlayer);
|
||||
NET_InitPlayers();
|
||||
|
@ -1033,10 +1031,7 @@ int NETinit(BOOL bFirstCall)
|
|||
{
|
||||
debug(LOG_NET, "NETPLAY: Init called, MORNIN'");
|
||||
|
||||
for(i = 0; i < MAX_PLAYERS; i++)
|
||||
{
|
||||
memset(&NetPlay.games[i], 0, sizeof(NetPlay.games[i]));
|
||||
}
|
||||
memset(&NetPlay.games, 0, sizeof(NetPlay.games));
|
||||
// NOTE NetPlay.isUPNP is already set in configuration.c!
|
||||
NetPlay.bComms = true;
|
||||
NetPlay.GamePassworded = false;
|
||||
|
@ -1355,7 +1350,7 @@ void NETflush()
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Check if a message is a system message
|
||||
static BOOL NETprocessSystemMessage(NETQUEUE playerQueue, uint8_t type)
|
||||
static bool NETprocessSystemMessage(NETQUEUE playerQueue, uint8_t type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
|
@ -1566,7 +1561,7 @@ static BOOL NETprocessSystemMessage(NETQUEUE playerQueue, uint8_t type)
|
|||
debug(LOG_NET, "Broadcast leaving message to everyone else");
|
||||
NETbeginEncode(NETbroadcastQueue(), NET_PLAYER_LEAVING);
|
||||
{
|
||||
BOOL host = NetPlay.isHost;
|
||||
bool host = NetPlay.isHost;
|
||||
uint32_t id = index;
|
||||
|
||||
NETuint32_t(&id);
|
||||
|
@ -1667,7 +1662,7 @@ static void NETcheckPlayers(void)
|
|||
// Receive a message over the current connection. We return true if there
|
||||
// is a message for the higher level code to process, and false otherwise.
|
||||
// We should not block here.
|
||||
BOOL NETrecvNet(NETQUEUE *queue, uint8_t *type)
|
||||
bool NETrecvNet(NETQUEUE *queue, uint8_t *type)
|
||||
{
|
||||
uint32_t current;
|
||||
|
||||
|
@ -1744,7 +1739,7 @@ checkMessages:
|
|||
return false;
|
||||
}
|
||||
|
||||
BOOL NETrecvGame(NETQUEUE *queue, uint8_t *type)
|
||||
bool NETrecvGame(NETQUEUE *queue, uint8_t *type)
|
||||
{
|
||||
uint32_t current;
|
||||
for (current = 0; current < MAX_PLAYERS; ++current)
|
||||
|
@ -1784,7 +1779,7 @@ BOOL NETrecvGame(NETQUEUE *queue, uint8_t *type)
|
|||
// ////////////////////////////////////////////////////////////////////////
|
||||
// Protocol functions
|
||||
|
||||
BOOL NETsetupTCPIP(const char *machine)
|
||||
bool NETsetupTCPIP(const char *machine)
|
||||
{
|
||||
debug(LOG_NET, "NETsetupTCPIP(%s)", machine ? machine : "NULL");
|
||||
|
||||
|
@ -1890,7 +1885,7 @@ UBYTE NETrecvFile(NETQUEUE queue)
|
|||
debug(LOG_NET, "We are leaving 'nicely' after a fatal error");
|
||||
NETbeginEncode(NETnetQueue(NET_HOST_ONLY), NET_PLAYER_LEAVING);
|
||||
{
|
||||
BOOL host = NetPlay.isHost;
|
||||
bool host = NetPlay.isHost;
|
||||
uint32_t id = selectedPlayer;
|
||||
|
||||
NETuint32_t(&id);
|
||||
|
@ -2454,7 +2449,7 @@ static void NETallowJoining(void)
|
|||
}
|
||||
}
|
||||
|
||||
BOOL NEThostGame(const char* SessionName, const char* PlayerName,
|
||||
bool NEThostGame(const char* SessionName, const char* PlayerName,
|
||||
SDWORD one, SDWORD two, SDWORD three, SDWORD four,
|
||||
UDWORD plyrs) // # of players.
|
||||
{
|
||||
|
@ -2572,7 +2567,7 @@ BOOL NEThostGame(const char* SessionName, const char* PlayerName,
|
|||
|
||||
// ////////////////////////////////////////////////////////////////////////
|
||||
// Stop the dplay interface from accepting more players.
|
||||
BOOL NEThaltJoining(void)
|
||||
bool NEThaltJoining(void)
|
||||
{
|
||||
debug(LOG_NET, "temporarily locking game to prevent more players");
|
||||
|
||||
|
@ -2584,7 +2579,7 @@ BOOL NEThaltJoining(void)
|
|||
|
||||
// ////////////////////////////////////////////////////////////////////////
|
||||
// find games on open connection
|
||||
BOOL NETfindGame(void)
|
||||
bool NETfindGame(void)
|
||||
{
|
||||
SocketAddress* hosts;
|
||||
unsigned int gamecount = 0;
|
||||
|
@ -2727,7 +2722,7 @@ BOOL NETfindGame(void)
|
|||
// ////////////////////////////////////////////////////////////////////////
|
||||
// ////////////////////////////////////////////////////////////////////////
|
||||
// Functions used to setup and join games.
|
||||
BOOL NETjoinGame(UDWORD gameNumber, const char* playername)
|
||||
bool NETjoinGame(UDWORD gameNumber, const char* playername)
|
||||
{
|
||||
SocketAddress *hosts = NULL;
|
||||
unsigned int i;
|
||||
|
@ -3272,7 +3267,6 @@ const char *messageTypeToString(unsigned messageType_)
|
|||
case GAME_FEATUREDEST: return "GAME_FEATUREDEST";
|
||||
case GAME_RESEARCH: return "GAME_RESEARCH";
|
||||
case GAME_FEATURES: return "GAME_FEATURES";
|
||||
case GAME_SECONDARY: return "GAME_SECONDARY";
|
||||
case GAME_ALLIANCE: return "GAME_ALLIANCE";
|
||||
case GAME_GIFT: return "GAME_GIFT";
|
||||
case GAME_ARTIFACTS: return "GAME_ARTIFACTS";
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
// Lobby Connection errors
|
||||
|
||||
typedef enum
|
||||
enum LOBBY_ERROR_TYPES
|
||||
{
|
||||
ERROR_NOERROR,
|
||||
ERROR_CONNECTION,
|
||||
|
@ -43,9 +43,9 @@ typedef enum
|
|||
ERROR_HOSTDROPPED,
|
||||
ERROR_WRONGDATA,
|
||||
ERROR_UNKNOWNFILEISSUE
|
||||
} LOBBY_ERROR_TYPES;
|
||||
};
|
||||
|
||||
typedef enum
|
||||
enum CONNECTION_STATUS
|
||||
{
|
||||
CONNECTIONSTATUS_PLAYER_DROPPED,
|
||||
CONNECTIONSTATUS_PLAYER_LEAVING,
|
||||
|
@ -53,9 +53,9 @@ typedef enum
|
|||
CONNECTIONSTATUS_WAITING_FOR_PLAYER,
|
||||
|
||||
CONNECTIONSTATUS_NORMAL
|
||||
} CONNECTION_STATUS;
|
||||
};
|
||||
|
||||
typedef enum
|
||||
enum MESSAGE_TYPES
|
||||
{
|
||||
NET_MIN_TYPE = 33, ///< Minimum-1 valid NET_ type, *MUST* be first.
|
||||
NET_PING, ///< ping players.
|
||||
|
@ -97,7 +97,6 @@ typedef enum
|
|||
GAME_FEATUREDEST, ///< destroy a game feature.
|
||||
GAME_RESEARCH, ///< Research has been completed.
|
||||
GAME_FEATURES, ///< information regarding features.
|
||||
GAME_SECONDARY, ///< set a droids secondary order
|
||||
GAME_ALLIANCE, ///< alliance data.
|
||||
GAME_GIFT, ///< a luvly gift between players.
|
||||
GAME_ARTIFACTS, ///< artifacts randomly placed.
|
||||
|
@ -119,7 +118,7 @@ typedef enum
|
|||
GAME_DROIDDISEMBARK, ///< droid disembarked from a Transporter
|
||||
// End of redundant messages.
|
||||
GAME_MAX_TYPE ///< Maximum+1 valid GAME_ type, *MUST* be last.
|
||||
} MESSAGE_TYPES;
|
||||
};
|
||||
//#define SYNC_FLAG (NUM_GAME_PACKETS * NUM_GAME_PACKETS) //special flag used for logging.
|
||||
#define SYNC_FLAG 0x10000000 //special flag used for logging. (Not sure what this is. Was added in trunk, NUM_GAME_PACKETS not in newnet.)
|
||||
|
||||
|
@ -139,20 +138,21 @@ typedef enum
|
|||
#define MAX_CONNECTED_PLAYERS MAX_PLAYERS
|
||||
#define MAX_TMP_SOCKETS 16
|
||||
|
||||
typedef struct { //Available game storage... JUST FOR REFERENCE!
|
||||
struct SESSIONDESC //Available game storage... JUST FOR REFERENCE!
|
||||
{
|
||||
int32_t dwSize;
|
||||
int32_t dwFlags;
|
||||
char host[40]; // host's ip address (can fit a full IPv4 and IPv6 address + terminating NUL)
|
||||
int32_t dwMaxPlayers;
|
||||
int32_t dwCurrentPlayers;
|
||||
int32_t dwUserFlags[4];
|
||||
} SESSIONDESC;
|
||||
};
|
||||
|
||||
/**
|
||||
* @note when changing this structure, NETsendGAMESTRUCT, NETrecvGAMESTRUCT and
|
||||
* the lobby server should be changed accordingly.
|
||||
*/
|
||||
typedef struct
|
||||
struct GAMESTRUCT
|
||||
{
|
||||
/* Version of this structure and thus the binary lobby protocol.
|
||||
* @NOTE: <em>MUST</em> be the first item of this struct.
|
||||
|
@ -179,7 +179,7 @@ typedef struct
|
|||
uint32_t future2; // for future use
|
||||
uint32_t future3; // for future use
|
||||
uint32_t future4; // for future use
|
||||
} GAMESTRUCT;
|
||||
};
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////
|
||||
// Message information. ie. the packets sent between machines.
|
||||
|
@ -187,7 +187,8 @@ typedef struct
|
|||
#define NET_ALL_PLAYERS 255
|
||||
#define NET_HOST_ONLY 0
|
||||
// the following structure is going to be used to track if we sync or not
|
||||
typedef struct {
|
||||
struct SYNC_COUNTER
|
||||
{
|
||||
uint64_t sentDroidCheck;
|
||||
uint64_t unsentDroidCheck;
|
||||
uint64_t sentStructureCheck;
|
||||
|
@ -205,31 +206,31 @@ typedef struct {
|
|||
uint16_t cantjoin;
|
||||
uint16_t banned;
|
||||
uint16_t rejected;
|
||||
} SYNC_COUNTER;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
struct WZFile
|
||||
{
|
||||
PHYSFS_file *pFileHandle; // handle
|
||||
PHYSFS_sint32 fileSize_32; // size
|
||||
int32_t currPos; // current position
|
||||
BOOL isSending; // sending to this player
|
||||
BOOL isCancelled; // player cancelled
|
||||
bool isSending; // sending to this player
|
||||
bool isCancelled; // player cancelled
|
||||
int32_t filetype; // future use (1=map 2=mod 3=...)
|
||||
} WZFile;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
struct wzFileStatus
|
||||
{
|
||||
int32_t player; // the client we sent data to
|
||||
int32_t done; // how far done we are (100= finished)
|
||||
int32_t byteCount; // current byte count
|
||||
} wzFileStatus;
|
||||
};
|
||||
|
||||
typedef enum
|
||||
enum wzFileEnum
|
||||
{
|
||||
WZ_FILE_OK,
|
||||
ALREADY_HAVE_FILE,
|
||||
STUCK_IN_FILE_LOOP
|
||||
} wzFileEnum;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -239,49 +240,50 @@ enum
|
|||
// ////////////////////////////////////////////////////////////////////////
|
||||
// Player information. Filled when players join, never re-ordered. selectedPlayer global points to
|
||||
// currently controlled player.
|
||||
typedef struct
|
||||
struct PLAYER
|
||||
{
|
||||
char name[StringSize]; ///< Player name
|
||||
int32_t position; ///< Map starting position
|
||||
int32_t colour; ///< Which colour slot this player is using
|
||||
BOOL allocated; ///< Allocated as a human player
|
||||
bool allocated; ///< Allocated as a human player
|
||||
uint32_t heartattacktime; ///< Time cardiac arrest started
|
||||
BOOL heartbeat; ///< If we are still alive or not
|
||||
BOOL kick; ///< If we should kick them
|
||||
bool heartbeat; ///< If we are still alive or not
|
||||
bool kick; ///< If we should kick them
|
||||
int32_t connection; ///< Index into connection list
|
||||
int32_t team; ///< Which team we are on
|
||||
BOOL ready; ///< player ready to start?
|
||||
bool ready; ///< player ready to start?
|
||||
int8_t ai; ///< index into sorted list of AIs, zero is always default AI
|
||||
int8_t difficulty; ///< difficulty level of AI
|
||||
BOOL needFile; ///< if We need a file sent to us
|
||||
bool needFile; ///< if We need a file sent to us
|
||||
WZFile wzFile; ///< for each player, we keep track of map progress
|
||||
char IPtextAddress[40]; ///< IP of this player
|
||||
} PLAYER;
|
||||
};
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////
|
||||
// all the luvly Netplay info....
|
||||
typedef struct {
|
||||
struct NETPLAY
|
||||
{
|
||||
GAMESTRUCT games[MaxGames]; ///< The collection of games
|
||||
PLAYER players[MAX_PLAYERS]; ///< The array of players.
|
||||
uint32_t playercount; ///< Number of players in game.
|
||||
uint32_t hostPlayer; ///< Index of host in player array
|
||||
uint32_t bComms; ///< Actually do the comms?
|
||||
BOOL isHost; ///< True if we are hosting the game
|
||||
BOOL isUPNP; // if we want the UPnP detection routines to run
|
||||
BOOL isHostAlive; /// if the host is still alive
|
||||
bool isHost; ///< True if we are hosting the game
|
||||
bool isUPNP; // if we want the UPnP detection routines to run
|
||||
bool isHostAlive; /// if the host is still alive
|
||||
PHYSFS_file *pMapFileHandle;
|
||||
char gamePassword[password_string_size]; //
|
||||
bool GamePassworded; // if we have a password or not.
|
||||
bool ShowedMOTD; // only want to show this once
|
||||
char MOTDbuffer[255]; // buffer for MOTD
|
||||
char* MOTD;
|
||||
} NETPLAY;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
struct PLAYER_IP
|
||||
{
|
||||
char pname[40];
|
||||
char IPAddress[40];
|
||||
} PLAYER_IP;
|
||||
};
|
||||
#define MAX_BANS 255
|
||||
// ////////////////////////////////////////////////////////////////////////
|
||||
// variables
|
||||
|
@ -296,10 +298,10 @@ extern char iptoconnect[PATH_MAX]; // holds IP/hostname from command line
|
|||
|
||||
// ////////////////////////////////////////////////////////////////////////
|
||||
// functions available to you.
|
||||
extern int NETinit(BOOL bFirstCall); // init
|
||||
extern int NETinit(bool bFirstCall); // init
|
||||
bool NETsend(uint8_t player, NetMessage const *message); ///< send to player, or broadcast if player == NET_ALL_PLAYERS.
|
||||
extern BOOL NETrecvNet(NETQUEUE *queue, uint8_t *type); ///< recv a message from the net queues if possible.
|
||||
extern BOOL NETrecvGame(NETQUEUE *queue, uint8_t *type); ///< recv a message from the game queues which is sceduled to execute by time, if possible.
|
||||
extern bool NETrecvNet(NETQUEUE *queue, uint8_t *type); ///< recv a message from the net queues if possible.
|
||||
extern bool NETrecvGame(NETQUEUE *queue, uint8_t *type); ///< recv a message from the game queues which is sceduled to execute by time, if possible.
|
||||
void NETflush(void); ///< Flushes any data stuck in compression buffers.
|
||||
|
||||
extern UBYTE NETsendFile(char *fileName, UDWORD player); // send file chunk.
|
||||
|
@ -325,13 +327,13 @@ extern void NETplayerKicked(UDWORD index); // Cleanup after player has been ki
|
|||
// from netjoin.c
|
||||
extern SDWORD NETgetGameFlags(UDWORD flag); // return one of the four flags(dword) about the game.
|
||||
extern int32_t NETgetGameFlagsUnjoined(unsigned int gameid, unsigned int flag); // return one of the four flags(dword) about the game.
|
||||
extern BOOL NETsetGameFlags(UDWORD flag, SDWORD value); // set game flag(1-4) to value.
|
||||
extern BOOL NEThaltJoining(void); // stop new players joining this game
|
||||
extern BOOL NETfindGame(void); // find games being played(uses GAME_GUID);
|
||||
extern BOOL NETjoinGame(UDWORD gameNumber, const char* playername); // join game given with playername
|
||||
extern BOOL NEThostGame(const char* SessionName, const char* PlayerName,// host a game
|
||||
extern bool NETsetGameFlags(UDWORD flag, SDWORD value); // set game flag(1-4) to value.
|
||||
extern bool NEThaltJoining(void); // stop new players joining this game
|
||||
extern bool NETfindGame(void); // find games being played(uses GAME_GUID);
|
||||
extern bool NETjoinGame(UDWORD gameNumber, const char* playername); // join game given with playername
|
||||
extern bool NEThostGame(const char* SessionName, const char* PlayerName,// host a game
|
||||
SDWORD one, SDWORD two, SDWORD three, SDWORD four, UDWORD plyrs);
|
||||
extern BOOL NETchangePlayerName(UDWORD player, char *newName);// change a players name.
|
||||
extern bool NETchangePlayerName(UDWORD player, char *newName);// change a players name.
|
||||
void NETfixDuplicatePlayerNames(void); // Change a player's name automatically, if there are duplicates.
|
||||
|
||||
#include "netlog.h"
|
||||
|
@ -343,7 +345,7 @@ extern unsigned int NETgetMasterserverPort(void);
|
|||
extern void NETsetGameserverPort(unsigned int port);
|
||||
extern unsigned int NETgetGameserverPort(void);
|
||||
|
||||
extern BOOL NETsetupTCPIP(const char *machine);
|
||||
extern bool NETsetupTCPIP(const char *machine);
|
||||
extern void NETsetGamePassword(const char *password);
|
||||
extern void NETBroadcastPlayerInfo(uint32_t index);
|
||||
void NETBroadcastTwoPlayerInfo(uint32_t index1, uint32_t index2);
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
|
||||
#include "lib/framework/types.h"
|
||||
|
||||
typedef struct Socket Socket;
|
||||
typedef struct SocketSet SocketSet;
|
||||
struct Socket;
|
||||
struct SocketSet;
|
||||
typedef struct addrinfo SocketAddress;
|
||||
|
||||
#ifndef WZ_OS_WIN
|
||||
|
|
|
@ -377,7 +377,7 @@ void NETinsertMessageFromNet(NETQUEUE queue, NetMessage const *message)
|
|||
receiveQueue(queue)->pushMessage(*message);
|
||||
}
|
||||
|
||||
BOOL NETisMessageReady(NETQUEUE queue)
|
||||
bool NETisMessageReady(NETQUEUE queue)
|
||||
{
|
||||
return receiveQueue(queue)->haveMessage();
|
||||
}
|
||||
|
@ -447,7 +447,7 @@ void NETbeginDecode(NETQUEUE queue, uint8_t type)
|
|||
assert(type == message.type);
|
||||
}
|
||||
|
||||
BOOL NETend()
|
||||
bool NETend()
|
||||
{
|
||||
// If we are encoding just return true
|
||||
if (NETgetPacketDir() == PACKET_ENCODE)
|
||||
|
@ -573,13 +573,6 @@ void NETuint64_t(uint64_t *ip)
|
|||
queueAuto(*ip);
|
||||
}
|
||||
|
||||
void NETbool(BOOL *bp)
|
||||
{
|
||||
uint8_t i = !!*bp;
|
||||
queueAuto(i);
|
||||
*bp = !!i;
|
||||
}
|
||||
|
||||
void NETbool(bool *bp)
|
||||
{
|
||||
uint8_t i = !!*bp;
|
||||
|
|
|
@ -28,28 +28,28 @@
|
|||
#include "lib/framework/vector.h"
|
||||
#include "lib/netplay/netqueue.h"
|
||||
|
||||
typedef enum packetDirectionEnum
|
||||
enum PACKETDIR
|
||||
{
|
||||
PACKET_ENCODE,
|
||||
PACKET_DECODE,
|
||||
PACKET_INVALID
|
||||
} PACKETDIR;
|
||||
};
|
||||
|
||||
typedef enum QueueType
|
||||
enum QueueType
|
||||
{
|
||||
QUEUE_TMP,
|
||||
QUEUE_NET,
|
||||
QUEUE_GAME,
|
||||
QUEUE_BROADCAST,
|
||||
} QUEUETYPE;
|
||||
};
|
||||
|
||||
typedef struct _netqueue
|
||||
struct NETQUEUE
|
||||
{
|
||||
void *queue; ///< Is either a (NetQueuePair **) or a (NetQueue *). (Note different numbers of *.)
|
||||
BOOL isPair;
|
||||
bool isPair;
|
||||
uint8_t index;
|
||||
uint8_t queueType;
|
||||
} NETQUEUE;
|
||||
};
|
||||
|
||||
NETQUEUE NETnetTmpQueue(unsigned tmpPlayer); ///< One of the temp queues from before a client has joined the game. (See comments on tmpQueues in nettypes.cpp.)
|
||||
NETQUEUE NETnetQueue(unsigned player); ///< The queue pair used for sending and receiving data directly from another client. (See comments on netQueues in nettypes.cpp.)
|
||||
|
@ -58,7 +58,7 @@ NETQUEUE NETbroadcastQueue(void); ///< The queue for sending data di
|
|||
|
||||
void NETinsertRawData(NETQUEUE queue, uint8_t *data, size_t dataLen); ///< Dump raw data from sockets and raw data sent via host here.
|
||||
void NETinsertMessageFromNet(NETQUEUE queue, NetMessage const *message); ///< Dump whole NetMessages into the queue.
|
||||
BOOL NETisMessageReady(NETQUEUE queue); ///< Returns true if there is a complete message ready to deserialise in this queue.
|
||||
bool NETisMessageReady(NETQUEUE queue); ///< Returns true if there is a complete message ready to deserialise in this queue.
|
||||
NetMessage const *NETgetMessage(NETQUEUE queue);///< Returns the current message in the queue which is ready to be deserialised. Do not delete the message.
|
||||
|
||||
void NETinitQueue(NETQUEUE queue); ///< Allocates the queue. Deletes the old queue, if there was one. Avoids a crash on NULL pointer deference when trying to use the queue.
|
||||
|
@ -67,7 +67,7 @@ void NETmoveQueue(NETQUEUE src, NETQUEUE dst); ///< Used for moving the tmpQueue
|
|||
|
||||
void NETbeginEncode(NETQUEUE queue, uint8_t type);
|
||||
void NETbeginDecode(NETQUEUE queue, uint8_t type);
|
||||
BOOL NETend(void);
|
||||
bool NETend(void);
|
||||
void NETflushGameQueues(void);
|
||||
void NETpop(NETQUEUE queue);
|
||||
|
||||
|
@ -80,7 +80,7 @@ void NETuint32_t(uint32_t *ip); ///< Encodes small values (< 1 672 576) in
|
|||
void NETuint32_tLarge(uint32_t *ip); ///< Encodes all values in exactly 4 bytes.
|
||||
void NETint64_t(int64_t *ip);
|
||||
void NETuint64_t(uint64_t *ip);
|
||||
void NETbool(BOOL *bp);
|
||||
void NETbool(bool *bp);
|
||||
void NETbool(bool *bp);
|
||||
void NETstring(char *str, uint16_t maxlen);
|
||||
void NETstring(char const *str, uint16_t maxlen); ///< Encode-only version of NETstring.
|
||||
|
|
|
@ -44,7 +44,7 @@ extern int chat_lex(void);
|
|||
static void chat_store_command(const char *command);
|
||||
|
||||
/* Return value of the chat parsing - to be used in scripts */
|
||||
static BOOL chat_store_parameter(INTERP_VAL *parameter);
|
||||
static bool chat_store_parameter(INTERP_VAL *parameter);
|
||||
|
||||
// Store players that were addressed in a command
|
||||
static void chat_store_player(SDWORD cmdIndex, SDWORD playerIndex);
|
||||
|
@ -57,7 +57,7 @@ static void chat_reset_command(SDWORD cmdIndex);
|
|||
//static INTERP_VAL msgParams[MAX_CHAT_ARGUMENTS];
|
||||
|
||||
/* Store command parameter extracted from the message */
|
||||
static BOOL chat_store_parameter(INTERP_VAL *cmdParam)
|
||||
static bool chat_store_parameter(INTERP_VAL *cmdParam)
|
||||
{
|
||||
SDWORD numCmdParams, numCommands;
|
||||
|
||||
|
@ -175,7 +175,7 @@ static void yyerror(const char* msg);
|
|||
%name-prefix="chat_"
|
||||
|
||||
%union {
|
||||
BOOL bval;
|
||||
bool bval;
|
||||
SDWORD ival;
|
||||
}
|
||||
|
||||
|
@ -720,7 +720,7 @@ R_WAIT_FOR_ME: _T_WAIT R_EOD /* wait */
|
|||
%%
|
||||
|
||||
/* Initialize Bison and start chat processing */
|
||||
BOOL chatLoad(char *pData, UDWORD size)
|
||||
bool chatLoad(char *pData, UDWORD size)
|
||||
{
|
||||
SDWORD cmdIndex,parseResult;
|
||||
|
||||
|
|
|
@ -41,25 +41,25 @@
|
|||
|
||||
/* Holds information for each recognized
|
||||
* command in a chat message */
|
||||
typedef struct _chat_command_data
|
||||
struct CHAT_CMD_DATA
|
||||
{
|
||||
const char *pCmdDescription; /* String representing a certain command */
|
||||
BOOL bPlayerAddressed[MAX_PLAYERS]; /* Flag to indicate whether a command was addressed to a certain player */
|
||||
bool bPlayerAddressed[MAX_PLAYERS]; /* Flag to indicate whether a command was addressed to a certain player */
|
||||
SDWORD numCmdParams; /* Number of extracted parameters associated with each command */
|
||||
INTERP_VAL parameter[MAX_CHAT_CMD_PARAMS]; /* Parameters extracted from text - to be used with scripts */
|
||||
}CHAT_CMD_DATA;
|
||||
};
|
||||
|
||||
typedef struct _chat_command
|
||||
struct CHAT_MSG
|
||||
{
|
||||
char lastMessage[MAXSTRLEN]; /* Parse the same mesage only once - in case more than one player is trying to parse */
|
||||
SDWORD numCommands; /* Total number of commands in chat message */
|
||||
CHAT_CMD_DATA cmdData[MAX_CHAT_COMMANDS]; /* Holds information for each recognized command */
|
||||
}CHAT_MSG;
|
||||
};
|
||||
|
||||
extern CHAT_MSG chat_msg;
|
||||
|
||||
/* Store parameter extracted from the message - for scripts */
|
||||
//extern BOOL chat_store_parameter(INTERP_VAL *parameter);
|
||||
//extern bool chat_store_parameter(INTERP_VAL *parameter);
|
||||
|
||||
extern void chatGetErrorData(int *pLine, char **ppText);
|
||||
|
||||
|
@ -67,6 +67,6 @@ extern void chatGetErrorData(int *pLine, char **ppText);
|
|||
extern void chatSetInputBuffer(char *pBuffer, UDWORD size);
|
||||
|
||||
// Load message
|
||||
extern BOOL chatLoad(char *pData, UDWORD size);
|
||||
extern bool chatLoad(char *pData, UDWORD size);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -155,7 +155,7 @@ void cpPrintProgram(SCRIPT_CODE *psProg)
|
|||
OPCODE opcode;
|
||||
UDWORD data, i, dim;
|
||||
SCRIPT_DEBUG *psCurrDebug=NULL;
|
||||
BOOL debugInfo, triggerCode;
|
||||
bool debugInfo, triggerCode;
|
||||
UDWORD jumpOffset;
|
||||
VAR_DEBUG *psCurrVar;
|
||||
ARRAY_DATA *psCurrArray;
|
||||
|
|
|
@ -88,7 +88,7 @@ static void eventPrintTriggerInfo(ACTIVE_TRIGGER *psTrigger)
|
|||
#endif
|
||||
|
||||
// Initialise a trigger
|
||||
static BOOL eventInitTrigger(ACTIVE_TRIGGER **ppsTrigger, SCRIPT_CONTEXT *psContext,
|
||||
static bool eventInitTrigger(ACTIVE_TRIGGER **ppsTrigger, SCRIPT_CONTEXT *psContext,
|
||||
UDWORD event, SDWORD trigger, UDWORD currTime);
|
||||
|
||||
// Add a trigger to the list in order
|
||||
|
@ -113,7 +113,7 @@ void eventTimeReset(UDWORD initTime)
|
|||
}
|
||||
|
||||
/* Initialise the event system */
|
||||
BOOL eventInitialise()
|
||||
bool eventInitialise()
|
||||
{
|
||||
psTrigList = NULL;
|
||||
psCallbackList = NULL;
|
||||
|
@ -293,7 +293,7 @@ const char *eventGetEventID(SCRIPT_CODE *psCode, SDWORD event)
|
|||
}
|
||||
|
||||
// Initialise the create/release function array - specify the maximum value type
|
||||
BOOL eventInitValueFuncs(SDWORD maxType)
|
||||
bool eventInitValueFuncs(SDWORD maxType)
|
||||
{
|
||||
ASSERT(asReleaseFuncs == NULL, "eventInitValueFuncs: array already initialised");
|
||||
|
||||
|
@ -316,7 +316,7 @@ BOOL eventInitValueFuncs(SDWORD maxType)
|
|||
}
|
||||
|
||||
// Add a new value create function
|
||||
BOOL eventAddValueCreate(INTERP_TYPE type, VAL_CREATE_FUNC create)
|
||||
bool eventAddValueCreate(INTERP_TYPE type, VAL_CREATE_FUNC create)
|
||||
{
|
||||
if (type >= numFuncs)
|
||||
{
|
||||
|
@ -330,7 +330,7 @@ BOOL eventAddValueCreate(INTERP_TYPE type, VAL_CREATE_FUNC create)
|
|||
}
|
||||
|
||||
// Add a new value release function
|
||||
BOOL eventAddValueRelease(INTERP_TYPE type, VAL_RELEASE_FUNC release)
|
||||
bool eventAddValueRelease(INTERP_TYPE type, VAL_RELEASE_FUNC release)
|
||||
{
|
||||
if (type >= numFuncs)
|
||||
{
|
||||
|
@ -344,7 +344,7 @@ BOOL eventAddValueRelease(INTERP_TYPE type, VAL_RELEASE_FUNC release)
|
|||
}
|
||||
|
||||
// Create a new context for a script
|
||||
BOOL eventNewContext(SCRIPT_CODE *psCode, CONTEXT_RELEASE release,
|
||||
bool eventNewContext(SCRIPT_CODE *psCode, CONTEXT_RELEASE release,
|
||||
SCRIPT_CONTEXT **ppsContext)
|
||||
{
|
||||
SCRIPT_CONTEXT *psContext;
|
||||
|
@ -519,7 +519,7 @@ BOOL eventNewContext(SCRIPT_CODE *psCode, CONTEXT_RELEASE release,
|
|||
|
||||
|
||||
// Copy a context, including variable values
|
||||
BOOL eventCopyContext(SCRIPT_CONTEXT *psContext, SCRIPT_CONTEXT **ppsNew)
|
||||
bool eventCopyContext(SCRIPT_CONTEXT *psContext, SCRIPT_CONTEXT **ppsNew)
|
||||
{
|
||||
SCRIPT_CONTEXT *psNew;
|
||||
SDWORD val;
|
||||
|
@ -555,7 +555,7 @@ BOOL eventCopyContext(SCRIPT_CONTEXT *psContext, SCRIPT_CONTEXT **ppsNew)
|
|||
|
||||
// Add a new object to the trigger system
|
||||
// Time is the application time at which all the triggers are to be started
|
||||
BOOL eventRunContext(SCRIPT_CONTEXT *psContext, UDWORD time)
|
||||
bool eventRunContext(SCRIPT_CONTEXT *psContext, UDWORD time)
|
||||
{
|
||||
SDWORD event;
|
||||
ACTIVE_TRIGGER *psTrigger;
|
||||
|
@ -724,7 +724,7 @@ void eventRemoveContext(SCRIPT_CONTEXT *psContext)
|
|||
}
|
||||
|
||||
// Get the value pointer for a variable index
|
||||
BOOL eventGetContextVal(SCRIPT_CONTEXT *psContext, UDWORD index, INTERP_VAL **ppsVal)
|
||||
bool eventGetContextVal(SCRIPT_CONTEXT *psContext, UDWORD index, INTERP_VAL **ppsVal)
|
||||
{
|
||||
VAL_CHUNK *psChunk;
|
||||
|
||||
|
@ -747,7 +747,7 @@ BOOL eventGetContextVal(SCRIPT_CONTEXT *psContext, UDWORD index, INTERP_VAL **pp
|
|||
}
|
||||
|
||||
// Set a global variable value for a context
|
||||
BOOL eventSetContextVar(SCRIPT_CONTEXT *psContext, UDWORD index, INTERP_VAL *data)
|
||||
bool eventSetContextVar(SCRIPT_CONTEXT *psContext, UDWORD index, INTERP_VAL *data)
|
||||
{
|
||||
INTERP_VAL *psVal;
|
||||
|
||||
|
@ -836,7 +836,7 @@ static void eventAddTrigger(ACTIVE_TRIGGER *psTrigger)
|
|||
|
||||
|
||||
// Initialise a trigger
|
||||
static BOOL eventInitTrigger(ACTIVE_TRIGGER **ppsTrigger, SCRIPT_CONTEXT *psContext,
|
||||
static bool eventInitTrigger(ACTIVE_TRIGGER **ppsTrigger, SCRIPT_CONTEXT *psContext,
|
||||
UDWORD event, SDWORD trigger, UDWORD currTime)
|
||||
{
|
||||
ACTIVE_TRIGGER *psNewTrig;
|
||||
|
@ -876,7 +876,7 @@ static BOOL eventInitTrigger(ACTIVE_TRIGGER **ppsTrigger, SCRIPT_CONTEXT *psCont
|
|||
}
|
||||
|
||||
// Load a trigger into the system from a save game
|
||||
BOOL eventLoadTrigger(UDWORD time, SCRIPT_CONTEXT *psContext,
|
||||
bool eventLoadTrigger(UDWORD time, SCRIPT_CONTEXT *psContext,
|
||||
SDWORD type, SDWORD trigger, UDWORD event, UDWORD offset)
|
||||
{
|
||||
ACTIVE_TRIGGER *psNewTrig;
|
||||
|
@ -911,7 +911,7 @@ BOOL eventLoadTrigger(UDWORD time, SCRIPT_CONTEXT *psContext,
|
|||
}
|
||||
|
||||
// add a TR_PAUSE trigger to the event system.
|
||||
BOOL eventAddPauseTrigger(SCRIPT_CONTEXT *psContext, UDWORD event, UDWORD offset,
|
||||
bool eventAddPauseTrigger(SCRIPT_CONTEXT *psContext, UDWORD event, UDWORD offset,
|
||||
UDWORD time)
|
||||
{
|
||||
ACTIVE_TRIGGER *psNewTrig;
|
||||
|
@ -984,7 +984,7 @@ void eventFireCallbackTrigger(TRIGGER_TYPE callback)
|
|||
{
|
||||
ACTIVE_TRIGGER *psPrev = NULL, *psCurr, *psNext;
|
||||
TRIGGER_DATA *psTrigDat;
|
||||
BOOL fired;
|
||||
bool fired;
|
||||
|
||||
if (interpProcessorActive())
|
||||
{
|
||||
|
@ -1093,9 +1093,9 @@ void eventFireCallbackTrigger(TRIGGER_TYPE callback)
|
|||
|
||||
|
||||
// Run a trigger
|
||||
static BOOL eventFireTrigger(ACTIVE_TRIGGER *psTrigger)
|
||||
static bool eventFireTrigger(ACTIVE_TRIGGER *psTrigger)
|
||||
{
|
||||
BOOL fired;
|
||||
bool fired;
|
||||
INTERP_VAL sResult;
|
||||
|
||||
fired = false;
|
||||
|
@ -1267,7 +1267,7 @@ static void eventMarkTriggerInList(ACTIVE_TRIGGER **ppsList,
|
|||
|
||||
|
||||
// Change the trigger assigned to an event - to be called from script functions
|
||||
BOOL eventSetTrigger(void)
|
||||
bool eventSetTrigger(void)
|
||||
{
|
||||
ACTIVE_TRIGGER *psTrigger;
|
||||
UDWORD event;
|
||||
|
@ -1316,7 +1316,7 @@ BOOL eventSetTrigger(void)
|
|||
|
||||
|
||||
// set the event tracing level - to be called from script functions
|
||||
BOOL eventSetTraceLevel(void)
|
||||
bool eventSetTraceLevel(void)
|
||||
{
|
||||
SDWORD level;
|
||||
|
||||
|
|
|
@ -32,34 +32,34 @@
|
|||
#define CONTEXT_VALS 20
|
||||
|
||||
/* One chunk of variables for a script context */
|
||||
typedef struct _val_chunk
|
||||
struct VAL_CHUNK
|
||||
{
|
||||
INTERP_VAL asVals[CONTEXT_VALS];
|
||||
|
||||
struct _val_chunk *psNext;
|
||||
} VAL_CHUNK;
|
||||
VAL_CHUNK * psNext;
|
||||
};
|
||||
|
||||
|
||||
/* The number of links in a context event link chunk */
|
||||
#define CONTEXT_LINKS 10
|
||||
/* One chunk of event links for a script context */
|
||||
typedef struct _link_chunk
|
||||
struct LINK_CHUNK
|
||||
{
|
||||
SWORD aLinks[CONTEXT_LINKS];
|
||||
|
||||
struct _link_chunk *psNext;
|
||||
} LINK_CHUNK;
|
||||
LINK_CHUNK * psNext;
|
||||
};
|
||||
|
||||
// Whether a context is released when there are no active triggers for it
|
||||
typedef enum _context_release
|
||||
enum CONTEXT_RELEASE
|
||||
{
|
||||
CR_RELEASE, // release the context
|
||||
CR_NORELEASE, // do not release the context
|
||||
} CONTEXT_RELEASE;
|
||||
};
|
||||
|
||||
|
||||
/* The data needed within an object to run a script */
|
||||
typedef struct _script_context
|
||||
struct SCRIPT_CONTEXT
|
||||
{
|
||||
SCRIPT_CODE *psCode; // The actual script to run
|
||||
VAL_CHUNK *psGlobals; // The objects copy of the global variables
|
||||
|
@ -67,15 +67,15 @@ typedef struct _script_context
|
|||
CONTEXT_RELEASE release; // Whether to release the context when there are no triggers
|
||||
SWORD id;
|
||||
|
||||
struct _script_context *psNext;
|
||||
} SCRIPT_CONTEXT;
|
||||
SCRIPT_CONTEXT * psNext;
|
||||
};
|
||||
|
||||
/*
|
||||
* A currently active trigger.
|
||||
* If the type of the triggger == TR_PAUSE, the trigger number stored is the
|
||||
* index of the trigger to replace this one when the event restarts
|
||||
*/
|
||||
typedef struct _active_trigger
|
||||
struct ACTIVE_TRIGGER
|
||||
{
|
||||
UDWORD testTime;
|
||||
SCRIPT_CONTEXT *psContext;
|
||||
|
@ -83,12 +83,12 @@ typedef struct _active_trigger
|
|||
SWORD trigger;
|
||||
UWORD event;
|
||||
UWORD offset;
|
||||
BOOL deactivated; // Whether the trigger is marked for deletion
|
||||
struct _active_trigger *psNext;
|
||||
} ACTIVE_TRIGGER;
|
||||
bool deactivated; // Whether the trigger is marked for deletion
|
||||
ACTIVE_TRIGGER * psNext;
|
||||
};
|
||||
|
||||
// ID numbers for each user type
|
||||
typedef enum _scr_user_types
|
||||
enum SCR_USER_TYPES
|
||||
{
|
||||
ST_INTMESSAGE = VAL_USERTYPESTART, // Intelligence message ?? (6) - (pointer)
|
||||
ST_BASEOBJECT, // Base object (pointer)
|
||||
|
@ -124,7 +124,7 @@ typedef enum _scr_user_types
|
|||
ST_POINTER_STRUCTSTAT, //for NULLSTRUCTURESTAT
|
||||
|
||||
ST_MAXTYPE, // maximum possible type - should always be last
|
||||
} SCR_USER_TYPES;
|
||||
};
|
||||
|
||||
|
||||
// The list of currently active triggers
|
||||
|
@ -138,17 +138,17 @@ extern SCRIPT_CONTEXT *psContList;
|
|||
|
||||
|
||||
/* Initialise the event system */
|
||||
extern BOOL eventInitialise(void);
|
||||
extern bool eventInitialise(void);
|
||||
|
||||
// Shutdown the event system
|
||||
extern void eventShutDown(void);
|
||||
|
||||
// add a TR_PAUSE trigger to the event system.
|
||||
extern BOOL eventAddPauseTrigger(SCRIPT_CONTEXT *psContext, UDWORD event, UDWORD offset,
|
||||
extern bool eventAddPauseTrigger(SCRIPT_CONTEXT *psContext, UDWORD event, UDWORD offset,
|
||||
UDWORD time);
|
||||
|
||||
// Load a trigger into the system from a save game
|
||||
extern BOOL eventLoadTrigger(UDWORD time, SCRIPT_CONTEXT *psContext,
|
||||
extern bool eventLoadTrigger(UDWORD time, SCRIPT_CONTEXT *psContext,
|
||||
SDWORD type, SDWORD trigger, UDWORD event, UDWORD offset);
|
||||
|
||||
//resets the event timer - updateTime
|
||||
|
|
|
@ -34,15 +34,15 @@
|
|||
|
||||
|
||||
// the event save file header
|
||||
typedef struct _event_save_header
|
||||
struct EVENT_SAVE_HDR // : public GAME_SAVEHEADER
|
||||
{
|
||||
char aFileType[4];
|
||||
UDWORD version;
|
||||
} EVENT_SAVE_HDR;
|
||||
};
|
||||
|
||||
|
||||
// save the context information for the script system
|
||||
static BOOL eventSaveContext(char *pBuffer, UDWORD *pSize)
|
||||
static bool eventSaveContext(char *pBuffer, UDWORD *pSize)
|
||||
{
|
||||
UDWORD size, valSize;
|
||||
SDWORD numVars, i, numContext;
|
||||
|
@ -213,7 +213,7 @@ static BOOL eventSaveContext(char *pBuffer, UDWORD *pSize)
|
|||
}
|
||||
|
||||
// load the context information for the script system
|
||||
static BOOL eventLoadContext(const SDWORD version, char *pBuffer, UDWORD *pSize)
|
||||
static bool eventLoadContext(const SDWORD version, char *pBuffer, UDWORD *pSize)
|
||||
{
|
||||
UDWORD size, valSize,stringLen;
|
||||
SDWORD numVars, i, numContext, context;
|
||||
|
@ -287,9 +287,9 @@ static BOOL eventLoadContext(const SDWORD version, char *pBuffer, UDWORD *pSize)
|
|||
|
||||
switch (type) {
|
||||
case VAL_BOOL:
|
||||
data.v.bval = *((BOOL*)pPos);
|
||||
pPos += sizeof(BOOL);
|
||||
size += sizeof(BOOL);
|
||||
data.v.bval = *((bool*)pPos);
|
||||
pPos += sizeof(bool);
|
||||
size += sizeof(bool);
|
||||
break;
|
||||
case VAL_FLOAT:
|
||||
data.v.fval = *((float*)pPos);
|
||||
|
@ -389,7 +389,7 @@ static BOOL eventLoadContext(const SDWORD version, char *pBuffer, UDWORD *pSize)
|
|||
}
|
||||
|
||||
// return the index of a context
|
||||
static BOOL eventGetContextIndex(SCRIPT_CONTEXT *psContext, SDWORD *pIndex)
|
||||
static bool eventGetContextIndex(SCRIPT_CONTEXT *psContext, SDWORD *pIndex)
|
||||
{
|
||||
SCRIPT_CONTEXT *psCurr;
|
||||
SDWORD index;
|
||||
|
@ -409,7 +409,7 @@ static BOOL eventGetContextIndex(SCRIPT_CONTEXT *psContext, SDWORD *pIndex)
|
|||
}
|
||||
|
||||
// find a context from it's id number
|
||||
static BOOL eventFindContext(SDWORD id, SCRIPT_CONTEXT **ppsContext)
|
||||
static bool eventFindContext(SDWORD id, SCRIPT_CONTEXT **ppsContext)
|
||||
{
|
||||
SCRIPT_CONTEXT *psCurr;
|
||||
|
||||
|
@ -426,7 +426,7 @@ static BOOL eventFindContext(SDWORD id, SCRIPT_CONTEXT **ppsContext)
|
|||
}
|
||||
|
||||
// save a list of triggers
|
||||
static BOOL eventSaveTriggerList(ACTIVE_TRIGGER *psList, char *pBuffer, UDWORD *pSize)
|
||||
static bool eventSaveTriggerList(ACTIVE_TRIGGER *psList, char *pBuffer, UDWORD *pSize)
|
||||
{
|
||||
ACTIVE_TRIGGER *psCurr;
|
||||
UDWORD size;
|
||||
|
@ -491,7 +491,7 @@ static BOOL eventSaveTriggerList(ACTIVE_TRIGGER *psList, char *pBuffer, UDWORD *
|
|||
|
||||
|
||||
// load a list of triggers
|
||||
static BOOL eventLoadTriggerList(WZ_DECL_UNUSED const SDWORD version, char *pBuffer, UDWORD *pSize)
|
||||
static bool eventLoadTriggerList(WZ_DECL_UNUSED const SDWORD version, char *pBuffer, UDWORD *pSize)
|
||||
{
|
||||
UDWORD size, event, offset, time;
|
||||
char *pPos;
|
||||
|
@ -554,7 +554,7 @@ static BOOL eventLoadTriggerList(WZ_DECL_UNUSED const SDWORD version, char *pBuf
|
|||
|
||||
|
||||
// Save the state of the event system
|
||||
BOOL eventSaveState(SDWORD version, char **ppBuffer, UDWORD *pFileSize)
|
||||
bool eventSaveState(SDWORD version, char **ppBuffer, UDWORD *pFileSize)
|
||||
{
|
||||
UDWORD size, totalSize;
|
||||
char *pBuffer, *pPos;
|
||||
|
@ -633,7 +633,7 @@ BOOL eventSaveState(SDWORD version, char **ppBuffer, UDWORD *pFileSize)
|
|||
|
||||
|
||||
// Load the state of the event system
|
||||
BOOL eventLoadState(char *pBuffer, UDWORD fileSize)
|
||||
bool eventLoadState(char *pBuffer, UDWORD fileSize)
|
||||
{
|
||||
UDWORD size, totalSize, version;
|
||||
char *pPos;
|
||||
|
|
|
@ -28,9 +28,9 @@
|
|||
#define _evntsave_h
|
||||
|
||||
// Save the state of the event system
|
||||
extern BOOL eventSaveState(SDWORD version, char **ppBuffer, UDWORD *pFileSize);
|
||||
extern bool eventSaveState(SDWORD version, char **ppBuffer, UDWORD *pFileSize);
|
||||
|
||||
// Load the state of the event system
|
||||
extern BOOL eventLoadState(char *pBuffer, UDWORD fileSize);
|
||||
extern bool eventLoadState(char *pBuffer, UDWORD fileSize);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -40,11 +40,11 @@
|
|||
|
||||
static INTERP_VAL *varEnvironment[MAX_FUNC_CALLS]; //environments for local variables of events/functions
|
||||
|
||||
typedef struct
|
||||
struct ReturnAddressStack_t
|
||||
{
|
||||
UDWORD CallerIndex;
|
||||
INTERP_VAL *ReturnAddress;
|
||||
} ReturnAddressStack_t;
|
||||
};
|
||||
|
||||
/**
|
||||
* Reset the return address stack
|
||||
|
@ -56,14 +56,14 @@ static inline void retStackReset(void);
|
|||
*
|
||||
* \return True when empty, false otherwise
|
||||
*/
|
||||
static inline BOOL retStackIsEmpty(void);
|
||||
static inline bool retStackIsEmpty(void);
|
||||
|
||||
/**
|
||||
* Check whether the return address stack is full
|
||||
*
|
||||
* \return True when full, false otherwise
|
||||
*/
|
||||
static inline BOOL retStackIsFull(void);
|
||||
static inline bool retStackIsFull(void);
|
||||
|
||||
/**
|
||||
* Push a new address/event pair on the return address stack
|
||||
|
@ -72,7 +72,7 @@ static inline BOOL retStackIsFull(void);
|
|||
* \param ReturnAddress Address to return to
|
||||
* \return False on failure (stack full)
|
||||
*/
|
||||
static BOOL retStackPush(UDWORD CallerIndex, INTERP_VAL *ReturnAddress);
|
||||
static bool retStackPush(UDWORD CallerIndex, INTERP_VAL *ReturnAddress);
|
||||
|
||||
/**
|
||||
* Pop an address/event pair from the return address stack
|
||||
|
@ -81,7 +81,7 @@ static BOOL retStackPush(UDWORD CallerIndex, INTERP_VAL *ReturnAddress);
|
|||
* \param ReturnAddress Address to return to
|
||||
* \return False on failure (stack empty)
|
||||
*/
|
||||
static BOOL retStackPop(UDWORD *CallerIndex, INTERP_VAL **ReturnAddress);
|
||||
static bool retStackPop(UDWORD *CallerIndex, INTERP_VAL **ReturnAddress);
|
||||
|
||||
/* Creates a new local var environment for a new function call */
|
||||
static inline void createVarEnvironment(SCRIPT_CONTEXT *psContext, UDWORD eventIndex);
|
||||
|
@ -151,13 +151,13 @@ SDWORD aOpSize[] =
|
|||
static TYPE_EQUIV *asInterpTypeEquiv = NULL;
|
||||
|
||||
// whether the interpreter is running
|
||||
static BOOL bInterpRunning = false;
|
||||
static bool bInterpRunning = false;
|
||||
|
||||
/* Whether to output trace information */
|
||||
static BOOL interpTrace = false;
|
||||
static bool interpTrace = false;
|
||||
|
||||
static SCRIPT_CODE *psCurProg = NULL;
|
||||
static BOOL bCurCallerIsEvent = false;
|
||||
static bool bCurCallerIsEvent = false;
|
||||
|
||||
/* Print out trace info if tracing is turned on */
|
||||
#define TRCPRINTF(...) do { if (interpTrace) { fprintf( stderr, __VA_ARGS__ ); } } while (false)
|
||||
|
@ -184,7 +184,7 @@ static BOOL bCurCallerIsEvent = false;
|
|||
|
||||
|
||||
// true if the interpreter is currently running
|
||||
BOOL interpProcessorActive(void)
|
||||
bool interpProcessorActive(void)
|
||||
{
|
||||
return bInterpRunning;
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ static inline INTERP_VAL *interpGetVarData(VAL_CHUNK *psGlobals, UDWORD index)
|
|||
}
|
||||
|
||||
// get the array data for an array operation
|
||||
static BOOL interpGetArrayVarData(INTERP_VAL **pip, VAL_CHUNK *psGlobals, SCRIPT_CODE *psProg, INTERP_VAL **ppsVal)
|
||||
static bool interpGetArrayVarData(INTERP_VAL **pip, VAL_CHUNK *psGlobals, SCRIPT_CODE *psProg, INTERP_VAL **ppsVal)
|
||||
{
|
||||
SDWORD i, dimensions, vals[VAR_MAX_DIMENSIONS];
|
||||
UBYTE *elements;
|
||||
|
@ -271,7 +271,7 @@ static BOOL interpGetArrayVarData(INTERP_VAL **pip, VAL_CHUNK *psGlobals, SCRIPT
|
|||
|
||||
|
||||
// Initialise the interpreter
|
||||
BOOL interpInitialise(void)
|
||||
bool interpInitialise(void)
|
||||
{
|
||||
asInterpTypeEquiv = NULL;
|
||||
|
||||
|
@ -279,7 +279,7 @@ BOOL interpInitialise(void)
|
|||
}
|
||||
|
||||
/* Run a compiled script */
|
||||
BOOL interpRunScript(SCRIPT_CONTEXT *psContext, INTERP_RUNTYPE runType, UDWORD index, UDWORD offset)
|
||||
bool interpRunScript(SCRIPT_CONTEXT *psContext, INTERP_RUNTYPE runType, UDWORD index, UDWORD offset)
|
||||
{
|
||||
UDWORD data;
|
||||
OPCODE opcode;
|
||||
|
@ -293,9 +293,9 @@ BOOL interpRunScript(SCRIPT_CONTEXT *psContext, INTERP_RUNTYPE runType, UDWORD i
|
|||
SDWORD instructionCount = 0;
|
||||
|
||||
UDWORD CurEvent = 0;
|
||||
BOOL bStop = false, bEvent = false;
|
||||
bool bStop = false, bEvent = false;
|
||||
UDWORD callDepth = 0;
|
||||
BOOL bTraceOn=false; //enable to debug function/event calls
|
||||
bool bTraceOn=false; //enable to debug function/event calls
|
||||
|
||||
ASSERT( psContext != NULL,
|
||||
"interpRunScript: invalid context pointer" );
|
||||
|
@ -955,9 +955,9 @@ void scriptSetTypeEquiv(TYPE_EQUIV *psTypeTab)
|
|||
* Means: Their data can be copied without conversion.
|
||||
* I.e. strings are NOT equivalent to anything but strings, even though they can be converted
|
||||
*/
|
||||
BOOL interpCheckEquiv(INTERP_TYPE to, INTERP_TYPE from)
|
||||
bool interpCheckEquiv(INTERP_TYPE to, INTERP_TYPE from)
|
||||
{
|
||||
BOOL toRef = false, fromRef = false;
|
||||
bool toRef = false, fromRef = false;
|
||||
|
||||
// check for the VAL_REF flag
|
||||
if (to & VAL_REF)
|
||||
|
@ -1010,7 +1010,7 @@ BOOL interpCheckEquiv(INTERP_TYPE to, INTERP_TYPE from)
|
|||
|
||||
|
||||
/* Instinct function to turn on tracing */
|
||||
BOOL interpTraceOn(void)
|
||||
bool interpTraceOn(void)
|
||||
{
|
||||
interpTrace = true;
|
||||
|
||||
|
@ -1018,7 +1018,7 @@ BOOL interpTraceOn(void)
|
|||
}
|
||||
|
||||
/* Instinct function to turn off tracing */
|
||||
BOOL interpTraceOff(void)
|
||||
bool interpTraceOff(void)
|
||||
{
|
||||
interpTrace = false;
|
||||
|
||||
|
@ -1046,21 +1046,21 @@ static inline void retStackReset(void)
|
|||
}
|
||||
|
||||
|
||||
static inline BOOL retStackIsEmpty(void)
|
||||
static inline bool retStackIsEmpty(void)
|
||||
{
|
||||
if(retStackPos < 0) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static inline BOOL retStackIsFull(void)
|
||||
static inline bool retStackIsFull(void)
|
||||
{
|
||||
if(retStackPos >= MAX_FUNC_CALLS) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static BOOL retStackPush(UDWORD CallerIndex, INTERP_VAL *ReturnAddress)
|
||||
static bool retStackPush(UDWORD CallerIndex, INTERP_VAL *ReturnAddress)
|
||||
{
|
||||
if (retStackIsFull())
|
||||
{
|
||||
|
@ -1078,7 +1078,7 @@ static BOOL retStackPush(UDWORD CallerIndex, INTERP_VAL *ReturnAddress)
|
|||
}
|
||||
|
||||
|
||||
static BOOL retStackPop(UDWORD *CallerIndex, INTERP_VAL **ReturnAddress)
|
||||
static bool retStackPop(UDWORD *CallerIndex, INTERP_VAL **ReturnAddress)
|
||||
{
|
||||
if (retStackIsEmpty())
|
||||
{
|
||||
|
|
|
@ -26,13 +26,13 @@
|
|||
#define _interp_h
|
||||
|
||||
/* The type of function called by an OP_CALL */
|
||||
typedef BOOL (*SCRIPT_FUNC)(void);
|
||||
typedef bool (*SCRIPT_FUNC)(void);
|
||||
|
||||
/* The type of function called to access an object or in-game variable */
|
||||
typedef BOOL (*SCRIPT_VARFUNC)(UDWORD index);
|
||||
typedef bool (*SCRIPT_VARFUNC)(UDWORD index);
|
||||
|
||||
/* The possible value types for scripts */
|
||||
typedef enum _interp_type
|
||||
enum INTERP_TYPE
|
||||
{
|
||||
// Basic types
|
||||
VAL_BOOL,
|
||||
|
@ -55,11 +55,11 @@ typedef enum _interp_type
|
|||
|
||||
VAL_USERTYPESTART, //!< user defined types should start with this id
|
||||
VAL_REF = 0x00100000 //!< flag to specify a variable reference rather than simple value
|
||||
} INTERP_TYPE;
|
||||
};
|
||||
|
||||
|
||||
/* A value consists of its type and value */
|
||||
typedef struct _interp_val
|
||||
struct INTERP_VAL
|
||||
{
|
||||
INTERP_TYPE type; //Value type for interpreter; opcode or value type for compiler
|
||||
union
|
||||
|
@ -70,24 +70,24 @@ typedef struct _interp_val
|
|||
void *oval; //Object value - any in-game object
|
||||
float fval; //Float value - VAL_FLOAT
|
||||
int ival; // Integer value - VAL_INT
|
||||
BOOL bval; //Boolean value - VAL_BOOL
|
||||
bool bval; //Boolean value - VAL_BOOL
|
||||
} v;
|
||||
} INTERP_VAL;
|
||||
};
|
||||
|
||||
|
||||
// maximum number of equivalent types for a type
|
||||
#define INTERP_MAXEQUIV 10
|
||||
|
||||
// type equivalences
|
||||
typedef struct _interp_typeequiv
|
||||
struct TYPE_EQUIV
|
||||
{
|
||||
INTERP_TYPE base; // the type that the others are equivalent to
|
||||
unsigned int numEquiv; // number of equivalent types
|
||||
INTERP_TYPE aEquivTypes[INTERP_MAXEQUIV]; // the equivalent types
|
||||
} TYPE_EQUIV;
|
||||
};
|
||||
|
||||
/* Opcodes for the script interpreter */
|
||||
typedef enum _op_code
|
||||
enum OPCODE
|
||||
{
|
||||
OP_PUSH, // Push value onto stack
|
||||
OP_PUSHREF, // Push a pointer to a variable onto the stack
|
||||
|
@ -146,7 +146,7 @@ typedef enum _op_code
|
|||
OP_PUSHLOCALREF, //variable of object type (pointer)
|
||||
OP_TO_FLOAT, //float cast
|
||||
OP_TO_INT, //int cast
|
||||
} OPCODE;
|
||||
};
|
||||
|
||||
/* How far the opcode is shifted up a UDWORD to allow other data to be
|
||||
* stored in the same UDWORD
|
||||
|
@ -164,50 +164,50 @@ typedef enum _op_code
|
|||
#define ARRAY_DIMENSION_MASK 0x00f00000
|
||||
|
||||
/* The possible storage types for a variable */
|
||||
typedef enum _storage_type
|
||||
enum enum_STORAGE_TYPE
|
||||
{
|
||||
ST_PUBLIC, // Public variable
|
||||
ST_PRIVATE, // Private variable
|
||||
ST_OBJECT, // A value stored in an objects data space.
|
||||
ST_EXTERN, // An external value accessed by function call
|
||||
ST_LOCAL, // A local variable
|
||||
} enum_STORAGE_TYPE;
|
||||
};
|
||||
|
||||
typedef UBYTE STORAGE_TYPE;
|
||||
|
||||
/* Variable debugging info for a script */
|
||||
typedef struct _var_debug
|
||||
struct VAR_DEBUG
|
||||
{
|
||||
char *pIdent;
|
||||
STORAGE_TYPE storage;
|
||||
} VAR_DEBUG;
|
||||
};
|
||||
|
||||
/* Array info for a script */
|
||||
typedef struct _array_data
|
||||
struct ARRAY_DATA
|
||||
{
|
||||
UDWORD base; // the base index of the array values
|
||||
INTERP_TYPE type; // the array data type
|
||||
UBYTE dimensions;
|
||||
UBYTE elements[VAR_MAX_DIMENSIONS];
|
||||
} ARRAY_DATA;
|
||||
};
|
||||
|
||||
/* Array debug info for a script */
|
||||
typedef struct _array_debug
|
||||
struct ARRAY_DEBUG
|
||||
{
|
||||
char *pIdent;
|
||||
UBYTE storage;
|
||||
} ARRAY_DEBUG;
|
||||
};
|
||||
|
||||
/* Line debugging information for a script */
|
||||
typedef struct _script_debug
|
||||
struct SCRIPT_DEBUG
|
||||
{
|
||||
UDWORD offset; // Offset in the compiled script that corresponds to
|
||||
UDWORD line; // this line in the original script.
|
||||
char *pLabel; // the trigger/event that starts at this line
|
||||
} SCRIPT_DEBUG;
|
||||
};
|
||||
|
||||
/* Different types of triggers */
|
||||
typedef enum _trigger_type
|
||||
enum TRIGGER_TYPE
|
||||
{
|
||||
TR_INIT, // Trigger fires when the script is first run
|
||||
TR_CODE, // Trigger uses script code
|
||||
|
@ -216,18 +216,18 @@ typedef enum _trigger_type
|
|||
TR_PAUSE, // Event has paused for an interval and will restart in the middle of it's code
|
||||
|
||||
TR_CALLBACKSTART, // The user defined callback triggers should start with this id
|
||||
} TRIGGER_TYPE;
|
||||
};
|
||||
|
||||
/* Description of a trigger for the SCRIPT_CODE */
|
||||
typedef struct _trigger_data
|
||||
struct TRIGGER_DATA
|
||||
{
|
||||
TRIGGER_TYPE type; // Type of trigger
|
||||
UWORD code; // BOOL - is there code with this trigger
|
||||
UWORD code; // bool - is there code with this trigger
|
||||
UDWORD time; // How often to check the trigger
|
||||
} TRIGGER_DATA;
|
||||
};
|
||||
|
||||
/* A compiled script and its associated data */
|
||||
typedef struct _script_code
|
||||
struct SCRIPT_CODE
|
||||
{
|
||||
UDWORD size; // The size (in bytes) of the compiled code
|
||||
INTERP_VAL *pCode; // Pointer to the compiled code
|
||||
|
@ -258,28 +258,28 @@ typedef struct _script_code
|
|||
|
||||
UWORD debugEntries; // Number of entries in psDebug
|
||||
SCRIPT_DEBUG *psDebug; // Debugging info for the script
|
||||
} SCRIPT_CODE;
|
||||
};
|
||||
|
||||
|
||||
/* What type of code should be run by the interpreter */
|
||||
typedef enum _interp_runtype
|
||||
enum INTERP_RUNTYPE
|
||||
{
|
||||
IRT_TRIGGER, // Run trigger code
|
||||
IRT_EVENT, // Run event code
|
||||
} INTERP_RUNTYPE;
|
||||
};
|
||||
|
||||
|
||||
/* The size of each opcode */
|
||||
extern SDWORD aOpSize[];
|
||||
|
||||
/* Check if two types are equivalent */
|
||||
extern BOOL interpCheckEquiv(INTERP_TYPE to, INTERP_TYPE from) WZ_DECL_PURE;
|
||||
extern bool interpCheckEquiv(INTERP_TYPE to, INTERP_TYPE from) WZ_DECL_PURE;
|
||||
|
||||
// Initialise the interpreter
|
||||
extern BOOL interpInitialise(void);
|
||||
extern bool interpInitialise(void);
|
||||
|
||||
// true if the interpreter is currently running
|
||||
extern BOOL interpProcessorActive(void);
|
||||
extern bool interpProcessorActive(void);
|
||||
|
||||
/* Output script call stack trace */
|
||||
extern void scrOutputCallTrace(code_part part);
|
||||
|
|
|
@ -51,40 +51,40 @@
|
|||
#define MAX_SCR_MACRO_LEN 32
|
||||
|
||||
/* Structure to hold script define directive information */
|
||||
typedef struct _scr_define
|
||||
struct SCR_MACRO
|
||||
{
|
||||
char scr_define_macro[MAX_SCR_MACRO_LEN];
|
||||
char scr_define_body[MAXSTRLEN];
|
||||
}SCR_MACRO;
|
||||
};
|
||||
|
||||
/* Definition for the chunks of code that are used within the compiler */
|
||||
typedef struct _code_block
|
||||
struct CODE_BLOCK
|
||||
{
|
||||
UDWORD size; // size of the code block
|
||||
INTERP_VAL *pCode; // pointer to the code data
|
||||
UDWORD debugEntries;
|
||||
SCRIPT_DEBUG *psDebug; // Debugging info for the script.
|
||||
INTERP_TYPE type; // The type of the code block
|
||||
} CODE_BLOCK;
|
||||
};
|
||||
|
||||
/* The chunk of code returned from parsing a parameter list. */
|
||||
typedef struct _param_block
|
||||
struct PARAM_BLOCK
|
||||
{
|
||||
UDWORD numParams;
|
||||
INTERP_TYPE *aParams; // List of parameter types
|
||||
UDWORD size;
|
||||
INTERP_VAL *pCode; // The code that puts the parameters onto the stack
|
||||
}PARAM_BLOCK;
|
||||
};
|
||||
|
||||
/* The types of a functions parameters, returned from parsing a parameter declaration */
|
||||
typedef struct _param_decl
|
||||
struct PARAM_DECL
|
||||
{
|
||||
UDWORD numParams;
|
||||
INTERP_TYPE *aParams;
|
||||
} PARAM_DECL;
|
||||
};
|
||||
|
||||
/* The chunk of code used while parsing a conditional statement */
|
||||
typedef struct _cond_block
|
||||
struct COND_BLOCK
|
||||
{
|
||||
UDWORD numOffsets;
|
||||
UDWORD *aOffsets; // Positions in the code that have to be
|
||||
|
@ -94,43 +94,43 @@ typedef struct _cond_block
|
|||
INTERP_VAL *pCode;
|
||||
UDWORD debugEntries; // Number of debugging entries in psDebug.
|
||||
SCRIPT_DEBUG *psDebug; // Debugging info for the script.
|
||||
} COND_BLOCK;
|
||||
};
|
||||
|
||||
/* The possible access types for a type */
|
||||
typedef enum _access_type
|
||||
enum ACCESS_TYPE
|
||||
{
|
||||
AT_SIMPLE, // The type represents a simple data value
|
||||
AT_OBJECT, // The type represents an object
|
||||
} ACCESS_TYPE;
|
||||
};
|
||||
|
||||
|
||||
// function pointer for script variable saving
|
||||
// if pBuffer is NULL the script system is just asking how much space the saved variable will require
|
||||
// otherwise pBuffer points to an array to store the value in
|
||||
typedef BOOL (*SCR_VAL_SAVE)(INTERP_VAL *psVal, char *pBuffer, UDWORD *pSize);
|
||||
typedef bool (*SCR_VAL_SAVE)(INTERP_VAL *psVal, char *pBuffer, UDWORD *pSize);
|
||||
// function pointer for script variable loading
|
||||
typedef BOOL (*SCR_VAL_LOAD)(SDWORD version, INTERP_VAL *psVal, char *pBuffer, UDWORD size);
|
||||
typedef bool (*SCR_VAL_LOAD)(SDWORD version, INTERP_VAL *psVal, char *pBuffer, UDWORD size);
|
||||
|
||||
/* Type for a user type symbol */
|
||||
typedef struct _type_symbol
|
||||
struct TYPE_SYMBOL
|
||||
{
|
||||
const char *pIdent; // Type identifier
|
||||
INTERP_TYPE typeID; // The type id to use in the type field of values
|
||||
SWORD accessType; // Whether the type is an object or a simple value
|
||||
SCR_VAL_SAVE saveFunc; // load and save functions
|
||||
SCR_VAL_LOAD loadFunc; //
|
||||
} TYPE_SYMBOL;
|
||||
};
|
||||
|
||||
/* Type for a variable identifier declaration */
|
||||
typedef struct _var_ident_decl
|
||||
struct VAR_IDENT_DECL
|
||||
{
|
||||
char *pIdent; // variable identifier
|
||||
SDWORD dimensions; // number of dimensions of an array - 0 for normal var
|
||||
SDWORD elements[VAR_MAX_DIMENSIONS]; // number of elements in an array
|
||||
} VAR_IDENT_DECL;
|
||||
};
|
||||
|
||||
/* Type for a variable symbol */
|
||||
typedef struct _var_symbol
|
||||
struct VAR_SYMBOL
|
||||
{
|
||||
const char *pIdent; // variable's identifier
|
||||
INTERP_TYPE type; // variable type
|
||||
|
@ -141,12 +141,12 @@ typedef struct _var_symbol
|
|||
UDWORD dimensions; // number of dimensions of an array - 0 for normal var
|
||||
SDWORD elements[VAR_MAX_DIMENSIONS]; // number of elements in an array
|
||||
|
||||
struct _var_symbol *psNext;
|
||||
} VAR_SYMBOL;
|
||||
VAR_SYMBOL * psNext;
|
||||
};
|
||||
|
||||
|
||||
/* Type for an array access block */
|
||||
typedef struct _array_block
|
||||
struct ARRAY_BLOCK
|
||||
{
|
||||
VAR_SYMBOL *psArrayVar;
|
||||
UDWORD dimensions;
|
||||
|
@ -155,10 +155,10 @@ typedef struct _array_block
|
|||
INTERP_VAL *pCode;
|
||||
UDWORD debugEntries; // Number of debugging entries in psDebug.
|
||||
SCRIPT_DEBUG *psDebug; // Debugging info for the script.
|
||||
} ARRAY_BLOCK;
|
||||
};
|
||||
|
||||
/* Type for a constant symbol */
|
||||
typedef struct _const_symbol
|
||||
struct CONST_SYMBOL
|
||||
{
|
||||
const char *pIdent; // variable's identifier
|
||||
INTERP_TYPE type; // variable type
|
||||
|
@ -167,27 +167,27 @@ typedef struct _const_symbol
|
|||
* Only one of these will be valid depending on type.
|
||||
* A union is not used as a union cannot be statically initialised
|
||||
*/
|
||||
BOOL bval;
|
||||
bool bval;
|
||||
SDWORD ival;
|
||||
void *oval;
|
||||
char *sval; //String values
|
||||
float fval;
|
||||
} CONST_SYMBOL;
|
||||
};
|
||||
|
||||
/* The chunk of code used to reference an object variable */
|
||||
typedef struct _objvar_block
|
||||
struct OBJVAR_BLOCK
|
||||
{
|
||||
VAR_SYMBOL *psObjVar; // The object variables symbol
|
||||
|
||||
UDWORD size;
|
||||
INTERP_VAL *pCode; // The code to get the object value on the stack
|
||||
} OBJVAR_BLOCK;
|
||||
};
|
||||
|
||||
/* The maximum number of parameters for an instinct function */
|
||||
#define INST_MAXPARAMS 20
|
||||
|
||||
/* Type for a function symbol */
|
||||
typedef struct _func_symbol
|
||||
struct FUNC_SYMBOL
|
||||
{
|
||||
const char *pIdent; // function's identifier
|
||||
SCRIPT_FUNC pFunc; // Pointer to the instinct function
|
||||
|
@ -195,7 +195,7 @@ typedef struct _func_symbol
|
|||
UDWORD numParams; // Number of parameters to the function
|
||||
uint32_t/*INTERP_TYPE*/ aParams[INST_MAXPARAMS];
|
||||
// List of parameter types
|
||||
BOOL script; // Whether the function is defined in the script
|
||||
bool script; // Whether the function is defined in the script
|
||||
// or a C instinct function
|
||||
UDWORD size; // The size of script code
|
||||
INTERP_VAL *pCode; // The code for a function if it is defined in the script
|
||||
|
@ -203,27 +203,27 @@ typedef struct _func_symbol
|
|||
UDWORD debugEntries; // Number of debugging entries in psDebug.
|
||||
SCRIPT_DEBUG *psDebug; // Debugging info for the script.
|
||||
|
||||
struct _func_symbol *psNext;
|
||||
} FUNC_SYMBOL;
|
||||
FUNC_SYMBOL * psNext;
|
||||
};
|
||||
|
||||
/* The type for a variable declaration */
|
||||
typedef struct _var_decl
|
||||
struct VAR_DECL
|
||||
{
|
||||
INTERP_TYPE type;
|
||||
STORAGE_TYPE storage;
|
||||
} VAR_DECL;
|
||||
};
|
||||
|
||||
/* The type for a trigger sub declaration */
|
||||
typedef struct _trigger_decl
|
||||
struct TRIGGER_DECL
|
||||
{
|
||||
TRIGGER_TYPE type;
|
||||
UDWORD size;
|
||||
INTERP_VAL *pCode;
|
||||
UDWORD time;
|
||||
} TRIGGER_DECL;
|
||||
};
|
||||
|
||||
/* Type for a trigger symbol */
|
||||
typedef struct _trigger_symbol
|
||||
struct TRIGGER_SYMBOL
|
||||
{
|
||||
char *pIdent; // Trigger's identifier
|
||||
UDWORD index; // The triggers index number
|
||||
|
@ -235,11 +235,11 @@ typedef struct _trigger_symbol
|
|||
UDWORD debugEntries;
|
||||
SCRIPT_DEBUG *psDebug;
|
||||
|
||||
struct _trigger_symbol *psNext;
|
||||
} TRIGGER_SYMBOL;
|
||||
TRIGGER_SYMBOL *psNext;
|
||||
};
|
||||
|
||||
/* The type for a callback trigger symbol */
|
||||
typedef struct _callback_symbol
|
||||
struct CALLBACK_SYMBOL
|
||||
{
|
||||
const char *pIdent; // Callback identifier
|
||||
TRIGGER_TYPE type; // user defined callback id >= TR_CALLBACKSTART
|
||||
|
@ -247,11 +247,11 @@ typedef struct _callback_symbol
|
|||
UDWORD numParams; // Number of parameters to the function
|
||||
uint32_t/*INTERP_TYPE*/ aParams[INST_MAXPARAMS];
|
||||
// List of parameter types
|
||||
} CALLBACK_SYMBOL;
|
||||
};
|
||||
|
||||
|
||||
/* Type for an event symbol */
|
||||
typedef struct _event_symbol
|
||||
struct EVENT_SYMBOL
|
||||
{
|
||||
char *pIdent; // Event's identifier
|
||||
UDWORD index; // the events index number
|
||||
|
@ -265,14 +265,14 @@ typedef struct _event_symbol
|
|||
//functions stuff
|
||||
UDWORD numParams; //Number of parameters to the function
|
||||
UDWORD numLocalVars; //local variables
|
||||
BOOL bFunction; //if this event is defined as a function
|
||||
BOOL bDeclared; //if function was declared before
|
||||
bool bFunction; //if this event is defined as a function
|
||||
bool bDeclared; //if function was declared before
|
||||
INTERP_TYPE retType; //return type if a function
|
||||
|
||||
INTERP_TYPE aParams[INST_MAXPARAMS];
|
||||
|
||||
struct _event_symbol *psNext;
|
||||
} EVENT_SYMBOL;
|
||||
EVENT_SYMBOL * psNext;
|
||||
};
|
||||
|
||||
/* The table of user types */
|
||||
extern TYPE_SYMBOL *asScrTypeTab;
|
||||
|
@ -296,7 +296,7 @@ extern CALLBACK_SYMBOL *asScrCallbackTab;
|
|||
extern void scriptSetInputFile(PHYSFS_file* fileHandle);
|
||||
|
||||
/* Initialise the parser ready for a new script */
|
||||
extern BOOL scriptInitParser(void);
|
||||
extern bool scriptInitParser(void);
|
||||
|
||||
/* Set off the scenario file parser */
|
||||
extern int scr_parse(void);
|
||||
|
@ -307,55 +307,55 @@ void scr_error(const char *pMessage, ...) WZ_DECL_FORMAT(printf, 1, 2);
|
|||
extern void scriptGetErrorData(int *pLine, char **ppText);
|
||||
|
||||
/* Look up a type symbol */
|
||||
extern BOOL scriptLookUpType(const char *pIdent, INTERP_TYPE *pType);
|
||||
extern bool scriptLookUpType(const char *pIdent, INTERP_TYPE *pType);
|
||||
|
||||
/* Add a new variable symbol */
|
||||
extern BOOL scriptAddVariable(VAR_DECL *psStorage, VAR_IDENT_DECL *psVarIdent);
|
||||
extern bool scriptAddVariable(VAR_DECL *psStorage, VAR_IDENT_DECL *psVarIdent);
|
||||
|
||||
/* Add a new trigger symbol */
|
||||
extern BOOL scriptAddTrigger(const char *pIdent, TRIGGER_DECL *psDecl, UDWORD line);
|
||||
extern bool scriptAddTrigger(const char *pIdent, TRIGGER_DECL *psDecl, UDWORD line);
|
||||
|
||||
/* Add a new event symbol */
|
||||
extern BOOL scriptDeclareEvent(const char *pIdent, EVENT_SYMBOL **ppsEvent, SDWORD numArgs);
|
||||
extern bool scriptDeclareEvent(const char *pIdent, EVENT_SYMBOL **ppsEvent, SDWORD numArgs);
|
||||
|
||||
// Add the code to a defined event
|
||||
extern BOOL scriptDefineEvent(EVENT_SYMBOL *psEvent, CODE_BLOCK *psCode, SDWORD trigger);
|
||||
extern bool scriptDefineEvent(EVENT_SYMBOL *psEvent, CODE_BLOCK *psCode, SDWORD trigger);
|
||||
|
||||
/* Look up a variable symbol */
|
||||
extern BOOL scriptLookUpVariable(const char *pIdent, VAR_SYMBOL **ppsSym);
|
||||
extern bool scriptLookUpVariable(const char *pIdent, VAR_SYMBOL **ppsSym);
|
||||
|
||||
/* Look up a constant variable symbol */
|
||||
extern BOOL scriptLookUpConstant(const char *pIdent, CONST_SYMBOL **ppsSym);
|
||||
extern bool scriptLookUpConstant(const char *pIdent, CONST_SYMBOL **ppsSym);
|
||||
|
||||
/* Lookup a trigger symbol */
|
||||
extern BOOL scriptLookUpTrigger(const char *pIdent, TRIGGER_SYMBOL **ppsTrigger);
|
||||
extern bool scriptLookUpTrigger(const char *pIdent, TRIGGER_SYMBOL **ppsTrigger);
|
||||
|
||||
/* Lookup a callback trigger symbol */
|
||||
extern BOOL scriptLookUpCallback(const char *pIdent, CALLBACK_SYMBOL **ppsCallback);
|
||||
extern bool scriptLookUpCallback(const char *pIdent, CALLBACK_SYMBOL **ppsCallback);
|
||||
|
||||
/* Lookup an event symbol */
|
||||
extern BOOL scriptLookUpEvent(const char *pIdent, EVENT_SYMBOL **ppsEvent);
|
||||
extern bool scriptLookUpEvent(const char *pIdent, EVENT_SYMBOL **ppsEvent);
|
||||
|
||||
/* Add a new function symbol */
|
||||
extern BOOL scriptStartFunctionDef(const char *pIdent, // Functions name
|
||||
extern bool scriptStartFunctionDef(const char *pIdent, // Functions name
|
||||
INTERP_TYPE type); // return type
|
||||
|
||||
/* Store the parameter types for the current script function definition */
|
||||
extern BOOL scriptSetParameters(UDWORD numParams, // number of parameters
|
||||
extern bool scriptSetParameters(UDWORD numParams, // number of parameters
|
||||
INTERP_TYPE *pParams); // parameter types
|
||||
|
||||
/* Store the code for a script function definition.
|
||||
* Clean up the local variable list for this function definition.
|
||||
*/
|
||||
extern BOOL scriptSetCode(CODE_BLOCK *psBlock); // The code block
|
||||
extern bool scriptSetCode(CODE_BLOCK *psBlock); // The code block
|
||||
|
||||
/* Look up a function symbol */
|
||||
extern BOOL scriptLookUpFunction(const char *pIdent, FUNC_SYMBOL **ppsSym);
|
||||
extern bool scriptLookUpFunction(const char *pIdent, FUNC_SYMBOL **ppsSym);
|
||||
|
||||
/* Look up an in-script custom function symbol */
|
||||
extern BOOL scriptLookUpCustomFunction(const char *pIdent, EVENT_SYMBOL **ppsSym);
|
||||
extern bool scriptLookUpCustomFunction(const char *pIdent, EVENT_SYMBOL **ppsSym);
|
||||
|
||||
extern BOOL popArguments(INTERP_VAL **ip_temp, SDWORD numParams);
|
||||
extern bool popArguments(INTERP_VAL **ip_temp, SDWORD numParams);
|
||||
|
||||
extern void widgCopyString(char *pDest, const char *pSrc); // FIXME Duplicate declaration of internal widget function
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
|
||||
// Initialise the script library
|
||||
BOOL scriptInitialise()
|
||||
bool scriptInitialise()
|
||||
{
|
||||
if (!stackInitialise())
|
||||
{
|
||||
|
@ -148,7 +148,7 @@ void scriptFreeCode(SCRIPT_CODE *psCode)
|
|||
|
||||
|
||||
/* Lookup a script variable */
|
||||
BOOL scriptGetVarIndex(SCRIPT_CODE *psCode, char *pID, UDWORD *pIndex)
|
||||
bool scriptGetVarIndex(SCRIPT_CODE *psCode, char *pID, UDWORD *pIndex)
|
||||
{
|
||||
UDWORD index;
|
||||
|
||||
|
@ -173,9 +173,9 @@ BOOL scriptGetVarIndex(SCRIPT_CODE *psCode, char *pID, UDWORD *pIndex)
|
|||
all types are listed explicitly, with asserts/warnings for invalid/unrecognised types, as
|
||||
getting this wrong will cause segfaults if sizeof(void*) != sizeof(SDWORD) (eg. amd64). a lot of
|
||||
these aren't currently checked for, but it's a lot clearer what's going on if they're all here */
|
||||
BOOL scriptTypeIsPointer(INTERP_TYPE type)
|
||||
bool scriptTypeIsPointer(INTERP_TYPE type)
|
||||
{
|
||||
ASSERT((_scr_user_types)type < ST_MAXTYPE || type >= VAL_REF, "Invalid type: %d", type);
|
||||
ASSERT((SCR_USER_TYPES)type < ST_MAXTYPE || type >= VAL_REF, "Invalid type: %d", type);
|
||||
// any value or'ed with VAL_REF is a pointer
|
||||
if (type >= VAL_REF) return true;
|
||||
switch ((unsigned)type) // Unsigned cast to suppress compiler warnings due to enum abuse.
|
||||
|
|
|
@ -33,17 +33,17 @@
|
|||
#include "eventsave.h"
|
||||
|
||||
/* Whether to include debug info when compiling */
|
||||
typedef enum _scr_debugtype
|
||||
enum SCR_DEBUGTYPE
|
||||
{
|
||||
SCR_DEBUGINFO, // Generate debug info
|
||||
SCR_NODEBUG, // Do not generate debug info
|
||||
} SCR_DEBUGTYPE;
|
||||
};
|
||||
|
||||
// If this is defined we save out the compiled scripts
|
||||
#define SCRIPTTYPE SCR_DEBUGINFO
|
||||
|
||||
// Initialise the script library
|
||||
extern BOOL scriptInitialise(void);
|
||||
extern bool scriptInitialise(void);
|
||||
|
||||
// Shutdown the script library
|
||||
extern void scriptShutDown(void);
|
||||
|
@ -108,17 +108,17 @@ extern SCRIPT_CODE* scriptCompile(PHYSFS_file* fileHandle, SCR_DEBUGTYPE debugTy
|
|||
extern void scriptFreeCode(SCRIPT_CODE *psCode);
|
||||
|
||||
/* Lookup a script variable */
|
||||
extern BOOL scriptGetVarIndex(SCRIPT_CODE *psCode, char *pID, UDWORD *pIndex);
|
||||
extern bool scriptGetVarIndex(SCRIPT_CODE *psCode, char *pID, UDWORD *pIndex);
|
||||
|
||||
/* returns true if passed INTERP_TYPE is used as a pointer in INTERP_VAL, false otherwise */
|
||||
extern BOOL scriptTypeIsPointer(INTERP_TYPE type);
|
||||
extern bool scriptTypeIsPointer(INTERP_TYPE type);
|
||||
|
||||
extern const char *scriptTypeToString(INTERP_TYPE type) WZ_DECL_PURE;
|
||||
extern const char *scriptOpcodeToString(OPCODE opcode) WZ_DECL_PURE;
|
||||
extern const char *scriptFunctionToString(SCRIPT_FUNC function) WZ_DECL_PURE;
|
||||
|
||||
/* Run a compiled script */
|
||||
extern BOOL interpRunScript(SCRIPT_CONTEXT *psContext, INTERP_RUNTYPE runType,
|
||||
extern bool interpRunScript(SCRIPT_CONTEXT *psContext, INTERP_RUNTYPE runType,
|
||||
UDWORD index, UDWORD offset);
|
||||
|
||||
|
||||
|
@ -131,40 +131,40 @@ extern BOOL interpRunScript(SCRIPT_CONTEXT *psContext, INTERP_RUNTYPE runType,
|
|||
extern void eventReset(void);
|
||||
|
||||
// Initialise the create/release function array - specify the maximum value type
|
||||
extern BOOL eventInitValueFuncs(SDWORD maxType);
|
||||
extern bool eventInitValueFuncs(SDWORD maxType);
|
||||
|
||||
// a create function for data stored in an INTERP_VAL
|
||||
typedef BOOL (*VAL_CREATE_FUNC)(INTERP_VAL *psVal);
|
||||
typedef bool (*VAL_CREATE_FUNC)(INTERP_VAL *psVal);
|
||||
|
||||
// a release function for data stored in an INTERP_VAL
|
||||
typedef void (*VAL_RELEASE_FUNC)(INTERP_VAL *psVal);
|
||||
|
||||
// Add a new value create function
|
||||
extern BOOL eventAddValueCreate(INTERP_TYPE type, VAL_CREATE_FUNC create);
|
||||
extern bool eventAddValueCreate(INTERP_TYPE type, VAL_CREATE_FUNC create);
|
||||
|
||||
// Add a new value release function
|
||||
extern BOOL eventAddValueRelease(INTERP_TYPE type, VAL_RELEASE_FUNC release);
|
||||
extern bool eventAddValueRelease(INTERP_TYPE type, VAL_RELEASE_FUNC release);
|
||||
|
||||
// Create a new context for a script
|
||||
extern BOOL eventNewContext(SCRIPT_CODE *psCode,
|
||||
extern bool eventNewContext(SCRIPT_CODE *psCode,
|
||||
CONTEXT_RELEASE release, SCRIPT_CONTEXT **ppsContext);
|
||||
|
||||
// Copy a context, including variable values
|
||||
extern BOOL eventCopyContext(SCRIPT_CONTEXT *psContext, SCRIPT_CONTEXT **ppsNew);
|
||||
extern bool eventCopyContext(SCRIPT_CONTEXT *psContext, SCRIPT_CONTEXT **ppsNew);
|
||||
|
||||
// Add a new object to the trigger system
|
||||
// Time is the application time at which all the triggers are to be started
|
||||
extern BOOL eventRunContext(SCRIPT_CONTEXT *psContext, UDWORD time);
|
||||
extern bool eventRunContext(SCRIPT_CONTEXT *psContext, UDWORD time);
|
||||
|
||||
// Remove a context from the event system
|
||||
extern void eventRemoveContext(SCRIPT_CONTEXT *psContext);
|
||||
|
||||
// Set a global variable value for a context
|
||||
extern BOOL eventSetContextVar(SCRIPT_CONTEXT *psContext, UDWORD index,
|
||||
extern bool eventSetContextVar(SCRIPT_CONTEXT *psContext, UDWORD index,
|
||||
INTERP_VAL *data);
|
||||
|
||||
// Get the value pointer for a variable index
|
||||
extern BOOL eventGetContextVal(SCRIPT_CONTEXT *psContext, UDWORD index,
|
||||
extern bool eventGetContextVal(SCRIPT_CONTEXT *psContext, UDWORD index,
|
||||
INTERP_VAL **ppsVal);
|
||||
|
||||
// Process all the currently active triggers
|
||||
|
@ -184,10 +184,10 @@ extern void eventFireCallbackTrigger(TRIGGER_TYPE callback);
|
|||
* The varargs part is a set of INTERP_TYPE, UDWORD * pairs.
|
||||
* The value of the parameter is stored in the DWORD pointed to by the UDWORD *
|
||||
*/
|
||||
extern BOOL stackPopParams(unsigned int numParams, ...);
|
||||
extern bool stackPopParams(unsigned int numParams, ...);
|
||||
|
||||
/* Push a value onto the stack without using a value structure */
|
||||
extern BOOL stackPushResult(INTERP_TYPE type, INTERP_VAL *result);
|
||||
extern bool stackPushResult(INTERP_TYPE type, INTERP_VAL *result);
|
||||
|
||||
/***********************************************************************************
|
||||
*
|
||||
|
@ -207,20 +207,20 @@ extern BOOL stackPushResult(INTERP_TYPE type, INTERP_VAL *result);
|
|||
*/
|
||||
|
||||
/* Instinct function to turn on tracing */
|
||||
extern BOOL interpTraceOn(void);
|
||||
extern bool interpTraceOn(void);
|
||||
|
||||
/* Instinct function to turn off tracing */
|
||||
extern BOOL interpTraceOff(void);
|
||||
extern bool interpTraceOff(void);
|
||||
|
||||
// Change the trigger assigned to an event
|
||||
// This is an instinct function that takes a VAL_EVENT and VAL_TRIGGER as parameters
|
||||
extern BOOL eventSetTrigger(void);
|
||||
extern bool eventSetTrigger(void);
|
||||
|
||||
// set the event tracing level
|
||||
// 0 - no tracing
|
||||
// 1 - only fired triggers
|
||||
// 2 - added and fired triggers
|
||||
// 3 - as 2 but show tested but not fired triggers as well
|
||||
extern BOOL eventSetTraceLevel(void);
|
||||
extern bool eventSetTraceLevel(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -61,7 +61,7 @@ static char aText[TEXT_BUFFERS][YYLMAX];
|
|||
static UDWORD currText=0;
|
||||
|
||||
// Note if we are in a comment
|
||||
static BOOL inComment = false;
|
||||
static bool inComment = false;
|
||||
|
||||
/* FLEX include buffer stack */
|
||||
static YY_BUFFER_STATE include_stack[MAX_SCR_INCLUDE_DEPTH];
|
||||
|
@ -106,7 +106,7 @@ static YYSTYPE dummy;
|
|||
/* Get the token type for a variable symbol */
|
||||
static SDWORD scriptGetVarToken(VAR_SYMBOL *psVar)
|
||||
{
|
||||
BOOL object;
|
||||
bool object;
|
||||
|
||||
// See if this is an object pointer
|
||||
if (!asScrTypeTab || psVar->type < VAL_USERTYPESTART)
|
||||
|
@ -220,7 +220,7 @@ static SDWORD scriptGetVarToken(VAR_SYMBOL *psVar)
|
|||
/* Get the token type for a constant symbol */
|
||||
static SDWORD scriptGetConstToken(CONST_SYMBOL *psConst)
|
||||
{
|
||||
BOOL object;
|
||||
bool object;
|
||||
|
||||
// See if this is an object constant
|
||||
if (!asScrTypeTab || psConst->type < VAL_USERTYPESTART)
|
||||
|
@ -261,7 +261,7 @@ static SDWORD scriptGetConstToken(CONST_SYMBOL *psConst)
|
|||
/* Get the token type for a function symbol */
|
||||
static SDWORD scriptGetFuncToken(FUNC_SYMBOL *psFunc)
|
||||
{
|
||||
BOOL object;
|
||||
bool object;
|
||||
|
||||
// See if this is an object pointer
|
||||
if(psFunc->type >= VAL_USERTYPESTART)
|
||||
|
@ -299,7 +299,7 @@ static SDWORD scriptGetFuncToken(FUNC_SYMBOL *psFunc)
|
|||
/* Get the token type for a custom function symbol */
|
||||
static SDWORD scriptGetCustomFuncToken(EVENT_SYMBOL *psFunc)
|
||||
{
|
||||
BOOL object;
|
||||
bool object;
|
||||
|
||||
// See if this is an object pointer
|
||||
if (!asScrTypeTab || psFunc->retType < VAL_USERTYPESTART)
|
||||
|
@ -348,7 +348,7 @@ static SDWORD scriptGetCustomFuncToken(EVENT_SYMBOL *psFunc)
|
|||
}
|
||||
|
||||
/* Look up defined macro and return new define buffer */
|
||||
static BOOL scriptLoopUpMacro(const char *pMacro, char **ppMacroBody)
|
||||
static bool scriptLoopUpMacro(const char *pMacro, char **ppMacroBody)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
|
@ -498,7 +498,7 @@ pause return PAUSE;
|
|||
/* Match type keywords */
|
||||
void|VOID { scr_lval.tval = VAL_VOID; return _VOID; }
|
||||
string|STRING { scr_lval.tval = VAL_STRING; return TYPE; }
|
||||
bool|BOOL { scr_lval.tval = VAL_BOOL; return TYPE; }
|
||||
bool|bool { scr_lval.tval = VAL_BOOL; return TYPE; }
|
||||
int|INT { scr_lval.tval = VAL_INT; return TYPE; }
|
||||
float|FLOAT { scr_lval.tval = VAL_FLOAT; return TYPE; }
|
||||
|
||||
|
|
|
@ -42,12 +42,12 @@ extern int scr_lex(void);
|
|||
extern int scr_lex_destroy(void);
|
||||
|
||||
/* Error return codes for code generation functions */
|
||||
typedef enum _code_error
|
||||
enum CODE_ERROR
|
||||
{
|
||||
CE_OK, // No error
|
||||
CE_MEMORY, // Out of memory
|
||||
CE_PARSE // A parse error occured
|
||||
} CODE_ERROR;
|
||||
};
|
||||
|
||||
/* Turn off a couple of warnings that the yacc generated code gives */
|
||||
|
||||
|
@ -67,7 +67,7 @@ static OBJVAR_BLOCK *psObjVarBlock=NULL;
|
|||
static PARAM_BLOCK *psCurrPBlock=NULL;
|
||||
|
||||
/* Any errors occured? */
|
||||
static BOOL bError=false;
|
||||
static bool bError=false;
|
||||
|
||||
//String support
|
||||
//-----------------------------
|
||||
|
@ -111,7 +111,7 @@ EVENT_SYMBOL *psCurEvent = NULL; /* stores current event: for local var declar
|
|||
static INTERP_TYPE objVarContext = (INTERP_TYPE)0;
|
||||
|
||||
/* Control whether debug info is generated */
|
||||
static BOOL genDebugInfo = true;
|
||||
static bool genDebugInfo = true;
|
||||
|
||||
/* Currently defined triggers */
|
||||
static TRIGGER_SYMBOL *psTriggers;
|
||||
|
@ -124,7 +124,7 @@ static UDWORD numEvents;
|
|||
/* This is true when local variables are being defined.
|
||||
* (So local variables can have the same name as global ones)
|
||||
*/
|
||||
static BOOL localVariableDef=false;
|
||||
static bool localVariableDef=false;
|
||||
|
||||
/* The identifier for the current script function being defined */
|
||||
//static char *pCurrFuncIdent=NULL;
|
||||
|
@ -531,7 +531,7 @@ static void freeVARIDENTDECL(VAR_IDENT_DECL* psDcl)
|
|||
/* Macros to store a value in a code block */
|
||||
#define PUT_DATA_BOOL(ip, value) \
|
||||
(ip)->type = VAL_BOOL; \
|
||||
(ip)->v.bval = (BOOL)(value); \
|
||||
(ip)->v.bval = (bool)(value); \
|
||||
(ip)++
|
||||
|
||||
#define PUT_DATA_INT(ip, value) \
|
||||
|
@ -714,13 +714,13 @@ void script_debug(const char *pFormat, ...)
|
|||
*/
|
||||
static CODE_ERROR scriptCodeFunction(FUNC_SYMBOL *psFSymbol, // The function being called
|
||||
PARAM_BLOCK *psPBlock, // The functions parameters
|
||||
BOOL expContext, // Whether the function is being
|
||||
bool expContext, // Whether the function is being
|
||||
// called in an expression context
|
||||
CODE_BLOCK **ppsCBlock) // The generated code block
|
||||
{
|
||||
UDWORD size, i;
|
||||
INTERP_VAL *ip;
|
||||
BOOL typeError = false;
|
||||
bool typeError = false;
|
||||
char aErrorString[255];
|
||||
INTERP_TYPE type1,type2;
|
||||
|
||||
|
@ -853,7 +853,7 @@ static CODE_ERROR scriptCodeCallbackParams(
|
|||
{
|
||||
UDWORD size, i;
|
||||
INTERP_VAL *ip;
|
||||
BOOL typeError = false;
|
||||
bool typeError = false;
|
||||
char aErrorString[255];
|
||||
|
||||
ASSERT( psPBlock != NULL,
|
||||
|
@ -1256,7 +1256,7 @@ static CODE_ERROR scriptCodeBinaryOperator(CODE_BLOCK *psFirst, // Code for firs
|
|||
|
||||
/* check if the arguments in the function definition body match the argument types
|
||||
and names from function declaration (if there was any) */
|
||||
static BOOL checkFuncParamType(UDWORD argIndex, UDWORD argType)
|
||||
static bool checkFuncParamType(UDWORD argIndex, UDWORD argType)
|
||||
{
|
||||
VAR_SYMBOL *psCurr;
|
||||
SDWORD i,j;
|
||||
|
@ -1557,7 +1557,7 @@ static CODE_ERROR scriptCodeVarRef(VAR_SYMBOL *psVariable, // The object variab
|
|||
|
||||
%union {
|
||||
/* Types returned by the lexer */
|
||||
BOOL bval;
|
||||
bool bval;
|
||||
float fval;
|
||||
SDWORD ival;
|
||||
char *sval;
|
||||
|
@ -5706,7 +5706,7 @@ void scr_error(const char *pMessage, ...)
|
|||
|
||||
|
||||
/* Look up a type symbol */
|
||||
BOOL scriptLookUpType(const char *pIdent, INTERP_TYPE *pType)
|
||||
bool scriptLookUpType(const char *pIdent, INTERP_TYPE *pType)
|
||||
{
|
||||
UDWORD i;
|
||||
|
||||
|
@ -5730,7 +5730,7 @@ BOOL scriptLookUpType(const char *pIdent, INTERP_TYPE *pType)
|
|||
}
|
||||
|
||||
/* pop passed arguments (if any) */
|
||||
BOOL popArguments(INTERP_VAL **ip_temp, SDWORD numParams)
|
||||
bool popArguments(INTERP_VAL **ip_temp, SDWORD numParams)
|
||||
{
|
||||
SDWORD i;
|
||||
|
||||
|
@ -5748,7 +5748,7 @@ BOOL popArguments(INTERP_VAL **ip_temp, SDWORD numParams)
|
|||
* If localVariableDef is true a local variable symbol is defined,
|
||||
* otherwise a global variable symbol is defined.
|
||||
*/
|
||||
BOOL scriptAddVariable(VAR_DECL *psStorage, VAR_IDENT_DECL *psVarIdent)
|
||||
bool scriptAddVariable(VAR_DECL *psStorage, VAR_IDENT_DECL *psVarIdent)
|
||||
{
|
||||
VAR_SYMBOL *psNew;
|
||||
unsigned int i;
|
||||
|
@ -5838,7 +5838,7 @@ BOOL scriptAddVariable(VAR_DECL *psStorage, VAR_IDENT_DECL *psVarIdent)
|
|||
}
|
||||
|
||||
/* Look up a variable symbol */
|
||||
BOOL scriptLookUpVariable(const char *pIdent, VAR_SYMBOL **ppsSym)
|
||||
bool scriptLookUpVariable(const char *pIdent, VAR_SYMBOL **ppsSym)
|
||||
{
|
||||
VAR_SYMBOL *psCurr;
|
||||
UDWORD i;
|
||||
|
@ -5945,7 +5945,7 @@ BOOL scriptLookUpVariable(const char *pIdent, VAR_SYMBOL **ppsSym)
|
|||
|
||||
|
||||
/* Add a new trigger symbol */
|
||||
BOOL scriptAddTrigger(const char *pIdent, TRIGGER_DECL *psDecl, UDWORD line)
|
||||
bool scriptAddTrigger(const char *pIdent, TRIGGER_DECL *psDecl, UDWORD line)
|
||||
{
|
||||
TRIGGER_SYMBOL *psTrigger, *psCurr, *psPrev;
|
||||
|
||||
|
@ -6018,7 +6018,7 @@ BOOL scriptAddTrigger(const char *pIdent, TRIGGER_DECL *psDecl, UDWORD line)
|
|||
|
||||
|
||||
/* Lookup a trigger symbol */
|
||||
BOOL scriptLookUpTrigger(const char *pIdent, TRIGGER_SYMBOL **ppsTrigger)
|
||||
bool scriptLookUpTrigger(const char *pIdent, TRIGGER_SYMBOL **ppsTrigger)
|
||||
{
|
||||
TRIGGER_SYMBOL *psCurr;
|
||||
|
||||
|
@ -6041,7 +6041,7 @@ BOOL scriptLookUpTrigger(const char *pIdent, TRIGGER_SYMBOL **ppsTrigger)
|
|||
|
||||
|
||||
/* Lookup a callback trigger symbol */
|
||||
BOOL scriptLookUpCallback(const char *pIdent, CALLBACK_SYMBOL **ppsCallback)
|
||||
bool scriptLookUpCallback(const char *pIdent, CALLBACK_SYMBOL **ppsCallback)
|
||||
{
|
||||
CALLBACK_SYMBOL *psCurr;
|
||||
|
||||
|
@ -6067,7 +6067,7 @@ BOOL scriptLookUpCallback(const char *pIdent, CALLBACK_SYMBOL **ppsCallback)
|
|||
}
|
||||
|
||||
/* Add a new event symbol */
|
||||
BOOL scriptDeclareEvent(const char *pIdent, EVENT_SYMBOL **ppsEvent, SDWORD numArgs)
|
||||
bool scriptDeclareEvent(const char *pIdent, EVENT_SYMBOL **ppsEvent, SDWORD numArgs)
|
||||
{
|
||||
EVENT_SYMBOL *psEvent, *psCurr, *psPrev;
|
||||
|
||||
|
@ -6119,7 +6119,7 @@ BOOL scriptDeclareEvent(const char *pIdent, EVENT_SYMBOL **ppsEvent, SDWORD numA
|
|||
}
|
||||
|
||||
// Add the code to a defined event
|
||||
BOOL scriptDefineEvent(EVENT_SYMBOL *psEvent, CODE_BLOCK *psCode, SDWORD trigger)
|
||||
bool scriptDefineEvent(EVENT_SYMBOL *psEvent, CODE_BLOCK *psCode, SDWORD trigger)
|
||||
{
|
||||
ASSERT(psCode != NULL, "scriptDefineEvent: psCode == NULL");
|
||||
ASSERT(psCode->size > 0,
|
||||
|
@ -6172,7 +6172,7 @@ BOOL scriptDefineEvent(EVENT_SYMBOL *psEvent, CODE_BLOCK *psCode, SDWORD trigger
|
|||
}
|
||||
|
||||
/* Lookup an event symbol */
|
||||
BOOL scriptLookUpEvent(const char *pIdent, EVENT_SYMBOL **ppsEvent)
|
||||
bool scriptLookUpEvent(const char *pIdent, EVENT_SYMBOL **ppsEvent)
|
||||
{
|
||||
EVENT_SYMBOL *psCurr;
|
||||
//debug(LOG_SCRIPT, "scriptLookUpEvent");
|
||||
|
@ -6192,7 +6192,7 @@ BOOL scriptLookUpEvent(const char *pIdent, EVENT_SYMBOL **ppsEvent)
|
|||
|
||||
|
||||
/* Look up a constant variable symbol */
|
||||
BOOL scriptLookUpConstant(const char *pIdent, CONST_SYMBOL **ppsSym)
|
||||
bool scriptLookUpConstant(const char *pIdent, CONST_SYMBOL **ppsSym)
|
||||
{
|
||||
CONST_SYMBOL *psCurr;
|
||||
|
||||
|
@ -6218,7 +6218,7 @@ BOOL scriptLookUpConstant(const char *pIdent, CONST_SYMBOL **ppsSym)
|
|||
|
||||
|
||||
/* Look up a function symbol */
|
||||
BOOL scriptLookUpFunction(const char *pIdent, FUNC_SYMBOL **ppsSym)
|
||||
bool scriptLookUpFunction(const char *pIdent, FUNC_SYMBOL **ppsSym)
|
||||
{
|
||||
UDWORD i;
|
||||
|
||||
|
@ -6245,7 +6245,7 @@ BOOL scriptLookUpFunction(const char *pIdent, FUNC_SYMBOL **ppsSym)
|
|||
}
|
||||
|
||||
/* Look up a function symbol defined in script */
|
||||
BOOL scriptLookUpCustomFunction(const char *pIdent, EVENT_SYMBOL **ppsSym)
|
||||
bool scriptLookUpCustomFunction(const char *pIdent, EVENT_SYMBOL **ppsSym)
|
||||
{
|
||||
EVENT_SYMBOL *psCurr;
|
||||
|
||||
|
|
|
@ -42,13 +42,13 @@ char STRSTACK[MAXSTACKLEN][MAXSTRLEN]; //simple string 'stack'
|
|||
UDWORD CURSTACKSTR = 0; //Points to the top of the string stack
|
||||
|
||||
/* store for a 'chunk' of the stack */
|
||||
typedef struct _stack_chunk
|
||||
struct STACK_CHUNK
|
||||
{
|
||||
INTERP_VAL *aVals;
|
||||
UDWORD size;
|
||||
|
||||
struct _stack_chunk *psNext, *psPrev;
|
||||
} STACK_CHUNK;
|
||||
STACK_CHUNK * psNext, *psPrev;
|
||||
};
|
||||
|
||||
/* The first chunk of the stack */
|
||||
static STACK_CHUNK *psStackBase=NULL;
|
||||
|
@ -60,18 +60,18 @@ static STACK_CHUNK *psCurrChunk=NULL;
|
|||
static UDWORD currEntry=0;
|
||||
|
||||
/* Get rid of the top value without returning it */
|
||||
static inline BOOL stackRemoveTop(void);
|
||||
static inline bool stackRemoveTop(void);
|
||||
|
||||
|
||||
/* Check if the stack is empty */
|
||||
BOOL stackEmpty(void)
|
||||
bool stackEmpty(void)
|
||||
{
|
||||
return (psCurrChunk->psPrev == NULL && currEntry == 0);
|
||||
}
|
||||
|
||||
|
||||
/* Allocate a new chunk for the stack */
|
||||
static BOOL stackNewChunk(UDWORD size)
|
||||
static bool stackNewChunk(UDWORD size)
|
||||
{
|
||||
/* see if a chunk has already been allocated */
|
||||
if (psCurrChunk->psNext != NULL)
|
||||
|
@ -107,7 +107,7 @@ static BOOL stackNewChunk(UDWORD size)
|
|||
|
||||
|
||||
/* Push a value onto the stack */
|
||||
BOOL stackPush(INTERP_VAL *psVal)
|
||||
bool stackPush(INTERP_VAL *psVal)
|
||||
{
|
||||
/* Store the value in the stack - psCurrChunk/currEntry always point to
|
||||
valid space */
|
||||
|
@ -156,7 +156,7 @@ BOOL stackPush(INTERP_VAL *psVal)
|
|||
|
||||
|
||||
/* Pop a value off the stack */
|
||||
BOOL stackPop(INTERP_VAL *psVal)
|
||||
bool stackPop(INTERP_VAL *psVal)
|
||||
{
|
||||
if (stackEmpty())
|
||||
{
|
||||
|
@ -184,7 +184,7 @@ BOOL stackPop(INTERP_VAL *psVal)
|
|||
}
|
||||
|
||||
/* Return pointer to the top value without poping it */
|
||||
BOOL stackPeekTop(INTERP_VAL **ppsVal)
|
||||
bool stackPeekTop(INTERP_VAL **ppsVal)
|
||||
{
|
||||
if ((psCurrChunk->psPrev == NULL) && (currEntry == 0))
|
||||
{
|
||||
|
@ -214,7 +214,7 @@ BOOL stackPeekTop(INTERP_VAL **ppsVal)
|
|||
|
||||
|
||||
/* Pop a value off the stack, checking that the type matches what is passed in */
|
||||
BOOL stackPopType(INTERP_VAL *psVal)
|
||||
bool stackPopType(INTERP_VAL *psVal)
|
||||
{
|
||||
INTERP_VAL *psTop;
|
||||
|
||||
|
@ -287,7 +287,7 @@ BOOL stackPopType(INTERP_VAL *psVal)
|
|||
/* Pop a number of values off the stack checking their types
|
||||
* This is used by instinct functions to get their parameters
|
||||
*/
|
||||
BOOL stackPopParams(unsigned int numParams, ...)
|
||||
bool stackPopParams(unsigned int numParams, ...)
|
||||
{
|
||||
va_list args;
|
||||
unsigned int i, index;
|
||||
|
@ -342,7 +342,7 @@ BOOL stackPopParams(unsigned int numParams, ...)
|
|||
switch (type)
|
||||
{
|
||||
case VAL_BOOL:
|
||||
*(BOOL*)pData = psVal->v.bval;
|
||||
*(bool*)pData = psVal->v.bval;
|
||||
break;
|
||||
case VAL_INT:
|
||||
*(int*)pData = psVal->v.ival;
|
||||
|
@ -414,7 +414,7 @@ BOOL stackPopParams(unsigned int numParams, ...)
|
|||
/* Push a value onto the stack without using a value structure
|
||||
NOTE: result->type is _not_ set yet - use 'type' instead
|
||||
*/
|
||||
BOOL stackPushResult(INTERP_TYPE type, INTERP_VAL *result)
|
||||
bool stackPushResult(INTERP_TYPE type, INTERP_VAL *result)
|
||||
{
|
||||
/* assign type, wasn't done before */
|
||||
result->type = type;
|
||||
|
@ -464,7 +464,7 @@ BOOL stackPushResult(INTERP_TYPE type, INTERP_VAL *result)
|
|||
* index is how far down the stack to look.
|
||||
* Index 0 is the top entry on the stack.
|
||||
*/
|
||||
BOOL stackPeek(INTERP_VAL *psVal, UDWORD index)
|
||||
bool stackPeek(INTERP_VAL *psVal, UDWORD index)
|
||||
{
|
||||
STACK_CHUNK *psCurr;
|
||||
|
||||
|
@ -518,7 +518,7 @@ void stackPrintTop(void)
|
|||
/* Do binary operations on the top of the stack
|
||||
* This effectively pops two values and pushes the result
|
||||
*/
|
||||
BOOL stackBinaryOp(OPCODE opcode)
|
||||
bool stackBinaryOp(OPCODE opcode)
|
||||
{
|
||||
STACK_CHUNK *psChunk;
|
||||
INTERP_VAL *psV1, *psV2;
|
||||
|
@ -773,7 +773,7 @@ BOOL stackBinaryOp(OPCODE opcode)
|
|||
/* Perform a unary operation on the top of the stack
|
||||
* This effectively pops a value and pushes the result
|
||||
*/
|
||||
BOOL stackUnaryOp(OPCODE opcode)
|
||||
bool stackUnaryOp(OPCODE opcode)
|
||||
{
|
||||
STACK_CHUNK *psChunk;
|
||||
INTERP_VAL *psVal;
|
||||
|
@ -885,7 +885,7 @@ BOOL stackUnaryOp(OPCODE opcode)
|
|||
return true;
|
||||
}
|
||||
|
||||
BOOL stackCastTop(INTERP_TYPE neededType)
|
||||
bool stackCastTop(INTERP_TYPE neededType)
|
||||
{
|
||||
INTERP_VAL *pTop;
|
||||
|
||||
|
@ -947,7 +947,7 @@ BOOL stackCastTop(INTERP_TYPE neededType)
|
|||
|
||||
|
||||
/* Initialise the stack */
|
||||
BOOL stackInitialise(void)
|
||||
bool stackInitialise(void)
|
||||
{
|
||||
psStackBase = (STACK_CHUNK *)calloc(1, sizeof(*psStackBase));
|
||||
if (psStackBase == NULL)
|
||||
|
@ -1017,7 +1017,7 @@ void stackShutDown(void)
|
|||
}
|
||||
|
||||
/* Get rid of the top value without returning it */
|
||||
static inline BOOL stackRemoveTop(void)
|
||||
static inline bool stackRemoveTop(void)
|
||||
{
|
||||
if ((psCurrChunk->psPrev == NULL) && (currEntry == 0))
|
||||
{
|
||||
|
|
|
@ -33,47 +33,47 @@
|
|||
#define MAXSTACKLEN 8000
|
||||
|
||||
/* Initialise the stack */
|
||||
extern BOOL stackInitialise(void);
|
||||
extern bool stackInitialise(void);
|
||||
|
||||
/* Shutdown the stack */
|
||||
extern void stackShutDown(void);
|
||||
|
||||
/* Push a value onto the stack */
|
||||
extern BOOL stackPush(INTERP_VAL *psVal);
|
||||
extern bool stackPush(INTERP_VAL *psVal);
|
||||
|
||||
/* Pop a value off the stack */
|
||||
extern BOOL stackPop(INTERP_VAL *psVal);
|
||||
extern bool stackPop(INTERP_VAL *psVal);
|
||||
|
||||
/* Return pointer to the top value without poping it */
|
||||
extern BOOL stackPeekTop(INTERP_VAL **ppsVal);
|
||||
extern bool stackPeekTop(INTERP_VAL **ppsVal);
|
||||
|
||||
/* Pop a value off the stack, checking that the type matches what is passed in */
|
||||
extern BOOL stackPopType(INTERP_VAL *psVal);
|
||||
extern bool stackPopType(INTERP_VAL *psVal);
|
||||
|
||||
/* Look at a value on the stack without removing it.
|
||||
* index is how far down the stack to look.
|
||||
* Index 0 is the top entry on the stack.
|
||||
*/
|
||||
extern BOOL stackPeek(INTERP_VAL *psVal, UDWORD index);
|
||||
extern bool stackPeek(INTERP_VAL *psVal, UDWORD index);
|
||||
|
||||
/* Print the top value on the stack */
|
||||
extern void stackPrintTop(void);
|
||||
|
||||
/* Check if the stack is empty */
|
||||
extern BOOL stackEmpty(void);
|
||||
extern bool stackEmpty(void);
|
||||
|
||||
/* Do binary operations on the top of the stack
|
||||
* This effectively pops two values and pushes the result
|
||||
*/
|
||||
extern BOOL stackBinaryOp(OPCODE opcode);
|
||||
extern bool stackBinaryOp(OPCODE opcode);
|
||||
|
||||
/* Perform a unary operation on the top of the stack
|
||||
* This effectively pops a value and pushes the result
|
||||
*/
|
||||
extern BOOL stackUnaryOp(OPCODE opcode);
|
||||
extern bool stackUnaryOp(OPCODE opcode);
|
||||
|
||||
/* casts top of the stack to some other data type */
|
||||
extern BOOL stackCastTop(INTERP_TYPE neededType);
|
||||
extern bool stackCastTop(INTERP_TYPE neededType);
|
||||
|
||||
/* Reset the stack to an empty state */
|
||||
extern void stackReset(void);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
AM_CPPFLAGS = $(SDL_CFLAGS) $(THEORA_CFLAGS) $(WZ_CPPFLAGS) $(GLee_CFLAGS)
|
||||
AM_CPPFLAGS = $(SDL_CFLAGS) $(THEORA_CFLAGS) $(OPENAL_CFLAGS) $(WZ_CPPFLAGS) $(GLee_CFLAGS)
|
||||
AM_CFLAGS = $(WZ_CFLAGS)
|
||||
AM_CXXFLAGS = $(WZ_CXXFLAGS)
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@
|
|||
# endif
|
||||
|
||||
// stick this in sequence.h perhaps?
|
||||
typedef struct
|
||||
struct AudioData
|
||||
{
|
||||
ALuint buffer1; // buffer 1
|
||||
ALuint buffer2; // buffer 2
|
||||
|
@ -87,11 +87,11 @@ typedef struct
|
|||
int totbufstarted; // number of buffers started
|
||||
int audiofd_fragsize; // audio fragment size, used to calculate how big audiobuf is
|
||||
int audiobuf_fill; // how full our audio buffer is
|
||||
} AudioData;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
struct VideoData
|
||||
{
|
||||
ogg_sync_state oy; // ogg sync state
|
||||
ogg_page og; // ogg page
|
||||
|
@ -106,7 +106,7 @@ typedef struct
|
|||
vorbis_block vb; // vorbis block
|
||||
vorbis_comment vc; // vorbis comment
|
||||
#endif
|
||||
} VideoData;
|
||||
};
|
||||
// stick that in sequence.h perhaps?
|
||||
|
||||
#if !defined(WZ_NOSOUND)
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
static double startTimeInMicroSec = 0; // starting time in microseconds
|
||||
static double endTimeInMicroSec = 0; // ending time in microseconds
|
||||
static BOOL stopped = false; // stop flag
|
||||
static bool stopped = false; // stop flag
|
||||
|
||||
static struct timeval startCount;
|
||||
static struct timeval endCount;
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
// global variables
|
||||
static AUDIO_SAMPLE *g_psSampleList = NULL;
|
||||
static AUDIO_SAMPLE *g_psSampleQueue = NULL;
|
||||
static BOOL g_bAudioEnabled = false;
|
||||
static BOOL g_bAudioPaused = false;
|
||||
static bool g_bAudioEnabled = false;
|
||||
static bool g_bAudioPaused = false;
|
||||
static AUDIO_SAMPLE g_sPreviousSample;
|
||||
static int g_iPreviousSampleTime;
|
||||
|
||||
|
@ -85,7 +85,7 @@ unsigned int audio_GetSampleListCount()
|
|||
// =======================================================================================================================
|
||||
// =======================================================================================================================
|
||||
//
|
||||
BOOL audio_Disabled( void )
|
||||
bool audio_Disabled( void )
|
||||
{
|
||||
return !g_bAudioEnabled;
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ BOOL audio_Disabled( void )
|
|||
// =======================================================================================================================
|
||||
// =======================================================================================================================
|
||||
//
|
||||
BOOL audio_Init( AUDIO_CALLBACK pStopTrackCallback )
|
||||
bool audio_Init( AUDIO_CALLBACK pStopTrackCallback )
|
||||
{
|
||||
// init audio system
|
||||
g_sPreviousSample.iTrack = NO_SAMPLE;
|
||||
|
@ -113,11 +113,11 @@ BOOL audio_Init( AUDIO_CALLBACK pStopTrackCallback )
|
|||
// =======================================================================================================================
|
||||
// =======================================================================================================================
|
||||
//
|
||||
BOOL audio_Shutdown( void )
|
||||
bool audio_Shutdown( void )
|
||||
{
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
AUDIO_SAMPLE *psSample = NULL, *psSampleTemp = NULL;
|
||||
BOOL bOK;
|
||||
bool bOK;
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// if audio not enabled return true to carry on game without audio
|
||||
|
@ -158,7 +158,7 @@ BOOL audio_Shutdown( void )
|
|||
// =======================================================================================================================
|
||||
// =======================================================================================================================
|
||||
//
|
||||
BOOL audio_GetPreviousQueueTrackPos( SDWORD *iX, SDWORD *iY, SDWORD *iZ )
|
||||
bool audio_GetPreviousQueueTrackPos( SDWORD *iX, SDWORD *iY, SDWORD *iZ )
|
||||
{
|
||||
if (g_sPreviousSample.x == SAMPLE_COORD_INVALID
|
||||
|| g_sPreviousSample.y == SAMPLE_COORD_INVALID
|
||||
|
@ -174,7 +174,7 @@ BOOL audio_GetPreviousQueueTrackPos( SDWORD *iX, SDWORD *iY, SDWORD *iZ )
|
|||
return true;
|
||||
}
|
||||
|
||||
BOOL audio_GetPreviousQueueTrackRadarBlipPos( SDWORD *iX, SDWORD *iY )
|
||||
bool audio_GetPreviousQueueTrackRadarBlipPos( SDWORD *iX, SDWORD *iY )
|
||||
{
|
||||
if (g_sPreviousSample.x == SAMPLE_COORD_INVALID
|
||||
|| g_sPreviousSample.y == SAMPLE_COORD_INVALID)
|
||||
|
@ -281,12 +281,12 @@ static void audio_RemoveSample( AUDIO_SAMPLE **ppsSampleList, AUDIO_SAMPLE *psSa
|
|||
// =======================================================================================================================
|
||||
// =======================================================================================================================
|
||||
//
|
||||
static BOOL audio_CheckSameQueueTracksPlaying( SDWORD iTrack )
|
||||
static bool audio_CheckSameQueueTracksPlaying( SDWORD iTrack )
|
||||
{
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
SDWORD iCount;
|
||||
AUDIO_SAMPLE *psSample = NULL;
|
||||
BOOL bOK = true;
|
||||
bool bOK = true;
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// return if audio not enabled
|
||||
|
@ -618,7 +618,7 @@ void audio_Update()
|
|||
* \param audibleRadius the radius from the source of sound where it can be heard
|
||||
* \return a non-zero value when successful or audio is disabled, zero when the file is not found or no more tracks can be loaded (i.e. the limit is reached)
|
||||
*/
|
||||
unsigned int audio_SetTrackVals(const char* fileName, BOOL loop, unsigned int volume, unsigned int audibleRadius)
|
||||
unsigned int audio_SetTrackVals(const char* fileName, bool loop, unsigned int volume, unsigned int audibleRadius)
|
||||
{
|
||||
// if audio not enabled return a random non-zero value to carry on game without audio
|
||||
if ( g_bAudioEnabled == false )
|
||||
|
@ -640,12 +640,12 @@ unsigned int audio_SetTrackVals(const char* fileName, BOOL loop, unsigned int vo
|
|||
// =======================================================================================================================
|
||||
// =======================================================================================================================
|
||||
//
|
||||
static BOOL audio_CheckSame3DTracksPlaying( SDWORD iTrack, SDWORD iX, SDWORD iY, SDWORD iZ )
|
||||
static bool audio_CheckSame3DTracksPlaying( SDWORD iTrack, SDWORD iX, SDWORD iY, SDWORD iZ )
|
||||
{
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
SDWORD iCount, iDx, iDy, iDz, iDistSq, iMaxDistSq, iRad;
|
||||
AUDIO_SAMPLE *psSample = NULL;
|
||||
BOOL bOK = true;
|
||||
bool bOK = true;
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// return if audio not enabled
|
||||
|
@ -690,7 +690,7 @@ static BOOL audio_CheckSame3DTracksPlaying( SDWORD iTrack, SDWORD iX, SDWORD iY,
|
|||
// =======================================================================================================================
|
||||
// =======================================================================================================================
|
||||
//
|
||||
static BOOL audio_Play3DTrack( SDWORD iX, SDWORD iY, SDWORD iZ, int iTrack, SIMPLE_OBJECT *psObj, AUDIO_CALLBACK pUserCallback )
|
||||
static bool audio_Play3DTrack( SDWORD iX, SDWORD iY, SDWORD iZ, int iTrack, SIMPLE_OBJECT *psObj, AUDIO_CALLBACK pUserCallback )
|
||||
{
|
||||
//~~~~~~~~~~~~~~~~~~~~~~
|
||||
AUDIO_SAMPLE *psSample;
|
||||
|
@ -778,7 +778,7 @@ static BOOL audio_Play3DTrack( SDWORD iX, SDWORD iY, SDWORD iZ, int iTrack, SIMP
|
|||
// =======================================================================================================================
|
||||
// =======================================================================================================================
|
||||
//
|
||||
BOOL audio_PlayStaticTrack( SDWORD iMapX, SDWORD iMapY, int iTrack )
|
||||
bool audio_PlayStaticTrack( SDWORD iMapX, SDWORD iMapY, int iTrack )
|
||||
{
|
||||
//~~~~~~~~~~~~~~~
|
||||
SDWORD iX, iY, iZ;
|
||||
|
@ -1187,7 +1187,7 @@ void audio_RemoveObj(SIMPLE_OBJECT const *psObj)
|
|||
debug(LOG_MEMORY, "audio_RemoveObj: ***Warning! psOBJ %p was found %u times in the list of playing audio samples", psObj, count);
|
||||
}
|
||||
|
||||
static BOOL dummyCB(WZ_DECL_UNUSED void* dummy)
|
||||
static bool dummyCB(WZ_DECL_UNUSED void* dummy)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -23,15 +23,15 @@
|
|||
|
||||
#include "track.h"
|
||||
|
||||
extern BOOL audio_Init( AUDIO_CALLBACK pStopTrackCallback );
|
||||
extern bool audio_Init( AUDIO_CALLBACK pStopTrackCallback );
|
||||
extern void audio_Update(void);
|
||||
extern BOOL audio_Shutdown(void);
|
||||
extern BOOL audio_Disabled( void );
|
||||
extern bool audio_Shutdown(void);
|
||||
extern bool audio_Disabled( void );
|
||||
|
||||
extern BOOL audio_LoadTrackFromFile( char szFileName[] );
|
||||
extern unsigned int audio_SetTrackVals(const char* fileName, BOOL loop, unsigned int volume, unsigned int audibleRadius);
|
||||
extern bool audio_LoadTrackFromFile( char szFileName[] );
|
||||
extern unsigned int audio_SetTrackVals(const char* fileName, bool loop, unsigned int volume, unsigned int audibleRadius);
|
||||
|
||||
extern BOOL audio_PlayStaticTrack( SDWORD iX, SDWORD iY, int iTrack );
|
||||
extern bool audio_PlayStaticTrack( SDWORD iX, SDWORD iY, int iTrack );
|
||||
bool audio_PlayObjStaticTrack(SIMPLE_OBJECT *psObj, int iTrack);
|
||||
bool audio_PlayObjStaticTrackCallback(SIMPLE_OBJECT *psObj, int iTrack, AUDIO_CALLBACK pUserCallback);
|
||||
bool audio_PlayObjDynamicTrack(SIMPLE_OBJECT *psObj, int iTrack, AUDIO_CALLBACK pUserCallback );
|
||||
|
@ -49,9 +49,9 @@ extern void audio_QueueTrackPos( SDWORD iTrack, SDWORD iX, SDWORD iY,
|
|||
SDWORD iZ );
|
||||
extern void audio_QueueTrackGroupPos( SDWORD iTrack, SDWORD iGroup,
|
||||
SDWORD iX, SDWORD iY, SDWORD iZ );
|
||||
extern BOOL audio_GetPreviousQueueTrackPos( SDWORD *iX, SDWORD *iY,
|
||||
extern bool audio_GetPreviousQueueTrackPos( SDWORD *iX, SDWORD *iY,
|
||||
SDWORD *iZ );
|
||||
extern BOOL audio_GetPreviousQueueTrackRadarBlipPos( SDWORD *iX, SDWORD *iY);
|
||||
extern bool audio_GetPreviousQueueTrackRadarBlipPos( SDWORD *iX, SDWORD *iY);
|
||||
extern void audio_PauseAll( void );
|
||||
extern void audio_ResumeAll( void );
|
||||
extern void audio_StopAll( void );
|
||||
|
|
|
@ -30,12 +30,11 @@
|
|||
|
||||
/***************************************************************************/
|
||||
|
||||
typedef struct AUDIO_ID_MAP
|
||||
struct AUDIO_ID_MAP
|
||||
{
|
||||
INGAME_AUDIO ID;
|
||||
const char* fileName;
|
||||
}
|
||||
AUDIO_ID_MAP;
|
||||
};
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
|
|
|
@ -21,9 +21,7 @@
|
|||
#ifndef __INCLUDED_LIB_SOUND_AUDIO_ID_H__
|
||||
#define __INCLUDED_LIB_SOUND_AUDIO_ID_H__
|
||||
|
||||
/* INGAME AUDIO */
|
||||
|
||||
typedef enum
|
||||
enum INGAME_AUDIO
|
||||
{
|
||||
NO_SOUND = -1,
|
||||
|
||||
|
@ -494,8 +492,7 @@ typedef enum
|
|||
/* Last ID */
|
||||
ID_SOUND_NEXT, // Thanks to this dummy we don't have to redefine ID_MAX_SOUND every time in terms of the preceding enum value
|
||||
ID_MAX_SOUND = ID_SOUND_NEXT - 1,
|
||||
}
|
||||
INGAME_AUDIO;
|
||||
};
|
||||
|
||||
INGAME_AUDIO audio_GetIDFromStr(const char *pWavStr);
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ static bool stopping = true;
|
|||
static AUDIO_STREAM* cdStream = NULL;
|
||||
#endif
|
||||
|
||||
BOOL cdAudio_Open(const char* user_musicdir)
|
||||
bool cdAudio_Open(const char* user_musicdir)
|
||||
{
|
||||
PlayList_Init();
|
||||
|
||||
|
@ -133,7 +133,7 @@ static void cdAudio_TrackFinished(void* user_data)
|
|||
}
|
||||
#endif
|
||||
|
||||
BOOL cdAudio_PlayTrack(SONG_CONTEXT context)
|
||||
bool cdAudio_PlayTrack(SONG_CONTEXT context)
|
||||
{
|
||||
debug(LOG_SOUND, "called(%d)", (int)context);
|
||||
|
||||
|
|
|
@ -21,15 +21,15 @@
|
|||
#ifndef __INCLUDED_LIB_SOUND_CDAUDIO_H__
|
||||
#define __INCLUDED_LIB_SOUND_CDAUDIO_H__
|
||||
|
||||
typedef enum
|
||||
enum SONG_CONTEXT
|
||||
{
|
||||
SONG_FRONTEND,
|
||||
SONG_INGAME,
|
||||
} SONG_CONTEXT;
|
||||
};
|
||||
|
||||
BOOL cdAudio_Open(const char* user_musicdir);
|
||||
bool cdAudio_Open(const char* user_musicdir);
|
||||
void cdAudio_Close(void);
|
||||
BOOL cdAudio_PlayTrack(SONG_CONTEXT context);
|
||||
bool cdAudio_PlayTrack(SONG_CONTEXT context);
|
||||
void cdAudio_Stop(void);
|
||||
void cdAudio_Pause(void);
|
||||
void cdAudio_Resume(void);
|
||||
|
|
|
@ -42,7 +42,7 @@ struct OggVorbisDecoderState
|
|||
PHYSFS_file* fileHandle;
|
||||
|
||||
// Wether to allow seeking or not
|
||||
BOOL allowSeeking;
|
||||
bool allowSeeking;
|
||||
|
||||
#ifndef WZ_NOSOUND
|
||||
// Internal identifier towards libVorbisFile
|
||||
|
@ -100,7 +100,7 @@ static size_t wz_oggVorbis_read(void *ptr, size_t size, size_t nmemb, void *data
|
|||
static int wz_oggVorbis_seek(void *datasource, ogg_int64_t offset, int whence)
|
||||
{
|
||||
PHYSFS_file* fileHandle;
|
||||
BOOL allowSeeking;
|
||||
bool allowSeeking;
|
||||
int newPos;
|
||||
|
||||
ASSERT(datasource != NULL, "NULL decoder passed!");
|
||||
|
@ -181,7 +181,7 @@ static const ov_callbacks wz_oggVorbis_callbacks =
|
|||
};
|
||||
#endif
|
||||
|
||||
struct OggVorbisDecoderState* sound_CreateOggVorbisDecoder(PHYSFS_file* PHYSFS_fileHandle, BOOL allowSeeking)
|
||||
struct OggVorbisDecoderState* sound_CreateOggVorbisDecoder(PHYSFS_file* PHYSFS_fileHandle, bool allowSeeking)
|
||||
{
|
||||
#ifndef WZ_NOSOUND
|
||||
int error;
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "lib/framework/frame.h"
|
||||
#include <physfs.h>
|
||||
|
||||
typedef struct
|
||||
struct soundDataBuffer
|
||||
{
|
||||
// the size of the data contained in *data (NOTE: this is *NOT* the size of *data itself)
|
||||
size_t size;
|
||||
|
@ -37,12 +37,12 @@ typedef struct
|
|||
|
||||
// the raw PCM data
|
||||
char* data;
|
||||
} soundDataBuffer;
|
||||
};
|
||||
|
||||
// Forward declaration so we can take pointers to this type
|
||||
struct OggVorbisDecoderState;
|
||||
|
||||
struct OggVorbisDecoderState* sound_CreateOggVorbisDecoder(PHYSFS_file* PHYSFS_fileHandle, BOOL allowSeeking);
|
||||
struct OggVorbisDecoderState* sound_CreateOggVorbisDecoder(PHYSFS_file* PHYSFS_fileHandle, bool allowSeeking);
|
||||
void sound_DestroyOggVorbisDecoder(struct OggVorbisDecoderState* decoder);
|
||||
|
||||
soundDataBuffer* sound_DecodeOggVorbis(struct OggVorbisDecoderState* decoder, size_t bufferSize);
|
||||
|
|
|
@ -53,9 +53,9 @@
|
|||
ALuint current_queue_sample = -1;
|
||||
#endif
|
||||
|
||||
static BOOL openal_initialized = false;
|
||||
static bool openal_initialized = false;
|
||||
|
||||
struct __audio_stream
|
||||
struct AUDIO_STREAM
|
||||
{
|
||||
#ifndef WZ_NOSOUND
|
||||
ALuint source; // OpenAL name of the sound source
|
||||
|
@ -71,14 +71,14 @@ struct __audio_stream
|
|||
size_t bufferSize;
|
||||
|
||||
// Linked list pointer
|
||||
struct __audio_stream *next;
|
||||
AUDIO_STREAM * next;
|
||||
};
|
||||
|
||||
typedef struct SAMPLE_LIST
|
||||
struct SAMPLE_LIST
|
||||
{
|
||||
struct AUDIO_SAMPLE *curr;
|
||||
struct SAMPLE_LIST *next;
|
||||
} SAMPLE_LIST;
|
||||
AUDIO_SAMPLE * curr;
|
||||
SAMPLE_LIST * next;
|
||||
};
|
||||
|
||||
static SAMPLE_LIST *active_samples = NULL;
|
||||
|
||||
|
@ -122,7 +122,7 @@ static void sound_RemoveSample(SAMPLE_LIST* previous, SAMPLE_LIST* to_remove)
|
|||
// =======================================================================================================================
|
||||
// =======================================================================================================================
|
||||
//
|
||||
BOOL sound_InitLibrary( void )
|
||||
bool sound_InitLibrary( void )
|
||||
{
|
||||
#ifndef WZ_NOSOUND
|
||||
int err;
|
||||
|
@ -408,7 +408,7 @@ void sound_Update()
|
|||
// =======================================================================================================================
|
||||
// =======================================================================================================================
|
||||
//
|
||||
BOOL sound_QueueSamplePlaying( void )
|
||||
bool sound_QueueSamplePlaying( void )
|
||||
{
|
||||
#ifndef WZ_NOSOUND
|
||||
ALenum state;
|
||||
|
@ -653,7 +653,7 @@ static bool sound_SetupChannel( AUDIO_SAMPLE *psSample )
|
|||
// =======================================================================================================================
|
||||
// =======================================================================================================================
|
||||
//
|
||||
BOOL sound_Play2DSample( TRACK *psTrack, AUDIO_SAMPLE *psSample, BOOL bQueued )
|
||||
bool sound_Play2DSample( TRACK *psTrack, AUDIO_SAMPLE *psSample, bool bQueued )
|
||||
{
|
||||
#ifndef WZ_NOSOUND
|
||||
ALfloat zero[3] = { 0.0, 0.0, 0.0 };
|
||||
|
@ -727,7 +727,7 @@ BOOL sound_Play2DSample( TRACK *psTrack, AUDIO_SAMPLE *psSample, BOOL bQueued )
|
|||
// =======================================================================================================================
|
||||
// =======================================================================================================================
|
||||
//
|
||||
BOOL sound_Play3DSample( TRACK *psTrack, AUDIO_SAMPLE *psSample )
|
||||
bool sound_Play3DSample( TRACK *psTrack, AUDIO_SAMPLE *psSample )
|
||||
{
|
||||
#ifndef WZ_NOSOUND
|
||||
ALfloat zero[3] = { 0.0, 0.0, 0.0 };
|
||||
|
@ -961,7 +961,7 @@ AUDIO_STREAM* sound_PlayStreamWithBuf(PHYSFS_file* fileHandle, float volume, voi
|
|||
* \post true if playing, false otherwise.
|
||||
*
|
||||
*/
|
||||
BOOL sound_isStreamPlaying(AUDIO_STREAM *stream)
|
||||
bool sound_isStreamPlaying(AUDIO_STREAM *stream)
|
||||
{
|
||||
#if !defined(WZ_NOSOUND)
|
||||
ALint state;
|
||||
|
@ -1423,7 +1423,7 @@ void sound_StopAll( void )
|
|||
// =======================================================================================================================
|
||||
// =======================================================================================================================
|
||||
//
|
||||
BOOL sound_SampleIsFinished( AUDIO_SAMPLE *psSample )
|
||||
bool sound_SampleIsFinished( AUDIO_SAMPLE *psSample )
|
||||
{
|
||||
#ifndef WZ_NOSOUND
|
||||
//~~~~~~~~~~
|
||||
|
|
|
@ -27,11 +27,11 @@
|
|||
|
||||
#define BUFFER_SIZE 2048
|
||||
|
||||
typedef struct _wzTrack
|
||||
struct WZ_TRACK
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
struct _wzTrack *next;
|
||||
} WZ_TRACK;
|
||||
WZ_TRACK * next;
|
||||
};
|
||||
|
||||
static WZ_TRACK *currentSong = NULL;
|
||||
static int numSongs = 0;
|
||||
|
|
|
@ -39,14 +39,14 @@ static TRACK *g_apTrack[MAX_TRACKS];
|
|||
static SDWORD g_iCurTracks = 0;
|
||||
|
||||
// flag set when system is active (for callbacks etc)
|
||||
static BOOL g_bSystemActive = false;
|
||||
static bool g_bSystemActive = false;
|
||||
static AUDIO_CALLBACK g_pStopTrackCallback = NULL;
|
||||
|
||||
//*
|
||||
// =======================================================================================================================
|
||||
// =======================================================================================================================
|
||||
//
|
||||
BOOL sound_Init()
|
||||
bool sound_Init()
|
||||
{
|
||||
g_iCurTracks = 0;
|
||||
if (!sound_InitLibrary())
|
||||
|
@ -67,7 +67,7 @@ BOOL sound_Init()
|
|||
// =======================================================================================================================
|
||||
// =======================================================================================================================
|
||||
//
|
||||
BOOL sound_Shutdown( void )
|
||||
bool sound_Shutdown( void )
|
||||
{
|
||||
// set inactive flag to prevent callbacks coming after shutdown
|
||||
g_bSystemActive = false;
|
||||
|
@ -79,7 +79,7 @@ BOOL sound_Shutdown( void )
|
|||
// =======================================================================================================================
|
||||
// =======================================================================================================================
|
||||
//
|
||||
BOOL sound_GetSystemActive( void )
|
||||
bool sound_GetSystemActive( void )
|
||||
{
|
||||
return g_bSystemActive;
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ BOOL sound_GetSystemActive( void )
|
|||
* \param audibleRadius the radius from the source of sound where it can be heard
|
||||
* \return a non-zero value representing the track id number when successful, zero when the file is not found or no more tracks can be loaded (i.e. the limit is reached)
|
||||
*/
|
||||
unsigned int sound_SetTrackVals(const char* fileName, BOOL loop, unsigned int volume, unsigned int audibleRadius)
|
||||
unsigned int sound_SetTrackVals(const char* fileName, bool loop, unsigned int volume, unsigned int audibleRadius)
|
||||
{
|
||||
unsigned int trackID;
|
||||
TRACK* psTrack;
|
||||
|
@ -187,7 +187,7 @@ void sound_CheckAllUnloaded( void )
|
|||
// =======================================================================================================================
|
||||
// =======================================================================================================================
|
||||
//
|
||||
BOOL sound_TrackLooped( SDWORD iTrack )
|
||||
bool sound_TrackLooped( SDWORD iTrack )
|
||||
{
|
||||
sound_CheckTrack( iTrack );
|
||||
return g_apTrack[iTrack]->bLoop;
|
||||
|
@ -207,7 +207,7 @@ SDWORD sound_GetNumPlaying( SDWORD iTrack )
|
|||
// =======================================================================================================================
|
||||
// =======================================================================================================================
|
||||
//
|
||||
BOOL sound_CheckTrack( SDWORD iTrack )
|
||||
bool sound_CheckTrack( SDWORD iTrack )
|
||||
{
|
||||
if ( iTrack < 0 || iTrack > g_iCurTracks - 1 )
|
||||
{
|
||||
|
@ -278,7 +278,7 @@ const char *sound_GetTrackName( SDWORD iTrack )
|
|||
// =======================================================================================================================
|
||||
// =======================================================================================================================
|
||||
//
|
||||
BOOL sound_Play2DTrack( AUDIO_SAMPLE *psSample, BOOL bQueued )
|
||||
bool sound_Play2DTrack( AUDIO_SAMPLE *psSample, bool bQueued )
|
||||
{
|
||||
TRACK *psTrack;
|
||||
|
||||
|
@ -296,7 +296,7 @@ BOOL sound_Play2DTrack( AUDIO_SAMPLE *psSample, BOOL bQueued )
|
|||
// =======================================================================================================================
|
||||
// =======================================================================================================================
|
||||
//
|
||||
BOOL sound_Play3DTrack( AUDIO_SAMPLE *psSample )
|
||||
bool sound_Play3DTrack( AUDIO_SAMPLE *psSample )
|
||||
{
|
||||
TRACK *psTrack;
|
||||
|
||||
|
|
|
@ -43,14 +43,14 @@
|
|||
/* typedefs
|
||||
*/
|
||||
|
||||
typedef BOOL (* AUDIO_CALLBACK) ( void *psObj );
|
||||
typedef struct __audio_stream AUDIO_STREAM;
|
||||
typedef bool (* AUDIO_CALLBACK) ( void *psObj );
|
||||
struct AUDIO_STREAM;
|
||||
|
||||
/* structs */
|
||||
|
||||
struct SIMPLE_OBJECT;
|
||||
|
||||
typedef struct AUDIO_SAMPLE
|
||||
struct AUDIO_SAMPLE
|
||||
{
|
||||
SDWORD iTrack; // ID number identifying a specific sound; currently (r1182) mapped in audio_id.c
|
||||
#ifndef WZ_NOSOUND
|
||||
|
@ -63,16 +63,16 @@ typedef struct AUDIO_SAMPLE
|
|||
#endif
|
||||
SDWORD x, y, z;
|
||||
float fVol; // computed volume of sample
|
||||
BOOL bFinishedPlaying;
|
||||
bool bFinishedPlaying;
|
||||
AUDIO_CALLBACK pCallback;
|
||||
SIMPLE_OBJECT * psObj;
|
||||
struct AUDIO_SAMPLE *psPrev;
|
||||
struct AUDIO_SAMPLE *psNext;
|
||||
} AUDIO_SAMPLE;
|
||||
AUDIO_SAMPLE * psPrev;
|
||||
AUDIO_SAMPLE * psNext;
|
||||
};
|
||||
|
||||
typedef struct TRACK
|
||||
struct TRACK
|
||||
{
|
||||
BOOL bLoop;
|
||||
bool bLoop;
|
||||
SDWORD iVol;
|
||||
SDWORD iAudibleRadius;
|
||||
SDWORD iTime; // duration in milliseconds
|
||||
|
@ -82,16 +82,16 @@ typedef struct TRACK
|
|||
ALuint iBufferName; // OpenAL name of the buffer
|
||||
#endif
|
||||
const char* fileName;
|
||||
} TRACK;
|
||||
};
|
||||
|
||||
/* functions
|
||||
*/
|
||||
|
||||
BOOL sound_Init(void);
|
||||
BOOL sound_Shutdown(void);
|
||||
bool sound_Init(void);
|
||||
bool sound_Shutdown(void);
|
||||
|
||||
TRACK * sound_LoadTrackFromFile(const char *fileName);
|
||||
unsigned int sound_SetTrackVals(const char* fileName, BOOL loop, unsigned int volume, unsigned int audibleRadius);
|
||||
unsigned int sound_SetTrackVals(const char* fileName, bool loop, unsigned int volume, unsigned int audibleRadius);
|
||||
void sound_ReleaseTrack( TRACK * psTrack );
|
||||
|
||||
void sound_StopTrack( AUDIO_SAMPLE *psSample );
|
||||
|
@ -99,22 +99,22 @@ void sound_PauseTrack( AUDIO_SAMPLE *psSample );
|
|||
void sound_UpdateSample( AUDIO_SAMPLE *psSample );
|
||||
void sound_CheckAllUnloaded( void );
|
||||
void sound_RemoveActiveSample( AUDIO_SAMPLE *psSample );
|
||||
BOOL sound_CheckTrack( SDWORD iTrack );
|
||||
bool sound_CheckTrack( SDWORD iTrack );
|
||||
|
||||
SDWORD sound_GetTrackTime( SDWORD iTrack );
|
||||
SDWORD sound_GetTrackAudibleRadius( SDWORD iTrack );
|
||||
SDWORD sound_GetTrackVolume( SDWORD iTrack );
|
||||
const char * sound_GetTrackName( SDWORD iTrack );
|
||||
|
||||
BOOL sound_TrackLooped( SDWORD iTrack );
|
||||
bool sound_TrackLooped( SDWORD iTrack );
|
||||
void sound_SetCallbackFunction( void * fn );
|
||||
|
||||
BOOL sound_Play2DTrack( AUDIO_SAMPLE *psSample, BOOL bQueued );
|
||||
BOOL sound_Play3DTrack( AUDIO_SAMPLE *psSample );
|
||||
bool sound_Play2DTrack( AUDIO_SAMPLE *psSample, bool bQueued );
|
||||
bool sound_Play3DTrack( AUDIO_SAMPLE *psSample );
|
||||
void sound_PlayWithCallback( AUDIO_SAMPLE *psSample, SDWORD iCurTime, AUDIO_CALLBACK pDoneFunc );
|
||||
void sound_FinishedCallback( AUDIO_SAMPLE *psSample );
|
||||
|
||||
BOOL sound_GetSystemActive( void );
|
||||
bool sound_GetSystemActive( void );
|
||||
SDWORD sound_GetTrackID( TRACK *psTrack );
|
||||
SDWORD sound_GetAvailableID( void );
|
||||
SDWORD sound_GetNumPlaying( SDWORD iTrack );
|
||||
|
@ -127,7 +127,7 @@ void sound_SetStoppedCallback( AUDIO_CALLBACK pStopTrackCallback );
|
|||
UDWORD sound_GetTrackTimeLastFinished( SDWORD iTrack );
|
||||
void sound_SetTrackTimeLastFinished( SDWORD iTrack, UDWORD iTime );
|
||||
|
||||
extern BOOL sound_isStreamPlaying(AUDIO_STREAM *stream);
|
||||
extern bool sound_isStreamPlaying(AUDIO_STREAM *stream);
|
||||
extern void sound_StopStream(AUDIO_STREAM* stream);
|
||||
extern void sound_PauseStream(AUDIO_STREAM* stream);
|
||||
extern void sound_ResumeStream(AUDIO_STREAM* stream);
|
||||
|
|
|
@ -28,14 +28,14 @@
|
|||
#include "track.h"
|
||||
#include "lib/framework/vector.h"
|
||||
|
||||
BOOL sound_InitLibrary( void );
|
||||
bool sound_InitLibrary( void );
|
||||
void sound_ShutdownLibrary( void );
|
||||
|
||||
void sound_FreeTrack( TRACK * psTrack );
|
||||
|
||||
BOOL sound_Play2DSample( TRACK * psTrack, AUDIO_SAMPLE * psSample,
|
||||
BOOL bQueued );
|
||||
BOOL sound_Play3DSample( TRACK * psTrack, AUDIO_SAMPLE * psSample );
|
||||
bool sound_Play2DSample( TRACK * psTrack, AUDIO_SAMPLE * psSample,
|
||||
bool bQueued );
|
||||
bool sound_Play3DSample( TRACK * psTrack, AUDIO_SAMPLE * psSample );
|
||||
void sound_StopSample(AUDIO_SAMPLE* psSample);
|
||||
void sound_PauseSample( AUDIO_SAMPLE * psSample );
|
||||
void sound_ResumeSample( AUDIO_SAMPLE * psSample );
|
||||
|
@ -44,11 +44,11 @@ AUDIO_STREAM* sound_PlayStream(PHYSFS_file* PHYSFS_fileHandle, float volume, voi
|
|||
|
||||
void sound_SetSampleFreq( AUDIO_SAMPLE * psSample, SDWORD iFreq );
|
||||
void sound_SetSampleVol( AUDIO_SAMPLE * psSample, SDWORD iVol,
|
||||
BOOL bScale3D );
|
||||
bool bScale3D );
|
||||
|
||||
int sound_GetNumSamples( void );
|
||||
BOOL sound_SampleIsFinished( AUDIO_SAMPLE * psSample );
|
||||
BOOL sound_QueueSamplePlaying( void );
|
||||
bool sound_SampleIsFinished( AUDIO_SAMPLE * psSample );
|
||||
bool sound_QueueSamplePlaying( void );
|
||||
|
||||
void sound_SetPlayerPos(Vector3f pos);
|
||||
void sound_SetPlayerOrientationVector(Vector3f forward, Vector3f up);
|
||||
|
|
|
@ -343,7 +343,7 @@ void barGraphDisplayTrough(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIE
|
|||
{
|
||||
SDWORD x0 = 0, y0 = 0, x1 = 0, y1 = 0; // Position of the bar
|
||||
SDWORD tx0 = 0, ty0 = 0, tx1 = 0, ty1 = 0; // Position of the trough
|
||||
BOOL showBar=true, showTrough=true;
|
||||
bool showBar=true, showTrough=true;
|
||||
W_BARGRAPH *psBGraph = (W_BARGRAPH *)psWidget;
|
||||
|
||||
/* figure out which way the bar graph fills */
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
|
||||
/* Initialise the button module */
|
||||
BOOL buttonStartUp(void)
|
||||
bool buttonStartUp(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ struct W_BUTTON : public WIDGET
|
|||
};
|
||||
|
||||
/* Initialise the button module */
|
||||
extern BOOL buttonStartUp(void);
|
||||
extern bool buttonStartUp(void);
|
||||
|
||||
/* Create a button widget data structure */
|
||||
extern W_BUTTON* buttonCreate(const W_BUTINIT* psInit);
|
||||
|
|
|
@ -546,7 +546,7 @@ void editBoxDisplay(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *
|
|||
enum iV_fonts CurrFontID;
|
||||
|
||||
#if CURSOR_BLINK
|
||||
BOOL blink;
|
||||
bool blink;
|
||||
#endif
|
||||
|
||||
psEdBox = (W_EDITBOX *)psWidget;
|
||||
|
|
|
@ -357,7 +357,7 @@ void formFree(W_FORM *psWidget)
|
|||
|
||||
|
||||
/* Add a widget to a form */
|
||||
BOOL formAddWidget(W_FORM *psForm, WIDGET *psWidget, W_INIT *psInit)
|
||||
bool formAddWidget(W_FORM *psForm, WIDGET *psWidget, W_INIT *psInit)
|
||||
{
|
||||
W_TABFORM *psTabForm;
|
||||
WIDGET **ppsList;
|
||||
|
@ -688,7 +688,7 @@ void formGetOrigin(W_FORM *psWidget, SDWORD *pXOrigin, SDWORD *pYOrigin)
|
|||
// So ONLY this routine was modified. Will have to modify the vert. tab
|
||||
// routine if we ever use it.
|
||||
// Choose a horizontal tab from a coordinate
|
||||
static BOOL formPickHTab(TAB_POS *psTabPos,
|
||||
static bool formPickHTab(TAB_POS *psTabPos,
|
||||
SDWORD x0, SDWORD y0,
|
||||
UDWORD width, UDWORD height, UDWORD gap,
|
||||
UDWORD number, SDWORD fx, SDWORD fy, unsigned maxTabsShown)
|
||||
|
@ -758,7 +758,7 @@ static BOOL formPickHTab(TAB_POS *psTabPos,
|
|||
|
||||
// NOTE: This routine is NOT modified to use the tab scroll buttons.
|
||||
// Choose a vertical tab from a coordinate
|
||||
static BOOL formPickVTab(TAB_POS *psTabPos,
|
||||
static bool formPickVTab(TAB_POS *psTabPos,
|
||||
SDWORD x0, SDWORD y0,
|
||||
UDWORD width, UDWORD height, UDWORD gap,
|
||||
UDWORD number, SDWORD fx, SDWORD fy)
|
||||
|
@ -800,7 +800,7 @@ static BOOL formPickVTab(TAB_POS *psTabPos,
|
|||
|
||||
|
||||
/* Find which tab is under a form coordinate */
|
||||
static BOOL formPickTab(W_TABFORM *psForm, UDWORD fx, UDWORD fy,
|
||||
static bool formPickTab(W_TABFORM *psForm, UDWORD fx, UDWORD fy,
|
||||
TAB_POS *psTabPos)
|
||||
{
|
||||
SDWORD x0,y0, x1,y1;
|
||||
|
|
|
@ -37,7 +37,7 @@ struct W_FORM : public WIDGET
|
|||
|
||||
void clicked(W_CONTEXT *, WIDGET_KEY key) { formClicked(this, key); }
|
||||
|
||||
BOOL disableChildren; ///< Disable all child widgets if true
|
||||
bool disableChildren; ///< Disable all child widgets if true
|
||||
UWORD Ax0,Ay0,Ax1,Ay1; ///< Working coords for animations.
|
||||
UDWORD animCount; ///< Animation counter.
|
||||
UDWORD startTime; ///< Animation start time
|
||||
|
@ -127,7 +127,7 @@ extern W_FORM* formCreate(const W_FORMINIT* psInit);
|
|||
extern void formFree(W_FORM *psWidget);
|
||||
|
||||
/* Add a widget to a form */
|
||||
extern BOOL formAddWidget(W_FORM *psForm, WIDGET *psWidget, W_INIT *psInit);
|
||||
extern bool formAddWidget(W_FORM *psForm, WIDGET *psWidget, W_INIT *psInit);
|
||||
|
||||
/* Return the widgets currently displayed by a form */
|
||||
extern WIDGET *formGetWidgets(W_FORM *psWidget);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue