- Assembly code is disabled when building with __APPLE__ defined, for now.

- If you aren't targeting x86, m_fixed.h only includes basicinlines.h now.
- Moved x64inlines.h into basicinlines.h.
- Replaced uses of __int64 with types from doomtype.h.
- The stop console command no longer ends single player games, just the demo
  that was being recorded.
- In C mode, the sc_man parser no longer allows multi-line string constants
  without using the \ character to preface the newline character. This makes
  it much easier to diagnose errors where you forget the closing quote of a
  string.
- Fixed: V_BreakLines() added the terminating '\0' to the last line of the
  input string.
- Added font as a parameter to V_BreakLines and removed its keepspace
  parameter, which was never passed as anything other than the default.


SVN r331 (trunk)
This commit is contained in:
Randy Heit 2006-09-19 23:25:51 +00:00
parent 73032c2f3d
commit 419724dd02
30 changed files with 327 additions and 565 deletions

View file

@ -22,7 +22,7 @@ DEBUGTARGET ?= zdoomgccd.exe
DEBUGOBJDIR ?= debugobj DEBUGOBJDIR ?= debugobj
RELEASEOBJDIR ?= releaseobj RELEASEOBJDIR ?= releaseobj
CCDV = @ccdv CCDV ?= @ccdv
RE2C = tools/re2c/re2c RE2C = tools/re2c/re2c
CPPFLAGS = -DWIN32 -D_WIN32 -D_WINDOWS -DHAVE_STRUPR -DHAVE_FILELENGTH -DI_DO_NOT_LIKE_BIG_DOWNLOADS -D__forceinline=inline -MMD -Izlib -IFLAC -Ijpeg-6b -Isrc -Isrc/win32 -Isrc/g_doom -Isrc/g_heretic -I src/g_hexen -Isrc/g_raven -Isrc/g_strife -Isrc/g_shared -Isrc/oplsynth -Isrc/sound CPPFLAGS = -DWIN32 -D_WIN32 -D_WINDOWS -DHAVE_STRUPR -DHAVE_FILELENGTH -DI_DO_NOT_LIKE_BIG_DOWNLOADS -D__forceinline=inline -MMD -Izlib -IFLAC -Ijpeg-6b -Isrc -Isrc/win32 -Isrc/g_doom -Isrc/g_heretic -I src/g_hexen -Isrc/g_raven -Isrc/g_strife -Isrc/g_shared -Isrc/oplsynth -Isrc/sound

View file

@ -1,3 +1,24 @@
September 19, 2006
- Assembly code is disabled when building with __APPLE__ defined, for now.
- If you aren't targeting x86, m_fixed.h only includes basicinlines.h now.
- Moved x64inlines.h into basicinlines.h.
- Replaced uses of __int64 with types from doomtype.h.
- The stop console command no longer ends single player games, just the demo
that was being recorded.
- In C mode, the sc_man parser no longer allows multi-line string constants
without using the \ character to preface the newline character. This makes
it much easier to diagnose errors where you forget the closing quote of a
string.
- Fixed: V_BreakLines() added the terminating '\0' to the last line of the
input string.
- Added font as a parameter to V_BreakLines and removed its keepspace
parameter, which was never passed as anything other than the default.
September 18, 2006
- Removed REGEXEPEEK. It was only there for a Dev-C++ project, and the Dev-C++
project was long ago removed, thanks to that particular IDE being so agonizingly
slow.
September 17, 2006 (Changes by Graf Zahl) September 17, 2006 (Changes by Graf Zahl)
- Fixed: Texture scale calculations for HIRESTEX were incorrect. - Fixed: Texture scale calculations for HIRESTEX were incorrect.
- Fixed: The sky scrolling calculations caused an integer multiplication overflow. - Fixed: The sky scrolling calculations caused an integer multiplication overflow.

View file

@ -32,21 +32,26 @@
** **
*/ */
#if defined(__GNUC__) && defined(_WIN32) #ifndef AUTOSEGS_H
#define AUTOSEGS_H
void InitAutoSegMarkers ();
#define REGEXEPEEK
#define REGMARKER(x) (*x)
typedef void **REGINFO;
#ifdef __GNUC__
#ifdef __MACH__
#define AREG_SECTION "__DATA,areg"
#define CREG_SECTION "__DATA,creg"
#define GREG_SECTION "__DATA,greg"
#define SREG_SECTION "__DATA,sreg"
#else #else
#define AREG_SECTION "areg"
#define CREG_SECTION "creg"
#define GREG_SECTION "greg"
#define SREG_SECTION "sreg"
#endif
#endif
#define REGMARKER(x) (x) #define REGMARKER(x) (x)
typedef void *REGINFO; typedef void *REGINFO;
#endif
// List of ActorInfos and the TypeInfos they belong to // List of ActorInfos and the TypeInfos they belong to
extern REGINFO ARegHead; extern REGINFO ARegHead;
extern REGINFO ARegTail; extern REGINFO ARegTail;
@ -63,13 +68,24 @@ extern REGINFO SRegTail;
extern REGINFO CRegHead; extern REGINFO CRegHead;
extern REGINFO CRegTail; extern REGINFO CRegTail;
template<class T, REGINFO *head, REGINFO *tail> template<class T, REGINFO *_head, REGINFO *_tail>
class TAutoSegIteratorNoArrow class TAutoSegIteratorNoArrow
{ {
public: public:
TAutoSegIteratorNoArrow () TAutoSegIteratorNoArrow ()
{ {
Probe = (T *)REGMARKER(head); // Weirdness. Mingw's linker puts these together backwards.
if (_head < _tail)
{
Head = _head;
Tail = _tail;
}
else
{
Head = _tail;
Tail = _head;
}
Probe = (T *)REGMARKER(Head);
} }
operator T () const operator T () const
{ {
@ -80,16 +96,18 @@ class TAutoSegIteratorNoArrow
do do
{ {
++Probe; ++Probe;
} while (*Probe == 0 && Probe < (T *)REGMARKER(tail)); } while (*Probe == 0 && Probe < (T *)REGMARKER(Tail));
return *this; return *this;
} }
void Reset () void Reset ()
{ {
Probe = (T *)REGMARKER(head); Probe = (T *)REGMARKER(Head);
} }
protected: protected:
T *Probe; T *Probe;
REGINFO *Head;
REGINFO *Tail;
}; };
template<class T, REGINFO *head, REGINFO *tail> template<class T, REGINFO *head, REGINFO *tail>
@ -101,3 +119,5 @@ class TAutoSegIterator : public TAutoSegIteratorNoArrow<T, head, tail>
return *(this->Probe); return *(this->Probe);
} }
}; };
#endif

View file

@ -83,73 +83,13 @@ void *SRegHead = 0;
#elif defined(__GNUC__) #elif defined(__GNUC__)
#ifndef _WIN32 void *ARegHead __attribute__((section(AREG_SECTION))) = 0;
void *ARegHead __attribute__((section("areg"))) = 0; void *CRegHead __attribute__((section(CREG_SECTION))) = 0;
void *CRegHead __attribute__((section("creg"))) = 0; void *GRegHead __attribute__((section(GREG_SECTION))) = 0;
void *GRegHead __attribute__((section("greg"))) = 0; void *SRegHead __attribute__((section(SREG_SECTION))) = 0;
void *SRegHead __attribute__((section("sreg"))) = 0;
#else
// I can't find any way to specify the order to link files with
// Dev C++, so when compiling with GCC under WIN32, I inspect
// the executable instead of letting the linker do all the work for
// me.
void **ARegHead;
void **CRegHead;
void **GRegHead;
void **SRegHead;
#endif
#elif #elif
#error Please fix autostart.cpp for your compiler #error Please fix autostart.cpp for your compiler
#endif #endif
#ifdef REGEXEPEEK
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <winnt.h>
struct AutoSegStuff
{
char name[IMAGE_SIZEOF_SHORT_NAME];
REGINFO *HeadPtr;
REGINFO *TailPtr;
};
static const AutoSegStuff Stuff[5] =
{
{ "areg", &ARegHead, &ARegTail },
{ "creg", &CRegHead, &CRegTail },
{ "greg", &GRegHead, &GRegTail },
{ "sreg", &SRegHead, &SRegTail },
};
void InitAutoSegMarkers ()
{
BYTE *module = (BYTE *)GetModuleHandle (NULL);
IMAGE_DOS_HEADER *dosHeader = (IMAGE_DOS_HEADER *)module;
IMAGE_NT_HEADERS *ntHeaders = (IMAGE_NT_HEADERS *)(module + dosHeader->e_lfanew);
IMAGE_SECTION_HEADER *sections = IMAGE_FIRST_SECTION (ntHeaders);
int i, j;
for (i = 0; i < 5; ++i)
{
for (j = 0; j < ntHeaders->FileHeader.NumberOfSections; ++j)
{
if (memcmp (sections[j].Name, Stuff[i].name, IMAGE_SIZEOF_SHORT_NAME) == 0)
{
*Stuff[i].HeadPtr = (REGINFO)(sections[j].VirtualAddress + module - 4);
*Stuff[i].TailPtr = (REGINFO)(sections[j].VirtualAddress + module + sections[j].Misc.VirtualSize);
break;
}
}
}
}
#endif

View file

@ -55,23 +55,10 @@ void *SRegTail = 0;
#elif defined(__GNUC__) #elif defined(__GNUC__)
#ifndef _WIN32 void *ARegTail __attribute__((section(AREG_SECTION))) = 0;
void *ARegTail __attribute__((section("areg"))) = 0; void *CRegTail __attribute__((section(CREG_SECTION))) = 0;
void *CRegTail __attribute__((section("creg"))) = 0; void *GRegTail __attribute__((section(GREG_SECTION))) = 0;
void *GRegTail __attribute__((section("greg"))) = 0; void *SRegTail __attribute__((section(SREG_SECTION))) = 0;
void *SRegTail __attribute__((section("sreg"))) = 0;
#else
// I can't find any way to specify the order to link files with
// Dev C++, so when compiling with GCC under WIN32, I inspect
// the executable instead of letting the linker do all the work for
// me.
void **ARegTail;
void **CRegTail;
void **GRegTail;
void **SRegTail;
#endif
#elif #elif

View file

@ -6,232 +6,206 @@
// source code release but is meant for use with any compiler and does not // source code release but is meant for use with any compiler and does not
// rely on any inline assembly. // rely on any inline assembly.
// //
// Some of the inline assembly has been turned into C code, because VC++
// is smart enough to produce code at least as good as Ken's inlines.
// The more used functions are still inline assembly, because they do
// things that can't really be done in C. (I consider this a bad thing,
// because VC++ has considerably poorer support for inline assembly than
// Watcom, so it's better to rely on its C optimizer to produce fast code.)
//
#include <string.h> #if _MSC_VER
#include <stddef.h> #pragma once
#endif
#define toint(f) ((int)(f)) #ifndef _MSC_VER
#define quickertoint(f) ((int)(f)) #define __forceinline inline
#endif
inline SDWORD Scale (SDWORD a, SDWORD b, SDWORD c) __forceinline SDWORD Scale (SDWORD a, SDWORD b, SDWORD c)
{ {
return (fixed_t)(((__int64) a * (__int64) b) / c); return (SDWORD)(((SQWORD)a*b)/c);
} }
inline SDWORD MulScale (SDWORD a, SDWORD b, SDWORD c) __forceinline SDWORD MulScale (SDWORD a, SDWORD b, SDWORD c)
{ {
return (fixed_t)(((__int64) a * (__int64) b) >> c); return (SDWORD)(((SQWORD)a*b)>>c);
} }
#define MAKECONSTMulScale(s) \ __forceinline SDWORD MulScale1 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 1); }
inline SDWORD MulScale##s (SDWORD a, SDWORD b) \ __forceinline SDWORD MulScale2 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 2); }
{ \ __forceinline SDWORD MulScale3 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 3); }
return (fixed_t)(((__int64) a * (__int64) b) >> s); \ __forceinline SDWORD MulScale4 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 4); }
} __forceinline SDWORD MulScale5 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 5); }
MAKECONSTMulScale(1) __forceinline SDWORD MulScale6 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 6); }
MAKECONSTMulScale(2) __forceinline SDWORD MulScale7 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 7); }
MAKECONSTMulScale(3) __forceinline SDWORD MulScale8 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 8); }
MAKECONSTMulScale(4) __forceinline SDWORD MulScale9 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 9); }
MAKECONSTMulScale(5) __forceinline SDWORD MulScale10 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 10); }
MAKECONSTMulScale(6) __forceinline SDWORD MulScale11 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 11); }
MAKECONSTMulScale(7) __forceinline SDWORD MulScale12 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 12); }
MAKECONSTMulScale(8) __forceinline SDWORD MulScale13 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 13); }
MAKECONSTMulScale(9) __forceinline SDWORD MulScale14 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 14); }
MAKECONSTMulScale(10) __forceinline SDWORD MulScale15 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 15); }
MAKECONSTMulScale(11) __forceinline SDWORD MulScale16 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 16); }
MAKECONSTMulScale(12) __forceinline SDWORD MulScale17 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 17); }
MAKECONSTMulScale(13) __forceinline SDWORD MulScale18 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 18); }
MAKECONSTMulScale(14) __forceinline SDWORD MulScale19 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 19); }
MAKECONSTMulScale(15) __forceinline SDWORD MulScale20 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 20); }
MAKECONSTMulScale(16) __forceinline SDWORD MulScale21 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 21); }
MAKECONSTMulScale(17) __forceinline SDWORD MulScale22 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 22); }
MAKECONSTMulScale(18) __forceinline SDWORD MulScale23 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 23); }
MAKECONSTMulScale(19) __forceinline SDWORD MulScale24 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 24); }
MAKECONSTMulScale(20) __forceinline SDWORD MulScale25 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 25); }
MAKECONSTMulScale(21) __forceinline SDWORD MulScale26 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 26); }
MAKECONSTMulScale(22) __forceinline SDWORD MulScale27 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 27); }
MAKECONSTMulScale(23) __forceinline SDWORD MulScale28 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 28); }
MAKECONSTMulScale(24) __forceinline SDWORD MulScale29 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 29); }
MAKECONSTMulScale(25) __forceinline SDWORD MulScale30 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 30); }
MAKECONSTMulScale(26) __forceinline SDWORD MulScale31 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 31); }
MAKECONSTMulScale(27) __forceinline SDWORD MulScale32 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 32); }
MAKECONSTMulScale(28)
MAKECONSTMulScale(29)
MAKECONSTMulScale(30)
MAKECONSTMulScale(31)
MAKECONSTMulScale(32)
#undef MAKECONSTMulScale
inline SDWORD DMulScale (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD s) __forceinline SDWORD DMulScale (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD s)
{ {
return (fixed_t)((((__int64) a * (__int64) b) + ((__int64) c * (__int64) d)) >> s); return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> s);
} }
#define MAKECONSTDMulScale(s) \ __forceinline SDWORD DMulScale1 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 1); }
inline SDWORD DMulScale##s (SDWORD a, SDWORD b, SDWORD c, SDWORD d) \ __forceinline SDWORD DMulScale2 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 2); }
{ \ __forceinline SDWORD DMulScale3 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 3); }
return (fixed_t)((((__int64) a * (__int64) b) + ((__int64) c * (__int64) d)) >> s); \ __forceinline SDWORD DMulScale4 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 4); }
} __forceinline SDWORD DMulScale5 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 5); }
__forceinline SDWORD DMulScale6 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 6); }
__forceinline SDWORD DMulScale7 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 7); }
__forceinline SDWORD DMulScale8 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 8); }
__forceinline SDWORD DMulScale9 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 9); }
__forceinline SDWORD DMulScale10 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 10); }
__forceinline SDWORD DMulScale11 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 11); }
__forceinline SDWORD DMulScale12 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 12); }
__forceinline SDWORD DMulScale13 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 13); }
__forceinline SDWORD DMulScale14 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 14); }
__forceinline SDWORD DMulScale15 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 15); }
__forceinline SDWORD DMulScale16 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 16); }
__forceinline SDWORD DMulScale17 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 17); }
__forceinline SDWORD DMulScale18 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 18); }
__forceinline SDWORD DMulScale19 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 19); }
__forceinline SDWORD DMulScale20 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 20); }
__forceinline SDWORD DMulScale21 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 21); }
__forceinline SDWORD DMulScale22 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 22); }
__forceinline SDWORD DMulScale23 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 23); }
__forceinline SDWORD DMulScale24 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 24); }
__forceinline SDWORD DMulScale25 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 25); }
__forceinline SDWORD DMulScale26 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 26); }
__forceinline SDWORD DMulScale27 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 27); }
__forceinline SDWORD DMulScale28 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 28); }
__forceinline SDWORD DMulScale29 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 29); }
__forceinline SDWORD DMulScale30 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 30); }
__forceinline SDWORD DMulScale31 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 31); }
__forceinline SDWORD DMulScale32 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 32); }
MAKECONSTDMulScale(1) __forceinline SDWORD TMulScale1 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 1); }
MAKECONSTDMulScale(2) __forceinline SDWORD TMulScale2 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 2); }
MAKECONSTDMulScale(3) __forceinline SDWORD TMulScale3 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 3); }
MAKECONSTDMulScale(4) __forceinline SDWORD TMulScale4 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 4); }
MAKECONSTDMulScale(5) __forceinline SDWORD TMulScale5 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 5); }
MAKECONSTDMulScale(6) __forceinline SDWORD TMulScale6 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 6); }
MAKECONSTDMulScale(7) __forceinline SDWORD TMulScale7 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 7); }
MAKECONSTDMulScale(8) __forceinline SDWORD TMulScale8 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 8); }
MAKECONSTDMulScale(9) __forceinline SDWORD TMulScale9 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 9); }
MAKECONSTDMulScale(10) __forceinline SDWORD TMulScale10 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 10); }
MAKECONSTDMulScale(11) __forceinline SDWORD TMulScale11 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 11); }
MAKECONSTDMulScale(12) __forceinline SDWORD TMulScale12 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 12); }
MAKECONSTDMulScale(13) __forceinline SDWORD TMulScale13 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 13); }
MAKECONSTDMulScale(14) __forceinline SDWORD TMulScale14 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 14); }
MAKECONSTDMulScale(15) __forceinline SDWORD TMulScale15 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 15); }
MAKECONSTDMulScale(16) __forceinline SDWORD TMulScale16 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 16); }
MAKECONSTDMulScale(17) __forceinline SDWORD TMulScale17 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 17); }
MAKECONSTDMulScale(18) __forceinline SDWORD TMulScale18 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 18); }
MAKECONSTDMulScale(19) __forceinline SDWORD TMulScale19 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 19); }
MAKECONSTDMulScale(20) __forceinline SDWORD TMulScale20 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 20); }
MAKECONSTDMulScale(21) __forceinline SDWORD TMulScale21 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 21); }
MAKECONSTDMulScale(22) __forceinline SDWORD TMulScale22 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 22); }
MAKECONSTDMulScale(23) __forceinline SDWORD TMulScale23 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 23); }
MAKECONSTDMulScale(24) __forceinline SDWORD TMulScale24 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 24); }
MAKECONSTDMulScale(25) __forceinline SDWORD TMulScale25 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 25); }
MAKECONSTDMulScale(26) __forceinline SDWORD TMulScale26 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 26); }
MAKECONSTDMulScale(27) __forceinline SDWORD TMulScale27 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 27); }
MAKECONSTDMulScale(28) __forceinline SDWORD TMulScale28 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 28); }
MAKECONSTDMulScale(29) __forceinline SDWORD TMulScale29 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 29); }
MAKECONSTDMulScale(30) __forceinline SDWORD TMulScale30 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 30); }
MAKECONSTDMulScale(31) __forceinline SDWORD TMulScale31 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 31); }
MAKECONSTDMulScale(32) __forceinline SDWORD TMulScale32 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 32); }
#undef MAKCONSTDMulScale
#define MAKECONSTTMulScale(s) \ __forceinline SDWORD BoundMulScale (SDWORD a, SDWORD b, SDWORD c)
inline SDWORD TMulScale##s (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) \
{ \
return (fixed_t)((((__int64) a * (__int64) b) + ((__int64) c * (__int64) d) \
+ ((__int64) e* (__int64) f)) >> s); \
}
MAKECONSTTMulScale(1)
MAKECONSTTMulScale(2)
MAKECONSTTMulScale(3)
MAKECONSTTMulScale(4)
MAKECONSTTMulScale(5)
MAKECONSTTMulScale(6)
MAKECONSTTMulScale(7)
MAKECONSTTMulScale(8)
MAKECONSTTMulScale(9)
MAKECONSTTMulScale(10)
MAKECONSTTMulScale(11)
MAKECONSTTMulScale(12)
MAKECONSTTMulScale(13)
MAKECONSTTMulScale(14)
MAKECONSTTMulScale(15)
MAKECONSTTMulScale(16)
MAKECONSTTMulScale(17)
MAKECONSTTMulScale(18)
MAKECONSTTMulScale(19)
MAKECONSTTMulScale(20)
MAKECONSTTMulScale(21)
MAKECONSTTMulScale(22)
MAKECONSTTMulScale(23)
MAKECONSTTMulScale(24)
MAKECONSTTMulScale(25)
MAKECONSTTMulScale(26)
MAKECONSTTMulScale(27)
MAKECONSTTMulScale(28)
MAKECONSTTMulScale(29)
MAKECONSTTMulScale(30)
MAKECONSTTMulScale(31)
MAKECONSTTMulScale(32)
#undef MAKECONSTTMulScale
inline SDWORD BoundMulScale (SDWORD a, SDWORD b, SDWORD c)
{ {
return 0xBadBeef; SQWORD x = ((SQWORD)a * b) >> c;
return x > 0x7FFFFFFFll ? 0x7FFFFFFF :
x < -0x80000000ll ? 0x80000000 :
(SDWORD)x;
} }
inline SDWORD DivScale (SDWORD a, SDWORD b, SDWORD c) inline SDWORD DivScale (SDWORD a, SDWORD b, SDWORD c)
{ {
return (fixed_t)((((__int64) a) << c) / b); return (SDWORD)(((SQWORD)a << c) / b);
} }
#define MAKECONSTDivScale(s) \ inline SDWORD DivScale1 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 1) / b); }
inline SDWORD DivScale##s (SDWORD a, SDWORD b) \ inline SDWORD DivScale2 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 2) / b); }
{ \ inline SDWORD DivScale3 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 3) / b); }
return (fixed_t)((((__int64) a) << s) / b); \ inline SDWORD DivScale4 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 4) / b); }
} inline SDWORD DivScale5 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 5) / b); }
inline SDWORD DivScale6 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 6) / b); }
inline SDWORD DivScale7 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 7) / b); }
inline SDWORD DivScale8 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 8) / b); }
inline SDWORD DivScale9 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 9) / b); }
inline SDWORD DivScale10 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 10) / b); }
inline SDWORD DivScale11 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 11) / b); }
inline SDWORD DivScale12 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 12) / b); }
inline SDWORD DivScale13 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 13) / b); }
inline SDWORD DivScale14 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 14) / b); }
inline SDWORD DivScale15 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 15) / b); }
inline SDWORD DivScale16 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 16) / b); }
inline SDWORD DivScale17 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 17) / b); }
inline SDWORD DivScale18 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 18) / b); }
inline SDWORD DivScale19 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 19) / b); }
inline SDWORD DivScale20 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 20) / b); }
inline SDWORD DivScale21 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 21) / b); }
inline SDWORD DivScale22 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 22) / b); }
inline SDWORD DivScale23 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 23) / b); }
inline SDWORD DivScale24 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 24) / b); }
inline SDWORD DivScale25 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 25) / b); }
inline SDWORD DivScale26 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 26) / b); }
inline SDWORD DivScale27 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 27) / b); }
inline SDWORD DivScale28 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 28) / b); }
inline SDWORD DivScale29 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 29) / b); }
inline SDWORD DivScale30 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 30) / b); }
inline SDWORD DivScale31 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 31) / b); }
inline SDWORD DivScale32 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 32) / b); }
MAKECONSTDivScale(1) __forceinline void clearbuf (void *buff, unsigned int count, SDWORD clear)
MAKECONSTDivScale(2)
MAKECONSTDivScale(3)
MAKECONSTDivScale(4)
MAKECONSTDivScale(5)
MAKECONSTDivScale(6)
MAKECONSTDivScale(7)
MAKECONSTDivScale(8)
MAKECONSTDivScale(9)
MAKECONSTDivScale(10)
MAKECONSTDivScale(11)
MAKECONSTDivScale(12)
MAKECONSTDivScale(13)
MAKECONSTDivScale(14)
MAKECONSTDivScale(15)
MAKECONSTDivScale(16)
MAKECONSTDivScale(17)
MAKECONSTDivScale(18)
MAKECONSTDivScale(19)
MAKECONSTDivScale(20)
MAKECONSTDivScale(21)
MAKECONSTDivScale(22)
MAKECONSTDivScale(23)
MAKECONSTDivScale(24)
MAKECONSTDivScale(25)
MAKECONSTDivScale(26)
MAKECONSTDivScale(27)
MAKECONSTDivScale(28)
MAKECONSTDivScale(29)
MAKECONSTDivScale(30)
MAKECONSTDivScale(31)
MAKECONSTDivScale(32)
#undef MAKECONSTDivScale
inline void clearbuf (void *buff, int count, SDWORD clear)
{ {
SDWORD *b2 = (SDWORD *)buff; SDWORD *b2 = (SDWORD *)buff;
while (count--) for (unsigned int i = 0; i != count; ++i)
*b2++ = clear; {
b2[i] = clear;
}
} }
inline void clearbufshort (void *buff, unsigned int count, WORD clear) __forceinline void clearbufshort (void *buff, unsigned int count, WORD clear)
{ {
if (!count)
return;
SWORD *b2 = (SWORD *)buff; SWORD *b2 = (SWORD *)buff;
if ((size_t)b2 & 2) for (unsigned int i = 0; i != count; ++i)
{ {
*b2++ = clear; b2[i] = clear;
if (--count == 0)
return;
} }
do
{
*b2++ = clear;
} while (--count);
} }
inline SDWORD ksgn (SDWORD a) __forceinline SDWORD ksgn (SDWORD a)
{ {
if (a < 0) return -1; if (a < 0) return -1;
else if (a > 0) return 1; else if (a > 0) return 1;
else return 0; else return 0;
} }
__forceinline int toint (float v)
{
return int(v);
}
__forceinline int quickertoint (float v)
{
return int(v);
}

View file

@ -576,11 +576,11 @@ void C_AddNotifyString (int printlevel, const char *source)
if (addtype == APPENDLINE && NotifyStrings[NUMNOTIFIES-1].PrintLevel == printlevel) if (addtype == APPENDLINE && NotifyStrings[NUMNOTIFIES-1].PrintLevel == printlevel)
{ {
FString str = NotifyStrings[NUMNOTIFIES-1].Text + source; FString str = NotifyStrings[NUMNOTIFIES-1].Text + source;
lines = V_BreakLines (width, str); lines = V_BreakLines (screen->Font, width, str);
} }
else else
{ {
lines = V_BreakLines (width, source); lines = V_BreakLines (screen->Font, width, source);
addtype = (addtype == APPENDLINE) ? NEWLINE : addtype; addtype = (addtype == APPENDLINE) ? NEWLINE : addtype;
} }

View file

@ -656,7 +656,7 @@ FProduction *ProdNeqStr (FStringProd *prod1, FStringProd *prod2)
FProduction *ProdXorDbl (FDoubleProd *prod1, FDoubleProd *prod2) FProduction *ProdXorDbl (FDoubleProd *prod1, FDoubleProd *prod2)
{ {
return NewDoubleProd ((double)((__int64)prod1->Value ^ (__int64)prod2->Value)); return NewDoubleProd ((double)((SQWORD)prod1->Value ^ (SQWORD)prod2->Value));
} }
//========================================================================== //==========================================================================
@ -667,7 +667,7 @@ FProduction *ProdXorDbl (FDoubleProd *prod1, FDoubleProd *prod2)
FProduction *ProdAndDbl (FDoubleProd *prod1, FDoubleProd *prod2) FProduction *ProdAndDbl (FDoubleProd *prod1, FDoubleProd *prod2)
{ {
return NewDoubleProd ((double)((__int64)prod1->Value & (__int64)prod2->Value)); return NewDoubleProd ((double)((SQWORD)prod1->Value & (SQWORD)prod2->Value));
} }
//========================================================================== //==========================================================================
@ -678,7 +678,7 @@ FProduction *ProdAndDbl (FDoubleProd *prod1, FDoubleProd *prod2)
FProduction *ProdOrDbl (FDoubleProd *prod1, FDoubleProd *prod2) FProduction *ProdOrDbl (FDoubleProd *prod1, FDoubleProd *prod2)
{ {
return NewDoubleProd ((double)((__int64)prod1->Value | (__int64)prod2->Value)); return NewDoubleProd ((double)((SQWORD)prod1->Value | (SQWORD)prod2->Value));
} }
//========================================================================== //==========================================================================
@ -689,7 +689,7 @@ FProduction *ProdOrDbl (FDoubleProd *prod1, FDoubleProd *prod2)
FProduction *ProdLAndDbl (FDoubleProd *prod1, FDoubleProd *prod2) FProduction *ProdLAndDbl (FDoubleProd *prod1, FDoubleProd *prod2)
{ {
return NewDoubleProd ((double)((__int64)prod1->Value && (__int64)prod2->Value)); return NewDoubleProd ((double)((SQWORD)prod1->Value && (SQWORD)prod2->Value));
} }
//========================================================================== //==========================================================================
@ -700,7 +700,7 @@ FProduction *ProdLAndDbl (FDoubleProd *prod1, FDoubleProd *prod2)
FProduction *ProdLOrDbl (FDoubleProd *prod1, FDoubleProd *prod2) FProduction *ProdLOrDbl (FDoubleProd *prod1, FDoubleProd *prod2)
{ {
return NewDoubleProd ((double)((__int64)prod1->Value || (__int64)prod2->Value)); return NewDoubleProd ((double)((SQWORD)prod1->Value || (SQWORD)prod2->Value));
} }

View file

@ -42,8 +42,9 @@
// Since this file is included by everything, it seems an appropriate place // Since this file is included by everything, it seems an appropriate place
// to check the NOASM/USEASM macros. // to check the NOASM/USEASM macros.
#if !defined(_M_IX86) && !defined(__i386__) #if (!defined(_M_IX86) && !defined(__i386__)) || defined(__APPLE__)
// The assembly code requires an x86 processor. // The assembly code requires an x86 processor.
// And needs to be tweaked for Mach-O before enabled on Macs.
#define NOASM #define NOASM
#endif #endif

View file

@ -195,7 +195,6 @@ void DHUDMessage::ScreenSizeChanged ()
void DHUDMessage::ResetText (const char *text) void DHUDMessage::ResetText (const char *text)
{ {
FFont *oldfont = screen->Font;
int width; int width;
if (HUDWidth != 0) if (HUDWidth != 0)
@ -212,9 +211,7 @@ void DHUDMessage::ResetText (const char *text)
V_FreeBrokenLines (Lines); V_FreeBrokenLines (Lines);
} }
screen->SetFont (Font); Lines = V_BreakLines (Font, width, (BYTE *)text);
Lines = V_BreakLines (width, (BYTE *)text);
NumLines = 0; NumLines = 0;
Width = 0; Width = 0;
@ -228,8 +225,6 @@ void DHUDMessage::ResetText (const char *text)
Width = MAX<int> (Width, Lines[NumLines].Width); Width = MAX<int> (Width, Lines[NumLines].Width);
} }
} }
screen->SetFont (oldfont);
} }
//============================================================================ //============================================================================

View file

@ -584,7 +584,7 @@ private:
if (CPlayer->LogText != NULL) if (CPlayer->LogText != NULL)
{ {
FBrokenLines *lines = V_BreakLines (272, CPlayer->LogText); FBrokenLines *lines = V_BreakLines (SmallFont2, 272, CPlayer->LogText);
for (i = 0; lines[i].Width >= 0; ++i) for (i = 0; lines[i].Width >= 0; ++i)
{ {
screen->DrawText (CR_UNTRANSLATED, left+24*xscale, top+(18+i*12)*yscale, screen->DrawText (CR_UNTRANSLATED, left+24*xscale, top+(18+i*12)*yscale,

View file

@ -114,6 +114,8 @@ typedef void (*voidfunc_)();
************* Non-Visual C++ macros ************ ************* Non-Visual C++ macros ************
************************************************/ ************************************************/
#include "autosegs.h"
#define DOOMEDNUMOF(actor) actor##ActorInfo.DoomEdNum #define DOOMEDNUMOF(actor) actor##ActorInfo.DoomEdNum
extern void ApplyActorDefault (int defnum, const char *datastr); extern void ApplyActorDefault (int defnum, const char *datastr);
@ -125,7 +127,7 @@ extern void ApplyActorDefault (int defnum, int dataint);
extern FActorInfo actor##ActorInfo; \ extern FActorInfo actor##ActorInfo; \
extern FActorInfo *actor##DefaultsReg; \ extern FActorInfo *actor##DefaultsReg; \
extern void actor##DefaultsConstructor(); \ extern void actor##DefaultsConstructor(); \
FActorInfo *actor##DefaultsReg __attribute__((section("areg"))) = &actor##ActorInfo; \ FActorInfo *actor##DefaultsReg __attribute__((section(AREG_SECTION))) = &actor##ActorInfo; \
FActorInfo actor##ActorInfo = { FActorInfo actor##ActorInfo = {
#define BEGIN_DEFAULTS_POST(actor,game,ednum,id) \ #define BEGIN_DEFAULTS_POST(actor,game,ednum,id) \
@ -142,14 +144,14 @@ extern void ApplyActorDefault (int defnum, int dataint);
#define AT_GAME_SET(ns) \ #define AT_GAME_SET(ns) \
extern void ns##_gs(); \ extern void ns##_gs(); \
voidfunc_ ns##_gsr __attribute__((section("greg"))) = ns##_gs; \ voidfunc_ ns##_gsr __attribute__((section(GREG_SECTION))) = ns##_gs; \
void ns##_gs () void ns##_gs ()
//typedef void (*speedfunc)(EGameSpeed); //typedef void (*speedfunc)(EGameSpeed);
#define AT_SPEED_SET(ns,varname) \ #define AT_SPEED_SET(ns,varname) \
extern void ns##_ss(EGameSpeed); \ extern void ns##_ss(EGameSpeed); \
void (*ns##_gsr)(EGameSpeed) __attribute__((section("sreg"))) = ns##_ss; \ void (*ns##_gsr)(EGameSpeed) __attribute__((section(SREG_SECTION))) = ns##_ss; \
void ns##_ss (EGameSpeed varname) void ns##_ss (EGameSpeed varname)
#endif #endif

View file

@ -12,9 +12,9 @@
#include <stdlib.h> #include <stdlib.h>
#include "doomtype.h" #include "doomtype.h"
#if defined(__GNUG__) #if defined(__GNUC__) && defined(__i386__)
#include "gccinlines.h" #include "gccinlines.h"
#elif defined(_MSC_VER) #elif defined(_MSC_VER) && defined(_M_IX86)
#include "mscinlines.h" #include "mscinlines.h"
#else #else
#include "basicinlines.h" #include "basicinlines.h"

View file

@ -983,7 +983,7 @@ static void M_ExtractSaveData (const FSaveGameNode *node)
memcpy (comment + timelen, pcomment, commentlen); memcpy (comment + timelen, pcomment, commentlen);
} }
comment[timelen+commentlen] = 0; comment[timelen+commentlen] = 0;
SaveComment = V_BreakLines (216*screen->GetWidth()/640/CleanXfac, comment); SaveComment = V_BreakLines (screen->Font, 216*screen->GetWidth()/640/CleanXfac, comment);
delete[] comment; delete[] comment;
delete[] time; delete[] time;
delete[] pcomment; delete[] pcomment;
@ -2921,7 +2921,7 @@ bool M_SaveLoadResponder (event_t *ev)
{ {
V_FreeBrokenLines (SaveComment); V_FreeBrokenLines (SaveComment);
} }
SaveComment = V_BreakLines (216*screen->GetWidth()/640/CleanXfac, workbuf); SaveComment = V_BreakLines (screen->Font, 216*screen->GetWidth()/640/CleanXfac, workbuf);
} }
break; break;
@ -3099,7 +3099,7 @@ void M_Drawer ()
BorderNeedRefresh = screen->GetPageCount (); BorderNeedRefresh = screen->GetPageCount ();
SB_state = screen->GetPageCount (); SB_state = screen->GetPageCount ();
FBrokenLines *lines = V_BreakLines (320, messageString); FBrokenLines *lines = V_BreakLines (screen->Font, 320, messageString);
y = 100; y = 100;
for (i = 0; lines[i].Width >= 0; i++) for (i = 0; lines[i].Width >= 0; i++)

View file

@ -18,10 +18,6 @@
#include <string.h> #include <string.h>
#include <stddef.h> #include <stddef.h>
#ifdef _M_X64
#include "x64inlines.h"
#else
#pragma warning (disable: 4035) #pragma warning (disable: 4035)
__forceinline SDWORD Scale (SDWORD a, SDWORD b, SDWORD c) __forceinline SDWORD Scale (SDWORD a, SDWORD b, SDWORD c)
@ -363,4 +359,3 @@ __forceinline int quickertoint (float v)
} }
#pragma warning (default: 4035) #pragma warning (default: 4035)
#endif

View file

@ -681,7 +681,7 @@ void P_StartConversation (AActor *npc, AActor *pc, bool facetalker, bool saveang
toSay = GStrings[dlgtext.GetChars()]; toSay = GStrings[dlgtext.GetChars()];
if (toSay==NULL) toSay = "Go away!"; // Ok, it's lame - but it doesn't look like an error to the player. ;) if (toSay==NULL) toSay = "Go away!"; // Ok, it's lame - but it doesn't look like an error to the player. ;)
} }
DialogueLines = V_BreakLines (screen->GetWidth()/CleanXfac-24*2, toSay); DialogueLines = V_BreakLines (screen->Font, screen->GetWidth()/CleanXfac-24*2, toSay);
// Fill out the possible choices // Fill out the possible choices
ShowGold = false; ShowGold = false;
@ -694,7 +694,7 @@ void P_StartConversation (AActor *npc, AActor *pc, bool facetalker, bool saveang
continue; continue;
} }
ShowGold |= reply->NeedsGold; ShowGold |= reply->NeedsGold;
reply->ReplyLines = V_BreakLines (320-50-10, reply->Reply); reply->ReplyLines = V_BreakLines (screen->Font, 320-50-10, reply->Reply);
for (j = 0; reply->ReplyLines[j].Width >= 0; ++j) for (j = 0; reply->ReplyLines[j].Width >= 0; ++j)
{ {
item.label = reply->ReplyLines[j].Text.LockBuffer(); item.label = reply->ReplyLines[j].Text.LockBuffer();

View file

@ -554,12 +554,27 @@ string:
{ {
cursor++; cursor++;
} }
else if (*cursor == '\r' && *(cursor + 1) == '\n')
{
cursor++; // convert CR-LF to simply LF
}
else if (*cursor == '"') else if (*cursor == '"')
{ {
break; break;
} }
if (*cursor == '\n') if (*cursor == '\n')
{ {
if (CMode)
{
if (!Escape || sc_StringLen == 0 || sc_String[sc_StringLen - 1] != '\\')
{
SC_ScriptError ("Unterminated string constant");
}
else
{
sc_StringLen--; // overwrite the \ character with \n
}
}
sc_Line++; sc_Line++;
sc_Crossed = true; sc_Crossed = true;
} }

View file

@ -151,12 +151,27 @@ string:
{ {
cursor++; cursor++;
} }
else if (*cursor == '\r' && *(cursor + 1) == '\n')
{
cursor++; // convert CR-LF to simply LF
}
else if (*cursor == '"') else if (*cursor == '"')
{ {
break; break;
} }
if (*cursor == '\n') if (*cursor == '\n')
{ {
if (CMode)
{
if (!Escape || sc_StringLen == 0 || sc_String[sc_StringLen - 1] != '\\')
{
SC_ScriptError ("Unterminated string constant");
}
else
{
sc_StringLen--; // overwrite the \ character with \n
}
}
sc_Line++; sc_Line++;
sc_Crossed = true; sc_Crossed = true;
} }

View file

@ -54,7 +54,7 @@ inline cycle_t GetClockCycle ()
#endif #endif
} }
#elif (defined __GNUG__) #elif defined(__GNUG__) && defined(__i386__)
typedef QWORD cycle_t; typedef QWORD cycle_t;

View file

@ -150,6 +150,10 @@ IndexType BinarySearchFlexible (IndexType max, const KeyType key, IndexType noIn
// Returns the minimum of a and b. // Returns the minimum of a and b.
//========================================================================== //==========================================================================
#ifdef MIN
#undef MIN
#endif
template<class T> template<class T>
inline inline
const T MIN (const T a, const T b) const T MIN (const T a, const T b)
@ -164,6 +168,10 @@ const T MIN (const T a, const T b)
// Returns the maximum of a and b. // Returns the maximum of a and b.
//========================================================================== //==========================================================================
#ifdef MAX
#undef MAX
#endif
template<class T> template<class T>
inline inline
const T MAX (const T a, const T b) const T MAX (const T a, const T b)

View file

@ -42,6 +42,7 @@ class FTexture;
enum EColorRange enum EColorRange
{ {
CR_UNDEFINED = -1,
CR_BRICK, CR_BRICK,
CR_TAN, CR_TAN,
CR_GRAY, CR_GRAY,

View file

@ -307,25 +307,18 @@ int FFont::StringWidth (const BYTE *string) const
// //
// Break long lines of text into multiple lines no longer than maxwidth pixels // Break long lines of text into multiple lines no longer than maxwidth pixels
// //
static void breakit (FBrokenLines *line, const BYTE *start, const BYTE *string, bool keepspace, FString &linecolor) static void breakit (FBrokenLines *line, FFont *font, const BYTE *start, const BYTE *stop, FString &linecolor)
{ {
// Leave out trailing white space
if (!keepspace)
{
while (string > start && isspace (*(string - 1)))
string--;
}
if (!linecolor.IsEmpty()) if (!linecolor.IsEmpty())
{ {
line->Text = TEXTCOLOR_ESCAPE; line->Text = TEXTCOLOR_ESCAPE;
line->Text += linecolor; line->Text += linecolor;
} }
line->Text.AppendCStrPart ((const char *)start, string - start); line->Text.AppendCStrPart ((const char *)start, stop - start);
line->Width = screen->Font->StringWidth (line->Text); line->Width = font->StringWidth (line->Text);
} }
FBrokenLines *V_BreakLines (int maxwidth, const BYTE *string, bool keepspace) FBrokenLines *V_BreakLines (FFont *font, int maxwidth, const BYTE *string)
{ {
FBrokenLines lines[128]; // Support up to 128 lines (should be plenty) FBrokenLines lines[128]; // Support up to 128 lines (should be plenty)
@ -333,7 +326,7 @@ FBrokenLines *V_BreakLines (int maxwidth, const BYTE *string, bool keepspace)
int i, c, w, nw; int i, c, w, nw;
FString lastcolor, linecolor; FString lastcolor, linecolor;
bool lastWasSpace = false; bool lastWasSpace = false;
int kerning = screen->Font->GetDefaultKerning (); int kerning = font->GetDefaultKerning ();
i = w = 0; i = w = 0;
@ -377,24 +370,19 @@ FBrokenLines *V_BreakLines (int maxwidth, const BYTE *string, bool keepspace)
lastWasSpace = false; lastWasSpace = false;
} }
nw = screen->Font->GetCharWidth (c); nw = font->GetCharWidth (c);
if ((w > 0 && w + nw > maxwidth) || c == '\n') if ((w > 0 && w + nw > maxwidth) || c == '\n')
{ // Time to break the line { // Time to break the line
if (!space) if (!space)
space = string - 1; space = string - 1;
lines[i].NLTerminated = (c == '\n'); breakit (&lines[i], font, start, space, linecolor);
breakit (&lines[i], start, space, keepspace, linecolor);
if (c == '\n') if (c == '\n')
{ {
// Why did I do it like this? Why? Oh why? lastcolor = ""; // Why, oh why, did I do it like this?
linecolor = lastcolor = "";
} }
else
{
linecolor = lastcolor; linecolor = lastcolor;
}
i++; i++;
w = 0; w = 0;
@ -417,20 +405,19 @@ FBrokenLines *V_BreakLines (int maxwidth, const BYTE *string, bool keepspace)
} }
} }
if (string - start > 1) // String here is pointing one character after the '\0'
if (i < 128 && --string - start > 1)
{ {
const BYTE *s = start; const BYTE *s = start;
while (s < string) while (s < string)
{ {
if (keepspace || !isspace (*s)) // If there is any non-white space in the remainder of the string, add it.
if (!isspace (*s++))
{ {
lines[i].NLTerminated = (*s == '\n'); breakit (&lines[i++], font, start, string, linecolor);
s++;
breakit (&lines[i++], start, string, keepspace, linecolor);
break; break;
} }
s++;
} }
} }

View file

@ -39,9 +39,7 @@
struct FBrokenLines struct FBrokenLines
{ {
short Width; int Width;
BYTE NLTerminated;
BYTE Pad;
FString Text; FString Text;
}; };
@ -73,9 +71,9 @@ struct FBrokenLines
#define TEXTCOLOR_NORMAL "\034-" #define TEXTCOLOR_NORMAL "\034-"
#define TEXTCOLOR_BOLD "\034+" #define TEXTCOLOR_BOLD "\034+"
FBrokenLines *V_BreakLines (int maxwidth, const BYTE *str, bool keepspace=false); FBrokenLines *V_BreakLines (FFont *font, int maxwidth, const BYTE *str);
void V_FreeBrokenLines (FBrokenLines *lines); void V_FreeBrokenLines (FBrokenLines *lines);
inline FBrokenLines *V_BreakLines (int maxwidth, const char *str, bool keepspace=false) inline FBrokenLines *V_BreakLines (FFont *font, int maxwidth, const char *str)
{ return V_BreakLines (maxwidth, (const BYTE *)str, keepspace); } { return V_BreakLines (font, maxwidth, (const BYTE *)str); }
#endif //__V_TEXT_H__ #endif //__V_TEXT_H__

View file

@ -188,6 +188,11 @@ void DCanvas::Clear (int left, int top, int right, int bottom, int color) const
int x, y; int x, y;
BYTE *dest; BYTE *dest;
if (left == right || top == bottom)
{
return;
}
assert (left < right); assert (left < right);
assert (top < bottom); assert (top < bottom);

View file

@ -832,7 +832,7 @@ int FWadCollection::CheckNumForName (const char *name, int space)
while (i != NULL_INDEX) while (i != NULL_INDEX)
{ {
if (*(__int64 *)&LumpInfo[i].name == *(__int64 *)&uname) if (*(QWORD *)&LumpInfo[i].name == *(QWORD *)&uname)
{ {
if (LumpInfo[i].namespc == space) break; if (LumpInfo[i].namespc == space) break;
// If the lump is from one of the special namespaces exclusive to Zips // If the lump is from one of the special namespaces exclusive to Zips
@ -864,7 +864,7 @@ int FWadCollection::CheckNumForName (const char *name, int space, int wadnum)
i = FirstLumpIndex[LumpNameHash (uname) % NumLumps]; i = FirstLumpIndex[LumpNameHash (uname) % NumLumps];
while (i != NULL_INDEX && while (i != NULL_INDEX &&
(*(__int64 *)&LumpInfo[i].name != *(__int64 *)&uname || (*(QWORD *)&LumpInfo[i].name != *(QWORD *)&uname ||
LumpInfo[i].namespc != space || LumpInfo[i].namespc != space ||
LumpInfo[i].wadnum != wadnum)) LumpInfo[i].wadnum != wadnum))
{ {
@ -1520,7 +1520,7 @@ int FWadCollection::FindLump (const char *name, int *lastlump, bool anyns)
while (lump_p < &LumpInfo[NumLumps]) while (lump_p < &LumpInfo[NumLumps])
{ {
if ((anyns || lump_p->namespc == ns_global) && if ((anyns || lump_p->namespc == ns_global) &&
*(__int64 *)&lump_p->name == *(__int64 *)&name8) *(QWORD *)&lump_p->name == *(QWORD *)&name8)
{ {
int lump = lump_p - &LumpInfo[0]; int lump = lump_p - &LumpInfo[0];
*lastlump = lump + 1; *lastlump = lump + 1;

View file

@ -731,7 +731,7 @@ int WI_DrawName(int y,const char * levelname, bool nomove=false)
if (!l) return 0; if (!l) return 0;
screen->SetFont(BigFont); screen->SetFont(BigFont);
FBrokenLines *lines = V_BreakLines(320, p); FBrokenLines *lines = V_BreakLines(BigFont, 320, p);
if (lines) if (lines)
{ {

View file

@ -557,10 +557,6 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE nothing, LPSTR cmdline, int n
} }
#endif #endif
#ifdef REGEXEPEEK
InitAutoSegMarkers ();
#endif
MainThread = INVALID_HANDLE_VALUE; MainThread = INVALID_HANDLE_VALUE;
DuplicateHandle (GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &MainThread, DuplicateHandle (GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &MainThread,
0, FALSE, DUPLICATE_SAME_ACCESS); 0, FALSE, DUPLICATE_SAME_ACCESS);

View file

@ -1,198 +0,0 @@
#if _MSC_VER
#pragma once
#endif
__forceinline SDWORD Scale (SDWORD a, SDWORD b, SDWORD c)
{
return (SDWORD)(((SQWORD)a*b)/c);
}
__forceinline SDWORD MulScale (SDWORD a, SDWORD b, SDWORD c)
{
return (SDWORD)(((SQWORD)a*b)>>c);
}
__forceinline SDWORD MulScale1 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 1); }
__forceinline SDWORD MulScale2 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 2); }
__forceinline SDWORD MulScale3 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 3); }
__forceinline SDWORD MulScale4 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 4); }
__forceinline SDWORD MulScale5 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 5); }
__forceinline SDWORD MulScale6 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 6); }
__forceinline SDWORD MulScale7 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 7); }
__forceinline SDWORD MulScale8 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 8); }
__forceinline SDWORD MulScale9 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 9); }
__forceinline SDWORD MulScale10 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 10); }
__forceinline SDWORD MulScale11 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 11); }
__forceinline SDWORD MulScale12 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 12); }
__forceinline SDWORD MulScale13 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 13); }
__forceinline SDWORD MulScale14 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 14); }
__forceinline SDWORD MulScale15 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 15); }
__forceinline SDWORD MulScale16 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 16); }
__forceinline SDWORD MulScale17 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 17); }
__forceinline SDWORD MulScale18 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 18); }
__forceinline SDWORD MulScale19 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 19); }
__forceinline SDWORD MulScale20 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 20); }
__forceinline SDWORD MulScale21 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 21); }
__forceinline SDWORD MulScale22 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 22); }
__forceinline SDWORD MulScale23 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 23); }
__forceinline SDWORD MulScale24 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 24); }
__forceinline SDWORD MulScale25 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 25); }
__forceinline SDWORD MulScale26 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 26); }
__forceinline SDWORD MulScale27 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 27); }
__forceinline SDWORD MulScale28 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 28); }
__forceinline SDWORD MulScale29 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 29); }
__forceinline SDWORD MulScale30 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 30); }
__forceinline SDWORD MulScale31 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 31); }
__forceinline SDWORD MulScale32 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 32); }
__forceinline SDWORD DMulScale (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD s)
{
return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> s);
}
__forceinline SDWORD DMulScale1 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 1); }
__forceinline SDWORD DMulScale2 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 2); }
__forceinline SDWORD DMulScale3 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 3); }
__forceinline SDWORD DMulScale4 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 4); }
__forceinline SDWORD DMulScale5 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 5); }
__forceinline SDWORD DMulScale6 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 6); }
__forceinline SDWORD DMulScale7 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 7); }
__forceinline SDWORD DMulScale8 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 8); }
__forceinline SDWORD DMulScale9 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 9); }
__forceinline SDWORD DMulScale10 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 10); }
__forceinline SDWORD DMulScale11 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 11); }
__forceinline SDWORD DMulScale12 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 12); }
__forceinline SDWORD DMulScale13 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 13); }
__forceinline SDWORD DMulScale14 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 14); }
__forceinline SDWORD DMulScale15 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 15); }
__forceinline SDWORD DMulScale16 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 16); }
__forceinline SDWORD DMulScale17 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 17); }
__forceinline SDWORD DMulScale18 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 18); }
__forceinline SDWORD DMulScale19 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 19); }
__forceinline SDWORD DMulScale20 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 20); }
__forceinline SDWORD DMulScale21 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 21); }
__forceinline SDWORD DMulScale22 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 22); }
__forceinline SDWORD DMulScale23 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 23); }
__forceinline SDWORD DMulScale24 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 24); }
__forceinline SDWORD DMulScale25 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 25); }
__forceinline SDWORD DMulScale26 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 26); }
__forceinline SDWORD DMulScale27 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 27); }
__forceinline SDWORD DMulScale28 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 28); }
__forceinline SDWORD DMulScale29 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 29); }
__forceinline SDWORD DMulScale30 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 30); }
__forceinline SDWORD DMulScale31 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 31); }
__forceinline SDWORD DMulScale32 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 32); }
__forceinline SDWORD TMulScale1 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 1); }
__forceinline SDWORD TMulScale2 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 2); }
__forceinline SDWORD TMulScale3 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 3); }
__forceinline SDWORD TMulScale4 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 4); }
__forceinline SDWORD TMulScale5 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 5); }
__forceinline SDWORD TMulScale6 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 6); }
__forceinline SDWORD TMulScale7 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 7); }
__forceinline SDWORD TMulScale8 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 8); }
__forceinline SDWORD TMulScale9 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 9); }
__forceinline SDWORD TMulScale10 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 10); }
__forceinline SDWORD TMulScale11 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 11); }
__forceinline SDWORD TMulScale12 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 12); }
__forceinline SDWORD TMulScale13 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 13); }
__forceinline SDWORD TMulScale14 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 14); }
__forceinline SDWORD TMulScale15 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 15); }
__forceinline SDWORD TMulScale16 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 16); }
__forceinline SDWORD TMulScale17 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 17); }
__forceinline SDWORD TMulScale18 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 18); }
__forceinline SDWORD TMulScale19 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 19); }
__forceinline SDWORD TMulScale20 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 20); }
__forceinline SDWORD TMulScale21 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 21); }
__forceinline SDWORD TMulScale22 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 22); }
__forceinline SDWORD TMulScale23 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 23); }
__forceinline SDWORD TMulScale24 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 24); }
__forceinline SDWORD TMulScale25 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 25); }
__forceinline SDWORD TMulScale26 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 26); }
__forceinline SDWORD TMulScale27 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 27); }
__forceinline SDWORD TMulScale28 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 28); }
__forceinline SDWORD TMulScale29 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 29); }
__forceinline SDWORD TMulScale30 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 30); }
__forceinline SDWORD TMulScale31 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 31); }
__forceinline SDWORD TMulScale32 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 32); }
__forceinline SDWORD BoundMulScale (SDWORD a, SDWORD b, SDWORD c)
{
SQWORD x = ((SQWORD)a * b) >> c;
return x > 0x7FFFFFFFll ? 0x7FFFFFFF :
x < -0x80000000ll ? 0x80000000 :
(SDWORD)x;
}
inline SDWORD DivScale (SDWORD a, SDWORD b, SDWORD c)
{
return (SDWORD)(((SQWORD)a << c) / b);
}
inline SDWORD DivScale1 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 1) / b); }
inline SDWORD DivScale2 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 2) / b); }
inline SDWORD DivScale3 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 3) / b); }
inline SDWORD DivScale4 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 4) / b); }
inline SDWORD DivScale5 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 5) / b); }
inline SDWORD DivScale6 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 6) / b); }
inline SDWORD DivScale7 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 7) / b); }
inline SDWORD DivScale8 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 8) / b); }
inline SDWORD DivScale9 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 9) / b); }
inline SDWORD DivScale10 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 10) / b); }
inline SDWORD DivScale11 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 11) / b); }
inline SDWORD DivScale12 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 12) / b); }
inline SDWORD DivScale13 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 13) / b); }
inline SDWORD DivScale14 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 14) / b); }
inline SDWORD DivScale15 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 15) / b); }
inline SDWORD DivScale16 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 16) / b); }
inline SDWORD DivScale17 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 17) / b); }
inline SDWORD DivScale18 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 18) / b); }
inline SDWORD DivScale19 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 19) / b); }
inline SDWORD DivScale20 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 20) / b); }
inline SDWORD DivScale21 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 21) / b); }
inline SDWORD DivScale22 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 22) / b); }
inline SDWORD DivScale23 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 23) / b); }
inline SDWORD DivScale24 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 24) / b); }
inline SDWORD DivScale25 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 25) / b); }
inline SDWORD DivScale26 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 26) / b); }
inline SDWORD DivScale27 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 27) / b); }
inline SDWORD DivScale28 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 28) / b); }
inline SDWORD DivScale29 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 29) / b); }
inline SDWORD DivScale30 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 30) / b); }
inline SDWORD DivScale31 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 31) / b); }
inline SDWORD DivScale32 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 32) / b); }
__forceinline void clearbuf (void *buff, unsigned int count, SDWORD clear)
{
SDWORD *b2 = (SDWORD *)buff;
for (unsigned int i = 0; i != count; ++i)
{
b2[i] = clear;
}
}
__forceinline void clearbufshort (void *buff, unsigned int count, WORD clear)
{
SWORD *b2 = (SWORD *)buff;
for (unsigned int i = 0; i != count; ++i)
{
b2[i] = clear;
}
}
__forceinline SDWORD ksgn (SDWORD a)
{
if (a < 0) return -1;
else if (a > 0) return 1;
else return 0;
}
__forceinline int toint (float v)
{
return int(v);
}
__forceinline int quickertoint (float v)
{
return int(v);
}

View file

@ -157,6 +157,10 @@
RelativePath=".\terrain.txt" RelativePath=".\terrain.txt"
> >
</File> </File>
<File
RelativePath=".\textcolors.txt"
>
</File>
<File <File
RelativePath=".\x11r6rgb.txt" RelativePath=".\x11r6rgb.txt"
> >

View file

@ -4763,10 +4763,6 @@
RelativePath=".\src\wi_stuff.h" RelativePath=".\src\wi_stuff.h"
> >
</File> </File>
<File
RelativePath=".\src\x64inlines.h"
>
</File>
<File <File
RelativePath=".\src\zstring.h" RelativePath=".\src\zstring.h"
> >